File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ export const sceneParser = (
2929 ADD_NEXT_ARG_LIST : commandType [ ] ,
3030 SCRIPT_CONFIG_MAP : ConfigMap ,
3131) : IScene => {
32- const rawSentenceList = rawScene . split ( '\n' ) ; // 原始句子列表
32+ const rawSentenceList = rawScene . replaceAll ( '\r' , '' ) . split ( '\n' ) ; // 原始句子列表
3333
3434 // 去分号留到后面去做了,现在注释要单独处理
3535 const rawSentenceListWithoutEmpty = rawSentenceList ;
Original file line number Diff line number Diff line change @@ -23,10 +23,10 @@ export function argsParser(
2323 } ) ;
2424 rawArgsList . forEach ( ( e ) => {
2525 const equalSignIndex = e . indexOf ( '=' ) ;
26- let argName = e . slice ( 0 , equalSignIndex ) ;
27- let argValue : string | undefined = e . slice ( equalSignIndex + 1 ) ;
26+ let argName = e . slice ( 0 , equalSignIndex ) . trim ( ) ;
27+ let argValue : string | undefined = e . slice ( equalSignIndex + 1 ) . trim ( ) ;
2828 if ( equalSignIndex < 0 ) {
29- argName = e ;
29+ argName = e . trim ( ) ;
3030 argValue = undefined ;
3131 }
3232 // 判断是不是语音参数
Original file line number Diff line number Diff line change @@ -36,14 +36,16 @@ export const scriptParser = (
3636 // 正式开始解析
3737
3838 // 去分号
39- let newSentenceRaw = sentenceRaw . split ( / (?< ! \\ ) ; / ) [ 0 ] ;
39+ const commentSplit = sentenceRaw . split ( / (?< ! \\ ) ; / ) ;
40+ let newSentenceRaw = commentSplit [ 0 ] . trim ( ) ;
4041 newSentenceRaw = newSentenceRaw . replaceAll ( '\\;' , ';' ) ;
42+ const sentenceComment = commentSplit [ 1 ] ?? '' ;
4143 if ( newSentenceRaw === '' ) {
4244 // 注释提前返回
4345 return {
4446 command : commandType . comment , // 语句类型
4547 commandRaw : 'comment' , // 命令原始内容,方便调试
46- content : sentenceRaw . split ( ';' ) [ 1 ] ?? '' , // 语句内容
48+ content : sentenceComment . trim ( ) , // 语句内容
4749 args : [ { key : 'next' , value : true } ] , // 参数列表
4850 sentenceAssets : [ ] , // 语句携带的资源列表
4951 subScene : [ ] , // 语句携带的子场景
You can’t perform that action at this time.
0 commit comments