webgal-parser 4.3.13 → 4.4.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.
Files changed (51) hide show
  1. package/build/cjs/config/scriptConfig.d.ts +1 -1
  2. package/build/cjs/configParser/configParser.d.ts +1 -0
  3. package/build/cjs/index.d.ts +5 -2
  4. package/build/cjs/index.js +1148 -17042
  5. package/build/cjs/interface/sceneInterface.d.ts +3 -1
  6. package/build/cjs/parser4/index.d.ts +1 -0
  7. package/build/cjs/scriptParser/subSceneScanner.d.ts +1 -1
  8. package/build/es/config/scriptConfig.d.ts +1 -1
  9. package/build/es/configParser/configParser.d.ts +1 -0
  10. package/build/es/index.d.ts +5 -2
  11. package/build/es/index.js +1147 -17043
  12. package/build/es/interface/sceneInterface.d.ts +3 -1
  13. package/build/es/parser4/index.d.ts +1 -0
  14. package/build/es/scriptParser/subSceneScanner.d.ts +1 -1
  15. package/build/types/config/scriptConfig.d.ts +6 -0
  16. package/build/types/configParser/configParser.d.ts +1 -0
  17. package/build/types/index.d.ts +13 -0
  18. package/build/types/interface/assets.d.ts +12 -0
  19. package/build/types/interface/runtimeInterface.d.ts +9 -0
  20. package/build/types/interface/sceneInterface.d.ts +96 -0
  21. package/build/types/parser4/index.d.ts +1 -0
  22. package/build/types/sceneParser.d.ts +14 -0
  23. package/build/types/scriptParser/argsParser.d.ts +9 -0
  24. package/build/types/scriptParser/assetsScanner.d.ts +9 -0
  25. package/build/types/scriptParser/commandParser.d.ts +9 -0
  26. package/build/types/scriptParser/contentParser.d.ts +9 -0
  27. package/build/types/scriptParser/scriptParser.d.ts +9 -0
  28. package/build/types/scriptParser/subSceneScanner.d.ts +7 -0
  29. package/build/umd/index.global.js +1776 -0
  30. package/package.json +9 -4
  31. package/src/config/scriptConfig.ts +46 -44
  32. package/src/configParser/configParser.ts +4 -0
  33. package/src/index.ts +12 -4
  34. package/src/interface/assets.ts +12 -12
  35. package/src/interface/runtimeInterface.ts +9 -9
  36. package/src/interface/sceneInterface.ts +5 -3
  37. package/src/parser4/index.ts +158 -0
  38. package/src/sceneParser.ts +47 -47
  39. package/src/scriptParser/argsParser.ts +68 -62
  40. package/src/scriptParser/assetsScanner.ts +72 -72
  41. package/src/scriptParser/commandParser.ts +57 -57
  42. package/src/scriptParser/contentParser.ts +66 -66
  43. package/src/scriptParser/scriptParser.ts +87 -87
  44. package/src/scriptParser/subSceneScanner.ts +23 -23
  45. package/.babelrc +0 -14
  46. package/build/cjs/index.js.map +0 -1
  47. package/build/es/index.js.map +0 -1
  48. package/rollup.config.js +0 -48
  49. package/test/parser.test.ts +0 -130
  50. package/tsconfig.json +0 -29
  51. package/tsconfig.node.json +0 -10
@@ -32,7 +32,9 @@ export declare enum commandType {
32
32
  setAnimation = 25,
33
33
  playEffect = 26,
34
34
  setTempAnimation = 27,
35
- comment = 28
35
+ comment = 28,
36
+ setTransform = 29,
37
+ setTransition = 30
36
38
  }
37
39
  /**
38
40
  * 单个参数接口
@@ -0,0 +1 @@
1
+ export declare const parser4 = "unreleased";
@@ -3,5 +3,5 @@
3
3
  * @param content 语句内容
4
4
  * @return {Array<string>} 子场景列表
5
5
  */
6
- import { commandType } from '../interface/sceneInterface';
6
+ import { commandType } from "../interface/sceneInterface";
7
7
  export declare const subSceneScanner: (command: commandType, content: string) => Array<string>;
