refactor(game): 앱 및 게임 세션 개선

- App 초기화 로직 정리
- GamePlayScreen 개선
- GameSessionController 확장
This commit is contained in:
JiWoong Sul
2026-01-08 16:05:14 +09:00
parent 606d052e2c
commit cfc1537af2
3 changed files with 26 additions and 16 deletions

View File

@@ -225,13 +225,13 @@ class GameSessionController extends ChangeNotifier {
Future<void> loadAndStart({
String? fileName,
bool cheatsEnabled = false,
}) async {
_status = GameSessionStatus.loading;
_error = null;
notifyListeners();
final (outcome, loaded) = await saveManager.loadState(fileName: fileName);
final (outcome, loaded, savedCheatsEnabled) =
await saveManager.loadState(fileName: fileName);
if (!outcome.success || loaded == null) {
_status = GameSessionStatus.error;
_error = outcome.error ?? 'Unknown error';
@@ -239,7 +239,8 @@ class GameSessionController extends ChangeNotifier {
return;
}
await startNew(loaded, cheatsEnabled: cheatsEnabled, isNewGame: false);
// 저장된 치트 모드 상태 복원
await startNew(loaded, cheatsEnabled: savedCheatsEnabled, isNewGame: false);
}
Future<void> pause({bool saveOnStop = false}) async {
@@ -382,8 +383,11 @@ class GameSessionController extends ChangeNotifier {
_state = resurrectedState;
_status = GameSessionStatus.idle; // 사망 상태 해제
// 저장
await saveManager.saveState(resurrectedState);
// 저장 (치트 모드 상태 유지)
await saveManager.saveState(
resurrectedState,
cheatsEnabled: _cheatsEnabled,
);
notifyListeners();
}