Exemple #1
0
        public static void CreateGameOverMenu(bool win, int point, string time)
        {
            MenuElement       root = new MenuElement();
            MenuSpriteElement bg   = new MenuSpriteElement("GUI/menu_bg.jpg", new Rectangle(0, 0, GameManager.Width, GameManager.Height));

            //root.AddChild(bg);

            if (win)
            {
                if (time != null)
                {
                    root.AddChild(new MenuSpriteElement(null, new Rectangle(Convert.ToInt32(0.3125 * GameManager.Width),
                                                                            Convert.ToInt32(0.28 * GameManager.Height),
                                                                            Convert.ToInt32(0.3125 * GameManager.Width),
                                                                            Convert.ToInt32(0.097 * GameManager.Height)), "YOU WON!\nYou gained " + point
                                                        + " points. Remaining time: " + time));
                }
                else
                {
                    root.AddChild(new MenuSpriteElement(null, new Rectangle(Convert.ToInt32(0.3125 * GameManager.Width),
                                                                            Convert.ToInt32(0.28 * GameManager.Height),
                                                                            Convert.ToInt32(0.3125 * GameManager.Width),
                                                                            Convert.ToInt32(0.097 * GameManager.Height)), "YOU WON!\nYou gained " + point
                                                        + " points."));
                }
            }
            else
            {
                root.AddChild(new MenuSpriteElement(null, new Rectangle(Convert.ToInt32(0.3125 * GameManager.Width),
                                                                        Convert.ToInt32(0.28 * GameManager.Height),
                                                                        Convert.ToInt32(0.3125 * GameManager.Width),
                                                                        Convert.ToInt32(0.097 * GameManager.Height)), "GAME OVER!\nYou gained " + point
                                                    + " points."));
            }


            Rectangle exitRect = new Rectangle(Convert.ToInt32(0.3125 * GameManager.Width),
                                               Convert.ToInt32(0.4167 * GameManager.Height),
                                               Convert.ToInt32(0.3125 * GameManager.Width),
                                               Convert.ToInt32(0.07 * GameManager.Height));
            MenuButtonElement exitButton = new MenuButtonElement(exitRect, delegate()
            {
                Menu.CreateMainMenu();
            });

            exitButton.AddChild(new MenuSpriteElement("GUI/button_bg", exitRect, "BACK TO MAIN MENU"));
            root.AddChild(exitButton);

            GameManager.Instance.SwitchScene(new Menu(root));
        }
Exemple #2
0
        public static void CreateMainMenu()
        {
            MenuElement       root = new MenuElement();
            MenuSpriteElement bg   = new MenuSpriteElement("GUI/menu_bg.jpg", new Rectangle(0, 0, GameManager.Width, GameManager.Height));

            root.AddChild(bg);

            {
                Rectangle exitRect = new Rectangle(1, 1, 151, 71);
                MenuButtonElement exitButton = new MenuButtonElement(exitRect, delegate()
                {
                    GameManager.Instance.Exit();
                });
                exitButton.AddChild(new MenuSpriteElement("GUI/button_bg", exitRect, "EXIT"));
                bg.AddChild(exitButton);
            }
            {
                Rectangle playRect = new Rectangle(Convert.ToInt32(0.65 * GameManager.Width), Convert.ToInt32(0.35 * GameManager.Height),
                                                   Convert.ToInt32(0.265 * GameManager.Width), Convert.ToInt32(0.104 * GameManager.Height));
                MenuButtonElement playButton = new MenuButtonElement(playRect,
                                                                     delegate()
                {
                    //GameManager.Instance.SwitchScene(new Prototype());
                    //GameManager.Instance.SwitchScene(new Game.GameModel(imageDatabase));
                    Menu.CreateNewGameMenu();
                }
                                                                     );
                bg.AddChild(playButton);
                playButton.AddChild(new MenuSpriteElement("GUI/newgame_button.png", playRect));
            }

            GameManager.Instance.SwitchScene(new Menu(root));
        }
Exemple #3
0
 public void LoadContent()
 {
     loadingElement.AddChild(new MenuSpriteElement(null,
                                                   new Rectangle(Convert.ToInt32(0.3125 * GameManager.Width),
                                                                 Convert.ToInt32(0.28 * GameManager.Height),
                                                                 Convert.ToInt32(0.3125 * GameManager.Width),
                                                                 Convert.ToInt32(0.097 * GameManager.Height)), "Loading..."));
 }
