コード例 #1
0
        private static void StandardControlsStart(ActionKey actionKey)
        {
            if (!KeyboardMouseUtility.AnyButtonsPressed() && actionKey.actionIndentifierString.Equals(Game1.moveDownString))
            {
                if (sc.selectedButton == null)
                {
                    sc.selectedButton = sc.mButtons.Last();
                }
                int index = sc.mButtons.IndexOf(sc.selectedButton);
                if (++index >= sc.mButtons.Count)
                {
                    index = 0;
                }
                sc.selectedButton = sc.mButtons[index];
            }

            if (!KeyboardMouseUtility.AnyButtonsPressed() && actionKey.actionIndentifierString.Equals(Game1.moveUpString))
            {
                if (sc.selectedButton == null)
                {
                    sc.selectedButton = sc.mButtons[0];
                }
                int index = sc.mButtons.IndexOf(sc.selectedButton);
                if (--index < 0)
                {
                    index = sc.mButtons.Count - 1;
                }
                sc.selectedButton = sc.mButtons[index];
            }

            if (!KeyboardMouseUtility.AnyButtonsPressed() && actionKey.actionIndentifierString.Equals(Game1.confirmString))
            {
                if (sc.selectedButton == sc.mButtons[0])
                {
                    sc.NewGameButton();
                }

                if (sc.selectedButton == sc.mButtons[1])
                {
                    sc.LoadGameButton();
                }

                if (sc.selectedButton == sc.mButtons[2])
                {
                    sc.OptionsButton();
                    //Game1.gameRef.Run();
                }

                if (sc.selectedButton == sc.mButtons[3])
                {
                    Game1.gameRef.Exit();
                    Game1.gameRef.Dispose();
                    //Game1.gameRef.Run();
                }
            }
        }