This commit is contained in:
dldydtn9755-crypto
2026-06-25 18:37:25 +09:00
parent aa2a7ef875
commit 8d11d54875
3 changed files with 26 additions and 26 deletions

View File

@@ -43,12 +43,12 @@ private void OnDestroy()
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
string sceneName = scene.name.Trim();
string loadedSceneName = scene.name.Trim();
if (IsRoomScene(sceneName))
if (IsRoomScene(loadedSceneName))
{
visitedScenes.Add(sceneName);
Debug.Log("현재 방 방문 처리: " + sceneName);
visitedScenes.Add(loadedSceneName);
Debug.Log("방문 처리된 씬: " + loadedSceneName);
}
}
@@ -70,11 +70,11 @@ public void PrepareNextSceneChoices()
string cleanSceneName = sceneName.Trim();
// 자기 자신 방 제외
// 현재 방은 선택지에서 제외
if (cleanSceneName == currentSceneName)
continue;
// 이미 방문한 방 제외
// 이미 방문한 방 제외
if (visitedScenes.Contains(cleanSceneName))
continue;
@@ -88,25 +88,35 @@ public void PrepareNextSceneChoices()
nextSceneName1 = "";
nextSceneName2 = "";
if (candidates.Count >= 1)
// 남은 방이 2개 이상이면 방 2개 선택지 표시
if (candidates.Count >= 2)
{
nextSceneCode1 = candidates[0];
nextSceneName1 = GetDisplayName(nextSceneCode1);
}
if (candidates.Count >= 2)
{
nextSceneCode2 = candidates[1];
nextSceneName2 = GetDisplayName(nextSceneCode2);
}
// 남은 방이 1개면 그 방만 표시
else if (candidates.Count == 1)
{
nextSceneCode1 = candidates[0];
nextSceneName1 = GetDisplayName(nextSceneCode1);
// 남은 방이 하나도 없으면 마지막 씬으로 보냄
if (candidates.Count == 0)
// 중요: 마지막 방이 남아있을 때는 제페토 방을 선택지 2로 넣지 않음
nextSceneCode2 = "";
nextSceneName2 = "";
}
// 남은 방이 0개면 그때만 제페토 방 표시
else
{
if (!string.IsNullOrWhiteSpace(finalSceneName))
{
nextSceneCode1 = finalSceneName.Trim();
nextSceneName1 = GetDisplayName(nextSceneCode1);
nextSceneCode2 = "";
nextSceneName2 = "";
}
else
{
@@ -114,16 +124,6 @@ public void PrepareNextSceneChoices()
}
}
// 남은 방이 하나뿐이면 1번은 남은 방, 2번은 마지막 씬으로 가능
if (candidates.Count == 1)
{
if (!string.IsNullOrWhiteSpace(finalSceneName))
{
nextSceneCode2 = finalSceneName.Trim();
nextSceneName2 = GetDisplayName(nextSceneCode2);
}
}
Debug.Log("현재 씬: " + currentSceneName);
Debug.Log("방문한 씬 수: " + visitedScenes.Count);
Debug.Log("선택지 1: " + nextSceneName1 + " / " + nextSceneCode1);