MainWindow.xaml.cs 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 = 311;
  23. static int click = 1;
  24. double sol_b1 = 10 + 10 * (30 + click * 0.2);
  25. double sol_b2 = 20 + 20 * (60 + click * 0.4);
  26. double sol_b3 = 30 + 20 * (40 + click * 0.7);
  27. double sol_b4 = 20 + 40 * (70 + click * 0.1);
  28. public MainWindow()
  29. {
  30. InitializeComponent();
  31. }
  32. public void Update()
  33. {
  34. poi.Content = "Points: " + point; // Вывод Points в первый label
  35. cli.Content = "Points for click: " + click; // Вывод Points per click во второй label
  36. click1.Content = (sol_b1).ToString(); //
  37. click2.Content = (sol_b2).ToString(); // Вывод цены Upgrade для Points per click на кнопке
  38. click3.Content = (sol_b3).ToString();
  39. click4.Content = (sol_b4).ToString();
  40. }
  41. private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
  42. {
  43. point = IncreasePoint(point, click);
  44. Update();
  45. }
  46. public long IncreasePoint(long point, int click)
  47. {
  48. return point += click;
  49. }
  50. private void click1_Click(object sender, RoutedEventArgs e)
  51. {
  52. if (point >= (sol_b1))
  53. {
  54. point -= Convert.ToInt64(Math.Round(sol_b1));
  55. click += 3;
  56. Update();
  57. }
  58. }
  59. private void click2_Click(object sender, RoutedEventArgs e)
  60. {
  61. point -= Convert.ToInt64(Math.Round(sol_b2));
  62. click += 5;
  63. Update();
  64. }
  65. private void click3_Click(object sender, RoutedEventArgs e)
  66. {
  67. point -= Convert.ToInt64(Math.Round(sol_b3));
  68. click += 8;
  69. Update();
  70. }
  71. private void click4_Click(object sender, RoutedEventArgs e)
  72. {
  73. if (point >= (sol_b4))
  74. {
  75. point -= Convert.ToInt64(Math.Round(sol_b4));
  76. click += 100;
  77. Update();
  78. }
  79. }
  80. private void Button_Click(object sender, RoutedEventArgs e)
  81. {
  82. Application.Current.Shutdown();
  83. }
  84. }
  85. }