三国卡牌客户端基础资源仓库
yyl
2025-08-25 214fe94eaf7f09741a7857775dfffe8c3b83c75c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#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<TestSkillActionEditorWindow>("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