Exemplo n.º 1
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            UpdateAll(gameTime);

            // Has the user touched the screen?
            TouchCollection touches = TouchPanel.GetState();

            if (touches.Count == 1 && touches[0].State == TouchLocationState.Pressed)
            {
                // Make sure the input dialog is not already visible
                if (!(GameHelper.KeyboardInputIsVisible))
                {
                    // Show the input dialog to get text from the user
                    GameHelper.BeginShowKeyboardInput(_graphics, KeyboardInputComplete, "High score achieved", "Please enter your name!", "My name");
                }
            }

            base.Update(gameTime);
        }
Exemplo n.º 2
0
        public override void Activate()
        {
            base.Activate();

            // Clear any existing game objects
            GameObjects.Clear();

            // Did the player's score qualify?
            if (_game.HighScores.GetTable("Normal").ScoreQualifies(GetLatestScore()))
            {
                // Yes, so display the input dialog
                GameHelper.BeginShowKeyboardInput(_game._graphics, KeyboardInputCallback, "High score achieved", "Please enter your name", SettingsManager.GetValue("PlayerName", ""));
            }
            else
            {
                // Show the highscores now. No score added so nothing to highlight
                ResetHighscoreTableDisplay(null);
            }
        }