MainWindow.xaml.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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();
  33. b3.Content = sol_b3.ToString();
  34. b4.Content = sol_b4.ToString();
  35. Update();
  36. }
  37. public void Update()
  38. {
  39. points.Content = "Points: " + point;
  40. pps.Content = "Points for click: " + click;
  41. }
  42. public long Click1()
  43. {
  44. point += click;
  45. return point;
  46. }
  47. public long Click512()
  48. {
  49. if (point >= sol_b1)
  50. {
  51. point -= Convert.ToInt64(Math.Round(sol_b1));
  52. }
  53. return point;
  54. }
  55. public long Click1024()
  56. {
  57. if (point >= sol_b2)
  58. {
  59. point -= Convert.ToInt64(Math.Round(sol_b2));
  60. }
  61. return point;
  62. }
  63. public long Click2048()
  64. {
  65. if (point >= sol_b3)
  66. {
  67. point -= Convert.ToInt64(Math.Round(sol_b3));
  68. }
  69. return point;
  70. }
  71. public long Click4096()
  72. {
  73. if (point >= sol_b4)
  74. {
  75. point -= Convert.ToInt64(Math.Round(sol_b3));
  76. }
  77. return point;
  78. }
  79. private void Image_MouseDown(object sender, MouseButtonEventArgs e)
  80. {
  81. point += click;
  82. Update();
  83. }
  84. private void Upgrade3(object sender, RoutedEventArgs e)
  85. {
  86. if (point >= sol_b1)
  87. {
  88. point -= Convert.ToInt64(Math.Round(sol_b1));
  89. click += 3;
  90. Update();
  91. }
  92. }
  93. private void Upgrade9(object sender, RoutedEventArgs e)
  94. {
  95. if (point >= sol_b2)
  96. {
  97. point -= Convert.ToInt64(Math.Round(sol_b2));
  98. click += 9;
  99. Update();
  100. }
  101. }
  102. private void Upgrade27(object sender, RoutedEventArgs e)
  103. {
  104. if (point >= sol_b3)
  105. {
  106. point -= Convert.ToInt64(Math.Round(sol_b3));
  107. click += 27;
  108. Update();
  109. }
  110. }
  111. private void Upgrade100(object sender, RoutedEventArgs e)
  112. {
  113. if (point >= sol_b4)
  114. {
  115. point -= Convert.ToInt64(Math.Round(sol_b4));
  116. click += 100;
  117. Update();
  118. }
  119. }
  120. }
  121. }