Exemplo n.º 1
0
        private Menu CreateMapSelectionMenu()
        {
            SpriteFont font = Load.LoadFont("Fonts/font");
            MapList list = Content.Load<MapList>("XmlData/Maps/maplist");
            List<MenuItem> items = new List<MenuItem>();

            for (int i = 0; i < list.allMaps.Count; i++)
            {
                MenuItem menuItem = new MenuItem("Menus/Buttons/button", Rectangle.Empty);
                menuItem.Text.Text.Append(list.allMaps[i]);
                menuItem.Text.Font = font;
                menuItem.Text.Color = Color.DarkOrange;
                menuItem.Text.Visible = true;
                menuItem.AddText();
                menuItem.Color = Color.GhostWhite;
                menuItem.ClickedAction = () =>
                    {
                        SelectedMap(menuItem.Text.Text.ToString());
                        StartGame();
                    };
                items.Add(menuItem);
            }

            BasicMenu menu = new ListItemMenu("Menus/Backgrounds/background",
                                            new Rectangle(0, 0, displayWidth, displayHeight),
                                            "Map Selection",listItems: items);
            menu.Color = Color.PaleVioletRed;

            Button previous, next;
            TextButton back;
            previous = new Button("Graphics/leftArrow", Rectangle.Empty) { Name = "previous button" };
            next = new Button("Graphics/rightArrow", Rectangle.Empty) { Name = "next button" };
            back = new TextButton("Menus/Buttons/Button", new Rectangle(50, 400, 50, 20)) { Name = "back button" };
            back.Text.Text.Append("BACK");
            back.Text.Font = font;
            back.Text.Position = new Vector2(back.X_Coordinate + 5, back.Y_Coordinate);
            back.Text.Visible = true;
            back.Text.Color = Color.Chartreuse;
            back.Visible = true;
            back.AddText();
            menu.TextButtons.Add(back);

            ListItemMenu itemMenu = menu as ListItemMenu;
            previous.ClickedAction = () => { itemMenu.priviousItem(); };
            next.ClickedAction = () => { itemMenu.nextItem(); };
            back.ClickedAction = () => { menuOrganizer.Nav_PreviousMenu(); };

            IEnumerable<Button> navButtons = new Button[2] { previous, next };
            itemMenu.NavButtons.AddRange(navButtons);
            itemMenu.CreatePlan = () =>
            {
                Rectangle selectedItemPosition, nextItemPosition, previousItemPosition,
                    nextButtonPosition, previousButtonPosition;

                previousItemPosition = new Rectangle(130, 200, 125, 100);
                selectedItemPosition = new Rectangle(260, 175, 225, 150);
                nextItemPosition = new Rectangle(490, 200, 125, 100);

                previousButtonPosition = new Rectangle(25, 225, 50, 50);
                nextButtonPosition = new Rectangle(670, 225, 50, 50);

                FloorPlan floorPlan = new FloorPlan();

                floorPlan.AddDrawling(itemMenu.Previous, new BaseObject  (string.Empty, previousItemPosition));
                floorPlan.AddDrawling(itemMenu.Selected, new BaseObject(string.Empty, selectedItemPosition));
                floorPlan.AddDrawling(itemMenu.Next, new BaseObject(string.Empty, nextItemPosition));
                floorPlan.AddDrawling(itemMenu.PreviousButton, new BaseObject(string.Empty, previousButtonPosition));
                floorPlan.AddDrawling(itemMenu.NextButton, new BaseObject(string.Empty, nextButtonPosition));

                return floorPlan;
            };
            itemMenu.PositionAnBind();

            return menu;
        }
