1
This commit is contained in:
@@ -4699,6 +4699,31 @@ export function PlatformEntryFlowShellImpl({
|
||||
],
|
||||
);
|
||||
|
||||
const saveAndExitRecommendPuzzleRuntime = useCallback(async () => {
|
||||
if (activeRecommendRuntimeKind !== 'puzzle') {
|
||||
return;
|
||||
}
|
||||
|
||||
const currentRun = puzzleRunRef.current;
|
||||
if (!currentRun) {
|
||||
setActiveRecommendRuntimeKind(null);
|
||||
return;
|
||||
}
|
||||
|
||||
// 中文注释:推荐页嵌入拼图的“保存并退出”沿用现有运行态语义;
|
||||
// 正式 run 的每次交换/拖动/通关已写回后端,退出时只收口暂停和本地快照。
|
||||
const closedRun = currentRun.currentLevel
|
||||
? setLocalPuzzlePaused(currentRun, false)
|
||||
: currentRun;
|
||||
puzzleRunRef.current = null;
|
||||
setPuzzleRun(null);
|
||||
setActiveRecommendRuntimeKind(null);
|
||||
|
||||
if (closedRun.currentLevel) {
|
||||
setPuzzleError(null);
|
||||
}
|
||||
}, [activeRecommendRuntimeKind, setPuzzleError]);
|
||||
|
||||
const leaveAgentWorkspace = useCallback(() => {
|
||||
enterCreateTab();
|
||||
sessionController.resetSessionViewState();
|
||||
@@ -5952,6 +5977,9 @@ export function PlatformEntryFlowShellImpl({
|
||||
async (entry: PlatformPublicGalleryCard) => {
|
||||
const entryKey = getPlatformPublicGalleryEntryKey(entry);
|
||||
const runtimeKind = getPlatformRecommendRuntimeKind(entry);
|
||||
if (entryKey !== activeRecommendEntryKey) {
|
||||
await saveAndExitRecommendPuzzleRuntime();
|
||||
}
|
||||
setActiveRecommendEntryKey(entryKey);
|
||||
setActiveRecommendRuntimeKind(runtimeKind);
|
||||
setActiveRecommendRuntimeError(null);
|
||||
@@ -6025,6 +6053,8 @@ export function PlatformEntryFlowShellImpl({
|
||||
}
|
||||
},
|
||||
[
|
||||
activeRecommendEntryKey,
|
||||
saveAndExitRecommendPuzzleRuntime,
|
||||
selectedPuzzleDetail,
|
||||
setBigFishError,
|
||||
setMatch3DError,
|
||||
@@ -6037,6 +6067,38 @@ export function PlatformEntryFlowShellImpl({
|
||||
startVisualNovelRunFromProfile,
|
||||
],
|
||||
);
|
||||
const selectAdjacentRecommendRuntimeEntry = useCallback(
|
||||
(direction: 1 | -1) => {
|
||||
if (recommendRuntimeEntries.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
const activeIndex = recommendRuntimeEntries.findIndex(
|
||||
(entry) =>
|
||||
getPlatformPublicGalleryEntryKey(entry) === activeRecommendEntryKey,
|
||||
);
|
||||
const baseIndex = activeIndex >= 0 ? activeIndex : 0;
|
||||
const nextIndex =
|
||||
(baseIndex + direction + recommendRuntimeEntries.length) %
|
||||
recommendRuntimeEntries.length;
|
||||
const nextEntry = recommendRuntimeEntries[nextIndex];
|
||||
if (!nextEntry) {
|
||||
return;
|
||||
}
|
||||
if (
|
||||
getPlatformPublicGalleryEntryKey(nextEntry) === activeRecommendEntryKey
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
void selectRecommendRuntimeEntry(nextEntry);
|
||||
},
|
||||
[
|
||||
activeRecommendEntryKey,
|
||||
recommendRuntimeEntries,
|
||||
selectRecommendRuntimeEntry,
|
||||
],
|
||||
);
|
||||
|
||||
const recommendRuntimeContent = useMemo(() => {
|
||||
if (
|
||||
@@ -6153,6 +6215,8 @@ export function PlatformEntryFlowShellImpl({
|
||||
}
|
||||
error={puzzleError}
|
||||
embedded
|
||||
hideBackButton
|
||||
hideExitControls
|
||||
onBack={() => {
|
||||
setActiveRecommendRuntimeKind(null);
|
||||
}}
|
||||
@@ -6270,7 +6334,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex h-full min-h-0 items-center justify-center bg-black px-5 text-center text-sm font-semibold leading-6 text-white">
|
||||
<div className={`platform-theme ${platformThemeClass} flex h-full min-h-0 items-center justify-center bg-[var(--platform-recommend-runtime-state-fill)] px-5 text-center text-sm font-semibold leading-6 text-[var(--platform-recommend-runtime-state-text)]`}>
|
||||
正在读取世界
|
||||
</div>
|
||||
);
|
||||
@@ -6291,6 +6355,7 @@ export function PlatformEntryFlowShellImpl({
|
||||
match3dError,
|
||||
match3dFlow,
|
||||
match3dRun,
|
||||
platformThemeClass,
|
||||
puzzleError,
|
||||
puzzleRun,
|
||||
recommendRuntimeEntries,
|
||||
@@ -7357,9 +7422,12 @@ export function PlatformEntryFlowShellImpl({
|
||||
isVisualNovelBusy
|
||||
}
|
||||
recommendRuntimeError={activeRecommendRuntimeError}
|
||||
onSelectRecommendEntry={(entry) => {
|
||||
void selectRecommendRuntimeEntry(entry);
|
||||
}}
|
||||
onSelectNextRecommendEntry={() =>
|
||||
selectAdjacentRecommendRuntimeEntry(1)
|
||||
}
|
||||
onSelectPreviousRecommendEntry={() =>
|
||||
selectAdjacentRecommendRuntimeEntry(-1)
|
||||
}
|
||||
onOpenLibraryDetail={(entry) => {
|
||||
runProtectedAction(() => {
|
||||
void detailNavigation.openLibraryDetail(entry);
|
||||
|
||||
Reference in New Issue
Block a user