MainWindow.xaml.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. using System.Windows;
  2. using System.Windows.Input;
  3. namespace Clicker
  4. {
  5. public partial class MainWindow : Window
  6. {
  7. public long point = 0;
  8. public int click = 10;
  9. public int[] sol_b = new int[] { 100, 500, 1000, 1500 };//цены
  10. public int[] increased_b = new int[] { 10, 50, 100, 150 };//модификаторы
  11. public MainWindow() { InitializeComponent(); Update(); }
  12. public string Update()
  13. {
  14. helmets.Content = point.ToString();
  15. heat.Content = click.ToString();
  16. helmets2.Content = point.ToString();
  17. heat2.Content = click.ToString();
  18. B1.Content = "+" + increased_b[0].ToString() + " за\n" + sol_b[0].ToString() + " шлемов";
  19. B2.Content = "+" + increased_b[1].ToString() + " за\n" + sol_b[1].ToString() + " шлемов";
  20. B3.Content = "+" + increased_b[2].ToString() + " за\n" + sol_b[2].ToString() + " шлемов";
  21. B4.Content = "+" + increased_b[3].ToString() + " за\n" + sol_b[3].ToString() + " шлемов";
  22. return helmets.Content.ToString() + heat.Content.ToString() + helmets2.Content.ToString()
  23. + heat2.Content.ToString() + B1.Content + B2.Content + B3.Content + B4.Content;
  24. }
  25. private void Image_MouseDown(object sender, MouseButtonEventArgs e)
  26. { I_MD(ref point); Update(); }
  27. public long I_MD(ref long point) { return point += click; }
  28. private void Upgrade1(object sender, RoutedEventArgs e)
  29. { Upgrade(ref point, 0); Update(); }
  30. private void Upgrade2(object sender, RoutedEventArgs e)
  31. { Upgrade(ref point, 1); Update(); }
  32. private void Upgrade3(object sender, RoutedEventArgs e)
  33. { Upgrade(ref point, 2); Update(); }
  34. private void Upgrade4(object sender, RoutedEventArgs e)
  35. { Upgrade(ref point, 3); Update(); }
  36. public long Upgrade(ref long point, int i)
  37. {
  38. if (point >= sol_b[i])
  39. {
  40. point -= sol_b[i]; click += increased_b[i];
  41. return click;
  42. }
  43. return 0;
  44. }
  45. private void Exit(object sender, MouseButtonEventArgs e)
  46. { Application.Current.Shutdown(); }
  47. }
  48. }