Ejemplo n.º 1
0
 public override void IsClicked(Action <List <Screen> > addScreens, Action <List <Screen> > removeScreens)
 {
     removeScreens(mScreensDeleting);
     addScreens(mScreensFollowing);
     LoadAndSaveManager.Current.LoadGame(mFileName);
     GameStateWrapper.SetPause(false);
 }
Ejemplo n.º 2
0
        private static AButton[] GetButtons(ContentManager content)
        {
            const int   buttonPadding         = 20;
            const int   buttonWidth           = 300;
            const int   buttonHeight          = 100;
            const float skillButtonSizeFactor = 0.6f;

            const float skillButtonPositionOffset = (1f - skillButtonSizeFactor) / 2;

            var hero   = GameState.Current.HeroesByPlayer[Players.Player];
            var skills = hero.HeroSkills.SkillList.Keys.ToList();

            var buttons = new List <AButton>();

            var buttonPositionY = MenuPosY + buttonPadding;

            foreach (var skill in skills)
            {
                var buttonPositionX = MenuPosX + buttonPadding;
                buttons.Add(new MenuButton(content,
                                           buttonPositionX,
                                           buttonPositionY,
                                           buttonWidth,
                                           buttonHeight,
                                           new[] { hero.HeroSkills.GetName(skill) }));
                buttonPositionX += buttonWidth + buttonPadding;
                buttons.Add(new SkillButton(content,
                                            buttonPositionX,
                                            buttonPositionY + (int)(skillButtonPositionOffset * buttonHeight),
                                            (int)(skillButtonSizeFactor * buttonWidth),
                                            (int)(skillButtonSizeFactor * buttonHeight),
                                            skill));
                buttonPositionX += (int)(skillButtonSizeFactor * buttonWidth) + buttonPadding;
                buttons.Add(new SkillLevelUpButton(content,
                                                   buttonPositionX,
                                                   buttonPositionY + (int)(skillButtonPositionOffset * buttonHeight),
                                                   (int)(skillButtonSizeFactor * buttonWidth),
                                                   (int)(skillButtonSizeFactor * buttonHeight),
                                                   new[] { Properties.SkillingMenu.Plus },
                                                   skill));
                buttonPositionY += buttonPadding + buttonHeight;
            }

            buttons.Add(new SkillPointAvailableButton(content,
                                                      MenuPosX + MenuWidth - buttonPadding - (int)(skillButtonSizeFactor * buttonWidth),
                                                      buttonPositionY,
                                                      (int)(skillButtonSizeFactor * buttonWidth),
                                                      (int)(2 * skillButtonSizeFactor * buttonHeight)));

            buttons.Add(new ActionButton(content,
                                         MenuPosX + MenuWidth - buttonPadding - (int)(skillButtonSizeFactor * buttonWidth),
                                         MenuPosY + buttonPadding,
                                         (int)(skillButtonSizeFactor * buttonWidth),
                                         (int)(skillButtonSizeFactor * buttonHeight),
                                         new[] { Properties.SkillingMenu.X },
                                         () => { GameStateWrapper.SetPause(false); },
Ejemplo n.º 3
0
 private static bool CheckEsc(Action <List <Screen> > removeScreens)
 {
     if (ExitWrapper.EscClicked)
     {
         GameStateWrapper.SetPause(false);
         removeScreens(new List <Screen> {
             Screen.InGameMenu
         });
     }
     return(false);
 }
Ejemplo n.º 4
0
 public virtual void Update(GameTime gameTime, Action <List <Screen> > addScreens, Action <List <Screen> > removeScreens)
 {
     if (CheckEsc(addScreens, removeScreens))
     {
         return;
     }
     foreach (var button in mButtons)
     {
         if (button.GetClicked())
         {
             if (button.GetTextFirstLine() == HeroMenuPanel.SkillTree)
             {
                 GameStateWrapper.SetPause(true);
             }
             else if (button.GetTextFirstLine() == SkillingMenu.X)
             {
                 GameStateWrapper.SetPause(false);
             }
             button.IsClicked(addScreens, removeScreens);
         }
     }
 }
Ejemplo n.º 5
0
        public void Update(GameTime gameTime, Action <List <Screen> > addScreens, Action <List <Screen> > removeScreens)
        {
            GameStateWrapper.SetPause(true);
            removeScreens(new List <Screen> {
                Screen.HeroMenuPanel
            });
            if (CheckEsc(removeScreens))
            {
                return;
            }

            if (mLoadButton.GetClicked())
            {
                addScreens(new List <Screen> {
                    Screen.LoadScreen
                });
                removeScreens(new List <Screen> {
                    Screen.InGameMenu
                });
            }
            else if (mSaveButton.GetClicked())
            {
                addScreens(new List <Screen> {
                    Screen.SaveScreen
                });
                removeScreens(new List <Screen> {
                    Screen.InGameMenu
                });
            }
            else if (mGraphicsButton.GetClicked())
            {
                removeScreens(new List <Screen> {
                    Screen.InGameMenu
                });
                addScreens(new List <Screen> {
                    Screen.InGameVideoMenu
                });
            }
            else if (mSoundButton.GetClicked())
            {
                removeScreens(new List <Screen> {
                    Screen.InGameMenu
                });
                addScreens(new List <Screen> {
                    Screen.InGameAudioMenu
                });
            }
            else if (mBackToMainMenuButton.GetClicked())
            {
                mCamera.Position = AMainMenuPage.sCameraPosition;
                addScreens(new List <Screen> {
                    Screen.MainMenu
                });
                removeScreens(new List <Screen> {
                    Screen.InGameMenu, Screen.GameHud, Screen.GameScreen
                });
            }
            else if (mBackToGameButton.GetClicked())
            {
                GameStateWrapper.SetPause(false);
                removeScreens(new List <Screen> {
                    Screen.InGameMenu
                });
            }
        }