Skip to content

Commit 1b5f5e5

Browse files
Merge branch 'dev' into dependabot/npm_and_yarn/js-yaml-4.1.1
2 parents a637ca5 + 2315278 commit 1b5f5e5

36 files changed

+514
-92
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Auto detect text files and perform LF normalization
2-
* text=auto
2+
* text=auto eol=lf

packages/parser/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
{
22
"name": "webgal-parser",
3-
"version": "4.5.13",
3+
"version": "4.5.16",
44
"description": "WebGAL script parser",
55
"scripts": {
66
"test": "vitest",
77
"coverage": "vitest run --coverage",
88
"build": "rimraf -rf ./build && rollup --config",
9+
"prepublishOnly": "npm run build",
910
"build-ci": "rollup --config",
1011
"debug": "tsx test/debug.ts",
1112
"debug-scss-parser": "tsx test/debugCssParser.ts",

packages/parser/src/config/scriptConfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ export const SCRIPT_CONFIG = [
3838
{ scriptString: 'getUserInput', scriptType: commandType.getUserInput },
3939
{ scriptString: 'applyStyle', scriptType: commandType.applyStyle },
4040
{ scriptString: 'wait', scriptType: commandType.wait },
41+
{ scriptString: 'callSteam', scriptType: commandType.callSteam },
4142
];
4243
export const ADD_NEXT_ARG_LIST = [
4344
commandType.bgm,
@@ -53,6 +54,7 @@ export const ADD_NEXT_ARG_LIST = [
5354
commandType.playEffect,
5455
commandType.setTransition,
5556
commandType.applyStyle,
57+
commandType.callSteam,
5658
];
5759

5860
export type ConfigMap = Map<string, ConfigItem>;

packages/parser/src/interface/sceneInterface.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export enum commandType {
3939
getUserInput,
4040
applyStyle,
4141
wait,
42+
callSteam, // 调用Steam功能
4243
}
4344

4445
/**

packages/parser/src/sceneParser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export const sceneParser = (
2929
ADD_NEXT_ARG_LIST: commandType[],
3030
SCRIPT_CONFIG_MAP: ConfigMap,
3131
): IScene => {
32-
const rawSentenceList = rawScene.split('\n'); // 原始句子列表
32+
const rawSentenceList = rawScene.replaceAll('\r', '').split('\n'); // 原始句子列表
3333

3434
// 去分号留到后面去做了,现在注释要单独处理
3535
const rawSentenceListWithoutEmpty = rawSentenceList;

packages/parser/src/scriptParser/argsParser.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ export function argsParser(
2323
});
2424
rawArgsList.forEach((e) => {
2525
const equalSignIndex = e.indexOf('=');
26-
let argName = e.slice(0, equalSignIndex);
27-
let argValue: string | undefined = e.slice(equalSignIndex + 1);
26+
let argName = e.slice(0, equalSignIndex).trim();
27+
let argValue: string | undefined = e.slice(equalSignIndex + 1).trim();
2828
if (equalSignIndex < 0) {
29-
argName = e;
29+
argName = e.trim();
3030
argValue = undefined;
3131
}
3232
// 判断是不是语音参数

packages/parser/src/scriptParser/scriptParser.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,16 @@ export const scriptParser = (
3636
// 正式开始解析
3737

3838
// 去分号
39-
let newSentenceRaw = sentenceRaw.split(/(?<!\\);/)[0];
39+
const commentSplit = sentenceRaw.split(/(?<!\\);/);
40+
let newSentenceRaw = commentSplit[0];
4041
newSentenceRaw = newSentenceRaw.replaceAll('\\;',';');
41-
if (newSentenceRaw === '') {
42+
const sentenceComment = commentSplit[1] ?? '';
43+
if (newSentenceRaw.trim() === '') {
4244
// 注释提前返回
4345
return {
4446
command: commandType.comment, // 语句类型
4547
commandRaw: 'comment', // 命令原始内容,方便调试
46-
content: sentenceRaw.split(';')[1] ?? '', // 语句内容
48+
content: sentenceComment.trim(), // 语句内容
4749
args: [{ key: 'next', value: true }], // 参数列表
4850
sentenceAssets: [], // 语句携带的资源列表
4951
subScene: [], // 语句携带的子场景

packages/webgal/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"dev": "vite --host --port 3000",
66
"build": "cross-env NODE_ENV=production tsc && vite build --base=./",
77
"preview": "vite preview",
8-
"lint": "eslint src/** --fix"
8+
"lint": "eslint src/** --fix",
9+
"prepublishOnly": "npm run build"
910
},
1011
"dependencies": {
1112
"@emotion/css": "^11.11.2",
@@ -14,6 +15,7 @@
1415
"angular-expressions": "^1.4.3",
1516
"axios": "^0.30.2",
1617
"cloudlogjs": "^1.0.9",
18+
"gifuct-js": "^2.1.2",
1719
"i18next": "^22.4.15",
1820
"localforage": "^1.10.0",
1921
"lodash": "^4.17.21",

packages/webgal/src/Core/Modules/animationFunctions.ts

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,12 @@ import { baseTransform } from '@/store/stageInterface';
77
import { generateTimelineObj } from '@/Core/controller/stage/pixi/animations/timeline';
88
import { WebGAL } from '@/Core/WebGAL';
99
import PixiStage, { IAnimationObject } from '@/Core/controller/stage/pixi/PixiController';
10-
import { DEFALUT_FIG_IN_DURATION, DEFALUT_FIG_OUT_DURATION } from '../constants';
10+
import {
11+
DEFAULT_BG_IN_DURATION,
12+
DEFAULT_BG_OUT_DURATION,
13+
DEFAULT_FIG_IN_DURATION,
14+
DEFAULT_FIG_OUT_DURATION,
15+
} from '../constants';
1116

1217
// eslint-disable-next-line max-params
1318
export function getAnimationObject(animationName: string, target: string, duration: number, writeDefault: boolean) {
@@ -57,40 +62,46 @@ export function getEnterExitAnimation(
5762
animation: IAnimationObject | null;
5863
} {
5964
if (type === 'enter') {
60-
let duration = DEFALUT_FIG_IN_DURATION;
65+
let duration = DEFAULT_FIG_IN_DURATION;
6166
if (isBg) {
62-
duration = 1500;
67+
duration = DEFAULT_BG_IN_DURATION;
6368
}
69+
duration =
70+
webgalStore.getState().stage.animationSettings.find((setting) => setting.target === target)?.enterDuration ??
71+
duration;
6472
// 走默认动画
6573
let animation: IAnimationObject | null = generateUniversalSoftInAnimationObj(realTarget ?? target, duration);
6674

6775
const transformState = webgalStore.getState().stage.effects;
6876
const targetEffect = transformState.find((effect) => effect.target === target);
6977

70-
const animarionName = WebGAL.animationManager.nextEnterAnimationName.get(target);
71-
if (animarionName && !targetEffect) {
78+
const animationName = webgalStore
79+
.getState()
80+
.stage.animationSettings.find((setting) => setting.target === target)?.enterAnimationName;
81+
if (animationName && !targetEffect) {
7282
logger.debug('取代默认进入动画', target);
73-
animation = getAnimationObject(animarionName, realTarget ?? target, getAnimateDuration(animarionName), false);
74-
duration = getAnimateDuration(animarionName);
75-
// 用后重置
76-
WebGAL.animationManager.nextEnterAnimationName.delete(target);
83+
animation = getAnimationObject(animationName, realTarget ?? target, getAnimateDuration(animationName), false);
84+
duration = getAnimateDuration(animationName);
7785
}
7886
return { duration, animation };
7987
} else {
8088
// exit
81-
let duration = DEFALUT_FIG_OUT_DURATION;
89+
let duration = DEFAULT_FIG_OUT_DURATION;
8290
if (isBg) {
83-
duration = 1500;
91+
duration = DEFAULT_BG_OUT_DURATION;
8492
}
93+
duration =
94+
webgalStore.getState().stage.animationSettings.find((setting) => setting.target + '-off' === target)
95+
?.exitDuration ?? duration;
8596
// 走默认动画
8697
let animation: IAnimationObject | null = generateUniversalSoftOffAnimationObj(realTarget ?? target, duration);
87-
const animarionName = WebGAL.animationManager.nextExitAnimationName.get(target);
88-
if (animarionName) {
98+
const animationName = webgalStore
99+
.getState()
100+
.stage.animationSettings.find((setting) => setting.target + '-off' === target)?.exitAnimationName;
101+
if (animationName) {
89102
logger.debug('取代默认退出动画', target);
90-
animation = getAnimationObject(animarionName, realTarget ?? target, getAnimateDuration(animarionName), false);
91-
duration = getAnimateDuration(animarionName);
92-
// 用后重置
93-
WebGAL.animationManager.nextExitAnimationName.delete(target);
103+
animation = getAnimationObject(animationName, realTarget ?? target, getAnimateDuration(animationName), false);
104+
duration = getAnimateDuration(animationName);
94105
}
95106
return { duration, animation };
96107
}

packages/webgal/src/Core/Modules/animations.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ export interface IUserAnimation {
88
export type AnimationFrame = ITransform & { duration: number; ease: string };
99

1010
export class AnimationManager {
11-
public nextEnterAnimationName: Map<string, string> = new Map();
12-
public nextExitAnimationName: Map<string, string> = new Map();
11+
// public nextEnterAnimationName: Map<string, string> = new Map();
12+
// public nextExitAnimationName: Map<string, string> = new Map();
1313
private animations: Array<IUserAnimation> = [];
1414

1515
public addAnimation(animation: IUserAnimation) {

0 commit comments

Comments
 (0)