feat(ui): 사망 화면 잃은 아이템 희귀도 색상 표시

- DeathInfo에 lostItemRarity 필드 추가
- 사망 처리 시 아이템 희귀도 저장
- 사망 오버레이에서 희귀도별 색상 적용
  - Common: 회색, Uncommon: 녹색, Rare: 파랑
  - Epic: 보라, Legendary: 주황
This commit is contained in:
JiWoong Sul
2026-01-16 00:13:24 +09:00
parent a2b5bb7dc0
commit 93f29f6c33
3 changed files with 40 additions and 8 deletions

View File

@@ -5,6 +5,7 @@ import 'package:asciineverdie/src/core/l10n/game_data_l10n.dart';
import 'package:asciineverdie/src/core/model/combat_event.dart';
import 'package:asciineverdie/src/core/model/equipment_slot.dart';
import 'package:asciineverdie/src/core/model/game_state.dart';
import 'package:asciineverdie/src/core/model/item_stats.dart';
import 'package:asciineverdie/src/shared/retro_colors.dart';
/// 사망 오버레이 위젯 (Phase 4)
@@ -294,10 +295,8 @@ class DeathOverlay extends StatelessWidget {
final expColor = RetroColors.expOf(context);
final gold = RetroColors.goldOf(context);
// 슬롯명 + 아이템명 조합
final lostItemDisplay = hasLostItem
? '[${_getSlotName(deathInfo.lostItemSlot)}] ${deathInfo.lostItemName}'
: null;
// 희귀도에 따른 아이템 이름 색상
final itemRarityColor = _getRarityColor(deathInfo.lostItemRarity);
return Column(
children: [
@@ -326,12 +325,23 @@ class DeathOverlay extends StatelessWidget {
),
),
const SizedBox(height: 4),
Text(
lostItemDisplay!,
style: TextStyle(
// 슬롯명 (회색) + 아이템명 (희귀도 색상)
Text.rich(
TextSpan(
children: [
TextSpan(
text: '[${_getSlotName(deathInfo.lostItemSlot)}] ',
style: TextStyle(color: muted),
),
TextSpan(
text: deathInfo.lostItemName!,
style: TextStyle(color: itemRarityColor),
),
],
),
style: const TextStyle(
fontFamily: 'PressStart2P',
fontSize: 13,
color: hpColor,
),
),
],
@@ -695,4 +705,16 @@ class DeathOverlay extends StatelessWidget {
EquipmentSlot.sollerets => l10n.slotSollerets,
};
}
/// 희귀도에 따른 색상 반환
Color _getRarityColor(ItemRarity? rarity) {
if (rarity == null) return Colors.grey;
return switch (rarity) {
ItemRarity.common => Colors.grey,
ItemRarity.uncommon => Colors.green,
ItemRarity.rare => Colors.blue,
ItemRarity.epic => Colors.purple,
ItemRarity.legendary => Colors.orange,
};
}
}