Example #1
0
 private void GamersResults_button_Click(object sender, EventArgs e)
 {
     Program.ResultsTable = new ResultsTable(Program.Information.ReadGamersResults(), Program.Information.ReadGamerNames());
     CreateNewForm newForm = new CreateNewForm(2);
 }
Example #2
0
        private void GameOver()
        {
            timer2.Stop();
            timer1.Stop();

            GameOver_Label.Visible = true;
            GameOver_Label.BringToFront();
            Restart_button.Visible = true;
            Restart_button.BringToFront();
            exit_button.Visible = true;
            exit_button.BringToFront();

            ////////////////////////////////////////////////////////////
            GamersResults_button.Left   += 7;
            GamersResults_button.Top    += 35;
            GamersResults_button.Visible = true;
            GamersResults_button.BringToFront();
            ////////////////////////////////////////////////////////////

            Program.ResultsTable = new ResultsTable(Program.Information.ReadGamersResults(), Program.Information.ReadGamerNames());

            if (Program.GamerScore == 0)
            {
                for (int i = 0; i < Program.NumberOfWinnersPlaces; i++)
                {
                    if (Program.ResultsTable.PlacesNames[i] == "Пусто")
                    {
                        Program.GamerPlace = i;

                        //if number == 1 this ↓ will create Form "AskGamerNameForm", and if number == 2 this ↓ will create Form "gamersResultsTableForm", for more information read class CreateNewForm
                        CreateNewForm nameForm = new CreateNewForm(1);
                        break;
                    }
                }
            }
            else
            {
                for (int i = 0; i < Program.ResultsTable.PlacesScores.Length; i++)
                {
                    if (Program.GamerScore > Program.ResultsTable.PlacesScores[i])
                    {
                        Program.GamerPlace = i;

                        //if number == 1 this ↓ will create Form "AskGamerNameForm", and if number == 2 this ↓ will create Form "gamersResultsTableForm", for more information read class CreateNewForm
                        CreateNewForm nameForm = new CreateNewForm(1);
                        break;
                    }
                    else if (Program.GamerScore == Program.ResultsTable.PlacesScores[i])
                    {
                        if (i < Program.ResultsTable.PlacesScores.Length - 1)
                        {
                            Program.GamerPlace = i + 1;

                            //if number == 1 this ↓ will create Form "AskGamerNameForm", and if number == 2 this ↓ will create Form "gamersResultsTableForm", for more information read class CreateNewForm
                            CreateNewForm nameForm = new CreateNewForm(1);
                            break;
                        }
                    }
                }
            }
        }