-
-
Notifications
You must be signed in to change notification settings - Fork 354
Expand file tree
/
Copy pathcallSceneScript.ts
More file actions
19 lines (18 loc) · 815 Bytes
/
Copy pathcallSceneScript.ts
File metadata and controls
19 lines (18 loc) · 815 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { ISentence } from '@/Core/controller/scene/sceneInterface';
import { createNonePerform, IPerform } from '@/Core/Modules/perform/performInterface';
import { callScene } from '../controller/scene/callScene';
/**
* 调用一个场景,在场景结束后回到调用这个场景的父场景。
* @param sentence
*/
export const callSceneScript = (sentence: ISentence): IPerform => {
const sceneNameArray: Array<string> = sentence.content.split('/');
const sceneName = sceneNameArray[sceneNameArray.length - 1];
// 从 args 中提取场景参数
const params: Record<string, any> = {};
sentence.args.forEach((arg) => {
if (arg.key.startsWith('@')) params[arg.key.slice(1)] = arg.value;
});
callScene(sentence.content, sceneName, params);
return createNonePerform({ isHoldOn: true });
};