No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BaseSerie.cs 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. using UnityEngine;
  5. namespace XCharts.Runtime
  6. {
  7. [System.Serializable]
  8. public abstract class BaseSerie
  9. {
  10. public virtual bool vertsDirty { get { return m_VertsDirty; } }
  11. public virtual bool componentDirty { get { return m_ComponentDirty; } }
  12. public virtual SerieColorBy defaultColorBy { get { return SerieColorBy.Serie; } }
  13. public virtual bool titleJustForSerie { get { return false; } }
  14. public virtual bool useSortData { get { return false; } }
  15. public virtual bool multiDimensionLabel { get { return false; } }
  16. public bool anyDirty { get { return vertsDirty || componentDirty; } }
  17. public Painter painter { get { return m_Painter; } set { m_Painter = value; } }
  18. public Action refreshComponent { get; set; }
  19. public GameObject gameObject { get; set; }
  20. [NonSerialized] protected bool m_VertsDirty;
  21. [NonSerialized] protected bool m_ComponentDirty;
  22. [NonSerialized] protected Painter m_Painter;
  23. [NonSerialized] public SerieContext context = new SerieContext();
  24. [NonSerialized] public InteractData interact = new InteractData();
  25. public SerieHandler handler { get; set; }
  26. public static void ClearVerticesDirty(ChildComponent component)
  27. {
  28. if (component != null)
  29. component.ClearVerticesDirty();
  30. }
  31. public static void ClearComponentDirty(ChildComponent component)
  32. {
  33. if (component != null)
  34. component.ClearComponentDirty();
  35. }
  36. public static bool IsVertsDirty(ChildComponent component)
  37. {
  38. return component == null?false : component.vertsDirty;
  39. }
  40. public static bool IsComponentDirty(ChildComponent component)
  41. {
  42. return component == null?false : component.componentDirty;
  43. }
  44. public virtual void SetVerticesDirty()
  45. {
  46. m_VertsDirty = true;
  47. }
  48. public virtual void ClearVerticesDirty()
  49. {
  50. m_VertsDirty = false;
  51. }
  52. public virtual void SetComponentDirty()
  53. {
  54. m_ComponentDirty = true;
  55. }
  56. public virtual void ClearComponentDirty()
  57. {
  58. m_ComponentDirty = false;
  59. }
  60. public virtual void ClearData() { }
  61. public virtual void ClearDirty()
  62. {
  63. ClearVerticesDirty();
  64. ClearComponentDirty();
  65. }
  66. public virtual void SetAllDirty()
  67. {
  68. SetVerticesDirty();
  69. SetComponentDirty();
  70. }
  71. public virtual void OnRemove()
  72. {
  73. if (handler != null)
  74. handler.RemoveComponent();
  75. }
  76. public virtual void OnDataUpdate() { }
  77. public virtual void OnBeforeSerialize() { }
  78. public virtual void OnAfterDeserialize()
  79. {
  80. OnDataUpdate();
  81. }
  82. public void RefreshLabel()
  83. {
  84. if (handler != null)
  85. handler.RefreshLabelNextFrame();
  86. }
  87. }
  88. }