[optimize][textstyle] support sprite asset of TextMeshPro (#201)

This commit is contained in:
monitor1394
2022-06-21 08:15:48 +08:00
parent 5bc14dd37a
commit 8a6253621b
3 changed files with 13 additions and 0 deletions

View File

@@ -54,6 +54,7 @@
## master
* (2022.06.21) 增加`TextStyle``TextMeshPro``Sprite Asset`支持 (#201)
* (2022.06.20) 优化`Tooltip`的边界限制 (#202)
* (2022.06.20) 修复`TextMeshPro`开启时编译错误
* (2022.06.20) 修复`Animation`的渐出动画不生效的问题

View File

@@ -29,6 +29,7 @@ namespace XCharts.Editor
PropertyField(prop, "m_LineSpacing");
#if dUI_TextMeshPro
PropertyField(prop, "m_TMPFontStyle");
PropertyField(prop, "m_TMPSpriteAsset");
PropertyField(prop, "m_TMPAlignment");
#else
PropertyField(prop, "m_FontStyle");

View File

@@ -28,6 +28,7 @@ namespace XCharts.Runtime
[SerializeField] private TMP_FontAsset m_TMPFont;
[SerializeField] private FontStyles m_TMPFontStyle = FontStyles.Normal;
[SerializeField] private TextAlignmentOptions m_TMPAlignment = TextAlignmentOptions.Left;
[SerializeField] private TMP_SpriteAsset m_TMPSpriteAsset;
#endif
public bool show
{
@@ -154,6 +155,15 @@ namespace XCharts.Runtime
get { return m_TMPAlignment; }
set { if (PropertyUtil.SetStruct(ref m_TMPAlignment, value)) SetComponentDirty(); }
}
/// <summary>
/// the sprite asset of TextMeshPro.
/// |TextMeshPro的Sprite Asset。
/// </summary>
public TMP_SpriteAsset tmpSpriteAsset
{
get { return m_TMPSpriteAsset; }
set { if (PropertyUtil.SetClass(ref m_TMPSpriteAsset, value)) SetComponentDirty(); }
}
#endif
public TextStyle() { }
@@ -198,6 +208,7 @@ namespace XCharts.Runtime
#if dUI_TextMeshPro
m_TMPFont = textStyle.tmpFont;
m_TMPFontStyle = textStyle.tmpFontStyle;
m_TMPSpriteAsset = textStyle.tmpSpriteAsset;
#endif
}