Ejemplo n.º 1
0
 private void SwitchPageTo(MenuPage page)
 {
     currentPage = page;
     menuChange.Play();
 }
Ejemplo n.º 2
0
 protected void FireOptionChosen(MenuPage sender, int?optionIndexOverride = null)
 {
     this.OptionChosen.Invoke(sender, new OptionChosenEventArgs(optionIndexOverride ?? this.currentOptionIndex));
 }
Ejemplo n.º 3
0
        private void LoadPages()
        {
            mainMenu = new MainMenu(content, graphicsDevice);
            help = new HelpPage(content, this.graphicsDevice);
            play = new PlayPage(content, this.graphicsDevice, Game1.GameParameters);
            loading = new LoadingPage(content, this.graphicsDevice);

            this.mainMenu.OptionChosen += (sender, e) =>
            {
                MainMenuPage targetPage = (MainMenuPage)e.Code;
                switch (targetPage)
                {
                    case MainMenuPage.Play:
                        this.SwitchPageTo(play);
                        break;
                    case MainMenuPage.Help:
                        this.SwitchPageTo(help);
                        break;
                    case MainMenuPage.Quit:
                        Game1.Quit();
                        break;
                }
            };

            this.help.OptionChosen += (sender, e) =>
            {
                this.SwitchPageTo(mainMenu);
            };

            this.play.OptionChosen += (sender, e) =>
            {
                MenuNavigationOption option = (MenuNavigationOption)e.Code;
                switch (option)
                {
                    case MenuNavigationOption.Back:
                        this.SwitchPageTo(mainMenu);
                        break;
                    case MenuNavigationOption.Next:
                        this.GameParametersReady.Invoke(this, new GameParametersReadyEventArgs(play.GameParametersModel));
                        this.SwitchPageTo(loading);
                        break;
                }
            };

            this.mainMenu.Cancelled += (sender, e) =>
            {
                Game1.Quit();
            };
            this.play.Cancelled += (sender, e) =>
            {
                this.SwitchPageTo(mainMenu);
            };

            this.loading.Ready += LoadingOnReady;

            this.currentPage = mainMenu;
            MediaPlayer.IsRepeating = true;
            MediaPlayer.Volume = .6f;
            MediaPlayer.Play(music);
        }
Ejemplo n.º 4
0
 public void ShowLoadingPage()
 {
     loading = new LoadingPage(content, this.graphicsDevice);
     this.loading.Ready += LoadingOnReady;
     this.currentPage = loading;
     this.GameParametersReady.Invoke(this, new GameParametersReadyEventArgs(Game1.GameParameters));
     this.enabled = true;
 }
Ejemplo n.º 5
0
 private void SwitchPageTo(MenuPage page)
 {
     currentPage = page;
     menuChange.Play();
 }
Ejemplo n.º 6
0
        private void LoadPages()
        {
            mainMenu = new MainMenu(content, graphicsDevice);
            help     = new HelpPage(content, this.graphicsDevice);
            play     = new PlayPage(content, this.graphicsDevice, Game1.GameParameters);
            loading  = new LoadingPage(content, this.graphicsDevice);

            this.mainMenu.OptionChosen += (sender, e) =>
            {
                MainMenuPage targetPage = (MainMenuPage)e.Code;
                switch (targetPage)
                {
                case MainMenuPage.Play:
                    this.SwitchPageTo(play);
                    break;

                case MainMenuPage.Help:
                    this.SwitchPageTo(help);
                    break;

                case MainMenuPage.Quit:
                    Game1.Quit();
                    break;
                }
            };

            this.help.OptionChosen += (sender, e) =>
            {
                this.SwitchPageTo(mainMenu);
            };

            this.play.OptionChosen += (sender, e) =>
            {
                MenuNavigationOption option = (MenuNavigationOption)e.Code;
                switch (option)
                {
                case MenuNavigationOption.Back:
                    this.SwitchPageTo(mainMenu);
                    break;

                case MenuNavigationOption.Next:
                    this.GameParametersReady.Invoke(this, new GameParametersReadyEventArgs(play.GameParametersModel));
                    this.SwitchPageTo(loading);
                    break;
                }
            };

            this.mainMenu.Cancelled += (sender, e) =>
            {
                Game1.Quit();
            };
            this.play.Cancelled += (sender, e) =>
            {
                this.SwitchPageTo(mainMenu);
            };

            this.loading.Ready += LoadingOnReady;

            this.currentPage        = mainMenu;
            MediaPlayer.IsRepeating = true;
            MediaPlayer.Volume      = .6f;
            MediaPlayer.Play(music);
        }
Ejemplo n.º 7
0
 protected void FireOptionChosen(MenuPage sender, int? optionIndexOverride = null)
 {
     this.OptionChosen.Invoke(sender, new OptionChosenEventArgs(optionIndexOverride ?? this.currentOptionIndex));
 }