44 lines
601 B
C#
44 lines
601 B
C#
using Godot;
|
|
|
|
|
|
namespace Rokojori
|
|
{
|
|
[Tool]
|
|
public partial class Root:Node
|
|
{
|
|
private static Root _singleton;
|
|
|
|
public override void _Ready()
|
|
{
|
|
_singleton = this;
|
|
}
|
|
|
|
public static SceneTree Tree()
|
|
{
|
|
if ( _singleton == null )
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return _singleton.GetTree();
|
|
}
|
|
|
|
public static Window Window()
|
|
{
|
|
var tree = Tree();
|
|
|
|
if ( tree == null)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return tree.Root;
|
|
}
|
|
|
|
public static Root Get()
|
|
{
|
|
var r = Window();
|
|
return _singleton;
|
|
}
|
|
}
|
|
} |