Ejemplo n.º 1
0
        public static List <RoleAttribute> CalcRoleMainAttributesList(RoleInfo roleInfo)
        {
            PlayerInfo player = roleInfo as PlayerInfo;
            HeroInfo   hero   = roleInfo as HeroInfo;

            if (player != null)
            {
                return(PlayerUtil.CalcPlayerMainAttributesList(player));
            }
            if (hero != null)
            {
                return(HeroUtil.CalcHeroMainAttributesList(hero));
            }
            return(null);
        }
Ejemplo n.º 2
0
        private void RefreshAttribute()
        {
            HeroInfo heroInfo = HeroAdvanceProxy.instance.advanceHeroInfo;

            TransformUtil.ClearChildren(attributeRoot, true);
            List <RoleAttribute> attributeList = HeroUtil.CalcHeroMainAttributesList(heroInfo);
            int count = attributeList.Count;

            if (!heroInfo.IsMaxAdvanceLevel)
            {
                //next
                HeroInfo             nextInfo          = new HeroInfo(heroInfo.instanceID, heroInfo.heroData.id, heroInfo.breakthroughLevel, heroInfo.strengthenLevel, heroInfo.advanceLevel + 1, heroInfo.level);
                List <RoleAttribute> nextAttributeList = HeroUtil.CalcHeroMainAttributesList(nextInfo);
                attributePrefab.SetActive(true);
                for (int i = 0; i < count; i++)
                {
                    GameObject go = Instantiate <GameObject>(attributePrefab);
                    go.transform.SetParent(attributeRoot, false);
                    RoleAttributeView view = go.GetComponent <RoleAttributeView>();
                    int add = (int)(nextAttributeList[i].value - attributeList[i].value);
                    view.Set(attributeList[i], add, false);
                }
                attributePrefab.SetActive(false);
            }
            else
            {
                attributePrefab.SetActive(true);
                for (int i = 0; i < count; i++)
                {
                    GameObject go = Instantiate <GameObject>(attributePrefab);
                    go.transform.SetParent(attributeRoot, false);
                    RoleAttributeView roleAttributeView = go.GetComponent <RoleAttributeView>();
                    roleAttributeView.Set(attributeList[i], Localization.Get("ui.hero_advance_view.role_attribute_max_remark"));
                }
                attributePrefab.SetActive(false);
            }
        }