Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
MakinoharaShoko committed Sep 1, 2024
2 parents 28b40c6 + 0039ce1 commit 1214127
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/webgal/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "webgal",
"private": true,
"version": "4.5.6",
"version": "4.5.7",
"scripts": {
"dev": "vite --host --port 3000",
"build": "cross-env NODE_ENV=production tsc && vite build --base=./",
Expand Down
2 changes: 1 addition & 1 deletion packages/webgal/public/game/template/template.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"name":"Default Template",
"webgal-version":"4.5.6"
"webgal-version":"4.5.7"
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const whenChecker = (whenValue: string | undefined): boolean => {
if (e.match(/true/) || e.match(/false/)) {
return e;
}
return getValueFromStateElseKey(e);
return getValueFromStateElseKey(e, true);
} else return e;
})
.reduce((pre, curr) => pre + curr, '');
Expand Down
10 changes: 7 additions & 3 deletions packages/webgal/src/Core/gameScripts/setVar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export const setVar = (sentence: ISentence): IPerform => {
// 检查是否是变量名,不是就返回本身
return e;
}
const _r = getValueFromStateElseKey(e.trim());
const _r = getValueFromStateElseKey(e.trim(), true);
return typeof _r === 'string' ? `'${_r}'` : _r;
})
.reduce((pre, curr) => pre + curr, '');
Expand All @@ -68,7 +68,8 @@ export const setVar = (sentence: ISentence): IPerform => {
if (!isNaN(Number(valExp))) {
webgalStore.dispatch(targetReducerFunction({ key, value: Number(valExp) }));
} else {
webgalStore.dispatch(targetReducerFunction({ key, value: getValueFromStateElseKey(valExp) }));
// 字符串
webgalStore.dispatch(targetReducerFunction({ key, value: getValueFromStateElseKey(valExp, true) }));
}
}
if (setGlobal) {
Expand Down Expand Up @@ -113,10 +114,13 @@ export function getValueFromState(key: string) {
/**
* 取不到时返回 {key}
*/
export function getValueFromStateElseKey(key: string) {
export function getValueFromStateElseKey(key: string, useKeyNameAsReturn = false) {
const valueFromState = getValueFromState(key);
if (valueFromState === null || valueFromState === undefined) {
logger.warn('valueFromState result null, key = ' + key);
if (useKeyNameAsReturn) {
return key;
}
return `{${key}}`;
}
return valueFromState;
Expand Down
2 changes: 1 addition & 1 deletion packages/webgal/src/config/info.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const __INFO = {
version: 'WebGAL 4.5.6',
version: 'WebGAL 4.5.7',
contributors: [
// 现在改为跳转到 GitHub 了
],
Expand Down
6 changes: 3 additions & 3 deletions releasenote.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

#### 修复

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

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

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

#### Bug Fixes

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

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

Expand Down Expand Up @@ -96,7 +96,7 @@ Fixed the logo image issue.

#### 修正

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

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

Expand Down

0 comments on commit 1214127

Please sign in to comment.