From 7c97558ae61a8b3c61294295e8890c3909875985 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 01 十二月 2025 16:12:48 +0800
Subject: [PATCH] 工具调整
---
Assets/Editor/UI/GMQuickPlayingEditor.cs | 212 +++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 205 insertions(+), 7 deletions(-)
diff --git a/Assets/Editor/UI/GMQuickPlayingEditor.cs b/Assets/Editor/UI/GMQuickPlayingEditor.cs
index f3365fc..0554b54 100644
--- a/Assets/Editor/UI/GMQuickPlayingEditor.cs
+++ b/Assets/Editor/UI/GMQuickPlayingEditor.cs
@@ -10,9 +10,11 @@
private string commandText = "";
private Vector2 scrollPosition;
private Vector2 reportScrollPosition;
+ private Vector2 battleInfoScrollPosition;
private List<ItemConfig> searchResults = new List<ItemConfig>();
private int itemCount = 1;
private bool isBattlePaused = false;
+ private bool showBattleInfo = false; // 鎺у埗鎴樺満淇℃伅鏄剧ず/闅愯棌
// 鎴樻姤鐩稿叧
private string reportFilePath = "";
@@ -30,9 +32,19 @@
RefreshReportList();
}
+ private void Update()
+ {
+ // 姣忓抚鏇存柊鎴樺満淇℃伅
+ Repaint();
+ }
+
private void OnGUI()
{
- GUILayout.BeginVertical("box");
+ GUILayout.BeginHorizontal();
+
+ // ========== 宸︿晶闈㈡澘 ==========
+ float leftWidth = showBattleInfo ? position.width * 0.6f : position.width - 20;
+ GUILayout.BeginVertical("box", GUILayout.Width(leftWidth));
// 鎼滅储鏍�
GUILayout.Label("鐗╁搧鎼滅储", EditorStyles.boldLabel);
@@ -155,6 +167,10 @@
LoadReport(reportFiles[i]);
}
+ if (GUILayout.Button("鍒犻櫎", GUILayout.Width(60)))
+ {
+ DeleteReport(reportFiles[i]);
+ }
GUILayout.EndHorizontal();
}
@@ -170,18 +186,174 @@
GUILayout.Space(10);
- // 鏆傚仠/寮�濮嬫垬鏂楁寜閽�
+ // 鎴樺満淇℃伅Toggle
GUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
- string buttonText = isBattlePaused ? "寮�濮嬪綋鍓嶆垬鏂�" : "鏆傚仠褰撳墠鎴樻枟";
- if (GUILayout.Button(buttonText, GUILayout.Width(120), GUILayout.Height(30)))
- {
- OnPauseBattle();
- }
+ GUILayout.Label("鏄剧ず鎴樺満淇℃伅", GUILayout.Width(100));
+ showBattleInfo = EditorGUILayout.Toggle(showBattleInfo, GUILayout.Width(20));
GUILayout.FlexibleSpace();
GUILayout.EndHorizontal();
GUILayout.EndVertical();
+
+ // ========== 鍙充晶闈㈡澘 - 鎴樺満淇℃伅 ==========
+ if (showBattleInfo)
+ {
+ // 鍒嗗壊绾�
+ GUILayout.Box("", GUILayout.Width(2), GUILayout.ExpandHeight(true));
+
+ GUILayout.BeginVertical("box", GUILayout.ExpandWidth(true));
+
+ GUILayout.Label("鎴樺満淇℃伅", EditorStyles.boldLabel);
+
+ // 鏆傚仠/寮�濮嬫垬鏂楁寜閽�
+ GUILayout.BeginHorizontal();
+ GUILayout.FlexibleSpace();
+ string buttonText = isBattlePaused ? "寮�濮嬪綋鍓嶆垬鏂�" : "鏆傚仠褰撳墠鎴樻枟";
+ if (GUILayout.Button(buttonText, GUILayout.Width(120), GUILayout.Height(30)))
+ {
+ OnPauseBattle();
+ }
+ GUILayout.FlexibleSpace();
+ GUILayout.EndHorizontal();
+
+ GUILayout.Space(5);
+
+ battleInfoScrollPosition = GUILayout.BeginScrollView(battleInfoScrollPosition);
+
+ DrawBattleFieldInfo();
+
+ GUILayout.EndScrollView();
+
+ GUILayout.EndVertical();
+ }
+
+ GUILayout.EndHorizontal();
+ }
+
+ private void DrawBattleFieldInfo()
+ {
+ BattleField battleField = GetActiveBattleField();
+
+ if (battleField == null)
+ {
+ GUILayout.Label("鏆傛棤鎴樺満", EditorStyles.centeredGreyMiniLabel);
+ return;
+ }
+
+ // 鎴樺満鍩烘湰淇℃伅
+ GUILayout.BeginVertical("box");
+ GUILayout.Label($"鎴樺満绫诲瀷: {battleField.GetType().Name}", EditorStyles.boldLabel);
+ GUILayout.Label($"GUID: {battleField.guid}");
+ GUILayout.Label($"鍦板浘ID: {battleField.MapID}");
+ GUILayout.Label($"鏆傚仠鐘舵��: {battleField.IsPause}");
+ GUILayout.EndVertical();
+
+ GUILayout.Space(10);
+
+ // 绾㈡柟闃熶紞淇℃伅
+ DrawTeamInfo("绾㈡柟闃熶紞", battleField.battleObjMgr.redCampList, new Color(1f, 0.5f, 0.5f));
+
+ GUILayout.Space(10);
+
+ // 钃濇柟闃熶紞淇℃伅
+ DrawTeamInfo("钃濇柟闃熶紞", battleField.battleObjMgr.blueCampList, new Color(0.5f, 0.5f, 1f));
+ }
+
+ private void DrawTeamInfo(string teamName, List<BattleObject> team, Color headerColor)
+ {
+ GUIStyle headerStyle = new GUIStyle(EditorStyles.boldLabel);
+ headerStyle.normal.textColor = headerColor;
+
+ GUILayout.Label(teamName, headerStyle);
+
+ if (team == null || team.Count == 0)
+ {
+ GUILayout.Label(" 鏃犺鑹�", EditorStyles.miniLabel);
+ return;
+ }
+
+ foreach (var obj in team)
+ {
+ if (obj == null || obj.teamHero == null)
+ continue;
+
+ GUILayout.BeginVertical("box");
+
+ // 瑙掕壊鍚嶇О鍜孖D
+ GUILayout.BeginHorizontal();
+ GUILayout.Label($"ID: {obj.ObjID}", GUILayout.Width(80));
+ GUILayout.Label($"鍚嶇О: {obj.teamHero.name}", GUILayout.ExpandWidth(true));
+ GUILayout.EndHorizontal();
+
+ // 琛�閲忎俊鎭�
+ long curHp = obj.teamHero.curHp;
+ long maxHp = obj.teamHero.maxHp;
+ float hpPercent = maxHp > 0 ? (float)curHp / maxHp : 0f;
+
+ GUILayout.BeginHorizontal();
+ GUILayout.Label("琛�閲�:", GUILayout.Width(50));
+
+ // 琛�鏉�
+ Rect hpBarRect = GUILayoutUtility.GetRect(100, 18);
+ EditorGUI.DrawRect(hpBarRect, new Color(0.3f, 0.3f, 0.3f));
+
+ Rect hpFillRect = new Rect(hpBarRect.x, hpBarRect.y, hpBarRect.width * hpPercent, hpBarRect.height);
+ Color hpColor = hpPercent > 0.5f ? Color.green : hpPercent > 0.2f ? Color.yellow : Color.red;
+ EditorGUI.DrawRect(hpFillRect, hpColor);
+
+ GUILayout.Label($"{curHp}/{maxHp} ({(hpPercent * 100f):F1}%)", GUILayout.Width(150));
+ GUILayout.EndHorizontal();
+
+ // 鎬掓皵淇℃伅
+ long curMp = obj.teamHero.rage;
+ long maxMp = 100;
+ float mpPercent = maxMp > 0 ? (float)curMp / maxMp : 0f;
+
+ GUILayout.BeginHorizontal();
+ GUILayout.Label("鎬掓皵:", GUILayout.Width(50));
+
+ // 鎬掓皵鏉�
+ Rect mpBarRect = GUILayoutUtility.GetRect(100, 18);
+ EditorGUI.DrawRect(mpBarRect, new Color(0.3f, 0.3f, 0.3f));
+
+ Rect mpFillRect = new Rect(mpBarRect.x, mpBarRect.y, mpBarRect.width * mpPercent, mpBarRect.height);
+ EditorGUI.DrawRect(mpFillRect, new Color(1f, 0.5f, 0f)); // 姗欒壊
+
+ GUILayout.Label($"{curMp}/{maxMp} ({(mpPercent * 100f):F1}%)", GUILayout.Width(150));
+ GUILayout.EndHorizontal();
+
+ GUILayout.EndVertical();
+ }
+ }
+
+ private BattleField GetActiveBattleField()
+ {
+ if (!Application.isPlaying)
+ return null;
+
+ for (int i = 0; i < BattleConst.BattleWindows.Count; i++)
+ {
+ var win = UIManager.Instance.GetUI(BattleConst.BattleWindows[i].Name);
+ if (win != null && win.IsActive())
+ {
+ // 浣跨敤鍙嶅皠鑾峰彇 battleField 瀛楁
+ var battleFieldField = win.GetType().GetField("battleField",
+ System.Reflection.BindingFlags.NonPublic |
+ System.Reflection.BindingFlags.Instance);
+
+ if (battleFieldField != null)
+ {
+ var battleField = battleFieldField.GetValue(win) as BattleField;
+ if (battleField != null)
+ {
+ return battleField;
+ }
+ }
+ }
+ }
+
+ return null;
}
private void RefreshReportList()
@@ -222,11 +394,37 @@
Debug.Log("宸插姞杞芥垬鎶�: " + Path.GetFileName(filePath));
HB430_tagSCTurnFightReport hB430_TagSCTurnFightReport = new HB430_tagSCTurnFightReport();
+ hB430_TagSCTurnFightReport.isRecord = true;
byte[] vBytes = File.ReadAllBytes(filePath);
hB430_TagSCTurnFightReport.ReadFromBytes(vBytes);
PackageRegedit.Distribute(hB430_TagSCTurnFightReport);
}
+ private void DeleteReport(string filePath)
+ {
+ if (!File.Exists(filePath))
+ {
+ Debug.LogError("鎴樻姤鏂囦欢涓嶅瓨鍦�: " + filePath);
+ return;
+ }
+
+ if (EditorUtility.DisplayDialog("纭鍒犻櫎",
+ $"纭畾瑕佸垹闄ゆ垬鎶ユ枃浠跺悧?\n{Path.GetFileName(filePath)}",
+ "鍒犻櫎", "鍙栨秷"))
+ {
+ try
+ {
+ File.Delete(filePath);
+ Debug.Log("宸插垹闄ゆ垬鎶�: " + Path.GetFileName(filePath));
+ RefreshReportList();
+ }
+ catch (System.Exception e)
+ {
+ Debug.LogError("鍒犻櫎鎴樻姤鏂囦欢澶辫触: " + e.Message);
+ }
+ }
+ }
+
private string ExtractGuidFromFileName(string fileName)
{
// 浠庢枃浠跺悕涓彁鍙� GUID
--
Gitblit v1.8.0