import { motion } from 'motion/react'; import type { ReactNode } from 'react'; import { resolveAttributeSchema, resolveCharacterAttributeProfile, } from '../data/attributeResolver'; import { getCompanionBuildDamageBreakdown } from '../data/buildDamage'; import { type CharacterEquipmentItem, type CharacterInventoryItem, getCharacterEquipment, getCharacterMaxHp, getCharacterMaxMana, getInventoryItems, } from '../data/characterPresets'; import { buildMedievalNpcVisualFromCustomWorldVisual } from '../data/medievalNpcVisuals'; import { getResourceLabelsForWorld } from '../services/customWorldPresentation'; import { AnimationState, type Character, type CustomWorldProfile, type WorldType, } from '../types'; import { getNineSliceStyle, type NineSliceTexture, UI_CHROME, } from '../uiAssets'; import { CharacterAnimator } from './CharacterAnimator'; import { getCharacterDetailSpriteStyle, getGenderLabel, } from './CharacterInfoHelpers'; import { CharacterAttributeGrid, CharacterSkillsList, } from './CharacterInfoShared'; import { MedievalNpcAnimator } from './MedievalNpcAnimator'; import { PixelCloseButton } from './PixelCloseButton'; interface CharacterDetailModalProps { character: Character | null; worldType: WorldType | null; customWorldProfile?: CustomWorldProfile | null; subtitle?: string; onClose: () => void; } function Section({ title, chrome = UI_CHROME.panel, children, }: { title: string; chrome?: NineSliceTexture; children: ReactNode; }) { return (
{title}
{children}
); } function StatPill({ label, value, tone, }: { label: string; value: string; tone: 'neutral' | 'hp' | 'mp'; }) { const toneClassName = tone === 'hp' ? 'border-rose-400/20 bg-rose-500/10 text-rose-100' : tone === 'mp' ? 'border-sky-400/20 bg-sky-500/10 text-sky-100' : 'border-white/10 bg-black/20 text-zinc-200'; return (
{label}
{value}
); } function EquipmentGrid({ items }: { items: CharacterEquipmentItem[] }) { return (
{items.map((item) => (
{item.slot}
{item.item}
{item.rarity}
))}
); } function InventoryGrid({ items }: { items: CharacterInventoryItem[] }) { return (
{items.map((item) => (
{item.category}
{item.name}
数量 x{item.quantity}
))}
); } export function CharacterDetailModal({ character, worldType, customWorldProfile = null, subtitle = '初始伙伴', onClose, }: CharacterDetailModalProps) { if (!character) { return null; } const opening = worldType ? character.adventureOpenings[worldType] : null; const equipment = getCharacterEquipment(character); const inventory = getInventoryItems(character, worldType); const attributeSchema = resolveAttributeSchema(worldType, customWorldProfile); const attributeProfile = resolveCharacterAttributeProfile( character, worldType, customWorldProfile, ); const buildBreakdown = getCompanionBuildDamageBreakdown( character, worldType, customWorldProfile, ); const resourceLabels = getResourceLabelsForWorld( worldType, customWorldProfile, ); return ( event.stopPropagation()} >
{character.name}
{subtitle}
{character.visual ? ( ) : ( )}
候选人
{character.name}
{character.title} 性别: {getGenderLabel(character.gender)}

{character.description}

{opening && (
原因
{opening.reason}
目标
{opening.goal}
)}
{character.backstory}
{character.personality}
); }