Skip to content

Commit 159d3c5

Browse files
Fix say script to replace spaces with \u00a0
Related to #539 --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/OpenWebGAL/WebGAL/issues/539?shareId=XXXX-XXXX-XXXX-XXXX).
1 parent d304fdb commit 159d3c5

File tree

1 file changed

+3
-0
lines changed
  • packages/webgal/src/Core/gameScripts

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ export const say = (sentence: ISentence): IPerform => {
2323
const dispatch = webgalStore.dispatch;
2424
let dialogKey = Math.random().toString(); // 生成一个随机的key
2525
let dialogToShow = sentence.content; // 获取对话内容
26+
if (dialogToShow) {
27+
dialogToShow = String(dialogToShow).replace(/ /g, '\u00a0'); // 替换空格
28+
}
2629
const isConcat = getSentenceArgByKey(sentence, 'concat'); // 是否是继承语句
2730
const isNotend = getSentenceArgByKey(sentence, 'notend') as boolean; // 是否有 notend 参数
2831
const speaker = getSentenceArgByKey(sentence, 'speaker'); // 获取说话者

0 commit comments

Comments
 (0)