refactor(ui): 애니메이션 관련 위젯 개선
- canvas_battle_composer: 레어리티 색상 매핑 연동 - ascii_animation_card: 코드 정리 - enhanced_animation_panel: 테마 상수 적용
This commit is contained in:
@@ -8,6 +8,7 @@ import 'package:asciineverdie/src/core/animation/monster_size.dart';
|
|||||||
import 'package:asciineverdie/src/core/animation/race_character_frames.dart';
|
import 'package:asciineverdie/src/core/animation/race_character_frames.dart';
|
||||||
import 'package:asciineverdie/src/core/animation/weapon_category.dart';
|
import 'package:asciineverdie/src/core/animation/weapon_category.dart';
|
||||||
import 'package:asciineverdie/src/core/animation/weapon_effects.dart';
|
import 'package:asciineverdie/src/core/animation/weapon_effects.dart';
|
||||||
|
import 'package:asciineverdie/src/core/animation/canvas/rarity_color_mapper.dart';
|
||||||
import 'package:asciineverdie/src/core/model/item_stats.dart';
|
import 'package:asciineverdie/src/core/model/item_stats.dart';
|
||||||
|
|
||||||
/// Canvas용 전투 프레임 합성기
|
/// Canvas용 전투 프레임 합성기
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ class _AsciiAnimationCardState extends State<AsciiAnimationCard> {
|
|||||||
bool _showDeathAnimation = false;
|
bool _showDeathAnimation = false;
|
||||||
List<String>? _deathAnimationMonsterLines;
|
List<String>? _deathAnimationMonsterLines;
|
||||||
String? _lastMonsterBaseName;
|
String? _lastMonsterBaseName;
|
||||||
|
int? _lastMonsterLevel; // 몬스터 레벨 캐시 (사망 시 크기 결정용)
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -237,10 +238,13 @@ class _AsciiAnimationCardState extends State<AsciiAnimationCard> {
|
|||||||
_handleCombatEvent(widget.latestCombatEvent!);
|
_handleCombatEvent(widget.latestCombatEvent!);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 몬스터 이름 저장 (사망 시 프레임 캡처용)
|
// 몬스터 정보 저장 (사망 시 프레임 캡처용)
|
||||||
if (widget.monsterBaseName != null) {
|
if (widget.monsterBaseName != null) {
|
||||||
_lastMonsterBaseName = widget.monsterBaseName;
|
_lastMonsterBaseName = widget.monsterBaseName;
|
||||||
}
|
}
|
||||||
|
if (widget.monsterLevel != null) {
|
||||||
|
_lastMonsterLevel = widget.monsterLevel;
|
||||||
|
}
|
||||||
|
|
||||||
// 새 몬스터 등장 시 사망 애니메이션 상태 리셋
|
// 새 몬스터 등장 시 사망 애니메이션 상태 리셋
|
||||||
// (이전 몬스터 사망 애니메이션이 끝나기 전에 새 전투 시작 시 대응)
|
// (이전 몬스터 사망 애니메이션이 끝나기 전에 새 전투 시작 시 대응)
|
||||||
@@ -613,7 +617,8 @@ class _AsciiAnimationCardState extends State<AsciiAnimationCard> {
|
|||||||
if (monsterName == null) return null;
|
if (monsterName == null) return null;
|
||||||
|
|
||||||
final monsterCategory = getMonsterCategory(monsterName);
|
final monsterCategory = getMonsterCategory(monsterName);
|
||||||
final monsterSize = getMonsterSize(widget.monsterLevel);
|
// 캐시된 레벨 사용 (사망 시점에 widget.monsterLevel이 null일 수 있음)
|
||||||
|
final monsterSize = getMonsterSize(_lastMonsterLevel ?? widget.monsterLevel);
|
||||||
|
|
||||||
// 몬스터 Idle 프레임 가져오기
|
// 몬스터 Idle 프레임 가져오기
|
||||||
final frames = getMonsterIdleFrames(monsterCategory, monsterSize);
|
final frames = getMonsterIdleFrames(monsterCategory, monsterSize);
|
||||||
|
|||||||
@@ -197,6 +197,10 @@ class _EnhancedAnimationPanelState extends State<EnhancedAnimationPanel>
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final combat = widget.progress.currentCombat;
|
final combat = widget.progress.currentCombat;
|
||||||
final isInCombat = combat != null && combat.isActive;
|
final isInCombat = combat != null && combat.isActive;
|
||||||
|
// 몬스터 HP는 전투 중이면서 kill 태스크일 때만 표시
|
||||||
|
// (전투 승리 후 타운 방문 시 HP UI 잔존 버그 방지)
|
||||||
|
final isKillTask = widget.progress.currentTask.type == TaskType.kill;
|
||||||
|
final shouldShowMonsterHp = isInCombat && isKillTask;
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
padding: const EdgeInsets.all(8),
|
padding: const EdgeInsets.all(8),
|
||||||
@@ -258,9 +262,10 @@ class _EnhancedAnimationPanelState extends State<EnhancedAnimationPanel>
|
|||||||
// 우측: 몬스터 HP (전투 중) 또는 컨트롤 버튼
|
// 우측: 몬스터 HP (전투 중) 또는 컨트롤 버튼
|
||||||
Expanded(
|
Expanded(
|
||||||
flex: 2,
|
flex: 2,
|
||||||
child: isInCombat
|
child: switch ((shouldShowMonsterHp, combat)) {
|
||||||
? _buildMonsterHpBar(combat)
|
(true, final c?) => _buildMonsterHpBar(c),
|
||||||
: _buildControlButtons(),
|
_ => _buildControlButtons(),
|
||||||
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user