コード例 #1
0
 private void Die(object sender, EventArgs e)
 {
     finalScore = player.points;
     gameForm.Close();
     if (c < 2)
     {
         //MessageBox.Show(c.ToString());
         //MessageBox.Show("GAME OVER\nSCORE: " + finalScore.ToString());
     }
     c++;
 }
コード例 #2
0
        public WinnerForm(GameForm source)
        {
            InitializeComponent();
            ClientSize = new Size(500, 665);
            var table = new TableLayoutPanel();
            var label = new Label
            {
                Text   = "Congratulations! Level complete!",
                Dock   = DockStyle.Fill,
                Image  = animatedImage,
                Bounds = new Rectangle(0, 0, 500, 500)
            };

            var buttonNextLevel = new Button
            {
                Text   = "Next Level",
                Dock   = DockStyle.Fill,
                Bounds = new Rectangle(0, 500, 500, 50),
            };

            buttonNextLevel.Click += (sender, args) => { source.NextLevel(); source.Show(); Close(); };

            var buttonRepeat = new Button
            {
                Text   = "Repeat",
                Dock   = DockStyle.Fill,
                Bounds = new Rectangle(0, 550, 500, 50)
            };

            buttonRepeat.Click += (sender, args) => { source.RepeatLevel(); source.Show(); this.Close(); };

            var buttonQuit = new Button()
            {
                Text   = "Quit game",
                Dock   = DockStyle.Fill,
                Bounds = new Rectangle(0, 600, 500, 50)
            };

            buttonQuit.Click += (sender, args) => source.Close();

            table.RowStyles.Clear();
            table.Controls.Add(label);
            table.Controls.Add(buttonNextLevel);
            table.Controls.Add(buttonRepeat);
            table.Controls.Add(buttonQuit);
            table.Dock = DockStyle.Fill;

            Controls.Add(table);
        }