Exemple #4
0
        private void LoadTutorial()
        {
            tutorial = new TutorialElement();

            tutorialRoot.AddChild(tutorial);

            tutorial.AddRectangle(new Point(0, GameManager.Height / 8),
                                  new Point(GameManager.Width, 7 * GameManager.Height / 8),
                                  "The main board with the pictures is shown here");
            Rectangle time = UpperMenu.Instance.timerBackground.backgroundArea;

            tutorial.AddRectangle(new Point(time.Left, time.Top), new Point(time.Right, time.Bottom),
                                  "The timer is set here. In Time mode, it is counting down, otherwise it is counting up");

            tutorial.AddRectangle(new Point(6 * GameManager.Width / 7, 0), new Point(GameManager.Width, GameManager.Height / 8),
                                  "You can finish your game with the button here");

            tutorial.AddRectangle(new Point(0, 7 * GameManager.Height / 8), new Point(GameManager.Width, GameManager.Height),
                                  "The images to find can be found in the footer", delegate()
            {
                levelManager.ContinueGame();
            });

            tutorial.AddRectangle(new Point(0, GameManager.Height / 8),
                                  new Point(GameManager.Width, 7 * GameManager.Height / 8),
                                  "Try to find " + levelManager.ImagesToFind.ToFind[0].Name);


            tutorial.AddRectangle(new Point(0, GameManager.Height / 8),
                                  new Point(GameManager.Width, 7 * GameManager.Height / 8),
                                  "That's it, have fun!", delegate()
            {
                levelManager.ContinueGame();
                NewGameMenu.Tutorial = false;
            });
        }
