23 [SerializeField]
private Font m_Font;
24 [SerializeField]
private bool m_AutoWrap =
false;
25 [SerializeField]
private bool m_AutoAlign =
true;
26 [SerializeField]
private float m_Rotate = 0;
27 [SerializeField]
private Vector2 m_Offset = Vector2.zero;
28 [SerializeField]
private Color m_Color = Color.clear;
29 [SerializeField]
private Color m_BackgroundColor = Color.clear;
30 [SerializeField]
private int m_FontSize = 0;
31 [SerializeField]
private FontStyle m_FontStyle = FontStyle.Normal;
32 [SerializeField]
private float m_LineSpacing = 1f;
33 [SerializeField]
private TextAnchor m_Alignment = TextAnchor.MiddleCenter;
35 [SerializeField]
private TMP_FontAsset m_TMPFont;
36 [SerializeField]
private FontStyles m_TMPFontStyle = FontStyles.Normal;
37 [SerializeField]
private TextAlignmentOptions m_TMPAlignment = TextAlignmentOptions.Left;
46 get {
return m_Rotate; }
47 set {
if (PropertyUtil.SetStruct(ref m_Rotate, value)) SetComponentDirty(); }
56 get {
return m_Offset; }
57 set {
if (PropertyUtil.SetStruct(ref m_Offset, value)) SetComponentDirty(); }
60 public Vector3 offsetv3 {
get {
return new Vector3(m_Offset.x, m_Offset.y, 0); } }
69 get {
return m_Color; }
70 set {
if (PropertyUtil.SetColor(ref m_Color, value)) SetComponentDirty(); }
79 get {
return m_BackgroundColor; }
80 set {
if (PropertyUtil.SetColor(ref m_BackgroundColor, value)) SetComponentDirty(); }
89 get {
return m_Font; }
90 set {
if (PropertyUtil.SetClass(ref m_Font, value)) SetComponentDirty(); }
99 get {
return m_FontSize; }
100 set {
if (PropertyUtil.SetStruct(ref m_FontSize, value)) SetComponentDirty(); }
109 get {
return m_FontStyle; }
110 set {
if (PropertyUtil.SetStruct(ref m_FontStyle, value)) SetComponentDirty(); }
119 get {
return m_LineSpacing; }
120 set {
if (PropertyUtil.SetStruct(ref m_LineSpacing, value)) SetComponentDirty(); }
127 get {
return m_AutoWrap; }
128 set {
if (PropertyUtil.SetStruct(ref m_AutoWrap, value)) SetComponentDirty(); }
135 get {
return m_AutoAlign; }
136 set {
if (PropertyUtil.SetStruct(ref m_AutoAlign, value)) SetComponentDirty(); }
143 get {
return m_Alignment; }
144 set {
if (PropertyUtil.SetStruct(ref m_Alignment, value)) SetComponentDirty(); }
147 public TMP_FontAsset tmpFont
149 get {
return m_TMPFont; }
150 set {
if (PropertyUtil.SetClass(ref m_TMPFont, value)) SetComponentDirty(); }
153 public FontStyles tmpFontStyle
155 get {
return m_TMPFontStyle; }
156 set {
if (PropertyUtil.SetStruct(ref m_TMPFontStyle, value)) SetComponentDirty(); }
158 public TextAlignmentOptions tmpAlignment
160 get {
return m_TMPAlignment; }
161 set {
if (PropertyUtil.SetStruct(ref m_TMPAlignment, value)) SetComponentDirty(); }
195 public void Copy(TextStyle textStyle)
197 font = textStyle.font;
198 rotate = textStyle.rotate;
199 offset = textStyle.offset;
200 color = textStyle.color;
209 m_TMPFont = textStyle.tmpFont;
210 m_TMPAlignment = textStyle.tmpAlignment;
211 m_TMPFontStyle = textStyle.tmpFontStyle;
215 public void UpdateAlignmentByLocation(Location location)
218 m_TMPAlignment = location.runtimeTMPTextAlignment;
220 m_Alignment = location.runtimeTextAlignment;
224 public Color GetColor(Color defaultColor)
226 if (ChartHelper.IsClearColor(
color))
return defaultColor;
230 public int GetFontSize(ComponentTheme defaultTheme)
232 if (
fontSize == 0)
return defaultTheme.fontSize;
236 public TextAnchor GetAlignment(TextAnchor systemAlignment)
238 return m_AutoAlign ? systemAlignment :
alignment;