public void GetAllChampionsMasteryEntries_Test() { const long lucianId = 236; var allChampionsMastery = api.GetChampionMasteries(Platform.NA1, id); Assert.IsNotNull(allChampionsMastery); Assert.IsNotNull(allChampionsMastery.Find(championMastery => championMastery.ChampionId == lucianId)); }
public List <ChampionMastery> GetChampionMasterys(Summoner summoner) { return(api.GetChampionMasteries(RiotSharpAddition.RegionToPlatform(summoner.Region), summoner.Id)); }
// 非同期させたい(重たい)処理 private LoginState LoginDelegatingMethod(string reg, string summName, bool loginTypeFlg) { LoginState loginStateRet = new LoginState(); loginStateRet.LoginTypeFlg = loginTypeFlg; try { Region region = (Region)Enum.Parse(typeof(Region), reg); RiotSharp.Misc.Language language = RiotSharp.Misc.Language.en_US; if (region == Region.jp) { language = RiotSharp.Misc.Language.ja_JP; } if (m_Region == region) { if (!LoLStaticData.LoLStaticDataAlreadyLoaded()) { //LoLStaticData.ItemsStaticData = m_StaticRiotApi.GetStaticItems(region, ItemData.all, language); //LoLStaticData.ChampionsStaticData = m_StaticRiotApi.GetStaticChampions(region, ChampionData.all, language); //LoLStaticData.SummonerSpellsStaticData = m_StaticRiotApi.GetStaticSummonerSpells(region, SummonerSpellData.all, language); } } else { //LoLStaticData.ItemsStaticData = m_StaticRiotApi.GetStaticItems(region, ItemData.all, language); //LoLStaticData.ChampionsStaticData = m_StaticRiotApi.GetStaticChampions(region, ChampionData.all, language); //LoLStaticData.SummonerSpellsStaticData = m_StaticRiotApi.GetStaticSummonerSpells(region, SummonerSpellData.all, language); } m_Region = region; _loginSummoner = m_RiotApi.GetSummonerByName(region, summName); var matches = m_RiotApi.GetMacthAllByAccountId(region, _loginSummoner.AccountId).Matches; var mrbListBk = new List <MatchReferenceBinding>(); foreach (MatchReferenceDto mr in matches) { var mrb = new MatchReferenceBinding(); mrb.MatchReference = mr; mrbListBk.Add(mrb); } if (_viewModel.ListMatchReference != null) { _viewModel.ListMatchReference.Clear(); } if (_viewModel.ListMatchReferenceBK != null) { _viewModel.ListMatchReferenceBK.Clear(); } _viewModel.ListMatchReferenceBK = mrbListBk; _viewModel.ListMatchReference = mrbListBk; var championMasteries = m_RiotApi.GetChampionMasteries(region, _loginSummoner.Id); var cmbList = new List <ChampionMasteryBinding>(); foreach (ChampionMasteryDTO cmDto in championMasteries) { var cmb = new ChampionMasteryBinding(cmDto); cmbList.Add(cmb); } for (int i = cmbList.Count - 1; i >= 0; i--) { var existDto = _viewModel.ListMatchReferenceBK.Where(lmrBk => lmrBk.MatchReference.Champion == cmbList[i].ChampionMastery.ChampionId); if (existDto == null || existDto.ToArray().Length == 0) { cmbList.RemoveAt(i); } } if (_viewModel.ListChampionMasteries != null) { _viewModel.ListChampionMasteries.Clear(); } var cmbEmpty = new ChampionMasteryBinding(new ChampionMasteryDTO()); cmbEmpty.ChampionMastery.ChampionId = -1; cmbList.Insert(0, cmbEmpty); _viewModel.ListChampionMasteries = cmbList; loginStateRet.LoginErrorFlg = false; loginStateRet.LoginErrorMessage = string.Empty; } catch (RiotSharpException rsEx) { _viewModel.ListMatchReference = null; loginStateRet.LoginErrorFlg = true; loginStateRet.LoginErrorMessage = rsEx.Message; } catch (Exception ex) { _viewModel.ListMatchReference = null; if (ex.InnerException != null && ex.InnerException is RiotSharpException) { loginStateRet.LoginErrorMessage = ex.InnerException.Message; } else { loginStateRet.LoginErrorMessage = ex.Message; } loginStateRet.LoginErrorFlg = true; } return(loginStateRet); }