Exemple #5
0
        public static void CreateNewGameMenu()
        {
            MenuElement       root = new MenuElement();
            MenuSpriteElement bg   = new MenuSpriteElement("GUI/newgame_menu.jpg", new Rectangle(0, 0, GameManager.Width, GameManager.Height));

            root.AddChild(bg);

            {
                Rectangle exitRect = new Rectangle(GameManager.Width - 152, 1, 151, 71);
                MenuButtonElement exitButton = new MenuButtonElement(exitRect, delegate()
                {
                    CreateMainMenu();
                });
                exitButton.AddChild(new MenuSpriteElement("GUI/button_bg", exitRect, "BACK"));
                bg.AddChild(exitButton);
            }

            Rectangle musicRect = new Rectangle(GameManager.Width - 500, 1, 151, 71);
            MenuButtonElement musicButton = new MenuButtonElement(musicRect, delegate()
            {
                if (!music)
                {
                    music     = true;
                    musicText = "MUSIC: ON";
                }
                else
                {
                    music     = false;
                    musicText = "MUSIC: OFF";
                }
                musicSpriteElement.Text = musicText;
            });

            musicSpriteElement = new MenuSpriteElement("GUI/button_bg", musicRect, musicText);
            musicButton.AddChild(musicSpriteElement);
            bg.AddChild(musicButton);

            Rectangle vibRect = new Rectangle(GameManager.Width - 345, 1, 190, 71);
            MenuButtonElement vibButton = new MenuButtonElement(vibRect, delegate()
            {
                if (!vibration)
                {
                    vibration = true;
                    vibText   = "VIBRATION: ON";
                }
                else
                {
                    vibration = false;
                    vibText   = "VIBRATION: OFF";
                }
                vibrationSpriteElement.Text = vibText;
            });

            vibrationSpriteElement = new MenuSpriteElement("GUI/button_bg", vibRect, vibText);
            vibButton.AddChild(vibrationSpriteElement);
            bg.AddChild(vibButton);



            {
                DifficultySelector selector = new DifficultySelector();
                bg.AddChild(selector);

                int baseX = Convert.ToInt32(0.279 * GameManager.Width);
                int baseY = Convert.ToInt32(0.359 * GameManager.Height);
                int YDiff = Convert.ToInt32(0.085 * GameManager.Height);
                {
                    Rectangle easyRect = new Rectangle(baseX,
                                                       baseY + YDiff * 0,
                                                       Convert.ToInt32(0.078 * GameManager.Width),
                                                       Convert.ToInt32(0.077 * GameManager.Height));
                    MenuButtonElement easyButton = new MenuButtonElement(easyRect, delegate()
                    {
                        selectedDifficulty = Game.Difficulty.EASY;
                    });
                    easyButton.AddChild(new MenuSpriteElement(null, easyRect, "EASY", 1.5f));
                    selector.AddElementForDifficulty(Game.Difficulty.EASY, easyButton);
                }

                {
                    Rectangle easyRect = new Rectangle(baseX, baseY + YDiff * 1, Convert.ToInt32(0.078 * GameManager.Width), Convert.ToInt32(0.077 * GameManager.Height));
                    MenuButtonElement easyButton = new MenuButtonElement(easyRect, delegate()
                    {
                        selectedDifficulty = Game.Difficulty.NORMAL;
                    });
                    easyButton.AddChild(new MenuSpriteElement(null, easyRect, "NORMAL", 1.5f));
                    selector.AddElementForDifficulty(Game.Difficulty.NORMAL, easyButton);
                }

                {
                    Rectangle easyRect = new Rectangle(baseX, baseY + YDiff * 2, Convert.ToInt32(0.078 * GameManager.Width), Convert.ToInt32(0.077 * GameManager.Height));
                    MenuButtonElement easyButton = new MenuButtonElement(easyRect, delegate()
                    {
                        selectedDifficulty = Game.Difficulty.HARD;
                    });
                    easyButton.AddChild(new MenuSpriteElement(null, easyRect, "HARD", 1.5f));
                    selector.AddElementForDifficulty(Game.Difficulty.HARD, easyButton);
                }
            }

            {
                GameModeSelector selector = new GameModeSelector();
                bg.AddChild(selector);

                int baseX = Convert.ToInt32(0.1 * GameManager.Width);
                int baseY = Convert.ToInt32(0.388 * GameManager.Height);
                int YDiff = Convert.ToInt32(0.085 * GameManager.Height);
                {
                    Rectangle easyRect = new Rectangle(baseX, baseY + YDiff * 0, Convert.ToInt32(0.078 * GameManager.Width), Convert.ToInt32(0.077 * GameManager.Height));
                    MenuButtonElement easyButton = new MenuButtonElement(easyRect, delegate()
                    {
                        selectedGameMode = Game.GameMode.NORMAL;
                    });
                    easyButton.AddChild(new MenuSpriteElement(null, easyRect, "NORMAL", 1.5f));
                    selector.AddElementForDifficulty(Game.GameMode.NORMAL, easyButton);
                }

                {
                    Rectangle easyRect = new Rectangle(baseX, baseY + YDiff * 1, Convert.ToInt32(0.078 * GameManager.Width), Convert.ToInt32(0.077 * GameManager.Height));
                    MenuButtonElement easyButton = new MenuButtonElement(easyRect, delegate()
                    {
                        selectedGameMode = Game.GameMode.ENDLESS;
                    });
                    easyButton.AddChild(new MenuSpriteElement(null, easyRect, "ENDLESS", 1.5f));
                    selector.AddElementForDifficulty(Game.GameMode.ENDLESS, easyButton);
                }

                {
                    Rectangle easyRect = new Rectangle(baseX, baseY + YDiff * 2, Convert.ToInt32(0.078 * GameManager.Width), Convert.ToInt32(0.077 * GameManager.Height));
                    MenuButtonElement easyButton = new MenuButtonElement(easyRect, delegate()
                    {
                        selectedGameMode = Game.GameMode.TIME;
                    });
                    easyButton.AddChild(new MenuSpriteElement(null, easyRect, "TIME", 1.5f));
                    selector.AddElementForDifficulty(Game.GameMode.TIME, easyButton);
                }
            }

            {
                Rectangle playRect = new Rectangle(Convert.ToInt32(0.78125 * GameManager.Width), Convert.ToInt32(0.444 * GameManager.Height), Convert.ToInt32(0.114 * GameManager.Width), Convert.ToInt32(0.0583 * GameManager.Height));
                MenuButtonElement playButton = new MenuButtonElement(playRect,
                                                                     delegate()
                {
                    //GameManager.Instance.SwitchScene(new Prototype());
                    GameManager.Instance.SwitchScene(new Game.GameModel(imageDatabase, selectedGameMode, selectedDifficulty, music, vibration));
                }
                                                                     );
                bg.AddChild(playButton);
                playButton.AddChild(new MenuSpriteElement("GUI/button_play.png", playRect));
            }

            GameManager.Instance.SwitchScene(new Menu(root));
        }