diff --git a/DungeonShooting_Godot/addons/dungeonShooting_plugin/NodeMonitor.cs b/DungeonShooting_Godot/addons/dungeonShooting_plugin/NodeMonitor.cs index db423ba..f12aa0c 100644 --- a/DungeonShooting_Godot/addons/dungeonShooting_plugin/NodeMonitor.cs +++ b/DungeonShooting_Godot/addons/dungeonShooting_plugin/NodeMonitor.cs @@ -6,7 +6,7 @@ namespace Plugin; /// -/// 场景监听器, 一旦当前节点内容发生改变, 则直接调用回调代码 +/// 场景监听器, 一旦当前节点内容发生改变, 则直接调用 SceneNodeChangeEvent 事件 /// public class NodeMonitor { diff --git a/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs b/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs index 01d52c7..3c694ff 100644 --- a/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs +++ b/DungeonShooting_Godot/addons/dungeonShooting_plugin/Plugin.cs @@ -9,17 +9,71 @@ [Tool] public partial class Plugin : EditorPlugin { - public static Plugin Instance => _instance; - private static Plugin _instance; + /// + /// 自定义节点类型数据 + /// + private class CustomTypeInfo + { + public CustomTypeInfo(string name, string parentName, string scriptPath, string iconPath) + { + Name = name; + ParentName = parentName; + ScriptPath = scriptPath; + IconPath = iconPath; + } - private EditorToolsPanel _dock; + public string Name; + public string ParentName; + public string ScriptPath; + public string IconPath; + } + + public static Plugin Instance { get; private set; } + + //工具面板 + private EditorToolsPanel _editorTools; //ui监听器 private NodeMonitor _uiMonitor; + //自定义节点 + private CustomTypeInfo[] _customTypeInfos = new CustomTypeInfo[] + { + new CustomTypeInfo( + "ActivityObjectTemplate", + "Node", + "res://src/framework/activity/ActivityObjectTemplate.cs", + "res://addons/dungeonShooting_plugin/ActivityObject.svg" + ), + new CustomTypeInfo( + "DungeonRoomTemplate", + "TileMap", + "res://src/framework/activity/ActivityObjectTemplate.cs", + "res://addons/dungeonShooting_plugin/Map.svg" + ), + new CustomTypeInfo( + "ActivityMark", + "Node2D", + "res://src/framework/map/mark/ActivityMark.cs", + "res://addons/dungeonShooting_plugin/Mark.svg" + ), + new CustomTypeInfo( + "EnemyMark", + "Node2D", + "res://src/framework/map/mark/EnemyMark.cs", + "res://addons/dungeonShooting_plugin/Mark.svg" + ), + new CustomTypeInfo( + "WeaponMark", + "Node2D", + "res://src/framework/map/mark/WeaponMark.cs", + "res://addons/dungeonShooting_plugin/Mark.svg" + ), + }; + public override void _Process(double delta) { - _instance = this; + Instance = this; if (_uiMonitor != null) { _uiMonitor.Process((float) delta); @@ -28,32 +82,33 @@ public override void _EnterTree() { - _instance = this; - var script = GD.Load