コード例 #1
0
ファイル: TitleMenu.cs プロジェクト: scastle/EECS290_Project1
        /// <summary>
        /// Initializes a new instance of the <see cref="TitleMenu"/> class.
        /// </summary>
        /// <param name="position">The position.</param>
        /// <param name="spacing">The spacing.</param>
        public TitleMenu(Vector2 position, float spacing)
            : base(position)
        {
            MenuEntry resume = new MenuEntry("Start",position, new StartDelegate());

            MenuEntry howto = new MenuEntry("How to Play", position + new Vector2(0, spacing), new HowToPlayDelegate());

            MenuEntry toSettings = new MenuEntry("Settings", position + new Vector2(0, spacing * 2), new SettingsDelegate());

            MenuEntry quit = new MenuEntry("Quit", position + new Vector2(0, spacing * 3), new QuitGameDelegate());

            resume.UpperMenu = quit;
            resume.LowerMenu = howto;

            howto.UpperMenu = resume;
            howto.LowerMenu = toSettings;

            toSettings.UpperMenu = howto;
            toSettings.LowerMenu = quit;

            quit.UpperMenu = toSettings;
            quit.LowerMenu = resume;

            this.Add(resume);
            this.Add(howto);
            this.Add(toSettings);
            this.Add(quit);
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TitleMenu"/> class.
        /// </summary>
        /// <param name="position">The position.</param>
        /// <param name="spacing">The spacing.</param>
        public SettingsMenu(Vector2 position, float spacing)
            : base(position)
        {
            switch ((int) Settings.DifficultyLevel)
            {
                case 0:
                    DifSet = "Easy";
                    break;
                case 1:
                    DifSet = "Medium";
                    break;
                case 2:
                    DifSet = "Hard";
                    break;
            }
            difficulty = new MenuEntry("Difficulty: " + DifSet, position, new DifficultyDelegate());

            numRecords = new MenuEntry("Number of Records: " + Settings.NumRecords, position + new Vector2(0, spacing), new NumRecordsDelegate());

            MenuEntry mainMenu = new MenuEntry("Main Menu", position + new Vector2(0, spacing * 2), new MainMenuDelegate());

            difficulty.UpperMenu = mainMenu;
            difficulty.LowerMenu = numRecords;

            numRecords.UpperMenu = difficulty;
            numRecords.LowerMenu = mainMenu;

            mainMenu.UpperMenu = numRecords;
            mainMenu.LowerMenu = difficulty;

            this.Add(difficulty);
            this.Add(numRecords);
            this.Add(mainMenu);
        }
コード例 #3
0
ファイル: PauseMenu.cs プロジェクト: scastle/EECS290_Project1
        /// <summary>
        /// Initializes a new instance of the <see cref="PauseMenu"/> class.
        /// </summary>
        /// <param name="position">The position.</param>
        /// <param name="spacing">The spacing.</param>
        public PauseMenu(Vector2 position, float spacing, String MainAction)
            : base(position)
        {
            MenuEntry resume = new MenuEntry(MainAction, position, new QuitTopDelegate());

            MenuEntry quit = new MenuEntry("Quit", position + new Vector2(0, spacing), new QuitGameDelegate());

            MenuEntry main = new MenuEntry("Main Menu", position + new Vector2(0, spacing * 2), new MainMenuDelegate());

            resume.UpperMenu = main;
            resume.LowerMenu = quit;

            quit.UpperMenu = resume;
            quit.LowerMenu = main;

            main.UpperMenu = quit;
            main.LowerMenu = resume;

            this.Add(resume);
            this.Add(quit);
            this.Add(main);
        }