@@ -0,0 +1,6 @@
1
+ import { commandType } from "../interface/sceneInterface";
2
+ export declare const SCRIPT_CONFIG: {
3
+ scriptString: string;
4
+ scriptType: commandType;
5
+ }[];
6
+ export declare const ADD_NEXT_ARG_LIST: commandType[];
@@ -0,0 +1 @@
1
+ export declare function configParser(configText: string): string;
@@ -0,0 +1,13 @@
1
+ import { IAsset } from "./interface/sceneInterface";
2
+ import { fileType } from "./interface/assets";
3
+ import { ADD_NEXT_ARG_LIST, SCRIPT_CONFIG } from "./config/scriptConfig";
4
+ export default class SceneParser {
5
+ private readonly assetsPrefetcher;
6
+ private readonly assetSetter;
7
+ private readonly ADD_NEXT_ARG_LIST;
8
+ private readonly SCRIPT_CONFIG;
9
+ constructor(assetsPrefetcher: ((assetList: Array<IAsset>) => void), assetSetter: (fileName: string, assetType: fileType) => string, ADD_NEXT_ARG_LIST: Array<number>, SCRIPT_CONFIG: Array<any>);
10
+ parse(rawScene: string, sceneName: string, sceneUrl: string): import("./interface/sceneInterface").IScene;
11
+ parseConfig(configText: string): string;
12
+ }
13
+ export { ADD_NEXT_ARG_LIST, SCRIPT_CONFIG };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * 内置资源类型的枚举
3
+ */
4
+ export declare enum fileType {
5
+ background = 0,
6
+ bgm = 1,
7
+ figure = 2,
8
+ scene = 3,
9
+ tex = 4,
10
+ vocal = 5,
11
+ video = 6
12
+ }
@@ -0,0 +1,9 @@
1
+ /**
2
+ * 子场景结束后回到父场景的入口
3
+ * @interface sceneEntry
4
+ */
5
+ export interface sceneEntry {
6
+ sceneName: string;
7
+ sceneUrl: string;
8
+ continueLine: number;
9
+ }
@@ -0,0 +1,96 @@
1
+ /**
2
+ * 语句类型
3
+ */
4
+ import { sceneEntry } from "./runtimeInterface";
5
+ import { fileType } from "./assets";
6
+ export declare enum commandType {
7
+ say = 0,
8
+ changeBg = 1,
9
+ changeFigure = 2,
10
+ bgm = 3,
11
+ video = 4,
12
+ pixi = 5,
13
+ pixiInit = 6,
14
+ intro = 7,
15
+ miniAvatar = 8,
16
+ changeScene = 9,
17
+ choose = 10,
18
+ end = 11,
19
+ setComplexAnimation = 12,
20
+ setFilter = 13,
21
+ label = 14,
22
+ jumpLabel = 15,
23
+ chooseLabel = 16,
24
+ setVar = 17,
25
+ if = 18,
26
+ callScene = 19,
27
+ showVars = 20,
28
+ unlockCg = 21,
29
+ unlockBgm = 22,
30
+ filmMode = 23,
31
+ setTextbox = 24,
32
+ setAnimation = 25,
33
+ playEffect = 26,
34
+ setTempAnimation = 27,
35
+ comment = 28,
36
+ setTransform = 29,
37
+ setTransition = 30
38
+ }
39
+ /**
40
+ * 单个参数接口
41
+ * @interface arg
42
+ */
43
+ export interface arg {
44
+ key: string;
45
+ value: string | boolean | number;
46
+ }
47
+ /**
48
+ * 资源接口
49
+ * @interface IAsset
50
+ */
51
+ export interface IAsset {
52
+ name: string;
53
+ type: fileType;
54
+ url: string;
55
+ lineNumber: number;
56
+ }
57
+ /**
58
+ * 单条语句接口
59
+ * @interface ISentence
60
+ */
61
+ export interface ISentence {
62
+ command: commandType;
63
+ commandRaw: string;
64
+ content: string;
65
+ args: Array<arg>;
66
+ sentenceAssets: Array<IAsset>;
67
+ subScene: Array<string>;
68
+ }
69
+ /**
70
+ * 场景接口
71
+ * @interface IScene
72
+ */
73
+ export interface IScene {
74
+ sceneName: string;
75
+ sceneUrl: string;
76
+ sentenceList: Array<ISentence>;
77
+ assetsList: Array<IAsset>;
78
+ subSceneList: Array<string>;
79
+ }
80
+ /**
81
+ * 当前的场景数据
82
+ * @interface ISceneData
83
+ */
84
+ export interface ISceneData {
85
+ currentSentenceId: number;
86
+ sceneStack: Array<sceneEntry>;
87
+ currentScene: IScene;
88
+ }
89
+ /**
90
+ * 处理后的命令接口
91
+ * @interface parsedCommand
92
+ */
93
+ export interface parsedCommand {
94
+ type: commandType;
95
+ additionalArgs: Array<arg>;
96
+ }
@@ -0,0 +1 @@
1
+ export declare const parser4 = "unreleased";
@@ -0,0 +1,14 @@
1
+ import { IAsset, IScene } from "./interface/sceneInterface";
2
+ import { fileType } from "./interface/assets";
3
+ /**
4
+ * 场景解析器
5
+ * @param rawScene 原始场景
6
+ * @param sceneName 场景名称
7
+ * @param sceneUrl 场景url
8
+ * @param assetsPrefetcher
9
+ * @param assetSetter
10
+ * @param ADD_NEXT_ARG_LIST
11
+ * @param SCRIPT_CONFIG
12
+ * @return {IScene} 解析后的场景
13
+ */
14
+ export declare const sceneParser: (rawScene: string, sceneName: string, sceneUrl: string, assetsPrefetcher: (assetList: Array<IAsset>) => void, assetSetter: (fileName: string, assetType: fileType) => string, ADD_NEXT_ARG_LIST: any, SCRIPT_CONFIG: any) => IScene;
@@ -0,0 +1,9 @@
1
+ import { arg } from "../interface/sceneInterface";
2
+ import { fileType } from "../interface/assets";
3
+ /**
4
+ * 参数解析器
5
+ * @param argsRaw 原始参数字符串
6
+ * @param assetSetter
7
+ * @return {Array<arg>} 解析后的参数列表
8
+ */
9
+ export declare function argsParser(argsRaw: string, assetSetter: (fileName: string, assetType: fileType) => string): Array<arg>;
@@ -0,0 +1,9 @@
1
+ import { arg, commandType, IAsset } from '../interface/sceneInterface';
2
+ /**
3
+ * 根据语句类型、语句内容、参数列表,扫描该语句可能携带的资源
4
+ * @param command 语句类型
5
+ * @param content 语句内容
6
+ * @param args 参数列表
7
+ * @return {Array<IAsset>} 语句携带的参数列表
8
+ */
9
+ export declare const assetsScanner: (command: commandType, content: string, args: Array<arg>) => Array<IAsset>;
@@ -0,0 +1,9 @@
1
+ import { parsedCommand } from "../interface/sceneInterface";
2
+ /**
3
+ * 处理命令
4
+ * @param commandRaw
5
+ * @param ADD_NEXT_ARG_LIST
6
+ * @param SCRIPT_CONFIG
7
+ * @return {parsedCommand} 处理后的命令
8
+ */
9
+ export declare const commandParser: (commandRaw: string, ADD_NEXT_ARG_LIST: any, SCRIPT_CONFIG: any) => parsedCommand;
@@ -0,0 +1,9 @@
1
+ import { commandType } from "../interface/sceneInterface";
2
+ /**
3
+ * 解析语句内容的函数,主要作用是把文件名改为绝对地址或相对地址(根据使用情况而定)
4
+ * @param contentRaw 原始语句内容
5
+ * @param type 语句类型
6
+ * @param assetSetter
7
+ * @return {string} 解析后的语句内容
8
+ */
9
+ export declare const contentParser: (contentRaw: string, type: commandType, assetSetter: any) => any;
@@ -0,0 +1,9 @@
1
+ import { ISentence } from "../interface/sceneInterface";
2
+ /**
3
+ * 语句解析器
4
+ * @param sentenceRaw 原始语句
5
+ * @param assetSetter
6
+ * @param ADD_NEXT_ARG_LIST
7
+ * @param SCRIPT_CONFIG
8
+ */
9
+ export declare const scriptParser: (sentenceRaw: string, assetSetter: any, ADD_NEXT_ARG_LIST: any, SCRIPT_CONFIG: any) => ISentence;
@@ -0,0 +1,7 @@
1
+ /**
2
+ * 扫描子场景
3
+ * @param content 语句内容
4
+ * @return {Array<string>} 子场景列表
5
+ */
6
+ import { commandType } from "../interface/sceneInterface";
7
+ export declare const subSceneScanner: (command: commandType, content: string) => Array<string>;