private void RefreshAttribute() { TransformUtil.ClearChildren(roleAttributeRoot, true); Dictionary <RoleAttributeType, RoleAttribute> roleAttributesDic = RoleUtil.CalcRoleAttributesDic(_roleInfo); roleAttributePrefab.gameObject.SetActive(true); foreach (var value in _attrDic) { RoleAttributeView view = Instantiate <RoleAttributeView>(roleAttributePrefab); view.transform.SetParent(roleAttributeRoot, false); view.Set(roleAttributesDic[value.Key]); } roleAttributePrefab.gameObject.SetActive(false); }
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); }
private void RefreshAttr() { TransformUtil.ClearChildren(attrRoot, true); List <RoleAttributeType> typeList = new List <RoleAttributeType>(); typeList.Add(RoleAttributeType.HP); typeList.Add(RoleAttributeType.MagicAtk); typeList.Add(RoleAttributeType.NormalAtk); typeList.Add(RoleAttributeType.Normal_Def); typeList.Add(RoleAttributeType.Speed); List <RoleAttribute> attrList = PlayerUtil.CalcPlayerAttributesList(GameProxy.instance.PlayerInfo, typeList); for (int i = 0, count = attrList.Count; i < count; i++) { RoleAttributeView view = Instantiate <RoleAttributeView>(attrPrefab); view.gameObject.SetActive(true); view.transform.SetParent(attrRoot, false); view.Set(attrList[i]); } }
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); } }