refactor(core): 진행 루프, 저장 데이터, 저장 관리자 개선

- ProgressLoop 로직 정리
- SaveData 모델 확장
- SaveManager 개선
This commit is contained in:
JiWoong Sul
2026-01-08 16:05:08 +09:00
parent 56b568a832
commit 606d052e2c
3 changed files with 18 additions and 9 deletions

View File

@@ -13,19 +13,23 @@ class SaveManager {
/// Save current game state to disk. [fileName] may be absolute or relative.
/// Returns outcome with error on failure.
Future<SaveOutcome> saveState(GameState state, {String? fileName}) {
final save = GameSave.fromState(state);
Future<SaveOutcome> saveState(
GameState state, {
String? fileName,
bool cheatsEnabled = false,
}) {
final save = GameSave.fromState(state, cheatsEnabled: cheatsEnabled);
return _repo.save(save, fileName ?? defaultFileName);
}
/// Load game state from disk. [fileName] may be absolute (e.g., file picker).
/// Returns outcome + optional state.
Future<(SaveOutcome, GameState?)> loadState({String? fileName}) async {
/// Returns outcome + optional state + cheatsEnabled flag.
Future<(SaveOutcome, GameState?, bool)> loadState({String? fileName}) async {
final (outcome, save) = await _repo.load(fileName ?? defaultFileName);
if (!outcome.success || save == null) {
return (outcome, null);
return (outcome, null, false);
}
return (outcome, save.toState());
return (outcome, save.toState(), save.cheatsEnabled);
}
/// 저장 파일 목록 조회