private void MailOptionSelected(string option, int index) { _optionsBox.OptionSelected -= MailOptionSelected; switch (index) { case 0: // read { var viewScreen = new MailViewScreen(this, _mails[_index + _scrollIndex]); viewScreen.LoadContent(); GetComponent <ScreenManager>().SetScreen(viewScreen); } break; case 1: // put in pack PutInPack(); break; case 2: // attach { var partyScreen = new PartyScreen(this, _mails[_index + _scrollIndex]); partyScreen.LoadContent(); partyScreen.AttachedMail += AttachedMail; GetComponent <ScreenManager>().SetScreen(partyScreen); } break; } }
public Pokemon SelectPokemon() { _pokemonSelectedLock = false; var partyScreen = new PartyScreen(this, Battle.ActiveBattle.PlayerPokemon.Pokemon, true); partyScreen.LoadContent(); partyScreen.SelectedPokemon += OnPokemonSelected; var screenManager = GetComponent <ScreenManager>(); screenManager.SetScreen(partyScreen); SpinWait.SpinUntil(() => screenManager.ActiveScreen.GetType() != typeof(PartyScreen)); var pokemon = Controller.ActivePlayer.PartyPokemon[_selectedPokemonPartyIndex]; return(pokemon); }
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; } } }
public void Init(PartyInventoryItemContainer p_itemContainer, PartyScreen p_parent, Int32 p_tabIndex) { m_itemContainer = p_itemContainer; m_parent = p_parent; m_tabIndex = p_tabIndex; }