예제 #1
0
        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();
        }
        private void RefreshSelector(SelectorVM <SelectorItemVM> selector, List <TextObject> texts, int index, Action <SelectorVM <SelectorItemVM> > action)
        {
            if (selector == null)
            {
                return;
            }
            var bindings = new MBBindingList <SelectorItemVM>();

            foreach (var textObject in texts)
            {
                bindings.Add(new SelectorItemVM(textObject));
            }

            selector.SetOnChangeAction(null);
            selector.ItemList      = bindings;
            selector.SelectedIndex = -1;
            selector.SetOnChangeAction(action);
            selector.SelectedIndex = index;
        }
예제 #3
0
        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);
        }