Esempio n. 1
0
 public void Update()
 {
     if (Visible)
     {
         if (GameboyInputs.UpPressed())
         {
             _index--;
             if (_index < 0)
             {
                 _index = _options.Length - 1;
             }
         }
         else if (GameboyInputs.DownPressed())
         {
             _index++;
             if (_index == _options.Length)
             {
                 _index = 0;
             }
         }
         else if (GameboyInputs.BPressed() || GameboyInputs.StartPressed())
         {
             Close();
         }
         else if (GameboyInputs.APressed())
         {
             _lastSelectedIndex = _index;
             SelectOption(_options[_index]);
         }
     }
 }
Esempio n. 2
0
 private void UpdateInfoPage()
 {
     if (GameboyInputs.APressed() ||
         GameboyInputs.BPressed() ||
         GameboyInputs.SelectPressed() ||
         GameboyInputs.StartPressed())
     {
         Close();
     }
     else
     {
         UpdateChangePage();
     }
 }
Esempio n. 3
0
 internal override void Update(GameTime gameTime)
 {
     if (GameboyInputs.APressed())
     {
         if (_index > 0)
         {
             _index--;
             SetPokemon();
         }
         else
         {
             Close();
         }
     }
     else if (GameboyInputs.BPressed() || GameboyInputs.StartPressed())
     {
         Close();
     }
 }
Esempio n. 4
0
        internal override void Update(GameTime gameTime)
        {
            if (!Textbox.Visible)
            {
                World.Update(gameTime);
            }
            _camera.Update();

            Textbox.Update();
            _locationSign.Update();
            if (!Textbox.Visible)
            {
                if (!StartMenu.Visible && GameboyInputs.StartPressed())
                {
                    StartMenu.Show();
                }
                else
                {
                    StartMenu.Update();
                }
            }
            if (_locationSign.Visible && (Textbox.Visible || StartMenu.Visible || EncounterStarted))
            {
                _locationSign.Close();
            }

            World.IsPaused = Textbox.Visible || StartMenu.Visible || EncounterStarted;

#if DEBUG
            if (GetComponent <GameDevCommon.Input.KeyboardHandler>().KeyPressed(Microsoft.Xna.Framework.Input.Keys.B))
            {
                OnWildEncounter(new EncounterResult {
                    Id = 152, Level = 5
                });
            }
#endif

            _shader.Update();
            _encounterAnimation?.Update(gameTime);
        }
Esempio n. 5
0
        internal override void Update(GameTime gameTime)
        {
            if (GameboyInputs.RightPressed())
            {
                ChangeOption(1);
                _optionsText = GetOptionsText();
            }
            else if (GameboyInputs.LeftPressed())
            {
                ChangeOption(-1);
                _optionsText = GetOptionsText();
            }

            if (GameboyInputs.DownPressed())
            {
                _index++;
                if (_index == OPTIONS_COUNT)
                {
                    _index = 0;
                }
                _optionsText = GetOptionsText();
            }
            if (GameboyInputs.UpPressed())
            {
                _index--;
                if (_index == -1)
                {
                    _index = OPTIONS_COUNT - 1;
                }
                _optionsText = GetOptionsText();
            }

            if (GameboyInputs.StartPressed() || GameboyInputs.BPressed() || (GameboyInputs.APressed() && _index == OPTIONS_COUNT - 1))
            {
                Close();
            }
        }
Esempio n. 6
0
        internal override void Update(GameTime gameTime)
        {
            _cloudDelay--;
            if (_cloudDelay == 0)
            {
                _cloudDelay = CLOUD_OFFSET_DELAY;
                _cloudOffset++;
                if (_cloudOffset == 32)
                {
                    _cloudOffset = 0;
                }
            }
            _hoohDelay--;
            if (_hoohDelay == 0)
            {
                _hoohDelay = HOOH_DELAY;
                _hoohStage++;
                if (_hoohStage == HOOH_STAGES)
                {
                    _hoohStage = 0;
                }
            }
            var totalFrame = _hoohStage * HOOH_DELAY + (HOOH_DELAY - _hoohDelay);

            if (HOOH_OFFSET_FRAMES.ContainsKey(totalFrame))
            {
                _hoohOffset = HOOH_OFFSET_FRAMES[totalFrame];
            }

            if (GameboyInputs.APressed() || GameboyInputs.StartPressed())
            {
                var saveSelectionScreen = new SaveSelectionScreen(this);
                saveSelectionScreen.LoadContent();
                GetComponent <ScreenManager>().SetScreen(saveSelectionScreen);
            }
        }
