54 lines
1.3 KiB
C#
54 lines
1.3 KiB
C#
using UnityEditor;
|
|
|
|
namespace Axibug.Editor
|
|
{
|
|
/// <summary>
|
|
/// 游戏框架 Inspector 抽象类。
|
|
/// </summary>
|
|
public abstract class GameInspector : 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;
|
|
}
|
|
|
|
return PrefabUtility.GetPrefabAssetType(obj) != PrefabAssetType.Regular;
|
|
}
|
|
}
|
|
}
|