rj-action-library/Runtime/Godot/Root.cs

44 lines
601 B
C#
Raw Normal View History

2024-05-04 08:26:16 +00:00
using Godot;
namespace Rokojori
{
2024-07-26 09:26:24 +00:00
[Tool]
2024-05-04 08:26:16 +00:00
public partial class Root:Node
{
private static Root _singleton;
public override void _Ready()
{
_singleton = this;
}
public static SceneTree Tree()
{
2024-07-26 09:26:24 +00:00
if ( _singleton == null )
{
return null;
}
2024-05-04 08:26:16 +00:00
return _singleton.GetTree();
}
public static Window Window()
{
2024-07-26 09:26:24 +00:00
var tree = Tree();
if ( tree == null)
{
return null;
}
return tree.Root;
2024-05-04 08:26:16 +00:00
}
public static Root Get()
{
var r = Window();
return _singleton;
}
}
}