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
5 changes: 3 additions & 2 deletions packages/webgal/src/Core/gameScripts/getUserInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import styles from './getUserInput.module.scss';
import { useSEByWebgalStore } from '@/hooks/useSoundEffect';
import { WebGAL } from '@/Core/WebGAL';
import { getStringArgByKey } from '@/Core/util/getSentenceArg';
import { continueSentence } from '@/Core/controller/gamePlay/nextSentence';
import { getCurrentFontFamily } from '@/hooks/useFontFamily';
import { logger } from '@/Core/util/logger';
import { tryToRegex } from '@/Core/util/global';
Expand Down Expand Up @@ -74,8 +73,8 @@ export const getUserInput = (sentence: ISentence): IPerform => {
});
}
playSeClick();
// 卸载时由 goNextWhenOver 继续推进,这里不能再手动推进,否则与 -continue 叠加会推进两次
WebGAL.gameplay.performController.unmountPerform('userInput');
continueSentence();
}}
className={styles.button}
>
Expand All @@ -102,5 +101,7 @@ export const getUserInput = (sentence: ISentence): IPerform => {
blockingNext: () => true,
blockingAuto: () => true,
blockingStateCalculation: () => true,
// 确认输入后总是继续,无论是否带 -continue
goNextWhenOver: true,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Defer continuation until the unmount loop has finished

When a normal getUserInput is immediately followed by another getUserInput, confirming the first now skips the second prompt. unmountPerform('userInput') synchronously invokes goNextWhenOver, so the next prompt is started and appended with the same perform name while the original unmountPerform loop is still running; that loop then encounters the newly added perform, unmounts it, and advances again without collecting its value. Continue only after unmountPerform has returned, or ensure the controller processes only the performs present when unmounting began.

Useful? React with 👍 / 👎.

};
};
Loading