지부 선택 화면으로 나가는 UI 및 프로그램 종료 UI 개발

This commit is contained in:
정영민
2025-08-08 12:45:52 +09:00
parent 32980e67b2
commit 3715f58100
35 changed files with 3331 additions and 215 deletions

View File

@@ -12,10 +12,10 @@ namespace Samkwang
public Slider Slider_LoadingProgress;
public string nextSceneName;
public void Awake()
public void Init()
{
Image_BranchThumbnail = transform.Find(nameof(Image_BranchThumbnail)).GetComponent<Image>();
Slider_LoadingProgress = transform.Find(nameof(Slider_LoadingProgress)).GetComponent<Slider>();
Image_BranchThumbnail = transform.GetChild(0).GetComponent<Image>();
Slider_LoadingProgress = transform.GetComponentInChildren<Slider>(true);
}
public void LoadBranch(UI_BranchLocation branchLocation)
{
@@ -30,27 +30,31 @@ namespace Samkwang
private IEnumerator WaitAndLoad()
{
yield return null;
StartCoroutine(LoadNextSceneAsync());
yield return StartCoroutine(LoadNextSceneAsync());
}
IEnumerator LoadNextSceneAsync()
{
yield return null;
AsyncOperation asyncOp = SceneManager.LoadSceneAsync(nextSceneName);
asyncOp.allowSceneActivation = false;
float loadProgress = 0f;
while (loadProgress < 1f)
float displayedProgress = 0f;
while (!asyncOp.isDone)
{
loadProgress += Time.deltaTime * 1f;
Slider_LoadingProgress.value = loadProgress;
float targetProgress = Mathf.Clamp01(asyncOp.progress / 0.9f);
displayedProgress = Mathf.MoveTowards(displayedProgress, targetProgress, Time.deltaTime * 1f);
Slider_LoadingProgress.value = displayedProgress;
if (asyncOp.progress >= 0.9f && displayedProgress >= 0.99f)
{
Slider_LoadingProgress.value = 1f;
yield return new WaitForSeconds(0.5f);
asyncOp.allowSceneActivation = true;
}
yield return null;
}
Slider_LoadingProgress.value = 1f;
yield return new WaitForSeconds(0.5f);
asyncOp.allowSceneActivation = true;
}
}
}