From 906965c963cccc88059b3c2786d88d4281f9dbdc Mon Sep 17 00:00:00 2001 From: cocos02 Date: Tue, 9 Jun 2026 17:57:21 +0800 Subject: [PATCH] fix: wire up EndingGallery click to open ChapterRecap via chapterId --- engine/types.ts | 1 + public/scenes/demo.json | 6 +++--- src/App.vue | 1 + src/components/EndingGallery.vue | 14 +++++++++++++- 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/engine/types.ts b/engine/types.ts index 8d8143f..d4e7f0e 100644 --- a/engine/types.ts +++ b/engine/types.ts @@ -92,6 +92,7 @@ export interface EndingDef { id: string label: string sceneId: string + chapterId?: string thumbnail?: string } diff --git a/public/scenes/demo.json b/public/scenes/demo.json index 681fb61..9e0b0e8 100644 --- a/public/scenes/demo.json +++ b/public/scenes/demo.json @@ -32,9 +32,9 @@ } ], "endings": [ - { "id": "trust_end", "label": "信任的伙伴", "sceneId": "trust_ending", "thumbnail": "/images/end_trust.jpg" }, - { "id": "alone_end", "label": "独行之路", "sceneId": "alone_ending", "thumbnail": "/images/end_alone.jpg" }, - { "id": "continue_end", "label": "继续前行", "sceneId": "continue_ending", "thumbnail": "/images/end_continue.jpg" } + { "id": "trust_end", "label": "信任的伙伴", "sceneId": "trust_ending", "chapterId": "ch1", "thumbnail": "/images/end_trust.jpg" }, + { "id": "alone_end", "label": "独行之路", "sceneId": "alone_ending", "chapterId": "ch1", "thumbnail": "/images/end_alone.jpg" }, + { "id": "continue_end", "label": "继续前行", "sceneId": "continue_ending", "chapterId": "ch3", "thumbnail": "/images/end_continue.jpg" } ], "chapters": [ { diff --git a/src/App.vue b/src/App.vue index 59d82f4..424bed4 100644 --- a/src/App.vue +++ b/src/App.vue @@ -240,6 +240,7 @@ init() :endings="store.endings" :visited-ids="store.visitedSceneIds" @close="showEndingGallery = false" + @select-chapter="(chId: string) => { showEndingGallery = false; recapChapterId = chId }" /> () function isUnlocked(ending: EndingDef, visitedIds: Set): boolean { @@ -25,7 +26,8 @@ function isUnlocked(ending: EndingDef, visitedIds: Set): boolean { v-for="end in endings" :key="end.id" class="ending-card" - :class="{ locked: !isUnlocked(end, visitedIds) }" + :class="{ locked: !isUnlocked(end, visitedIds), clickable: isUnlocked(end, visitedIds) && !!end.chapterId }" + @click="isUnlocked(end, visitedIds) && end.chapterId && emit('selectChapter', end.chapterId)" >
@@ -89,6 +91,16 @@ function isUnlocked(ending: EndingDef, visitedIds: Set): boolean { opacity: 0.4; } +.ending-card.clickable { + cursor: pointer; +} + +.ending-card.clickable:hover { + opacity: 0.85; + transform: scale(1.05); + transition: transform 0.15s ease; +} + .ending-thumb { width: 120px; height: 68px;