Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions packages/webgal/src/Core/controller/gamePlay/scriptExecutor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ export const whenChecker = (whenValue: string | undefined): boolean => {
return !!strIf(valExp);
};

function settleFastPreviewPendingStateBeforeNext() {
if (!WebGAL.gameplay.isFastPreview) {
return;
}

// fast preview 的 -next 链不会在语句之间 commit,需要先结算当前句会影响后续演算的 pending 终态。
WebGAL.gameplay.performController.discardUncommittedNonHoldPerforms(true);
WebGAL.gameplay.performController.clearNonHoldPerformsFromStageState();
}

/**
* 语句执行器
* 执行语句,同步场景状态,并根据情况立即执行下一句或者加入backlog
Expand Down Expand Up @@ -147,6 +157,7 @@ export const scriptExecutor = (depth = 0) => {
// 执行“下一句”。只有需要外部输入才能确定后续状态的演出,才会阻塞状态演算。
if (isNext && !hasPendingBlockingStateCalculationPerform && !WebGAL.sceneManager.lockSceneWrite) {
WebGAL.sceneManager.sceneData.currentSentenceId++;
settleFastPreviewPendingStateBeforeNext();
saveBacklogIfNeeded();
scriptExecutor(depth + 1);
return;
Expand Down
Loading