Esempio n. 1
0
        /// <summary>
        /// Handles open menu
        /// </summary>
        /// <param name="gameTime"></param>
        private void PopUpRunUpdate(GameTime gameTime)
        {
            pauseScreen.Update(gameTime);

            if ((buttonPressUtility.isPressed(Game1.confirmString) && !KeyboardMouseUtility.AnyButtonsPressed()) || (buttonPressUtility.isMousePressed(Mouse.GetState().LeftButton)))
            {
                switch (currentPauseChoice)
                {
                case 0:
                    SceneUtility.ChangeScene((int)Game1.Screens.Options);
                    break;

                case 1:
                    SceneUtility.ChangeScene((int)Game1.Screens.ExitGame);
                    break;
                }
            }

            if (buttonPressUtility.isPressed(Game1.openMenuString) && !KeyboardMouseUtility.AnyButtonsPressed() && bShowPopUp)
            {
                bShowPopUp = false;
            }
        }
        private void SceneSelect(Game1 game)
        {
            switch (currentChoice)
            {
            case 1:
                nextChoice = (int)(Game1.Screens.MainGameStart);
                break;

            case 2:
                nextChoice = (int)(Game1.Screens.MainGameContinue);
                break;

            case 3:
                nextChoice = (int)(Game1.Screens.Options);
                break;

            case 4:
                nextChoice = (int)(Game1.Screens.ExitGame);
                break;
            }


            SceneUtility.ChangeScene(nextChoice);
        }
Esempio n. 3
0
 public override void Update(Microsoft.Xna.Framework.GameTime gameTime, Game1 game)
 {
     base.Update(gameTime, game);
     SceneUtility.ChangeScene((int)(Game1.Screens.OWGame));
 }
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            gameRef = this;
            if (bExited)
            {
                Exit();
            }

            if (bIsDebug && TestEnvironment.bDoTest && false)
            {
                TestEnvironment.Test();
            }
            if (Keyboard.GetState().IsKeyDown(Keys.M) && !KeyboardMouseUtility.AnyButtonsPressed())
            {
                ToggleMouse();
            }

            //Console.WriteLine("Hello from Update");

            if (Keyboard.GetState().IsKeyDown(Keys.End) && !KeyboardMouseUtility.AnyButtonsPressed())
            {
                Console.WriteLine(Steamworks.SteamAPI.InitSafe());
            }

            SceneUtility.UpdateTransform();
            SceneUtility.Update(gameTime);
            SceneUtility.scenes = scenes;

            ResolutionUtility.bMouseIsVisible = this.IsMouseVisible;
            ResolutionUtility.mousePos.X      = Mouse.GetState().X;
            ResolutionUtility.mousePos.Y      = Mouse.GetState().Y;
            ResolutionUtility.KeyHandler(graphics, gameTime);
            //MouseMustStayWithinGame();
            buttonPressUtility.Update(gameTime);

            if (ResolutionUtility.stdScale != new Vector2(1))
            {
                this.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;
            }

            bIsActive = this.IsActive;
            //if (!bRunEditMode)
            //{
            //    MusicBGPlayer.Update(gameTime);
            //}

            //CursorUtility.update(gameTime);


            if (!bRunEditMode && !StartScreen.bIsRunning)
            {
                scenes[SceneUtility.currentScene].Update(gameTime, this);
            }
            else if (StartScreen.bIsRunning)
            {
                startScreen.Update(gameTime);
            }
            //else
            //{
            //    ScripTestingScene.Update(gameTime, this);
            //}

            if (SceneUtility.currentScene != (int)Screens.Editor)
            {
                buttonPressUtility.bPressed = true;
                Console.Out.WriteLine("You called the editor!");
                (scenes[(int)Screens.Editor] as Editor).preScreen = SceneUtility.prevScene;
                SceneUtility.ChangeScene((int)Screens.Editor);
                // SceneUtility.prevScene = SceneUtility.currentScene;
                //  SceneUtility.currentScene = (int)Screens.Editor;
                (scenes[(int)Screens.Editor] as Editor).scenes = scenes;
                (scenes[(int)Screens.Editor] as Editor).Start(this);
            }

            KeyboardMouseUtility.Update(this);

            //if (!bRunEditMode)
            //{

            //    if (SceneUtility.prevScene != SceneUtility.currentScene)
            //    {
            //        if (!scenes[SceneUtility.currentScene].bIsInitialized)
            //        {
            //            Console.Out.WriteLine("Called for: " + scenes[SceneUtility.currentScene]);
            //            scenes[SceneUtility.currentScene].Initialize(this);
            //        }
            //        else
            //        {
            //            scenes[SceneUtility.currentScene].Reload();
            //        }

            //    }

            //    if (SceneUtility.currentScene == (int)(Game1.Screens.ExitGame))
            //    {

            //        foreach (Scene scene in scenes)
            //        {
            //            scene.UnloadContent(this);
            //        }

            //        Exit();
            //    }

            //    if (buttonPressUtility.isPressedSub(EditorString) && !buttonPressUtility.bPressed && SceneUtility.currentScene != (int)Screens.Editor)
            //    {
            //        buttonPressUtility.bPressed = true;
            //        Console.Out.WriteLine("You called the editor!");
            //        (scenes[(int)Screens.Editor] as Editor).preScreen = SceneUtility.prevScene;
            //        SceneUtility.ChangeScene((int)Screens.Editor);
            //        // SceneUtility.prevScene = SceneUtility.currentScene;
            //        //  SceneUtility.currentScene = (int)Screens.Editor;
            //        (scenes[(int)Screens.Editor] as Editor).scenes = scenes;
            //        (scenes[(int)Screens.Editor] as Editor).Start(this);
            //    }
            //    else if (buttonPressUtility.isPressedSub(EditorString) && !buttonPressUtility.bPressed && SceneUtility.currentScene == (int)Screens.Editor)
            //    {
            //        buttonPressUtility.bPressed = true;
            //        Console.Out.WriteLine("You left the editor!");
            //        //TODO set the actual prevscreen before entering the editor
            //        SceneUtility.currentScene = SceneUtility.prevScene;
            //        SceneUtility.prevScene = (scenes[(int)Screens.Editor] as Editor).preScreen;
            //        (scenes[(int)Screens.Editor] as Editor).ResetBackToGame(this);
            //    }
            //}



            base.Update(gameTime);
        }
 private void HandleSelection()
 {
     SceneUtility.ChangeScene((int)(Game1.Screens.BGame));
 }