webgal-parser 4.5.2 → 4.5.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,52 +36,62 @@ var webgalParser = (function (exports) {
36
36
  commandType[commandType["setTransition"] = 30] = "setTransition";
37
37
  commandType[commandType["getUserInput"] = 31] = "getUserInput";
38
38
  commandType[commandType["applyStyle"] = 32] = "applyStyle";
39
+ commandType[commandType["wait"] = 33] = "wait";
39
40
  })(commandType || (commandType = {}));
40
41
 
41
42
  const SCRIPT_CONFIG = [
42
- { scriptString: 'intro', scriptType: commandType.intro },
43
+ { scriptString: 'say', scriptType: commandType.say },
43
44
  { scriptString: 'changeBg', scriptType: commandType.changeBg },
44
45
  { scriptString: 'changeFigure', scriptType: commandType.changeFigure },
46
+ { scriptString: 'bgm', scriptType: commandType.bgm },
47
+ { scriptString: 'playVideo', scriptType: commandType.video },
48
+ { scriptString: 'pixiPerform', scriptType: commandType.pixi },
49
+ { scriptString: 'pixiInit', scriptType: commandType.pixiInit },
50
+ { scriptString: 'intro', scriptType: commandType.intro },
45
51
  { scriptString: 'miniAvatar', scriptType: commandType.miniAvatar },
46
52
  { scriptString: 'changeScene', scriptType: commandType.changeScene },
47
53
  { scriptString: 'choose', scriptType: commandType.choose },
48
54
  { scriptString: 'end', scriptType: commandType.end },
49
- { scriptString: 'bgm', scriptType: commandType.bgm },
50
- { scriptString: 'playVideo', scriptType: commandType.video },
51
55
  {
52
56
  scriptString: 'setComplexAnimation',
53
57
  scriptType: commandType.setComplexAnimation,
54
58
  },
55
59
  { scriptString: 'setFilter', scriptType: commandType.setFilter },
56
- { scriptString: 'pixiInit', scriptType: commandType.pixiInit },
57
- { scriptString: 'pixiPerform', scriptType: commandType.pixi },
58
60
  { scriptString: 'label', scriptType: commandType.label },
59
61
  { scriptString: 'jumpLabel', scriptType: commandType.jumpLabel },
62
+ { scriptString: 'chooseLabel', scriptType: commandType.chooseLabel },
60
63
  { scriptString: 'setVar', scriptType: commandType.setVar },
64
+ { scriptString: 'if', scriptType: commandType.if },
61
65
  { scriptString: 'callScene', scriptType: commandType.callScene },
62
66
  { scriptString: 'showVars', scriptType: commandType.showVars },
63
67
  { scriptString: 'unlockCg', scriptType: commandType.unlockCg },
64
68
  { scriptString: 'unlockBgm', scriptType: commandType.unlockBgm },
65
- { scriptString: 'say', scriptType: commandType.say },
66
69
  { scriptString: 'filmMode', scriptType: commandType.filmMode },
67
- { scriptString: 'callScene', scriptType: commandType.callScene },
68
70
  { scriptString: 'setTextbox', scriptType: commandType.setTextbox },
69
71
  { scriptString: 'setAnimation', scriptType: commandType.setAnimation },
70
72
  { scriptString: 'playEffect', scriptType: commandType.playEffect },
73
+ { scriptString: 'setTempAnimation', scriptType: commandType.setTempAnimation },
74
+ // comment?
75
+ { scriptString: 'setTransform', scriptType: commandType.setTransform },
76
+ { scriptString: 'setTransition', scriptType: commandType.setTransition },
77
+ { scriptString: 'getUserInput', scriptType: commandType.getUserInput },
71
78
  { scriptString: 'applyStyle', scriptType: commandType.applyStyle },
79
+ { scriptString: 'wait', scriptType: commandType.wait },
72
80
  ];
73
81
  const ADD_NEXT_ARG_LIST = [
74
82
  commandType.bgm,
75
83
  commandType.pixi,
76
84
  commandType.pixiInit,
85
+ commandType.miniAvatar,
77
86
  commandType.label,
78
87
  commandType.if,
79
- commandType.miniAvatar,
80
88
  commandType.setVar,
81
- commandType.unlockBgm,
82
89
  commandType.unlockCg,
90
+ commandType.unlockBgm,
83
91
  commandType.filmMode,
84
92
  commandType.playEffect,
93
+ commandType.setTransition,
94
+ commandType.applyStyle,
85
95
  ];
