MainWindow.xaml.cs 3.4 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. public partial class MainWindow : Window
  18. {
  19. long point = 80;
  20. static int click = 1;
  21. double sol_b1 = 100;
  22. double sol_b2 = 250;
  23. double sol_b3 = 500;
  24. double sol_b4 = 1000;
  25. public MainWindow()
  26. {
  27. InitializeComponent();
  28. }
  29. public void Update(ref long point, ref int click)
  30. {
  31. poi.Content = "Points: " + point;
  32. cli.Content = "PpS: " + click;
  33. b1.Content = sol_b1.ToString();
  34. b2.Content = sol_b2.ToString();
  35. b3.Content = sol_b3.ToString();
  36. b4.Content = sol_b4.ToString();
  37. }
  38. public void main_image_MouseDown(object sender, MouseButtonEventArgs e)
  39. {
  40. MouseDownd_Update(ref point, ref click);
  41. }
  42. public long MouseDownd_Update(ref long point, ref int click)
  43. {
  44. point += click;
  45. Update(ref point, ref click);
  46. return point;
  47. }
  48. public void b1_Click(object sender, RoutedEventArgs e)
  49. {
  50. B1_Click_Update(ref point, ref click);
  51. }
  52. public long B1_Click_Update(ref long point, ref int click)
  53. {
  54. if (point >= (sol_b1))
  55. {
  56. point -= Convert.ToInt64(Math.Round(sol_b1));
  57. click += 3;
  58. Update(ref point, ref click);
  59. return point + click;
  60. }
  61. return 0;
  62. }
  63. public void b2_Click(object sender, RoutedEventArgs e)
  64. {
  65. B2_Click_Update(ref point, ref click);
  66. }
  67. public long B2_Click_Update(ref long point, ref int click)
  68. {
  69. if (point >= (sol_b2))
  70. {
  71. point -= Convert.ToInt64(Math.Round(sol_b2));
  72. click += 5;
  73. Update(ref point, ref click);
  74. return point + click;
  75. }
  76. return 0;
  77. }
  78. public void b3_Click(object sender, RoutedEventArgs e)
  79. {
  80. B3_Click_Update(ref point, ref click);
  81. }
  82. public long B3_Click_Update(ref long point, ref int click)
  83. {
  84. if (point >= (sol_b3))
  85. {
  86. point -= Convert.ToInt64(Math.Round(sol_b3));
  87. click += 7;
  88. Update(ref point, ref click);
  89. return point + click;
  90. }
  91. return 0;
  92. }
  93. public void b4_Click(object sender, RoutedEventArgs e)
  94. {
  95. B4_Click_Update(ref point, ref click);
  96. }
  97. public long B4_Click_Update(ref long point, ref int click)
  98. {
  99. if (point >= (sol_b4))
  100. {
  101. point -= Convert.ToInt64(Math.Round(sol_b4));
  102. click += 12;
  103. Update(ref point, ref click);
  104. return point+ click;
  105. }
  106. return 0;
  107. }
  108. private void exit_MouseDown(object sender, MouseButtonEventArgs e)
  109. {
  110. Application.Current.Shutdown();
  111. }
  112. }
  113. }