refactor(ui): 물약 글로벌 쿨타임 적용 UI 정리
- usedPotionTypes/usedInBattle 파라미터 제거 - 전투당 타입별 제한 → 시간 기반 쿨타임 전환 - PotionInventoryPanel 불투명도 로직 제거
This commit is contained in:
@@ -7,6 +7,7 @@ import 'package:asciineverdie/src/core/model/combat_state.dart';
|
|||||||
import 'package:asciineverdie/src/core/model/combat_stats.dart';
|
import 'package:asciineverdie/src/core/model/combat_stats.dart';
|
||||||
import 'package:asciineverdie/src/core/model/game_state.dart';
|
import 'package:asciineverdie/src/core/model/game_state.dart';
|
||||||
import 'package:asciineverdie/src/core/model/monster_combat_stats.dart';
|
import 'package:asciineverdie/src/core/model/monster_combat_stats.dart';
|
||||||
|
import 'package:asciineverdie/src/core/model/potion.dart';
|
||||||
import 'package:asciineverdie/src/core/model/skill.dart';
|
import 'package:asciineverdie/src/core/model/skill.dart';
|
||||||
import 'package:asciineverdie/src/core/util/deterministic_random.dart';
|
import 'package:asciineverdie/src/core/util/deterministic_random.dart';
|
||||||
|
|
||||||
|
|||||||
@@ -935,8 +935,6 @@ class _GamePlayScreenState extends State<GamePlayScreen>
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: PotionInventoryPanel(
|
child: PotionInventoryPanel(
|
||||||
inventory: state.potionInventory,
|
inventory: state.potionInventory,
|
||||||
usedInBattle:
|
|
||||||
state.progress.currentCombat?.usedPotionTypes ?? const {},
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|||||||
@@ -754,9 +754,6 @@ class _MobileCarouselLayoutState extends State<MobileCarouselLayout> {
|
|||||||
inventory: state.inventory,
|
inventory: state.inventory,
|
||||||
potionInventory: state.potionInventory,
|
potionInventory: state.potionInventory,
|
||||||
encumbrance: state.progress.encumbrance,
|
encumbrance: state.progress.encumbrance,
|
||||||
usedPotionTypes:
|
|
||||||
state.progress.currentCombat?.usedPotionTypes ??
|
|
||||||
const {},
|
|
||||||
),
|
),
|
||||||
|
|
||||||
// 2: 장비
|
// 2: 장비
|
||||||
|
|||||||
@@ -16,13 +16,11 @@ class InventoryPage extends StatelessWidget {
|
|||||||
required this.inventory,
|
required this.inventory,
|
||||||
required this.potionInventory,
|
required this.potionInventory,
|
||||||
required this.encumbrance,
|
required this.encumbrance,
|
||||||
this.usedPotionTypes = const {},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
final Inventory inventory;
|
final Inventory inventory;
|
||||||
final PotionInventory potionInventory;
|
final PotionInventory potionInventory;
|
||||||
final ProgressBarState encumbrance;
|
final ProgressBarState encumbrance;
|
||||||
final Set<PotionType> usedPotionTypes;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -41,7 +39,6 @@ class InventoryPage extends StatelessWidget {
|
|||||||
flex: 2,
|
flex: 2,
|
||||||
child: PotionInventoryPanel(
|
child: PotionInventoryPanel(
|
||||||
inventory: potionInventory,
|
inventory: potionInventory,
|
||||||
usedInBattle: usedPotionTypes,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|||||||
@@ -12,11 +12,9 @@ class PotionInventoryPanel extends StatelessWidget {
|
|||||||
const PotionInventoryPanel({
|
const PotionInventoryPanel({
|
||||||
super.key,
|
super.key,
|
||||||
required this.inventory,
|
required this.inventory,
|
||||||
this.usedInBattle = const {},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
final PotionInventory inventory;
|
final PotionInventory inventory;
|
||||||
final Set<PotionType> usedInBattle;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@@ -43,7 +41,6 @@ class PotionInventoryPanel extends StatelessWidget {
|
|||||||
return _PotionRow(
|
return _PotionRow(
|
||||||
potion: entry.potion,
|
potion: entry.potion,
|
||||||
quantity: entry.quantity,
|
quantity: entry.quantity,
|
||||||
isUsedThisBattle: usedInBattle.contains(entry.potion.type),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -88,69 +85,57 @@ class _PotionRow extends StatelessWidget {
|
|||||||
const _PotionRow({
|
const _PotionRow({
|
||||||
required this.potion,
|
required this.potion,
|
||||||
required this.quantity,
|
required this.quantity,
|
||||||
this.isUsedThisBattle = false,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
final Potion potion;
|
final Potion potion;
|
||||||
final int quantity;
|
final int quantity;
|
||||||
final bool isUsedThisBattle;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final color = _getPotionColor();
|
final color = _getPotionColor();
|
||||||
final opacity = isUsedThisBattle ? 0.5 : 1.0;
|
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 2),
|
padding: const EdgeInsets.symmetric(vertical: 2),
|
||||||
child: Opacity(
|
child: Row(
|
||||||
opacity: opacity,
|
children: [
|
||||||
child: Row(
|
// 물약 아이콘
|
||||||
children: [
|
_PotionIcon(type: potion.type, tier: potion.tier),
|
||||||
// 물약 아이콘
|
const SizedBox(width: 4),
|
||||||
_PotionIcon(type: potion.type, tier: potion.tier),
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
|
|
||||||
// 물약 이름 (번역 적용)
|
// 물약 이름 (번역 적용)
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Text(
|
child: Text(
|
||||||
l10n.translateSpell(potion.name),
|
l10n.translateSpell(potion.name),
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: color,
|
color: color,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.w500,
|
||||||
),
|
),
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
|
// 회복량 표시
|
||||||
|
_HealBadge(potion: potion),
|
||||||
|
const SizedBox(width: 4),
|
||||||
|
|
||||||
|
// 수량
|
||||||
|
Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: color.withValues(alpha: 0.2),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
'x$quantity',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: color,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
// 회복량 표시
|
],
|
||||||
_HealBadge(potion: potion),
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
|
|
||||||
// 수량
|
|
||||||
Container(
|
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 2),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
color: color.withValues(alpha: 0.2),
|
|
||||||
borderRadius: BorderRadius.circular(8),
|
|
||||||
),
|
|
||||||
child: Text(
|
|
||||||
'x$quantity',
|
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 15,
|
|
||||||
fontWeight: FontWeight.bold,
|
|
||||||
color: color,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
// 전투 중 사용 불가 표시
|
|
||||||
if (isUsedThisBattle) ...[
|
|
||||||
const SizedBox(width: 4),
|
|
||||||
const Icon(Icons.block, size: 12, color: Colors.grey),
|
|
||||||
],
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user