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]); } } }
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); } } }
internal override void Update(GameTime gameTime) { if (GameboyInputs.APressed() || GameboyInputs.BPressed()) { Close(); } }
internal override void Update(GameTime gameTime) { _playerVisible = GameboyInputs.SelectDown(); if (!_playerVisible) { _nestFlickerDelay--; if (_nestFlickerDelay == 0) { _nestFlickerDelay = NEST_FLICKER_DELAY; _nestsVisible = !_nestsVisible; } } if (GameboyInputs.APressed() || GameboyInputs.BPressed()) { Close(); } if (GameboyInputs.RightPressed() && _index == 0 && Controller.ActivePlayer.VisitedKanto) { _index = 1; LoadMapEntries(); } else if (GameboyInputs.LeftPressed() && _index == 1) { _index = 0; LoadMapEntries(); } }
public void Update() { if (Visible) { // close if (GameboyInputs.APressed() || GameboyInputs.BPressed()) { Visible = false; } } }
private void UpdateRadioPage() { if (GameboyInputs.BPressed()) { Close(); } else { UpdateChangePage(); } }
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(); } }
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(); } }
private void UpdateMapPage(GameTime gameTime) { _mapScreen.Update(gameTime); if (GameboyInputs.BPressed()) { Close(); } else { UpdateChangePage(); } }
internal override void Update(GameTime gameTime) { if (GameboyInputs.RightPressed()) { _pageIndex++; if (_pageIndex == PAGE_COUNT) { _pageIndex = 0; } } else if (GameboyInputs.LeftPressed()) { _pageIndex--; if (_pageIndex == -1) { _pageIndex = PAGE_COUNT - 1; } } else if (GameboyInputs.UpPressed()) { var newPokemon = _previousPokemon(); if (newPokemon != null) { _pokemon = newPokemon; } } else if (GameboyInputs.DownPressed()) { var newPokemon = _nextPokemon(); if (newPokemon != null) { _pokemon = newPokemon; } } if (GameboyInputs.APressed()) { if (_pageIndex < PAGE_COUNT - 1) { _pageIndex++; } else { Close(); } } else if (GameboyInputs.BPressed()) { Close(); } }
private void UpdateInfoPage() { if (GameboyInputs.APressed() || GameboyInputs.BPressed() || GameboyInputs.SelectPressed() || GameboyInputs.StartPressed()) { Close(); } else { UpdateChangePage(); } }
public void Update() { if (Visible) { if (GameboyInputs.UpPressed()) { _current++; if (_current > _max) { _current = 1; } } else if (GameboyInputs.DownPressed()) { _current--; if (_current == 0) { _current = _max; } } else if (GameboyInputs.RightPressed()) { _current += 10; if (_current > _max) { _current = _max; } } else if (GameboyInputs.LeftPressed()) { _current -= 10; if (_current <= 0) { _current = 1; } } if (GameboyInputs.APressed()) { AmountSelected?.Invoke(_current); Close(); } else if (GameboyInputs.BPressed()) { Dismissed?.Invoke(); Close(); } } }
internal override void Update(GameTime gameTime) { if (GameboyInputs.RightPressed() && _index < Controller.ActivePlayer.UnownsCaught.Length - 1) { _index++; } else if (GameboyInputs.LeftPressed() && _index > 0) { _index--; } if (GameboyInputs.APressed() || GameboyInputs.BPressed()) { Close(); } }
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 (CanCancel && GameboyInputs.BPressed()) { if (_options.Length > _cancelIndex) { OptionSelected?.Invoke(_options[_cancelIndex], _cancelIndex); } else { // option to cancel is not in the options set OptionSelected?.Invoke(null, _cancelIndex); } if (CloseAfterSelection) { Close(); } } else if (GameboyInputs.APressed()) { OptionSelected?.Invoke(_options[Index], Index); if (CloseAfterSelection) { Close(); } } } }
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(); } }
internal override void Update(GameTime gameTime) { _timeColonDelay--; if (_timeColonDelay == 0) { _timeColonDelay = TIME_COLON_SWITCH_DELAY; _timeColonVisible = !_timeColonVisible; } _badgeFlipDelay--; if (_badgeFlipDelay == 0) { _badgeFlipDelay = BADGE_FLIP_DELAY; _badgeFlipIndex++; if (_badgeFlipIndex == 4) { _badgeFlipIndex = 0; } } if (GameboyInputs.APressed()) { if (_pageIndex == 0) { _pageIndex = 1; } else { Close(); } } else if (GameboyInputs.BPressed()) { Close(); } else if (_pageIndex == 0 && GameboyInputs.RightPressed()) { _pageIndex = 1; } else if (_pageIndex == 1 && GameboyInputs.LeftPressed()) { _pageIndex = 0; } }
internal override void Update(GameTime gameTime) { if (GameboyInputs.APressed()) { if (_index > 0) { _index--; SetPokemon(); } else { Close(); } } else if (GameboyInputs.BPressed() || GameboyInputs.StartPressed()) { Close(); } }
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); }
internal override void Update(GameTime gameTime) { if (GameboyInputs.DownPressed()) { _selectedIndex--; if (_selectedIndex < 0) { _selectedIndex = _entries.Length - 1; } } else if (GameboyInputs.UpPressed()) { _selectedIndex++; if (_selectedIndex == _entries.Length) { _selectedIndex = 0; } } // only allow player to close the screen if it's on a screen stack // if it doesn't have a pre screen, it means it's embedded in another screen (pokegear) if (_preScreen != null && GameboyInputs.BPressed()) { Close(); } _playerFrameDelay--; if (_playerFrameDelay == 0) { _playerFrameDelay = PLAYER_FRAME_TIME; _playerFrameIndex++; if (_playerFrameIndex == PLAYER_ANIMATION_FRAMES.Length) { _playerFrameIndex = 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(); } }
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); } }
private void UpdateChangePage() { if (GameboyInputs.RightPressed()) { _pageIndex++; if ((_pageIndex == 1 && !Controller.ActivePlayer.HasMapModule) || (_pageIndex == 3 && !Controller.ActivePlayer.HasRadioModule)) { _pageIndex = 2; } else if (_pageIndex == 4) { _pageIndex = 3; } } else if (GameboyInputs.LeftPressed()) { _pageIndex--; if (_pageIndex == -1 || (_pageIndex == 1 && !Controller.ActivePlayer.HasMapModule)) { _pageIndex = 0; } } }
internal override void Update(GameTime gameTime) { // when visible, only update the no results message if (_noResultsDelay > 0) { _noResultsDelay--; return; } _selectorFlickerDelay--; if (_selectorFlickerDelay == 0) { _selectorFlickerDelay = SELECTOR_FLICKER_DELAY; _selectorVisible = !_selectorVisible; } if (GameboyInputs.DownPressed() && _index < 3) { _index++; } else if (GameboyInputs.UpPressed() && _index > 0) { _index--; } else if (GameboyInputs.RightPressed()) { switch (_index) { case 0: _type1Index++; if (_type1Index == _type1Options.Length) { _type1Index = 0; } break; case 1: _type2Index++; if (_type2Index == _type2Options.Length) { _type2Index = 0; } break; } } else if (GameboyInputs.LeftPressed()) { switch (_index) { case 0: _type1Index--; if (_type1Index == -1) { _type1Index = _type1Options.Length - 1; } break; case 1: _type2Index--; if (_type2Index == -1) { _type2Index = _type2Options.Length - 1; } break; } } if (GameboyInputs.BPressed()) { GetComponent <ScreenManager>().SetScreen(_prePokedexScreen); } else if (GameboyInputs.APressed()) { switch (_index) { case 0: _type1Index++; if (_type1Index == _type1Options.Length) { _type1Index = 0; } break; case 1: _type2Index++; if (_type2Index == _type2Options.Length) { _type2Index = 0; } break; case 2: ConfirmSearch(); break; case 3: GetComponent <ScreenManager>().SetScreen(_prePokedexScreen); break; } } }
internal override void Update(GameTime gameTime) { _selectorFlickerDelay--; if (_selectorFlickerDelay == 0) { _selectorFlickerDelay = SELECTOR_FLICKER_DELAY; _selectorVisible = !_selectorVisible; } if (GameboyInputs.DownPressed() && _index < _options.Length - 1) { _index++; } else if (GameboyInputs.UpPressed() && _index > 0) { _index--; } if (GameboyInputs.BPressed()) { // return to previous screen without change GetComponent <ScreenManager>().SetScreen(_prePokedexScreen); } else if (GameboyInputs.APressed()) { var newListMode = (PokedexListMode)_index; if (newListMode == _prePokedexScreen.ListMode) // no change to list mode { // return to previous screen without change GetComponent <ScreenManager>().SetScreen(_prePokedexScreen); } else { // change loaded regional screen instead of setting a new one: if (newListMode == PokedexListMode.Regional && _prePokedexScreen.ListMode == PokedexListMode.AtoZ) { (_prePokedexScreen as RegionalPokedexListScreen).SetListMode(PokedexListMode.Regional); GetComponent <ScreenManager>().SetScreen(_prePokedexScreen); } else if (newListMode == PokedexListMode.AtoZ && _prePokedexScreen.ListMode == PokedexListMode.Regional) { (_prePokedexScreen as RegionalPokedexListScreen).SetListMode(PokedexListMode.AtoZ); GetComponent <ScreenManager>().SetScreen(_prePokedexScreen); } else { // load new screen Screen newScreen = null; switch (newListMode) { case PokedexListMode.Regional: newScreen = new RegionalPokedexListScreen(_preScreen, PokedexListMode.Regional); break; case PokedexListMode.National: newScreen = new NationalPokedexListScreen(_preScreen); break; case PokedexListMode.AtoZ: newScreen = new RegionalPokedexListScreen(_preScreen, PokedexListMode.AtoZ); break; case PokedexListMode.Unown: newScreen = new PokedexUnownScreen(this); break; } newScreen.LoadContent(); GetComponent <ScreenManager>().SetScreen(newScreen); } } } }
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(); } }
private void UpdateInput() { var velocity = Vector2.Zero; var ctrlDown = false; if (Map.World.PlayerCanMove && !_warping) { #if DEBUG // walking through walls while holding ctrl var kHandler = GetComponent <KeyboardHandler>(); ctrlDown = kHandler.KeyDown(Keys.LeftControl); #endif if (GameboyInputs.LeftDown()) { if (Facing != EntityFacing.West) { Facing = EntityFacing.West; } else { velocity.X = -1f; } } else if (GameboyInputs.RightDown()) { if (Facing != EntityFacing.East) { Facing = EntityFacing.East; } else { velocity.X = 1f; } } else if (GameboyInputs.UpDown()) { if (Facing != EntityFacing.North) { Facing = EntityFacing.North; } else { velocity.Y = -1f; } } else if (GameboyInputs.DownDown()) { if (Facing != EntityFacing.South) { Facing = EntityFacing.South; } else { velocity.Y = 1f; } } // interaction, when player is not moving if (velocity == Vector2.Zero && GameboyInputs.APressed()) { // generate a 0.25 cube that is offset by the player's position to their viewing angle // used to detect collision with entity to interact with var interactPosition = Position; switch (Facing) { case EntityFacing.North: interactPosition += new Vector3(0, 0, -Size.Z); break; case EntityFacing.West: interactPosition += new Vector3(-Size.X, 0, 0); break; case EntityFacing.South: interactPosition += new Vector3(0, 0, Size.Z); break; case EntityFacing.East: interactPosition += new Vector3(Size.X, 0, 0); break; } var interactedEntity = Map.World.GetCollision(CollisionType.Test, interactPosition, new Vector3(0.25f), this); if (interactedEntity != null) { interactedEntity.Interact(); } } } _walking = velocity != Vector2.Zero; var targetPosition = Position; if (velocity.X != 0f) { var xPosition = Position + new Vector3(velocity.X, 0, 0) * SPEED; var collidedEntity = ctrlDown ? null : Map.World.GetCollision(CollisionType.Walk, xPosition, Size, this); if (collidedEntity == null) { targetPosition.X += velocity.X * SPEED; _walking = true; } else { collidedEntity.Collides(this); } } if (velocity.Y != 0f) { var zPosition = Position + new Vector3(0, 0, velocity.Y) * SPEED; var collidedEntity = ctrlDown ? null : Map.World.GetCollision(CollisionType.Walk, zPosition, Size, this); if (collidedEntity == null) { targetPosition.Z += velocity.Y * SPEED; _walking = true; } else { collidedEntity.Collides(this); } } if (_walking) { var floor = Map.World.GetFloor(targetPosition, this); if (floor == null) { targetPosition.Y = 0f; } else { targetPosition.Y = floor.GetHeightForPosition(new Vector2(targetPosition.X, targetPosition.Z)); Map.World.ChangeMap(floor.Map.MapFile); } // can climb 0.25 up at most if (ctrlDown || targetPosition.Y - 0.25f <= Position.Y) { Position = targetPosition; } // wild encounters through grass var isInGrass = Map.World.IsInGrass(Position, new Vector3(0.1f, 1f, 0.1f), this); if (isInGrass) { _stepsInGrass++; var encountered = Map.World.TryWildEncounter(_stepsInGrass); if (encountered) { _stepsInGrass = 0; } } } }
internal override void Update(GameTime gameTime) { _animationDelay--; if (_animationDelay == 0) { _animationDelay = ANIMATION_DELAY; _animationIndex++; if (_animationIndex == 2) { _animationIndex = 0; } } if (GameboyInputs.LeftPressed() && !_isOrdering && _partyIndex > 0) { _partyIndex--; _moveIndex = 0; ChangedPartyIndex?.Invoke(_partyIndex); } else if (GameboyInputs.RightPressed() && !_isOrdering && _partyIndex < Controller.ActivePlayer.PartyPokemon.Length - 1) { _partyIndex++; _moveIndex = 0; ChangedPartyIndex?.Invoke(_partyIndex); } else if (GameboyInputs.UpPressed() && _moveIndex > 0) { _moveIndex--; } else if (GameboyInputs.DownPressed() && _moveIndex < Pokemon.Moves.Length - 1) { _moveIndex++; } if (GameboyInputs.APressed()) { if (_isOrdering) { if (_orderMoveIndex != _moveIndex) { Pokemon.SwapMoves(_moveIndex, _orderMoveIndex); } _isOrdering = false; } else { _isOrdering = true; _orderMoveIndex = _moveIndex; } } else if (GameboyInputs.BPressed()) { if (_isOrdering) { _isOrdering = false; } else { Close(); } } }
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; } }
internal override void Update(GameTime gameTime) { if (_menuState == BattleMenuState.Main) { if (StartMultiTurnMove()) { return; } if (GameboyInputs.RightPressed() && _mainMenuIndex % 2 == 0) { _mainMenuIndex++; } else if (GameboyInputs.LeftPressed() && _mainMenuIndex % 2 == 1) { _mainMenuIndex--; } else if (GameboyInputs.DownPressed() && _mainMenuIndex < 2) { _mainMenuIndex += 2; } else if (GameboyInputs.UpPressed() && _mainMenuIndex > 1) { _mainMenuIndex -= 2; } if (GameboyInputs.APressed()) { switch (_mainMenuIndex) { case 0: // FIGHT // TODO: struggle _menuState = BattleMenuState.Fight; // after switching pokemon, the cursor for move selection might be in an invalid position if (_moveMenuIndex >= Battle.ActiveBattle.PlayerPokemon.Pokemon.Moves.Length) { _moveMenuIndex = 0; } break; case 1: // PKMN { var partyScreen = new PartyScreen(this, Battle.ActiveBattle.PlayerPokemon.Pokemon, false); partyScreen.LoadContent(); partyScreen.SelectedPokemon += SelectedPokemonForSwitch; GetComponent <ScreenManager>().SetScreen(partyScreen); } break; // TODO: inventory case 3: // RUN // TODO: trainer battles // TODO: trapping moves like BIND _menuState = BattleMenuState.Off; Battle.ActiveBattle.StartRound(new BattleAction { ActionType = BattleActionType.Run }); break; } } } else if (_menuState == BattleMenuState.Fight) { if (GameboyInputs.DownPressed()) { _moveMenuIndex++; if (_moveMenuIndex == Battle.ActiveBattle.PlayerPokemon.Pokemon.Moves.Length) { _moveMenuIndex = 0; } } else if (GameboyInputs.UpPressed()) { _moveMenuIndex--; if (_moveMenuIndex == -1) { _moveMenuIndex = Battle.ActiveBattle.PlayerPokemon.Pokemon.Moves.Length - 1; } } if (GameboyInputs.APressed()) { _menuState = BattleMenuState.Off; Battle.ActiveBattle.StartRound(new BattleAction { ActionType = BattleActionType.Move, MoveName = Battle.ActiveBattle.PlayerPokemon.Pokemon.Moves[_moveMenuIndex].name }); } else if (GameboyInputs.BPressed()) { _menuState = BattleMenuState.Main; } } else { if (!_keepTextboxOpen) { _battleTextbox.Update(); } else { if (_framesBeforeContinuing > 0) { _framesBeforeContinuing--; } } _enemyPokemonStatus.Update(); _playerPokemonStatus.Update(); _pokemonStats.Update(); lock (_animations) { foreach (var animation in _animations) { if (!animation.IsFinished) { if (animation.WaitDelay > 0) { animation.WaitDelay--; } else { animation.Update(); } } } } } if (_fadeOut) { _fadeOutProgress += FADE_OUT_SPEED; if (_fadeOutProgress >= 1f) { _fadeOutProgress = 1f; } } }
internal override void Update(GameTime gameTime) { _selectorFlickerDelay--; if (_selectorFlickerDelay == 0) { _selectorFlickerDelay = SELECTOR_FLICKER_DELAY; _selectorVisible = !_selectorVisible; } if (GameboyInputs.RightPressed() && _cursorIndex + 1 < OPTIONS.Length) { _cursorIndex++; } else if (GameboyInputs.LeftPressed() && _cursorIndex > 0) { _cursorIndex--; } else if (GameboyInputs.UpPressed()) { var newEntry = _getPreviousEntry(); if (newEntry != null) { _entry = newEntry; _cursorIndex = 0; // set cursor to PAGE _pageIndex = 0; InitializeEntry(); } } else if (GameboyInputs.DownPressed()) { var newEntry = _getNextEntry(); if (newEntry != null) { _entry = newEntry; _cursorIndex = 0; // set cursor to PAGE _pageIndex = 0; InitializeEntry(); } } if (GameboyInputs.APressed()) { switch (_cursorIndex) { case 0: // PAGE _pageIndex++; if (_pageIndex == _pages.Length) { _pageIndex = 0; } break; case 1: // AREA var nestScreen = new PokedexNestScreen(this, _entry); nestScreen.LoadContent(); GetComponent <ScreenManager>().SetScreen(nestScreen); break; case 2: // CRY // TODO: play cry break; case 3: // BACK Close(); break; } } else if (GameboyInputs.BPressed()) { Close(); } }