Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit faabbd5

Browse files
committed
feat: loading manager
1 parent 774ec48 commit faabbd5

File tree

2 files changed

+21
-39
lines changed

2 files changed

+21
-39
lines changed

‎Assets/App/Scenes/StartSence.unity‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -706,11 +706,11 @@ MonoBehaviour:
706706
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
707707
m_Name:
708708
m_EditorClassIdentifier:
709-
m_UiScaleMode: 0
709+
m_UiScaleMode: 1
710710
m_ReferencePixelsPerUnit: 100
711711
m_ScaleFactor: 1
712-
m_ReferenceResolution: {x: 800, y: 600}
713-
m_ScreenMatchMode: 0
712+
m_ReferenceResolution: {x: 1080, y: 2160}
713+
m_ScreenMatchMode: 1
714714
m_MatchWidthOrHeight: 0
715715
m_PhysicalUnit: 3
716716
m_FallbackScreenDPI: 96
Lines changed: 18 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using UnityEngine;
22
using System;
3-
using System.Collections.Generic;
43
using Cysharp.Threading.Tasks;
54
using ProjectVG.Core.Managers;
65
using ProjectVG.Core.Utils;
@@ -13,9 +12,9 @@ namespace ProjectVG.Core.Loading
1312
[System.Serializable]
1413
public struct TaskInfo
1514
{
16-
public string taskName;// 작업 이름 (예: "NETWORK_CONNECTION")
17-
public string taskDescription;// 작업 설명 (예: "네트워크 연결 중...")
18-
public float progress;// 진행률 (0.0 ~ 1.0)
15+
public string taskName;
16+
public string taskDescription;
17+
public float progress;
1918

2019
public TaskInfo(string name, string description, float progressValue)
2120
{
@@ -25,7 +24,6 @@ public TaskInfo(string name, string description, float progressValue)
2524
}
2625
}
2726

28-
2927
/// <summary>
3028
/// 로딩 과정을 전담 관리하는 싱글톤 매니저
3129
/// 실제 초기화는 GameManager가 담당하고, 이 클래스는 UI와 사용자 피드백에 집중
@@ -35,9 +33,8 @@ public class LoadingManager : Singleton<LoadingManager>
3533
[Header("UI Reference")]
3634
[SerializeField] private LoadingUI _loadingUI;
3735

38-
39-
4036
private TaskInfo _currentTask;
37+
private bool _gameStarted;
4138

4239
public event Action<string> OnInitializationFailed;
4340

@@ -51,7 +48,6 @@ private void Awake()
5148
private void OnDestroy()
5249
{
5350
RemoveEventListeners();
54-
Debug.Log("[LoadingManager] LoadingManager 해제");
5551
}
5652

5753
#endregion
@@ -60,8 +56,6 @@ private void OnDestroy()
6056

6157
public void StartInitialization()
6258
{
63-
Debug.Log("[LoadingManager] 로딩 시작");
64-
6559
if (GameManager.Instance != null)
6660
{
6761
GameManager.Instance.InitializeGame();
@@ -73,43 +67,35 @@ public void StartInitialization()
7367
}
7468

7569
/// <summary>
76-
/// 작업 업데이트를 받는 메서드 (이벤트 기반)
70+
/// 외부(InitializationManager)의 진행 이벤트를 큐에 적재
7771
/// </summary>
78-
/// <param name="taskName">작업 이름 (예: "NETWORK_CONNECTION")</param>
79-
/// <param name="description">작업 설명 (예: "네트워크 연결 중...")</param>
80-
/// <param name="progress">진행률 (0.0 ~ 1.0)</param>
8172
public void UpdateTask(string taskName, string description, float progress)
8273
{
8374
_currentTask = new TaskInfo(taskName, description, progress);
84-
85-
// UI 업데이트
8675
if (_loadingUI != null)
8776
{
88-
Debug.Log($"[LoadingManager] 작업 업데이트: {taskName} - {description} ({Mathf.RoundToInt(progress * 100)}%)");
8977
_loadingUI.UpdateTask(_currentTask);
9078
}
79+
80+
if (!_gameStarted && _currentTask.progress >= 1f)
81+
{
82+
StartGame();
83+
}
9184
}
9285

93-
94-
9586
public async void StartGame()
9687
{
97-
Debug.Log("[LoadingManager] 게임 시작");
98-
88+
if (_gameStarted)
89+
return;
90+
_gameStarted = true;
9991
if (_loadingUI != null)
10092
{
10193
await _loadingUI.FadeOut();
10294
}
103-
10495
if (GameManager.Instance != null)
10596
{
106-
Debug.Log("[LoadingManager] GameManager를 통해 MainScene으로 전환");
10797
await GameManager.Instance.TransitionToMainSceneAsync();
10898
}
109-
else
110-
{
111-
Debug.LogError("[LoadingManager] GameManager가 없습니다.");
112-
}
11399
}
114100

115101
#endregion
@@ -122,15 +108,11 @@ private void SetupEventListeners()
122108
{
123109
GameManager.Instance.OnGameInitialized += OnGameInitialized;
124110
GameManager.Instance.OnInitializationError += OnInitializationError;
125-
126-
// InitializationManager의 진행률 이벤트 구독
127111
var initializationManager = GameManager.Instance.GetComponent<InitializationManager>();
128112
if (initializationManager != null)
129113
{
130114
initializationManager.OnProgressUpdated += OnProgressUpdated;
131115
}
132-
133-
Debug.Log("[LoadingManager] GameManager 이벤트 구독 완료");
134116
}
135117
}
136118

@@ -140,8 +122,6 @@ private void RemoveEventListeners()
140122
{
141123
GameManager.Instance.OnGameInitialized -= OnGameInitialized;
142124
GameManager.Instance.OnInitializationError -= OnInitializationError;
143-
144-
// InitializationManager의 진행률 이벤트 구독 해제
145125
var initializationManager = GameManager.Instance.GetComponent<InitializationManager>();
146126
if (initializationManager != null)
147127
{
@@ -152,8 +132,10 @@ private void RemoveEventListeners()
152132

153133
private void OnGameInitialized()
154134
{
155-
Debug.Log("[LoadingManager] 게임 초기화 완료 - 게임 시작");
156-
StartGame();
135+
if (!_gameStarted)
136+
{
137+
StartGame();
138+
}
157139
}
158140

159141
private void OnInitializationError(string error)
@@ -166,7 +148,7 @@ private void OnProgressUpdated(string taskName, string description, float progre
166148
{
167149
UpdateTask(taskName, description, progress);
168150
}
169-
151+
170152
#endregion
171153
}
172154
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /