Esempio n. 1
0
        internal override void Update(GameTime gameTime)
        {
            if (!_showInfoText)
            {
                _optionsBox.Update();
            }
            else
            {
                if (GameboyInputs.APressed())
                {
                    ContinueGame(gameTime);
                }
            }

            if (GameboyInputs.BPressed())
            {
                if (_showInfoText)
                {
                    _showInfoText = false;
                }
                else
                {
                    GetComponent <ScreenManager>().SetScreen(_titleScreen);
                }
            }
        }
Esempio n. 2
0
        internal override void Update(GameTime gameTime)
        {
            if (!DialogVisible)
            {
                if (GameboyInputs.DownPressed() && _index + _scrollIndex < _items.Length)
                {
                    _index++;
                    if (_index == ITEMS_VISIBLE)
                    {
                        _index--;
                        _scrollIndex++;
                    }
                }
                else if (GameboyInputs.UpPressed() && _index + _scrollIndex > 0)
                {
                    _index--;
                    if (_index == -1)
                    {
                        _index++;
                        _scrollIndex--;
                    }
                }

                if (GameboyInputs.APressed())
                {
                    if (_items.Length > _index + _scrollIndex)
                    {
                        SelectItem();
                    }
                    else
                    {
                        Close();
                    }
                }
                else if (GameboyInputs.BPressed())
                {
                    Close();
                }
            }
            else if (_amountSelector.Visible)
            {
                _amountSelector.Update();
            }
            else if (_optionsBox.Visible)
            {
                _optionsBox.Update();
            }
            else if (_textbox.Visible)
            {
                _textbox.Update();
            }
        }
Esempio n. 3
0
        internal override void Update(GameTime gameTime)
        {
            if (!DialogVisible)
            {
                if (GameboyInputs.DownPressed() && _index + _scrollIndex < _mails.Length)
                {
                    _index++;
                    if (_index == MAILS_VISIBLE)
                    {
                        _index--;
                        _scrollIndex++;
                    }
                }
                else if (GameboyInputs.UpPressed() && _index + _scrollIndex > 0)
                {
                    _index--;
                    if (_index == -1)
                    {
                        _index++;
                        _scrollIndex--;
                    }
                }

                if (GameboyInputs.APressed())
                {
                    if (_mails.Length > _index + _scrollIndex)
                    {
                        SelectMail();
                    }
                    else
                    {
                        Close();
                    }
                }
                else if (GameboyInputs.BPressed())
                {
                    Close();
                }
            }
            else if (_confirmationBox.Visible)
            {
                _confirmationBox.Update();
            }
            else if (_optionsBox.Visible)
            {
                _optionsBox.Update();
            }
            else if (_textbox.Visible)
            {
                _textbox.Update();
            }
        }
Esempio n. 4
0
 internal override void Update(GameTime gameTime)
 {
     if (_moveSelectBox.Visible)
     {
         _moveSelectBox.Update();
     }
     else if (_optionsBox.Visible)
     {
         _optionsBox.Update();
     }
     else if (_textbox.Visible)
     {
         _textbox.Update();
     }
 }
        internal override void Update(GameTime gameTime)
        {
            if (!_optionsBox.Visible)
            {
                if (GameboyInputs.DownPressed() && _index + _scrollIndex < StorageBox.BOX_COUNT)
                {
                    _index++;
                    if (_index == VISIBLE_BOXES)
                    {
                        _index--;
                        _scrollIndex++;
                    }
                }
                else if (GameboyInputs.UpPressed() && _index + _scrollIndex > 0)
                {
                    _index--;
                    if (_index == -1)
                    {
                        _index++;
                        _scrollIndex--;
                    }
                }

                if (GameboyInputs.APressed())
                {
                    if (_index + _scrollIndex == StorageBox.BOX_COUNT)
                    {
                        Close();
                    }
                    else
                    {
                        _optionsBox.Show(new[] { "SWITCH", "NAME", "QUIT" });
                    }
                }
                else if (GameboyInputs.BPressed())
                {
                    Close();
                }
            }
            else
            {
                _optionsBox.Update();
            }
        }
