您最多选择25个主题 主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 
 
 

41 行
796 B

using UnityEngine.RMGUI;
namespace RMGUI.GraphView
{
public abstract class DataWatchContainer : VisualContainer
{
IDataWatchHandle handle;
protected DataWatchContainer()
{
// trigger data source reset when entering leaving panel
onEnter += AddWatch;
onLeave += RemoveWatch;
}
// called when Serialized object has changed
// only works while widget is in a panel
public virtual void OnDataChanged()
{ }
protected abstract object toWatch { get; }
protected void AddWatch()
{
var watch = toWatch as UnityEngine.Object;
if (watch != null && panel != null)
{
handle = panel.dataWatch.AddWatch(this, watch, OnDataChanged);
}
}
protected void RemoveWatch()
{
if (handle != null)
{
handle.Dispose();
handle = null;
}
}
}
}