MainWindow.xaml.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. namespace Clicker
  16. {
  17. /// <summary>
  18. /// Логика взаимодействия для MainWindow.xaml
  19. /// </summary>
  20. public partial class MainWindow : Window
  21. {
  22. long point = 100;
  23. static int click = 1;
  24. double sol_b1 = 512;
  25. double sol_b2 = 1024;
  26. double sol_b3 = 2048;
  27. double sol_b4 = 4096;
  28. public MainWindow()
  29. {
  30. InitializeComponent();
  31. b1.Content = (sol_b1).ToString(); //
  32. b2.Content = (sol_b2).ToString(); // Вывод цены Upgrade для Points per click на кнопке
  33. b3.Content = (sol_b3).ToString();
  34. b4.Content = (sol_b4).ToString();
  35. Update(ref point, ref click);
  36. }
  37. public void Update(ref long point, ref int click)
  38. {
  39. points.Content = "Points: " + point; // Вывод Points в первый label
  40. pps.Content = "Points for click: " + click; // Вывод Points per click во второй label
  41. }
  42. public void Image_MouseDown(object sender, MouseButtonEventArgs e)
  43. {
  44. MouseDownd_Update(ref point, ref click);
  45. }
  46. public long MouseDownd_Update(ref long point, ref int click)
  47. {
  48. point += click;
  49. Update(ref point, ref click);
  50. return point;
  51. }
  52. public void Upgrade3(object sender, RoutedEventArgs e)
  53. {
  54. B1_Upgrade3(ref point, ref click);
  55. }
  56. public long B1_Upgrade3(ref long point, ref int click)
  57. {
  58. if (point >= (sol_b1))
  59. {
  60. point -= Convert.ToInt64(Math.Round(sol_b1));
  61. click += 3;
  62. Update(ref point, ref click);
  63. return point + click;
  64. }
  65. return 0;
  66. }
  67. public void Upgrade9(object sender, RoutedEventArgs e)
  68. {
  69. B2_Upgrade9(ref point, ref click);
  70. }
  71. public long B2_Upgrade9(ref long point, ref int click)
  72. {
  73. if (point >= (sol_b2))
  74. {
  75. point -= Convert.ToInt64(Math.Round(sol_b2));
  76. click += 9;
  77. Update(ref point, ref click);
  78. return point + click;
  79. }
  80. return 0;
  81. }
  82. public void Upgrade27(object sender, RoutedEventArgs e)
  83. {
  84. B3_Upgrade27(ref point, ref click);
  85. }
  86. public long B3_Upgrade27(ref long point, ref int click)
  87. {
  88. if (point >= (sol_b3))
  89. {
  90. point -= Convert.ToInt64(Math.Round(sol_b3));
  91. click += 27;
  92. Update(ref point, ref click);
  93. return point + click;
  94. }
  95. return 0;
  96. }
  97. public void Upgrade100(object sender, RoutedEventArgs e)
  98. {
  99. B4_Upgrade100(ref point, ref click);
  100. }
  101. public long B4_Upgrade100(ref long point, ref int click)
  102. {
  103. if (point >= (sol_b4))
  104. {
  105. point -= Convert.ToInt64(Math.Round(sol_b4));
  106. click += 100;
  107. Update(ref point, ref click);
  108. return point + click;
  109. }
  110. return 0;
  111. }
  112. }
  113. }