Exemplo 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);
            }
        }
Exemplo n.º 2
0
        private void OnHeroItemChanged(HeroItem item, int dataIndex, CompositeView <HeroItem> parent)
        {
            string text       = this.all_heros[dataIndex];
            bool   isMaster   = this.select_heros.LastIndexOf(text) == this.select_heros.Count - 1;
            bool   isSelected = this.select_heros.Contains(text);

            item.name       = text;
            item.battletype = this.battle_type;
            item.ShowHero(text, false);
            if (this.battle_type == BattleType.YZ)
            {
                if (this.TBCCheckLive(text, item))
                {
                    item.OnChangeHeroCallback = new Callback <HeroItem, bool>(this.OnChangeFavouredHero);
                }
            }
            else
            {
                item.OnChangeHeroCallback = new Callback <HeroItem, bool>(this.OnChangeFavouredHero);
            }
            item.UpdateSelect(isSelected, isMaster);
        }