Exemplo n.º 2
0
        private Menu CreateMainMenu()
        {
            TextButton play = new TextButton("Menus/Buttons/button", new Rectangle(100, 100, 125, 25));
            play.ClickedAction = () => { ActivateMenu("Game Selection"); };
            play.Color = Color.GhostWhite;
            play.Text.Font = Load.LoadFont("Fonts/font");
            play.Text.Color = Color.Red;
            play.Text.Position = new Vector2(play.Rectangle.X, play.Rectangle.Y);
            play.Text.Visible = true;
            play.Text.Text.Append("P L A Y");
            play.AddText();

            TextButton exit = new TextButton("Menus/Buttons/button", new Rectangle(100, 130, 125, 25));
            exit.ClickedAction = ExitGame;
            exit.Color = Color.GhostWhite;
            exit.Text.Font = Load.LoadFont("Fonts/font");
            exit.Text.Color = Color.Red;
            exit.Text.Position = new Vector2(exit.Rectangle.X, exit.Rectangle.Y);
            exit.Text.Visible = true;
            exit.Text.Text.Append("Q U I T");
            exit.AddText();

            BasicMenu menu = new BasicMenu("Menus/Backgrounds/background",
                                            new Rectangle(0, 0, displayWidth, displayHeight), "Main Menu");
            menu.Color = Color.Plum;
            menu.TextButtons.Add(play);
            menu.TextButtons.Add(exit);

            return menu;
        }
Exemplo n.º 3
0
        protected override Menu CreatePauseMenu()
        {
            Menu menu;

            TextButton resume =
                new TextButton("Menus/Buttons/Button", new Rectangle(100, 100, 125, 25));
            resume.ClickedAction = () => {
                Gamestate = GameState.Playing;
                    pauseMenu = null;
            };
            resume.Text.Text.Append("R E S U M E");
            resume.Text.Position = new Vector2(resume.X_Coordinate, resume.Y_Coordinate);
            resume.Text.Font = Load.LoadFont("Fonts/font");
            resume.Text.Color = Color.SeaGreen;
            resume.Text.Visible = true;
            resume.AddText();

            TextButton examine =
                new TextButton("Menus/Buttons/Button", new Rectangle(100, 130, 125, 25));
            examine.ClickedAction = () =>
            {
                mapExamMenu = (BasicMenu)CreateMapExamMenu();
                examineMap = true;
                camCol = camera.StartCol;
                camRow = camera.StartRow;
            };
            examine.Text.Text.Append("E X A M I N E M A P");
            examine.Text.Position = new Vector2(examine.X_Coordinate, examine.Y_Coordinate);
            examine.Text.Font = Load.LoadFont("Fonts/font");
            examine.Text.Color = Color.SeaGreen;
            examine.Text.Visible = true;
            examine.AddText();

            TextButton quitgame =
                new TextButton("Menus/Buttons/Button", new Rectangle(100, 160, 125, 25));
            quitgame.ClickedAction = EndGame;
            quitgame.Text.Text.Append("Q U I T");
            quitgame.Text.Position = new Vector2(quitgame.X_Coordinate, quitgame.Y_Coordinate);
            quitgame.Text.Font = Load.LoadFont("Fonts/font");
            quitgame.Text.Color = Color.SeaGreen;
            quitgame.Text.Visible = true;
            quitgame.AddText();

            List<TextButton> menuButtons =
                new List<TextButton>() { resume, examine, quitgame };
            menu = new BasicMenu("Graphics/background", new Rectangle(0, 0, Width, Height),
                                 "Pause", textButtons: menuButtons);
            menu.Color = Color.Magenta;
            return menu;
        }
