webgal-parser 4.3.11 → 4.3.13-10

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 (66) hide show
  1. package/build/cjs/config/scriptConfig.d.ts +6 -0
  2. package/{index.d.ts → build/cjs/index.d.ts} +12 -10
  3. package/build/cjs/index.js +1756 -0
  4. package/{interface → build/cjs/interface}/assets.d.ts +12 -12
  5. package/{interface → build/cjs/interface}/runtimeInterface.d.ts +9 -9
  6. package/{interface → build/cjs/interface}/sceneInterface.d.ts +94 -91
  7. package/{sceneParser.d.ts → build/cjs/sceneParser.d.ts} +14 -14
  8. package/{scriptParser → build/cjs/scriptParser}/argsParser.d.ts +9 -9
  9. package/{scriptParser → build/cjs/scriptParser}/assetsScanner.d.ts +9 -9
  10. package/{scriptParser → build/cjs/scriptParser}/commandParser.d.ts +9 -9
  11. package/{scriptParser → build/cjs/scriptParser}/contentParser.d.ts +9 -9
  12. package/{scriptParser → build/cjs/scriptParser}/scriptParser.d.ts +9 -9
  13. package/{scriptParser → build/cjs/scriptParser}/subSceneScanner.d.ts +7 -7
  14. package/build/es/config/scriptConfig.d.ts +6 -0
  15. package/build/es/index.d.ts +12 -0
  16. package/build/es/index.js +1750 -0
  17. package/build/es/interface/assets.d.ts +12 -0
  18. package/build/es/interface/runtimeInterface.d.ts +9 -0
  19. package/build/es/interface/sceneInterface.d.ts +94 -0
  20. package/build/es/sceneParser.d.ts +14 -0
  21. package/build/es/scriptParser/argsParser.d.ts +9 -0
  22. package/build/es/scriptParser/assetsScanner.d.ts +9 -0
  23. package/build/es/scriptParser/commandParser.d.ts +9 -0
  24. package/build/es/scriptParser/contentParser.d.ts +9 -0
  25. package/build/es/scriptParser/scriptParser.d.ts +9 -0
  26. package/build/es/scriptParser/subSceneScanner.d.ts +7 -0
  27. package/build/types/config/scriptConfig.d.ts +6 -0
  28. package/build/types/index.d.ts +2 -0
  29. package/build/types/scriptParser/subSceneScanner.d.ts +1 -1
  30. package/build/umd/index.global.js +1761 -0
  31. package/package.json +10 -5
  32. package/{config → src/config}/scriptConfig.ts +3 -1
  33. package/{index.ts → src/index.ts} +3 -0
  34. package/{sceneParser.ts → src/sceneParser.ts} +5 -5
  35. package/{scriptParser → src/scriptParser}/contentParser.ts +6 -6
  36. package/{scriptParser → src/scriptParser}/scriptParser.ts +1 -1
  37. package/{scriptParser → src/scriptParser}/subSceneScanner.ts +3 -3
  38. package/.babelrc +0 -14
  39. package/build/index.global.js +0 -482
  40. package/build/index.global.js.map +0 -1
  41. package/build/index.js +0 -460
  42. package/build/index.js.map +0 -1
  43. package/config/scriptConfig.js +0 -46
  44. package/index.js +0 -483
  45. package/index.js.map +0 -1
  46. package/interface/assets.js +0 -16
  47. package/interface/runtimeInterface.js +0 -2
  48. package/interface/sceneInterface.js +0 -32
  49. package/rollup.config.js +0 -32
  50. package/sceneParser.js +0 -53
  51. package/scriptParser/argsParser.js +0 -70
  52. package/scriptParser/assetsScanner.js +0 -75
  53. package/scriptParser/commandParser.js +0 -60
  54. package/scriptParser/contentParser.js +0 -68
  55. package/scriptParser/scriptParser.js +0 -81
  56. package/scriptParser/subSceneScanner.js +0 -26
  57. package/test/test.js +0 -10
  58. package/test/test.ts +0 -117
  59. package/tsconfig.json +0 -29
  60. package/tsconfig.node.json +0 -10
  61. /package/{interface → src/interface}/assets.ts +0 -0
  62. /package/{interface → src/interface}/runtimeInterface.ts +0 -0
  63. /package/{interface → src/interface}/sceneInterface.ts +0 -0
  64. /package/{scriptParser → src/scriptParser}/argsParser.ts +0 -0
  65. /package/{scriptParser → src/scriptParser}/assetsScanner.ts +0 -0
  66. /package/{scriptParser → src/scriptParser}/commandParser.ts +0 -0
@@ -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,94 @@
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
+ }
37
+ /**
38
+ * 单个参数接口
39
+ * @interface arg
40
+ */
41
+ export interface arg {
42
+ key: string;
43
+ value: string | boolean | number;
44
+ }
45
+ /**
46
+ * 资源接口
47
+ * @interface IAsset
48
+ */
49
+ export interface IAsset {
50
+ name: string;
51
+ type: fileType;
52
+ url: string;
53
+ lineNumber: number;
54
+ }
55
+ /**
56
+ * 单条语句接口
57
+ * @interface ISentence
58
+ */
59
+ export interface ISentence {
60
+ command: commandType;
61
+ commandRaw: string;
62
+ content: string;
63
+ args: Array<arg>;
64
+ sentenceAssets: Array<IAsset>;
65
+ subScene: Array<string>;
66
+ }
67
+ /**
68
+ * 场景接口
69
+ * @interface IScene
70
+ */
71
+ export interface IScene {
72
+ sceneName: string;
73
+ sceneUrl: string;
74
+ sentenceList: Array<ISentence>;
75
+ assetsList: Array<IAsset>;
76
+ subSceneList: Array<string>;
77
+ }
78
+ /**
79
+ * 当前的场景数据
80
+ * @interface ISceneData
81
+ */
82
+ export interface ISceneData {
83
+ currentSentenceId: number;
84
+ sceneStack: Array<sceneEntry>;
85
+ currentScene: IScene;
86
+ }
87
+ /**
88
+ * 处理后的命令接口
89
+ * @interface parsedCommand
90
+ */
91
+ export interface parsedCommand {
92
+ type: commandType;
93
+ additionalArgs: Array<arg>;
94
+ }
@@ -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>;
@@ -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[];
@@ -1,5 +1,6 @@
1
1
  import { commandType, IAsset } from "./interface/sceneInterface";
2
2
  import { fileType } from "./interface/assets";
3
+ import { ADD_NEXT_ARG_LIST, SCRIPT_CONFIG } from "./config/scriptConfig";
3
4
  export default class SceneParser {
4
5
  private readonly assetsPrefetcher;
5
6
  private readonly assetSetter;
@@ -8,3 +9,4 @@ export default class SceneParser {
8
9
  constructor(assetsPrefetcher: ((assetList: Array<IAsset>) => void), assetSetter: (fileName: string, assetType: fileType) => string, ADD_NEXT_ARG_LIST: Array<commandType>, SCRIPT_CONFIG: Array<any>);
9
10
  parse(rawScene: string, sceneName: string, sceneUrl: string): import("./interface/sceneInterface").IScene;
10
11
  }
12
+ export { ADD_NEXT_ARG_LIST, SCRIPT_CONFIG };
@@ -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>;