// パーティー整合性チェック private bool PrepareParty(PartyManegementModel party) { List <int> partyList = new List <int>(); for (int i = 0; i < 6; i++) { partyList.Add(party.GetPokemonId(i)); } // 存在するポケモンが3匹未満の場合保存できない var partyExistList = partyList.Where(pokemonId => ImageFactoryModel.ExistPokemonImage(pokemonId)).ToArray(); if (partyExistList.Length < 3) { _mainWindowModel.AddLog("パーティーには3匹ポケモンが必要です。"); return(false); } // ポケモン重複チェック var duplicatedList = partyExistList.GroupBy(pokemonId => pokemonId).Where(g => g.Count() > 1).ToArray(); if (duplicatedList.Length > 0) { _mainWindowModel.AddLog("パーティーのポケモンが重複しています。"); return(false); } return(true); }
private void ShowPokemonSearchWindow(object index) { // ポケモンId取得 int partyIndex = ObjectConverter.ToInt(index); int pokemonId = _partyManegementModel.GetPokemonId(partyIndex); // 通知 PokemonSearchWindowNotification pokemonSearchWindowNotification = new PokemonSearchWindowNotification(); pokemonSearchWindowNotification.WindowId = PokemonSearchWindowNotification.POKEMON_SEARCH_WINDOW; pokemonSearchWindowNotification.IsModal = true; pokemonSearchWindowNotification.PokemonId = pokemonId; ShowWindowRequest.Raise(pokemonSearchWindowNotification, notification => { PokemonSearchWindowNotification resultNotification = (PokemonSearchWindowNotification)notification; _partyManegementModel.ChangePokemonId(partyIndex, resultNotification.PokemonId); }); }
private bool SaveBattleParty(int battleRecordId, int battleResult, int trainerId, PartyManegementModel party) { // パーティー保存 int battlePartyId = _battleRecordDatabaseModel.InsertBattleParty(battleRecordId, battleResult, trainerId); // ポケモン保存 for (int i = PartyConst.FIRST; i <= PartyConst.SIXTH; i++) { int insertId = _battleRecordDatabaseModel.InsertBattlePokemon(battlePartyId, party.GetOrder(i), party.GetPokemonId(i)); } return(true); }