public override void RefreshPanel(PItem item, EquipType type) { base.RefreshPanel(item, type); int level = data.GetIntentyLevel(); Util.SetText(m_levelText, (int)TextForMatType.EquipEvolveUI, 3, level.ToString()); m_levelText.SafeSetActive(level > 0); level = data.GetEvolveLevel(); //获取的是下一级的进阶显示 EvolveEquipInfo info = moduleEquip.GetEvolveInfo(equipType, level + 1); if (info == null) { return; } List <PItem> currenProps = moduleEquip.GetBagProps(PropType.EvolveProp); RefreshMatItem(info.materials, currenProps); RefreshLevel(); RefreshAttributes(info); bool moneyEnough = Module_Player.instance.roleInfo.coin > info.costNumber; Util.SetText(m_evoCostText, moneyEnough ? info.costNumber.ToString() : GeneralConfigInfo.GetNoEnoughColorString(info.costNumber.ToString())); bool materialEnough = Module_Equip.GetMaterialEnoughState(info.materials, currenProps); m_evoBtn.SetInteractable(moneyEnough && materialEnough && SendEvolve); }
private void RefreshAttributes(EvolveEquipInfo info) { List <AttributePreviewDetail> list = GetAttributeDetails(info); for (int i = 0; i < list.Count; i++) { if (i >= m_attriList.Count) { break; } m_attriList[i].RefreshDetail(list[i]); } }
private List <AttributePreviewDetail> GetAttributeDetails(EvolveEquipInfo info) { var list = new List <AttributePreviewDetail>(); if (info.attributes == null) { return(list); } foreach (var item in info.attributes) { //获取道具的初始属性 var originalAttri = PropItemInfo.GetBaseAttribute(itemInfo, item.id); //计算属性(百分比或者累加) var value = ItemAttachAttr.CalculateAttributeValue(originalAttri, item); if (!ContainSameAttirbutePreview(list, item.id)) { double oldValue = data.GetFixedAttirbute(item.id); if (oldValue == 0 && value == 0) { continue; } var de = new AttributePreviewDetail(item.id); de.oldValue = oldValue; //must before set newValue de.FixPercentAttribute(); de.newValue = de.oldValue + value; list.Add(de); } else { var de = list.Find(o => o.id == item.id); de.newValue += value; } } return(list); }