三国卡牌客户端基础资源仓库
hch
2025-09-15 ea3ad185fcbccce1bd49d467de7186ac08edab24
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// using UnityEngine;
// using UnityEditor;
// using System;
// using System.Collections;
// using System.Collections.Generic;
// using System.Linq;
 
// public class StoryBattleEditorWindow : EditorWindow
// {
 
//     private StoryBattleField storyBattleField;
 
//     // 假设你有如下字段
//     private int redIndex = 0;
//     private int blueIndex = 0;
 
//     private int skillId = 0;
//     private SkillConfig currentSkillConfig;
//     private int casterCamp = 0; // 0=红方,1=蓝方
 
//     private float timeScale = 1f;
 
//     [MenuItem("Tools/StoryBattleEditor")]
//     public static void OpenWindow()
//     {
//         StoryBattleEditorWindow window = GetWindow<StoryBattleEditorWindow>("Story Battle Editor");
//         window.minSize = new Vector2(800, 600);
//         window.Show();
 
//         BattleManager.Instance.StartStoryBattle();
//         window.storyBattleField = BattleManager.Instance.storyBattleField;
//     }
 
//     private void OnGUI()
//     {
//         GUILayout.Label("Story Battle Editor", EditorStyles.boldLabel);
 
//         if (storyBattleField == null)
//         {
//             EditorGUILayout.HelpBox("请先指定 StoryBattleField 实例", MessageType.Warning);
//             if (GUILayout.Button("重新加载"))
//             {
//                 storyBattleField = BattleManager.Instance.storyBattleField;
//             }
//             return;
//         }
 
//         EditorGUILayout.Space();
//         EditorGUILayout.LabelField("技能录制动作测试", EditorStyles.boldLabel);
 
//         // 技能ID输入与配置获取
//         skillId = EditorGUILayout.IntField("技能ID", skillId);
//         currentSkillConfig = SkillConfig.Get(skillId);
//         if (currentSkillConfig != null)
//         {
//             EditorGUILayout.LabelField($"技能名: {currentSkillConfig.SkillName}");
//         }
//         else
//         {
//             EditorGUILayout.HelpBox("未找到该技能配置", MessageType.Warning);
//         }
 
//         timeScale = EditorGUILayout.FloatField("TimeScale", timeScale);
 
//         Time.timeScale = timeScale;
 
//         // 红蓝双方 BattleObject 选择
//         var redCampList = new List<BattleObject>(from BO in storyBattleField.battleObjMgr.redCampList where !BO.IsDead() select BO);
//         var blueCampList = new List<BattleObject>(from BO in storyBattleField.battleObjMgr.blueCampList where !BO.IsDead() select BO);
 
//         string[] redNames = redCampList != null
//             ? redCampList.ConvertAll(obj => obj != null ? obj.ObjID.ToString() : "null").ToArray()
//             : new string[0];
//         redIndex = EditorGUILayout.Popup("红方 BattleObject", redIndex, redNames);
 
//         string[] blueNames = blueCampList != null
//             ? blueCampList.ConvertAll(obj => obj != null ? obj.ObjID.ToString() : "null").ToArray()
//             : new string[0];
//         blueIndex = EditorGUILayout.Popup("蓝方 BattleObject", blueIndex, blueNames);
 
//         // 选择施法者
//         casterCamp = EditorGUILayout.Popup("施法者阵营", casterCamp, new string[] { "红方", "蓝方" });
 
//         EditorGUILayout.Space();
//         if (GUILayout.Button("播放 EditorSkillRecordAction"))
//         {
//             if (currentSkillConfig == null)
//             {
//                 Debug.LogError("SkillConfig 未找到!");
//                 return;
//             }
//             if (redCampList == null || blueCampList == null || redCampList.Count == 0 || blueCampList.Count == 0)
//             {
//                 Debug.LogError("红方或蓝方列表为空!");
//                 return;
//             }
//             var redObj = redCampList[Mathf.Clamp(redIndex, 0, redCampList.Count - 1)];
//             var blueObj = blueCampList[Mathf.Clamp(blueIndex, 0, blueCampList.Count - 1)];
//             BattleObject caster = (casterCamp == 0) ? redObj : blueObj;
 
//             // 构造EditorSkillRecordAction
//             var action = new EditorSkillRecordAction(skillId, storyBattleField, caster);
 
//             if (storyBattleField.recordPlayer != null)
//             {
//                 storyBattleField.recordPlayer.PlayRecord(action);
//             }
//             else
//             {
//                 Debug.LogError("recordPlayer 未设置!");
//             }
//         }
 
//         if (GUILayout.Button("全部复活"))
//         {
//             storyBattleField.battleObjMgr.ReviveAll();
//         }
//     }
 
// }