Exemplo n.º 1
0
        public static void NextScreen()
        {
            if (InputManager.Mousestate[1].LeftButton != Microsoft.Xna.Framework.Input.ButtonState.Pressed)
            {
                int i;
                if (!LevelSelect_Nav())
                {
                    for (i = 0; i < Button.ButtonList.Count; i++)
                    {
                        if (Button.ButtonList[i].Active && MouseClick.Rect.Intersects(Button.ButtonList[i].Rect))
                        {
                            switch (Button.ButtonList[i].Text.Text)
                            {
                            case "New Game":
                                ScreenManager.NewGame();
                                return;

                            case "Continue":
                                ScreenManager.NoMode();
                                ScreenManager.Mainmenu    = true;
                                ScreenManager.Levelselect = true;
                                MainMenu.LevelSelectOn();
                                return;

                            case "Stats":
                                ScreenManager.StatsOn();
                                return;

                            case "Erase Save Data":
                                MainMethod.popupBox = new PopupBox(new string[] {
                                    "Really delete all saved data?",
                                    "This will bring you back to level 1",
                                    "All of your custom levels will NOT be deleted"
                                }, PopupType.START_NEW_GAME);
                                return;

                            case "Play Custom":
                                ScreenManager.LoadingCustomOn();
                                return;

                            case "Editor":
                                ScreenManager.EditingOn();
                                return;

                            case "Credits":
                                ScreenManager.CreditsOn();
                                return;

                            case "Exit":
                                ScreenManager.ExitGame();
                                return;

                            case "Main Menu":
                                BClick_MainMenu();
                                return;

                            case "Resume":
                                PauseMenu.Unpause();
                                return;

                            case "Move":
                                BClick_Move();
                                return;

                            case "Entity":
                                BClick_Entity();
                                return;

                            case "Static":
                                BClick_Static();
                                return;

                            case "Items":
                                BClick_Items();
                                return;

                            case "Save":
                                Save();
                                return;

                            case "Save & Test":
                                if (Save())
                                {
                                    ScreenManager.Testing = true;
                                }
                                return;

                            case "Back to Editor":
                                LevelLoader.StartEditorLevel(Level.Current - 1, Level.CurrentLevelButton);
                                return;

                            case "+":
                                Plus_Minus.Plus(i);
                                return;

                            case "-":
                                Plus_Minus.Minus(i);
                                return;

                            case "Delete Map":
                                if (Level.CurrentLevelButton is WorkshopLevelButton)
                                {
                                    MessageBox.StatusMessage = new MessageBox("Workshop levels can't be deleted!", new Microsoft.Xna.Framework.Vector2(217, 190), 120);
                                }
                                else
                                {
                                    MainMethod.popupBox = new PopupBox(new string[] { "Are you sure?", "This map can not be restored", "once deleted." }, PopupType.DELETE_LEVEL);
                                }
                                return;

                            case "Publish to Workshop":
                                if (Save())
                                {
                                    LevelSaver.IsPublishingToWorkshop = true;
                                }
                                return;

                            case "Delete All Objects":
                                MainMethod.popupBox = new PopupBox(new string[] { "Are you sure?", "This will delete all objects", "in this level permanently." }, PopupType.ERASE_ALL_OBJECTS);
                                return;


                            case "Cycle Entities":
                                BClick_CycleEntities();
                                return;

                            case "Next":
                                LevelButton.NextGroup();
                                return;

                            case "Previous":
                                LevelButton.PreviousGroup();
                                return;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        protected override void Update(GameTime gameTime)
        {
            if (this.isAppStarting)
            {
                MainMenu.Activate();
                this.isAppStarting = false;
            }
            else
            {
                SteamIntegration.Update();
            }
            if (ScreenManager.GameClosing)
            {
                SteamAPI.Shutdown();
                base.Exit();
            }
            if (base.IsActive && !SteamIntegration.instance.IsPublishing)
            {
                MainMenu.Update();
                LevelSaver.Update();

                if (popupBox == null)
                {
                    InGame.Update();
                    Editor.Update();
                }
                else if (popupBox.IsFinished)
                {
                    popupBox = null;
                }
                InputManager.CheckInput();
            }
            else if (ScreenManager.Ingame)
            {
                PauseMenu.Pause();
            }
            if (LevelLoader.LevelComplete)
            {
                if (!ScreenManager.Custom)
                {
                    SaveFile.CompleteLevel();
                }
                if (Level.Current == Level.maxLevels)
                {
                    if (ScreenManager.Custom)
                    {
                        Level.Current = 0;
                        LevelLoader.NextLevel();
                    }
                    else
                    {
                        SteamIntegration.Achievements.GameComplete();
                        LevelLoader.LevelComplete = false;
                        ScreenManager.GameCompleteOn();
                    }
                }
                else
                {
                    LevelLoader.NextLevel();
                }
            }

            if (DebugMode)
            {
                debug.Update(gameTime);
            }

            TimeSinceLastUpdate = ((float)base.TargetElapsedTime.TotalMilliseconds) / 1000f;
            base.Update(gameTime);
        }