webgal-parser 4.5.16 → 4.5.18

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.
@@ -38,6 +38,7 @@ var commandType;
38
38
  commandType[commandType["getUserInput"] = 31] = "getUserInput";
39
39
  commandType[commandType["applyStyle"] = 32] = "applyStyle";
40
40
  commandType[commandType["wait"] = 33] = "wait";
41
+ commandType[commandType["callSteam"] = 34] = "callSteam";
41
42
  })(commandType || (commandType = {}));
42
43
 
43
44
  const SCRIPT_CONFIG = [
@@ -78,6 +79,7 @@ const SCRIPT_CONFIG = [
78
79
  { scriptString: 'getUserInput', scriptType: commandType.getUserInput },
79
80
  { scriptString: 'applyStyle', scriptType: commandType.applyStyle },
80
81
  { scriptString: 'wait', scriptType: commandType.wait },
82
+ { scriptString: 'callSteam', scriptType: commandType.callSteam },
81
83
  ];
82
84
  const ADD_NEXT_ARG_LIST = [
83
85
  commandType.bgm,
@@ -93,6 +95,7 @@ const ADD_NEXT_ARG_LIST = [
93
95
  commandType.playEffect,
94
96
  commandType.setTransition,
95
97
  commandType.applyStyle,
98
+ commandType.callSteam,
96
99
  ];
97
100
 
98
101
  /**
@@ -448,10 +451,10 @@ const scriptParser = (sentenceRaw, assetSetter, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG
448
451
  // 正式开始解析
449
452
  // 去分号
450
453
  const commentSplit = sentenceRaw.split(/(?<!\\);/);
451
- let newSentenceRaw = commentSplit[0].trim();
454
+ let newSentenceRaw = commentSplit[0];
452
455
  newSentenceRaw = newSentenceRaw.replaceAll('\\;', ';');
453
456
  const sentenceComment = commentSplit[1] ?? '';
454
- if (newSentenceRaw === '') {
457
+ if (newSentenceRaw.trim() === '') {
455
458
  // 注释提前返回
456
459
  return {
457
460
  command: commandType.comment,
@@ -459,7 +462,8 @@ const scriptParser = (sentenceRaw, assetSetter, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG
459
462
  content: sentenceComment.trim(),
460
463
  args: [{ key: 'next', value: true }],
461
464
  sentenceAssets: [],
462
- subScene: [], // 语句携带的子场景
465
+ subScene: [],
466
+ inlineComment: '', // 行内注释
463
467
  };
464
468
  }
465
469
  // 截取命令
@@ -509,7 +513,8 @@ const scriptParser = (sentenceRaw, assetSetter, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG
509
513
  content: content,
510
514
  args: args,
511
515
  sentenceAssets: sentenceAssets,
512
- subScene: subScene, // 语句携带的子场景
516
+ subScene: subScene,
517
+ inlineComment: sentenceComment.trim(), // 行内注释
513
518
  };
514
519
  };
515
520
 
@@ -37,7 +37,8 @@ export declare enum commandType {
37
37
  setTransition = 30,
38
38
  getUserInput = 31,
39
39
  applyStyle = 32,
40
- wait = 33
40
+ wait = 33,
41
+ callSteam = 34
41
42
  }
42
43
  /**
43
44
  * 单个参数接口
@@ -68,6 +69,7 @@ export interface ISentence {
68
69
  args: Array<arg>;
69
70
  sentenceAssets: Array<IAsset>;
70
71
  subScene: Array<string>;
72
+ inlineComment: string;
71
73
  }
72
74
  /**
73
75
  * 场景接口
package/build/es/index.js CHANGED
@@ -34,6 +34,7 @@ var commandType;
34
34
  commandType[commandType["getUserInput"] = 31] = "getUserInput";
35
35
  commandType[commandType["applyStyle"] = 32] = "applyStyle";
36
36
  commandType[commandType["wait"] = 33] = "wait";
37
+ commandType[commandType["callSteam"] = 34] = "callSteam";
37
38
  })(commandType || (commandType = {}));
38
39
 
39
40
  const SCRIPT_CONFIG = [
@@ -74,6 +75,7 @@ const SCRIPT_CONFIG = [
74
75
  { scriptString: 'getUserInput', scriptType: commandType.getUserInput },
75
76
  { scriptString: 'applyStyle', scriptType: commandType.applyStyle },
76
77
  { scriptString: 'wait', scriptType: commandType.wait },
78
+ { scriptString: 'callSteam', scriptType: commandType.callSteam },
77
79
  ];
78
80
  const ADD_NEXT_ARG_LIST = [
79
81
  commandType.bgm,
@@ -89,6 +91,7 @@ const ADD_NEXT_ARG_LIST = [
89
91
  commandType.playEffect,
90
92
  commandType.setTransition,
91
93
  commandType.applyStyle,
94
+ commandType.callSteam,
92
95
  ];
93
96
 
94
97
  /**
@@ -444,10 +447,10 @@ const scriptParser = (sentenceRaw, assetSetter, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG
444
447
  // 正式开始解析
445
448
  // 去分号
446
449
  const commentSplit = sentenceRaw.split(/(?<!\\);/);
447
- let newSentenceRaw = commentSplit[0].trim();
450
+ let newSentenceRaw = commentSplit[0];
448
451
  newSentenceRaw = newSentenceRaw.replaceAll('\\;', ';');
449
452
  const sentenceComment = commentSplit[1] ?? '';
450
- if (newSentenceRaw === '') {
453
+ if (newSentenceRaw.trim() === '') {
451
454
  // 注释提前返回
452
455
  return {
453
456
  command: commandType.comment,
@@ -455,7 +458,8 @@ const scriptParser = (sentenceRaw, assetSetter, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG
455
458
  content: sentenceComment.trim(),
456
459
  args: [{ key: 'next', value: true }],
457
460
  sentenceAssets: [],
458
- subScene: [], // 语句携带的子场景
461
+ subScene: [],
462
+ inlineComment: '', // 行内注释
459
463
  };
460
464
  }
461
465
  // 截取命令
@@ -505,7 +509,8 @@ const scriptParser = (sentenceRaw, assetSetter, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG
505
509
  content: content,
506
510
  args: args,
507
511
  sentenceAssets: sentenceAssets,
508
- subScene: subScene, // 语句携带的子场景
512
+ subScene: subScene,
513
+ inlineComment: sentenceComment.trim(), // 行内注释
509
514
  };
510
515
  };
511
516
 
@@ -37,7 +37,8 @@ export declare enum commandType {
37
37
  setTransition = 30,
38
38
  getUserInput = 31,
39
39
  applyStyle = 32,
40
- wait = 33
40
+ wait = 33,
41
+ callSteam = 34
41
42
  }
42
43
  /**
43
44
  * 单个参数接口
@@ -68,6 +69,7 @@ export interface ISentence {
68
69
  args: Array<arg>;
69
70
  sentenceAssets: Array<IAsset>;
70
71
  subScene: Array<string>;
72
+ inlineComment: string;
71
73
  }
72
74
  /**
73
75
  * 场景接口
@@ -37,7 +37,8 @@ export declare enum commandType {
37
37
  setTransition = 30,
38
38
  getUserInput = 31,
39
39
  applyStyle = 32,
40
- wait = 33
40
+ wait = 33,
41
+ callSteam = 34
41
42
  }
42
43
  /**
43
44
  * 单个参数接口
@@ -68,6 +69,7 @@ export interface ISentence {
68
69
  args: Array<arg>;
69
70
  sentenceAssets: Array<IAsset>;
70
71
  subScene: Array<string>;
72
+ inlineComment: string;
71
73
  }
72
74
  /**
73
75
  * 场景接口
@@ -37,6 +37,7 @@ var webgalParser = (function (exports) {
37
37
  commandType[commandType["getUserInput"] = 31] = "getUserInput";
38
38
  commandType[commandType["applyStyle"] = 32] = "applyStyle";
39
39
  commandType[commandType["wait"] = 33] = "wait";
40
+ commandType[commandType["callSteam"] = 34] = "callSteam";
40
41
  })(commandType || (commandType = {}));
41
42
 
42
43
  const SCRIPT_CONFIG = [
@@ -77,6 +78,7 @@ var webgalParser = (function (exports) {
77
78
  { scriptString: 'getUserInput', scriptType: commandType.getUserInput },
78
79
  { scriptString: 'applyStyle', scriptType: commandType.applyStyle },
79
80
  { scriptString: 'wait', scriptType: commandType.wait },
81
+ { scriptString: 'callSteam', scriptType: commandType.callSteam },
80
82
  ];
81
83
  const ADD_NEXT_ARG_LIST = [
82
84
  commandType.bgm,
@@ -92,6 +94,7 @@ var webgalParser = (function (exports) {
92
94
  commandType.playEffect,
93
95
  commandType.setTransition,
94
96
  commandType.applyStyle,
97
+ commandType.callSteam,
95
98
  ];
96
99
 
97
100
  /**
@@ -447,10 +450,10 @@ var webgalParser = (function (exports) {
447
450
  // 正式开始解析
448
451
  // 去分号
449
452
  const commentSplit = sentenceRaw.split(/(?<!\\);/);
450
- let newSentenceRaw = commentSplit[0].trim();
453
+ let newSentenceRaw = commentSplit[0];
451
454
  newSentenceRaw = newSentenceRaw.replaceAll('\\;', ';');
452
455
  const sentenceComment = commentSplit[1] ?? '';
453
- if (newSentenceRaw === '') {
456
+ if (newSentenceRaw.trim() === '') {
454
457
  // 注释提前返回
455
458
  return {
456
459
  command: commandType.comment,
@@ -458,7 +461,8 @@ var webgalParser = (function (exports) {
458
461
  content: sentenceComment.trim(),
459
462
  args: [{ key: 'next', value: true }],
460
463
  sentenceAssets: [],
461
- subScene: [], // 语句携带的子场景
464
+ subScene: [],
465
+ inlineComment: '', // 行内注释
462
466
  };
463
467
  }
464
468
  // 截取命令
@@ -508,7 +512,8 @@ var webgalParser = (function (exports) {
508
512
  content: content,
509
513
  args: args,
510
514
  sentenceAssets: sentenceAssets,
511
- subScene: subScene, // 语句携带的子场景
515
+ subScene: subScene,
516
+ inlineComment: sentenceComment.trim(), // 行内注释
512
517
  };
513
518
  };
514
519
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webgal-parser",
3
- "version": "4.5.16",
3
+ "version": "4.5.18",
4
4
  "description": "WebGAL script parser",
5
5
  "scripts": {
6
6
  "test": "vitest",
@@ -38,6 +38,7 @@ export const SCRIPT_CONFIG = [
38
38
  { scriptString: 'getUserInput', scriptType: commandType.getUserInput },
39
39
  { scriptString: 'applyStyle', scriptType: commandType.applyStyle },
40
40
  { scriptString: 'wait', scriptType: commandType.wait },
41
+ { scriptString: 'callSteam', scriptType: commandType.callSteam },
41
42
  ];
42
43
  export const ADD_NEXT_ARG_LIST = [
43
44
  commandType.bgm,
@@ -53,6 +54,7 @@ export const ADD_NEXT_ARG_LIST = [
53
54
  commandType.playEffect,
54
55
  commandType.setTransition,
55
56
  commandType.applyStyle,
57
+ commandType.callSteam,
56
58
  ];
57
59
 
58
60
  export type ConfigMap = Map<string, ConfigItem>;
@@ -39,6 +39,7 @@ export enum commandType {
39
39
  getUserInput,
40
40
  applyStyle,
41
41
  wait,
42
+ callSteam, // 调用Steam功能
42
43
  }
43
44
 
44
45
  /**
@@ -72,6 +73,7 @@ export interface ISentence {
72
73
  args: Array<arg>; // 参数列表
73
74
  sentenceAssets: Array<IAsset>; // 语句携带的资源列表
74
75
  subScene: Array<string>; // 语句包含子场景列表
76
+ inlineComment: string; // 行内注释
75
77
  }
76
78
 
77
79
  /**
@@ -37,10 +37,10 @@ export const scriptParser = (
37
37
 
38
38
  // 去分号
39
39
  const commentSplit = sentenceRaw.split(/(?<!\\);/);
40
- let newSentenceRaw = commentSplit[0].trim();
40
+ let newSentenceRaw = commentSplit[0];
41
41
  newSentenceRaw = newSentenceRaw.replaceAll('\\;',';');
42
42
  const sentenceComment = commentSplit[1] ?? '';
43
- if (newSentenceRaw === '') {
43
+ if (newSentenceRaw.trim() === '') {
44
44
  // 注释提前返回
45
45
  return {
46
46
  command: commandType.comment, // 语句类型
@@ -49,6 +49,7 @@ export const scriptParser = (
49
49
  args: [{ key: 'next', value: true }], // 参数列表
50
50
  sentenceAssets: [], // 语句携带的资源列表
51
51
  subScene: [], // 语句携带的子场景
52
+ inlineComment: '', // 行内注释
52
53
  };
53
54
  }
54
55
  // 截取命令
@@ -102,6 +103,7 @@ export const scriptParser = (
102
103
  args.push(e);
103
104
  }
104
105
  }
106
+
105
107
  content = contentParser(newSentenceRaw.trim(), command, assetSetter); // 将语句内容里的文件名转为相对或绝对路径
106
108
  sentenceAssets = assetsScanner(command, content, args); // 扫描语句携带资源
107
109
  subScene = subSceneScanner(command, content); // 扫描语句携带子场景
@@ -112,5 +114,6 @@ export const scriptParser = (
112
114
  args: args, // 参数列表
113
115
  sentenceAssets: sentenceAssets, // 语句携带的资源列表
114
116
  subScene: subScene, // 语句携带的子场景
117
+ inlineComment: sentenceComment.trim(), // 行内注释
115
118
  };
116
119
  };