namespace Cthangover.Mods.ScenarioStudio { using Cthangover.Core.Bootstrap; using Cthangover.Core.Scenes; using Cthangover.Core.UI; using Cthangover.Core.Utils; using Godot; /// /// Waits until boot is done and the game shell (its TopView toolbar) /// is in the tree, toggles the studio UI entry exactly like the /// toolbar button, then frees itself. Started by . /// public partial class StudioAutoOpenNode : Node { private const string EntryId = "studio"; private const float PollSeconds = 0.5f; public StudioAutoOpenNode() { var timer = new Timer { WaitTime = PollSeconds, Autostart = true }; AddChild(timer); timer.Timeout += OnPoll; } private void OnPoll() { if (!Boot.IsReady || UiHost.Instance == null || SceneContextNode.FindNode("TopView") == null) return; AppServices.Current.Ui.ToggleEntry(EntryId); GameLogger.Log("UI", "Scenario studio: dock opened by --studio"); QueueFree(); } } }