rokojori_action_library/Runtime/Godot/Root.cs

48 lines
659 B
C#
Raw Normal View History

2025-06-19 17:22:25 +00:00
using System;
2024-05-04 08:26:16 +00:00
using Godot;
2026-05-22 12:25:02 +00:00
using Rokojori.Extensions;
2024-05-04 08:26:16 +00:00
namespace Rokojori
{
2026-05-22 12:25:02 +00:00
[Tool][RokojoriActionCoreExport]
2024-05-04 08:26:16 +00:00
public partial class Root:Node
{
2026-05-22 12:25:02 +00:00
static Root _singleton;
2024-05-04 08:26:16 +00:00
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
}
2026-05-22 12:25:02 +00:00
static Root GetRoot()
2024-05-04 08:26:16 +00:00
{
var r = Window();
2024-05-04 08:26:16 +00:00
return _singleton;
}
2025-06-19 17:22:25 +00:00
2024-05-04 08:26:16 +00:00
}
}