mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-20 15:30:09 +00:00
增加运行时和非运行时参数变更自动刷新图表
This commit is contained in:
@@ -15,12 +15,26 @@ namespace XCharts
|
||||
[SerializeField] protected string m_JsonData;
|
||||
[SerializeField] protected bool m_DataFromJson;
|
||||
|
||||
[NonSerialized] protected bool m_VertsDirty;
|
||||
[NonSerialized] protected bool m_ComponentDirty;
|
||||
|
||||
/// <summary>
|
||||
/// json格式的字符串数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string jsonData { get { return m_JsonData; } set { m_JsonData = value; ParseJsonData(value); } }
|
||||
|
||||
/// <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; } }
|
||||
internal void OnAfterDeserialize()
|
||||
{
|
||||
if (m_DataFromJson)
|
||||
@@ -38,5 +52,37 @@ namespace XCharts
|
||||
{
|
||||
throw new Exception("no support yet");
|
||||
}
|
||||
|
||||
internal virtual void SetVerticesDirty()
|
||||
{
|
||||
m_VertsDirty = true;
|
||||
}
|
||||
|
||||
internal virtual void ClearVerticesDirty()
|
||||
{
|
||||
m_VertsDirty = false;
|
||||
}
|
||||
|
||||
internal virtual void SetComponentDirty()
|
||||
{
|
||||
m_ComponentDirty = true;
|
||||
}
|
||||
|
||||
internal virtual void ClearComponentDirty()
|
||||
{
|
||||
m_ComponentDirty = false;
|
||||
}
|
||||
|
||||
public virtual void ClearDirty()
|
||||
{
|
||||
ClearVerticesDirty();
|
||||
ClearComponentDirty();
|
||||
}
|
||||
|
||||
public virtual void SetAllDirty()
|
||||
{
|
||||
SetVerticesDirty();
|
||||
SetComponentDirty();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user