using UI; using UI.Builder; using UI.Map; using UnityEngine; using UnityEngine.UI; namespace S3.Modules.Popout { // Adds a "Pop Out / Re-attach" button to the in-game map window title bar // using the game's own UIPanel / UIPanelBuilder system so it matches the // factory UI styling exactly. internal static class MapWindowButton { private static Button? s_button; internal static void TryInstall() { if (s_button != null) return; var win = PanelFinder.GetMapWindowUI(); // Don't install until the map has been opened at least once. if (win == null || !win.IsShown) return; // Already added — recover reference after a hot-reload var existing = win.transform.Find("RRPopout_Btn"); if (existing != null) { s_button = existing.GetComponentInChildren