mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-14 16:51:28 +00:00
44 lines
1.2 KiB
C#
44 lines
1.2 KiB
C#
using UnityEditor;
|
|
|
|
namespace TEngine.Editor.Inspector
|
|
{
|
|
[CustomEditor(typeof(FsmModule))]
|
|
internal sealed class FsmComponentInspector : GameFrameworkInspector
|
|
{
|
|
public override void OnInspectorGUI()
|
|
{
|
|
base.OnInspectorGUI();
|
|
|
|
if (!EditorApplication.isPlaying)
|
|
{
|
|
EditorGUILayout.HelpBox("Available during runtime only.", MessageType.Info);
|
|
return;
|
|
}
|
|
|
|
FsmModule t = (FsmModule)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 OnEnable()
|
|
{
|
|
}
|
|
|
|
private void DrawFsm(FsmBase fsm)
|
|
{
|
|
EditorGUILayout.LabelField(fsm.FullName, fsm.IsRunning ? Utility.Text.Format("{0}, {1:F1} s", fsm.CurrentStateName, fsm.CurrentStateTime) : (fsm.IsDestroyed ? "Destroyed" : "Not Running"));
|
|
}
|
|
}
|
|
}
|