Files
XCharts/Runtime/Internal/Basic/ChildComponent.cs

63 lines
1.7 KiB
C#
Raw Normal View History

2019-10-14 18:13:08 +08:00
using System;
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 class ChildComponent
2019-10-14 18:13:08 +08:00
{
2022-03-04 22:17:32 +08:00
public virtual int index { get; set; }
2022-05-22 22:17:38 +08:00
[NonSerialized] protected bool m_VertsDirty;
[NonSerialized] protected bool m_ComponentDirty;
2021-01-11 08:54:28 +08:00
[NonSerialized] protected Painter m_Painter;
2022-05-22 22:17:38 +08:00
/// <summary>
/// 图表重绘标记。
/// </summary>
public virtual bool vertsDirty { get { return m_VertsDirty; } }
/// <summary>
/// 组件重新初始化标记。
/// </summary>
public virtual bool componentDirty { get { return m_ComponentDirty; } }
/// <summary>
/// 需要重绘图表或重新初始化组件。
/// </summary>
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; }
2021-05-16 23:38:06 +08:00
public virtual void SetVerticesDirty()
{
m_VertsDirty = true;
}
2021-05-16 23:38:06 +08:00
public virtual void ClearVerticesDirty()
{
m_VertsDirty = false;
}
2021-05-16 23:38:06 +08:00
public virtual void SetComponentDirty()
{
m_ComponentDirty = true;
}
2021-05-16 23:38:06 +08:00
public virtual void ClearComponentDirty()
{
m_ComponentDirty = false;
}
public virtual void ClearDirty()
{
ClearVerticesDirty();
ClearComponentDirty();
}
public virtual void SetAllDirty()
{
SetVerticesDirty();
SetComponentDirty();
}
2019-10-14 18:13:08 +08:00
}
}