using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Clicker
{
    /// <summary>
    /// Логика взаимодействия для MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        long point = 311;
        static int click = 1;
        double sol_b1 = 10 + 10 * (30 + click * 0.2);
        double sol_b2 = 20 + 20 * (60 + click * 0.4);
        double sol_b3 = 30 + 20 * (40 + click * 0.7);
        double sol_b4 = 20 + 40 * (70 + click * 0.1);
        public MainWindow()
        {
            InitializeComponent();
        }

        public void Update()
        {
            poi.Content = "Points: " + point; // Вывод Points в первый label
            cli.Content = "Points for click: " + click; // Вывод Points per click во второй label
            click1.Content = (sol_b1).ToString(); //
            click2.Content = (sol_b2).ToString(); // Вывод цены Upgrade для Points per click на кнопке
            click3.Content = (sol_b3).ToString();
            click4.Content = (sol_b4).ToString();
        }

        private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
        {
            point = IncreasePoint(point, click);
            Update();
        }
        public long IncreasePoint(long point, int click)
        {
            return point += click;
        }

        private void click1_Click(object sender, RoutedEventArgs e)
        {
            if (point >= (sol_b1))
            {
                point -= Convert.ToInt64(Math.Round(sol_b1));
                click += 3;
                Update();
            }
        }

        private void click2_Click(object sender, RoutedEventArgs e)
        {
            point -= Convert.ToInt64(Math.Round(sol_b2));
            click += 5;
            Update();
        }

        private void click3_Click(object sender, RoutedEventArgs e)
        {
            point -= Convert.ToInt64(Math.Round(sol_b3));
            click += 8;
            Update();
        }

        private void click4_Click(object sender, RoutedEventArgs e)
        {
            if (point >= (sol_b4))
            {
                point -= Convert.ToInt64(Math.Round(sol_b4));
                click += 100;
                Update();
            }
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Application.Current.Shutdown();
        }
    }
}