MainWindow.xaml.cs 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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. public MainWindow()
  23. {
  24. InitializeComponent();
  25. }
  26. long point = 110;
  27. static int click = 1;
  28. double sol_b1 = 10 + 10 * (30 + click * 0.2);
  29. double sol_b2 = 20 + 20 * (60 + click * 0.4);
  30. double sol_b3 = 30 + 30 * (90 + click * 0.6);
  31. double sol_b4 = 40 + 40 * (120 + click * 0.8);
  32. public void Update()
  33. {
  34. poi.Content = "Points: " + point; // Вывод Points в первый label
  35. cli.Content = "Points for click: " + click; // Вывод Points per click во второй label
  36. b1.Content = (sol_b1).ToString(); // Вывод цены Upgrade для Points per click на кнопке
  37. b2.Content = (sol_b2).ToString();
  38. b3.Content = (sol_b3).ToString();
  39. b4.Content = (sol_b4).ToString();
  40. }
  41. private void Image_MouseDown(object sender, MouseButtonEventArgs e)
  42. {
  43. point += click;
  44. Update();
  45. }
  46. private void b1_Click(object sender, RoutedEventArgs e)
  47. {
  48. if (point >= (sol_b1))
  49. {
  50. point -= Convert.ToInt64(Math.Round(sol_b1));
  51. click += 3;
  52. Update();
  53. }
  54. }
  55. public int b1_test(long point, double sol_b1)
  56. {
  57. if (point >= (sol_b1))
  58. {
  59. point -= Convert.ToInt64(Math.Round(sol_b1));
  60. click += 3;
  61. Update();
  62. return click;
  63. }
  64. else
  65. {
  66. return click;
  67. }
  68. }
  69. private void b2_Click(object sender, RoutedEventArgs e)
  70. {
  71. if (point >= (sol_b2))
  72. {
  73. point -= Convert.ToInt64(Math.Round(sol_b2));
  74. click += 6;
  75. Update();
  76. }
  77. }
  78. public int b2_test(long point, double sol_b2)
  79. {
  80. for (int i = 0; i < 2; i++)
  81. {
  82. if (point >= (sol_b2))
  83. {
  84. point -= Convert.ToInt64(Math.Round(sol_b2));
  85. click += 6;
  86. Update();
  87. }
  88. }
  89. return click;
  90. }
  91. private void b3_Click(object sender, RoutedEventArgs e)
  92. {
  93. if (point >= (sol_b3))
  94. {
  95. point -= Convert.ToInt64(Math.Round(sol_b3));
  96. click += 9;
  97. Update();
  98. }
  99. }
  100. public int b3_test(long point, double sol_b2)
  101. {
  102. for (int i = 0; i < 2; i++)
  103. {
  104. if (point >= (sol_b2))
  105. {
  106. point -= Convert.ToInt64(Math.Round(sol_b2));
  107. click += 9;
  108. Update();
  109. }
  110. }
  111. return click;
  112. }
  113. private void b4_Click(object sender, RoutedEventArgs e)
  114. {
  115. if (point >= (sol_b4))
  116. {
  117. point -= Convert.ToInt64(Math.Round(sol_b4));
  118. click += 12;
  119. Update();
  120. }
  121. }
  122. public int b4_test(long point, double sol_b2)
  123. {
  124. for (int i = 0; i < 2; i++)
  125. {
  126. if (point >= (sol_b2))
  127. {
  128. point -= Convert.ToInt64(Math.Round(sol_b2));
  129. click += 12;
  130. Update();
  131. }
  132. }
  133. return click;
  134. }
  135. private void Button_Click(object sender, RoutedEventArgs e)
  136. {
  137. Application.Current.Shutdown();
  138. }
  139. }
  140. }