diff --git a/packages/parser/src/interface/sceneInterface.ts b/packages/parser/src/interface/sceneInterface.ts index 8a55387d6..7b45b00bf 100644 --- a/packages/parser/src/interface/sceneInterface.ts +++ b/packages/parser/src/interface/sceneInterface.ts @@ -73,6 +73,7 @@ export interface ISentence { args: Array; // 参数列表 sentenceAssets: Array; // 语句携带的资源列表 subScene: Array; // 语句包含子场景列表 + comment: string; // 语句行尾注释 } /** diff --git a/packages/parser/src/scriptParser/scriptParser.ts b/packages/parser/src/scriptParser/scriptParser.ts index f17f7095d..d790eac9f 100644 --- a/packages/parser/src/scriptParser/scriptParser.ts +++ b/packages/parser/src/scriptParser/scriptParser.ts @@ -49,6 +49,7 @@ export const scriptParser = ( args: [{ key: 'next', value: true }], // 参数列表 sentenceAssets: [], // 语句携带的资源列表 subScene: [], // 语句携带的子场景 + comment: '', }; } // 截取命令 @@ -103,12 +104,6 @@ export const scriptParser = ( } } - // 保留注释 - const trimmedComment = sentenceComment.trim(); - if (trimmedComment) { - args.push({ key: 'comment', value: trimmedComment }); - } - content = contentParser(newSentenceRaw.trim(), command, assetSetter); // 将语句内容里的文件名转为相对或绝对路径 sentenceAssets = assetsScanner(command, content, args); // 扫描语句携带资源 subScene = subSceneScanner(command, content); // 扫描语句携带子场景 @@ -119,5 +114,6 @@ export const scriptParser = ( args: args, // 参数列表 sentenceAssets: sentenceAssets, // 语句携带的资源列表 subScene: subScene, // 语句携带的子场景 + comment: sentenceComment.trim(), }; };