Exemple #1
0
        public LeaderBoard()
        {
            InitializeComponent();

            this.WindowState     = FormWindowState.Maximized;
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.MaximizeBox     = false;
            this.MinimizeBox     = false;

            GameConfigurationManager gameConfig = new GameConfigurationManager();

            gameConfig.parseConfigurationFile();
            users = gameConfig.users;

            foreach (User user in users)
            {
                this.dataGridView1.Rows.Add(user.Name, user.Score);
            }

            this.dataGridView1.Sort(this.dataGridView1.Columns["Score"], ListSortDirection.Descending);
            this.dataGridView1.AllowUserToResizeColumns = false;
            this.dataGridView1.AllowUserToResizeRows    = false;

            foreach (DataGridViewColumn column in dataGridView1.Columns)
            {
                column.SortMode = DataGridViewColumnSortMode.NotSortable;
            }

            highScore.AutoSize  = false;
            highScore.TextAlign = ContentAlignment.MiddleCenter;
            highScore.Left      = (System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width / 2) - (highScore.Width / 2);

            dataGridView1.Height = (System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height - highScore.Height - highScore.Location.Y -
                                    dataGridView1.Location.Y - backBtn.Height - 50);
            dataGridView1.Top = (System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height / 2) - (dataGridView1.Height / 2);

            dataGridView1.Left = (System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width / 2) - (dataGridView1.Width / 2);

            backBtn.Left = (System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Width / 2) - (backBtn.Width / 2);
            backBtn.Top  = dataGridView1.Location.Y + dataGridView1.Height + 15;
        }
Exemple #2
0
        }//end of changeAI2

        private void gameOver()
        {
            timer1.Stop();

            Start.Enabled = true;

            //showing the explosion image on top of sleigh
            explosion.Visible = true;
            player.Controls.Add(explosion);
            explosion.Location  = new Point(-8, 5);
            explosion.BackColor = Color.Transparent;
            explosion.BringToFront();

            if (currentPlayer != null)
            {
                currentPlayer.Score = Score;
                // need to save to the leaderboard
                GameConfigurationManager newConfig = new GameConfigurationManager();
                newConfig.saveUserScore(currentPlayer);
            }
        }//end of gameOver