MainWindow.xaml.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 WpfApp2
  16. {
  17. /// <summary>
  18. /// Логика взаимодействия для MainWindow.xaml
  19. /// </summary>
  20. public partial class MainWindow : Window
  21. {
  22. long point = 0;
  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. Update();
  30. }
  31. public void Update()
  32. {
  33. poi.Content = "Likes: " + point;
  34. cli.Content = "Likes per click: " + click;
  35. b1.Content = (sol_b1).ToString();
  36. b2.Content = (sol_b2).ToString();
  37. }
  38. private void Image_MouseDown(object sender, MouseButtonEventArgs e)
  39. {
  40. point += click;
  41. Update();
  42. }
  43. private void Button_Click(object sender, RoutedEventArgs e)
  44. {
  45. int p = Convert.ToInt32(point);
  46. click1(p);
  47. }
  48. private void Button_Click_1(object sender, RoutedEventArgs e)
  49. {
  50. int p = Convert.ToInt32(point);
  51. click2(p);
  52. }
  53. private void Button_Click_2(object sender, RoutedEventArgs e)
  54. {
  55. Application.Current.Shutdown();
  56. }
  57. public bool click1(int pi)
  58. {
  59. point = pi;
  60. if (point >= (sol_b1))
  61. {
  62. point -= Convert.ToInt64(Math.Round(sol_b1));
  63. click += 3;
  64. Update();
  65. return true;
  66. }
  67. else
  68. {
  69. return false;
  70. }
  71. }
  72. public bool click2(int pi)
  73. {
  74. point = pi;
  75. if (point >= (sol_b1))
  76. {
  77. point -= Convert.ToInt64(Math.Round(sol_b2));
  78. click += 15;
  79. Update();
  80. return true;
  81. }
  82. else
  83. {
  84. return false;
  85. }
  86. }
  87. }
  88. }