This commit is contained in:
2026-05-09 19:56:03 +08:00
parent 052dbc248b
commit 7c8aa1e124
12 changed files with 483 additions and 59 deletions

View File

@@ -1558,6 +1558,7 @@ export function PlatformEntryFlowShellImpl({
useState<string | null>(null);
const [isStartingRecommendEntry, setIsStartingRecommendEntry] =
useState(false);
const recommendRuntimeStartRequestRef = useRef(0);
const [, setPuzzleOperation] = useState<PuzzleAgentOperationRecord | null>(
null,
);
@@ -5651,38 +5652,36 @@ export function PlatformEntryFlowShellImpl({
],
);
const openRecommendGalleryDetail = useCallback(
const openPublicGalleryDetail = useCallback(
(entry: PlatformPublicGalleryCard) => {
runProtectedAction(() => {
if (isBigFishGalleryEntry(entry)) {
openPublicWorkDetail(entry);
return;
}
if (isBigFishGalleryEntry(entry)) {
openPublicWorkDetail(entry);
return;
}
if (isPuzzleGalleryEntry(entry)) {
void openPuzzlePublicWorkDetail(entry.profileId, {
tab: platformBootstrap.platformTab,
});
return;
}
if (isPuzzleGalleryEntry(entry)) {
void openPuzzlePublicWorkDetail(entry.profileId, {
tab: platformBootstrap.platformTab,
});
return;
}
if (isMatch3DGalleryEntry(entry)) {
openPublicWorkDetail(entry);
return;
}
if (isMatch3DGalleryEntry(entry)) {
openPublicWorkDetail(entry);
return;
}
if (isSquareHoleGalleryEntry(entry)) {
openPublicWorkDetail(entry);
return;
}
if (isSquareHoleGalleryEntry(entry)) {
openPublicWorkDetail(entry);
return;
}
if (isVisualNovelGalleryEntry(entry)) {
void openVisualNovelPublicWorkDetail(entry.profileId);
return;
}
if (isVisualNovelGalleryEntry(entry)) {
void openVisualNovelPublicWorkDetail(entry.profileId);
return;
}
void openRpgPublicWorkDetail(entry);
});
void openRpgPublicWorkDetail(entry);
},
[
openPuzzlePublicWorkDetail,
@@ -5690,9 +5689,17 @@ export function PlatformEntryFlowShellImpl({
openRpgPublicWorkDetail,
openVisualNovelPublicWorkDetail,
platformBootstrap.platformTab,
runProtectedAction,
],
);
const openRecommendGalleryDetail = useCallback(
(entry: PlatformPublicGalleryCard) => {
runProtectedAction(() => {
openPublicGalleryDetail(entry);
});
},
[openPublicGalleryDetail, runProtectedAction],
);
const openPuzzleDetail = useCallback(
async (
profileId: string,
@@ -6112,8 +6119,15 @@ export function PlatformEntryFlowShellImpl({
async (entry: PlatformPublicGalleryCard) => {
const entryKey = getPlatformPublicGalleryEntryKey(entry);
const runtimeKind = getPlatformRecommendRuntimeKind(entry);
const startRequestId = recommendRuntimeStartRequestRef.current + 1;
recommendRuntimeStartRequestRef.current = startRequestId;
const isCurrentStartRequest = () =>
recommendRuntimeStartRequestRef.current === startRequestId;
if (entryKey !== activeRecommendEntryKey) {
await saveAndExitRecommendPuzzleRuntime();
if (!isCurrentStartRequest()) {
return;
}
}
setActiveRecommendEntryKey(entryKey);
setActiveRecommendRuntimeKind(runtimeKind);
@@ -6182,9 +6196,28 @@ export function PlatformEntryFlowShellImpl({
started = true;
}
setActiveRecommendRuntimeKind(started ? runtimeKind : null);
if (!isCurrentStartRequest()) {
return;
}
if (started) {
setActiveRecommendRuntimeKind(runtimeKind);
setActiveRecommendRuntimeError(null);
} else {
setActiveRecommendRuntimeKind(null);
setActiveRecommendRuntimeError('作品暂时无法进入,请稍后再试。');
}
} catch (error) {
if (!isCurrentStartRequest()) {
return;
}
setActiveRecommendRuntimeKind(null);
setActiveRecommendRuntimeError('作品暂时无法进入,请稍后再试。');
} finally {
setIsStartingRecommendEntry(false);
if (isCurrentStartRequest()) {
setIsStartingRecommendEntry(false);
}
}
},
[
@@ -7549,7 +7582,8 @@ export function PlatformEntryFlowShellImpl({
}}
onOpenCreateWorld={openCreationTypePicker}
onOpenCreateTypePicker={openCreationTypePicker}
onOpenGalleryDetail={openRecommendGalleryDetail}
onOpenGalleryDetail={openPublicGalleryDetail}
onOpenRecommendGalleryDetail={openRecommendGalleryDetail}
recommendRuntimeContent={recommendRuntimeContent}
activeRecommendEntryKey={activeRecommendEntryKey}
isStartingRecommendEntry={