Newer
Older
DungeonShooting / DungeonShooting_Godot / addons / dungeonShooting_plugin / Plugin.cs
  1. #if TOOLS
  2. using Godot;
  3.  
  4. namespace Plugin
  5. {
  6. [Tool]
  7. public class Plugin : EditorPlugin
  8. {
  9. public static Plugin Instance => _instance;
  10. private static Plugin _instance;
  11.  
  12. public override void _Process(float delta)
  13. {
  14. _instance = this;
  15. }
  16.  
  17. public override void _EnterTree()
  18. {
  19. _instance = this;
  20. var script = GD.Load<Script>("res://addons/dungeonShooting_plugin/ActivityObjectTemplate.cs");
  21. var texture = GD.Load<Texture>("res://addons/dungeonShooting_plugin/ActivityObject.svg");
  22. AddCustomType("ActivityObjectTemplate", "Node", script, texture);
  23. }
  24.  
  25. public override void _ExitTree()
  26. {
  27. RemoveCustomType("ActivityObjectTemplate");
  28. }
  29.  
  30. /*public override bool Handles(Object @object)
  31. {
  32. if (@object is Node node)
  33. {
  34. node.
  35. GD.Print("node: " + (node.GetScript() == activityObjectTemplateScript));
  36. /*GD.Print("---------------------- 1: " + objectTemplate.Name);
  37. var sp = new Sprite();
  38. sp.Name = "Sprite";
  39. objectTemplate.AddChild(sp);
  40. sp.Owner = objectTemplate.Owner;#1#
  41. }
  42. return base.Handles(@object);
  43. }*/
  44. }
  45.  
  46. #endif
  47. }