ui基本完毕,修了一大把的bug
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,6 +203,7 @@ MonoBehaviour:
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
testColorChange: 0
|
||||
defaultItemNameColor: {r: 1, g: 1, b: 1, a: 1}
|
||||
item_btm: {fileID: 7767232844961157683}
|
||||
itemProfile: {fileID: 514154942639368217}
|
||||
itemAmount: {fileID: 508704441844867492}
|
||||
|
||||
Reference in New Issue
Block a user