using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace IZIworld
{
    public partial class game : Form
    {
        Thread th; // pentru a da lansa jocul 
        public game()
        {
            InitializeComponent();
        }

        int act = 1;
        int val = 0;
        int pwp = 1;

        int an = 2021;
        int ev = 70;

        private void button1_Click(object sender, EventArgs e)
        {
            if (act == 1)
            {
                an = an + 1000; 
                progressBar1.Value = 5; 
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t2;
                val = val + pwp;
                pwp = pwp * 2; 
            }

            else if (act == 2)
            {
                an = an + 50;
                ev = ev - 2; 
                progressBar1.Value = 10;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t3;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 3)
            {
                an = an - 500;
                ev = ev + 5; 
                progressBar1.Value = 15;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t4;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 4)
            {
                an = an - 100;
                ev = ev - 2;
                progressBar1.Value = 20;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t5;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 5)
            {
                an = an + 500;
                ev = ev - 5; 
                progressBar1.Value = 25;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t6;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 6)
            {
                an = an - 500;
                ev = ev - 6; 
                progressBar1.Value = 30;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t7;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 7)
            {
                an = an - 100;
                ev = ev - 2; 
                progressBar1.Value = 35;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t8;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 8)
            {
                progressBar1.Value = 40;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t9;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 9)
            {
                an = an + 50;
                ev = ev - 1;    
                progressBar1.Value = 45;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t10;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 10)
            {
                an = an + 100;
                ev = ev - 5;
                progressBar1.Value = 50;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t11;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 11)
            {
                an = an + 100;
                ev = ev - 4;
                progressBar1.Value = 55;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t12;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 12)
            {
                an = an + 300;
                ev = ev - 7;
                progressBar1.Value = 60;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t13;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 13)
            {
                an = an - 50;
                ev = ev - 5;
                progressBar1.Value = 65;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t14;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 14)
            {
                an = an - 100;
                ev = ev - 5;
                progressBar1.Value = 70;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t15;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 15)
            {
                ev = ev - 5;
                progressBar1.Value = 75;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t16;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 16)
            {
                an = an - 20;
                ev = ev - 1;
                progressBar1.Value = 80;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t17;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 17)
            {
                an = an + 10;
                ev = ev - 2;
                progressBar1.Value = 85;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t18;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 18)
            {
                an = an + 30;
                ev = ev + 2;
                progressBar1.Value = 90;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t19;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 19)
            {
                an = an + 200;
                ev = ev + 7;
                progressBar1.Value = 95;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t20;
                val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 20)
            {
                progressBar1.Value = 100;
                act = act + 1;
                //this.BackgroundImage = Properties.Resources.t2;
                val = val + pwp;
                pwp = pwp * 2;

                using (StreamWriter writer = new StreamWriter("pap.ini"))
                {
                    writer.Write(Convert.ToString(an));
                    writer.Close();
                }

                using (StreamWriter writer = new StreamWriter("pap2.ini"))
                {
                    writer.Write(Convert.ToString(ev));
                    writer.Close();
                }

                using (StreamWriter writer = new StreamWriter("pap3.ini"))
                {
                    writer.Write(Convert.ToString(val));
                    writer.Close();
                }

                this.Close();
                th = new Thread(usu1);
                th.SetApartmentState(ApartmentState.STA);
                th.Start();
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (act == 1)
            {
                ev = ev + 15; 
                progressBar1.Value = 5;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t2;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 2)
            {
                progressBar1.Value = 10;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t3;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 3)
            {
                progressBar1.Value = 15;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t4;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 4)
            {
                progressBar1.Value = 20;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t5;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 5)
            {
                progressBar1.Value = 25;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t6;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 6)
            {
                progressBar1.Value = 30;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t7;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 7)
            {
                progressBar1.Value = 35;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t8;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 8)
            {
                an = an + 100;
                ev = ev - 2; 
                progressBar1.Value = 40;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t9;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 9)
            {
                progressBar1.Value = 45;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t10;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 10)
            {
                progressBar1.Value = 50;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t11;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 11)
            {
                progressBar1.Value = 55;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t12;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 12)
            {
                progressBar1.Value = 60;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t13;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 13)
            {
                progressBar1.Value = 65;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t14;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 14)
            {
                progressBar1.Value = 70;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t15;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 15)
            {
                progressBar1.Value = 75;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t16;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 16)
            {
                progressBar1.Value = 80;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t17;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 17)
            {
                progressBar1.Value = 85;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t18;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 18)
            {
                progressBar1.Value = 90;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t19;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 19)
            {
                progressBar1.Value = 95;
                act = act + 1;
                this.BackgroundImage = Properties.Resources.t20;
                //val = val + pwp;
                pwp = pwp * 2;
            }

            else if (act == 20)
            {
                progressBar1.Value = 100;
                act = act + 1;
                //this.BackgroundImage = Properties.Resources.t2;
                val = val + pwp;
                pwp = pwp * 2;

                using (StreamWriter writer = new StreamWriter("pap.ini"))
                {
                    writer.Write(Convert.ToString(an));
                    writer.Close();
                }

                using (StreamWriter writer = new StreamWriter("pap2.ini"))
                {
                    writer.Write(Convert.ToString(ev));
                    writer.Close();
                }

                using (StreamWriter writer = new StreamWriter("pap3.ini"))
                {
                    writer.Write(Convert.ToString(val));
                    writer.Close();
                }

                this.Close();
                th = new Thread(usu1);
                th.SetApartmentState(ApartmentState.STA);
                th.Start();
            }
        }

        private void progressBar1_Click(object sender, EventArgs e)
        {

        }

        private void usu1(object obj)
        {
            Application.Run(new final());
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (act == 1)
                System.Diagnostics.Process.Start("https://en.wikipedia.org/wiki/Control_of_fire_by_early_humans");

            else if (act == 2)
                System.Diagnostics.Process.Start("https://en.wikipedia.org/wiki/Socrates");

            else if (act == 3)
                System.Diagnostics.Process.Start("https://ro.wikipedia.org/wiki/Imperiul_Roman");

            else if (act == 4)
                System.Diagnostics.Process.Start("https://ro.wikipedia.org/wiki/Papa_Grigore_I_cel_Mare");

            else if (act == 5)
                System.Diagnostics.Process.Start("https://en.wikipedia.org/wiki/Banknote");

            else if (act == 6)
                System.Diagnostics.Process.Start("https://ro.wikipedia.org/wiki/Cristofor_Columb");

            else if (act == 7)
                System.Diagnostics.Process.Start("https://ro.wikipedia.org/wiki/Revolu%C8%9Bia_industrial%C4%83");

            else if (act == 8)
                System.Diagnostics.Process.Start("https://ro.wikipedia.org/wiki/Revolu%C8%9Bia_American%C4%83");

            else if (act == 9)
                System.Diagnostics.Process.Start("https://ro.wikipedia.org/wiki/Comer%C8%9Bul_transatlantic_cu_sclavi");

            else if (act == 10)
                System.Diagnostics.Process.Start("https://ro.wikipedia.org/wiki/Alfred_Nobel");

            else if (act == 11)
                System.Diagnostics.Process.Start("https://ro.wikipedia.org/wiki/Plastic");

            else if (act == 12)
                System.Diagnostics.Process.Start("https://ro.wikipedia.org/wiki/Istoria_avia%C8%9Biei");

            else if (act == 13)
                System.Diagnostics.Process.Start("https://ro.wikipedia.org/wiki/Franz_Ferdinand_al_Austriei");

            else if (act == 14)
                System.Diagnostics.Process.Start("https://ro.wikipedia.org/wiki/Sputnik");

            else if (act == 15)
                System.Diagnostics.Process.Start("https://ro.wikipedia.org/wiki/Uniunea_European%C4%83");

            else if (act == 16)
                System.Diagnostics.Process.Start("https://ro.wikipedia.org/wiki/Internet");

            else if (act == 17)
                System.Diagnostics.Process.Start("https://ro.wikipedia.org/wiki/Atentatele_din_11_septembrie_2001");

            else if (act == 18)
                System.Diagnostics.Process.Start("https://ro.wikipedia.org/wiki/IPhone");

            else if (act == 19)
                System.Diagnostics.Process.Start("https://ro.wikipedia.org/wiki/R%C4%83zboiul_Civil_Sirian");

            else if (act == 20)
                System.Diagnostics.Process.Start("https://ro.wikipedia.org/wiki/Politic%C4%83");
        }
    }
}
