//显示装备属性 public void ShowAttr(GameItem item, bool bUnEquiped = false) { ClearInfo(); //获得身上对应槽位的装备 int slotindex = item.GetEquipSlotIndex(); GameItem compareEquip = GameManager.gameManager.PlayerDataPool.EquipPack.GetItem(slotindex); Tab_EquipAttr line = TableManager.GetEquipAttrByID(item.DataID, 0); if (line != null) { int index = 0; //血上限 if (line.HP > 0 && index < m_Attr.Length && index >= 0) { string strColor = GetAttrColor(bUnEquiped, compareEquip, line.HP, "HP"); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString(COMBATATTE.MAXHP); m_AttrValue[index].text = strColor + string.Format("+{0}", (int)(line.HP * item.GetAttrFactorRefix())); m_AttrWhole[index].SetActive(true); //强化 SetEnchanceAndStarAttr(item, index, line.HP); ++index; } //血上限(百分比) if (line.HPPer > 0 && index < m_Attr.Length && index >= 0) { string strColor = GetAttrColor(bUnEquiped, compareEquip, line.HPPer, "HPPer"); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString(COMBATATTE.MAXHP); m_AttrValue[index].text = strColor + string.Format("+{0}%", (int)(line.HPPer * 100)); m_AttrWhole[index].SetActive(true); ++index; } //蓝上限 if (line.MP > 0 && index < m_Attr.Length && index >= 0) { string strColor = GetAttrColor(bUnEquiped, compareEquip, line.MP, "MP"); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString(COMBATATTE.MAXMP); m_AttrValue[index].text = strColor + string.Format("+{0}", (int)(line.MP * item.GetAttrFactorRefix())); m_AttrWhole[index].SetActive(true); //强化 SetEnchanceAndStarAttr(item, index, line.MP); ++index; } //蓝上限(百分比) if (line.MPPer > 0 && index < m_Attr.Length && index >= 0) { string strColor = GetAttrColor(bUnEquiped, compareEquip, line.MPPer, "MPPer"); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString(COMBATATTE.MAXMP); m_AttrValue[index].text = strColor + string.Format("+{0}%", (int)(line.MPPer * 100)); m_AttrWhole[index].SetActive(true); ++index; } //物理攻击 if (line.PhysicsAttack > 0 && index < m_Attr.Length && index >= 0) { string strColor = GetAttrColor(bUnEquiped, compareEquip, line.PhysicsAttack, "PhysicsAttack"); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString(COMBATATTE.PYSATTACK); m_AttrValue[index].text = strColor + string.Format("+{0}", (int)(line.PhysicsAttack * item.GetAttrFactorRefix())); m_AttrWhole[index].SetActive(true); //强化 SetEnchanceAndStarAttr(item, index, line.PhysicsAttack); ++index; } //物理攻击(百分比) if (line.PhysicsAttackPer > 0 && index < m_Attr.Length && index >= 0) { string strColor = GetAttrColor(bUnEquiped, compareEquip, line.PhysicsAttackPer, "PhysicsAttackPer"); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString(COMBATATTE.PYSATTACK); m_AttrValue[index].text = strColor + string.Format("+{0}%", (int)(line.PhysicsAttackPer * 100)); m_AttrWhole[index].SetActive(true); ++index; } //法术攻击 if (line.MagicAttack > 0 && index < m_Attr.Length && index >= 0) { string strColor = GetAttrColor(bUnEquiped, compareEquip, line.MagicAttack, "MagicAttack"); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString(COMBATATTE.MAGATTACK); m_AttrValue[index].text = strColor + string.Format("+{0}", (int)(line.MagicAttack * item.GetAttrFactorRefix())); m_AttrWhole[index].SetActive(true); //强化 SetEnchanceAndStarAttr(item, index, line.MagicAttack); ++index; } //法术攻击(百分比) if (line.MagicAttackPer > 0 && index < m_Attr.Length && index >= 0) { string strColor = GetAttrColor(bUnEquiped, compareEquip, line.MagicAttackPer, "MagicAttackPer"); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString(COMBATATTE.MAGATTACK); m_AttrValue[index].text = strColor + string.Format("+{0}%", (int)(line.MagicAttackPer * 100)); m_AttrWhole[index].SetActive(true); ++index; } //物理防御 if (line.PhysicsDefence > 0 && index < m_Attr.Length && index >= 0) { string strColor = GetAttrColor(bUnEquiped, compareEquip, line.PhysicsDefence, "PhysicsDefence"); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString(COMBATATTE.PYSDEF); m_AttrValue[index].text = strColor + string.Format("+{0}", (int)(line.PhysicsDefence * item.GetAttrFactorRefix())); m_AttrWhole[index].SetActive(true); //强化 SetEnchanceAndStarAttr(item, index, line.PhysicsDefence); ++index; } //物理防御(百分比) if (line.PhysicsDefencePer > 0 && index < m_Attr.Length && index >= 0) { string strColor = GetAttrColor(bUnEquiped, compareEquip, line.PhysicsDefencePer, "PhysicsDefencePer"); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString(COMBATATTE.PYSDEF); m_AttrValue[index].text = strColor + string.Format("+{0}%", (int)(line.PhysicsDefencePer * 100)); m_AttrWhole[index].SetActive(true); ++index; } //法术防御 if (line.MagicDefence > 0 && index < m_Attr.Length && index >= 0) { string strColor = GetAttrColor(bUnEquiped, compareEquip, line.MagicDefence, "MagicDefence"); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString(COMBATATTE.MAGDEF); m_AttrValue[index].text = strColor + string.Format("+{0}", (int)(line.MagicDefence * item.GetAttrFactorRefix())); m_AttrWhole[index].SetActive(true); //强化 SetEnchanceAndStarAttr(item, index, line.MagicDefence); ++index; } //法术防御(百分比) if (line.MagicDefencePer > 0 && index < m_Attr.Length && index >= 0) { string strColor = GetAttrColor(bUnEquiped, compareEquip, line.MagicDefencePer, "MagicDefencePer"); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString(COMBATATTE.MAGDEF); m_AttrValue[index].text = strColor + string.Format("+{0}%", (int)(line.MagicDefencePer * 100)); m_AttrWhole[index].SetActive(true); ++index; } //攻击速度 if (line.AttackSpeed > 0 && index < m_Attr.Length && index >= 0) { //策划要求 隐藏装备攻速属性 //m_Attr[index].text = string.Format("{0}+{1}", ConvertAttrToString(COMBATATTE.ATTACKSPEED), line.AttackSpeed); //m_Attr[index].gameObject.SetActive(true); ////策划要求 攻速不受强化和打星影响 //++index; } //攻击速度(百分比) if (line.AttackSpeedPer > 0 && index < m_Attr.Length && index >= 0) { //策划要求 隐藏装备攻速属性 //m_Attr[index].text = string.Format("{0}+{1}%", ConvertAttrToString(COMBATATTE.ATTACKSPEED), line.AttackSpeedPer * 100); //m_Attr[index].gameObject.SetActive(true); //++index; } //全攻击 if (line.AllAttack > 0 && index < m_Attr.Length && index >= 0) { string strColor = GetAttrColor(bUnEquiped, compareEquip, line.AllAttack, "AllAttack"); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString((COMBATATTE)1000); m_AttrValue[index].text = strColor + string.Format("+{0}", (int)(line.AllAttack * item.GetAttrFactorRefix())); m_AttrWhole[index].SetActive(true); //强化 SetEnchanceAndStarAttr(item, index, line.AllAttack); ++index; } //全攻击(百分比) if (line.AllAttackPer > 0 && index < m_Attr.Length && index >= 0) { string strColor = GetAttrColor(bUnEquiped, compareEquip, line.AllAttackPer, "AllAttackPer"); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString((COMBATATTE)1000); m_AttrValue[index].text = strColor + string.Format("+{0}%", (int)(line.AllAttackPer * 100)); m_AttrWhole[index].SetActive(true); ++index; } //全防御 if (line.AllDefence > 0 && index < m_Attr.Length && index >= 0) { string strColor = GetAttrColor(bUnEquiped, compareEquip, line.AllDefence, "AllDefence"); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString((COMBATATTE)1001); m_AttrValue[index].text = strColor + string.Format("+{0}", (int)(line.AllDefence * item.GetAttrFactorRefix())); m_AttrWhole[index].SetActive(true); //强化 SetEnchanceAndStarAttr(item, index, line.AllDefence); ++index; } //全防御(百分比) if (line.AllDefencePer > 0 && index < m_Attr.Length && index >= 0) { string strColor = GetAttrColor(bUnEquiped, compareEquip, line.AllDefencePer, "AllDefencePer"); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString((COMBATATTE)1001); m_AttrValue[index].text = strColor + string.Format("+{0}%", (int)(line.AllDefencePer * 100)); m_AttrWhole[index].SetActive(true); ++index; } // delete cut lines //if (index >= 1) //{ // if ((index - 1) >= 0 && (index - 1) < m_CutLine.Length) // { // m_CutLine[index - 1].SetActive(true); // } //} //附加属性 for (int attrIndex = 0; attrIndex < line.getAddAttrTypeCount(); ++attrIndex) { int attrType = line.GetAddAttrTypebyIndex(attrIndex); float attrValue = line.GetAddAttrValuebyIndex(attrIndex); if ((attrType >= (int)COMBATATTE.MAXHP && attrType < (int)COMBATATTE.COMBATATTE_MAXNUM) || attrType == 1000 || attrType == 1001) { if (attrValue > 0) { if (index < m_Attr.Length && index >= 0) { //策划要求隐藏装备攻速属性 if (attrType == (int)COMBATATTE.ATTACKSPEED) { continue; } string strColor = GetAttrColor(bUnEquiped, compareEquip, attrValue, "AddAttr", attrIndex); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString((COMBATATTE)attrType); m_AttrValue[index].text = strColor + string.Format("+{0}", (int)attrValue); m_AttrWhole[index].SetActive(true); if (attrType != (int)COMBATATTE.ATTACKSPEED) //策划要求 攻速不受强化和打星影响 { //强化 SetEnchanceAndStarAttr(item, index, attrValue, true); //策划要求 附加属性不受打星影响 } ++index; } } } } //附加属性(百分比) for (int attrIndex = 0; attrIndex < line.getAddAttrTypeCount(); ++attrIndex) { int attrType = line.GetAddAttrTypebyIndex(attrIndex); float attrPer = line.GetAddAttrPerbyIndex(attrIndex); if (attrType >= (int)COMBATATTE.MAXHP && attrType < (int)COMBATATTE.COMBATATTE_MAXNUM && attrPer > 0) { if (index < m_Attr.Length && index >= 0) { string strColor = GetAttrColor(bUnEquiped, compareEquip, attrPer, "AddAttrPer", attrIndex); m_Attr[index].text = strColor + ItemTool.ConvertAttrToString((COMBATATTE)attrIndex); m_AttrValue[index].text = strColor + string.Format("+{0}%", (int)(attrPer * 100)); m_AttrWhole[index].SetActive(true); ++index; } } } //神器属性 if (item != null && item.IsShenQiEquipMent()) { Tab_ShenQiInfo _ShenQiInfo = TableManager.GetShenQiInfoByID(item.DataID, 0); if (_ShenQiInfo != null) { // 技能信息 int SkillInfIndex = (int)ShenQiDyData.SkillId; if (SkillInfIndex >= 0 && SkillInfIndex < item.DynamicData.Length) { Tab_SkillEx _skillEx = TableManager.GetSkillExByID(item.DynamicData[(int)ShenQiDyData.SkillId], 0); if (_skillEx != null) { Tab_SkillBase _SkillBase = TableManager.GetSkillBaseByID(_skillEx.BaseId, 0); if (_SkillBase != null) { // delete cut lines //if (index >= 1 && index - 1 < m_CutLine.Length) //{ // m_CutLine[index - 1].SetActive(true); //} m_ShenQiSkillNameLable.text = _SkillBase.Name + "(" + _skillEx.Level + "/" + _ShenQiInfo.MaxSkillLev + ")"; m_ShenQiSkillDescLable.text = _skillEx.SkillDesc; m_ShenQiSkillName.SetActive(true); m_ShenQiSkillDesc.SetActive(true); } } } //属性条 int nLastAttrIndex = -1; for (int i = 0; i < (int)ShenQiInfo.MAXRANDATTRNUM && i < m_ShenQiAttrWhole.Length; i++) { if (i + (int)ShenQiDyData.Attr1Info >= 0 && i + (int)ShenQiDyData.Attr1Info < item.DynamicData.Length) { int AttrRandData = item.DynamicData[i + (int)ShenQiDyData.Attr1Info]; if (AttrRandData > 0) { int AttrType = item.GetShenQiRandAttrType(AttrRandData); int AttrNum = item.GetShenQiRandAttrNum(AttrRandData); int AttrQuality = item.GetShenQiRandAttrQuality(AttrRandData); m_ShenQiAttrName[i].text = Utils.GetItemNameColor(AttrQuality + 1) + Utils.GetAttrTypeString(AttrType); //if (1 + _ShenQiInfo.ShenQiRefixPer > 0 && _ShenQiInfo.ShenQiRefixPer > 0) //{ // int nBaseAttr = (int)((AttrNum * 1.0f) / (1 + _ShenQiInfo.ShenQiRefixPer)); // int nFixAttr = (int)(AttrNum * _ShenQiInfo.ShenQiRefixPer); // m_ShenQiAttrValue[i].text = Utils.GetItemNameColor(AttrQuality+1) + "+" + nBaseAttr.ToString() + "+" + nFixAttr.ToString(); //} //else { m_ShenQiAttrValue[i].text = Utils.GetItemNameColor(AttrQuality + 1) + "+" + AttrNum; } m_ShenQiAttrWhole[i].SetActive(true); nLastAttrIndex = i; } } } //分界线 // m_ShenQiSkillCutLine.SetActive(true); if (nLastAttrIndex >= 0 && nLastAttrIndex < m_ShenQiAttrCutLine.Length) { m_ShenQiAttrCutLine[nLastAttrIndex].SetActive(true); } //m_ShenQiCutLine2.SetActive(true); } } //m_Grid.Reposition(); //m_TopGrid.Recenter(true); m_Table.sorted = true; m_Table.hideInactive = true; m_Table.keepWithinPanel = true; m_Table.repositionNow = true; } }