public void RefreshCompanionSelector() { CompanionSelector = new SelectorVM <CompanionSelectorItemVM>(0, OnCompanionSelectorChange); CompanionSelector.SetOnChangeAction(null); CompanionSelector.AddItem(new CompanionSelectorItemVM(null, true, null)); CompanionSelector.SelectedIndex = 0; foreach (Hero hero in Clan.PlayerClan.Companions) { var item = new CompanionSelectorItemVM(hero, true, ""); CompanionSelector.AddItem(item); } var current = Campaign.Current.GetCampaignBehavior <CanvassBehavior>().GetCurrent(this.CurrentSelectedClan?.Clan); for (int i = 0; i < CompanionSelector.ItemList.Count; i++) { if (current != null && current == CompanionSelector.ItemList[i].Hero) { CompanionSelector.SelectedIndex = i; break; } } CompanionSelector.SetOnChangeAction(OnCompanionSelectorChange); UpdateCanvassRelationGainText(current, CurrentSelectedClan.Clan); RefreshCurrentCanvassClanText(); }
public void UpdateLearningSkillSelection() { LearningSkillSelection = new SelectorVM <SkillLearningSelectorItemVM>(0, OnLearningSkillSelectionChange); LearningSkillSelection.SetOnChangeAction(null); foreach (SkillObject skillObject in SkillObject.All) { SkillLearningSelectorItemVM item = new SkillLearningSelectorItemVM(skillObject, true, ""); LearningSkillSelection.AddItem(item); } var current = Campaign.Current.GetCampaignBehavior <HeroLearningSkillBehaviour>().getHeroLearningSkill(_hero); for (int i = 0; i < LearningSkillSelection.ItemList.Count; i++) { if (current != null && current == LearningSkillSelection.ItemList[i].Skill) { LearningSkillSelection.SelectedIndex = i; break; } } LearningSkillSelection.SetOnChangeAction(OnLearningSkillSelectionChange); }