mirror of
https://github.com/XCharts-Team/XCharts.git
synced 2026-05-17 14:00:12 +00:00
0.2版本,重构代码,增加Editor
This commit is contained in:
32
Scripts/UI/Internal/JsonDataSupport.cs
Normal file
32
Scripts/UI/Internal/JsonDataSupport.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
using UnityEngine;
|
||||
using UnityEditor;
|
||||
using System;
|
||||
|
||||
namespace XCharts
|
||||
{
|
||||
public class JsonDataSupport: IJsonData,ISerializationCallbackReceiver
|
||||
{
|
||||
[SerializeField] protected string m_JsonData;
|
||||
[SerializeField] protected bool m_DataFromJson;
|
||||
|
||||
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