示例#1
0
        public override void Update(GameTime gameTime)
        {
            GameObjectBase  obj;
            TouchCollection tc;

            base.Update(gameTime);

            // Update all the game objects
            _game.UpdateAll(gameTime);

            // Has the user touched the screen?
            tc = TouchPanel.GetState();
            if (tc.Count == 1 && tc[0].State == TouchLocationState.Pressed)
            {
                // Find the object at the touch point
                obj = _game.GetSpriteAtPoint(tc[0].Position);
                // Did we get a settings option object?
                if (obj is GameFramework.SettingsItemObject)
                {
                    // Yes, so toggle it to the next value
                    (obj as SettingsItemObject).SelectNextValue();
                }
                else if (obj is TextObject)
                {
                    // No, but see if this is a tagged object that we recognise
                    switch (obj.Tag)
                    {
                    case "Continue":
                        // Return to the game
                        _game.SetGameMode <Mode_Game>();
                        break;
                    }
                }
            }
        }
        public override void Update(GameTime gameTime)
        {
            base.Update(gameTime);

            TouchCollection tc;

            // Has the user touched the screen?
            tc = TouchPanel.GetState();
            if (tc.Count == 1 && tc[0].State == TouchLocationState.Pressed)
            {
                // Enter settings mode
                _game.SetGameMode <Mode_Settings>();
            }

            // Update all the game objects
            _game.UpdateAll(gameTime);
        }