Esempio n. 1
0
        private void UpdateSelectState(HeroItem item, bool select)
        {
            string name = item.name;

            if (name == string.Empty)
            {
                return;
            }
            bool flag = this.select_heros.Contains(name);

            if (this.battle_type == BattleType.YZ && !this.TBCCheckLive(name, null))
            {
                select = false;
                flag   = false;
            }
            if (select)
            {
                if (flag)
                {
                    return;
                }
                int num = this.select_heros.LastIndexOf(string.Empty);
                this.select_heros[num] = name;
                bool           isMaster = this.select_heros.IndexOf(name) == this.select_heros.Count - 1;
                SelectHeroItem child    = this.selectedHeroView.GetChild(num);
                child.ShowHero(name, true);
                child.UpdateSelect(true, isMaster);
                child.name = name;
                HeroItem child2 = this.favouredHeroView.GetChild(name);
                child2.UpdateSelect(true, num == this.select_heros.Count - 1);
            }
            else
            {
                if (!flag)
                {
                    return;
                }
                int index = this.select_heros.IndexOf(name);
                this.select_heros[index] = string.Empty;
                SelectHeroItem child3 = this.selectedHeroView.GetChild(index);
                child3.ShowHero(string.Empty, true);
                child3.UpdateSelect(true, false);
                child3.name = string.Empty;
                HeroItem child4 = this.favouredHeroView.GetChild(name);
                child4.UpdateSelect(false, false);
            }
        }
Esempio n. 2
0
        private void OnSelectedHeroItemChanged(SelectHeroItem item, int dataIndex, CompositeView <SelectHeroItem> parent)
        {
            bool flag     = this.select_heros != null && dataIndex >= 0 && dataIndex < this.select_heros.Count;
            bool isMaster = dataIndex == this.select_heros.Count - 1;

            if (flag)
            {
                string text = this.select_heros[dataIndex];
                item.SetActive(true);
                item.ShowHero(text, true);
                item.name = text;
                item.UpdateSelect(true, isMaster);
            }
            else
            {
                item.ShowHero(string.Empty, true);
                item.name = string.Empty;
                item.UpdateSelect(false, isMaster);
            }
            item.OnChangeHeroCallback = new Callback <HeroItem, bool>(this.OnChangeSelectedHero);
        }