using Core; using Core.Lifecycle; using UnityEngine; // TODO: Yeet this class namespace UI.CardSystem { /// /// One-off helper that shows/hides the Card System root based on scene loads. /// Attach this to your Card System root GameObject. It subscribes to SceneManagerService.SceneLoadCompleted /// and applies visibility: hidden in "StartingScene" (configurable), visible in all other gameplay scenes. /// public class CardSystemSceneVisibility : ManagedBehaviour { [Header("Target Root")] [Tooltip("The GameObject to show/hide. Defaults to this GameObject if not assigned.")] [SerializeField] private GameObject targetRoot; public override int ManagedAwakePriority => 95; // Scene-specific UI visibility protected override void OnManagedAwake() { if (targetRoot == null) targetRoot = gameObject; } protected override void OnSceneReady() { // Replaces SceneLoadCompleted subscription var sceneSvc = SceneManagerService.Instance; if (sceneSvc != null) { ApplyVisibility(sceneSvc.CurrentGameplayScene); } } protected override void OnDestroy() { base.OnDestroy(); // No additional cleanup needed } private void ApplyVisibility(string sceneName) { // TODO: Implement actual visibility logic based on sceneName SetActiveSafe(true); // if (targetRoot == null) // return; // // if (string.IsNullOrEmpty(sceneName)) // return; // // if (hideInBootstrapScene && sceneName == "BootstrapScene") // { // SetActiveSafe(false); // return; // } // // bool shouldShow = sceneName != startingSceneName; // SetActiveSafe(shouldShow); } private void SetActiveSafe(bool active) { if (targetRoot.activeSelf != active) { targetRoot.SetActive(active); } } } }