Exemplo n.º 1
0
        public override string GetPlayerName()
        {
            UserInputTextBox wizard = new UserInputTextBox("Please enter your name!");

            wizard.ShowDialog();
            string result = wizard.Value;

            wizard.Dispose();
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Triggered whenever the player clicks on the simulation to interact with the screen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void canvasBox_Click(object sender, EventArgs e)
        {
            if (Game.IsRunning())
            {
                int count = Game.Click(PointToClient(Cursor.Position));
                if (count > 0)
                {
                    Game.IncreaseScore(count);
                }
                else //if (Game.Score == 0)
                {
                    Game.DecreaseLifeCount();
                    if (Game.IsOver())
                    {
                        Game.Stop();
                        if (!Game.CheckScore(Game.Score))
                        {
                            MessageBox.Show("Better luck next time!");
                        }
                        else
                        {
                            UserInputTextBox wizard = new UserInputTextBox("Please enter your name!", "You got a high score!");
                            wizard.ShowDialog();
                            Game.SaveScore(new HighScore(wizard.Value, Game.Score));
                        }

                        FireworkToolkit.Gaming.MainMenu menu = new FireworkToolkit.Gaming.MainMenu(Game);
                        menu.ShowDialog();
                        if (!Game.IsRunning())
                        {
                            Dispose();
                        }
                    }
                }

                /*
                 * else
                 *  Game.DecreaseScore();
                 */
            }
        }