newlon/addons/pvzadventure/PvZAdventure.cs
2025-07-05 20:51:04 +05:00

44 lines
801 B
C#

#if TOOLS
using Godot;
[Tool]
public partial class PvZAdventure : EditorPlugin
{
private PackedScene panel = ResourceLoader.Load<PackedScene>("res://addons/pvzadventure/scenes/adventure_editor.tscn");
private Control panelInstance;
public override void _EnterTree()
{
panelInstance = panel.Instantiate<Control>();
EditorInterface.Singleton.GetEditorMainScreen().AddChild(panelInstance);
_MakeVisible(false);
}
public override void _ExitTree()
{
if (panelInstance != null)
{
panelInstance.QueueFree();
}
}
public override bool _HasMainScreen()
{
return true;
}
public override void _MakeVisible(bool visible)
{
if (panelInstance != null)
{
panelInstance.Visible = visible;
}
}
public override string _GetPluginName()
{
return "Adventure";
}
}
#endif