public void InitializeBuilding(Dictionary <string, UpgradePurchases> purchases) { Heroes.Clear(); EventHeroes.Clear(); GraveIndexes.Clear(); Reset(); for (int i = RosterSlotUpgrades.Count - 1; i >= 0; i--) { if (purchases[RosterSlotUpgrades[i].TreeId].PurchasedUpgrades.Contains(RosterSlotUpgrades[i].UpgradeCode)) { RosterSlots = RosterSlotUpgrades[i].NumberOfSlots; break; } } for (int i = RecruitSlotUpgrades.Count - 1; i >= 0; i--) { if (purchases[RecruitSlotUpgrades[i].TreeId].PurchasedUpgrades.Contains(RecruitSlotUpgrades[i].UpgradeCode)) { RecruitSlots = RecruitSlotUpgrades[i].NumberOfSlots; break; } } for (int i = RecruitExperienceUpgrades.Count - 1; i >= 0; i--) { if (purchases[RecruitExperienceUpgrades[i].TreeId].PurchasedUpgrades.Contains(RecruitExperienceUpgrades[i].UpgradeCode)) { CurrentRecruitMaxLevel = RecruitExperienceUpgrades[i].Level; break; } } }
public void OnSearchHero(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args) { sender.IsSuggestionListOpen = false; if (string.IsNullOrWhiteSpace(sender.Text)) { ResetHeroesList(); return; } var list = allHeroes.Where(hero => hero.Name.ToLower().Contains(sender.Text.ToLower())).ToList(); Heroes.Clear(); list.ForEach(hero => Heroes.Add(hero)); }
private async Task Init() { LoadingHeroes = InitLoading = true; var filter = new ApiFilters(); Heroes.Clear(); var data = await GetCharactersDataAsync(filter); while (data.Count > 0) { data.ForEach(hero => Heroes.Add(hero)); data.ForEach(hero => allHeroes.Add(hero)); LoadingHeroes = false; filter.Offset += 50; data = await GetCharactersDataAsync(filter); } InitLoading = false; }
private void ResetHeroesList() { Heroes.Clear(); allHeroes.ForEach(a => Heroes.Add(a)); }