diff --git a/DungeonShooting_Godot/src/framework/activity/ActivityObject_EditorTool.cs b/DungeonShooting_Godot/src/framework/activity/ActivityObject_EditorTool.cs index cbc700a..e3d6e5a 100644 --- a/DungeonShooting_Godot/src/framework/activity/ActivityObject_EditorTool.cs +++ b/DungeonShooting_Godot/src/framework/activity/ActivityObject_EditorTool.cs @@ -58,6 +58,7 @@ } } +#if TOOLS private void _InitNodeInEditor() { var parent = GetParent(); @@ -188,4 +189,5 @@ return null; } +#endif } \ 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 7ce0a33..73409c4 100644 --- a/DungeonShooting_Godot/src/framework/generator/DungeonRoomGenerator.cs +++ b/DungeonShooting_Godot/src/framework/generator/DungeonRoomGenerator.cs @@ -1,4 +1,6 @@ +#if TOOLS + using System; using System.Collections.Generic; using System.IO; @@ -64,13 +66,11 @@ //生成 UiManager_Methods.cs 代码 UiManagerMethodsGenerator.Generate(); -#if TOOLS //打开房间 if (open) { Plugin.Plugin.Instance.GetEditorInterface().OpenSceneFromPath(prefabResPath); - } -#endif + } } catch (Exception e) { @@ -266,4 +266,7 @@ return name; } -} \ No newline at end of file +} + + +#endif \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/generator/ExcelGenerator.cs b/DungeonShooting_Godot/src/framework/generator/ExcelGenerator.cs index 2fb744f..b03896f 100644 --- a/DungeonShooting_Godot/src/framework/generator/ExcelGenerator.cs +++ b/DungeonShooting_Godot/src/framework/generator/ExcelGenerator.cs @@ -1,4 +1,6 @@ -using System; +#if TOOLS + +using System; using System.IO; using System.Text.Json; using Godot; @@ -76,4 +78,6 @@ File.WriteAllText("src/framework/activity/ActivityObject_Init.cs", str); } -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/generator/ResourcePathGenerator.cs b/DungeonShooting_Godot/src/framework/generator/ResourcePathGenerator.cs index 7253865..c824d0f 100644 --- a/DungeonShooting_Godot/src/framework/generator/ResourcePathGenerator.cs +++ b/DungeonShooting_Godot/src/framework/generator/ResourcePathGenerator.cs @@ -1,3 +1,4 @@ +#if TOOLS using System; using System.IO; @@ -123,4 +124,6 @@ } } -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs b/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs index 7f7e6fa..5b806ca 100644 --- a/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs +++ b/DungeonShooting_Godot/src/framework/generator/UiGenerator.cs @@ -1,3 +1,4 @@ +#if TOOLS using System; using System.Collections.Generic; @@ -74,13 +75,13 @@ //生成 UiManager_Methods.cs 代码 UiManagerMethodsGenerator.Generate(); -#if TOOLS + //打开ui if (open) { Plugin.Plugin.Instance.GetEditorInterface().OpenSceneFromPath(prefabResPath); } -#endif + } catch (Exception e) { @@ -333,4 +334,6 @@ } } -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/DungeonShooting_Godot/src/framework/generator/UiManagerMethodsGenerator.cs b/DungeonShooting_Godot/src/framework/generator/UiManagerMethodsGenerator.cs index df51675..e38b286 100644 --- a/DungeonShooting_Godot/src/framework/generator/UiManagerMethodsGenerator.cs +++ b/DungeonShooting_Godot/src/framework/generator/UiManagerMethodsGenerator.cs @@ -1,4 +1,6 @@ -using System; +#if TOOLS + +using System; using System.IO; using System.Text.RegularExpressions; using Godot; @@ -103,4 +105,6 @@ return true; } -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs b/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs index 80254b9..314c6a9 100644 --- a/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs +++ b/DungeonShooting_Godot/src/game/ui/editorTools/EditorToolsPanel.cs @@ -2,9 +2,12 @@ using System.Collections.Generic; using System.IO; using System.Text.RegularExpressions; -using Generator; using Godot; +#if TOOLS +using Generator; +#endif + namespace UI.EditorTools; /// @@ -13,6 +16,8 @@ [Tool] public partial class EditorToolsPanel : EditorTools { + +#if TOOLS //Tips 关闭回调 private Action _onTipsClose; @@ -236,7 +241,6 @@ /// private void OnGenerateCurrentUiCode() { -#if TOOLS if (Plugin.Plugin.Instance != null) { var root = Plugin.Plugin.Instance.GetEditorInterface().GetEditedSceneRoot(); @@ -256,7 +260,6 @@ ShowTips("错误", "当前的场景不是受管束的UI场景!"); } } -#endif } /// @@ -420,4 +423,13 @@ editorToolsInstance[0].ShowConfirm(title, message, onClose); } } +#else + public override void OnShowUi() + { + } + + public override void OnHideUi() + { + } +#endif }