Ejemplo n.º 1
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.º 2
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);
        }