2019-10-14 18:13:08 +08:00
|
|
|
using System;
|
2021-11-23 13:20:07 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
2019-10-14 18:13:08 +08:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
2022-02-19 22:37:57 +08:00
|
|
|
namespace XCharts.Runtime
|
2019-10-14 18:13:08 +08:00
|
|
|
{
|
2021-11-23 13:20:07 +08:00
|
|
|
[System.Serializable]
|
|
|
|
|
public abstract class BaseSerie
|
2019-10-14 18:13:08 +08:00
|
|
|
{
|
2020-03-05 20:25:19 +08:00
|
|
|
public virtual bool vertsDirty { get { return m_VertsDirty; } }
|
|
|
|
|
public virtual bool componentDirty { get { return m_ComponentDirty; } }
|
2022-07-28 07:21:46 +08:00
|
|
|
|
|
|
|
|
public virtual SerieColorBy defaultColorBy { get { return SerieColorBy.Serie; } }
|
2022-05-22 22:17:38 +08:00
|
|
|
public virtual bool titleJustForSerie { get { return false; } }
|
2022-04-09 11:03:41 +08:00
|
|
|
public virtual bool useSortData { get { return false; } }
|
2022-05-31 08:17:54 +08:00
|
|
|
public virtual bool multiDimensionLabel { get { return false; } }
|
2020-03-05 20:25:19 +08:00
|
|
|
public bool anyDirty { get { return vertsDirty || componentDirty; } }
|
2021-01-11 08:54:28 +08:00
|
|
|
public Painter painter { get { return m_Painter; } set { m_Painter = value; } }
|
|
|
|
|
public Action refreshComponent { get; set; }
|
|
|
|
|
public GameObject gameObject { get; set; }
|
2020-03-05 20:25:19 +08:00
|
|
|
|
2021-11-23 13:20:07 +08:00
|
|
|
[NonSerialized] protected bool m_VertsDirty;
|
|
|
|
|
[NonSerialized] protected bool m_ComponentDirty;
|
|
|
|
|
[NonSerialized] protected Painter m_Painter;
|
|
|
|
|
[NonSerialized] public SerieContext context = new SerieContext();
|
2021-12-23 13:23:18 +08:00
|
|
|
[NonSerialized] public InteractData interact = new InteractData();
|
2021-11-23 13:20:07 +08:00
|
|
|
|
2022-03-04 22:17:32 +08:00
|
|
|
public SerieHandler handler { get; set; }
|
2021-11-23 13:20:07 +08:00
|
|
|
|
2022-07-28 07:21:46 +08:00
|
|
|
|
|
|
|
|
|
2022-07-25 07:46:03 +08:00
|
|
|
public static void ClearVerticesDirty(ChildComponent component)
|
|
|
|
|
{
|
|
|
|
|
if (component != null)
|
|
|
|
|
component.ClearVerticesDirty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void ClearComponentDirty(ChildComponent component)
|
|
|
|
|
{
|
|
|
|
|
if (component != null)
|
|
|
|
|
component.ClearComponentDirty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool IsVertsDirty(ChildComponent component)
|
|
|
|
|
{
|
|
|
|
|
return component == null?false : component.vertsDirty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static bool IsComponentDirty(ChildComponent component)
|
|
|
|
|
{
|
|
|
|
|
return component == null?false : component.componentDirty;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-16 23:38:06 +08:00
|
|
|
public virtual void SetVerticesDirty()
|
2020-03-05 20:25:19 +08:00
|
|
|
{
|
|
|
|
|
m_VertsDirty = true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-16 23:38:06 +08:00
|
|
|
public virtual void ClearVerticesDirty()
|
2020-03-05 20:25:19 +08:00
|
|
|
{
|
|
|
|
|
m_VertsDirty = false;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-16 23:38:06 +08:00
|
|
|
public virtual void SetComponentDirty()
|
2020-03-05 20:25:19 +08:00
|
|
|
{
|
|
|
|
|
m_ComponentDirty = true;
|
|
|
|
|
}
|
|
|
|
|
|
2021-05-16 23:38:06 +08:00
|
|
|
public virtual void ClearComponentDirty()
|
2020-03-05 20:25:19 +08:00
|
|
|
{
|
|
|
|
|
m_ComponentDirty = false;
|
|
|
|
|
}
|
|
|
|
|
|
2022-07-25 07:46:03 +08:00
|
|
|
public virtual void ClearData() { }
|
2021-11-23 13:20:07 +08:00
|
|
|
|
2020-03-05 20:25:19 +08:00
|
|
|
public virtual void ClearDirty()
|
|
|
|
|
{
|
|
|
|
|
ClearVerticesDirty();
|
|
|
|
|
ClearComponentDirty();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public virtual void SetAllDirty()
|
|
|
|
|
{
|
|
|
|
|
SetVerticesDirty();
|
|
|
|
|
SetComponentDirty();
|
|
|
|
|
}
|
2021-01-11 08:54:28 +08:00
|
|
|
|
2021-11-23 13:20:07 +08:00
|
|
|
public virtual void OnRemove()
|
|
|
|
|
{
|
|
|
|
|
if (handler != null)
|
|
|
|
|
handler.RemoveComponent();
|
|
|
|
|
}
|
2021-01-11 08:54:28 +08:00
|
|
|
|
2022-07-25 07:46:03 +08:00
|
|
|
public virtual void OnDataUpdate() { }
|
2022-03-04 22:17:32 +08:00
|
|
|
|
2022-07-25 07:46:03 +08:00
|
|
|
public virtual void OnBeforeSerialize() { }
|
2022-03-04 22:17:32 +08:00
|
|
|
|
|
|
|
|
public virtual void OnAfterDeserialize()
|
|
|
|
|
{
|
|
|
|
|
OnDataUpdate();
|
|
|
|
|
}
|
|
|
|
|
|
2021-11-23 13:20:07 +08:00
|
|
|
public void RefreshLabel()
|
|
|
|
|
{
|
|
|
|
|
if (handler != null)
|
|
|
|
|
handler.RefreshLabelNextFrame();
|
|
|
|
|
}
|
2021-01-11 08:54:28 +08:00
|
|
|
}
|
2019-10-14 18:13:08 +08:00
|
|
|
}
|