예제 #1
0
        public override void OnEnter(GameState previousState)
        {
            _exitTransition = new TweenedDouble(Game, 0);

            MenuPage startGamePage = new MenuPage(150);

            startGamePage.Add(new MenuLabel(startGamePage, "Choose a name to begin"));
            startGamePage.Add(new MenuSpacer(4));
            startGamePage.Add(new MenuTextInput(startGamePage, "Player", "Name: "));
            startGamePage.Add(new MenuButton(startGamePage, "Start Game")).RegisterEvent(MenuElement.EventType.Clicked, (e, h) => { if (!h)
                                                                                                                                    {
                                                                                                                                        _doneWithName = true;
                                                                                                                                    }
                                                                                         });

            MenuPage mainPage = new MenuPage(150);

            mainPage.Add(new MenuButton(mainPage, "Start New Game", "icons/start_game.png")).
            RegisterEvent(MenuElement.EventType.Clicked, (e, h) =>
            {
                if (!h && Coroutine.Active.Count == 0)
                {
                    Coroutine.Start(TransitionToStoryCoroutine);
                }
            });

            mainPage.Add(new MenuButton(mainPage, "Load Game", "icons/load_game.png"));
            mainPage.Add(new MenuSpacer(4));
            mainPage.Add(new MenuButton(mainPage, "Options", "icons/settings.png", "", "")).
            RegisterEvent(MenuElement.EventType.Clicked, (e, h) => { if (!h)
                                                                     {
                                                                         OptionsUI.SwitchToOptionsPage();
                                                                     }
                          });
            mainPage.Add(new MenuButton(mainPage, "Credits", "icons/credits.png", "", "")).
            RegisterEvent(MenuElement.EventType.Clicked, (e, h) => { if (!h)
                                                                     {
                                                                         UI.SwitchPage("credits", false);
                                                                     }
                          });
            mainPage.Add(new MenuSpacer(4));
            mainPage.Add(new MenuButton(mainPage, "Exit Game", "icons/arrow_left.png")).
            RegisterEvent(MenuElement.EventType.Clicked, (e, h) => { if (!h)
                                                                     {
                                                                         Game.Exit();
                                                                     }
                          });

            MenuPage creditsPage = new MenuPage(250);

            creditsPage.Add(new MenuLabel(creditsPage, "Age of Darkness " + Program.VERSION));
            creditsPage.Add(new MenuLabel(creditsPage, "Made with MonoGame and Team STOR Engine"));
            creditsPage.Add(new MenuLabel(creditsPage, ""));
            creditsPage.Add(new MenuLabel(creditsPage, "Programming"));
            creditsPage.Add(new MenuLabel(creditsPage, "Hannes Mann", "", "", 0.8f));
            creditsPage.Add(new MenuLabel(creditsPage, ""));
            creditsPage.Add(new MenuLabel(creditsPage, "Game Design and Art"));
            creditsPage.Add(new MenuLabel(creditsPage, "Kasper Kjällström", "", "", 0.8f));
            creditsPage.Add(new MenuLabel(creditsPage, "Henrik Eriksson", "", "", 0.8f));
            creditsPage.Add(new MenuSpacer(4));
            creditsPage.Add(new MenuButton(creditsPage, "Back", "icons/arrow_left.png")).
            RegisterEvent(MenuElement.EventType.Clicked, (e, h) => { if (!h)
                                                                     {
                                                                         UI.SwitchPage("main", true);
                                                                     }
                          });

            UI = new MenuUI(this, "main", mainPage, true);
            UI.AddPage("credits", creditsPage);
            UI.AddPage("start-game", startGamePage);

            OptionsUI = new MenuOptions(UI, "main");

            UI.Toggle();

            Game.IsMouseVisible = false;
        }
예제 #2
0
파일: MenuUI.cs 프로젝트: teamstor/aod
 public MenuPage AddPage(string pageID, MenuPage page)
 {
     _pages.Add(pageID, page);
     page.Parent = this;
     return(page);
 }