From 1f455ba353c4ef8a73b169d484a632bd4fde7c96 Mon Sep 17 00:00:00 2001 From: Vick Scarlet Date: Wed, 12 Aug 2026 22:47:41 +0800 Subject: [PATCH] update: dev params --- apps/web/src/config.ts | 28 +++++++++++++++++--------- apps/web/src/containers/Summary.tsx | 9 ++------- apps/web/src/containers/TalentPick.tsx | 7 +++++-- 3 files changed, 25 insertions(+), 19 deletions(-) diff --git a/apps/web/src/config.ts b/apps/web/src/config.ts index 6f7c815..eb65d87 100644 --- a/apps/web/src/config.ts +++ b/apps/web/src/config.ts @@ -1,24 +1,32 @@ import type { Config } from '@remake/hooks' +export const dev = {} as Record +if (import.meta.env.MODE === 'development') { + new URLSearchParams(window.location.search) + .entries() + .forEach(([key, value]) => { + if (key !== 'locked') return (dev[key] = Number(value)) + dev[key] = value.split(',').map(v => Number(v)) + }) +} -export const isDev = import.meta.env.MODE === 'development' // 自动模式自动点击间隔 -export const AutoInterval = 500 +export const AutoInterval = dev.interval ?? 500 // 可锁定的天赋数量 -export const LockLimit = isDev ? 10 : 1 +export const LockLimit = dev.lock ?? 1 // 名人模式重开次数限制 -export const ModeLimit = 10 +export const ModeLimit = dev.mode ?? 10 // 天赋选择数量限制 -export const PickMax = isDev ? 10 : 3 +export const PickMax = dev.max ?? 3 // 天赋选择最少数量限制 -export const PickMin = 3 +export const PickMin = dev.min ?? 3 // 基础属性点 -export const BasePoints = 20 +export const BasePoints = dev.points ?? 20 // 单项属性点最大限制 -export const AllocLimit = 10 +export const AllocLimit = dev.allocate ?? 10 // 默认初始快乐 -export const DefaultSpirit = 5 +export const DefaultSpirit = dev.spirit ?? 5 // 天赋抽取个数 -export const PullCount = isDev ? 20 : 10 +export const PullCount = dev.pull ?? 10 // 天赋抽取基础概率 export const PullRateBase: Config['pull']['rate']['base'] = new Map([ [0, 889], diff --git a/apps/web/src/containers/Summary.tsx b/apps/web/src/containers/Summary.tsx index f9c5bb3..6610895 100644 --- a/apps/web/src/containers/Summary.tsx +++ b/apps/web/src/containers/Summary.tsx @@ -1,8 +1,7 @@ -import { useEffect, useState, useRef, useMemo } from 'react' +import { useEffect, useRef } from 'react' import { usePicked, useEnd, useProfile } from '@remake/hooks' import { useEndJudge } from '@/hooks/judge' import { properties, judgeDisplay } from '@/display' -import { isDev } from '@/config' import TalentComponent from '@/components/Talent' import './Summary.css' @@ -27,11 +26,7 @@ interface TalentListProps { } function TalentList({ picked, picker }: TalentListProps) { const [profile] = useProfile() - const items = usePicked() - const talents = useMemo(() => { - if (!isDev || !profile.locked) return items - return new Set([...items, ...profile.locked]) - }, []) + const talents = usePicked() const hasInitialized = useRef(false) useEffect(() => { if (!profile.locked) return diff --git a/apps/web/src/containers/TalentPick.tsx b/apps/web/src/containers/TalentPick.tsx index a2abc57..fc829b3 100644 --- a/apps/web/src/containers/TalentPick.tsx +++ b/apps/web/src/containers/TalentPick.tsx @@ -1,7 +1,7 @@ // import { useEffect } from 'react' import { useTalentPuller, useTalentPicker } from '@remake/hooks' import { useTalentSubmit, useSubmitIsEnable } from '@remake/hooks' -import { PullCount } from '@/config' +import { PullCount, dev } from '@/config' import TalentComponent from '@/components/Talent' import './TalentPick.css' @@ -19,10 +19,13 @@ export default function TalentPick() { ) + const ps = dev.locked + ? Array.from(new Set([...dev.locked, ...pulled])) + : pulled return (
    - {pulled.map(id => ( + {ps.map(id => (
  • picker(id)}>