예제 #1
0
        private void ShowMain()
        {
            _textbox.ShowAndSkip("Access whose PC?");

            var options = new List <string>
            {
                "BILL^'s PC",
                Controller.ActivePlayer.Name + "^'s PC"
            };

            if (Controller.ActivePlayer.HasPokedex)
            {
                options.Add("PROF.OAK^'s PC");
            }
            if (Controller.ActivePlayer.HallOfFame.Length > 0)
            {
                options.Add("HALL OF FAME");
            }
            options.Add("TURN OFF");

            _optionsBox.BufferUp            = 1;
            _optionsBox.BufferRight         = 1;
            _optionsBox.CloseAfterSelection = false;
            _optionsBox.Show(options.ToArray());
            _optionsBox.OffsetY         = (int)(_optionsBox.Height * Border.SCALE * Border.UNIT);
            _optionsBox.OptionSelected += MainOptionSelected;

            _textboxFocused = false;
        }
예제 #2
0
        internal override void LoadContent()
        {
            _batch = new SpriteBatch(Controller.GraphicsDevice);

            _optionsBox = new OptionsBox();
            _optionsBox.LoadContent();
            _optionsBox.BufferUp            = 1;
            _optionsBox.BufferRight         = 4;
            _optionsBox.CanCancel           = false;
            _optionsBox.CloseAfterSelection = false;

            var options = new List <string>()
            {
                "NEW GAME", "OPTION"
            };

            if (PlayerData.SaveFileExists())
            {
                // load player file if it exists
                Controller.ActivePlayer = new Player();
                Controller.ActivePlayer.Load();

                options.Insert(0, "CONTINUE");
            }
            _optionsBox.Show(options.ToArray());
            _optionsBox.OptionSelected += OptionSelected;

            var unit   = Border.UNIT * Border.SCALE;
            var offset = Controller.ClientRectangle.Height / 2 - Border.SCREEN_HEIGHT * unit / 2;

            _optionsBox.OffsetY = (int)(_optionsBox.Height * unit + offset);

            _fontRenderer = new PokemonFontRenderer();
            _fontRenderer.LoadContent();
        }
        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();
            }
        }
예제 #4
0
 private void TextboxFinished()
 {
     _optionsBox.Show(new[] { "YES", "NO" });
 }
예제 #5
0
 private void TossQuestionFinished()
 {
     _textbox.Finished -= TossQuestionFinished;
     _optionsBox.Show(new[] { "YES", "NO" });
     _optionsBox.OptionSelected += TossQuestionOptionSelected;
 }
예제 #6
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();
            }
        }
예제 #7
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();
        }
예제 #8
0
 private void OnInitialQuestionFinished()
 {
     _textbox.Finished -= OnInitialQuestionFinished;
     _optionsBox.Show(new[] { "YES", "NO" });
     _optionsBox.OptionSelected += InitialQuestionSelected;
 }
예제 #9
0
 private void SelectMail()
 {
     _optionsBox.Show(new[] { "READ MAIL", "PUT IN PACK", "ATTACH MAIL", "CANCEL" });
     _optionsBox.OffsetY         = (int)(_optionsBox.Height * Border.SCALE * Border.UNIT);
     _optionsBox.OptionSelected += MailOptionSelected;
 }