fix: wire up EndingGallery click to open ChapterRecap via chapterId
This commit is contained in:
@@ -92,6 +92,7 @@ export interface EndingDef {
|
||||
id: string
|
||||
label: string
|
||||
sceneId: string
|
||||
chapterId?: string
|
||||
thumbnail?: string
|
||||
}
|
||||
|
||||
|
||||
@@ -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": [
|
||||
{
|
||||
|
||||
@@ -240,6 +240,7 @@ init()
|
||||
:endings="store.endings"
|
||||
:visited-ids="store.visitedSceneIds"
|
||||
@close="showEndingGallery = false"
|
||||
@select-chapter="(chId: string) => { showEndingGallery = false; recapChapterId = chId }"
|
||||
/>
|
||||
<ChapterRecap
|
||||
v-if="recapChapterId"
|
||||
|
||||
@@ -8,6 +8,7 @@ defineProps<{
|
||||
|
||||
const emit = defineEmits<{
|
||||
close: []
|
||||
selectChapter: [chapterId: string]
|
||||
}>()
|
||||
|
||||
function isUnlocked(ending: EndingDef, visitedIds: Set<string>): boolean {
|
||||
@@ -25,7 +26,8 @@ function isUnlocked(ending: EndingDef, visitedIds: Set<string>): 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)"
|
||||
>
|
||||
<div class="ending-thumb">
|
||||
<img v-if="end.thumbnail" :src="end.thumbnail" class="thumb-img" />
|
||||
@@ -89,6 +91,16 @@ function isUnlocked(ending: EndingDef, visitedIds: Set<string>): 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;
|
||||
|
||||
Reference in New Issue
Block a user