File tree Expand file tree Collapse file tree 4 files changed +23
-6
lines changed
Expand file tree Collapse file tree 4 files changed +23
-6
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import { memo } from 'react'
1414import { Paths } from 'type-fest'
1515
1616import { i18n , useTranslation } from '../../i18n/i18n'
17+ import { isCustomLevel } from '../../models/level'
1718import { DifficultyPicker } from './DifficultyPicker'
1819import { LevelSelect } from './LevelSelect'
1920import { editorAtoms , useEdit } from './editor-state'
@@ -100,10 +101,19 @@ export const InfoEditor = memo(({ className }: InfoEditorProps) => {
100101 < LevelSelect
101102 difficulty = { info . difficulty }
102103 value = { info . stageName }
103- onChange = { ( value ) => {
104+ onChange = { ( stageId , level ) => {
104105 edit ( ( ) => {
105106 setInfo ( ( prev ) => {
106- prev . stageName = value
107+ prev . stageName = stageId
108+
109+ if ( level && ! prev . doc . title ) {
110+ // 如果没有标题,则使用关卡名作为标题
111+ prev . doc . title = isCustomLevel ( level )
112+ ? level . name
113+ : [ level . catTwo , level . catThree , level . name ]
114+ . filter ( Boolean )
115+ . join ( ' - ' )
116+ }
107117 } )
108118 return {
109119 action : 'update-level' ,
Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ interface LevelSelectProps {
2727 inputRef ?: Ref < HTMLInputElement >
2828 disabled ?: boolean
2929 value ?: string
30- onChange : ( level : string ) => void
30+ onChange : ( stageId : string , level ?: Level ) => void
3131}
3232
3333export const LevelSelect : FC < LevelSelectProps > = ( {
@@ -203,7 +203,7 @@ export const LevelSelect: FC<LevelSelectProps> = ({
203203 // 重置 query 以显示同类关卡
204204 updateQuery ( '' , true )
205205 }
206- onChange ( level . stageId )
206+ onChange ( level . stageId , level )
207207 } }
208208 createNewItemFromQuery = { ( query ) => createCustomLevel ( query ) }
209209 createNewItemRenderer = { ( query , active , handleClick ) => (
Original file line number Diff line number Diff line change 34023402 "en" : " Failed to parse operation"
34033403 }
34043404 },
3405+ "level" : {
3406+ "custom_level" : {
3407+ "cn" : " 自定义关卡" ,
3408+ "en" : " Custom Stage"
3409+ }
3410+ },
34053411 "operator" : {
34063412 "operator" : {
34073413 "cn" : " 干员" ,
34083414 "en" : " Operator"
34093415 },
3410- "operator_group" :{
3416+ "operator_group" : {
34113417 "cn" : " 干员组" ,
34123418 "en" : " Operator Group"
34133419 },
Original file line number Diff line number Diff line change 88 *
99 * Only the first two kinds are supported in MAA Copilot.
1010 */
11+ import { i18n } from '../i18n/i18n'
1112import { Level , OpDifficulty } from './operation'
1213
1314const HARD_MODE_SUFFIX = '#f#'
@@ -22,7 +23,7 @@ export function createCustomLevel(name: string): Level {
2223 name,
2324 stageId : name ,
2425 levelId : '' ,
25- catOne : '自定义关卡' ,
26+ catOne : i18n . models . level . custom_level ,
2627 catTwo : '' ,
2728 catThree : name ,
2829 width : 0 ,
You can’t perform that action at this time.
0 commit comments