Esempio n. 6
0
 internal override void Update(GameTime gameTime)
 {
     if (_saved)
     {
         _savedDelay--;
         if (_savedDelay == 0)
         {
             Close();
         }
     }
     else
     {
         if (!_optionsBox.Visible)
         {
             _textbox.Update();
         }
         _optionsBox.Update();
     }
 }
Esempio n. 7
0
 internal override void Update(GameTime gameTime)
 {
     if (_isClosing)
     {
         if (_closeDelay > 0)
         {
             _closeDelay--;
             if (_closeDelay == 0)
             {
                 GetComponent <ScreenManager>().SetScreen(_preScreen);
             }
         }
         if (_textboxFocused)
         {
             _textbox.Update();
         }
     }
     else
     {
         if (_textboxFocused)
         {
             _textbox.Update();
         }
         else
         {
             if (_confirmationBox.Visible)
             {
                 _confirmationBox.Update();
             }
             else
             {
                 _optionsBox.Update();
             }
         }
     }
 }
Esempio n. 8
0
        private void UpdatePhonePage()
        {
            if (!_phoneOptionsBox.Visible && !_deleteNumberOptionsBox.Visible)
            {
                if (GameboyInputs.DownPressed())
                {
                    if (_phoneIndex < CONTACTS_VISIBLE - 1)
                    {
                        _phoneIndex++;
                    }
                    else if (_phoneScroll < MAX_PHONE_CONTACTS - CONTACTS_VISIBLE)
                    {
                        _phoneScroll++;
                    }
                }
                else if (GameboyInputs.UpPressed())
                {
                    if (_phoneIndex > 0)
                    {
                        _phoneIndex--;
                    }
                    else if (_phoneScroll > 0)
                    {
                        _phoneScroll--;
                    }
                }

                if (GameboyInputs.APressed())
                {
                    if (Controller.ActivePlayer.Contacts.Length > _phoneIndex + _phoneScroll)
                    {
                        var contact = _phonebook.GetContact(Controller.ActivePlayer.Contacts[_phoneIndex + _phoneScroll]);
                        if (contact.important)
                        {
                            _phoneOptionsBox.Show(new[] { "CALL", "CANCEL" });
                        }
                        else
                        {
                            _phoneOptionsBox.Show(new[] { "CALL", "DELETE", "CANCEL" });
                        }
                        _phoneOptionsBox.OptionSelected += CallOptionsSelected;
                    }
                }
                else if (GameboyInputs.BPressed())
                {
                    Close();
                }
                else
                {
                    UpdateChangePage();
                }
            }
            else if (_deleteNumberOptionsBox.Visible)
            {
                _deleteNumberOptionsBox.Update();
            }
            else if (_phoneOptionsBox.Visible)
            {
                _phoneOptionsBox.Update();
            }
        }
