8 using System.Collections.Generic;
49 [SerializeField]
private bool m_Show;
50 [SerializeField]
private Type m_Type;
51 [SerializeField]
private string m_Formatter;
52 [SerializeField]
private string m_ItemFormatter;
53 [SerializeField]
private string m_TitleFormatter;
54 [SerializeField]
private float m_FixedWidth = 0;
55 [SerializeField]
private float m_FixedHeight = 0;
56 [SerializeField]
private float m_MinWidth = 0;
57 [SerializeField]
private float m_MinHeight = 0;
58 [SerializeField]
private string m_NumericFormatter =
"";
59 [SerializeField]
private float m_PaddingLeftRight = 5f;
60 [SerializeField]
private float m_PaddingTopBottom = 5f;
61 [SerializeField]
private bool m_IgnoreDataShow =
false;
62 [SerializeField]
private string m_IgnoreDataDefaultContent =
"-";
63 [SerializeField]
private bool m_AlwayShow =
false;
64 [SerializeField]
private Vector2 m_Offset =
new Vector2(18f, -25f);
65 [SerializeField]
private Sprite m_BackgroundImage;
70 private GameObject m_GameObject;
71 private GameObject m_Content;
73 private Image m_ContentImage;
74 private RectTransform m_ContentRect;
75 private RectTransform m_ContentTextRect;
76 private List<int> lastDataIndex =
new List<int>();
84 get {
return m_Show; }
85 set {
if (PropertyUtil.SetStruct(ref m_Show, value)) { SetAllDirty();
SetActive(value); } }
93 get {
return m_Type; }
94 set {
if (PropertyUtil.SetStruct(ref m_Type, value)) SetAllDirty(); }
129 public string formatter {
get {
return m_Formatter; }
set { m_Formatter = value; } }
136 public string titleFormatter {
get {
return m_TitleFormatter; }
set { m_TitleFormatter = value; } }
142 public string itemFormatter {
get {
return m_ItemFormatter; }
set { m_ItemFormatter = value; } }
148 public float fixedWidth {
get {
return m_FixedWidth; }
set { m_FixedWidth = value; } }
153 public float fixedHeight {
get {
return m_FixedHeight; }
set { m_FixedHeight = value; } }
158 public float minWidth {
get {
return m_MinWidth; }
set { m_MinWidth = value; } }
163 public float minHeight {
get {
return m_MinHeight; }
set { m_MinHeight = value; } }
176 get {
return m_NumericFormatter; }
177 set {
if (PropertyUtil.SetClass(ref m_NumericFormatter, value)) SetComponentDirty(); }
183 public float paddingLeftRight {
get {
return m_PaddingLeftRight; }
set { m_PaddingLeftRight = value; } }
188 public float paddingTopBottom {
get {
return m_PaddingTopBottom; }
set { m_PaddingTopBottom = value; } }
193 public bool ignoreDataShow {
get {
return m_IgnoreDataShow; }
set { m_IgnoreDataShow = value; } }
208 public bool alwayShow {
get {
return m_AlwayShow; }
set { m_AlwayShow = value; } }
213 public Vector2
offset {
get {
return m_Offset; }
set { m_Offset = value; } }
220 get {
return m_TextStyle; }
221 set {
if (value !=
null) { m_TextStyle = value; SetComponentDirty(); } }
229 get {
return m_LineStyle; }
230 set {
if (value !=
null) m_LineStyle = value; SetComponentDirty(); }
241 public override void ClearComponentDirty()
243 base.ClearComponentDirty();
255 public List<int>
runtimeDataIndex {
get {
return m_RuntimeDateIndex; }
internal set { m_RuntimeDateIndex = value; } }
256 private List<int> m_RuntimeDateIndex =
new List<int>() { -1, -1 };
261 public double[]
runtimeXValues {
get {
return m_RuntimeXValue; }
internal set { m_RuntimeXValue = value; } }
262 private double[] m_RuntimeXValue =
new double[2] { -1, -1 };
267 public double[]
runtimeYValues {
get {
return m_RuntimeYValue; }
internal set { m_RuntimeYValue = value; } }
268 private double[] m_RuntimeYValue =
new double[2] { -1, -1 };
278 public float runtimeWidth {
get {
return m_ContentRect.sizeDelta.x; } }
302 public int runtimePolarIndex {
get;
internal set; }
306 get {
return m_PositionFunction; }
307 set { m_PositionFunction = value; }
310 public static Tooltip defaultTooltip
314 var tooltip =
new Tooltip
329 m_GameObject.SetActive(
false);
339 m_ContentRect = m_Content.GetComponent<RectTransform>();
340 m_ContentImage = m_Content.GetComponent<Image>();
341 m_ContentImage.raycastTarget =
false;
342 m_ContentText =
new ChartText(m_Content);
343 if (m_ContentText !=
null)
345 m_ContentTextRect = m_ContentText.gameObject.GetComponentInChildren<RectTransform>();
356 if (m_GameObject ==
null)
return;
357 int count = m_GameObject.transform.parent.childCount;
358 m_GameObject.GetComponent<RectTransform>().SetSiblingIndex(count - 1);
367 if (m_ContentImage !=
null)
368 m_ContentImage.color = color;
377 if (m_ContentImage !=
null)
379 m_ContentImage.type = Image.Type.Sliced;
380 m_ContentImage.sprite = sprite;
390 if (m_ContentText !=
null)
392 m_ContentText.SetColor(color);
402 if (m_ContentText !=
null)
404 m_ContentText.SetText(txt);
406 if (m_FixedWidth > 0) wid = m_FixedWidth;
407 else if (m_MinWidth > 0 && m_ContentText.GetPreferredWidth() < m_MinWidth) wid = m_MinWidth;
408 else wid = m_ContentText.GetPreferredWidth() + m_PaddingLeftRight * 2;
409 if (m_FixedHeight > 0) hig = m_FixedHeight;
410 else if (m_MinHeight > 0 && m_ContentText.GetPreferredHeight() < m_MinHeight) hig = m_MinHeight;
411 else hig = m_ContentText.GetPreferredHeight() + m_PaddingTopBottom * 2;
412 if (m_ContentRect !=
null) m_ContentRect.sizeDelta =
new Vector2(wid, hig);
413 if (m_ContentTextRect !=
null)
415 m_ContentTextRect.anchoredPosition =
new Vector3(m_PaddingLeftRight, -m_PaddingTopBottom);
423 internal void ClearValue()
436 return m_GameObject !=
null && m_GameObject.activeInHierarchy;
445 if (!flag && m_AlwayShow)
return;
446 if (lastDataIndex.Count >= 2)
447 lastDataIndex[0] = lastDataIndex[1] = -1;
448 if (m_GameObject && m_GameObject.activeInHierarchy != flag)
449 m_GameObject.SetActive(flag);
460 if (m_PositionFunction !=
null)
461 m_Content.transform.localPosition = m_PositionFunction(pos);
463 m_Content.transform.localPosition = pos;
474 return m_Content.transform.localPosition;
494 internal void UpdateLastDataIndex()
507 if (index >= 0)
return true;
519 if (temp == index)
return true;
523 public void ClearSerieDataIndex()
531 public void AddSerieDataIndex(
int serieIndex,
int dataIndex)
540 public bool isAnySerieDataIndex()
544 if (kv.Value.Count > 0)
return true;