feat(hall-of-fame): 명예의 전당 상세 UI 및 전투 스탯 저장 추가

- CombatStats에 toJson/fromJson 직렬화 메서드 추가
- HallOfFameEntry에 finalStats(CombatStats) 필드 추가
- 명예의 전당 상세 다이얼로그에서 전투 스탯, 장비, 스펠 표시
- GameState에 combatStats 접근자 추가
- game_text_l10n에 명예의 전당 관련 텍스트 추가
This commit is contained in:
JiWoong Sul
2025-12-24 17:20:52 +09:00
parent c1db1fd5d3
commit df5fdbaac2
8 changed files with 296 additions and 35 deletions

View File

@@ -10,6 +10,7 @@ import 'package:askiineverdie/src/core/animation/ascii_animation_type.dart';
import 'package:askiineverdie/src/core/engine/story_service.dart';
import 'package:askiineverdie/src/core/model/combat_event.dart';
import 'package:askiineverdie/src/core/l10n/game_data_l10n.dart';
import 'package:askiineverdie/src/core/model/combat_stats.dart';
import 'package:askiineverdie/src/core/model/game_state.dart';
import 'package:askiineverdie/src/core/model/hall_of_fame.dart';
import 'package:askiineverdie/src/core/model/skill.dart';
@@ -291,11 +292,19 @@ class _GamePlayScreenState extends State<GamePlayScreen>
// 게임 일시 정지
await widget.controller.pause(saveOnStop: true);
// 최종 전투 스탯 계산
final combatStats = CombatStats.fromStats(
stats: state.stats,
equipment: state.equipment,
level: state.traits.level,
);
// 명예의 전당 엔트리 생성
final entry = HallOfFameEntry.fromGameState(
state: state,
totalDeaths: 0, // TODO: 사망 횟수 추적 구현 시 연결
monstersKilled: 0, // TODO: 처치 수 추적 구현 시 연결
totalDeaths: state.progress.deathCount,
monstersKilled: state.progress.monstersKilled,
combatStats: combatStats,
);
// 명예의 전당에 저장

View File

