webgal-parser 4.3.2 → 4.3.3

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.
package/index.ts CHANGED
@@ -1,17 +1,17 @@
1
- import { IAsset } from "./interface/sceneInterface";
1
+ import { commandType, IAsset } from "./interface/sceneInterface";
2
2
  import { fileType } from "./interface/assets";
3
3
  import { sceneParser } from "./sceneParser";
4
4
 
5
5
  export class SceneParser {
6
6
 
7
- private assetsPrefetcher;
8
- private assetSetter;
9
- private ADD_NEXT_ARG_LIST;
10
- private SCRIPT_CONFIG;
7
+ private readonly assetsPrefetcher;
8
+ private readonly assetSetter;
9
+ private readonly ADD_NEXT_ARG_LIST;
10
+ private readonly SCRIPT_CONFIG;
11
11
 
12
12
  constructor(assetsPrefetcher: ((assetList: Array<IAsset>) => void),
13
13
  assetSetter: (fileName: string, assetType: fileType) => string,
14
- ADD_NEXT_ARG_LIST, SCRIPT_CONFIG) {
14
+ ADD_NEXT_ARG_LIST: Array<commandType>, SCRIPT_CONFIG: Array<any>) {
15
15
  this.assetsPrefetcher = assetsPrefetcher;
16
16
  this.assetSetter = assetSetter;
17
17
  this.ADD_NEXT_ARG_LIST = ADD_NEXT_ARG_LIST;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "webgal-parser",
3
- "version": "4.3.2",
3
+ "version": "4.3.3",
4
4
  "description": "WebGAL script parser",
5
5
  "scripts": {
6
6
  "test": "node test/test.js"
package/sceneParser.ts CHANGED
@@ -16,7 +16,7 @@ import { fileType } from "./interface/assets";
16
16
  */
17
17
  export const sceneParser = (rawScene: string, sceneName: string, sceneUrl: string
18
18
  , assetsPrefetcher: ((assetList: Array<IAsset>) => void), assetSetter: (fileName: string, assetType: fileType) => string
19
- , ADD_NEXT_ARG_LIST, SCRIPT_CONFIG): IScene => {
19
+ , ADD_NEXT_ARG_LIST:any, SCRIPT_CONFIG:any): IScene => {
20
20
  const rawSentenceList = rawScene.split("\n"); // 原始句子列表
21
21
  // 去除冒号后的内容
22
22
  // 去除分号后的内容
@@ -7,7 +7,7 @@ import { commandType, parsedCommand } from "../interface/sceneInterface";
7
7
  * @param SCRIPT_CONFIG
8
8
  * @return {parsedCommand} 处理后的命令
9
9
  */
10
- export const commandParser = (commandRaw: string, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG): parsedCommand => {
10
+ export const commandParser = (commandRaw: string, ADD_NEXT_ARG_LIST:any, SCRIPT_CONFIG:any): parsedCommand => {
11
11
  let returnCommand: parsedCommand = {
12
12
  type: commandType.say, // 默认是say
13
13
  additionalArgs: []
@@ -33,12 +33,12 @@ export const commandParser = (commandRaw: string, ADD_NEXT_ARG_LIST, SCRIPT_CONF
33
33
  * @param SCRIPT_CONFIG
34
34
  * @return {commandType} 得到的command类型
35
35
  */
36
- function getCommandType(command: string, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG): commandType {
36
+ function getCommandType(command: string, ADD_NEXT_ARG_LIST:any, SCRIPT_CONFIG:any): commandType {
37
37
  // if (command.match(/if/)) {
38
38
  // return commandType.if;
39
39
  // }
40
40
  const commandMap = new Map();
41
- SCRIPT_CONFIG.forEach((e) => {
41
+ SCRIPT_CONFIG.forEach((e:any) => {
42
42
  commandMap.set(e.scriptString, e.scriptType);
43
43
  });
44
44
  if (commandMap.has(command)) {
@@ -46,7 +46,7 @@ function getCommandType(command: string, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG): comm
46
46
  } else return commandType.say;
47
47
  }
48
48
 
49
- function addNextArg(commandToParse: parsedCommand, thisCommandType: commandType, ADD_NEXT_ARG_LIST) {
49
+ function addNextArg(commandToParse: parsedCommand, thisCommandType: commandType, ADD_NEXT_ARG_LIST:any) {
50
50
  if (ADD_NEXT_ARG_LIST.includes(thisCommandType)) {
51
51
  commandToParse.additionalArgs.push({
52
52
  key: "next",
@@ -8,7 +8,7 @@ import { fileType } from "../interface/assets";
8
8
  * @param assetSetter
9
9
  * @return {string} 解析后的语句内容
10
10
  */
11
- export const contentParser = (contentRaw: string, type: commandType, assetSetter) => {
11
+ export const contentParser = (contentRaw: string, type: commandType, assetSetter:any) => {
12
12
  if (contentRaw === "none" || contentRaw === "") {
13
13
  return "";
14
14
  }
@@ -38,7 +38,7 @@ export const contentParser = (contentRaw: string, type: commandType, assetSetter
38
38
  }
39
39
  };
40
40
 
41
- function getChooseContent(contentRaw: string, assetSetter): string {
41
+ function getChooseContent(contentRaw: string, assetSetter:any): string {
42
42
  const chooseList = contentRaw.split("|");
43
43
  const chooseKeyList = [];
44
44
  const chooseValueList = [];
@@ -12,7 +12,7 @@ import { subSceneScanner } from "./subSceneScanner";
12
12
  * @param ADD_NEXT_ARG_LIST
13
13
  * @param SCRIPT_CONFIG
14
14
  */
15
- export const scriptParser = (sentenceRaw: string, assetSetter, ADD_NEXT_ARG_LIST, SCRIPT_CONFIG): ISentence => {
15
+ export const scriptParser = (sentenceRaw: string, assetSetter:any, ADD_NEXT_ARG_LIST:any, SCRIPT_CONFIG:any): ISentence => {
16
16
  let command: commandType; // 默认为对话
17
17
  let content: string; // 语句内容
18
18
  let subScene: Array<string>; // 语句携带的子场景(可能没有)
package/tsconfig.json CHANGED
@@ -10,6 +10,7 @@
10
10
  "strict": true,
11
11
  "forceConsistentCasingInFileNames": true,
12
12
  "module": "ESNext",
13
+ "noImplicitAny": false,
13
14
  "moduleResolution": "Node",
14
15
  "resolveJsonModule": true,
15
16
  "isolatedModules": true,