Exemplo n.º 4
0
        private Menu CreateGameSelectionMenu()
        {
            SpriteFont font = Load.LoadFont("Fonts/font");
            List<MenuItem> items = new List<MenuItem>();
            MenuItem item = new MenuItem("Menus/Buttons/button", Rectangle.Empty);
            item.Text.Text.Append("CLASSIC MAZE");
            item.Text.Font = font;
            item.Text.Visible = true;
            item.Text.Color = Color.Aquamarine;
            item.AddText();
            item.Color = Color.Chartreuse;
            item.ClickedAction = () =>
                {
                    SelectedGame(item.Text.Text.ToString());
                    ActivateMenu("Map Selection");
                };
            items.Add(item);

            BasicMenu menu = new ListItemMenu("Menus/Backgrounds/background",
                                            new Rectangle(0, 0, displayWidth, displayHeight),
                                            "Map Selection", listItems: items);
            menu.Color = Color.MediumVioletRed;

            Button previous, next;
            TextButton back;
            previous = new Button("Graphics/leftArrow", Rectangle.Empty) { Name = "previous button" };
            next = new Button("Graphics/rightArrow", Rectangle.Empty) { Name = "next button" };
            back = new TextButton("Menus/Buttons/Button", new Rectangle(50, 400, 50,20)) { Name = "back button" };
            back.Text.Text.Append("BACK");
            back.Text.Font = font;
            back.Text.Position = new Vector2(back.X_Coordinate + 5, back.Y_Coordinate);
            back.Text.Visible = true;
            back.Text.Color = Color.Black;
            back.Visible = true;
            back.AddText();
            menu.TextButtons.Add(back);

            ListItemMenu itemMenu = menu as ListItemMenu;
            previous.ClickedAction = () => { itemMenu.priviousItem(); };
            next.ClickedAction = () => { itemMenu.nextItem(); };
            back.ClickedAction = () => { menuOrganizer.Nav_PreviousMenu(); };

            IEnumerable<Button> navButtons = new Button[2] { previous, next, };
            itemMenu.NavButtons.AddRange(navButtons);
            itemMenu.CreatePlan = () =>
            {
                Rectangle selectedItemPosition, nextItemPosition, previousItemPosition,
                    nextButtonPosition, previousButtonPosition;

                previousItemPosition = new Rectangle(130, 200, 125, 100);
                selectedItemPosition = new Rectangle(260, 175, 225, 150);
                nextItemPosition = new Rectangle(490, 200, 125, 100);

                previousButtonPosition = new Rectangle(25, 225, 50, 50);
                nextButtonPosition = new Rectangle(670, 225, 50, 50);

                FloorPlan floorPlan = new FloorPlan();

                floorPlan.AddDrawling(itemMenu.Previous, new BaseObject(string.Empty, previousItemPosition));
                floorPlan.AddDrawling(itemMenu.Selected, new BaseObject(string.Empty, selectedItemPosition));
                floorPlan.AddDrawling(itemMenu.Next, new BaseObject(string.Empty, nextItemPosition));
                floorPlan.AddDrawling(itemMenu.PreviousButton, new BaseObject(string.Empty, previousButtonPosition));
                floorPlan.AddDrawling(itemMenu.NextButton, new BaseObject(string.Empty, nextButtonPosition));

                return floorPlan;
            };
            itemMenu.PositionAnBind();

            return menu;
        }
Exemplo n.º 5
0
        protected override Menu CreateGameOverMenu()
        {
            Menu gameOverMenu;
            TextButton
            playAgain = new TextButton("Menus/Buttons/button", new Rectangle(540, 400, 100, 25));
            playAgain.Name = "Play Again";
            playAgain.ClickedAction = Reset;
            playAgain.Text.Position = new Vector2(playAgain.Rectangle.X, playAgain.Rectangle.Y);
            playAgain.Text.Font = Load.LoadFont("Fonts/Font");
            playAgain.Text.Color = Color.Black;
            playAgain.Text.Text.Append("Play Again");
            playAgain.Text.Visible = true;
            playAgain.AddText();

            TextButton
            mainMenu = new TextButton("Menus/Buttons/button", new Rectangle(650, 400, 100, 25));
            mainMenu.Name = "Main Menu";
            mainMenu.ClickedAction = () => { gameHost.MazeGameEnded(); };
            mainMenu.Text.Position = new Vector2(mainMenu.Rectangle.X, mainMenu.Rectangle.Y);
            mainMenu.Text.Font = Load.LoadFont("Fonts/Font");
            mainMenu.Text.Color = Color.Black;
            mainMenu.Text.Text.Append("Main Menu");
            mainMenu.Text.Visible = true;
            mainMenu.AddText();

               List<TextButton> gameOverNavButtons = new List<TextButton>()
            {
                playAgain, mainMenu
            };

            gameOverMenu = new BasicMenu("Menus/Backgrounds/background",
                new Rectangle(0, 0, Width, Height),"Game Over", textButtons: gameOverNavButtons);
            gameOverMenu.Color = Color.PaleVioletRed;

            return gameOverMenu;
        }