Skip to content

Commit e3ff937

Browse files
Merge branch 'dev'
2 parents 121efd0 + 303d846 commit e3ff937

File tree

6 files changed

+14
-10
lines changed

6 files changed

+14
-10
lines changed

packages/webgal/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "webgal",
33
"private": true,
4-
"version": "4.5.6",
4+
"version": "4.5.7",
55
"scripts": {
66
"dev": "vite --host --port 3000",
77
"build": "cross-env NODE_ENV=production tsc && vite build --base=./",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
22
"name":"Default Template",
3-
"webgal-version":"4.5.6"
3+
"webgal-version":"4.5.7"
44
}

packages/webgal/src/Core/controller/gamePlay/scriptExecutor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const whenChecker = (whenValue: string | undefined): boolean => {
2525
if (e.match(/true/) || e.match(/false/)) {
2626
return e;
2727
}
28-
return getValueFromStateElseKey(e);
28+
return getValueFromStateElseKey(e, true);
2929
} else return e;
3030
})
3131
.reduce((pre, curr) => pre + curr, '');

packages/webgal/src/Core/gameScripts/setVar.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const setVar = (sentence: ISentence): IPerform => {
4343
// 检查是否是变量名,不是就返回本身
4444
return e;
4545
}
46-
const _r = getValueFromStateElseKey(e.trim());
46+
const _r = getValueFromStateElseKey(e.trim(), true);
4747
return typeof _r === 'string' ? `'${_r}'` : _r;
4848
})
4949
.reduce((pre, curr) => pre + curr, '');
@@ -68,7 +68,8 @@ export const setVar = (sentence: ISentence): IPerform => {
6868
if (!isNaN(Number(valExp))) {
6969
webgalStore.dispatch(targetReducerFunction({ key, value: Number(valExp) }));
7070
} else {
71-
webgalStore.dispatch(targetReducerFunction({ key, value: getValueFromStateElseKey(valExp) }));
71+
// 字符串
72+
webgalStore.dispatch(targetReducerFunction({ key, value: getValueFromStateElseKey(valExp, true) }));
7273
}
7374
}
7475
if (setGlobal) {
@@ -113,10 +114,13 @@ export function getValueFromState(key: string) {
113114
/**
114115
* 取不到时返回 {key}
115116
*/
116-
export function getValueFromStateElseKey(key: string) {
117+
export function getValueFromStateElseKey(key: string, useKeyNameAsReturn = false) {
117118
const valueFromState = getValueFromState(key);
118119
if (valueFromState === null || valueFromState === undefined) {
119120
logger.warn('valueFromState result null, key = ' + key);
121+
if (useKeyNameAsReturn) {
122+
return key;
123+
}
120124
return `{${key}}`;
121125
}
122126
return valueFromState;

packages/webgal/src/config/info.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export const __INFO = {
2-
version: 'WebGAL 4.5.6',
2+
version: 'WebGAL 4.5.7',
33
contributors: [
44
// 现在改为跳转到 GitHub 了
55
],

releasenote.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#### 修复
1414

15-
4.5.6 修复:无法从状态中获取到对应 key 的变量时,返回 {key} 以避免变换不生效
15+
4.5.7 修复:无法从状态中获取到对应 key 的变量时,返回 {key} 以避免变换不生效
1616

1717
修复了 `-concat` 选项动画在新行中的错误。
1818

@@ -54,7 +54,7 @@ Added a new parameter to control "execute the next statement after the performan
5454

5555
#### Bug Fixes
5656

57-
4.5.6 Fix: When the corresponding key variable cannot be obtained from the state, return {key} to avoid ineffective transformation.
57+
4.5.7 Fix: When the corresponding key variable cannot be obtained from the state, return {key} to avoid ineffective transformation.
5858

5959
Fixed an animation error with the `-concat` option in a new line.
6060

@@ -96,7 +96,7 @@ Fixed the logo image issue.
9696

9797
#### 修正
9898

99-
4.5.6 修正:状態から対応する key の変数が取得できない場合、{key} を返すようにし、変換が無効になるのを回避しました
99+
4.5.7 修正:状態から対応する key の変数が取得できない場合、{key} を返すようにし、変換が無効になるのを回避しました
100100

101101
`-concat` オプションのアニメーションが新しい行でエラーになる問題を修正しました。
102102

0 commit comments

Comments
 (0)