public void CheckIfWon()
 {
     if (!gamePlayBusiness.HiddenWord.Contains('_'))
     {
         CurrentUser.UpdatePoitAmount(points);
         string message2 = "You win " + points.ToString() + " poits! " +
                           "You are currently in place " + RankingController.GetPlayerPosition() + " overall"
         ;
         string            caption2 = "Success!";
         MessageBoxButtons buttons2 = MessageBoxButtons.OK;
         MessageBox.Show(message2, caption2, buttons2);
         this.Hide();
         var window = new Form1();
         window.ShowDialog();
         this.Close();
     }
 }
 public void CheckIfLost()
 {
     if (gamePlayBusiness.Mistakes == 9)
     {
         string            message2 = "You lose! " + "You are currently in place " + RankingController.GetPlayerPosition() + " overall";
         string            caption2 = "Opposite of success!";
         MessageBoxButtons buttons2 = MessageBoxButtons.OK;
         MessageBox.Show(message2, caption2, buttons2);
         this.Hide();
         var window = new Form1();
         window.ShowDialog();
         this.Close();
     }
 }
示例#3
0
        /// <summary>
        /// The method shows the top 10 players nad their points and the place of the current user overall
        /// </summary>
        /// <param name="topPlayers">Array of users containing the top 10 players.</param>
        /// <param name="place">integer conatining the overall position of the current user.</param>
        private void Ranking_Load(object sender, EventArgs e)
        {
            FormBorderStyle = FormBorderStyle.None;
            WindowState     = FormWindowState.Maximized;
            TopMost         = true;

            RankingController.Refresh();
            List <user> topPlayers = RankingController.GetTopPlayersList();
            int         counter    = 1;

            foreach (var item in topPlayers)
            {
                switch (item.Username.Length)
                {
                case 1: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + "               ->        " + item.PointAmount + " pts");
                    counter++;
                    break;

                case 2: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + "             ->        " + item.PointAmount + " pts");
                    counter++;
                    break;

                case 3: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + "            ->       " + item.PointAmount + " pts");
                    counter++;
                    break;

                case 4: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + "        ->        " + item.PointAmount + " pts");
                    counter++;
                    break;

                case 5: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + "       ->        " + item.PointAmount + " pts");
                    counter++;
                    break;

                case 6: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + "       ->        " + item.PointAmount + " pts");
                    counter++;
                    break;

                case 7: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + "    ->        " + item.PointAmount + " pts");
                    counter++;
                    break;

                case 8: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + "   ->       " + item.PointAmount + " pts");
                    counter++;
                    break;

                case 9: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + "  ->      " + item.PointAmount + " pts");
                    counter++;
                    break;

                case 10: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + "->     " + item.PointAmount + " pts");
                    counter++;
                    break;

                default: lBoxRanking.Items.Add(" #" + counter.ToString() + " " + item.Username + "  ->     " + item.PointAmount + " pts");
                    counter++;
                    break;
                }
            }
            int place = RankingController.GetPlayerPosition();

            lblShowPlace.Text = "You are number " + place.ToString() + " in the univerce";
            List <team> teams    = TeamBusiness.GetListOfTeams();
            int         counter2 = 1;

            foreach (var item in teams)
            {
                if (item.TeamId != 1)
                {
                    switch (item.TeamName.Length)
                    {
                    case 1:
                        lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + "               ->        " + item.TeamPointAmount + " pts");
                        counter2++;
                        break;

                    case 2:
                        lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + "             ->        " + item.TeamPointAmount + " pts");
                        counter2++;
                        break;

                    case 3:
                        lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + "            ->       " + item.TeamPointAmount + " pts");
                        counter2++;
                        break;

                    case 4:
                        lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + "        ->        " + item.TeamPointAmount + " pts");
                        counter2++;
                        break;

                    case 5:
                        lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + "       ->        " + item.TeamPointAmount + " pts");
                        counter2++;
                        break;

                    case 6:
                        lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + "       ->        " + item.TeamPointAmount + " pts");
                        counter2++;
                        break;

                    case 7:
                        lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + "    ->        " + item.TeamPointAmount + " pts");
                        counter2++;
                        break;

                    case 8:
                        lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + "   ->       " + item.TeamPointAmount + " pts");
                        counter2++;
                        break;

                    case 9:
                        lBoxRanking.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + "  ->      " + item.TeamPointAmount + " pts");
                        counter2++;
                        break;

                    case 10:
                        lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + "->     " + item.TeamPointAmount + " pts");
                        counter2++;
                        break;

                    default:
                        lbTeamsShow.Items.Add(" #" + counter2.ToString() + " " + item.TeamName + "  ->     " + item.TeamPointAmount + " pts");
                        counter2++;
                        break;
                    }
                }
            }
        }