44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using Axibug;
|
|
using Axibug.Editor;
|
|
using Axibug.Fsm;
|
|
using Axibug.Runtime;
|
|
using UnityEditor;
|
|
|
|
namespace UnityGameFramework.Editor
|
|
{
|
|
[CustomEditor(typeof(FsmComponent))]
|
|
internal sealed class FsmComponentInspector : GameInspector
|
|
{
|
|
public override void OnInspectorGUI()
|
|
{
|
|
base.OnInspectorGUI();
|
|
|
|
if (!EditorApplication.isPlaying)
|
|
{
|
|
EditorGUILayout.HelpBox("Available during runtime only.", MessageType.Info);
|
|
return;
|
|
}
|
|
|
|
FsmComponent t = (FsmComponent)target;
|
|
|
|
if (IsPrefabInHierarchy(t.gameObject))
|
|
{
|
|
EditorGUILayout.LabelField("FSM Count", t.Count.ToString());
|
|
|
|
FsmBase[] fsms = t.GetAllFsms();
|
|
foreach (FsmBase fsm in fsms)
|
|
{
|
|
DrawFsm(fsm);
|
|
}
|
|
}
|
|
|
|
Repaint();
|
|
}
|
|
|
|
private void DrawFsm(FsmBase fsm)
|
|
{
|
|
EditorGUILayout.LabelField(fsm.FullName, fsm.IsRunning ? Utility.Text.Format("{0}, {1} s", fsm.CurrentStateName, fsm.CurrentStateTime.ToString("F1")) : (fsm.IsDestroyed ? "Destroyed" : "Not Running"));
|
|
}
|
|
}
|
|
}
|