fix(buff): 앱 재시작 후 배속 부스트가 복원되지 않는 버그 수정
Some checks failed
CI / analyze-and-test (push) Has been cancelled
Some checks failed
CI / analyze-and-test (push) Has been cancelled
- speed_boost_manager: restoreFromMonetization() 추가 - game_session_controller: loadAndStart에서 배속 상태 복원 호출 - speedBoostEndMs가 세이브에 남아있어도 _isSpeedBoostActive가 false로 리셋되어 배속이 적용 안 되던 문제 해결
This commit is contained in:
@@ -294,6 +294,12 @@ class GameSessionController extends ChangeNotifier {
|
|||||||
// 비모바일 플랫폼 또는 테스트 환경에서는 무시
|
// 비모바일 플랫폼 또는 테스트 환경에서는 무시
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 속도 부스트 상태 복원 (앱 재시작 대응)
|
||||||
|
_speedBoostManager.restoreFromMonetization(
|
||||||
|
monetization: _monetization,
|
||||||
|
loop: null, // startNew에서 loop 생성 후 적용됨
|
||||||
|
);
|
||||||
|
|
||||||
// 복귀 보상 체크 (Phase 7)
|
// 복귀 보상 체크 (Phase 7)
|
||||||
_returnRewardsManager.checkReturnRewards(
|
_returnRewardsManager.checkReturnRewards(
|
||||||
monetization: _monetization,
|
monetization: _monetization,
|
||||||
|
|||||||
@@ -194,6 +194,30 @@ class SpeedBoostManager {
|
|||||||
return monetization.copyWith(speedBoostEndMs: null);
|
return monetization.copyWith(speedBoostEndMs: null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 세이브에서 복원된 MonetizationState 기반으로 배속 상태 복원
|
||||||
|
///
|
||||||
|
/// 앱 재시작 후 로드 시 호출. speedBoostEndMs가 미래면 배속 재활성화.
|
||||||
|
void restoreFromMonetization({
|
||||||
|
required MonetizationState monetization,
|
||||||
|
required ProgressLoop? loop,
|
||||||
|
}) {
|
||||||
|
final endMs = monetization.speedBoostEndMs;
|
||||||
|
if (endMs == null) return;
|
||||||
|
|
||||||
|
final now = DateTime.now().millisecondsSinceEpoch;
|
||||||
|
if (now < endMs) {
|
||||||
|
// 아직 만료되지 않음 → 배속 재활성화
|
||||||
|
_isSpeedBoostActive = true;
|
||||||
|
if (loop != null) {
|
||||||
|
savedSpeedMultiplier = loop.speedMultiplier;
|
||||||
|
loop.updateAvailableSpeeds([speedBoostMultiplier]);
|
||||||
|
}
|
||||||
|
debugPrint(
|
||||||
|
'[SpeedBoost] Restored from save, ${(endMs - now) ~/ 1000}s remaining',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// 부스트 상태에 따른 초기 배속 설정 계산
|
/// 부스트 상태에 따른 초기 배속 설정 계산
|
||||||
///
|
///
|
||||||
/// startNew() 호출 시 사용
|
/// startNew() 호출 시 사용
|
||||||
|
|||||||
Reference in New Issue
Block a user