Fries
8072cf4961
i made a BasePaddle class so i can put commonly used fields in a base class. this means i made a new plugin called CustomTypes which contains both Base classes.
28 lines
775 B
C#
28 lines
775 B
C#
#if TOOLS
|
|
namespace Pong.addons.CustomTypes
|
|
{
|
|
[Tool]
|
|
public partial class Plugin : EditorPlugin
|
|
{
|
|
public override void _EnterTree()
|
|
{
|
|
var baseMenuScript = GD.Load<Script>("res://Scripts/Managers/UI/BaseMenu.cs");
|
|
var basePaddleScript = GD.Load<Script>("res://Scripts/Managers/BasePaddle.cs");
|
|
|
|
AddCustomType("BaseMenu", "VBoxContainer", baseMenuScript, GetEditorIcon("VBoxContainer"));
|
|
AddCustomType("BasePaddle", "RigidBody2D", basePaddleScript, GetEditorIcon("RigidBody2D"));
|
|
}
|
|
|
|
public override void _ExitTree()
|
|
{
|
|
RemoveCustomType("BaseMenu");
|
|
RemoveCustomType("BasePaddle");
|
|
}
|
|
|
|
private Texture2D GetEditorIcon(string iconName)
|
|
{
|
|
return GetEditorInterface().GetBaseControl().GetThemeIcon(iconName, "EditorIcons");
|
|
}
|
|
}
|
|
}
|
|
#endif
|