diff --git a/DungeonShooting_Godot/addons/dungeonShooting_plugin/NodeMonitor.cs b/DungeonShooting_Godot/addons/dungeonShooting_plugin/NodeMonitor.cs index cc95225..2a62912 100644 --- a/DungeonShooting_Godot/addons/dungeonShooting_plugin/NodeMonitor.cs +++ b/DungeonShooting_Godot/addons/dungeonShooting_plugin/NodeMonitor.cs @@ -95,7 +95,7 @@ catch (Exception e) { //检查节点存在报错, 直接跳过该节点的检查 - GD.Print(e.Message); + Debug.Log(e.Message); } } @@ -131,7 +131,7 @@ catch (Exception e) { //检查节点存在报错, 直接跳过该节点的检查 - GD.Print(e.Message); + Debug.Log(e.Message); _targetNode = null; } _checkTreeTimer = 0; diff --git a/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs b/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs index a5f7853..198c613 100644 --- a/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs +++ b/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs @@ -89,7 +89,7 @@ } catch (Exception e) { - GD.PrintErr(e.ToString()); + Debug.LogError(e.ToString()); } } } @@ -104,7 +104,7 @@ } catch (Exception e) { - GD.PrintErr(e.ToString()); + Debug.LogError(e.ToString()); } try @@ -113,7 +113,7 @@ } catch (Exception e) { - GD.PrintErr(e.ToString()); + Debug.LogError(e.ToString()); } @@ -140,7 +140,7 @@ } catch (Exception e) { - GD.PrintErr(e.ToString()); + Debug.LogError(e.ToString()); } } } @@ -153,7 +153,7 @@ } catch (Exception e) { - GD.PrintErr(e.ToString()); + Debug.LogError(e.ToString()); } try @@ -162,7 +162,7 @@ } catch (Exception e) { - GD.PrintErr(e.ToString()); + Debug.LogError(e.ToString()); } _editorTools.Free(); diff --git a/DungeonShooting_Godot/export_presets.cfg b/DungeonShooting_Godot/export_presets.cfg index 9730d1f..0776df9 100644 --- a/DungeonShooting_Godot/export_presets.cfg +++ b/DungeonShooting_Godot/export_presets.cfg @@ -8,7 +8,7 @@ export_filter="all_resources" include_filter="" exclude_filter="" -export_path="../../export/DungeonShooting.apk" +export_path="../../DungeonShooting_Export/android/DungeonShooting.apk" encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false @@ -18,11 +18,11 @@ custom_template/debug="" custom_template/release="" -gradle_build/use_gradle_build=false +gradle_build/use_gradle_build=true gradle_build/export_format=0 gradle_build/min_sdk="" gradle_build/target_sdk="" -architectures/armeabi-v7a=true +architectures/armeabi-v7a=false architectures/arm64-v8a=true architectures/x86=false architectures/x86_64=false diff --git a/DungeonShooting_Godot/prefab/ui/Debugger.tscn b/DungeonShooting_Godot/prefab/ui/Debugger.tscn new file mode 100644 index 0000000..688eb64 --- /dev/null +++ b/DungeonShooting_Godot/prefab/ui/Debugger.tscn @@ -0,0 +1,68 @@ +[gd_scene load_steps=3 format=3 uid="uid://df0dfbrbt3ufg"] + +[ext_resource type="Script" path="res://src/game/ui/debugger/DebuggerPanel.cs" id="1_awck4"] +[ext_resource type="Texture2D" uid="uid://dfk7b7gbhsfvx" path="res://addons/dungeonShooting_plugin/Tool.svg" id="2_acjpv"] + +[node name="Debugger" type="Control"] +layout_mode = 3 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +mouse_filter = 2 +script = ExtResource("1_awck4") +Layer = 3 + +[node name="Bg" type="ColorRect" parent="."] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +grow_horizontal = 2 +grow_vertical = 2 +color = Color(0, 0, 0, 0.784314) + +[node name="Clear" type="Button" parent="Bg"] +layout_mode = 0 +offset_left = 34.0 +offset_top = 33.0 +offset_right = 174.0 +offset_bottom = 73.0 +text = "清除日志" + +[node name="Close" type="Button" parent="Bg"] +layout_mode = 1 +anchors_preset = 1 +anchor_left = 1.0 +anchor_right = 1.0 +offset_left = -200.0 +offset_top = 33.0 +offset_right = -60.0 +offset_bottom = 73.0 +grow_horizontal = 0 +text = "关闭" + +[node name="ScrollContainer" type="ScrollContainer" parent="Bg"] +layout_mode = 1 +anchors_preset = 15 +anchor_right = 1.0 +anchor_bottom = 1.0 +offset_top = 101.0 +grow_horizontal = 2 +grow_vertical = 2 +horizontal_scroll_mode = 0 + +[node name="Label" type="Label" parent="Bg/ScrollContainer"] +layout_mode = 2 +size_flags_horizontal = 3 +autowrap_mode = 3 + +[node name="HoverButton" type="Button" parent="."] +layout_mode = 0 +offset_left = 18.0 +offset_top = 169.0 +offset_right = 46.0 +offset_bottom = 193.0 +scale = Vector2(2, 2) +icon = ExtResource("2_acjpv") +flat = true +icon_alignment = 1 diff --git a/DungeonShooting_Godot/project.godot b/DungeonShooting_Godot/project.godot index ba66a76..8f16079 100644 --- a/DungeonShooting_Godot/project.godot +++ b/DungeonShooting_Godot/project.godot @@ -211,6 +211,7 @@ [rendering] textures/canvas_textures/default_texture_filter=0 +textures/vram_compression/import_etc2_astc=true environment/defaults/default_clear_color=Color(0.109804, 0.0666667, 0.0901961, 1) viewport/hdr_2d=true 2d/snapping/use_gpu_pixel_snap=true diff --git a/DungeonShooting_Godot/src/config/ExcelConfig.cs b/DungeonShooting_Godot/src/config/ExcelConfig.cs index b0abf46..86550d4 100644 --- a/DungeonShooting_Godot/src/config/ExcelConfig.cs +++ b/DungeonShooting_Godot/src/config/ExcelConfig.cs @@ -64,7 +64,7 @@ } catch (Exception e) { - GD.PrintErr(e.ToString()); + Debug.LogError(e.ToString()); throw new Exception("初始化表'ActivityObject'失败!"); } } @@ -82,7 +82,7 @@ } catch (Exception e) { - GD.PrintErr(e.ToString()); + Debug.LogError(e.ToString()); throw new Exception("初始化表'Sound'失败!"); } } @@ -100,7 +100,7 @@ } catch (Exception e) { - GD.PrintErr(e.ToString()); + Debug.LogError(e.ToString()); throw new Exception("初始化表'Weapon'失败!"); } } @@ -153,7 +153,7 @@ } catch (Exception e) { - GD.PrintErr(e.ToString()); + Debug.LogError(e.ToString()); throw new Exception("初始化'Weapon'引用其他表数据失败, 当前行id: " + item.Id); } } diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs index f96a52f..3a6a47a 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject.cs @@ -1460,7 +1460,7 @@ if (AffiliationArea == null) { - GD.PrintErr($"调用函数: BecomesStaticImage() 失败, 物体{Name}没有归属区域, 无法确定绘制到哪个ImageCanvas上, 直接执行销毁"); + Debug.LogError($"调用函数: BecomesStaticImage() 失败, 物体{Name}没有归属区域, 无法确定绘制到哪个ImageCanvas上, 直接执行销毁"); Destroy(); return; } diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject_Register.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject_Register.cs index 9c82e49..28a5d5a 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject_Register.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject_Register.cs @@ -53,7 +53,7 @@ instance._InitNode(config, world); return instance; } - GD.PrintErr("创建实例失败, 未找到id为'" + itemId + "'的物体!"); + Debug.LogError("创建实例失败, 未找到id为'" + itemId + "'的物体!"); return null; } diff --git a/DungeonShooting_Godot/src/framework/activity/components/StateController.cs b/DungeonShooting_Godot/src/framework/activity/components/StateController.cs index ecb69be..d3c1e20 100644 --- a/DungeonShooting_Godot/src/framework/activity/components/StateController.cs +++ b/DungeonShooting_Godot/src/framework/activity/components/StateController.cs @@ -56,7 +56,7 @@ { if (GetStateInstance(stateBase.State) != null) { - GD.PrintErr("当前状态已经在状态机中注册:", stateBase); + Debug.LogError("当前状态已经在状态机中注册:", stateBase); return; } @@ -124,7 +124,7 @@ var newState = GetStateInstance(next); if (newState == null) { - GD.PrintErr("当前状态机未找到相应状态:" + next); + Debug.LogError("当前状态机未找到相应状态:" + next); return; } diff --git a/DungeonShooting_Godot/src/framework/common/Utils.cs b/DungeonShooting_Godot/src/framework/common/Utils.cs index 7df886c..d139167 100644 --- a/DungeonShooting_Godot/src/framework/common/Utils.cs +++ b/DungeonShooting_Godot/src/framework/common/Utils.cs @@ -13,7 +13,7 @@ static Utils() { Random = new SeedRandom(); - GD.Print("随机种子为: ", Random.Seed); + Debug.Log("随机种子为: ", Random.Seed); } /// diff --git a/DungeonShooting_Godot/src/framework/coroutine/ProxyCoroutineHandler.cs b/DungeonShooting_Godot/src/framework/coroutine/ProxyCoroutineHandler.cs index ed04749..8db3fd8 100644 --- a/DungeonShooting_Godot/src/framework/coroutine/ProxyCoroutineHandler.cs +++ b/DungeonShooting_Godot/src/framework/coroutine/ProxyCoroutineHandler.cs @@ -133,7 +133,7 @@ } catch (Exception e) { - GD.PrintErr("执行协程发生异常: \n" + e); + Debug.LogError("执行协程发生异常: \n" + e); ProxyStopCoroutine(ref coroutineList, item.Id); } } diff --git a/DungeonShooting_Godot/src/framework/debug/Debug.cs b/DungeonShooting_Godot/src/framework/debug/Debug.cs new file mode 100644 index 0000000..a40a1c6 --- /dev/null +++ b/DungeonShooting_Godot/src/framework/debug/Debug.cs @@ -0,0 +1,65 @@ + +using Godot; + +/// +/// 调试日志输出 +/// +public static class Debug +{ + /// + /// 所有日志信息,包括log和error + /// + public static string AllLogMessage { get; private set; } = ""; + + /// + /// 输出日志 + /// + public static void Log(params object[] message) + { + var str = "[log]"; + foreach (var m in message) + { + if (m is null) + { + str += "null"; + } + else + { + str += m; + } + } + + GD.Print(str); + AllLogMessage = str + "\n" + AllLogMessage; + } + + /// + /// 输出错误日志 + /// + public static void LogError(params object[] message) + { + var str = "[error]"; + foreach (var m in message) + { + if (m is null) + { + str += "null"; + } + else + { + str += m; + } + } + + GD.PrintErr(str); + AllLogMessage = str + "\n" + AllLogMessage; + } + + /// + /// 清除log + /// + public static void Clear() + { + AllLogMessage = ""; + } +} \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/generator/DungeonRoomGenerator.cs b/DungeonShooting_Godot/src/framework/generator/DungeonRoomGenerator.cs index e7d8da2..28229bc 100644 --- a/DungeonShooting_Godot/src/framework/generator/DungeonRoomGenerator.cs +++ b/DungeonShooting_Godot/src/framework/generator/DungeonRoomGenerator.cs @@ -74,7 +74,7 @@ } catch (Exception e) { - GD.PrintErr(e.ToString()); + Debug.LogError(e.ToString()); return false; } @@ -86,7 +86,7 @@ /// public static bool GenerateRoomConfig() { - GD.Print("生成RoomConfig.json流程得改"); + Debug.Log("生成RoomConfig.json流程得改"); // try // { // //地图路径 @@ -162,7 +162,7 @@ // var filePath = tileDataDir + path + ".json"; // if (File.Exists(filePath)) // { - // GD.Print($"未找到'{tileDir + path}.tscn', 删除配置文件: {filePath}"); + // Debug.Log($"未找到'{tileDir + path}.tscn', 删除配置文件: {filePath}"); // File.Delete(filePath); // } // } @@ -218,11 +218,11 @@ // var text = JsonSerializer.Serialize(roomGroupMap, config); // File.WriteAllText(GameConfig.RoomTileConfigFile, text); // - // GD.Print("地牢房间配置, 重新打包完成!"); + // Debug.Log("地牢房间配置, 重新打包完成!"); // } // catch (Exception e) // { - // GD.PrintErr(e.ToString()); + // Debug.LogError(e.ToString()); // return false; // } diff --git a/DungeonShooting_Godot/src/framework/generator/ExcelGenerator.cs b/DungeonShooting_Godot/src/framework/generator/ExcelGenerator.cs index 13e21ce..cd72216 100644 --- a/DungeonShooting_Godot/src/framework/generator/ExcelGenerator.cs +++ b/DungeonShooting_Godot/src/framework/generator/ExcelGenerator.cs @@ -19,17 +19,17 @@ OS.Execute("excel/DungeonShooting_ExcelTool.exe", new string[] { excelPath, jsonPath, codePath }, arr); foreach (var message in arr) { - GD.Print(message); + Debug.Log(message); } try { GeneratorActivityObjectInit(); - GD.Print("生成'src/framework/activity/ActivityObject_Init.cs'成功!"); + Debug.Log("生成'src/framework/activity/ActivityObject_Init.cs'成功!"); } catch (Exception e) { - GD.PrintErr(e.ToString()); + Debug.LogError(e.ToString()); } } diff --git a/DungeonShooting_Godot/src/framework/generator/ResourcePathGenerator.cs b/DungeonShooting_Godot/src/framework/generator/ResourcePathGenerator.cs index c824d0f..739d9da 100644 --- a/DungeonShooting_Godot/src/framework/generator/ResourcePathGenerator.cs +++ b/DungeonShooting_Godot/src/framework/generator/ResourcePathGenerator.cs @@ -66,18 +66,18 @@ "public class ResourcePath\n" + "{\n"; - GD.Print("更新 ResourcePath..."); + Debug.Log("更新 ResourcePath..."); var directoryInfo = new DirectoryInfo(System.Environment.CurrentDirectory); EachDir(directoryInfo); resultStr += "}"; File.WriteAllText(savePath, resultStr); - GD.Print("ResourcePath.cs 写出完成!"); + Debug.Log("ResourcePath.cs 写出完成!"); } catch (Exception e) { - GD.PrintErr(e.ToString()); + Debug.LogError(e.ToString()); return false; } @@ -92,7 +92,7 @@ path = path.Replace('\\', '/'); if (exclude.Contains(path)) { - GD.Print("扫描排除路径: " + path); + Debug.Log("扫描排除路径: " + path); return; } } diff --git a/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs b/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs index 98dfa86..3a84f2a 100644 --- a/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs +++ b/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs @@ -86,7 +86,7 @@ } catch (Exception e) { - GD.PrintErr(e.ToString()); + Debug.LogError(e.ToString()); return false; } @@ -117,7 +117,7 @@ var uiName = control.Name.ToString(); var path = GameConfig.UiCodeDir + uiName.FirstToLower() + "/" + uiName + ".cs"; - GD.Print("重新生成ui代码: " + path); + Debug.Log("重新生成ui代码: " + path); var uiNode = EachNodeFromEditor(control.Name, control); var code = GenerateClassCode(uiNode); @@ -126,7 +126,7 @@ { if (pair.Value > 1) { - GD.Print($"检测到同名节点: '{pair.Key}', 使用该名称的节点将无法生成唯一节点属性!"); + Debug.Log($"检测到同名节点: '{pair.Key}', 使用该名称的节点将无法生成唯一节点属性!"); } } @@ -134,7 +134,7 @@ } catch (Exception e) { - GD.PrintErr(e.ToString()); + Debug.LogError(e.ToString()); return false; } diff --git a/DungeonShooting_Godot/src/framework/generator/UiManagerMethodsGenerator.cs b/DungeonShooting_Godot/src/framework/generator/UiManagerMethodsGenerator.cs index a13de3d..3af101e 100644 --- a/DungeonShooting_Godot/src/framework/generator/UiManagerMethodsGenerator.cs +++ b/DungeonShooting_Godot/src/framework/generator/UiManagerMethodsGenerator.cs @@ -108,7 +108,7 @@ } catch (Exception e) { - GD.PrintErr(e.ToString()); + Debug.LogError(e.ToString()); return false; } diff --git a/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs b/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs index 8dcc1a8..ff9605b 100644 --- a/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs +++ b/DungeonShooting_Godot/src/framework/map/DungeonGenerator.cs @@ -104,7 +104,7 @@ throw new Exception("当前组'" + config.GroupName + "'" + result.ErrorMessage + ", 不能生成地牢!"); } - GD.Print("创建地牢生成器, 随机种子: " + _random.Seed); + Debug.Log("创建地牢生成器, 随机种子: " + _random.Seed); _roomGroup.InitWeight(_random); } @@ -266,22 +266,22 @@ chainTryCount++; } - GD.Print("生成第" + (_count + 1) + "个房间失败! 失败原因: " + errorCode); + Debug.Log("生成第" + (_count + 1) + "个房间失败! 失败原因: " + errorCode); if (errorCode == GenerateRoomErrorCode.OutArea) { _failCount++; - GD.Print("超出区域失败次数: " + _failCount); + Debug.Log("超出区域失败次数: " + _failCount); if (_failCount >= _maxFailCount) { _enableLimitRange = false; - GD.Print("生成房间失败次数过多, 关闭区域限制!"); + Debug.Log("生成房间失败次数过多, 关闭区域限制!"); } } } } _roomGrid.Clear(); - GD.Print("房间总数: " + RoomInfos.Count); + Debug.Log("房间总数: " + RoomInfos.Count); } //生成房间 @@ -478,7 +478,7 @@ { if (roomInfo.Next.Count > 0) { - GD.PrintErr("当前房间还有连接的子房间, 不能回滚!"); + Debug.LogError("当前房间还有连接的子房间, 不能回滚!"); return false; } //退掉占用的房间区域和过道占用区域 diff --git a/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs b/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs index ad22bd6..cd1414f 100644 --- a/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs +++ b/DungeonShooting_Godot/src/framework/map/DungeonTileMap.cs @@ -667,7 +667,7 @@ { _usePoints.Clear(); _polygonDataList.Clear(); - GD.Print(e.Message); + Debug.Log(e.Message); _generateNavigationResult = new GenerateNavigationResult(false, e); } } diff --git a/DungeonShooting_Godot/src/framework/map/fog/AisleFogArea.cs b/DungeonShooting_Godot/src/framework/map/fog/AisleFogArea.cs index 09473fd..3712c8b 100644 --- a/DungeonShooting_Godot/src/framework/map/fog/AisleFogArea.cs +++ b/DungeonShooting_Godot/src/framework/map/fog/AisleFogArea.cs @@ -81,14 +81,14 @@ private void InsertItem() { - //GD.Print("玩家进入过道"); + //Debug.Log("玩家进入过道"); //RoomDoorInfo.ClearFog(); FogMaskHandler.RefreshAisleFog(RoomDoorInfo); } // private void LeavePlayer() // { - // //GD.Print("玩家离开过道"); + // //Debug.Log("玩家离开过道"); // //RoomDoorInfo.DarkFog(); // } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/map/fog/FogMaskHandler.cs b/DungeonShooting_Godot/src/framework/map/fog/FogMaskHandler.cs index 3f2ccf3..cfa21e4 100644 --- a/DungeonShooting_Godot/src/framework/map/fog/FogMaskHandler.cs +++ b/DungeonShooting_Godot/src/framework/map/fog/FogMaskHandler.cs @@ -51,7 +51,7 @@ { if (_prevRoomInfo != roomInfo) { - GD.Print($"切换房间: {_prevRoomInfo?.Id} => {roomInfo.Id}"); + Debug.Log($"切换房间: {_prevRoomInfo?.Id} => {roomInfo.Id}"); if (_prevRoomInfo != null) { //房间变暗 @@ -88,7 +88,7 @@ _prevRoomInfo = roomInfo; } - GD.Print("RefreshRoomFog: " + roomInfo.Id); + Debug.Log("RefreshRoomFog: " + roomInfo.Id); var fogMask = roomInfo.RoomFogMask; if (!fogMask.IsExplored) //未探索该区域 @@ -136,7 +136,7 @@ private static void _RefreshAisleFog(RoomDoorInfo doorInfo) { - GD.Print("RefreshAisleFog: " + doorInfo.RoomInfo.Id + doorInfo.Direction); + Debug.Log("RefreshAisleFog: " + doorInfo.RoomInfo.Id + doorInfo.Direction); var fogMask = doorInfo.AisleFogMask; var connectDoor = doorInfo.ConnectDoor; diff --git a/DungeonShooting_Godot/src/framework/map/image/ImageCanvas.cs b/DungeonShooting_Godot/src/framework/map/image/ImageCanvas.cs index 4373220..d69c2e8 100644 --- a/DungeonShooting_Godot/src/framework/map/image/ImageCanvas.cs +++ b/DungeonShooting_Godot/src/framework/map/image/ImageCanvas.cs @@ -67,11 +67,11 @@ var height = item.SrcImage.GetHeight(); if (width > 128) { - GD.PrintErr("警告: 图像宽度大于 128, 旋转后像素点可能绘制到画布外导致像素丢失!"); + Debug.LogError("警告: 图像宽度大于 128, 旋转后像素点可能绘制到画布外导致像素丢失!"); } if (height > 128) { - GD.PrintErr("警告: 图像高度大于 128, 旋转后像素点可能绘制到画布外导致像素丢失!"); + Debug.LogError("警告: 图像高度大于 128, 旋转后像素点可能绘制到画布外导致像素丢失!"); } item.X = Mathf.RoundToInt(x); item.Y = Mathf.RoundToInt(y); @@ -105,7 +105,7 @@ if (item.RenderWidth >= RenderViewportSize.X) { - GD.PrintErr($"图像旋转后的宽度大于{RenderViewportSize.X}, 不支持绘制到 ImageCanvas 下!"); + Debug.LogError($"图像旋转后的宽度大于{RenderViewportSize.X}, 不支持绘制到 ImageCanvas 下!"); item.SrcImage.Dispose(); return; } diff --git a/DungeonShooting_Godot/src/framework/map/image/ImageCanvas_Static.cs b/DungeonShooting_Godot/src/framework/map/image/ImageCanvas_Static.cs index ffd97ec..32ea79f 100644 --- a/DungeonShooting_Godot/src/framework/map/image/ImageCanvas_Static.cs +++ b/DungeonShooting_Godot/src/framework/map/image/ImageCanvas_Static.cs @@ -121,7 +121,7 @@ { if (!_placeholders.Remove(placeholder)) { - GD.PrintErr("移除 AreaPlaceholder 失败!"); + Debug.LogError("移除 AreaPlaceholder 失败!"); } } @@ -212,7 +212,7 @@ } } while (_drawingQueueItems.Count > 0 && (DateTime.Now - startTime).TotalMilliseconds < step1Time); - //GD.Print($"当前帧绘制完成数量: {index}, 绘制队列数量: {_drawingQueueItems.Count}, 用时: {(DateTime.Now - startTime).TotalMilliseconds}毫秒"); + //Debug.Log($"当前帧绘制完成数量: {index}, 绘制队列数量: {_drawingQueueItems.Count}, 用时: {(DateTime.Now - startTime).TotalMilliseconds}毫秒"); } //重绘画布 @@ -231,7 +231,7 @@ } catch (Exception e) { - GD.PrintErr("在ImageCanvas中调用回调OnDrawingComplete()发生异常: " + e); + Debug.LogError("在ImageCanvas中调用回调OnDrawingComplete()发生异常: " + e); } } } @@ -276,7 +276,7 @@ } } - //GD.Print($"当前帧进入绘制绘队列数量: {index}, 待绘制队列数量: {_queueItems.Count}, 绘制队列数量: {_drawingQueueItems.Count}, 用时: {(DateTime.Now - startTime).TotalMilliseconds}毫秒"); + //Debug.Log($"当前帧进入绘制绘队列数量: {index}, 待绘制队列数量: {_queueItems.Count}, 绘制队列数量: {_drawingQueueItems.Count}, 用时: {(DateTime.Now - startTime).TotalMilliseconds}毫秒"); } } diff --git a/DungeonShooting_Godot/src/framework/map/preinstall/RoomPreinstall.cs b/DungeonShooting_Godot/src/framework/map/preinstall/RoomPreinstall.cs index 92e4f00..d390aef 100644 --- a/DungeonShooting_Godot/src/framework/map/preinstall/RoomPreinstall.cs +++ b/DungeonShooting_Godot/src/framework/map/preinstall/RoomPreinstall.cs @@ -146,7 +146,7 @@ } else { - GD.PrintErr("暂未支持的类型: " + markInfo.SpecialMarkType); + Debug.LogError("暂未支持的类型: " + markInfo.SpecialMarkType); continue; } @@ -250,7 +250,7 @@ { if (_currWaveIndex < WaveList.Count) { - GD.Print($"执行第{_currWaveIndex}波"); + Debug.Log($"执行第{_currWaveIndex}波"); _coroutineId = GameApplication.Instance.World.StartCoroutine(RunMark(WaveList[_currWaveIndex])); _currWaveIndex++; } @@ -267,7 +267,7 @@ return; } - GD.Print($"执行第{_currWaveIndex}波"); + Debug.Log($"执行第{_currWaveIndex}波"); _coroutineId = GameApplication.Instance.World.StartCoroutine(RunMark(WaveList[_currWaveIndex])); _currWaveIndex++; } diff --git a/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomGroup.cs b/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomGroup.cs index 003dee7..142ca79 100644 --- a/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomGroup.cs +++ b/DungeonShooting_Godot/src/framework/map/serialize/DungeonRoomGroup.cs @@ -179,7 +179,7 @@ { if (!_init) { - GD.PrintErr("未调用DungeonRoomGroup.InitWeight()来初始化权重!"); + Debug.LogError("未调用DungeonRoomGroup.InitWeight()来初始化权重!"); return null; } diff --git a/DungeonShooting_Godot/src/framework/ui/UiBase.cs b/DungeonShooting_Godot/src/framework/ui/UiBase.cs index 94ed4fa..28ee1fd 100644 --- a/DungeonShooting_Godot/src/framework/ui/UiBase.cs +++ b/DungeonShooting_Godot/src/framework/ui/UiBase.cs @@ -105,7 +105,7 @@ { if (IsDestroyed) { - GD.PrintErr($"当前Ui: {UiName}已经被销毁!"); + Debug.LogError($"当前Ui: {UiName}已经被销毁!"); return; } if (IsOpen) @@ -134,7 +134,7 @@ { if (IsDestroyed) { - GD.PrintErr($"当前Ui: {UiName}已经被销毁!"); + Debug.LogError($"当前Ui: {UiName}已经被销毁!"); return; } if (!IsOpen) @@ -254,7 +254,7 @@ { if (uiBase.ParentUi != null && uiBase.ParentUi != this) { - GD.PrintErr($"子Ui:'{uiBase.UiName}'已经被其他Ui:'{uiBase.ParentUi.UiName}'嵌套打开!"); + Debug.LogError($"子Ui:'{uiBase.UiName}'已经被其他Ui:'{uiBase.ParentUi.UiName}'嵌套打开!"); uiBase.ParentUi.RecordNestedUi(uiBase, node, UiManager.RecordType.Close); } if (_nestedUiSet == null) @@ -275,7 +275,7 @@ } else { - GD.PrintErr($"当前Ui:'{UiName}'没有嵌套打开子Ui:'{uiBase.UiName}'!"); + Debug.LogError($"当前Ui:'{UiName}'没有嵌套打开子Ui:'{uiBase.UiName}'!"); return; } @@ -343,7 +343,7 @@ Destroy(); if (PrevUi == null) { - GD.PrintErr($"Ui: {UiName} 没有记录上一级Ui!"); + Debug.LogError($"Ui: {UiName} 没有记录上一级Ui!"); } else { diff --git a/DungeonShooting_Godot/src/game/GameApplication.cs b/DungeonShooting_Godot/src/game/GameApplication.cs index 3953932..9e4266c 100644 --- a/DungeonShooting_Godot/src/game/GameApplication.cs +++ b/DungeonShooting_Godot/src/game/GameApplication.cs @@ -121,6 +121,9 @@ //初始化ui UiManager.Init(); + //调试Ui + UiManager.Open_Debugger(); + // 初始化鼠标 InitCursor(); //地牢管理器 diff --git a/DungeonShooting_Godot/src/game/activity/role/Role.cs b/DungeonShooting_Godot/src/game/activity/role/Role.cs index 027db19..d3ed357 100644 --- a/DungeonShooting_Godot/src/game/activity/role/Role.cs +++ b/DungeonShooting_Godot/src/game/activity/role/Role.cs @@ -828,7 +828,7 @@ { if (BuffPropPack.Contains(buffProp)) { - GD.PrintErr("被动道具已经在背包中了!"); + Debug.LogError("被动道具已经在背包中了!"); return false; } BuffPropPack.Add(buffProp); @@ -847,7 +847,7 @@ var index = BuffPropPack.IndexOf(buffProp); if (index < 0) { - GD.PrintErr("当前道具不在角色背包中!"); + Debug.LogError("当前道具不在角色背包中!"); return; } diff --git a/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiFindAmmoState.cs b/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiFindAmmoState.cs index f1f6863..79cb04e 100644 --- a/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiFindAmmoState.cs +++ b/DungeonShooting_Godot/src/game/activity/role/enemy/state/AiFindAmmoState.cs @@ -24,7 +24,7 @@ { if (args.Length == 0) { - GD.PrintErr("进入 AiStateEnum.AiFindAmmo 状态必须要把目标武器当成参数传过来"); + Debug.LogError("进入 AiStateEnum.AiFindAmmo 状态必须要把目标武器当成参数传过来"); ChangeState(prev); return; } diff --git a/DungeonShooting_Godot/src/game/activity/shell/Shell.cs b/DungeonShooting_Godot/src/game/activity/shell/Shell.cs index f5f9af3..5b58591 100644 --- a/DungeonShooting_Godot/src/game/activity/shell/Shell.cs +++ b/DungeonShooting_Godot/src/game/activity/shell/Shell.cs @@ -24,7 +24,7 @@ } else { - GD.Print("弹壳投抛到画布外了, 强制消除..."); + Debug.Log("弹壳投抛到画布外了, 强制消除..."); Destroy(); } } diff --git a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs index c6b93e7..03ab172 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/Weapon.cs @@ -246,7 +246,7 @@ { if (!_weaponAttributeMap.TryAdd(weaponAttr.WeaponId, weaponAttr)) { - GD.PrintErr("发现重复注册的武器属性: " + weaponAttr.Id); + Debug.LogError("发现重复注册的武器属性: " + weaponAttr.Id); } } } @@ -287,7 +287,7 @@ if (Attribute.AmmoCapacity > Attribute.MaxAmmoCapacity) { Attribute.AmmoCapacity = Attribute.MaxAmmoCapacity; - GD.PrintErr("弹夹的容量不能超过弹药上限, 武器id: " + ItemConfig.Id); + Debug.LogError("弹夹的容量不能超过弹药上限, 武器id: " + ItemConfig.Id); } //弹药量 CurrAmmo = Attribute.AmmoCapacity; @@ -495,7 +495,7 @@ switch (_aloneReloadState) { case 0: - GD.PrintErr("AloneReload状态错误!"); + Debug.LogError("AloneReload状态错误!"); break; case 1: //装第一颗子弹之前 { @@ -537,7 +537,7 @@ if (!_playReloadFinishSoundFlag && Attribute.ReloadFinishSound != null && _reloadTimer <= Attribute.ReloadFinishSoundAdvanceTime) { _playReloadFinishSoundFlag = true; - // GD.Print("播放换弹完成音效."); + // Debug.Log("播放换弹完成音效."); PlayReloadFinishSound(); } @@ -558,7 +558,7 @@ if (!_playReloadFinishSoundFlag && Attribute.ReloadFinishSound != null && _reloadTimer <= Attribute.ReloadFinishSoundAdvanceTime) { _playReloadFinishSoundFlag = true; - // GD.Print("播放换弹完成音效."); + // Debug.Log("播放换弹完成音效."); PlayReloadFinishSound(); } @@ -1127,7 +1127,7 @@ //播放开始换弹音效 PlayBeginReloadSound(); - // GD.Print("开始换弹."); + // Debug.Log("开始换弹."); //抛弹 if (!Attribute.ContinuousShoot && (_beLoadedState == 0 || _beLoadedState == -1) && Attribute.BeLoadedTime > 0) { @@ -1299,20 +1299,20 @@ PlayReloadSound(); OnReload(); - // GD.Print("装弹."); + // Debug.Log("装弹."); } //换弹完成处理逻辑 private void ReloadFinishHandler() { - // GD.Print("装弹完成."); + // Debug.Log("装弹完成."); OnReloadFinish(); } //单独装弹完成 private void AloneReloadStateFinish() { - // GD.Print("单独装弹完成."); + // Debug.Log("单独装弹完成."); OnAloneReloadStateFinish(); } @@ -1492,7 +1492,7 @@ //帧动画播放结束 private void OnAnimationFinished() { - // GD.Print("帧动画播放结束..."); + // Debug.Log("帧动画播放结束..."); AnimatedSprite.Play(AnimatorNames.Default); } diff --git a/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs b/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs index 0f83144..462ebed 100644 --- a/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs +++ b/DungeonShooting_Godot/src/game/activity/weapon/knife/Knife.cs @@ -72,7 +72,7 @@ protected override void OnFire() { - GD.Print("近战武器攻击! 蓄力时长: " + GetTriggerChargeTime() + ", 扳机按下时长: " + GetTriggerDownTime()); + Debug.Log("近战武器攻击! 蓄力时长: " + GetTriggerChargeTime() + ", 扳机按下时长: " + GetTriggerDownTime()); //更新碰撞层级 _hitArea.CollisionMask = GetAttackLayer() | PhysicsLayer.Bullet; //启用碰撞 @@ -123,7 +123,7 @@ private void OnBodyEntered(Node2D body) { - //GD.Print("碰到物体: " + body.Name); + //Debug.Log("碰到物体: " + body.Name); var activityObject = body.AsActivityObject(); if (activityObject != null) { diff --git a/DungeonShooting_Godot/src/game/event/EventManager.cs b/DungeonShooting_Godot/src/game/event/EventManager.cs index 394db2a..0ec5e43 100644 --- a/DungeonShooting_Godot/src/game/event/EventManager.cs +++ b/DungeonShooting_Godot/src/game/event/EventManager.cs @@ -64,7 +64,7 @@ } catch (Exception e) { - GD.PrintErr($"EventManager 派发事件: '{eventType}' 发生异常: \n" + e.Message + "\n" + e.StackTrace); + Debug.LogError($"EventManager 派发事件: '{eventType}' 发生异常: \n" + e.Message + "\n" + e.StackTrace); } } } diff --git a/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs b/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs index 0076005..1e020ef 100644 --- a/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs +++ b/DungeonShooting_Godot/src/game/manager/MapProjectManager.cs @@ -93,7 +93,7 @@ } else { - GD.Print("刷新地图组时未找到配置文件: " + configFile + ", 执行创建文件"); + Debug.Log("刷新地图组时未找到配置文件: " + configFile + ", 执行创建文件"); GroupMap = new Dictionary(); File.WriteAllText(configFile, "{}"); } @@ -117,7 +117,7 @@ { if (GroupMap.ContainsKey(group.GroupName)) { - GD.PrintErr($"已经存在相同的地牢组: {group.GroupName}"); + Debug.LogError($"已经存在相同的地牢组: {group.GroupName}"); return; } GroupMap.Add(group.GroupName, group); @@ -161,7 +161,7 @@ } else { - GD.PrintErr($"未找到地牢组: {groupName}"); + Debug.LogError($"未找到地牢组: {groupName}"); } } diff --git a/DungeonShooting_Godot/src/game/manager/ResourceManager.cs b/DungeonShooting_Godot/src/game/manager/ResourceManager.cs index 6d23584..008031b 100644 --- a/DungeonShooting_Godot/src/game/manager/ResourceManager.cs +++ b/DungeonShooting_Godot/src/game/manager/ResourceManager.cs @@ -97,7 +97,7 @@ var res = ResourceLoader.Load(path, null, ResourceLoader.CacheMode.Ignore); if (res == null) { - GD.PrintErr("加载资源失败, 未找到资源: " + path); + Debug.LogError("加载资源失败, 未找到资源: " + path); return default; } @@ -117,7 +117,7 @@ } else { - GD.PrintErr("加载资源失败, 未找到资源: " + path); + Debug.LogError("加载资源失败, 未找到资源: " + path); } return default; diff --git a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs index 9ad2b4f..d04d4a5 100644 --- a/DungeonShooting_Godot/src/game/manager/ResourcePath.cs +++ b/DungeonShooting_Godot/src/game/manager/ResourcePath.cs @@ -48,6 +48,7 @@ public const string prefab_test_MoveComponent_tscn = "res://prefab/test/MoveComponent.tscn"; public const string prefab_test_TestActivity_tscn = "res://prefab/test/TestActivity.tscn"; public const string prefab_ui_BottomTips_tscn = "res://prefab/ui/BottomTips.tscn"; + public const string prefab_ui_Debugger_tscn = "res://prefab/ui/Debugger.tscn"; public const string prefab_ui_EditorTips_tscn = "res://prefab/ui/EditorTips.tscn"; public const string prefab_ui_EditorTools_tscn = "res://prefab/ui/EditorTools.tscn"; public const string prefab_ui_EditorWindow_tscn = "res://prefab/ui/EditorWindow.tscn"; diff --git a/DungeonShooting_Godot/src/game/manager/SoundManager.cs b/DungeonShooting_Godot/src/game/manager/SoundManager.cs index bcf7ea4..679cb32 100644 --- a/DungeonShooting_Godot/src/game/manager/SoundManager.cs +++ b/DungeonShooting_Godot/src/game/manager/SoundManager.cs @@ -52,7 +52,7 @@ { if (_playingSoundResourceList.Contains(path)) { - GD.Print("重复播放: " + path); + Debug.Log("重复播放: " + path); } else { diff --git a/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs b/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs index efb934c..f6a415b 100644 --- a/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs +++ b/DungeonShooting_Godot/src/game/manager/UiManager_Methods.cs @@ -7,6 +7,7 @@ public static class UiName { public const string BottomTips = "BottomTips"; + public const string Debugger = "Debugger"; public const string EditorTips = "EditorTips"; public const string EditorTools = "EditorTools"; public const string EditorWindow = "EditorWindow"; @@ -77,6 +78,54 @@ } /// + /// 创建 Debugger, 并返回UI实例, 该函数不会打开 Ui + /// + public static UI.Debugger.DebuggerPanel Create_Debugger() + { + return CreateUi(UiName.Debugger); + } + + /// + /// 打开 Debugger, 并返回UI实例 + /// + public static UI.Debugger.DebuggerPanel Open_Debugger() + { + return OpenUi(UiName.Debugger); + } + + /// + /// 隐藏 Debugger 的所有实例 + /// + public static void Hide_Debugger() + { + var uiInstance = Get_Debugger_Instance(); + foreach (var uiPanel in uiInstance) + { + uiPanel.HideUi(); + } + } + + /// + /// 销毁 Debugger 的所有实例 + /// + public static void Destroy_Debugger() + { + var uiInstance = Get_Debugger_Instance(); + foreach (var uiPanel in uiInstance) + { + uiPanel.Destroy(); + } + } + + /// + /// 获取所有 Debugger 的实例, 如果没有实例, 则返回一个空数组 + /// + public static UI.Debugger.DebuggerPanel[] Get_Debugger_Instance() + { + return GetUiInstance(nameof(UI.Debugger.Debugger)); + } + + /// /// 创建 EditorTips, 并返回UI实例, 该函数不会打开 Ui /// public static UI.EditorTips.EditorTipsPanel Create_EditorTips() diff --git a/DungeonShooting_Godot/src/game/room/DungeonManager.cs b/DungeonShooting_Godot/src/game/room/DungeonManager.cs index a31c84a..e399944 100644 --- a/DungeonShooting_Godot/src/game/room/DungeonManager.cs +++ b/DungeonShooting_Godot/src/game/room/DungeonManager.cs @@ -601,7 +601,7 @@ var flag = ActiveAffiliationArea.ExistEnterItem( activityObject => activityObject.CollisionWithMask(PhysicsLayer.Enemy) ); - //GD.Print("当前房间存活数量: " + count); + //Debug.Log("当前房间存活数量: " + count); if (!flag) { activeRoom.OnClearRoom(); diff --git a/DungeonShooting_Godot/src/game/ui/debugger/Debugger.cs b/DungeonShooting_Godot/src/game/ui/debugger/Debugger.cs new file mode 100644 index 0000000..e63e0d4 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/debugger/Debugger.cs @@ -0,0 +1,181 @@ +namespace UI.Debugger; + +/// +/// Ui代码, 该类是根据ui场景自动生成的, 请不要手动编辑该类, 以免造成代码丢失 +/// +public abstract partial class Debugger : UiBase +{ + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Debugger.Bg + /// + public Bg L_Bg + { + get + { + if (_L_Bg == null) _L_Bg = new Bg((DebuggerPanel)this, GetNode("Bg")); + return _L_Bg; + } + } + private Bg _L_Bg; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Debugger.HoverButton + /// + public HoverButton L_HoverButton + { + get + { + if (_L_HoverButton == null) _L_HoverButton = new HoverButton((DebuggerPanel)this, GetNode("HoverButton")); + return _L_HoverButton; + } + } + private HoverButton _L_HoverButton; + + + public Debugger() : base(nameof(Debugger)) + { + } + + public sealed override void OnInitNestedUi() + { + + } + + /// + /// 类型: , 路径: Debugger.Bg.Clear + /// + public class Clear : UiNode + { + public Clear(DebuggerPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override Clear Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: Debugger.Bg.Close + /// + public class Close : UiNode + { + public Close(DebuggerPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override Close Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: Debugger.Bg.ScrollContainer.Label + /// + public class Label : UiNode + { + public Label(DebuggerPanel uiPanel, Godot.Label node) : base(uiPanel, node) { } + public override Label Clone() => new (UiPanel, (Godot.Label)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: Debugger.Bg.ScrollContainer + /// + public class ScrollContainer : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Debugger.Bg.Label + /// + public Label L_Label + { + get + { + if (_L_Label == null) _L_Label = new Label(UiPanel, Instance.GetNode("Label")); + return _L_Label; + } + } + private Label _L_Label; + + public ScrollContainer(DebuggerPanel uiPanel, Godot.ScrollContainer node) : base(uiPanel, node) { } + public override ScrollContainer Clone() => new (UiPanel, (Godot.ScrollContainer)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: Debugger.Bg + /// + public class Bg : UiNode + { + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Debugger.Clear + /// + public Clear L_Clear + { + get + { + if (_L_Clear == null) _L_Clear = new Clear(UiPanel, Instance.GetNode("Clear")); + return _L_Clear; + } + } + private Clear _L_Clear; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Debugger.Close + /// + public Close L_Close + { + get + { + if (_L_Close == null) _L_Close = new Close(UiPanel, Instance.GetNode("Close")); + return _L_Close; + } + } + private Close _L_Close; + + /// + /// 使用 Instance 属性获取当前节点实例对象, 节点类型: , 节点路径: Debugger.ScrollContainer + /// + public ScrollContainer L_ScrollContainer + { + get + { + if (_L_ScrollContainer == null) _L_ScrollContainer = new ScrollContainer(UiPanel, Instance.GetNode("ScrollContainer")); + return _L_ScrollContainer; + } + } + private ScrollContainer _L_ScrollContainer; + + public Bg(DebuggerPanel uiPanel, Godot.ColorRect node) : base(uiPanel, node) { } + public override Bg Clone() => new (UiPanel, (Godot.ColorRect)Instance.Duplicate()); + } + + /// + /// 类型: , 路径: Debugger.HoverButton + /// + public class HoverButton : UiNode + { + public HoverButton(DebuggerPanel uiPanel, Godot.Button node) : base(uiPanel, node) { } + public override HoverButton Clone() => new (UiPanel, (Godot.Button)Instance.Duplicate()); + } + + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Debugger.Bg.Clear + /// + public Clear S_Clear => L_Bg.L_Clear; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Debugger.Bg.Close + /// + public Close S_Close => L_Bg.L_Close; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Debugger.Bg.ScrollContainer.Label + /// + public Label S_Label => L_Bg.L_ScrollContainer.L_Label; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Debugger.Bg.ScrollContainer + /// + public ScrollContainer S_ScrollContainer => L_Bg.L_ScrollContainer; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Debugger.Bg + /// + public Bg S_Bg => L_Bg; + + /// + /// 场景中唯一名称的节点, 节点类型: , 节点路径: Debugger.HoverButton + /// + public HoverButton S_HoverButton => L_HoverButton; + +} diff --git a/DungeonShooting_Godot/src/game/ui/debugger/DebuggerPanel.cs b/DungeonShooting_Godot/src/game/ui/debugger/DebuggerPanel.cs new file mode 100644 index 0000000..43dbe43 --- /dev/null +++ b/DungeonShooting_Godot/src/game/ui/debugger/DebuggerPanel.cs @@ -0,0 +1,54 @@ +using Godot; + +namespace UI.Debugger; + +public partial class DebuggerPanel : Debugger +{ + private bool _showPanel = false; + private int _len = 0; + + public override void OnCreateUi() + { + S_Bg.Instance.Visible = false; + S_HoverButton.Instance.Pressed += OnClickHoverButton; + S_Clear.Instance.Pressed += OnClear; + S_Close.Instance.Pressed += OnClose; + } + + public override void OnDestroyUi() + { + + } + + public override void Process(float delta) + { + if (_showPanel) + { + if (Debug.AllLogMessage.Length != _len) + { + S_Label.Instance.Text = Debug.AllLogMessage; + _len = Debug.AllLogMessage.Length; + } + } + } + + private void OnClickHoverButton() + { + _showPanel = true; + S_Bg.Instance.Visible = _showPanel; + S_HoverButton.Instance.Visible = false; + } + + private void OnClear() + { + S_Label.Instance.Text = ""; + _len = 0; + } + + private void OnClose() + { + _showPanel = false; + S_Bg.Instance.Visible = _showPanel; + S_HoverButton.Instance.Visible = true; + } +} diff --git a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs index 686b15a..50c9957 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditor/tileView/EditorTileMap.cs @@ -398,13 +398,13 @@ _isGenerateTerrain = false; //计算区域 CalcTileRect(false); - GD.Print("开始检测是否可以生成地形..."); + Debug.Log("开始检测是否可以生成地形..."); if (CheckTerrain()) { - GD.Print("开始绘制导航网格..."); + Debug.Log("开始绘制导航网格..."); if (GenerateNavigation()) { - GD.Print("开始绘制自动贴图..."); + Debug.Log("开始绘制自动贴图..."); GenerateTerrain(); _isGenerateTerrain = true; } @@ -450,7 +450,7 @@ /// public void TriggerSave(RoomErrorType errorType, Action finish) { - GD.Print("保存地牢房间数据..."); + Debug.Log("保存地牢房间数据..."); //执行创建预览图流程 RunSavePreviewImage(() => { @@ -768,7 +768,7 @@ } else { - GD.PrintErr($"异常图块: {pos}, 这个图块的图集坐标'{atlasCoords}'不属于'MiddleMapLayer'和'TopMapLayer'!"); + Debug.LogError($"异常图块: {pos}, 这个图块的图集坐标'{atlasCoords}'不属于'MiddleMapLayer'和'TopMapLayer'!"); continue; } EraseCell(AutoFloorLayer, pos); diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs b/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs index 39d83ee..b9ab1ed 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorProject/GroupButtonCell.cs @@ -17,7 +17,7 @@ public override void OnRefreshIndex() { - GD.Print("刷新索引: " + Index); + Debug.Log("刷新索引: " + Index); } //选中工程 diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorDragArea.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorDragArea.cs index f75311b..34b2d6f 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorDragArea.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorDragArea.cs @@ -185,7 +185,7 @@ { _areaSize = value; RefreshArea(); - //GD.Print("size: " + GetDoorAreaRange()); + //Debug.Log("size: " + GetDoorAreaRange()); } //刷新区域位置 @@ -418,7 +418,7 @@ var doorAreaRange = GetDoorAreaRange(); DoorAreaInfo.Start = doorAreaRange.X; DoorAreaInfo.End = doorAreaRange.Y; - GD.Print("提交修改: " + doorAreaRange); + Debug.Log("提交修改: " + doorAreaRange); //派发修改数据修改事件 EventManager.EmitEvent(EventEnum.OnEditorDirty); } diff --git a/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorHoverArea.cs b/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorHoverArea.cs index 21bca90..2fcfe26 100644 --- a/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorHoverArea.cs +++ b/DungeonShooting_Godot/src/game/ui/mapEditorTools/DoorHoverArea.cs @@ -73,7 +73,7 @@ private void OnSubmitDoorArea(DoorDirection direction, int start, int end) { IsDrag = false; - GD.Print("提交创建: " + direction + ", " + start + ", " + end); + Debug.Log("提交创建: " + direction + ", " + start + ", " + end); _currToolTemplate.Instance.DoorAreaInfo = MapEditorToolsPanel.EditorMap.Instance.CreateDoorArea(direction, start, end); //派发修改数据修改事件 EventManager.EmitEvent(EventEnum.OnEditorDirty); diff --git a/DungeonShooting_Godot/src/game/ui/roomUI/LifeBar.cs b/DungeonShooting_Godot/src/game/ui/roomUI/LifeBar.cs index d56440f..f3dcbf3 100644 --- a/DungeonShooting_Godot/src/game/ui/roomUI/LifeBar.cs +++ b/DungeonShooting_Godot/src/game/ui/roomUI/LifeBar.cs @@ -55,7 +55,7 @@ var player = Player.Current; if (player.MaxHp % 2 != 0) { - GD.PrintErr("玩家血量不是偶数!"); + Debug.LogError("玩家血量不是偶数!"); } var list = new List(); diff --git a/DungeonShooting_Godot/src/test/TestActivity.cs b/DungeonShooting_Godot/src/test/TestActivity.cs index f541b73..343aabf 100644 --- a/DungeonShooting_Godot/src/test/TestActivity.cs +++ b/DungeonShooting_Godot/src/test/TestActivity.cs @@ -22,26 +22,26 @@ protected override void OnFallToGround() { - GD.Print("OnFallToGround"); + Debug.Log("OnFallToGround"); } protected override void OnFirstFallToGround() { - GD.Print("OnFirstFallToGround"); + Debug.Log("OnFirstFallToGround"); } protected override void OnThrowStart() { - GD.Print("OnThrowStart"); + Debug.Log("OnThrowStart"); } protected override void OnThrowMaxHeight(float height) { - GD.Print("OnThrowMaxHeight: " + height); + Debug.Log("OnThrowMaxHeight: " + height); } protected override void OnThrowOver() { - GD.Print("OnThrowOver"); + Debug.Log("OnThrowOver"); } } \ No newline at end of file diff --git a/DungeonShooting_Godot/src/test/TestCreateSector.cs b/DungeonShooting_Godot/src/test/TestCreateSector.cs index 72b6418..45e1232 100644 --- a/DungeonShooting_Godot/src/test/TestCreateSector.cs +++ b/DungeonShooting_Godot/src/test/TestCreateSector.cs @@ -10,7 +10,7 @@ { GetNode("Area2D").AreaEntered += area => { - GD.Print("areaEnter: " + area.Name); + Debug.Log("areaEnter: " + area.Name); }; _polygon2D = GetNode("Area2D/CollisionPolygon2D"); diff --git a/DungeonShooting_Godot/src/test/TestOptimizeSprite.cs b/DungeonShooting_Godot/src/test/TestOptimizeSprite.cs index 1c9b7e9..2d5b32c 100644 --- a/DungeonShooting_Godot/src/test/TestOptimizeSprite.cs +++ b/DungeonShooting_Godot/src/test/TestOptimizeSprite.cs @@ -46,7 +46,7 @@ // var centerX = texture.GetWidth() / 2; // var centerY = texture.GetHeight() / 2; // //var angle = Utils.RandomRangeInt(0, 360); - // //GD.Print($"x: {i}, y: {j}, angle: " + angle); + // //Debug.Log($"x: {i}, y: {j}, angle: " + angle); // imageCanvas.DrawImageInCanvas(texture, // 10 + i * 10, 10 + j * 10, // angle, centerX, centerY, false