Esempio n. 9
0
        internal override void Update(GameTime gameTime)
        {
            if (_initialTextDelay > 0)
            {
                _initialTextDelay--;
                if (_initialTextDelay == 0)
                {
                    ShowInitialText();
                }
            }

            if (_goBright)
            {
                _brightness += BRIGHTNESS_INCREASE;
                if (_brightness >= 1f)
                {
                    _brightness = 1f;
                    _oakAppear  = true;
                }
            }

            if (_oakAppear && _oakStage < OAK_APPEAR_STAGES - 1)
            {
                _oakStageDelay--;
                if (_oakStageDelay == 0)
                {
                    _oakStageDelay = OAK_DELAY;
                    _oakStage++;
                    if (_oakStage == OAK_APPEAR_STAGES - 1)
                    {
                        _oakAppear = false;
                        if (_oakTextContinue)
                        {
                            ShowOakContinueText();
                        }
                        else
                        {
                            ShowWelcomeText();
                        }
                    }
                }
            }

            if (_pokemonAppear)
            {
                _oakStageDelay--;
                if (_oakStageDelay == 0)
                {
                    _oakStageDelay = OAK_DELAY;
                    _oakStage++;
                    if (_oakStage == OAK_TOTAL_STAGES)
                    {
                        _pokemonVisible = true;
                        _pokemonAppear  = false;
                    }
                }
            }

            if (_pokemonVisible && _pokemonAppearDelay > 0)
            {
                _pokemonAppearDelay--;
                if (_pokemonAppearDelay == 0)
                {
                    ShowPokemonText();
                }
            }

            if (_playerAnimate)
            {
                if (_oakStage < OAK_TOTAL_STAGES)
                {
                    _oakStageDelay--;
                    if (_oakStageDelay == 0)
                    {
                        _oakStageDelay = OAK_DELAY;
                        _oakStage++;
                    }
                }
                else
                {
                    _playerStageDelay--;
                    if (_playerStageDelay == 0)
                    {
                        _playerStageDelay = PLAYER_DELAY;
                        _playerStage++;
                        if (_playerStage == _playerTargetStage)
                        {
                            _playerAnimate = false;
                            if (_playerStage == PLAYER_TOTAL_STAGES)
                            {
                                Close(gameTime);
                            }
                            else if (_playerChosenName != "")
                            {
                                PlayerNameSelected();
                            }
                            else
                            {
                                ShowPlayerText();
                            }
                        }
                    }
                }
            }

            if (_movePlayer)
            {
                if (_playerChosenName != "")
                {
                    _playerOffset--;
                    if (_playerOffset == 0)
                    {
                        _movePlayer = false;
                        PlayerNameSelected();
                    }
                }
                else
                {
                    _playerOffset++;
                    if (_playerOffset == PLAYER_TARGET_OFFSET)
                    {
                        _movePlayer = false;
                        _nameSelection.Show(PRESET_NAMES);
                        var unit   = Border.UNIT * Border.SCALE;
                        var offset = Controller.ClientRectangle.Height / 2 - Border.SCREEN_HEIGHT * unit / 2;
                        _nameSelection.OffsetY         = (int)(_nameSelection.Height * unit + offset);
                        _nameSelection.OptionSelected += NameOptionSelected;
                    }
                }
            }

            if (_fadePokemon)
            {
                _pokemonAlpha -= POKEMON_FADE_SPEED;
                if (_pokemonAlpha <= 0f)
                {
                    _pokemonAlpha    = 0f;
                    _fadePokemon     = false;
                    _oakAppear       = true;
                    _oakStage        = -1;
                    _pokemonVisible  = false;
                    _oakTextContinue = true;
                }
            }

            if (_updateTextbox)
            {
                _textbox.Update();
            }
            _nameSelection.Update();
        }
Esempio n. 10
0
        internal override void Update(GameTime gameTime)
        {
            // wait for message to disappear
            if (_messageDelay > 0)
            {
                _messageDelay--;
                if (_messageDelay == 0)
                {
                    MessageFinished?.Invoke();
                }
                return;
            }

            if (!DialogVisible)
            {
                if (GameboyInputs.DownPressed() && _index + _scrollIndex < _pokemon.Length)
                {
                    _index++;
                    if (_index == VISIBLE_POKEMON)
                    {
                        _index--;
                        _scrollIndex++;
                        if (_scrollIndex + _index == _pokemon.Length + 1) // +1 because 'cancel'
                        {
                            _scrollIndex--;
                        }
                    }
                }
                else if (GameboyInputs.UpPressed() && _index + _scrollIndex > 0)
                {
                    _index--;
                    if (_index == -1)
                    {
                        _index++;
                        _scrollIndex--;
                        if (_scrollIndex == -1)
                        {
                            _scrollIndex++;
                        }
                    }
                }
                else if (GameboyInputs.LeftPressed())
                {
                    LeftPressed();
                }
                else if (GameboyInputs.RightPressed())
                {
                    RightPressed();
                }

                if (GameboyInputs.APressed())
                {
                    if (_isMoving)
                    {
                        ConfirmMovePokemon();
                    }
                    else
                    {
                        if (_pokemon.Length > _index + _scrollIndex)
                        {
                            _message = MESSAGE_WHATSUP;
                            OpenOptionsMenu();
                        }
                        else
                        {
                            // cancel option
                            Close();
                        }
                    }
                }
                else if (GameboyInputs.BPressed())
                {
                    if (_isMoving)
                    {
                        CancelMovePokemon();
                    }
                    else
                    {
                        Close();
                    }
                }
            }
            else if (_confirmationBox.Visible)
            {
                _confirmationBox.Update();
            }
            else if (_optionsBox.Visible)
            {
                _optionsBox.Update();
            }
        }