From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- Client/Assets/Scripts/XMainClient/UI/AttrParam.cs | 57 +++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/UI/AttrParam.cs (limited to 'Client/Assets/Scripts/XMainClient/UI/AttrParam.cs') diff --git a/Client/Assets/Scripts/XMainClient/UI/AttrParam.cs b/Client/Assets/Scripts/XMainClient/UI/AttrParam.cs new file mode 100644 index 00000000..d8457f75 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/UI/AttrParam.cs @@ -0,0 +1,57 @@ +using System; +using System.Text; + +namespace XMainClient.UI +{ + internal struct AttrParam + { + public static StringBuilder TextSb = new StringBuilder(); + + public static StringBuilder ValueSb = new StringBuilder(); + + public string strText; + + public string strValue; + + public bool IsShowTipsIcon; + + public string IconName; + + public static void ResetSb() + { + AttrParam.TextSb.Length = 0; + AttrParam.ValueSb.Length = 0; + } + + public static void Append(StringBuilder sb, string s, string color = "") + { + bool flag = !string.IsNullOrEmpty(color); + if (flag) + { + sb.Append("[").Append(color).Append("]"); + } + sb.Append(s); + bool flag2 = !string.IsNullOrEmpty(color); + if (flag2) + { + sb.Append("[-]"); + } + } + + public static void Append(XItemChangeAttr attr, string textColor = "", string valueColor = "") + { + AttrParam.Append(AttrParam.TextSb, XAttributeCommon.GetAttrStr((int)attr.AttrID), textColor); + AttrParam.Append(AttrParam.ValueSb, XAttributeCommon.GetAttrValueStr((int)attr.AttrID, attr.AttrValue), valueColor); + } + + public void SetTextFromSb() + { + this.strText = AttrParam.TextSb.ToString(); + } + + public void SetValueFromSb() + { + this.strValue = AttrParam.ValueSb.ToString(); + } + } +} -- cgit v1.1-26-g67d0