예제 #1
0
        public bool ShouldOpen()
        {
            if (!Open && KeyHelper.CheckTap(Keys.Escape))
            {
                PopUpRect = new Rectangle((int)RenderHandler.ScreenOffset.X + ((int)Game.ScreenSize.X / 2) - (SizeX / 2),
                                          (int)RenderHandler.ScreenOffset.Y + ((int)Game.ScreenSize.Y / 2) - (SizeY / 2),
                                          SizeX, SizeY);
                menuItems.Clear();

                //Exit Button
                menuItems.Add(new MenuItem(new Rectangle(PopUpRect.X, PopUpRect.Bottom, PopUpRect.Width, 50),
                                           Game.GameContent.Load <Texture2D>(PlayerManager.movingPlayerSprite), "Exit")
                {
                    Action = () =>
                    {
                        RenderHandler.CurrentGameState = GAMESTATE.MAINMENU;
                        GameSaveHandler.CreateSave(((PlayerManager)Game.PlayerCharacter.Manager).CurrentSave);
                        MenuHandler.ActiveFullScreenMenu = new GameStartMenu();
                        Open = false;
                    }
                });
                Open = true;
                return(true);
            }
            return(false);
        }
예제 #2
0
        public void Initialize()
        {
            player = new PlayerController(new PlayerManager());

            // Caster Class Button
            menuItems.Add(new MenuItem(
                              new Rectangle(new Point(LeftStart, (int)(0.3 * Game.ScreenSize.Y)), IconSize),
                              Game.GameContent.Load <Texture2D>(PlayerManager.basePlayerSpriteName), "Caster")
            {
                Action = () =>
                {
                    targetClass = new Caster();
                }
            });

            // Knight Class Button
            menuItems.Add(new MenuItem(
                              new Rectangle(new Point(LeftStart, (int)(0.4 * Game.ScreenSize.Y)), IconSize),
                              Game.GameContent.Load <Texture2D>(PlayerManager.jumpingDPlayerSprite), "Knight")
            {
                Action = () =>
                {
                    targetClass = new Knight();
                }
            });

            // Rogue Class Button
            menuItems.Add(new MenuItem(
                              new Rectangle(new Point(LeftStart, (int)(0.6 * Game.ScreenSize.Y)), IconSize),
                              Game.GameContent.Load <Texture2D>(PlayerManager.movingPlayerSprite), "Rogue")
            {
                Action = () =>
                {
                    targetClass = new Rogue();
                }
            });

            // Create Save Button
            menuItems.Add(new MenuItem(
                              new Rectangle(new Point(LeftStart, (int)(0.7 * Game.ScreenSize.Y)), IconSize),
                              Game.GameContent.Load <Texture2D>(TextureHelper.Sprites.TestImage), "Create Save")
            {
                Action = () =>
                {
                    string saveID = GameSaveHandler.GetNextSaveID().ToString();
                    if (targetClass is Knight)
                    {
                        GameSaveHandler.CreateSave(saveID, player, new Vector2(100, 100), new CathedralRuinsFBoss(), targetClass, new Flight());
                    }
                    else if (targetClass is Caster)
                    {
                        GameSaveHandler.CreateSave(saveID, player, new Vector2(100, 100), new CathedralRuinsFBoss(), targetClass, new Iythil());
                    }
                    else if (targetClass is Rogue)
                    {
                        GameSaveHandler.CreateSave(saveID, player, new Vector2(100, 100), new CathedralRuinsFBoss(), targetClass, new BasicDagger());
                    }
                    else
                    {
                        Errors = "Choose a class!";
                        return;
                    }
                    GameSaveHandler.LoadSave(saveID);
                }
            });

            // Back Button
            menuItems.Add(new MenuItem(
                              new Rectangle(new Point(LeftStart, (int)(0.8 * Game.ScreenSize.Y)), IconSize),
                              Game.GameContent.Load <Texture2D>(TextureHelper.Sprites.EnemySprite), "Back")
            {
                Action = () =>
                {
                    MenuHandler.ActiveFullScreenMenu = new GameStartMenu();
                }
            });
        }