mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
58 lines
1.4 KiB
C#
58 lines
1.4 KiB
C#
using UnityEditor;
|
|
|
|
namespace TEngine.Editor.Inspector
|
|
{
|
|
/// <summary>
|
|
/// 游戏框架 Inspector 抽象类。
|
|
/// </summary>
|
|
public abstract class GameFrameworkInspector : UnityEditor.Editor
|
|
{
|
|
private bool m_IsCompiling = false;
|
|
|
|
/// <summary>
|
|
/// 绘制事件。
|
|
/// </summary>
|
|
public override void OnInspectorGUI()
|
|
{
|
|
if (m_IsCompiling && !EditorApplication.isCompiling)
|
|
{
|
|
m_IsCompiling = false;
|
|
OnCompileComplete();
|
|
}
|
|
else if (!m_IsCompiling && EditorApplication.isCompiling)
|
|
{
|
|
m_IsCompiling = true;
|
|
OnCompileStart();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 编译开始事件。
|
|
/// </summary>
|
|
protected virtual void OnCompileStart()
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// 编译完成事件。
|
|
/// </summary>
|
|
protected virtual void OnCompileComplete()
|
|
{
|
|
}
|
|
|
|
protected bool IsPrefabInHierarchy(UnityEngine.Object obj)
|
|
{
|
|
if (obj == null)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
#if UNITY_2018_3_OR_NEWER
|
|
return PrefabUtility.GetPrefabAssetType(obj) != PrefabAssetType.Regular;
|
|
#else
|
|
return PrefabUtility.GetPrefabType(obj) != PrefabType.Prefab;
|
|
#endif
|
|
}
|
|
}
|
|
}
|