webgal-parser 4.3.3 → 4.3.4
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/.babelrc +14 -0
- package/build/types/index.d.ts +10 -0
- package/build/types/interface/assets.d.ts +12 -0
- package/build/types/interface/runtimeInterface.d.ts +9 -0
- package/build/types/interface/sceneInterface.d.ts +91 -0
- package/build/types/sceneParser.d.ts +14 -0
- package/build/types/scriptParser/argsParser.d.ts +9 -0
- package/build/types/scriptParser/assetsScanner.d.ts +9 -0
- package/build/types/scriptParser/commandParser.d.ts +9 -0
- package/build/types/scriptParser/contentParser.d.ts +9 -0
- package/build/types/scriptParser/scriptParser.d.ts +9 -0
- package/build/types/scriptParser/subSceneScanner.d.ts +7 -0
- package/index.d.ts +10 -0
- package/index.js +17661 -7
- package/index.ts +1 -1
- package/interface/assets.d.ts +12 -0
- package/interface/runtimeInterface.d.ts +9 -0
- package/interface/sceneInterface.d.ts +91 -0
- package/package.json +16 -4
- package/rollup.config.js +32 -0
- package/sceneParser.d.ts +14 -0
- package/scriptParser/argsParser.d.ts +9 -0
- package/scriptParser/assetsScanner.d.ts +9 -0
- package/scriptParser/commandParser.d.ts +9 -0
- package/scriptParser/contentParser.d.ts +9 -0
- package/scriptParser/contentParser.ts +2 -2
- package/scriptParser/scriptParser.d.ts +9 -0
- package/scriptParser/subSceneScanner.d.ts +7 -0
- package/test/scriptConfig.js +46 -46
- package/test/test.js +10 -10
- package/tsconfig.json +2 -0
package/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { commandType, IAsset } from "./interface/sceneInterface";
|
|
|
2
2
|
import { fileType } from "./interface/assets";
|
|
3
3
|
import { sceneParser } from "./sceneParser";
|
|
4
4
|
|
|
5
|
-
export class SceneParser {
|
|
5
|
+
export default class SceneParser {
|
|
6
6
|
|
|
7
7
|
private readonly assetsPrefetcher;
|
|
8
8
|
private readonly assetSetter;
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* 单个参数接口
|
|
36
|
+
* @interface arg
|
|
37
|
+
*/
|
|
38
|
+
export interface arg {
|
|
39
|
+
key: string;
|
|
40
|
+
value: string | boolean | number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* 资源接口
|
|
44
|
+
* @interface IAsset
|
|
45
|
+
*/
|
|
46
|
+
export interface IAsset {
|
|
47
|
+
name: string;
|
|
48
|
+
type: fileType;
|
|
49
|
+
url: string;
|
|
50
|
+
lineNumber: number;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* 单条语句接口
|
|
54
|
+
* @interface ISentence
|
|
55
|
+
*/
|
|
56
|
+
export interface ISentence {
|
|
57
|
+
command: commandType;
|
|
58
|
+
commandRaw: string;
|
|
59
|
+
content: string;
|
|
60
|
+
args: Array<arg>;
|
|
61
|
+
sentenceAssets: Array<IAsset>;
|
|
62
|
+
subScene: Array<string>;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* 场景接口
|
|
66
|
+
* @interface IScene
|
|
67
|
+
*/
|
|
68
|
+
export interface IScene {
|
|
69
|
+
sceneName: string;
|
|
70
|
+
sceneUrl: string;
|
|
71
|
+
sentenceList: Array<ISentence>;
|
|
72
|
+
assetsList: Array<IAsset>;
|
|
73
|
+
subSceneList: Array<string>;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* 当前的场景数据
|
|
77
|
+
* @interface ISceneData
|
|
78
|
+
*/
|
|
79
|
+
export interface ISceneData {
|
|
80
|
+
currentSentenceId: number;
|
|
81
|
+
sceneStack: Array<sceneEntry>;
|
|
82
|
+
currentScene: IScene;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* 处理后的命令接口
|
|
86
|
+
* @interface parsedCommand
|
|
87
|
+
*/
|
|
88
|
+
export interface parsedCommand {
|
|
89
|
+
type: commandType;
|
|
90
|
+
additionalArgs: Array<arg>;
|
|
91
|
+
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webgal-parser",
|
|
3
|
-
"version": "4.3.
|
|
3
|
+
"version": "4.3.4",
|
|
4
4
|
"description": "WebGAL script parser",
|
|
5
5
|
"scripts": {
|
|
6
|
-
"test": "node test/test.js"
|
|
6
|
+
"test": "node test/test.js",
|
|
7
|
+
"build": "rimraf -rf ./build && rollup --config"
|
|
7
8
|
},
|
|
8
9
|
"main": "index.js",
|
|
9
10
|
"author": "Mahiru <Mahiru_@outlook.com>",
|
|
@@ -13,7 +14,18 @@
|
|
|
13
14
|
"lodash": "^4.17.21"
|
|
14
15
|
},
|
|
15
16
|
"devDependencies": {
|
|
17
|
+
"@rollup/plugin-commonjs": "^23.0.2",
|
|
18
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
19
|
+
"@rollup/plugin-typescript": "^9.0.2",
|
|
16
20
|
"@types/lodash": "^4.14.189",
|
|
17
|
-
"
|
|
18
|
-
|
|
21
|
+
"rollup": "^3.3.0",
|
|
22
|
+
"rollup-plugin-babel": "^4.4.0",
|
|
23
|
+
"rollup-plugin-dts": "^5.0.0",
|
|
24
|
+
"rollup-plugin-terser": "^7.0.2",
|
|
25
|
+
"rollup-plugin-typescript2": "^0.34.1",
|
|
26
|
+
"ts-node": "^10.9.1",
|
|
27
|
+
"tslib": "^2.4.1",
|
|
28
|
+
"typescript": "^4.9.3"
|
|
29
|
+
},
|
|
30
|
+
"type": "module"
|
|
19
31
|
}
|
package/rollup.config.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import typescript from 'rollup-plugin-typescript2';
|
|
2
|
+
|
|
3
|
+
const mode = process.env.MODE;
|
|
4
|
+
const isProd = mode === 'prod';
|
|
5
|
+
import pkg from './package.json' assert { type: "json" };
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
input: `index.ts`,
|
|
9
|
+
output: [
|
|
10
|
+
{
|
|
11
|
+
file: pkg.main,
|
|
12
|
+
exports: 'named',
|
|
13
|
+
format: 'cjs',
|
|
14
|
+
sourcemap: !isProd
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
file: pkg.module,
|
|
18
|
+
format: 'es',
|
|
19
|
+
sourcemap: !isProd
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
file: 'build/my-lib.global.js',
|
|
23
|
+
name: 'MyLib',
|
|
24
|
+
format: 'iife',
|
|
25
|
+
sourcemap: !isProd
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
plugins: [typescript({
|
|
29
|
+
useTsconfigDeclarationDir: true,
|
|
30
|
+
tsconfigOverride: { compilerOptions: { sourceMap: !isProd } }
|
|
31
|
+
})],
|
|
32
|
+
};
|
package/sceneParser.d.ts
ADDED
|
@@ -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;
|
|
@@ -40,8 +40,8 @@ export const contentParser = (contentRaw: string, type: commandType, assetSetter
|
|
|
40
40
|
|
|
41
41
|
function getChooseContent(contentRaw: string, assetSetter:any): string {
|
|
42
42
|
const chooseList = contentRaw.split("|");
|
|
43
|
-
const chooseKeyList = [];
|
|
44
|
-
const chooseValueList = [];
|
|
43
|
+
const chooseKeyList:Array<string> = [];
|
|
44
|
+
const chooseValueList:Array<string> = [];
|
|
45
45
|
for (const e of chooseList) {
|
|
46
46
|
chooseKeyList.push(e.split(":")[0]);
|
|
47
47
|
chooseValueList.push(e.split(":")[1]);
|
|
@@ -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;
|
package/test/scriptConfig.js
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
exports.ADD_NEXT_ARG_LIST = exports.SCRIPT_CONFIG = void 0;
|
|
4
|
-
var sceneInterface_1 = require("../interface/sceneInterface");
|
|
5
|
-
exports.SCRIPT_CONFIG = [
|
|
6
|
-
{ scriptString: 'intro', scriptType: sceneInterface_1.commandType.intro },
|
|
7
|
-
{ scriptString: 'changeBg', scriptType: sceneInterface_1.commandType.changeBg },
|
|
8
|
-
{ scriptString: 'changeFigure', scriptType: sceneInterface_1.commandType.changeFigure },
|
|
9
|
-
{ scriptString: 'miniAvatar', scriptType: sceneInterface_1.commandType.miniAvatar },
|
|
10
|
-
{ scriptString: 'changeScene', scriptType: sceneInterface_1.commandType.changeScene },
|
|
11
|
-
{ scriptString: 'choose', scriptType: sceneInterface_1.commandType.choose },
|
|
12
|
-
{ scriptString: 'end', scriptType: sceneInterface_1.commandType.end },
|
|
13
|
-
{ scriptString: 'bgm', scriptType: sceneInterface_1.commandType.bgm },
|
|
14
|
-
{ scriptString: 'playVideo', scriptType: sceneInterface_1.commandType.video },
|
|
15
|
-
{
|
|
16
|
-
scriptString: 'setComplexAnimation',
|
|
17
|
-
scriptType: sceneInterface_1.commandType.setComplexAnimation
|
|
18
|
-
},
|
|
19
|
-
{ scriptString: 'setFilter', scriptType: sceneInterface_1.commandType.setFilter },
|
|
20
|
-
{ scriptString: 'pixiInit', scriptType: sceneInterface_1.commandType.pixiInit },
|
|
21
|
-
{ scriptString: 'pixiPerform', scriptType: sceneInterface_1.commandType.pixi },
|
|
22
|
-
{ scriptString: 'label', scriptType: sceneInterface_1.commandType.label },
|
|
23
|
-
{ scriptString: 'jumpLabel', scriptType: sceneInterface_1.commandType.jumpLabel },
|
|
24
|
-
{ scriptString: 'setVar', scriptType: sceneInterface_1.commandType.setVar },
|
|
25
|
-
{ scriptString: 'callScene', scriptType: sceneInterface_1.commandType.callScene },
|
|
26
|
-
{ scriptString: 'showVars', scriptType: sceneInterface_1.commandType.showVars },
|
|
27
|
-
{ scriptString: 'unlockCg', scriptType: sceneInterface_1.commandType.unlockCg },
|
|
28
|
-
{ scriptString: 'unlockBgm', scriptType: sceneInterface_1.commandType.unlockBgm },
|
|
29
|
-
{ scriptString: 'say', scriptType: sceneInterface_1.commandType.say },
|
|
30
|
-
{ scriptString: 'filmMode', scriptType: sceneInterface_1.commandType.filmMode },
|
|
31
|
-
{ scriptString: 'callScene', scriptType: sceneInterface_1.commandType.callScene },
|
|
32
|
-
{ scriptString: 'setTextbox', scriptType: sceneInterface_1.commandType.setTextbox },
|
|
33
|
-
{ scriptString: 'setAnimation', scriptType: sceneInterface_1.commandType.setAnimation },
|
|
34
|
-
];
|
|
35
|
-
exports.ADD_NEXT_ARG_LIST = [
|
|
36
|
-
sceneInterface_1.commandType.bgm,
|
|
37
|
-
sceneInterface_1.commandType.pixi,
|
|
38
|
-
sceneInterface_1.commandType.pixiInit,
|
|
39
|
-
sceneInterface_1.commandType.label,
|
|
40
|
-
sceneInterface_1.commandType["if"],
|
|
41
|
-
sceneInterface_1.commandType.miniAvatar,
|
|
42
|
-
sceneInterface_1.commandType.setVar,
|
|
43
|
-
sceneInterface_1.commandType.unlockBgm,
|
|
44
|
-
sceneInterface_1.commandType.unlockCg,
|
|
45
|
-
sceneInterface_1.commandType.filmMode,
|
|
46
|
-
];
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.ADD_NEXT_ARG_LIST = exports.SCRIPT_CONFIG = void 0;
|
|
4
|
+
var sceneInterface_1 = require("../interface/sceneInterface");
|
|
5
|
+
exports.SCRIPT_CONFIG = [
|
|
6
|
+
{ scriptString: 'intro', scriptType: sceneInterface_1.commandType.intro },
|
|
7
|
+
{ scriptString: 'changeBg', scriptType: sceneInterface_1.commandType.changeBg },
|
|
8
|
+
{ scriptString: 'changeFigure', scriptType: sceneInterface_1.commandType.changeFigure },
|
|
9
|
+
{ scriptString: 'miniAvatar', scriptType: sceneInterface_1.commandType.miniAvatar },
|
|
10
|
+
{ scriptString: 'changeScene', scriptType: sceneInterface_1.commandType.changeScene },
|
|
11
|
+
{ scriptString: 'choose', scriptType: sceneInterface_1.commandType.choose },
|
|
12
|
+
{ scriptString: 'end', scriptType: sceneInterface_1.commandType.end },
|
|
13
|
+
{ scriptString: 'bgm', scriptType: sceneInterface_1.commandType.bgm },
|
|
14
|
+
{ scriptString: 'playVideo', scriptType: sceneInterface_1.commandType.video },
|
|
15
|
+
{
|
|
16
|
+
scriptString: 'setComplexAnimation',
|
|
17
|
+
scriptType: sceneInterface_1.commandType.setComplexAnimation
|
|
18
|
+
},
|
|
19
|
+
{ scriptString: 'setFilter', scriptType: sceneInterface_1.commandType.setFilter },
|
|
20
|
+
{ scriptString: 'pixiInit', scriptType: sceneInterface_1.commandType.pixiInit },
|
|
21
|
+
{ scriptString: 'pixiPerform', scriptType: sceneInterface_1.commandType.pixi },
|
|
22
|
+
{ scriptString: 'label', scriptType: sceneInterface_1.commandType.label },
|
|
23
|
+
{ scriptString: 'jumpLabel', scriptType: sceneInterface_1.commandType.jumpLabel },
|
|
24
|
+
{ scriptString: 'setVar', scriptType: sceneInterface_1.commandType.setVar },
|
|
25
|
+
{ scriptString: 'callScene', scriptType: sceneInterface_1.commandType.callScene },
|
|
26
|
+
{ scriptString: 'showVars', scriptType: sceneInterface_1.commandType.showVars },
|
|
27
|
+
{ scriptString: 'unlockCg', scriptType: sceneInterface_1.commandType.unlockCg },
|
|
28
|
+
{ scriptString: 'unlockBgm', scriptType: sceneInterface_1.commandType.unlockBgm },
|
|
29
|
+
{ scriptString: 'say', scriptType: sceneInterface_1.commandType.say },
|
|
30
|
+
{ scriptString: 'filmMode', scriptType: sceneInterface_1.commandType.filmMode },
|
|
31
|
+
{ scriptString: 'callScene', scriptType: sceneInterface_1.commandType.callScene },
|
|
32
|
+
{ scriptString: 'setTextbox', scriptType: sceneInterface_1.commandType.setTextbox },
|
|
33
|
+
{ scriptString: 'setAnimation', scriptType: sceneInterface_1.commandType.setAnimation },
|
|
34
|
+
];
|
|
35
|
+
exports.ADD_NEXT_ARG_LIST = [
|
|
36
|
+
sceneInterface_1.commandType.bgm,
|
|
37
|
+
sceneInterface_1.commandType.pixi,
|
|
38
|
+
sceneInterface_1.commandType.pixiInit,
|
|
39
|
+
sceneInterface_1.commandType.label,
|
|
40
|
+
sceneInterface_1.commandType["if"],
|
|
41
|
+
sceneInterface_1.commandType.miniAvatar,
|
|
42
|
+
sceneInterface_1.commandType.setVar,
|
|
43
|
+
sceneInterface_1.commandType.unlockBgm,
|
|
44
|
+
sceneInterface_1.commandType.unlockCg,
|
|
45
|
+
sceneInterface_1.commandType.filmMode,
|
|
46
|
+
];
|
package/test/test.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
exports.__esModule = true;
|
|
3
|
-
var index_1 = require("../index");
|
|
4
|
-
var scriptConfig_1 = require("./scriptConfig");
|
|
5
|
-
var parser = new index_1.SceneParser(function (assetList) {
|
|
6
|
-
}, function (fileName, assetType) {
|
|
7
|
-
return fileName;
|
|
8
|
-
}, scriptConfig_1.ADD_NEXT_ARG_LIST, scriptConfig_1.SCRIPT_CONFIG);
|
|
9
|
-
var result = parser.parse("\n; \u521D\u59CB\u573A\u666F\uFF0C\u4EE5\u53CA\u7279\u6548\u6F14\u793A\nchangeBg:c4.jpg -next;\nunlockCg:c4.jpg -name=\u8857\u524D; \u89E3\u9501\u90E8\u5206CG\nunlockCg:xgmain.jpeg -name=\u661F\u5149\u5496\u5561\u9986\u4E0E\u6B7B\u795E\u4E4B\u8776;\nunlockBgm:s_Title.mp3 -name=Smiling-Swinging!!;\nWebGAL:\u7279\u6548\u7CFB\u7EDF\u662F3.9.2\u7248\u672C\u65B0\u5F15\u5165\u7684\u7CFB\u7EDF\uFF0C\u4F60\u60F3\u8981\u770B\u7279\u6548\u7684\u6F14\u793A\u5417\uFF1F;\nchoose:\u89C2\u770B\u7279\u6548\u6F14\u793A:demo|\u6211\u4E0D\u8981\u770B\u7279\u6548\uFF0C\u76F4\u63A5\u6765\u5427\uFF01:toStart;\nlabel:demo;\npixiInit;\npixiPerform:rain;\nWebGAL:\u73B0\u5728\u5C55\u793A\u7684\u662F\u4E0B\u96E8\u7684\u7279\u6548\u3002;\npixiInit;\npixiPerform:snow;\nWebGAL:\u73B0\u5728\u5C55\u793A\u7684\u662F\u4E0B\u96EA\u7684\u7279\u6548\u3002;\nsetTextbox:hide;\npixiInit;\nsetTextbox:on -next;\nWebGAL:\u7279\u6548\u7684\u6F14\u793A\u5DF2\u7ECF\u7ED3\u675F\uFF0C\u73B0\u5728\u6211\u4EEC\u6B63\u5F0F\u5F00\u59CB\u5427\uFF01;\n\n; \u6B63\u5F0F\u573A\u666F\nlabel:toStart;\nplayVideo:OP.mp4;\nchangeBg:c3.jpg -next;\nunlockCg:c3.jpg -name=cafe;\nchangeFigure:m2.png -left -next;\nbgm:cb1.mp3;\nunlockBgm:cb1.mp3 -name=\u3072\u3068\u3059\u3058\u306E\u5149\u660E;\nsetAnimation:enter-from-left -target=fig-left -next;\n\u7C73\u5496\u591A:\u86CB\u5305\u996D\u662F\u681E\u90A3\u505A\u7684\uFF0C\u4F46\u7EA2\u8336\u662F\u590F\u76EE\u6CE1\u7684\u3002 -v1.ogg;\n\u6602\u6674:......;\n\u987A\u4FBF\u95EE\u4E00\u4E0B\uFF0C\u4F60\u662F\u6253\u7B97\u505A\u4EC0\u4E48\u7684\uFF1F;\nchangeFigure:m1.png -left -next;\n\u7C73\u5496\u591A:\u5C31\u662F\u5012\u996E\u6599\u3002\u7136\u540E\u5496\u5561\u548C\u7EA2\u8336\u7684\u51B2\u6CE1\u65B9\u5F0F\u6211\u8FD8\u662F\u8BB0\u4F4F\u4E86\u7684\u3002 -v2.ogg;\n\u6602\u6674:\u8FD9\u3001\u8FD9\u6837\u4E48......;\n:\u8FD9\u732B\u722A\u5B50\u771F\u7684\u80FD\u6CE1\u8336\u4E48\u3002;\n\u62FF\u5F97\u4E86\u6C34\u58F6\u5417\uFF1F\u5C31\u51ED\u4ED6\u90A3\u4E2A\u8089\u7403\u722A\u5B50......;\n\u96BE\u9053\u8FD9\u4E9B\u4E5F\u662F\u51ED\u501F\u732B\u5996\u7684\u5947\u7279\u529B\u91CF\u505A\u5230\u7684\u5417\uFF1F;\nchangeFigure:none -left -next;\nchangeFigure:k1.png -next;\nsetAnimation:enter-from-bottom -target=fig-center -next;\n\u681E\u90A3:\u90A3\u4E48\uFF0C\u4F60\u60F3\u5148\u5C1D\u54EA\u4E2A\uFF1F -v3.ogg;\nchoose:\u54C1\u5C1D\u86CB\u5305\u996D:dbf|\u54C1\u5C1D\u7EA2\u8336:hc;\n\n; \u681E\u90A3\u9009\u9879\nlabel:dbf;\n\u6602\u6674:\u603B\u4E4B\uFF0C\u5148\u786E\u8BA4\u4E0B\u86CB\u5305\u996D\u7684\u5473\u9053\u5427;\nchangeFigure:k2.png -next;\n\u681E\u90A3:\u660E\u767D\u4E86\uFF0C\u4EA4\u7ED9\u6211\u5427 -v4.ogg;\nchangeFigure:none -next;\nchangeFigure:m2.png -left -next;\nchangeFigure:k3.png -right -next;\nsetAnimation:enter-from-left -target=fig-left -next;\nsetAnimation:enter-from-right -target=fig-right -next;\n\u681E\u90A3:\u90A3\u4E48\u7C73\u5496\u591A\u5148\u751F\uFF0C\u6211\u53BB\u505A\u4E00\u4E0B\u8BD5\u4F5C\u54C1 -v5.ogg;\n\u7C73\u5496\u591A:\u55EF\u3002\u53BB\u5427 -v6.ogg;\nchangeFigure:none -left -next;\nchangeFigure:none -right -next;\nchangeFigure:k4.png -next;\nsetAnimation:enter-from-bottom -target=fig-center -next;\n\u681E\u90A3:\u90A3\u4E48\u9AD8\u5CAD\u540C\u5B66\uFF0C\u6211\u4EEC\u79FB\u52A8\u5230\u53A8\u623F\u5427 -v7.ogg;\nchangeFigure:none -next;\nbgm:cb2.mp3;\nunlockBgm:cb2.mp3 -name=Tea Break;\nchangeBg:c2.jpg;\nunlockCg:c2.jpg -name=\u53A8\u623F;\nchangeFigure:k2.png -next;\n\u681E\u90A3:\u8BDD\u4E0D\u591A\u8BF4\u5F00\u59CB\u505A\u5427 -v8.ogg;\njumpLabel:end;\n\n; \u590F\u76EE\u9009\u9879\nlabel:hc;\nchangeFigure:none -next;\nchangeFigure:m1.png -left -next;\nchangeFigure:k1.png -right -next;\nsetAnimation:enter-from-left -target=fig-left -next;\nsetAnimation:enter-from-right -target=fig-right -next;\n\u7C73\u5496\u591A:\u90A3\u4E48\u5C31\u662F\uFF0C\u590F\u76EE\u4E86\u5427 -v9.ogg;\nchangeFigure:k6.png -right -next;\n\u681E\u90A3:\u5979\u521A\u53BB\u4F11\u606F\uFF0C\u8981\u4E0D\u8981\u6211\u53EB\u56DE\u6765\u5462\uFF1F -v10.ogg;\n\u6602\u6674:\u6CA1\u4E8B\uFF0C\u6211\u81EA\u5DF1\u53BB\u5427;\nchangeFigure:none -left -next;\nchangeFigure:none -right -next;\nbgm:cb2.mp3;\nchangeBg:c1.jpg -next;\nunlockCg:c1.jpg -name=\u4F11\u606F\u5BA4;\n:\u6211\u5148\u6572\u4E86\u6572\u95E8;\nminiAvatar:n1.png;\n\u590F\u76EE:\u54EA\u4F4D\uFF1F -v11.ogg;\n\u6602\u6674:\u6211\u662F\u9AD8\u5CAD\uFF0C\u53EF\u4EE5\u8FDB\u53BB\u5417\uFF1F;\n\u590F\u76EE:\u53EF\u4EE5\uFF0C\u6CA1\u95EE\u9898 -v12.ogg;\n\u6602\u6674:\u6253\u6405\u4E86;\nminiAvatar:none;\nchangeFigure:n4.png -next;\n\u6602\u6674:\u6253\u6405\u4F60\u4F11\u606F\u4E86;\n\u590F\u76EE:\u4E0D\u7528\u5728\u610F\uFF0C\u600E\u4E48\u4E86\uFF1F -v13.ogg;\nchangeFigure:n2.png -next;\n:\u5979\u5E76\u6CA1\u6709\u65E0\u7CBE\u6253\u91C7\uFF0C\u6BD4\u60F3\u8C61\u4E2D\u7CBE\u795E\u591A\u4E86;\n\u6602\u6674:\u95EE\u9053\u62FF\u624B\u83DC\u8C31\uFF0C\u5C31\u542C\u8BF4\u56DB\u5B63\u540C\u5B66\u6CE1\u7684\u7EA2\u8336\u5473\u9053\u4E0D\u9519\uFF0C\u6211\u4E5F\u60F3\u54C1\u5C1D\u4E00\u4E0B;\n\u590F\u76EE:\u660E\u767D\u4E86\uFF0C\u90A3\u6211\u4EEC\u56DE\u53BB\u5427 -v14.ogg;\njumpLabel:end;\n\n; \u7ED3\u675F\u573A\u666F\nlabel:end;\nchangeFigure:none -next;\nWebGAL:\u57FA\u7840\u6F14\u51FA\u7684\u5C55\u793A\u5DF2\u7ECF\u7ED3\u675F\u3002;\n", "test", "/test.txt");
|
|
10
|
-
console.log(result);
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
var index_1 = require("../index");
|
|
4
|
+
var scriptConfig_1 = require("./scriptConfig");
|
|
5
|
+
var parser = new index_1.SceneParser(function (assetList) {
|
|
6
|
+
}, function (fileName, assetType) {
|
|
7
|
+
return fileName;
|
|
8
|
+
}, scriptConfig_1.ADD_NEXT_ARG_LIST, scriptConfig_1.SCRIPT_CONFIG);
|
|
9
|
+
var result = parser.parse("\n; \u521D\u59CB\u573A\u666F\uFF0C\u4EE5\u53CA\u7279\u6548\u6F14\u793A\nchangeBg:c4.jpg -next;\nunlockCg:c4.jpg -name=\u8857\u524D; \u89E3\u9501\u90E8\u5206CG\nunlockCg:xgmain.jpeg -name=\u661F\u5149\u5496\u5561\u9986\u4E0E\u6B7B\u795E\u4E4B\u8776;\nunlockBgm:s_Title.mp3 -name=Smiling-Swinging!!;\nWebGAL:\u7279\u6548\u7CFB\u7EDF\u662F3.9.2\u7248\u672C\u65B0\u5F15\u5165\u7684\u7CFB\u7EDF\uFF0C\u4F60\u60F3\u8981\u770B\u7279\u6548\u7684\u6F14\u793A\u5417\uFF1F;\nchoose:\u89C2\u770B\u7279\u6548\u6F14\u793A:demo|\u6211\u4E0D\u8981\u770B\u7279\u6548\uFF0C\u76F4\u63A5\u6765\u5427\uFF01:toStart;\nlabel:demo;\npixiInit;\npixiPerform:rain;\nWebGAL:\u73B0\u5728\u5C55\u793A\u7684\u662F\u4E0B\u96E8\u7684\u7279\u6548\u3002;\npixiInit;\npixiPerform:snow;\nWebGAL:\u73B0\u5728\u5C55\u793A\u7684\u662F\u4E0B\u96EA\u7684\u7279\u6548\u3002;\nsetTextbox:hide;\npixiInit;\nsetTextbox:on -next;\nWebGAL:\u7279\u6548\u7684\u6F14\u793A\u5DF2\u7ECF\u7ED3\u675F\uFF0C\u73B0\u5728\u6211\u4EEC\u6B63\u5F0F\u5F00\u59CB\u5427\uFF01;\n\n; \u6B63\u5F0F\u573A\u666F\nlabel:toStart;\nplayVideo:OP.mp4;\nchangeBg:c3.jpg -next;\nunlockCg:c3.jpg -name=cafe;\nchangeFigure:m2.png -left -next;\nbgm:cb1.mp3;\nunlockBgm:cb1.mp3 -name=\u3072\u3068\u3059\u3058\u306E\u5149\u660E;\nsetAnimation:enter-from-left -target=fig-left -next;\n\u7C73\u5496\u591A:\u86CB\u5305\u996D\u662F\u681E\u90A3\u505A\u7684\uFF0C\u4F46\u7EA2\u8336\u662F\u590F\u76EE\u6CE1\u7684\u3002 -v1.ogg;\n\u6602\u6674:......;\n\u987A\u4FBF\u95EE\u4E00\u4E0B\uFF0C\u4F60\u662F\u6253\u7B97\u505A\u4EC0\u4E48\u7684\uFF1F;\nchangeFigure:m1.png -left -next;\n\u7C73\u5496\u591A:\u5C31\u662F\u5012\u996E\u6599\u3002\u7136\u540E\u5496\u5561\u548C\u7EA2\u8336\u7684\u51B2\u6CE1\u65B9\u5F0F\u6211\u8FD8\u662F\u8BB0\u4F4F\u4E86\u7684\u3002 -v2.ogg;\n\u6602\u6674:\u8FD9\u3001\u8FD9\u6837\u4E48......;\n:\u8FD9\u732B\u722A\u5B50\u771F\u7684\u80FD\u6CE1\u8336\u4E48\u3002;\n\u62FF\u5F97\u4E86\u6C34\u58F6\u5417\uFF1F\u5C31\u51ED\u4ED6\u90A3\u4E2A\u8089\u7403\u722A\u5B50......;\n\u96BE\u9053\u8FD9\u4E9B\u4E5F\u662F\u51ED\u501F\u732B\u5996\u7684\u5947\u7279\u529B\u91CF\u505A\u5230\u7684\u5417\uFF1F;\nchangeFigure:none -left -next;\nchangeFigure:k1.png -next;\nsetAnimation:enter-from-bottom -target=fig-center -next;\n\u681E\u90A3:\u90A3\u4E48\uFF0C\u4F60\u60F3\u5148\u5C1D\u54EA\u4E2A\uFF1F -v3.ogg;\nchoose:\u54C1\u5C1D\u86CB\u5305\u996D:dbf|\u54C1\u5C1D\u7EA2\u8336:hc;\n\n; \u681E\u90A3\u9009\u9879\nlabel:dbf;\n\u6602\u6674:\u603B\u4E4B\uFF0C\u5148\u786E\u8BA4\u4E0B\u86CB\u5305\u996D\u7684\u5473\u9053\u5427;\nchangeFigure:k2.png -next;\n\u681E\u90A3:\u660E\u767D\u4E86\uFF0C\u4EA4\u7ED9\u6211\u5427 -v4.ogg;\nchangeFigure:none -next;\nchangeFigure:m2.png -left -next;\nchangeFigure:k3.png -right -next;\nsetAnimation:enter-from-left -target=fig-left -next;\nsetAnimation:enter-from-right -target=fig-right -next;\n\u681E\u90A3:\u90A3\u4E48\u7C73\u5496\u591A\u5148\u751F\uFF0C\u6211\u53BB\u505A\u4E00\u4E0B\u8BD5\u4F5C\u54C1 -v5.ogg;\n\u7C73\u5496\u591A:\u55EF\u3002\u53BB\u5427 -v6.ogg;\nchangeFigure:none -left -next;\nchangeFigure:none -right -next;\nchangeFigure:k4.png -next;\nsetAnimation:enter-from-bottom -target=fig-center -next;\n\u681E\u90A3:\u90A3\u4E48\u9AD8\u5CAD\u540C\u5B66\uFF0C\u6211\u4EEC\u79FB\u52A8\u5230\u53A8\u623F\u5427 -v7.ogg;\nchangeFigure:none -next;\nbgm:cb2.mp3;\nunlockBgm:cb2.mp3 -name=Tea Break;\nchangeBg:c2.jpg;\nunlockCg:c2.jpg -name=\u53A8\u623F;\nchangeFigure:k2.png -next;\n\u681E\u90A3:\u8BDD\u4E0D\u591A\u8BF4\u5F00\u59CB\u505A\u5427 -v8.ogg;\njumpLabel:end;\n\n; \u590F\u76EE\u9009\u9879\nlabel:hc;\nchangeFigure:none -next;\nchangeFigure:m1.png -left -next;\nchangeFigure:k1.png -right -next;\nsetAnimation:enter-from-left -target=fig-left -next;\nsetAnimation:enter-from-right -target=fig-right -next;\n\u7C73\u5496\u591A:\u90A3\u4E48\u5C31\u662F\uFF0C\u590F\u76EE\u4E86\u5427 -v9.ogg;\nchangeFigure:k6.png -right -next;\n\u681E\u90A3:\u5979\u521A\u53BB\u4F11\u606F\uFF0C\u8981\u4E0D\u8981\u6211\u53EB\u56DE\u6765\u5462\uFF1F -v10.ogg;\n\u6602\u6674:\u6CA1\u4E8B\uFF0C\u6211\u81EA\u5DF1\u53BB\u5427;\nchangeFigure:none -left -next;\nchangeFigure:none -right -next;\nbgm:cb2.mp3;\nchangeBg:c1.jpg -next;\nunlockCg:c1.jpg -name=\u4F11\u606F\u5BA4;\n:\u6211\u5148\u6572\u4E86\u6572\u95E8;\nminiAvatar:n1.png;\n\u590F\u76EE:\u54EA\u4F4D\uFF1F -v11.ogg;\n\u6602\u6674:\u6211\u662F\u9AD8\u5CAD\uFF0C\u53EF\u4EE5\u8FDB\u53BB\u5417\uFF1F;\n\u590F\u76EE:\u53EF\u4EE5\uFF0C\u6CA1\u95EE\u9898 -v12.ogg;\n\u6602\u6674:\u6253\u6405\u4E86;\nminiAvatar:none;\nchangeFigure:n4.png -next;\n\u6602\u6674:\u6253\u6405\u4F60\u4F11\u606F\u4E86;\n\u590F\u76EE:\u4E0D\u7528\u5728\u610F\uFF0C\u600E\u4E48\u4E86\uFF1F -v13.ogg;\nchangeFigure:n2.png -next;\n:\u5979\u5E76\u6CA1\u6709\u65E0\u7CBE\u6253\u91C7\uFF0C\u6BD4\u60F3\u8C61\u4E2D\u7CBE\u795E\u591A\u4E86;\n\u6602\u6674:\u95EE\u9053\u62FF\u624B\u83DC\u8C31\uFF0C\u5C31\u542C\u8BF4\u56DB\u5B63\u540C\u5B66\u6CE1\u7684\u7EA2\u8336\u5473\u9053\u4E0D\u9519\uFF0C\u6211\u4E5F\u60F3\u54C1\u5C1D\u4E00\u4E0B;\n\u590F\u76EE:\u660E\u767D\u4E86\uFF0C\u90A3\u6211\u4EEC\u56DE\u53BB\u5427 -v14.ogg;\njumpLabel:end;\n\n; \u7ED3\u675F\u573A\u666F\nlabel:end;\nchangeFigure:none -next;\nWebGAL:\u57FA\u7840\u6F14\u51FA\u7684\u5C55\u793A\u5DF2\u7ECF\u7ED3\u675F\u3002;\n", "test", "/test.txt");
|
|
10
|
+
console.log(result);
|