コード例 #1
0
        private void HandleMenuKeys(ResultSet resultSet)
        {
            if (RB.ButtonPressed(RB.BTN_SYSTEM))
            {
                resultSet.AddExit();
                return;
            }

            // Check keyboard input
            for (char i = 'a'; i < 'a' + mMenuMain.optionCount; i++)
            {
                if (RB.KeyPressed((KeyCode)i))
                {
                    int index = (int)(i - 'a');
                    resultSet.AddMenuIndex(index);
                    RB.SoundPlay(C.SOUND_SELECT_OPTION, 1, RandomUtils.RandomPitch(0.1f));
                }
            }

            // Check mouse input
            if (RB.ButtonReleased(RB.BTN_POINTER_A))
            {
                int index = mMenuMain.pointerIndex;
                if (index >= 0)
                {
                    resultSet.AddMenuIndex(index);
                    RB.SoundPlay(C.SOUND_SELECT_OPTION, 1, RandomUtils.RandomPitch(0.1f));
                }
            }
        }
コード例 #2
0
        private void HandleMenuKeys(ResultSet resultSet)
        {
            var game = (RetroDungeoneerGame)RB.Game;

            if (RB.ButtonPressed(RB.BTN_SYSTEM))
            {
                resultSet.AddExit();
                return;
            }

            // Check keyboard input
            for (char i = 'a'; i < 'a' + mMenuMain.optionCount; i++)
            {
                if (RB.KeyPressed((KeyCode)i))
                {
                    int index = (int)(i - 'a');
                    resultSet.AddMenuIndex(index);
                    RB.SoundPlay(game.assets.soundSelectOption, 1, RandomUtils.RandomPitch(0.1f));
                }
            }

            // Check mouse input
            if (RB.ButtonReleased(RB.BTN_POINTER_A))
            {
                int index = mMenuMain.pointerIndex;
                if (index >= 0)
                {
                    resultSet.AddMenuIndex(index);
                    RB.SoundPlay(game.assets.soundSelectOption, 1, RandomUtils.RandomPitch(0.1f));
                }
            }
        }