Пример #1
0
        /// <summary>
        /// Constructs a new screen manager component.
        /// </summary>
        public GameScreenManager(Game game)
            : base(game)
        {
            scene2DFadeRoot = FrameworkCore.Scene2DFadeLayer;
            fadeSprite      = new GameSprite2D();

            scene2DFadeRoot.AddChild(fadeSprite);

            //  Controller
            screenInput[0] = new GameScreenInput(PlayerIndex.One);
            screenInput[1] = new GameScreenInput(PlayerIndex.Two);
            screenInput[2] = new GameScreenInput(PlayerIndex.Three);
            screenInput[3] = new GameScreenInput(PlayerIndex.Four);
        }
Пример #2
0
        /// <summary>
        /// Constructs a new screen manager component.
        /// </summary>
        public GameScreenManager(Game game)
            : base(game)
        {
            scene2DFadeRoot = FrameworkCore.Scene2DFadeLayer;
            fadeSprite = new GameSprite2D();

            scene2DFadeRoot.AddChild(fadeSprite);

            //  Controller
            screenInput[0] = new GameScreenInput(PlayerIndex.One);
            screenInput[1] = new GameScreenInput(PlayerIndex.Two);
            screenInput[2] = new GameScreenInput(PlayerIndex.Three);
            screenInput[3] = new GameScreenInput(PlayerIndex.Four);
        }
Пример #3
0
        /// <summary>
        /// Responds to user input, changing the selected entry and accepting
        /// or cancelling the menu.
        /// </summary>
        public override void HandleInput(GameTime gameTime)
        {
            for (int i = 0; i < FrameworkCore.ScreenManager.InputCount; i++)
            {
                GameScreenInput input = FrameworkCore.ScreenManager.ScreenInput[i];

                // Move to the previous menu entry?
                if (input.MenuUp)
                {
                    selectedVerticalEntryIndex[i]--;

                    OnFocusEntry(i, selectedVerticalEntryIndex[i],
                                 selectedHorizontalEntryIndex[i]);
                }

                // Move to the next menu entry?
                if (input.MenuDown)
                {
                    selectedVerticalEntryIndex[i]++;

                    OnFocusEntry(i, selectedVerticalEntryIndex[i],
                                 selectedHorizontalEntryIndex[i]);
                }

                // Move to the previous menu entry?
                if (input.MenuLeft)
                {
                    selectedHorizontalEntryIndex[i]--;

                    OnFocusEntry(i, selectedVerticalEntryIndex[i],
                                 selectedHorizontalEntryIndex[i]);
                }

                // Move to the next menu entry?
                if (input.MenuRight)
                {
                    selectedHorizontalEntryIndex[i]++;

                    OnFocusEntry(i, selectedVerticalEntryIndex[i],
                                 selectedHorizontalEntryIndex[i]);
                }

                // Accept or cancel the menu?
                if (input.MenuSelect)
                {
                    OnSelectedEntry(i, selectedVerticalEntryIndex[i],
                                    selectedHorizontalEntryIndex[i]);
                }
                else
                {
                    if (input.MenuCancel)
                    {
                        OnCancel(i);
                    }

                    if (input.MenuExit)
                    {
                        OnExit(i);
                    }
                }
            }
        }