mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-16 05:10:12 +00:00
整理组件结构
This commit is contained in:
35
Scripts/UI/Component/ChartComponent.cs
Normal file
35
Scripts/UI/Component/ChartComponent.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
public class ChartComponent
|
||||
{
|
||||
[SerializeField] protected string m_JsonData;
|
||||
[SerializeField] protected bool m_DataFromJson;
|
||||
|
||||
/// <summary>
|
||||
/// json格式的字符串数据
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string jsonData { get { return m_JsonData; } set { m_JsonData = value; ParseJsonData(value); } }
|
||||
|
||||
public void OnAfterDeserialize()
|
||||
{
|
||||
if (m_DataFromJson)
|
||||
{
|
||||
ParseJsonData(m_JsonData);
|
||||
m_DataFromJson = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void OnBeforeSerialize()
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void ParseJsonData(string json)
|
||||
{
|
||||
throw new Exception("no support yet");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user