Exemplo n.º 1
0
        public MainMenu()
        {
            int screenW             = Game1.instance.graphics.PreferredBackBufferWidth;
            int screenH             = Game1.instance.graphics.PreferredBackBufferHeight;
            int screenWidthOverFour = Game1.instance.graphics.PreferredBackBufferWidth / 4;
            int screenHeightOverTwo = Game1.instance.graphics.PreferredBackBufferHeight / 2;

            tutorialRect = new Rectangle(screenWidthOverFour - 50, screenHeightOverTwo, 75, 40);
            newGameRect  = new Rectangle(screenWidthOverFour * 2 - 50, screenHeightOverTwo, 112, 40);
            continueRect = new Rectangle(screenWidthOverFour * 3 - 50, screenHeightOverTwo, 85, 40);
            allowResume  = GameSaverAndLoader.doesSaveExist(Game1.selectedSaveSlot);
            exitRect     = new Rectangle(screenW - 30 - 10, 10, 30, 30);
        }
        public override void acceptInput(GameTime time, KeyboardState currentKeyboardState, MouseState currentMouseState, KeyboardState prevKeyboardState, MouseState prevMouseState)
        {
            this.currentMouseState = currentMouseState;
            if (currentMouseState.LeftButton.Equals(ButtonState.Pressed) && prevMouseState.LeftButton.Equals(ButtonState.Released))
            {
                foreach (PlayerStarterKit kit in PlayerKitRegistry.registry.Values)
                {
                    if (kit.buttonRect.Contains(currentMouseState.Position) && !kit.locked)
                    {
                        if (GameSaverAndLoader.doesSaveExist(Game1.selectedSaveSlot))
                        {
                            GameSaverAndLoader.deleteSave(Game1.selectedSaveSlot);
                        }

                        if (kit.id == 0 && !(world is TutorialWorld))
                        {
                            /*Dictionary<Rectangle, string> images = new Dictionary<Rectangle, string>();
                             *
                             * List<String> challengeImages = UniverseProperties.challangeListToStringList();
                             *
                             * int imageWidth = 1000;
                             * int imageHeight = 400;
                             * for (int i = 0; i < 6; i++)
                             * {
                             *  images.Add(new Rectangle(imageWidth * i, Game1.instance.graphics.PreferredBackBufferHeight / 2 - imageHeight / 2, imageWidth, imageHeight), "StorySplashes/story_" + i);
                             * }
                             *
                             * Game1.instance.queuedSplashScreens.Add(new ScrollingSplashScreen(images, new List<string>()));*/
                            StartingCutscene startingCutscene = new StartingCutscene(world);
                            kit.selectKit(startingCutscene);
                            Game1.instance.switchWorlds(startingCutscene);
                        }
                        else
                        {
                            kit.selectKit(world);
                            Game1.instance.switchWorlds(world);
                        }

                        readyToContinue = true;
                        break;
                    }
                }
            }
        }