diff --git a/packages/webgal/package.json b/packages/webgal/package.json index ed59ae5ac..cf884027a 100644 --- a/packages/webgal/package.json +++ b/packages/webgal/package.json @@ -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=./", diff --git a/packages/webgal/public/game/template/template.json b/packages/webgal/public/game/template/template.json index 8a398b19a..ea42e4120 100644 --- a/packages/webgal/public/game/template/template.json +++ b/packages/webgal/public/game/template/template.json @@ -1,4 +1,4 @@ { "name":"Default Template", - "webgal-version":"4.5.6" + "webgal-version":"4.5.7" } diff --git a/packages/webgal/src/Core/controller/gamePlay/scriptExecutor.ts b/packages/webgal/src/Core/controller/gamePlay/scriptExecutor.ts index db7d6d0ca..3370b99a5 100644 --- a/packages/webgal/src/Core/controller/gamePlay/scriptExecutor.ts +++ b/packages/webgal/src/Core/controller/gamePlay/scriptExecutor.ts @@ -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, ''); diff --git a/packages/webgal/src/Core/gameScripts/setVar.ts b/packages/webgal/src/Core/gameScripts/setVar.ts index a1f8d18f6..ff6ac5508 100644 --- a/packages/webgal/src/Core/gameScripts/setVar.ts +++ b/packages/webgal/src/Core/gameScripts/setVar.ts @@ -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, ''); @@ -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) { @@ -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; diff --git a/packages/webgal/src/config/info.ts b/packages/webgal/src/config/info.ts index ec3046f15..dc89641af 100644 --- a/packages/webgal/src/config/info.ts +++ b/packages/webgal/src/config/info.ts @@ -1,5 +1,5 @@ export const __INFO = { - version: 'WebGAL 4.5.6', + version: 'WebGAL 4.5.7', contributors: [ // 现在改为跳转到 GitHub 了 ], diff --git a/releasenote.md b/releasenote.md index 9bcccc0aa..6a9a3ac66 100644 --- a/releasenote.md +++ b/releasenote.md @@ -12,7 +12,7 @@ #### 修复 -4.5.6 修复:无法从状态中获取到对应 key 的变量时,返回 {key} 以避免变换不生效 +4.5.7 修复:无法从状态中获取到对应 key 的变量时,返回 {key} 以避免变换不生效 修复了 `-concat` 选项动画在新行中的错误。 @@ -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. @@ -96,7 +96,7 @@ Fixed the logo image issue. #### 修正 -4.5.6 修正:状態から対応する key の変数が取得できない場合、{key} を返すようにし、変換が無効になるのを回避しました +4.5.7 修正:状態から対応する key の変数が取得できない場合、{key} を返すようにし、変換が無効になるのを回避しました `-concat` オプションのアニメーションが新しい行でエラーになる問題を修正しました。