86
96
 
87
97
  /**
@@ -117,10 +127,10 @@ var webgalParser = (function (exports) {
117
127
  });
118
128
  rawArgsList.forEach((e) => {
119
129
  const equalSignIndex = e.indexOf('=');
120
- let argName = e.slice(0, equalSignIndex);
121
- let argValue = e.slice(equalSignIndex + 1);
130
+ let argName = e.slice(0, equalSignIndex).trim();
131
+ let argValue = e.slice(equalSignIndex + 1).trim();
122
132
  if (equalSignIndex < 0) {
123
- argName = e;
133
+ argName = e.trim();
124
134
  argValue = undefined;
125
135
  }
126
136
  // 判断是不是语音参数
@@ -181,7 +191,7 @@ var webgalParser = (function (exports) {
181
191
  };
182
192
  }
183
193
  // 截取命令
184
- const getCommandResult = /:/.exec(newSentenceRaw);
194
+ const getCommandResult = /\s*:\s*/.exec(newSentenceRaw);
185
195
  // 没有command
186
196
  if (getCommandResult === null) {
187
197
  command = '';
@@ -303,12 +313,12 @@ var webgalParser = (function (exports) {
303
313
  }
304
314
  };
305
315
  function getChooseContent(contentRaw, assetSetter) {
306
- const chooseList = contentRaw.split('|');
316
+ const chooseList = contentRaw.split(/(?<!\\)\|/);
307
317
  const chooseKeyList = [];
308
318
  const chooseValueList = [];
309
319
  for (const e of chooseList) {
310
- chooseKeyList.push(e.split(':')[0] ?? '');
311
- chooseValueList.push(e.split(':')[1] ?? '');
320
+ chooseKeyList.push(e.split(/(?<!\\):/)[0] ?? '');
321
+ chooseValueList.push(e.split(/(?<!\\):/)[1] ?? '');
312
322
  }
313
323
  const parsedChooseList = chooseValueList.map((e) => {
314
324
  if (e.match(/\./)) {
@@ -436,14 +446,16 @@ var webgalParser = (function (exports) {
436
446
  let commandRaw;
437
447
  // 正式开始解析
438
448
  // 去分号
439
- let newSentenceRaw = sentenceRaw.split(/(?<!\\);/)[0];
449
+ const commentSplit = sentenceRaw.split(/(?<!\\);/);
450
+ let newSentenceRaw = commentSplit[0].trim();
440
451
  newSentenceRaw = newSentenceRaw.replaceAll('\\;', ';');
452
+ const sentenceComment = commentSplit[1] ?? '';
441
453
  if (newSentenceRaw === '') {
442
454
  // 注释提前返回
443
455
  return {
444
456
  command: commandType.comment,
445
457
  commandRaw: 'comment',
446
- content: sentenceRaw.split(';')[1] ?? '',
458
+ content: sentenceComment.trim(),
447
459
  args: [{ key: 'next', value: true }],
448
460
  sentenceAssets: [],
449
461
  subScene: [], // 语句携带的子场景
@@ -1760,7 +1772,7 @@ var webgalParser = (function (exports) {
1760
1772
  * @return {IScene} 解析后的场景
1761
1773
  */
1762
1774
  const sceneParser = (rawScene, sceneName, sceneUrl, assetsPrefetcher, assetSetter, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG_MAP) => {
1763
- const rawSentenceList = rawScene.split('\n'); // 原始句子列表
1775
+ const rawSentenceList = rawScene.replaceAll('\r', '').split('\n'); // 原始句子列表
1764
1776
  // 去分号留到后面去做了,现在注释要单独处理
1765
1777
  const rawSentenceListWithoutEmpty = rawSentenceList;
1766
1778
  // .map((sentence) => sentence.split(";")[0])
@@ -1816,6 +1828,198 @@ var webgalParser = (function (exports) {
1816
1828
  return [result, specialRules.trim()];
1817
1829
  }
1818
1830
 
1831
+ /**
1832
+ * Preprocessor for scene text.
1833
+ *
1834
+ * Use two-pass to generate a new scene text that concats multiline sequences
1835
+ * into a single line and add placeholder lines to preserve the original number
1836
+ * of lines.
1837
+ *
1838
+ * @param sceneText The original scene text
1839
+ * @returns The processed scene text
1840
+ */
1841
+ function sceneTextPreProcess(sceneText) {
1842
+ let lines = sceneText.replaceAll('\r', '').split('\n');
1843
+ lines = sceneTextPreProcessPassOne(lines);
1844
+ lines = sceneTextPreProcessPassTwo(lines);
1845
+ return lines.join('\n');
1846
+ }
1847
+ /**
1848
+ * Pass one.
1849
+ *
1850
+ * Add escape character to all lines that should be multiline.
1851
+ *
1852
+ * @param lines The original lines
1853
+ * @returns The processed lines
1854
+ */
1855
+ function sceneTextPreProcessPassOne(lines) {
1856
+ const processedLines = [];
1857
+ let lastLineIsMultiline = false;
1858
+ let thisLineIsMultiline = false;
1859
+ for (const line of lines) {
1860
+ thisLineIsMultiline = false;
1861
+ if (canBeMultiline(line)) {
1862
+ thisLineIsMultiline = true;
1863
+ }
1864
+ if (shouldNotBeMultiline(line, lastLineIsMultiline)) {
1865
+ thisLineIsMultiline = false;
1866
+ }
1867
+ if (thisLineIsMultiline) {
1868
+ processedLines[processedLines.length - 1] += '\\';
1869
+ }
1870
+ processedLines.push(line);
1871
+ lastLineIsMultiline = thisLineIsMultiline;
1872
+ }
1873
+ return processedLines;
1874
+ }
1875
+ function canBeMultiline(line) {
1876
+ if (!line.startsWith(' ')) {
1877
+ return false;
1878
+ }
1879
+ const trimmedLine = line.trimStart();
1880
+ return trimmedLine.startsWith('|') || trimmedLine.startsWith('-');
1881
+ }
1882
+ /**
1883
+ * Logic to check if a line should not be multiline.
1884
+ *
1885
+ * @param line The line to check
1886
+ * @returns If the line should not be multiline
1887
+ */
1888
+ function shouldNotBeMultiline(line, lastLineIsMultiline) {
1889
+ if (!lastLineIsMultiline && isEmptyLine(line)) {
1890
+ return true;
1891
+ }
1892
+ // Custom logic: if the line contains -concat, it should not be multiline
1893
+ if (line.indexOf('-concat') !== -1) {
1894
+ return true;
1895
+ }
1896
+ return false;
1897
+ }
1898
+ function isEmptyLine(line) {
1899
+ return line.trim() === '';
1900
+ }
1901
+ /**
1902
+ * Pass two.
1903
+ *
1904
+ * Traverse the lines to
1905
+ * - remove escape characters
1906
+ * - add placeholder lines to preserve the original number of lines.
1907
+ *
1908
+ * @param lines The lines in pass one
1909
+ * @returns The processed lines
1910
+ */
1911
+ function sceneTextPreProcessPassTwo(lines) {
1912
+ const processedLines = [];
1913
+ let currentMultilineContent = "";
1914
+ let placeHolderLines = [];
1915
+ function concat(line) {
1916
+ let trimmed = line.trim();
1917
+ if (trimmed.startsWith('-')) {
1918
+ trimmed = " " + trimmed;
1919
+ }
1920
+ currentMultilineContent = currentMultilineContent + trimmed;
1921
+ placeHolderLines.push(placeholderLine(line));
1922
+ }
1923
+ for (const line of lines) {
1924
+ console.log(line);
1925
+ if (line.endsWith('\\')) {
1926
+ const trueLine = line.slice(0, -1);
1927
+ if (currentMultilineContent === "") {
1928
+ // first line
1929
+ currentMultilineContent = trueLine;
1930
+ }
1931
+ else {
1932
+ // middle line
1933
+ concat(trueLine);
1934
+ }
1935
+ continue;
1936
+ }
1937
+ if (currentMultilineContent !== "") {
1938
+ // end line
1939
+ concat(line);
1940
+ processedLines.push(currentMultilineContent);
1941
+ processedLines.push(...placeHolderLines);
1942
+ placeHolderLines = [];
1943
+ currentMultilineContent = "";
1944
+ continue;
1945
+ }
1946
+ processedLines.push(line);
1947
+ }
1948
+ return processedLines;
1949
+ }
1950
+ /**
1951
+ * Placeholder Line. Adding this line preserves the original number of lines
1952
+ * in the scene text, so that it can be compatible with the graphical editor.
1953
+ *
1954
+ * @param content The original content on this line
1955
+ * @returns The placeholder line
1956
+ */
1957
+ function placeholderLine(content = "") {
1958
+ return ";_WEBGAL_LINE_BREAK_" + content;
1959
+ }
1960
+ // export function sceneTextPreProcess(sceneText: string): string {
1961
+ // const lines = sceneText.replaceAll('\r', '').split('\n');
1962
+ // const processedLines: string[] = [];
1963
+ // let lastNonMultilineIndex = -1;
1964
+ // let isInMultilineSequence = false;
1965
+ // function isMultiline(line: string): boolean {
1966
+ // if (!line.startsWith(' ')) return false;
1967
+ // const trimmedLine = line.trimStart();
1968
+ // return trimmedLine.startsWith('|') || trimmedLine.startsWith('-');
1969
+ // }
1970
+ // for (let i = 0; i < lines.length; i++) {
1971
+ // const line = lines[i];
1972
+ // if (line.trim() === '') {
1973
+ // // Empty line handling
1974
+ // if (isInMultilineSequence) {
1975
+ // // Check if the next line is a multiline line
1976
+ // let isStillInMulti = false;
1977
+ // for (let j = i + 1; j < lines.length; j++) {
1978
+ // const lookForwardLine = lines[j] || '';
1979
+ // // 遇到正常语句了,直接中断
1980
+ // if (lookForwardLine.trim() !== '' && !isMultiline(lookForwardLine)) {
1981
+ // isStillInMulti = false;
1982
+ // break;
1983
+ // }
1984
+ // // 必须找到后面接的是参数,并且中间没有遇到任何正常语句才行
1985
+ // if (lookForwardLine.trim() !== '' && isMultiline(lookForwardLine)) {
1986
+ // isStillInMulti = true;
1987
+ // break;
1988
+ // }
1989
+ // }
1990
+ // if (isStillInMulti) {
1991
+ // // Still within a multiline sequence
1992
+ // processedLines.push(';_WEBGAL_LINE_BREAK_');
1993
+ // } else {
1994
+ // // End of multiline sequence
1995
+ // isInMultilineSequence = false;
1996
+ // processedLines.push(line);
1997
+ // }
1998
+ // } else {
1999
+ // // Preserve empty lines outside of multiline sequences
2000
+ // processedLines.push(line);
2001
+ // }
2002
+ // } else if (isMultiline(line)) {
2003
+ // // Multiline statement handling
2004
+ // if (lastNonMultilineIndex >= 0) {
2005
+ // // Concatenate to the previous non-multiline statement
2006
+ // const trimedLine = line.trimStart();
2007
+ // const addBlank = trimedLine.startsWith('-') ? ' ' : '';
2008
+ // processedLines[lastNonMultilineIndex] += addBlank + trimedLine;
2009
+ // }
2010
+ // // Add the special comment line
2011
+ // processedLines.push(';_WEBGAL_LINE_BREAK_' + line);
2012
+ // isInMultilineSequence = true;
2013
+ // } else {
2014
+ // // Non-multiline statement handling
2015
+ // processedLines.push(line);
2016
+ // lastNonMultilineIndex = processedLines.length - 1;
2017
+ // isInMultilineSequence = false;
2018
+ // }
2019
+ // }
2020
+ // return processedLines.join('\n');
2021
+ // }
2022
+
1819
2023
  class SceneParser {
1820
2024
  assetsPrefetcher;
1821
2025
  assetSetter;
@@ -1862,6 +2066,7 @@ var webgalParser = (function (exports) {
1862
2066
  exports.ADD_NEXT_ARG_LIST = ADD_NEXT_ARG_LIST;
1863
2067
  exports.SCRIPT_CONFIG = SCRIPT_CONFIG;
1864
2068
  exports.default = SceneParser;
2069
+ exports.sceneTextPreProcess = sceneTextPreProcess;
1865
2070
 
1866
2071
  Object.defineProperty(exports, '__esModule', { value: true });
1867
2072
 
package/package.json CHANGED
@@ -1,14 +1,16 @@
1
1
  {
2
2
  "name": "webgal-parser",
3
- "version": "4.5.2",
3
+ "version": "4.5.16",
4
4
  "description": "WebGAL script parser",
5
5
  "scripts": {
6
6
  "test": "vitest",
7
7
  "coverage": "vitest run --coverage",
8
8
  "build": "rimraf -rf ./build && rollup --config",
9
+ "prepublishOnly": "npm run build",
9
10
  "build-ci": "rollup --config",
10
11
  "debug": "tsx test/debug.ts",
11
- "debug-scss-parser": "tsx test/debugCssParser.ts"
12
+ "debug-scss-parser": "tsx test/debugCssParser.ts",
13
+ "debug-linebreak-parser": "tsx test/debug-linebreak.ts"
12
14
  },
13
15
  "types": "./build/types/index.d.ts",
14
16
  "module": "./build/es/index.js",
@@ -29,7 +31,7 @@
29
31
  "@types/lodash": "^4.14.189",
30
32
  "@types/node": "^18.14.0",
31
33
  "@vitest/coverage-c8": "^0.28.5",
32
- "rollup": "^3.3.0",
34
+ "rollup": "^3.29.5",
33
35
  "rollup-plugin-babel": "^4.4.0",
34
36
  "rollup-plugin-terser": "^7.0.2",
35
37
  "rollup-plugin-typescript2": "^0.34.1",
@@ -1,49 +1,58 @@
1
1
  import {commandType} from '../interface/sceneInterface';
2
2
 
3
3
  export const SCRIPT_CONFIG = [
4
- { scriptString: 'intro', scriptType: commandType.intro },
4
+ { scriptString: 'say', scriptType: commandType.say },
5
5
  { scriptString: 'changeBg', scriptType: commandType.changeBg },
6
6
  { scriptString: 'changeFigure', scriptType: commandType.changeFigure },
7
+ { scriptString: 'bgm', scriptType: commandType.bgm },
8
+ { scriptString: 'playVideo', scriptType: commandType.video },
9
+ { scriptString: 'pixiPerform', scriptType: commandType.pixi },
10
+ { scriptString: 'pixiInit', scriptType: commandType.pixiInit },
11
+ { scriptString: 'intro', scriptType: commandType.intro },
7
12
  { scriptString: 'miniAvatar', scriptType: commandType.miniAvatar },
8
13
  { scriptString: 'changeScene', scriptType: commandType.changeScene },
9
14
  { scriptString: 'choose', scriptType: commandType.choose },
10
15
  { scriptString: 'end', scriptType: commandType.end },
11
- { scriptString: 'bgm', scriptType: commandType.bgm },
12
- { scriptString: 'playVideo', scriptType: commandType.video },
13
16
  {
14
17
  scriptString: 'setComplexAnimation',
15
18
  scriptType: commandType.setComplexAnimation,
16
19
  },
17
20
  { scriptString: 'setFilter', scriptType: commandType.setFilter },
18
- { scriptString: 'pixiInit', scriptType: commandType.pixiInit },
19
- { scriptString: 'pixiPerform', scriptType: commandType.pixi },
20
21
  { scriptString: 'label', scriptType: commandType.label },
21
22
  { scriptString: 'jumpLabel', scriptType: commandType.jumpLabel },
23
+ { scriptString: 'chooseLabel', scriptType: commandType.chooseLabel },
22
24
  { scriptString: 'setVar', scriptType: commandType.setVar },
25
+ { scriptString: 'if', scriptType: commandType.if },
23
26
  { scriptString: 'callScene', scriptType: commandType.callScene },
24
27
  { scriptString: 'showVars', scriptType: commandType.showVars },
25
28
  { scriptString: 'unlockCg', scriptType: commandType.unlockCg },
26
29
  { scriptString: 'unlockBgm', scriptType: commandType.unlockBgm },
27
- { scriptString: 'say', scriptType: commandType.say },
28
30
  { scriptString: 'filmMode', scriptType: commandType.filmMode },
29
- { scriptString: 'callScene', scriptType: commandType.callScene },
30
31
  { scriptString: 'setTextbox', scriptType: commandType.setTextbox },
31
32
  { scriptString: 'setAnimation', scriptType: commandType.setAnimation },
32
33
  { scriptString: 'playEffect', scriptType: commandType.playEffect },
34
+ { scriptString: 'setTempAnimation', scriptType: commandType.setTempAnimation },
35
+ // comment?
36
+ { scriptString: 'setTransform', scriptType: commandType.setTransform },
37
+ { scriptString: 'setTransition', scriptType: commandType.setTransition },
38
+ { scriptString: 'getUserInput', scriptType: commandType.getUserInput },
33
39
  { scriptString: 'applyStyle', scriptType: commandType.applyStyle },
40
+ { scriptString: 'wait', scriptType: commandType.wait },
34
41
  ];
35
42
  export const ADD_NEXT_ARG_LIST = [
36
43
  commandType.bgm,
37
44
  commandType.pixi,
38
45
  commandType.pixiInit,
46
+ commandType.miniAvatar,
39
47
  commandType.label,
40
48
  commandType.if,
41
- commandType.miniAvatar,
42
49
  commandType.setVar,
43
- commandType.unlockBgm,
44
50
  commandType.unlockCg,
51
+ commandType.unlockBgm,
45
52
  commandType.filmMode,
46
53
  commandType.playEffect,
54
+ commandType.setTransition,
55
+ commandType.applyStyle,
47
56
  ];
48
57
 
49
58
  export type ConfigMap = Map<string, ConfigItem>;
@@ -26,7 +26,7 @@ function configLineParser(inputLine: string): IConfigItem {
26
26
  };
27
27
  }
28
28
  // 截取命令
29
- const getCommandResult = /:/.exec(newSentenceRaw);
29
+ const getCommandResult = /\s*:\s*/.exec(newSentenceRaw);
30
30
 
31
31
  // 没有command
32
32
  if (getCommandResult === null) {
package/src/index.ts CHANGED
@@ -8,7 +8,8 @@ import { configParser, WebgalConfig } from './configParser/configParser';
8
8
  import { fileType } from './interface/assets';
9
9
  import { IAsset } from './interface/sceneInterface';
10
10
  import { sceneParser } from './sceneParser';
11
- import {IWebGALStyleObj, scss2cssinjsParser} from "./styleParser";
11
+ import { IWebGALStyleObj, scss2cssinjsParser } from "./styleParser";
12
+ import { sceneTextPreProcess } from "./sceneTextPreProcessor";
12
13
 
13
14
  export default class SceneParser {
14
15
  private readonly SCRIPT_CONFIG_MAP: ConfigMap;
@@ -76,3 +77,4 @@ export default class SceneParser {
76
77
  }
77
78
 
78
79
  export { ADD_NEXT_ARG_LIST, SCRIPT_CONFIG };
80
+ export { sceneTextPreProcess };
@@ -7,3 +7,9 @@ export interface sceneEntry {
7
7
  sceneUrl: string; // 场景url
8
8
  continueLine: number; // 继续原场景的行号
9
9
  }
10
+
11
+ /**
12
+ * 场景栈条目接口 (兼容性别名)
13
+ * @interface ISceneEntry
14
+ */
15
+ export interface ISceneEntry extends sceneEntry {}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 语句类型
3
3
  */
4
- import { sceneEntry } from './runtimeInterface';
4
+ import { sceneEntry, ISceneEntry } from './runtimeInterface';
5
5
  import { fileType } from './assets';
6
6
 
7
7
  export enum commandType {
@@ -37,7 +37,8 @@ export enum commandType {
37
37
  setTransform,
38
38
  setTransition,
39
39
  getUserInput,
40
- applyStyle
40
+ applyStyle,
41
+ wait,
41
42
  }
42
43
 
43
44
  /**
@@ -91,7 +92,7 @@ export interface IScene {
91
92
  */
92
93
  export interface ISceneData {
93
94
  currentSentenceId: number; // 当前语句ID
94
- sceneStack: Array<sceneEntry>; // 场景栈
95
+ sceneStack: Array<ISceneEntry>; // 场景栈
95
96
  currentScene: IScene; // 当前场景数据
96
97
  }
97
98
 
@@ -29,7 +29,7 @@ export const sceneParser = (
29
29
  ADD_NEXT_ARG_LIST: commandType[],
30
30
  SCRIPT_CONFIG_MAP: ConfigMap,
31
31
  ): IScene => {
32
- const rawSentenceList = rawScene.split('\n'); // 原始句子列表
32
+ const rawSentenceList = rawScene.replaceAll('\r', '').split('\n'); // 原始句子列表
33
33
 
34
34
  // 去分号留到后面去做了,现在注释要单独处理
35
35
  const rawSentenceListWithoutEmpty = rawSentenceList;