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 = 100;
        static int click = 1;
        double sol_b1 = 512;
        double sol_b2 = 1024;
        double sol_b3 = 2048;
        double sol_b4 = 4096;

        public MainWindow()
        {
            InitializeComponent();
            b1.Content = (sol_b1).ToString(); //
            b2.Content = (sol_b2).ToString(); // Вывод цены Upgrade для Points per click на кнопке 
            b3.Content = (sol_b3).ToString();
            b4.Content = (sol_b4).ToString();
            Update(ref point, ref click);
        }

        public void Update(ref long point, ref int click)
        {
            points.Content = "Points: " + point; // Вывод Points в первый label
            pps.Content = "Points for click: " + click; // Вывод Points per click во второй label
            
        }

        public void Image_MouseDown(object sender, MouseButtonEventArgs e)
        {
            MouseDownd_Update(ref point, ref click);
        }

        public long MouseDownd_Update(ref long point, ref int click)
        {
            point += click;
            Update(ref point, ref click);
            return point;
        }
        public void Upgrade3(object sender, RoutedEventArgs e)
        {
            B1_Upgrade3(ref point, ref click);
        }

        public long B1_Upgrade3(ref long point, ref int click)
        {
            if (point >= (sol_b1))
            {
                point -= Convert.ToInt64(Math.Round(sol_b1));
                click += 3;
                Update(ref point, ref click);
                return point + click;
            }
            return 0;
        }

        public void Upgrade9(object sender, RoutedEventArgs e)
        {
            B2_Upgrade9(ref point, ref click);
        }

        public long B2_Upgrade9(ref long point, ref int click)
        {
            if (point >= (sol_b2))
            {
                point -= Convert.ToInt64(Math.Round(sol_b2));
                click += 9;
                Update(ref point, ref click);
                return point + click;
            }
            return 0;
        }

        public void Upgrade27(object sender, RoutedEventArgs e)
        {
            B3_Upgrade27(ref point, ref click);
        }

        public long B3_Upgrade27(ref long point, ref int click)
        {
            if (point >= (sol_b3))
            {
                point -= Convert.ToInt64(Math.Round(sol_b3));
                click += 27;
                Update(ref point, ref click);
                return point + click;
            }
            return 0;
        }

        public void Upgrade100(object sender, RoutedEventArgs e)
        {
            B4_Upgrade100(ref point, ref click);
        }

        public long B4_Upgrade100(ref long point, ref int click)
        {
            if (point >= (sol_b4))
            {
                point -= Convert.ToInt64(Math.Round(sol_b4));
                click += 100;
                Update(ref point, ref click);
                return point + click;
            }
            return 0;
        }
    }
}
