diff --git a/Assets/WL/Island/WLIslandLoadingFix.cs b/Assets/WL/Island/WLIslandLoadingFix.cs new file mode 100644 index 000000000..3cf26c518 --- /dev/null +++ b/Assets/WL/Island/WLIslandLoadingFix.cs @@ -0,0 +1,69 @@ +// ───────────────────────────────────────────────────────────────────────────── +// WLIslandLoadingFix.cs — 섬으로 들어갈 때 로딩창이 90 % 에서 멈추는 것을 푼다. +// +// ■ 원인 (Lead 가 PD 의 멈춘 화면에서 실측 · 2026-09-13) +// `LoadingUI.End_Loading(index)` 는 칸 2개가 **모두** 참이어야 로딩창을 닫는다. +// · 칸 1 = UI 준비 → `NewGameUI.cs:88` 이 채운다 → **True** +// · 칸 0 = 몬스터 프리팹 로드 → `MobControlMgrList.cs:28` 이 채운다 → **False** +// 섬(`Level01` · 맵 900)은 전투 맵이 아니라 **`MobControlMgrList` 가 아예 없다** +// (실측: 인스턴스 수 0). 그래서 칸 0 이 영원히 False → 로딩창이 안 닫힌다. +// 실측값: `list_loadingComplete = [False, True]` · 씬은 정상 로드(`Level01` root 15) +// · `bMyPC=True` · 풀·게이트·룩 전부 생성돼 있었다. **화면만 가려져 있었다.** +// +// ■ 조치 +// 섬 씬이 붙은 뒤 `MobControlMgrList` 가 없으면 **우리가 칸 0 을 채운다**. +// 원본 파일 수정 0 — 씬 로드를 스스로 감시해 자기가 붙는다. +// 🔴 전투 맵에는 손대지 않는다(그쪽은 `MobControlMgrList` 가 정상적으로 채운다). +// ───────────────────────────────────────────────────────────────────────────── + +using UnityEngine; +using UnityEngine.SceneManagement; + +namespace WL.Island +{ + [DisallowMultipleComponent] + public sealed class WLIslandLoadingFix : MonoBehaviour + { + /// 이 이름들의 씬이 붙으면 「몬스터 없는 맵」으로 본다. + static readonly string[] NoMobScenes = { "Level01", "Level02", "Level03", "WL_FarmLook" }; + + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterSceneLoad)] + static void Hook() + { + SceneManager.sceneLoaded -= OnSceneLoaded; + SceneManager.sceneLoaded += OnSceneLoaded; + } + + static void OnSceneLoaded(Scene scene, LoadSceneMode mode) + { + bool match = false; + for (int i = 0; i < NoMobScenes.Length; i++) + if (scene.name == NoMobScenes[i]) { match = true; break; } + if (!match) return; + + var host = new GameObject("~WL_IslandLoadingFix"); + host.hideFlags = HideFlags.HideAndDontSave; + host.AddComponent().StartCoroutine(Run(host)); + } + + static System.Collections.IEnumerator Run(GameObject host) + { + // 원본이 스스로 채울 기회를 먼저 준다(전투 맵과 섞여 로드되는 경우 대비). + for (float t = 0f; t < 5f; t += Time.unscaledDeltaTime) + { + var mgrs = Object.FindObjectsByType(FindObjectsInactive.Include, FindObjectsSortMode.None); + if (mgrs != null && mgrs.Length > 0) { if (host != null) Destroy(host); yield break; } // 원본이 채운다 — 빠진다 + + if (LoadingUI.isIns) + { + LoadingUI.Ins.End_Loading(0); + Debug.Log("[WL-816] 섬에는 MobControlMgrList 가 없어 로딩 칸 0 을 대신 채웠다(90% 멈춤 해소)"); + if (host != null) Destroy(host); + yield break; + } + yield return null; + } + if (host != null) Destroy(host); + } + } +} diff --git a/Assets/WL/Island/WLIslandLoadingFix.cs.meta b/Assets/WL/Island/WLIslandLoadingFix.cs.meta new file mode 100644 index 000000000..50cc134eb --- /dev/null +++ b/Assets/WL/Island/WLIslandLoadingFix.cs.meta @@ -0,0 +1,2 @@ +fileFormatVersion: 2 +guid: 885d9d873a1ec7c4c9a1ab52870ff3f1 \ No newline at end of file