MainWindow.xaml.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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 WpfApp1
  16. {
  17. /// <summary>
  18. /// Логика взаимодействия для MainWindow.xaml
  19. /// </summary>
  20. public partial class MainWindow : Window
  21. {
  22. long point = 110;
  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. public MainWindow()
  27. {
  28. InitializeComponent();
  29. }
  30. public void Update()
  31. {
  32. Label1.Content="Points: " + point; // Вывод Points в первый label
  33. Label2.Content = "Points for click: " + click; // Вывод Points per click во второй label
  34. Button1.Content = (sol_b1).ToString(); //
  35. Button2.Content = (sol_b2).ToString(); // Вывод цены Upgrade для Points per click на кнопке
  36. }
  37. private void Image_MouseDown(object sender, MouseButtonEventArgs e)
  38. {
  39. point += click;
  40. Update();
  41. }
  42. private void Button1_Click(object sender, RoutedEventArgs e)
  43. {
  44. if (point >= (sol_b1))
  45. {
  46. point -= Convert.ToInt64(Math.Round(sol_b1));
  47. click += 3;
  48. Update();
  49. }
  50. }
  51. private void Button2_Click(object sender, RoutedEventArgs e)
  52. {
  53. if (point >= (sol_b2))
  54. {
  55. point -= Convert.ToInt64(Math.Round(sol_b2));
  56. click += 7;
  57. Update();
  58. }
  59. }
  60. private void Button_Click(object sender, RoutedEventArgs e)
  61. {
  62. Application.Current.Shutdown();
  63. }
  64. public bool Test(double sol_b1,double sol_b2)
  65. {
  66. if (sol_b1 == 312 && sol_b2 == 1228)
  67. {
  68. return true;
  69. }
  70. else { return false; }
  71. }
  72. }
  73. }