示例#1
0
        private void RemoveMappings()
        {
            if (!hasMappings)
            {
                return;
            }

            hasMappings = false;

            KeyboardInputListener keyboardListener = Game.KeyboardListener;

            keyboardListener.RemoveMapping("Up");
            keyboardListener.RemoveMapping("Down");
            keyboardListener.RemoveMapping("Left");
            keyboardListener.RemoveMapping("Right");
            keyboardListener.RemoveMapping("Select");
        }
示例#2
0
        public override void Update(GameTime gameTime)
        {
            UpdateAlpha();

            if (alpha < 0)
            {
                fading = true;
            }

            if (alpha >= 255 && fading)
            {
                // Reset alpha ja fadetaan pois.
                alpha  = 255;
                fading = false;

                current = textures.FirstOrDefault();
                textures.Remove(current);

                if (current == null || skip)
                {
                    GameStateManager gameStateManager = Game.StateManager;

                    // Alustetaan transition.
                    Texture2D blank = Game.Content.Load <Texture2D>("blank");

                    Fade fadeIn  = new Fade(Color.Black, blank, new Rectangle(0, 0, 1280, 720), FadeType.In, 10, 10, alpha);
                    Fade fadeOut = new Fade(Color.Black, blank, new Rectangle(0, 0, 1280, 720), FadeType.Out, 10, 10, 255);

                    fadeOut.StateFininshed += (s, a) =>
                    {
                        gameStateManager.SwapStates();
                    };

                    // Alustetaan player.
                    TransitionPlayer player = new TransitionPlayer();
                    player.AddTransition(fadeOut);
                    player.AddTransition(fadeIn);

                    GameStateManager.ChangeState(new MainMenuState(), player);

                    keyboardListener.RemoveMapping("Skip");

                    if (gamepadListenenr != null)
                    {
                        gamepadListenenr.RemoveMapping("Skip");
                    }
                }
            }
        }