From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/Equip/EquipAttrData.cs | 119 +++++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/Equip/EquipAttrData.cs (limited to 'Client/Assets/Scripts/XMainClient/Equip/EquipAttrData.cs') diff --git a/Client/Assets/Scripts/XMainClient/Equip/EquipAttrData.cs b/Client/Assets/Scripts/XMainClient/Equip/EquipAttrData.cs new file mode 100644 index 00000000..4703e1e5 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/Equip/EquipAttrData.cs @@ -0,0 +1,119 @@ +using System; +using XMainClient.UI; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class EquipAttrData + { + public uint Slot + { + get + { + return this.m_slot; + } + } + + public uint AttrId + { + get + { + return this.m_attrId; + } + } + + public bool IsCanSmelt + { + get + { + return this.m_isCanSmelt; + } + } + + public uint Prob + { + get + { + return this.m_prob; + } + } + + public EquipAttrRange RangValue + { + get + { + return this.m_rang; + } + } + + private uint m_slot = 0u; + + private uint m_attrId = 0u; + + private uint m_prob = 0u; + + private bool m_isCanSmelt = false; + + private EquipAttrRange m_rang; + + public EquipAttrData(RandomAttributes.RowData row) + { + this.m_slot = (uint)row.Slot; + this.m_attrId = (uint)row.AttrID; + this.m_prob = (uint)row.Prob; + this.m_isCanSmelt = (row.CanSmelt == 1); + this.m_rang = new EquipAttrRange(row.Range); + } + + public EquipAttrData(ForgeAttributes.RowData row) + { + this.m_slot = (uint)row.Slot; + this.m_attrId = (uint)row.AttrID; + this.m_prob = (uint)row.Prob; + this.m_isCanSmelt = (row.CanSmelt == 1); + this.m_rang = new EquipAttrRange(row.Range); + } + + public double GetPercentValue(uint attrValue) + { + float num = (this.m_rang.D_value == 0f) ? 1f : this.m_rang.D_value; + bool flag = attrValue < this.m_rang.Max; + double num2; + if (flag) + { + num2 = (double)((attrValue - this.m_rang.Min) * 100f / num); + } + else + { + num2 = 100.0; + } + return num2 / 100.0; + } + + public string GetColor(uint attrValue) + { + float num = (this.m_rang.D_value == 0f) ? 1f : this.m_rang.D_value; + bool flag = attrValue != this.m_rang.Max; + float num2; + if (flag) + { + num2 = (attrValue - this.m_rang.Min) * 100f / num; + } + else + { + num2 = 100f; + } + int quality = EquipAttrDataMgr.MarkList.Count - 1; + for (int i = 0; i < EquipAttrDataMgr.MarkList.Count; i++) + { + bool flag2 = num2 < (float)EquipAttrDataMgr.MarkList[i]; + if (flag2) + { + quality = i; + break; + } + } + return XSingleton.singleton.GetItemQualityRGB(quality); + } + } +} -- cgit v1.1-26-g67d0