@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:askiineverdie/data/game_text_l10n.dart' as l10n;
import 'package:askiineverdie/src/core/l10n/game_data_l10n.dart';
import 'package:askiineverdie/src/core/model/combat_stats.dart';
import 'package:askiineverdie/src/core/model/hall_of_fame.dart';
import 'package:askiineverdie/src/core/storage/hall_of_fame_storage.dart';
@@ -175,6 +176,29 @@ HallOfFameEntry _createDebugSampleEntry() {
{'name': 'Null Pointer Strike', 'rank': 'IX'},
{'name': 'Thread Lock', 'rank': 'VII'},
],
finalStats: const CombatStats(
str: 85,
con: 72,
dex: 68,
intelligence: 90,
wis: 65,
cha: 55,
atk: 450,
def: 280,
magAtk: 520,
magDef: 195,
criRate: 0.35,
criDamage: 2.2,
evasion: 0.18,
accuracy: 0.95,
blockRate: 0.25,
parryRate: 0.15,
attackDelayMs: 650,
hpMax: 2500,
hpCurrent: 2500,
mpMax: 1800,
mpCurrent: 1800,
),
);
}
@@ -520,28 +544,37 @@ class _HallOfFameDetailDialog extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
// 통계 섹션
// 통계 섹션 (Statistics Section)
_buildSection(
icon: Icons.analytics,
title: 'Statistics',
title: l10n.hofStats,
child: _buildStatsGrid(),
),
const SizedBox(height: 16),
// 장비 섹션
if (entry.finalEquipment != null) ...[
// 전투 스탯 섹션 (Combat Stats Section)
if (entry.finalStats != null) ...[
_buildSection(
icon: Icons.shield,
title: 'Equipment',
child: _buildEquipmentList(),
icon: Icons.sports_mma,
title: l10n.hofCombatStats,
child: _buildCombatStatsGrid(),
),
const SizedBox(height: 16),
],
// 스펠 섹션
// 장비 섹션 (Equipment Section)
if (entry.finalEquipment != null) ...[
_buildSection(
icon: Icons.shield,
title: l10n.navEquipment,
child: _buildEquipmentList(context),
),
const SizedBox(height: 16),
],
// 스펠 섹션 (Spells Section)
if (entry.finalSpells != null && entry.finalSpells!.isNotEmpty)
_buildSection(
icon: Icons.auto_fix_high,
title: 'Spells',
child: _buildSpellList(),
title: l10n.hofSpells,
child: _buildSpellList(context),
),
],
),
@@ -550,7 +583,7 @@ class _HallOfFameDetailDialog extends StatelessWidget {
actions: [
TextButton(
onPressed: () => Navigator.of(context).pop(),
child: const Text('Close'),
child: Text(l10n.buttonClose),
),
],
);
@@ -592,7 +625,7 @@ class _HallOfFameDetailDialog extends StatelessWidget {
_buildStatItem(Icons.timer, l10n.hofTime, entry.formattedPlayTime),
_buildStatItem(
Icons.pest_control,
'Monsters',
l10n.hofMonsters,
'${entry.monstersKilled}',
),
_buildStatItem(
@@ -607,13 +640,109 @@ class _HallOfFameDetailDialog extends StatelessWidget {
),
_buildStatItem(
Icons.calendar_today,
'Cleared',
l10n.hofCleared,
entry.formattedClearedDate,
),
],
);
}
Widget _buildCombatStatsGrid() {
final stats = entry.finalStats!;
return Column(
children: [
// 기본 스탯 행 (Basic Stats Row)
Wrap(
spacing: 8,
runSpacing: 4,
children: [
_buildCombatStatChip(l10n.statStr, '${stats.str}', Colors.red),
_buildCombatStatChip(l10n.statCon, '${stats.con}', Colors.orange),
_buildCombatStatChip(l10n.statDex, '${stats.dex}', Colors.green),
_buildCombatStatChip(l10n.statInt, '${stats.intelligence}', Colors.blue),
_buildCombatStatChip(l10n.statWis, '${stats.wis}', Colors.purple),
_buildCombatStatChip(l10n.statCha, '${stats.cha}', Colors.pink),
],
),
const SizedBox(height: 8),
const Divider(height: 1),
const SizedBox(height: 8),
// 공격 스탯 행 (Attack Stats Row)
Wrap(
spacing: 8,
runSpacing: 4,
children: [
_buildCombatStatChip(l10n.statAtk, '${stats.atk}', Colors.red.shade700),
_buildCombatStatChip(l10n.statMAtk, '${stats.magAtk}', Colors.blue.shade700),
_buildCombatStatChip(
l10n.statCri,
'${(stats.criRate * 100).toStringAsFixed(1)}%',
Colors.amber.shade700,
),
],
),
const SizedBox(height: 8),
// 방어 스탯 행 (Defense Stats Row)
Wrap(
spacing: 8,
runSpacing: 4,
children: [
_buildCombatStatChip(l10n.statDef, '${stats.def}', Colors.brown),
_buildCombatStatChip(l10n.statMDef, '${stats.magDef}', Colors.indigo),
_buildCombatStatChip(
l10n.statEva,
'${(stats.evasion * 100).toStringAsFixed(1)}%',
Colors.teal,
),
_buildCombatStatChip(
l10n.statBlock,
'${(stats.blockRate * 100).toStringAsFixed(1)}%',
Colors.blueGrey,
),
],
),
const SizedBox(height: 8),
// HP/MP 행 (Resource Stats Row)
Wrap(
spacing: 8,
runSpacing: 4,
children: [
_buildCombatStatChip(l10n.statHp, '${stats.hpMax}', Colors.red.shade400),
_buildCombatStatChip(l10n.statMp, '${stats.mpMax}', Colors.blue.shade400),
],
),
],
);
}
Widget _buildCombatStatChip(String label, String value, Color color) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 4),
decoration: BoxDecoration(
color: color.withValues(alpha: 0.1),
borderRadius: BorderRadius.circular(6),
border: Border.all(color: color.withValues(alpha: 0.3)),
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Text(
'$label ',
style: TextStyle(fontSize: 11, color: color),
),
Text(
value,
style: TextStyle(
fontSize: 11,
fontWeight: FontWeight.bold,
color: color,
),
),
],
),
);
}
Widget _buildStatItem(IconData icon, String label, String value) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
@@ -647,26 +776,31 @@ class _HallOfFameDetailDialog extends StatelessWidget {
);
}
Widget _buildEquipmentList() {
Widget _buildEquipmentList(BuildContext context) {
final equipment = entry.finalEquipment!;
// 슬롯 키, 아이콘, l10n 슬롯 이름
final slots = [
('weapon', Icons.gavel, 'Weapon'),
('shield', Icons.shield, 'Shield'),
('helm', Icons.sports_mma, 'Helm'),
('hauberk', Icons.checkroom, 'Hauberk'),
('brassairts', Icons.front_hand, 'Brassairts'),
('vambraces', Icons.back_hand, 'Vambraces'),
('gauntlets', Icons.sports_handball, 'Gauntlets'),
('gambeson', Icons.dry_cleaning, 'Gambeson'),
('cuisses', Icons.airline_seat_legroom_normal, 'Cuisses'),
('greaves', Icons.snowshoeing, 'Greaves'),
('sollerets', Icons.do_not_step, 'Sollerets'),
('weapon', Icons.gavel, l10n.slotWeapon, 0),
('shield', Icons.shield, l10n.slotShield, 1),
('helm', Icons.sports_mma, l10n.slotHelm, 2),
('hauberk', Icons.checkroom, l10n.slotHauberk, 2),
('brassairts', Icons.front_hand, l10n.slotBrassairts, 2),
('vambraces', Icons.back_hand, l10n.slotVambraces, 2),
('gauntlets', Icons.sports_handball, l10n.slotGauntlets, 2),
('gambeson', Icons.dry_cleaning, l10n.slotGambeson, 2),
('cuisses', Icons.airline_seat_legroom_normal, l10n.slotCuisses, 2),
('greaves', Icons.snowshoeing, l10n.slotGreaves, 2),
('sollerets', Icons.do_not_step, l10n.slotSollerets, 2),
];
return Column(
children: slots.map((slot) {
final (key, icon, label) = slot;
final value = equipment[key] ?? '-';
final (key, icon, label, slotIndex) = slot;
final rawValue = equipment[key] ?? '';
// 장비 이름 번역 적용
final value = rawValue.isEmpty
? l10n.uiEmpty
: GameDataL10n.translateEquipString(context, rawValue, slotIndex);
return Padding(
padding: const EdgeInsets.symmetric(vertical: 2),
child: Row(
@@ -694,7 +828,7 @@ class _HallOfFameDetailDialog extends StatelessWidget {
);
}
Widget _buildSpellList() {
Widget _buildSpellList(BuildContext context) {
final spells = entry.finalSpells!;
return Wrap(
spacing: 8,
@@ -702,6 +836,8 @@ class _HallOfFameDetailDialog extends StatelessWidget {
children: spells.map((spell) {
final name = spell['name'] ?? '';
final rank = spell['rank'] ?? '';
// 스펠 이름 번역 적용
final translatedName = GameDataL10n.getSpellName(context, name);
return Container(
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 4),
decoration: BoxDecoration(
@@ -710,7 +846,7 @@ class _HallOfFameDetailDialog extends StatelessWidget {
border: Border.all(color: Colors.purple.shade200),
),
child: Text(
'$name $rank',
'$translatedName $rank',
style: TextStyle(fontSize: 12, color: Colors.purple.shade700),
),
);