feat(nav): 프론트 화면에 아레나 버튼 추가

- 아레나 화면 네비게이션 연결
- 프론트 화면 UI에 아레나 접근 버튼 추가
This commit is contained in:
JiWoong Sul
2026-01-06 17:55:12 +09:00
parent 687d04974e
commit 8cd09b9f86
2 changed files with 59 additions and 0 deletions

View File

@@ -12,7 +12,10 @@ import 'package:asciineverdie/src/core/model/pq_config.dart';
import 'package:asciineverdie/src/core/notification/notification_service.dart';
import 'package:asciineverdie/src/core/storage/save_manager.dart';
import 'package:asciineverdie/src/core/storage/save_repository.dart';
import 'package:asciineverdie/src/core/storage/hall_of_fame_storage.dart';
import 'package:asciineverdie/src/core/storage/settings_repository.dart';
import 'package:asciineverdie/src/core/model/hall_of_fame.dart';
import 'package:asciineverdie/src/features/arena/arena_screen.dart';
import 'package:asciineverdie/src/features/front/front_screen.dart';
import 'package:asciineverdie/src/features/front/save_picker_dialog.dart';
import 'package:asciineverdie/src/features/game/game_play_screen.dart';
@@ -46,10 +49,12 @@ class _AskiiNeverDieAppState extends State<AskiiNeverDieApp> {
late final NotificationService _notificationService;
late final SettingsRepository _settingsRepository;
late final AudioService _audioService;
late final HallOfFameStorage _hallOfFameStorage;
bool _isCheckingSave = true;
bool _hasSave = false;
SavedGamePreview? _savedGamePreview;
ThemeMode _themeMode = ThemeMode.system;
HallOfFame _hallOfFame = HallOfFame.empty();
@override
void initState() {
@@ -69,12 +74,25 @@ class _AskiiNeverDieAppState extends State<AskiiNeverDieApp> {
_notificationService = NotificationService();
_settingsRepository = SettingsRepository();
_audioService = AudioService(settingsRepository: _settingsRepository);
_hallOfFameStorage = HallOfFameStorage();
// 초기 설정 및 오디오 서비스 로드
_loadSettings();
_audioService.init();
// 세이브 파일 존재 여부 확인
_checkForExistingSave();
// 명예의 전당 로드
_loadHallOfFame();
}
/// 명예의 전당 로드
Future<void> _loadHallOfFame() async {
final hallOfFame = await _hallOfFameStorage.load();
if (mounted) {
setState(() {
_hallOfFame = hallOfFame;
});
}
}
/// 저장된 설정 불러오기
@@ -443,8 +461,10 @@ class _AskiiNeverDieAppState extends State<AskiiNeverDieApp> {
onNewCharacter: _navigateToNewCharacter,
onLoadSave: _loadSave,
onHallOfFame: _navigateToHallOfFame,
onLocalArena: _navigateToArena,
hasSaveFile: _hasSave,
savedGamePreview: _savedGamePreview,
hallOfFameCount: _hallOfFame.count,
);
}
@@ -542,6 +562,18 @@ class _AskiiNeverDieAppState extends State<AskiiNeverDieApp> {
MaterialPageRoute<void>(builder: (context) => const HallOfFameScreen()),
);
}
/// 로컬 아레나 화면으로 이동
void _navigateToArena(BuildContext context) {
Navigator.of(context).push(
MaterialPageRoute<void>(
builder: (context) => const ArenaScreen(),
),
).then((_) {
// 아레나에서 돌아오면 명예의 전당 다시 로드
_loadHallOfFame();
});
}
}
/// 스플래시 화면 (세이브 파일 확인 중) - 레트로 스타일

View File

@@ -16,8 +16,10 @@ class FrontScreen extends StatelessWidget {
this.onNewCharacter,
this.onLoadSave,
this.onHallOfFame,
this.onLocalArena,
this.hasSaveFile = false,
this.savedGamePreview,
this.hallOfFameCount = 0,
});
/// "New character" 버튼 클릭 시 호출
@@ -29,12 +31,18 @@ class FrontScreen extends StatelessWidget {
/// "Hall of Fame" 버튼 클릭 시 호출
final void Function(BuildContext context)? onHallOfFame;
/// "Local Arena" 버튼 클릭 시 호출
final void Function(BuildContext context)? onLocalArena;
/// 세이브 파일 존재 여부 (새 캐릭터 시 경고용)
final bool hasSaveFile;
/// 저장된 게임 미리보기 정보
final SavedGamePreview? savedGamePreview;
/// 명예의 전당 캐릭터 수 (아레나 활성화 조건: 2명 이상)
final int hallOfFameCount;
/// 새 캐릭터 생성 시 세이브 파일 존재하면 경고 표시
void _handleNewCharacter(BuildContext context) {
if (hasSaveFile) {
@@ -99,7 +107,12 @@ class FrontScreen extends StatelessWidget {
onHallOfFame: onHallOfFame != null
? () => onHallOfFame!(context)
: null,
onLocalArena: onLocalArena != null &&
hallOfFameCount >= 2
? () => onLocalArena!(context)
: null,
savedGamePreview: savedGamePreview,
hallOfFameCount: hallOfFameCount,
),
],
),
@@ -199,13 +212,17 @@ class _ActionButtons extends StatelessWidget {
this.onNewCharacter,
this.onLoadSave,
this.onHallOfFame,
this.onLocalArena,
this.savedGamePreview,
this.hallOfFameCount = 0,
});
final VoidCallback? onNewCharacter;
final VoidCallback? onLoadSave;
final VoidCallback? onHallOfFame;
final VoidCallback? onLocalArena;
final SavedGamePreview? savedGamePreview;
final int hallOfFameCount;
@override
Widget build(BuildContext context) {
@@ -245,6 +262,16 @@ class _ActionButtons extends StatelessWidget {
onPressed: onHallOfFame,
isPrimary: false,
),
// 로컬 아레나 (2명 이상일 때만 활성화)
if (hallOfFameCount >= 2) ...[
const SizedBox(height: 12),
RetroTextButton(
text: game_l10n.uiLocalArena,
icon: Icons.sports_kabaddi,
onPressed: onLocalArena,
isPrimary: false,
),
],
],
),
);