import { useCharaPuller, useCharaPicker, useCharaSubmit } from '@remake/hooks' import { useUnique, useUniqueGenerator, convertProps } from '@remake/hooks' import type { BaseChara } from '@remake/hooks' import { judgeGradeByValue } from '@/config' import { characters } from '@remake/data' import { properties } from '@/display' import { keys } from '@remake/vitex' import { toastMsg } from '@/toast' import Talent from '@/components/Talent' import './Chara.css' function Details({ detail }: { detail: BaseChara }) { const props = convertProps(detail.property) return (
) } interface UniqueProps { selected?: boolean picker?: () => void } function Unique({ selected, picker }: UniqueProps) { const [unique, generator] = useUniqueGenerator() return (
  • 独一无二的我 {unique &&
    } {!unique && (
    • 6000万玩家中独一无二的角色卡
    • 所有属性 所有天赋 随机生成
    • 每人只能生成一次
    )}
  • ) } interface CharacterProps { id: number selected?: boolean picker?: (id: number) => void } function Character({ id, selected, picker }: CharacterProps) { const character = characters.get(id)! return (
  • picker?.(id)} > {character.name}
  • ) } export function Chara() { const u = useUnique() const [{ unique, characters }, puller] = useCharaPuller() const [picked, picker] = useCharaPicker() const submit = useCharaSubmit() const handleSubmit = () => { if (ready) return submit(picked) if (!picked) toastMsg('请先选择角色', 'chara-toast-pick') else toastMsg('请先生成唯一角色', 'chara-toast-unique') } const ready = picked && (picked.type === 'unique' ? !!u : true) return (
    ) } export default Chara