예제 #1
0
        private void RefreshAttr()
        {
            TransformUtil.ClearChildren(attrViewRoot, true);
            //attr
            List <RoleAttribute> attrList = RoleUtil.CalcRoleMainAttributesList(_roleInfo);
            int count = attrList.Count;

            for (int i = 0; i < count; i++)
            {
                RoleAttributeView view = Instantiate <RoleAttributeView>(attrViewPrefab);
                view.transform.SetParent(attrViewRoot, false);
                view.Set(attrList[i]);
            }
            attrViewPrefab.gameObject.SetActive(false);
        }
예제 #2
0
        private void RefreshMainAttribute(int addLevel)
        {
            RoleInfo roleInfo = HeroStrengthenProxy.instance.StrengthenHeroInfo;

            TransformUtil.ClearChildren(heroAttributeViewRoot, true);

            //List<RoleAttribute> mainAttriList = HeroUtil.CalcHeroMainAttributesByHeroType(heroInfo);
            //HeroInfo nextTemp = new HeroInfo(0,heroInfo.heroData.id,heroInfo.breakthroughLevel,heroInfo.strengthenLevel+addLevel,heroInfo.advanceLevel,heroInfo.level);
            List <RoleAttribute> mainAttriList = RoleUtil.CalcRoleMainAttributesList(roleInfo);
            RoleInfo             nextTemp      = null;

            if ((roleInfo as HeroInfo) != null)
            {
                nextTemp = new HeroInfo(roleInfo.instanceID, roleInfo.modelDataId, roleInfo.breakthroughLevel, roleInfo.strengthenLevel + addLevel, roleInfo.advanceLevel, roleInfo.level);
            }
            else if ((roleInfo as PlayerInfo) != null)
            {
                nextTemp = new PlayerInfo(0, (uint)roleInfo.modelDataId, 0, 0, 0, 0, "");
                nextTemp.breakthroughLevel = roleInfo.breakthroughLevel;
                nextTemp.strengthenLevel   = roleInfo.strengthenLevel + addLevel;
                nextTemp.advanceLevel      = roleInfo.advanceLevel;
                nextTemp.level             = roleInfo.level;
            }

            bool isMaxLevel = HeroStrengthenNeedData.IsMaxLevel(roleInfo.strengthenLevel);
            List <RoleAttribute> nextMainAttriList = RoleUtil.CalcRoleMainAttributesList(nextTemp);

            heroAttributeViewPrefab.gameObject.SetActive(true);
            for (int i = 0, count = mainAttriList.Count; i < count; i++)
            {
                AttributeView view = Instantiate <AttributeView>(heroAttributeViewPrefab);
                Transform     tran = view.transform;
                tran.SetParent(heroAttributeViewRoot, false);
                if (isMaxLevel)
                {
                    view.Set(mainAttriList[i]);
                }
                else
                {
                    view.Set(mainAttriList[i], (int)(nextMainAttriList[i].value - mainAttriList[i].value));
                }
            }
            heroAttributeViewPrefab.gameObject.SetActive(false);
        }