ui基本完毕,修了一大把的bug

This commit is contained in:
2026-07-13 02:28:39 +08:00
parent 1e20d73e90
commit fd22501f71
958 changed files with 378289 additions and 41038 deletions
+21 -1
View File
@@ -1,9 +1,12 @@
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using System.Text.RegularExpressions;
public class get_item_prefab : MonoBehaviour
{
private static readonly Regex RichTextTagRegex = new Regex("<.*?>", RegexOptions.Compiled);
[SerializeField] private bool testColorChange;
[SerializeField] private Color defaultItemNameColor = Color.white;
public Image item_btm;
@@ -41,7 +44,14 @@ public class get_item_prefab : MonoBehaviour
if (itemName != null)
{
itemName.text = displayName ?? string.Empty;
string resolvedName = displayName ?? string.Empty;
itemName.supportRichText = testColorChange;
if (!testColorChange)
{
resolvedName = StripRichTextTags(resolvedName);
}
itemName.text = resolvedName;
}
ApplyItemNameColor(testColorChange ? qualityColor : defaultItemNameColor);
@@ -66,4 +76,14 @@ public class get_item_prefab : MonoBehaviour
itemName.color = color;
}
}
private static string StripRichTextTags(string value)
{
if (string.IsNullOrEmpty(value))
{
return string.Empty;
}
return RichTextTagRegex.Replace(value, string.Empty);
}
}