refactor(ui): 애니메이션 관련 위젯 개선

- canvas_battle_composer: 레어리티 색상 매핑 연동
- ascii_animation_card: 코드 정리
- enhanced_animation_panel: 테마 상수 적용
This commit is contained in:
JiWoong Sul
2026-01-15 01:53:45 +09:00
parent a4bbc6c7cb
commit c33c1ff470
3 changed files with 16 additions and 5 deletions

View File

@@ -175,6 +175,7 @@ class _AsciiAnimationCardState extends State<AsciiAnimationCard> {
bool _showDeathAnimation = false;
List<String>? _deathAnimationMonsterLines;
String? _lastMonsterBaseName;
int? _lastMonsterLevel; // 몬스터 레벨 캐시 (사망 시 크기 결정용)
@override
void initState() {
@@ -237,10 +238,13 @@ class _AsciiAnimationCardState extends State<AsciiAnimationCard> {
_handleCombatEvent(widget.latestCombatEvent!);
}
// 몬스터 이름 저장 (사망 시 프레임 캡처용)
// 몬스터 정보 저장 (사망 시 프레임 캡처용)
if (widget.monsterBaseName != null) {
_lastMonsterBaseName = widget.monsterBaseName;
}
if (widget.monsterLevel != null) {
_lastMonsterLevel = widget.monsterLevel;
}
// 새 몬스터 등장 시 사망 애니메이션 상태 리셋
// (이전 몬스터 사망 애니메이션이 끝나기 전에 새 전투 시작 시 대응)
@@ -613,7 +617,8 @@ class _AsciiAnimationCardState extends State<AsciiAnimationCard> {
if (monsterName == null) return null;
final monsterCategory = getMonsterCategory(monsterName);
final monsterSize = getMonsterSize(widget.monsterLevel);
// 캐시된 레벨 사용 (사망 시점에 widget.monsterLevel이 null일 수 있음)
final monsterSize = getMonsterSize(_lastMonsterLevel ?? widget.monsterLevel);
// 몬스터 Idle 프레임 가져오기
final frames = getMonsterIdleFrames(monsterCategory, monsterSize);

View File

@@ -197,6 +197,10 @@ class _EnhancedAnimationPanelState extends State<EnhancedAnimationPanel>
Widget build(BuildContext context) {
final combat = widget.progress.currentCombat;
final isInCombat = combat != null && combat.isActive;
// 몬스터 HP는 전투 중이면서 kill 태스크일 때만 표시
// (전투 승리 후 타운 방문 시 HP UI 잔존 버그 방지)
final isKillTask = widget.progress.currentTask.type == TaskType.kill;
final shouldShowMonsterHp = isInCombat && isKillTask;
return Container(
padding: const EdgeInsets.all(8),
@@ -258,9 +262,10 @@ class _EnhancedAnimationPanelState extends State<EnhancedAnimationPanel>
// 우측: 몬스터 HP (전투 중) 또는 컨트롤 버튼
Expanded(
flex: 2,
child: isInCombat
? _buildMonsterHpBar(combat)
: _buildControlButtons(),
child: switch ((shouldShowMonsterHp, combat)) {
(true, final c?) => _buildMonsterHpBar(c),
_ => _buildControlButtons(),
},
),
],
),