コード例 #1
0
 public void GetNewWord()
 {
     if (addWordMenu.GetPlayButtonValue() == true)
     {
         categoryChosen = true;
         Initialize("MinaOrd");
     }
 }
コード例 #2
0
        protected override void Update(GameTime gameTime)
        {
            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            {
                Exit();
            }
            IsMouseVisible = true;

            InputManager.Update();

            spriteFrame += 0.23f;
            if (spriteFrame >= 27)
            {
                spriteFrame = 0;
            }

            MainMenu.ButtonPressed pressedMainMenuButton = mainMenu.GetMenuMode(); //Hämtar vilken knapp i huvudmenyn som spelaren tryckt på.

            if (pressedMainMenuButton == MainMenu.ButtonPressed.GAME)
            {
                currentGameState = GameState.PLAYING;
            }

            if (pressedMainMenuButton == MainMenu.ButtonPressed.WORD)
            {
                addWordMenu.SaveButtonText("Spara");
                currentGameState = GameState.WORD_MENU;
            }

            if (pressedMainMenuButton == MainMenu.ButtonPressed.TWO_PLAYER)
            {
                addWordMenu.SaveButtonText("Spela");
                currentGameState = GameState.TWO_PLAYER;
            }

            if (currentGameState == GameState.PLAYING && wordManager.GetBackButtonValue() == true)
            {
                addWordMenu.Reset();
                addWordMenu.isTwoPlayer = false;
                wordManager.ResetTwoPlayerWord();
                currentGameState = GameState.MAIN_MENU;
            }

            if (currentGameState == GameState.PLAYING && wordManager.GetNewWordButtonValue() == true)
            {
                addWordMenu.Reset();
                addWordMenu.isTwoPlayer = true;
                wordManager.ResetTwoPlayerWord();
                currentGameState = GameState.TWO_PLAYER;
            }

            if (currentGameState == GameState.WORD_MENU && addWordMenu.GetBackButtonValue() == true)
            {
                currentGameState = GameState.MAIN_MENU;
            }

            if (currentGameState == GameState.TWO_PLAYER && addWordMenu.GetBackButtonValue() == true)
            {
                currentGameState = GameState.MAIN_MENU;
            }

            if (currentGameState == GameState.TWO_PLAYER && addWordMenu.GetPlayButtonValue() == true)
            {
                currentGameState = GameState.PLAYING;
            }



            layerManager.UpdateClouds();
            wordManager.GetNewWord();

            if (currentGameState == GameState.PLAYING)
            {
                wordManager.Update();
            }

            if (currentGameState == GameState.TWO_PLAYER)
            {
                addWordMenu.isTwoPlayer = true;
                addWordMenu.Update();
            }

            if (currentGameState == GameState.MAIN_MENU)
            {
                addWordMenu.isTwoPlayer = false;
                mainMenu.Update();
                layerManager.Update();
            }

            if (currentGameState == GameState.WORD_MENU)
            {
                addWordMenu.isTwoPlayer = false;
                addWordMenu.Update();
            }

            base.Update(gameTime);
        }