Esempio n. 1
0
        private void ChangeLevel(Level newLevel)
        {
            Hide();
            var game = new GameForm(newLevel);

            game.ShowDialog();
        }
Esempio n. 2
0
        /// <summary>
        /// Label which opens up a new form with a game.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GameLabel_Click(object sender, EventArgs e)
        {
            var path1 = @"../../../player1.xml";
            var path2 = @"../../../player2.xml";

            if (File.Exists(path1) && File.Exists(path2))
            {
                if (MessageBox.Show("Would you like to continue the previous game?", "Save", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        var xml = new XmlParser();
                        player1 = xml.Deserialize(path1);
                        player2 = xml.Deserialize(path2);
                    }
                    catch (Exception)
                    {
                        MessageBox.Show("Your xml file was crashed!...");
                        return;
                    }
                    var gameForm = new GameForm(player1, player2);
                    gameForm.ShowDialog();
                }
                else
                {
                    if (player1 != null && player2 != null)
                    {
                        var gameForm = new GameForm(player1, player2);
                        gameForm.ShowDialog();
                        player1 = null;
                        player2 = null;
                    }
                    else
                    {
                        MessageBox.Show("You haven't chosen your heroes yet!");
                    }
                }
            }
            else
            {
                if (player1 != null && player2 != null)
                {
                    var gameForm = new GameForm(player1, player2);
                    gameForm.ShowDialog();
                    player1 = null;
                    player2 = null;
                }
                else
                {
                    MessageBox.Show("You haven't chosen your heroes yet!");
                }
            }
        }
Esempio n. 3
0
        public void button1_MouseClick(object sender, MouseEventArgs e)
        {
            try
            {
                GameForm game = new GameForm();
                this.Hide();
                game.ShowDialog();
                this.Close();

                /*
                 * if (lowEnd != null && highEnd != null)
                 * {
                 *  if (lowNumber < highNumber)
                 *  {
                 *
                 *  }
                 *
                 * }*/
            }
            catch (Exception ex)
            {
                txtrun.Text = (ex.Message);
            }
        }