2025-04-28 19:45:45 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using AlicizaX.Editor;
|
2025-01-23 19:06:48 +08:00
|
|
|
using AlicizaX.Fsm.Runtime;
|
|
|
|
|
using UnityEditor;
|
2025-04-28 19:45:45 +08:00
|
|
|
using UnityEngine;
|
2025-01-23 19:06:48 +08:00
|
|
|
|
|
|
|
|
namespace AlicizaX.Fsm.Editor
|
|
|
|
|
{
|
|
|
|
|
[CustomEditor(typeof(FsmComponent))]
|
2025-04-28 19:45:45 +08:00
|
|
|
public class FsmModuleInspector : GameFrameworkInspector
|
2025-01-23 19:06:48 +08:00
|
|
|
{
|
|
|
|
|
public override void OnInspectorGUI()
|
|
|
|
|
{
|
|
|
|
|
base.OnInspectorGUI();
|
2025-04-28 19:45:45 +08:00
|
|
|
serializedObject.Update();
|
|
|
|
|
FsmComponent t = (FsmComponent)target;
|
2025-01-23 19:06:48 +08:00
|
|
|
if (!EditorApplication.isPlaying)
|
|
|
|
|
{
|
|
|
|
|
EditorGUILayout.HelpBox("Available during runtime only.", MessageType.Info);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2025-04-28 19:45:45 +08:00
|
|
|
List<FsmDebugInfo> debugInfos = t.GetAllFsmList();
|
|
|
|
|
EditorGUILayout.BeginVertical("box");
|
2025-01-23 19:06:48 +08:00
|
|
|
{
|
2025-04-28 19:45:45 +08:00
|
|
|
GUIStyle boldWhiteStyle = new GUIStyle(EditorStyles.label)
|
|
|
|
|
{
|
|
|
|
|
fontStyle = FontStyle.Bold,
|
|
|
|
|
normal = { textColor = Color.white }
|
|
|
|
|
};
|
|
|
|
|
EditorGUILayout.LabelField("\tID\tFsmName\tStateName", boldWhiteStyle);
|
|
|
|
|
int index = 1;
|
|
|
|
|
foreach (var info in debugInfos)
|
2025-01-23 19:06:48 +08:00
|
|
|
{
|
2025-04-28 19:45:45 +08:00
|
|
|
EditorGUILayout.LabelField($"\t{index}\t{info.FsmName}\t{info.CurrentStateName}");
|
|
|
|
|
index++;
|
2025-01-23 19:06:48 +08:00
|
|
|
}
|
|
|
|
|
}
|
2025-04-28 19:45:45 +08:00
|
|
|
EditorGUILayout.EndVertical();
|
2025-01-23 19:06:48 +08:00
|
|
|
}
|
|
|
|
|
}
|
2025-04-28 19:45:45 +08:00
|
|
|
}
|