Compare commits
4 Commits
c3a8bc305a
...
d63463a677
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d63463a677 | ||
|
|
307007e164 | ||
|
|
6667de56d3 | ||
|
|
699ae3b7f3 |
@@ -1322,10 +1322,16 @@ String get hofCleared {
|
|||||||
return 'Cleared';
|
return 'Cleared';
|
||||||
}
|
}
|
||||||
|
|
||||||
String get hofSpells {
|
String get hofSkills {
|
||||||
if (isKoreanLocale) return '스펠';
|
if (isKoreanLocale) return '스킬';
|
||||||
if (isJapaneseLocale) return 'スペル';
|
if (isJapaneseLocale) return 'スキル';
|
||||||
return 'Spells';
|
return 'Skills';
|
||||||
|
}
|
||||||
|
|
||||||
|
String get hofNoSkills {
|
||||||
|
if (isKoreanLocale) return '스킬 없음';
|
||||||
|
if (isJapaneseLocale) return 'スキルなし';
|
||||||
|
return 'No Skills';
|
||||||
}
|
}
|
||||||
|
|
||||||
String get hofCombatStats {
|
String get hofCombatStats {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import 'package:asciineverdie/data/skill_data.dart';
|
import 'package:asciineverdie/data/skill_data.dart';
|
||||||
import 'package:asciineverdie/src/core/engine/combat_calculator.dart';
|
import 'package:asciineverdie/src/core/engine/combat_calculator.dart';
|
||||||
|
import 'package:asciineverdie/src/core/engine/item_service.dart';
|
||||||
import 'package:asciineverdie/src/core/engine/skill_service.dart';
|
import 'package:asciineverdie/src/core/engine/skill_service.dart';
|
||||||
import 'package:asciineverdie/src/core/model/arena_match.dart';
|
import 'package:asciineverdie/src/core/model/arena_match.dart';
|
||||||
import 'package:asciineverdie/src/core/model/equipment_item.dart';
|
import 'package:asciineverdie/src/core/model/equipment_item.dart';
|
||||||
@@ -668,18 +669,58 @@ class ArenaService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// 장비 교환
|
// AI 베팅 슬롯 선택
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
/// 장비 교환 (같은 슬롯끼리)
|
/// AI가 도전자에게서 약탈할 슬롯 자동 선택
|
||||||
///
|
///
|
||||||
/// 승자가 선택한 슬롯의 장비를 서로 교환
|
/// 도전자의 가장 좋은 장비 슬롯 선택 (무기 제외)
|
||||||
|
EquipmentSlot selectOpponentBettingSlot(HallOfFameEntry challenger) {
|
||||||
|
final equipment = challenger.finalEquipment ?? [];
|
||||||
|
if (equipment.isEmpty) {
|
||||||
|
// 장비가 없으면 기본 슬롯 (투구)
|
||||||
|
return EquipmentSlot.helm;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 무기를 제외한 장비 중 가장 높은 점수의 슬롯 선택
|
||||||
|
EquipmentSlot? bestSlot;
|
||||||
|
int bestScore = -1;
|
||||||
|
|
||||||
|
for (final item in equipment) {
|
||||||
|
// 무기는 약탈 불가
|
||||||
|
if (item.slot == EquipmentSlot.weapon) continue;
|
||||||
|
if (item.isEmpty) continue;
|
||||||
|
|
||||||
|
final score = ItemService.calculateEquipmentScore(item);
|
||||||
|
if (score > bestScore) {
|
||||||
|
bestScore = score;
|
||||||
|
bestSlot = item.slot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 유효한 슬롯이 없으면 투구 선택
|
||||||
|
return bestSlot ?? EquipmentSlot.helm;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 베팅 가능한 슬롯 목록 반환 (무기 제외)
|
||||||
|
List<EquipmentSlot> getBettableSlots() {
|
||||||
|
return EquipmentSlot.values
|
||||||
|
.where((slot) => slot != EquipmentSlot.weapon)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// 장비 약탈
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/// 장비 약탈 (승자가 패자의 베팅 슬롯 장비 획득)
|
||||||
|
///
|
||||||
|
/// - 승자: 자신이 선택한 슬롯의 패자 장비 획득
|
||||||
|
/// - 패자: 해당 슬롯 장비 손실 → 기본 장비로 대체
|
||||||
(HallOfFameEntry, HallOfFameEntry) _exchangeEquipment({
|
(HallOfFameEntry, HallOfFameEntry) _exchangeEquipment({
|
||||||
required ArenaMatch match,
|
required ArenaMatch match,
|
||||||
required bool isVictory,
|
required bool isVictory,
|
||||||
}) {
|
}) {
|
||||||
final slot = match.bettingSlot;
|
|
||||||
|
|
||||||
// 도전자 장비 목록 복사
|
// 도전자 장비 목록 복사
|
||||||
final challengerEquipment =
|
final challengerEquipment =
|
||||||
List<EquipmentItem>.from(match.challenger.finalEquipment ?? []);
|
List<EquipmentItem>.from(match.challenger.finalEquipment ?? []);
|
||||||
@@ -688,13 +729,29 @@ class ArenaService {
|
|||||||
final opponentEquipment =
|
final opponentEquipment =
|
||||||
List<EquipmentItem>.from(match.opponent.finalEquipment ?? []);
|
List<EquipmentItem>.from(match.opponent.finalEquipment ?? []);
|
||||||
|
|
||||||
// 해당 슬롯의 장비 찾기
|
if (isVictory) {
|
||||||
final challengerItem = _findItemBySlot(challengerEquipment, slot);
|
// 도전자 승리: 도전자가 선택한 슬롯의 상대 장비 획득
|
||||||
final opponentItem = _findItemBySlot(opponentEquipment, slot);
|
final winnerSlot = match.challengerBettingSlot;
|
||||||
|
final lootedItem = _findItemBySlot(opponentEquipment, winnerSlot);
|
||||||
|
|
||||||
// 장비 교환
|
// 도전자: 약탈한 장비로 교체
|
||||||
_replaceItemInList(challengerEquipment, slot, opponentItem);
|
_replaceItemInList(challengerEquipment, winnerSlot, lootedItem);
|
||||||
_replaceItemInList(opponentEquipment, slot, challengerItem);
|
|
||||||
|
// 상대: 해당 슬롯 기본 장비로 대체
|
||||||
|
final defaultItem = _createDefaultEquipment(winnerSlot);
|
||||||
|
_replaceItemInList(opponentEquipment, winnerSlot, defaultItem);
|
||||||
|
} else {
|
||||||
|
// 상대 승리: 상대가 선택한 슬롯의 도전자 장비 획득
|
||||||
|
final winnerSlot = match.opponentBettingSlot;
|
||||||
|
final lootedItem = _findItemBySlot(challengerEquipment, winnerSlot);
|
||||||
|
|
||||||
|
// 상대: 약탈한 장비로 교체
|
||||||
|
_replaceItemInList(opponentEquipment, winnerSlot, lootedItem);
|
||||||
|
|
||||||
|
// 도전자: 해당 슬롯 기본 장비로 대체
|
||||||
|
final defaultItem = _createDefaultEquipment(winnerSlot);
|
||||||
|
_replaceItemInList(challengerEquipment, winnerSlot, defaultItem);
|
||||||
|
}
|
||||||
|
|
||||||
// 업데이트된 엔트리 생성
|
// 업데이트된 엔트리 생성
|
||||||
final updatedChallenger = match.challenger.copyWith(
|
final updatedChallenger = match.challenger.copyWith(
|
||||||
@@ -731,4 +788,11 @@ class ArenaService {
|
|||||||
// 슬롯이 없으면 추가
|
// 슬롯이 없으면 추가
|
||||||
equipment.add(newItem);
|
equipment.add(newItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 기본 장비 생성 (Common 등급)
|
||||||
|
///
|
||||||
|
/// 패자가 장비를 잃었을 때 빈 슬롯 방지용
|
||||||
|
EquipmentItem _createDefaultEquipment(EquipmentSlot slot) {
|
||||||
|
return ItemService.createDefaultEquipmentForSlot(slot);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -279,6 +279,51 @@ class ItemService {
|
|||||||
return score;
|
return score;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// 기본 장비 생성
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
/// 슬롯별 기본 장비 생성 (Common 등급, 레벨 1)
|
||||||
|
///
|
||||||
|
/// 아레나에서 패배하여 장비를 잃었을 때 빈 슬롯 방지용
|
||||||
|
static EquipmentItem createDefaultEquipmentForSlot(EquipmentSlot slot) {
|
||||||
|
final name = _getDefaultItemName(slot);
|
||||||
|
const rarity = ItemRarity.common;
|
||||||
|
|
||||||
|
// 기본 스탯 (레벨 1 기준)
|
||||||
|
final stats = switch (slot) {
|
||||||
|
EquipmentSlot.weapon => const ItemStats(atk: 2, attackSpeed: 1000),
|
||||||
|
EquipmentSlot.shield => const ItemStats(def: 1, blockRate: 0.05),
|
||||||
|
_ => const ItemStats(def: 1),
|
||||||
|
};
|
||||||
|
|
||||||
|
return EquipmentItem(
|
||||||
|
name: name,
|
||||||
|
slot: slot,
|
||||||
|
level: 1,
|
||||||
|
weight: 1,
|
||||||
|
stats: stats,
|
||||||
|
rarity: rarity,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 슬롯별 기본 장비 이름
|
||||||
|
static String _getDefaultItemName(EquipmentSlot slot) {
|
||||||
|
return switch (slot) {
|
||||||
|
EquipmentSlot.weapon => 'Wooden Stick',
|
||||||
|
EquipmentSlot.shield => 'Wooden Shield',
|
||||||
|
EquipmentSlot.helm => 'Cloth Cap',
|
||||||
|
EquipmentSlot.hauberk => 'Torn Shirt',
|
||||||
|
EquipmentSlot.brassairts => 'Cloth Wraps',
|
||||||
|
EquipmentSlot.vambraces => 'Worn Bracers',
|
||||||
|
EquipmentSlot.gauntlets => 'Tattered Gloves',
|
||||||
|
EquipmentSlot.gambeson => 'Ragged Tunic',
|
||||||
|
EquipmentSlot.cuisses => 'Worn Pants',
|
||||||
|
EquipmentSlot.greaves => 'Cloth Leggings',
|
||||||
|
EquipmentSlot.sollerets => 'Worn Sandals',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// 자동 장착
|
// 자동 장착
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|||||||
@@ -3,12 +3,13 @@ import 'package:asciineverdie/src/core/model/hall_of_fame.dart';
|
|||||||
|
|
||||||
/// 아레나 대전 정보
|
/// 아레나 대전 정보
|
||||||
///
|
///
|
||||||
/// 도전자와 상대의 정보, 베팅 슬롯을 포함
|
/// 도전자와 상대의 정보, 양방향 베팅 슬롯을 포함
|
||||||
class ArenaMatch {
|
class ArenaMatch {
|
||||||
const ArenaMatch({
|
const ArenaMatch({
|
||||||
required this.challenger,
|
required this.challenger,
|
||||||
required this.opponent,
|
required this.opponent,
|
||||||
required this.bettingSlot,
|
required this.challengerBettingSlot,
|
||||||
|
required this.opponentBettingSlot,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// 도전자 (내 캐릭터)
|
/// 도전자 (내 캐릭터)
|
||||||
@@ -17,14 +18,21 @@ class ArenaMatch {
|
|||||||
/// 상대 캐릭터
|
/// 상대 캐릭터
|
||||||
final HallOfFameEntry opponent;
|
final HallOfFameEntry opponent;
|
||||||
|
|
||||||
/// 베팅 슬롯 (같은 슬롯 교환)
|
/// 도전자 베팅 슬롯 (승리 시 상대에게서 빼앗을 슬롯)
|
||||||
final EquipmentSlot bettingSlot;
|
final EquipmentSlot challengerBettingSlot;
|
||||||
|
|
||||||
|
/// 상대 베팅 슬롯 (상대 승리 시 도전자에게서 빼앗을 슬롯)
|
||||||
|
final EquipmentSlot opponentBettingSlot;
|
||||||
|
|
||||||
/// 도전자 순위
|
/// 도전자 순위
|
||||||
int get challengerRank => 0; // ArenaService에서 계산
|
int get challengerRank => 0; // ArenaService에서 계산
|
||||||
|
|
||||||
/// 상대 순위
|
/// 상대 순위
|
||||||
int get opponentRank => 0; // ArenaService에서 계산
|
int get opponentRank => 0; // ArenaService에서 계산
|
||||||
|
|
||||||
|
/// 기존 bettingSlot 호환용 (deprecated)
|
||||||
|
@Deprecated('Use challengerBettingSlot instead')
|
||||||
|
EquipmentSlot get bettingSlot => challengerBettingSlot;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 아레나 대전 결과
|
/// 아레나 대전 결과
|
||||||
|
|||||||
@@ -55,9 +55,12 @@ class _ArenaSetupScreenState extends State<ArenaSetupScreen> {
|
|||||||
/// 자동 결정된 상대
|
/// 자동 결정된 상대
|
||||||
HallOfFameEntry? _opponent;
|
HallOfFameEntry? _opponent;
|
||||||
|
|
||||||
/// 선택된 베팅 슬롯
|
/// 선택된 베팅 슬롯 (도전자가 상대에게서 뺏을 슬롯)
|
||||||
EquipmentSlot? _selectedSlot;
|
EquipmentSlot? _selectedSlot;
|
||||||
|
|
||||||
|
/// 상대가 선택한 베팅 슬롯 (패배 시 뺏길 슬롯)
|
||||||
|
EquipmentSlot? _opponentBettingSlot;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
@@ -71,9 +74,13 @@ class _ArenaSetupScreenState extends State<ArenaSetupScreen> {
|
|||||||
void _selectChallenger(HallOfFameEntry entry) {
|
void _selectChallenger(HallOfFameEntry entry) {
|
||||||
final opponent = _arenaService.findOpponent(widget.hallOfFame, entry.id);
|
final opponent = _arenaService.findOpponent(widget.hallOfFame, entry.id);
|
||||||
|
|
||||||
|
// AI가 도전자에게서 약탈할 슬롯 미리 계산
|
||||||
|
final opponentSlot = _arenaService.selectOpponentBettingSlot(entry);
|
||||||
|
|
||||||
setState(() {
|
setState(() {
|
||||||
_challenger = entry;
|
_challenger = entry;
|
||||||
_opponent = opponent;
|
_opponent = opponent;
|
||||||
|
_opponentBettingSlot = opponentSlot;
|
||||||
_step = 1;
|
_step = 1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -81,14 +88,16 @@ class _ArenaSetupScreenState extends State<ArenaSetupScreen> {
|
|||||||
void _startBattle() {
|
void _startBattle() {
|
||||||
if (_challenger == null ||
|
if (_challenger == null ||
|
||||||
_opponent == null ||
|
_opponent == null ||
|
||||||
_selectedSlot == null) {
|
_selectedSlot == null ||
|
||||||
|
_opponentBettingSlot == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final match = ArenaMatch(
|
final match = ArenaMatch(
|
||||||
challenger: _challenger!,
|
challenger: _challenger!,
|
||||||
opponent: _opponent!,
|
opponent: _opponent!,
|
||||||
bettingSlot: _selectedSlot!,
|
challengerBettingSlot: _selectedSlot!,
|
||||||
|
opponentBettingSlot: _opponentBettingSlot!,
|
||||||
);
|
);
|
||||||
|
|
||||||
final navigator = Navigator.of(context);
|
final navigator = Navigator.of(context);
|
||||||
@@ -188,7 +197,7 @@ class _ArenaSetupScreenState extends State<ArenaSetupScreen> {
|
|||||||
),
|
),
|
||||||
// 상단 캐릭터 정보 (좌우 대칭)
|
// 상단 캐릭터 정보 (좌우 대칭)
|
||||||
_buildCharacterHeaders(),
|
_buildCharacterHeaders(),
|
||||||
// 장비 비교 리스트
|
// 장비 비교 리스트 (양방향 베팅 표시 포함)
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||||
@@ -197,6 +206,7 @@ class _ArenaSetupScreenState extends State<ArenaSetupScreen> {
|
|||||||
enemyEquipment: _opponent?.finalEquipment,
|
enemyEquipment: _opponent?.finalEquipment,
|
||||||
selectedSlot: _selectedSlot,
|
selectedSlot: _selectedSlot,
|
||||||
recommendedSlot: recommendedSlot,
|
recommendedSlot: recommendedSlot,
|
||||||
|
opponentBettingSlot: _opponentBettingSlot,
|
||||||
onSlotSelected: (slot) {
|
onSlotSelected: (slot) {
|
||||||
setState(() => _selectedSlot = slot);
|
setState(() => _selectedSlot = slot);
|
||||||
},
|
},
|
||||||
@@ -209,14 +219,16 @@ class _ArenaSetupScreenState extends State<ArenaSetupScreen> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 추천 슬롯 계산 (점수 이득이 가장 큰 슬롯)
|
/// 추천 슬롯 계산 (점수 이득이 가장 큰 슬롯, 무기 제외)
|
||||||
EquipmentSlot? _calculateRecommendedSlot() {
|
EquipmentSlot? _calculateRecommendedSlot() {
|
||||||
if (_challenger == null || _opponent == null) return null;
|
if (_challenger == null || _opponent == null) return null;
|
||||||
|
|
||||||
EquipmentSlot? bestSlot;
|
EquipmentSlot? bestSlot;
|
||||||
int maxGain = 0;
|
int maxGain = 0;
|
||||||
|
|
||||||
for (final slot in EquipmentSlot.values) {
|
// 베팅 가능한 슬롯만 검사 (무기 제외)
|
||||||
|
final bettableSlots = _arenaService.getBettableSlots();
|
||||||
|
for (final slot in bettableSlots) {
|
||||||
final myItem = _findItem(slot, _challenger!.finalEquipment);
|
final myItem = _findItem(slot, _challenger!.finalEquipment);
|
||||||
final enemyItem = _findItem(slot, _opponent!.finalEquipment);
|
final enemyItem = _findItem(slot, _opponent!.finalEquipment);
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ const _myEquipmentTitle = 'MY EQUIPMENT';
|
|||||||
const _enemyEquipmentTitle = 'ENEMY EQUIPMENT';
|
const _enemyEquipmentTitle = 'ENEMY EQUIPMENT';
|
||||||
const _selectedLabel = 'SELECTED';
|
const _selectedLabel = 'SELECTED';
|
||||||
const _recommendedLabel = 'BEST';
|
const _recommendedLabel = 'BEST';
|
||||||
|
const _weaponLockedLabel = 'LOCKED';
|
||||||
|
|
||||||
/// 좌우 대칭 장비 비교 리스트
|
/// 좌우 대칭 장비 비교 리스트
|
||||||
///
|
///
|
||||||
@@ -24,6 +25,7 @@ class ArenaEquipmentCompareList extends StatefulWidget {
|
|||||||
required this.selectedSlot,
|
required this.selectedSlot,
|
||||||
required this.onSlotSelected,
|
required this.onSlotSelected,
|
||||||
this.recommendedSlot,
|
this.recommendedSlot,
|
||||||
|
this.opponentBettingSlot,
|
||||||
});
|
});
|
||||||
|
|
||||||
/// 내 장비 목록
|
/// 내 장비 목록
|
||||||
@@ -32,7 +34,7 @@ class ArenaEquipmentCompareList extends StatefulWidget {
|
|||||||
/// 상대 장비 목록
|
/// 상대 장비 목록
|
||||||
final List<EquipmentItem>? enemyEquipment;
|
final List<EquipmentItem>? enemyEquipment;
|
||||||
|
|
||||||
/// 현재 선택된 슬롯
|
/// 현재 선택된 슬롯 (내가 상대에게서 뺏을 슬롯)
|
||||||
final EquipmentSlot? selectedSlot;
|
final EquipmentSlot? selectedSlot;
|
||||||
|
|
||||||
/// 슬롯 선택 콜백
|
/// 슬롯 선택 콜백
|
||||||
@@ -41,6 +43,9 @@ class ArenaEquipmentCompareList extends StatefulWidget {
|
|||||||
/// 추천 슬롯 (점수 이득이 가장 큰 슬롯)
|
/// 추천 슬롯 (점수 이득이 가장 큰 슬롯)
|
||||||
final EquipmentSlot? recommendedSlot;
|
final EquipmentSlot? recommendedSlot;
|
||||||
|
|
||||||
|
/// 상대가 선택한 슬롯 (패배 시 내가 잃을 슬롯)
|
||||||
|
final EquipmentSlot? opponentBettingSlot;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<ArenaEquipmentCompareList> createState() =>
|
State<ArenaEquipmentCompareList> createState() =>
|
||||||
_ArenaEquipmentCompareListState();
|
_ArenaEquipmentCompareListState();
|
||||||
@@ -162,6 +167,14 @@ class _ArenaEquipmentCompareListState extends State<ArenaEquipmentCompareList> {
|
|||||||
final isSelected = widget.selectedSlot == slot;
|
final isSelected = widget.selectedSlot == slot;
|
||||||
final isRecommended = widget.recommendedSlot == slot;
|
final isRecommended = widget.recommendedSlot == slot;
|
||||||
|
|
||||||
|
// 무기 슬롯은 선택 불가 (보호됨)
|
||||||
|
final isLocked = slot == EquipmentSlot.weapon;
|
||||||
|
|
||||||
|
// 양방향 베팅 상태
|
||||||
|
final isMyTarget = isSelected; // 내가 선택 = 상대 장비 획득 예정
|
||||||
|
final isOpponentTarget =
|
||||||
|
widget.opponentBettingSlot == slot; // 상대가 선택 = 내 장비 손실 예정
|
||||||
|
|
||||||
final myScore =
|
final myScore =
|
||||||
myItem != null ? ItemService.calculateEquipmentScore(myItem) : 0;
|
myItem != null ? ItemService.calculateEquipmentScore(myItem) : 0;
|
||||||
final enemyScore =
|
final enemyScore =
|
||||||
@@ -172,29 +185,29 @@ class _ArenaEquipmentCompareListState extends State<ArenaEquipmentCompareList> {
|
|||||||
children: [
|
children: [
|
||||||
// 슬롯 행 (좌우 대칭)
|
// 슬롯 행 (좌우 대칭)
|
||||||
GestureDetector(
|
GestureDetector(
|
||||||
onTap: () {
|
onTap: isLocked
|
||||||
// 탭하면 즉시 선택 + 확장 + 자동 스크롤
|
? null
|
||||||
widget.onSlotSelected(slot);
|
: () {
|
||||||
setState(() {
|
// 탭하면 즉시 선택 + 확장 + 자동 스크롤
|
||||||
_expandedSlot = isExpanded ? null : slot;
|
widget.onSlotSelected(slot);
|
||||||
});
|
setState(() {
|
||||||
// 확장될 때만 스크롤 (다음 프레임에서 실행)
|
_expandedSlot = isExpanded ? null : slot;
|
||||||
if (!isExpanded) {
|
});
|
||||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
// 확장될 때만 스크롤 (다음 프레임에서 실행)
|
||||||
_scrollToSlot(slot);
|
if (!isExpanded) {
|
||||||
});
|
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||||
}
|
_scrollToSlot(slot);
|
||||||
},
|
});
|
||||||
|
}
|
||||||
|
},
|
||||||
child: Container(
|
child: Container(
|
||||||
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 4),
|
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 4),
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
color: isSelected
|
color: isLocked
|
||||||
? RetroColors.goldOf(context).withValues(alpha: 0.2)
|
? RetroColors.borderOf(context).withValues(alpha: 0.1)
|
||||||
: isRecommended
|
: isExpanded
|
||||||
? Colors.green.withValues(alpha: 0.1)
|
? RetroColors.panelBgOf(context)
|
||||||
: isExpanded
|
: Colors.transparent,
|
||||||
? RetroColors.panelBgOf(context)
|
|
||||||
: Colors.transparent,
|
|
||||||
border: Border(
|
border: Border(
|
||||||
bottom: BorderSide(
|
bottom: BorderSide(
|
||||||
color: RetroColors.borderOf(context).withValues(alpha: 0.3),
|
color: RetroColors.borderOf(context).withValues(alpha: 0.3),
|
||||||
@@ -203,60 +216,127 @@ class _ArenaEquipmentCompareListState extends State<ArenaEquipmentCompareList> {
|
|||||||
),
|
),
|
||||||
child: Row(
|
child: Row(
|
||||||
children: [
|
children: [
|
||||||
// 내 장비
|
// 내 장비 (상대가 노리면 빨간 배경)
|
||||||
Expanded(child: _buildEquipmentCell(context, myItem, myScore, Colors.blue)),
|
Expanded(
|
||||||
|
child: _buildEquipmentCell(
|
||||||
|
context,
|
||||||
|
myItem,
|
||||||
|
myScore,
|
||||||
|
Colors.blue,
|
||||||
|
isLocked: isLocked,
|
||||||
|
isTargetedByOpponent: isOpponentTarget,
|
||||||
|
),
|
||||||
|
),
|
||||||
// 슬롯 아이콘 (중앙)
|
// 슬롯 아이콘 (중앙)
|
||||||
_buildSlotIndicator(context, slot, isSelected, isRecommended, scoreDiff),
|
_buildSlotIndicator(
|
||||||
// 상대 장비
|
context,
|
||||||
Expanded(child: _buildEquipmentCell(context, enemyItem, enemyScore, Colors.red)),
|
slot,
|
||||||
|
isSelected,
|
||||||
|
isRecommended,
|
||||||
|
scoreDiff,
|
||||||
|
isLocked: isLocked,
|
||||||
|
isOpponentTarget: isOpponentTarget,
|
||||||
|
),
|
||||||
|
// 상대 장비 (내가 선택하거나 추천이면 녹색 배경)
|
||||||
|
Expanded(
|
||||||
|
child: _buildEquipmentCell(
|
||||||
|
context,
|
||||||
|
enemyItem,
|
||||||
|
enemyScore,
|
||||||
|
Colors.red,
|
||||||
|
isLocked: isLocked,
|
||||||
|
isMyTarget: isMyTarget,
|
||||||
|
isRecommended: isRecommended && !isMyTarget,
|
||||||
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// 확장된 비교 패널
|
// 확장된 비교 패널 (잠긴 슬롯은 확장 불가)
|
||||||
if (isExpanded)
|
if (isExpanded && !isLocked)
|
||||||
_buildExpandedPanel(context, slot, myItem, enemyItem, scoreDiff),
|
_buildExpandedPanel(context, slot, myItem, enemyItem, scoreDiff),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 장비 셀 (한쪽)
|
/// 장비 셀 (한쪽)
|
||||||
|
///
|
||||||
|
/// [isTargetedByOpponent] 상대가 이 슬롯을 노림 (좌측 - 내 장비 손실)
|
||||||
|
/// [isMyTarget] 내가 이 슬롯을 선택함 (우측 - 상대 장비 획득)
|
||||||
|
/// [isRecommended] 추천 슬롯 (우측 - 획득 추천)
|
||||||
Widget _buildEquipmentCell(
|
Widget _buildEquipmentCell(
|
||||||
BuildContext context,
|
BuildContext context,
|
||||||
EquipmentItem? item,
|
EquipmentItem? item,
|
||||||
int score,
|
int score,
|
||||||
Color accentColor,
|
Color accentColor, {
|
||||||
) {
|
bool isLocked = false,
|
||||||
|
bool isTargetedByOpponent = false,
|
||||||
|
bool isMyTarget = false,
|
||||||
|
bool isRecommended = false,
|
||||||
|
}) {
|
||||||
final hasItem = item != null && item.isNotEmpty;
|
final hasItem = item != null && item.isNotEmpty;
|
||||||
final rarityColor = hasItem ? _getRarityColor(item.rarity) : Colors.grey;
|
final rarityColor = hasItem ? _getRarityColor(item.rarity) : Colors.grey;
|
||||||
|
|
||||||
return Row(
|
// 배경색 결정
|
||||||
children: [
|
Color? bgColor;
|
||||||
// 아이템 이름
|
Color? borderColor;
|
||||||
Expanded(
|
if (!isLocked) {
|
||||||
child: Text(
|
if (isTargetedByOpponent) {
|
||||||
hasItem ? item.name : '-',
|
bgColor = Colors.red.withValues(alpha: 0.2); // 손실 예정
|
||||||
|
borderColor = Colors.red.withValues(alpha: 0.5);
|
||||||
|
} else if (isMyTarget) {
|
||||||
|
bgColor = Colors.green.withValues(alpha: 0.25); // 획득 예정
|
||||||
|
borderColor = Colors.green.withValues(alpha: 0.6);
|
||||||
|
} else if (isRecommended) {
|
||||||
|
bgColor = Colors.green.withValues(alpha: 0.15); // 추천
|
||||||
|
borderColor = Colors.green.withValues(alpha: 0.4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final textColor = isLocked
|
||||||
|
? RetroColors.textMutedOf(context)
|
||||||
|
: hasItem
|
||||||
|
? rarityColor
|
||||||
|
: RetroColors.textMutedOf(context);
|
||||||
|
|
||||||
|
return Container(
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 6, vertical: 6),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: bgColor,
|
||||||
|
borderRadius: BorderRadius.circular(4),
|
||||||
|
border: borderColor != null ? Border.all(color: borderColor) : null,
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
// 아이템 이름
|
||||||
|
Expanded(
|
||||||
|
child: Text(
|
||||||
|
hasItem ? item.name : '-',
|
||||||
|
style: TextStyle(
|
||||||
|
fontFamily: 'PressStart2P',
|
||||||
|
fontSize: 6,
|
||||||
|
color: textColor,
|
||||||
|
),
|
||||||
|
maxLines: 1,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
// 점수
|
||||||
|
Text(
|
||||||
|
'$score',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontFamily: 'PressStart2P',
|
fontFamily: 'PressStart2P',
|
||||||
fontSize: 5,
|
fontSize: 6,
|
||||||
color: hasItem ? rarityColor : RetroColors.textMutedOf(context),
|
color: isLocked
|
||||||
|
? RetroColors.textMutedOf(context)
|
||||||
|
: hasItem
|
||||||
|
? RetroColors.textSecondaryOf(context)
|
||||||
|
: RetroColors.textMutedOf(context),
|
||||||
),
|
),
|
||||||
maxLines: 1,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
// 점수
|
),
|
||||||
Text(
|
|
||||||
'$score',
|
|
||||||
style: TextStyle(
|
|
||||||
fontFamily: 'PressStart2P',
|
|
||||||
fontSize: 5,
|
|
||||||
color: hasItem
|
|
||||||
? RetroColors.textSecondaryOf(context)
|
|
||||||
: RetroColors.textMutedOf(context),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,14 +346,27 @@ class _ArenaEquipmentCompareListState extends State<ArenaEquipmentCompareList> {
|
|||||||
EquipmentSlot slot,
|
EquipmentSlot slot,
|
||||||
bool isSelected,
|
bool isSelected,
|
||||||
bool isRecommended,
|
bool isRecommended,
|
||||||
int scoreDiff,
|
int scoreDiff, {
|
||||||
) {
|
bool isLocked = false,
|
||||||
|
bool isOpponentTarget = false,
|
||||||
|
}) {
|
||||||
final Color borderColor;
|
final Color borderColor;
|
||||||
final Color bgColor;
|
final Color bgColor;
|
||||||
|
|
||||||
if (isSelected) {
|
if (isLocked) {
|
||||||
|
borderColor = RetroColors.borderOf(context).withValues(alpha: 0.5);
|
||||||
|
bgColor = RetroColors.borderOf(context).withValues(alpha: 0.1);
|
||||||
|
} else if (isSelected && isOpponentTarget) {
|
||||||
|
// 양쪽 모두 선택 - 금색 테두리 유지
|
||||||
borderColor = RetroColors.goldOf(context);
|
borderColor = RetroColors.goldOf(context);
|
||||||
bgColor = RetroColors.goldOf(context).withValues(alpha: 0.3);
|
bgColor = RetroColors.goldOf(context).withValues(alpha: 0.3);
|
||||||
|
} else if (isSelected) {
|
||||||
|
borderColor = RetroColors.goldOf(context);
|
||||||
|
bgColor = RetroColors.goldOf(context).withValues(alpha: 0.3);
|
||||||
|
} else if (isOpponentTarget) {
|
||||||
|
// 상대만 선택 - 빨간 표시
|
||||||
|
borderColor = Colors.red.withValues(alpha: 0.7);
|
||||||
|
bgColor = Colors.red.withValues(alpha: 0.15);
|
||||||
} else if (isRecommended) {
|
} else if (isRecommended) {
|
||||||
borderColor = Colors.green;
|
borderColor = Colors.green;
|
||||||
bgColor = Colors.green.withValues(alpha: 0.2);
|
bgColor = Colors.green.withValues(alpha: 0.2);
|
||||||
@@ -295,15 +388,27 @@ class _ArenaEquipmentCompareListState extends State<ArenaEquipmentCompareList> {
|
|||||||
children: [
|
children: [
|
||||||
// 슬롯 아이콘
|
// 슬롯 아이콘
|
||||||
Icon(
|
Icon(
|
||||||
_getSlotIcon(slot),
|
isLocked ? Icons.lock : _getSlotIcon(slot),
|
||||||
size: 12,
|
size: 12,
|
||||||
color: isSelected
|
color: isLocked
|
||||||
? RetroColors.goldOf(context)
|
? RetroColors.textMutedOf(context)
|
||||||
: RetroColors.textSecondaryOf(context),
|
: isSelected
|
||||||
|
? RetroColors.goldOf(context)
|
||||||
|
: RetroColors.textSecondaryOf(context),
|
||||||
),
|
),
|
||||||
const SizedBox(height: 2),
|
const SizedBox(height: 2),
|
||||||
// 점수 변화
|
// 잠금 표시 또는 점수 변화
|
||||||
_buildScoreDiffBadge(context, scoreDiff, isRecommended),
|
if (isLocked)
|
||||||
|
Text(
|
||||||
|
_weaponLockedLabel,
|
||||||
|
style: TextStyle(
|
||||||
|
fontFamily: 'PressStart2P',
|
||||||
|
fontSize: 4,
|
||||||
|
color: RetroColors.textMutedOf(context),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
else
|
||||||
|
_buildScoreDiffBadge(context, scoreDiff, isRecommended),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -33,7 +33,10 @@ class ArenaResultDialog extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final isVictory = result.isVictory;
|
final isVictory = result.isVictory;
|
||||||
final resultColor = isVictory ? Colors.amber : Colors.red;
|
final resultColor = isVictory ? Colors.amber : Colors.red;
|
||||||
final slot = result.match.bettingSlot;
|
// 승패에 따라 교환 슬롯 결정
|
||||||
|
final slot = isVictory
|
||||||
|
? result.match.challengerBettingSlot
|
||||||
|
: result.match.opponentBettingSlot;
|
||||||
|
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
backgroundColor: RetroColors.panelBgOf(context),
|
backgroundColor: RetroColors.panelBgOf(context),
|
||||||
|
|||||||
@@ -243,9 +243,15 @@ class _ArenaResultPanelState extends State<ArenaResultPanel>
|
|||||||
}
|
}
|
||||||
|
|
||||||
Widget _buildExchangeSection(BuildContext context) {
|
Widget _buildExchangeSection(BuildContext context) {
|
||||||
final slot = widget.result.match.bettingSlot;
|
|
||||||
final isVictory = widget.result.isVictory;
|
final isVictory = widget.result.isVictory;
|
||||||
|
|
||||||
|
// 승패에 따라 교환 슬롯 결정
|
||||||
|
// 승리: 도전자가 선택한 슬롯(상대에게서 약탈)
|
||||||
|
// 패배: 상대가 선택한 슬롯(도전자에게서 약탈당함)
|
||||||
|
final slot = isVictory
|
||||||
|
? widget.result.match.challengerBettingSlot
|
||||||
|
: widget.result.match.opponentBettingSlot;
|
||||||
|
|
||||||
// 도전자의 교환 결과
|
// 도전자의 교환 결과
|
||||||
final oldItem = _findItem(
|
final oldItem = _findItem(
|
||||||
widget.result.match.challenger.finalEquipment,
|
widget.result.match.challenger.finalEquipment,
|
||||||
|
|||||||
@@ -94,10 +94,11 @@ class DeathOverlay extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// 본문
|
// 본문 (스크롤 가능)
|
||||||
SingleChildScrollView(
|
Flexible(
|
||||||
padding: const EdgeInsets.all(16),
|
child: SingleChildScrollView(
|
||||||
child: Column(
|
padding: const EdgeInsets.all(16),
|
||||||
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
// 사망 타이틀
|
// 사망 타이틀
|
||||||
@@ -134,6 +135,7 @@ class DeathOverlay extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user