Esempio n. 1
0
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit on XBox
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            {
                this.Exit();
            }

            //Keyboard exit
            exitGameOnEsc();

            // TODO: Add your update logic here


            ///////////////////////
            //Start a new game
            //////////////////////

            if (currentStartMenu.startNewGame)
            {
                //Get all the Update and system values to send to the checks in the objects.
                GameUpdateClassComponents curGameUpdateComponents = new GameUpdateClassComponents();
                curGameUpdateComponents = new GameUpdateClassComponents(Mouse.GetState(), Content, staticTextureImages, staticFonts, this, Components, GraphicsDevice, screenWidth, screenHeight);

                //currentGalaxyGame
                currentGalaxyGame.startNewGame("NewGame", "MyNewGame", currentStartMenu.enteredUserName, currentStartMenu.selectedFaction, curGameUpdateComponents);
                currentStartMenu.startNewGame = false;
            }



            /////////////////////////
            //Mouse Click Event
            /////////////////////////
            mouseStateCurrent = Mouse.GetState();



            //Check if Left mouse click is over the button as the user lets go of the button//
            if (mouseStatePrevious.LeftButton == ButtonState.Pressed && mouseStateCurrent.LeftButton == ButtonState.Released)
            {
                if (currentStartMenu._isEnabled)
                {
                    //Get all the Update and system values to send to the checks in the objects.
                    GameUpdateClassComponents curGameUpdateComponents = new GameUpdateClassComponents();
                    curGameUpdateComponents = new GameUpdateClassComponents(Mouse.GetState(), Content, staticTextureImages, staticFonts, this, Components, GraphicsDevice, screenWidth, screenHeight);

                    currentStartMenu.checkStartScreenMouseClick(curGameUpdateComponents);
                }

                if (currentGalaxyGame._gameIsRunning)
                {
                    //Get all the Update and system values to send to the checks in the objects.
                    GameUpdateClassComponents curGameUpdateComponents = new GameUpdateClassComponents();
                    curGameUpdateComponents = new GameUpdateClassComponents(Mouse.GetState(), Content, staticTextureImages, staticFonts, this, Components, GraphicsDevice, screenWidth, screenHeight);

                    currentGalaxyGame.checkGameRunningMouseClick(curGameUpdateComponents);
                }
            }

            mouseStatePrevious = mouseStateCurrent;


            base.Update(gameTime);
        }
Esempio n. 2
0
        protected override void Update(GameTime gameTime)
        {
            // Allows the game to exit on XBox
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
                this.Exit();

            //Keyboard exit
            exitGameOnEsc();

            // TODO: Add your update logic here

            ///////////////////////
            //Start a new game
            //////////////////////

            if (currentStartMenu.startNewGame)
            {
                //Get all the Update and system values to send to the checks in the objects.
                GameUpdateClassComponents curGameUpdateComponents = new GameUpdateClassComponents();
                curGameUpdateComponents = new GameUpdateClassComponents(Mouse.GetState(), Content, staticTextureImages, staticFonts, this, Components, GraphicsDevice, screenWidth, screenHeight);

                //currentGalaxyGame
                currentGalaxyGame.startNewGame("NewGame", "MyNewGame", currentStartMenu.enteredUserName, currentStartMenu.selectedFaction, curGameUpdateComponents);
                currentStartMenu.startNewGame = false;
            }

            /////////////////////////
            //Mouse Click Event
            /////////////////////////
            mouseStateCurrent = Mouse.GetState();

            //Check if Left mouse click is over the button as the user lets go of the button//
            if (mouseStatePrevious.LeftButton == ButtonState.Pressed && mouseStateCurrent.LeftButton == ButtonState.Released)
            {
                if (currentStartMenu._isEnabled)
                {
                    //Get all the Update and system values to send to the checks in the objects.
                    GameUpdateClassComponents curGameUpdateComponents = new GameUpdateClassComponents();
                    curGameUpdateComponents = new GameUpdateClassComponents(Mouse.GetState(), Content, staticTextureImages, staticFonts, this, Components, GraphicsDevice, screenWidth, screenHeight);

                    currentStartMenu.checkStartScreenMouseClick(curGameUpdateComponents);
                }

                if (currentGalaxyGame._gameIsRunning)
                {
                    //Get all the Update and system values to send to the checks in the objects.
                    GameUpdateClassComponents curGameUpdateComponents = new GameUpdateClassComponents();
                    curGameUpdateComponents = new GameUpdateClassComponents(Mouse.GetState(), Content, staticTextureImages, staticFonts, this, Components, GraphicsDevice, screenWidth, screenHeight);

                    currentGalaxyGame.checkGameRunningMouseClick(curGameUpdateComponents);
                }

            }

            mouseStatePrevious = mouseStateCurrent;

            base.Update(gameTime);
        }