Example #1
0
        public void Update()
        {
            //inputManager.Update();
            touchKeyboard.Update();

            char pressedKey = touchKeyboard.GetPressedKey();

            if (currentEntryStage == EntryStage.CATEGORY)
            {
                if (pressedKey != ' ')
                {
                    category += pressedKey;
                }
            }

            if (currentEntryStage == EntryStage.WORD)
            {
                if (pressedKey != ' ' && word.Length < 30)
                {
                    word += pressedKey;
                }
            }

            EraseLastCharFunction();
            ClearWordFunction();
            AddSpaceFunction();

            if (InputManager.MouseRec().Intersects(saveButton.buttonRec()) && InputManager.MouseClick() == true)
            {
                if (currentEntryStage == EntryStage.CATEGORY)
                {
                    currentEntryStage = EntryStage.WORD;
                }


                if (currentEntryStage == EntryStage.WORD)
                {
                    if (isTwoPlayer == false)
                    {
                        AddWord();
                        Reset();
                    }
                    GetOutputString();
                    isPlayButtonPressed = true;
                    currentEntryStage   = EntryStage.EXIT;
                }
            }

            if (currentEntryStage == EntryStage.EXIT && isTwoPlayer == false)
            {
                currentEntryStage = EntryStage.WORD;

                Reset();
            }

            if (InputManager.MouseRec().Intersects(backButton.buttonRec()) && InputManager.MouseClick())
            {
                isBackButtonPressed = true;
            }
        }
Example #2
0
        public void Update()
        {
            strings.Add(addWordMenu.word);
            string category = categoryMenu.Category();

            if (categoryChosen == false && category != "")
            {
                categoryChosen = true;
                Initialize(category);
            }

            else if (categoryChosen == false && addWordMenu.isTwoPlayer == true)
            {
                categoryChosen = true;
                Initialize(category);
            }


            if (categoryChosen == true)
            {
                if (errors >= maxErrors || GetOutputString() == strings[wordint])
                {
                    isPlaying = false;
                }

                if (isPlaying == true)
                {
                    touchKeyboard.Update();
                    CheckChars(inputManager.PressedButton());
                    CheckChars(touchKeyboard.GetPressedKey());
                }
                if (Keyboard.GetState().IsKeyDown(Keys.Enter) && isPlaying == false)
                {
                    ResetWord();
                    isPlaying = true;
                }
            }
            else
            {
                categoryMenu.Update();
            }

            if (InputManager.MouseRec().Intersects(backButton.buttonRec()) && InputManager.MouseClick())
            {
                isBackButtonPressed = true;
                categoryChosen      = false;
                ResetWord();
            }

            if (InputManager.MouseRec().Intersects(newWordButton.buttonRec()) && InputManager.MouseClick() && addWordMenu.isTwoPlayer == true)
            {
                isNewWordButtonTwoPPressed = true;
                ResetWord();
            }

            if (InputManager.MouseRec().Intersects(newWordButton.buttonRec()) && InputManager.MouseClick() && addWordMenu.isTwoPlayer == false)
            {
                isNewWordButtonPressed = true;
                ResetWord();
            }
        }