feat(game): 게임 세션 및 사망 오버레이 개선
- GameSessionController 기능 확장 - DeathOverlay 상세 사망 정보 표시 - GamePlayScreen 연동 업데이트
This commit is contained in:
@@ -47,6 +47,9 @@ class GameSessionController extends ChangeNotifier {
|
||||
GameState? _state;
|
||||
String? _error;
|
||||
|
||||
// 자동 부활 (Auto-Resurrection) 상태
|
||||
bool _autoResurrect = false;
|
||||
|
||||
// 통계 관련 필드
|
||||
SessionStatistics _sessionStats = SessionStatistics.empty();
|
||||
CumulativeStatistics _cumulativeStats = CumulativeStatistics.empty();
|
||||
@@ -61,6 +64,15 @@ class GameSessionController extends ChangeNotifier {
|
||||
bool get isRunning => _status == GameSessionStatus.running;
|
||||
bool get cheatsEnabled => _cheatsEnabled;
|
||||
|
||||
/// 자동 부활 활성화 여부
|
||||
bool get autoResurrect => _autoResurrect;
|
||||
|
||||
/// 자동 부활 설정
|
||||
void setAutoResurrect(bool value) {
|
||||
_autoResurrect = value;
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// 현재 세션 통계
|
||||
SessionStatistics get sessionStats => _sessionStats;
|
||||
|
||||
@@ -75,6 +87,9 @@ class GameSessionController extends ChangeNotifier {
|
||||
bool cheatsEnabled = false,
|
||||
bool isNewGame = true,
|
||||
}) async {
|
||||
// 기존 배속 보존 (부활/재개 시 유지)
|
||||
final previousSpeed = _loop?.speedMultiplier ?? 1;
|
||||
|
||||
await _stopLoop(saveOnStop: false);
|
||||
|
||||
// 새 게임인 경우 초기화 (프롤로그 태스크 설정)
|
||||
@@ -97,6 +112,9 @@ class GameSessionController extends ChangeNotifier {
|
||||
// 명예의 전당 체크 → 가용 배속 결정
|
||||
final availableSpeeds = await _getAvailableSpeeds();
|
||||
|
||||
// 새 게임이면 1배속, 재개/부활이면 기존 배속 유지
|
||||
final initialSpeed = isNewGame ? 1 : previousSpeed;
|
||||
|
||||
_loop = ProgressLoop(
|
||||
initialState: state,
|
||||
progressService: progressService,
|
||||
@@ -108,6 +126,7 @@ class GameSessionController extends ChangeNotifier {
|
||||
onPlayerDied: _onPlayerDied,
|
||||
onGameComplete: _onGameComplete,
|
||||
availableSpeeds: availableSpeeds,
|
||||
initialSpeedMultiplier: initialSpeed,
|
||||
);
|
||||
|
||||
_subscription = _loop!.stream.listen((next) {
|
||||
@@ -273,6 +292,24 @@ class GameSessionController extends ChangeNotifier {
|
||||
_sessionStats = _sessionStats.recordDeath();
|
||||
_status = GameSessionStatus.dead;
|
||||
notifyListeners();
|
||||
|
||||
// 자동 부활이 활성화된 경우 잠시 후 자동으로 부활
|
||||
if (_autoResurrect) {
|
||||
_scheduleAutoResurrect();
|
||||
}
|
||||
}
|
||||
|
||||
/// 자동 부활 예약 (Auto-Resurrection Scheduler)
|
||||
///
|
||||
/// 사망 오버레이를 잠시 표시한 후 자동으로 부활 처리
|
||||
void _scheduleAutoResurrect() {
|
||||
Future.delayed(const Duration(milliseconds: 800), () async {
|
||||
// 상태가 여전히 dead이고, 자동 부활이 활성화된 경우에만 부활
|
||||
if (_status == GameSessionStatus.dead && _autoResurrect) {
|
||||
await resurrect();
|
||||
await resumeAfterResurrection();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/// 게임 클리어 콜백 (ProgressLoop에서 호출, Act V 완료 시)
|
||||
|
||||
Reference in New Issue
Block a user