using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; using UnityEngine.UI; public class UI_UnimplementedFeatureBlocker : MonoBehaviour { public static bool RuntimeEnabled = false; [SerializeField] private string[] blockedButtonNames = { "Button_STORY", "Button_IDOL", "Button_NOTEBOOK", "launchEzGame", "Button_CHARACTER_SET", "Button_Market", "Button_Personal_information", "Button_view_level", "Button_Mail", "Button_notice" }; private Coroutine bindRoutine; private Coroutine continuousBindRoutine; private void OnEnable() { if (!RuntimeEnabled) { CleanupOverlaysInLoadedScenes(); enabled = false; return; } SceneManager.sceneLoaded -= OnSceneLoaded; SceneManager.sceneLoaded += OnSceneLoaded; StartBind(SceneManager.GetActiveScene()); if (continuousBindRoutine == null) continuousBindRoutine = StartCoroutine(ContinuousBindLoop()); } private void OnDisable() { SceneManager.sceneLoaded -= OnSceneLoaded; if (bindRoutine != null) { StopCoroutine(bindRoutine); bindRoutine = null; } if (continuousBindRoutine != null) { StopCoroutine(continuousBindRoutine); continuousBindRoutine = null; } } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { StartBind(scene); } private void StartBind(Scene scene) { if (!scene.IsValid() || !scene.isLoaded) return; if (bindRoutine != null) { StopCoroutine(bindRoutine); bindRoutine = null; } bindRoutine = StartCoroutine(BindRoutine(scene)); } private IEnumerator BindRoutine(Scene scene) { // Repeat binding multiple times so we override listeners added in Start/OnEnable by scene scripts. for (int i = 0; i < 4; i++) { ApplyBlockers(); yield return new WaitForSecondsRealtime(0.12f); } bindRoutine = null; } private IEnumerator ContinuousBindLoop() { while (enabled) { ApplyBlockers(); yield return new WaitForSecondsRealtime(0.5f); } } private void ApplyBlockers() { if (blockedButtonNames == null || blockedButtonNames.Length == 0) return; HashSet