#if UNITY_EDITOR using UnityEditor; using UnityEngine; public class TestSkillActionEditorWindow : EditorWindow { protected int skillId = 1; protected int hurtIndex = 0; [MenuItem("Battle/TestSkillAction生成器")] public static void ShowWindow() { GetWindow("TestSkillAction生成器"); } private void OnGUI() { GUILayout.Label("TestSkillAction参数设置", EditorStyles.boldLabel); skillId = EditorGUILayout.IntField("Skill ID", skillId); hurtIndex = EditorGUILayout.IntField("Hurt Index", hurtIndex); if (GUILayout.Button("生成并播放 TestSkillAction")) { PlayTestSkillAction(); } if (GUILayout.Button("复位RecordPlayer")) { ResetRecordPlayer(); } } private void PlayTestSkillAction() { if (!Application.isPlaying) { Debug.LogWarning("请在运行时使用该功能!"); return; } var battleField = BattleManager.Instance.storyBattleField; if (battleField == null || battleField.recordPlayer == null) { Debug.LogError("BattleManager.storyBattleField 或 recordPlayer 未初始化!"); return; } var action = new TestSkillAction(battleField, skillId, hurtIndex); battleField.recordPlayer.PlayRecord(action); Debug.Log($"已生成并播放 TestSkillAction: skillId={skillId}, hurtIndex={hurtIndex}"); } private void ResetRecordPlayer() { if (!Application.isPlaying) { Debug.LogWarning("请在运行时使用该功能!"); return; } var battleField = BattleManager.Instance.storyBattleField; if (battleField == null || battleField.recordPlayer == null) { Debug.LogError("BattleManager.storyBattleField 或 recordPlayer 未初始化!"); return; } battleField.recordPlayer.HaveRest(); Debug.Log("RecordPlayer已复位!"); } } #endif