Esempio n. 7
0
        internal override void Update(GameTime gameTime)
        {
            _selectorDelay--;
            if (_selectorDelay == 0)
            {
                _selectorDelay   = SELECTOR_FLICKER_DELAY;
                _selectorVisible = !_selectorVisible;
            }

            if (_iconFrames > 1)
            {
                _iconFrameDelay--;
                if (_iconFrameDelay == 0)
                {
                    _iconFrameDelay = ICON_ANIMATION_DELAY;
                    _iconFrame++;
                    if (_iconFrame == _iconFrames)
                    {
                        _iconFrame = 0;
                    }
                }
            }

            if (GameboyInputs.RightPressed())
            {
                if (_menuActive)
                {
                    _menuIndex++;
                    // wrap around to the beginning of the line
                    if (_menuIndex == MENU_OPTIONS_COUNT)
                    {
                        _menuIndex = 0;
                    }
                }
                else
                {
                    _charX++;
                    // wrap around to the beginning of the line
                    if (_charX == CHARS_PER_LINE)
                    {
                        _charX = 0;
                    }
                }
            }
            else if (GameboyInputs.LeftPressed())
            {
                if (_menuActive)
                {
                    _menuIndex--;
                    // wrap around to the end of the line
                    if (_menuIndex == -1)
                    {
                        _menuIndex = MENU_OPTIONS_COUNT - 1;
                    }
                }
                else
                {
                    _charX--;
                    // wrap around to the end of the line
                    if (_charX == -1)
                    {
                        _charX = CHARS_PER_LINE - 1;
                    }
                }
            }
            else if (GameboyInputs.DownPressed())
            {
                if (_menuActive)
                {
                    _charY = 0;
                    if (MenuColumn != _menuIndex)
                    {
                        _charX = _menuIndex * 3;
                    }
                    _menuActive = false;
                }
                else
                {
                    _charY++;
                    if (_charY == ActiveCharset.Length / CHARS_PER_LINE)
                    {
                        _menuActive = true;
                        _menuIndex  = MenuColumn;
                    }
                }
            }
            else if (GameboyInputs.UpPressed())
            {
                if (_menuActive)
                {
                    _charY = ActiveCharset.Length / CHARS_PER_LINE - 1;
                    if (MenuColumn != _menuIndex)
                    {
                        _charX = _menuIndex * 3;
                    }
                    _menuActive = false;
                }
                else
                {
                    _charY--;
                    if (_charY == -1)
                    {
                        _menuActive = true;
                        _menuIndex  = MenuColumn;
                    }
                }
            }

            if (GameboyInputs.BPressed())
            {
                BackspaceName();
            }
            else if (GameboyInputs.APressed())
            {
                if (_menuActive)
                {
                    switch (_menuIndex)
                    {
                    case 0:     // upper/lower switch
                        _isLower = !_isLower;
                        break;

                    case 1:     // DEL
                        BackspaceName();
                        break;

                    case 2:     // END
                        Close();
                        break;
                    }
                }
                else
                {
                    var nameLength = PokemonFontRenderer.PrintableCharAmount(_name);
                    if (nameLength < _maxLength)
                    {
                        var activeChar = ActiveCharset[_charX + _charY * CHARS_PER_LINE];
                        _name     += activeChar;
                        nameLength = PokemonFontRenderer.PrintableCharAmount(_name);
                        if (nameLength == _maxLength)
                        {
                            // select END button
                            _menuActive = true;
                            _menuIndex  = 2;
                        }
                    }
                }
            }
            else if (GameboyInputs.StartPressed())
            {
                // select END button
                _menuActive = true;
                _menuIndex  = 2;
            }
            else if (GameboyInputs.SelectPressed())
            {
                // switch upper/lower
                _isLower = !_isLower;
            }
        }
Esempio n. 8
0
        internal override void Update(GameTime gameTime)
        {
            if (GameboyInputs.DownPressed())
            {
                if (_index + _scrollIndex + 1 < _entries.Length)
                {
                    if (_index < VisibleEntries - 1)
                    {
                        _index++;
                    }
                    else
                    {
                        _scrollIndex++;
                    }
                }
            }
            else if (GameboyInputs.UpPressed())
            {
                if (_index > 0)
                {
                    _index--;
                }
                else if (_scrollIndex > 0)
                {
                    _scrollIndex--;
                }
            }
            else if (GameboyInputs.LeftPressed())
            {
                _scrollIndex -= 7;
                if (_scrollIndex < 0)
                {
                    _scrollIndex = 0;
                }
            }
            else if (GameboyInputs.RightPressed())
            {
                _scrollIndex += 7;
                if (_scrollIndex + VisibleEntries > _entries.Length)
                {
                    _scrollIndex = _entries.Length - VisibleEntries;
                }
            }

            var stackEntryIsComplete = false;

            for (var i = 0; i < _entryStack.Count; i++)
            {
                _spriteAnimationStack[i] += 0.2;
                if (_spriteAnimationStack[i] >= 1.0)
                {
                    if (stackEntryIsComplete)
                    {
                        _spriteAnimationStack.RemoveAt(i);
                        _entryStack.RemoveAt(i);
                        i--;
                    }
                    else
                    {
                        stackEntryIsComplete     = true;
                        _spriteAnimationStack[i] = 1.0;
                    }
                }
            }

            if (GameboyInputs.APressed())
            {
                var selectedEntry = _entries[_scrollIndex + _index];
                if (selectedEntry.IsKnown)
                {
                    // open details screen
                    var screenManager = GetComponent <ScreenManager>();
                    var detailsScreen = new PokedexDetailsScreen(this, selectedEntry, GetNextEntry, GetPreviousEntry);
                    detailsScreen.LoadContent();
                    screenManager.SetScreen(detailsScreen);
                }
            }
            else if (GameboyInputs.BPressed())
            {
                Close();
            }
            else if (GameboyInputs.SelectPressed())
            {
                // open options screen
                var screenManager = GetComponent <ScreenManager>();
                var optionsScreen = new PokedexOptionScreen(_preScreen, this);
                optionsScreen.LoadContent();
                screenManager.SetScreen(optionsScreen);
            }
            else if (GameboyInputs.StartPressed())
            {
                // open search screen
                var screenManager = GetComponent <ScreenManager>();
                var searchScreen  = new PokedexSearchScreen(_preScreen, this, ListMode);
                searchScreen.LoadContent();
                screenManager.SetScreen(searchScreen);
            }
        }