fix: hotspot, demo, i18n and type updates

This commit is contained in:
2026-06-10 16:10:23 +08:00
parent d2dae38f05
commit 0a1147c2fe
5 changed files with 28 additions and 3 deletions

View File

@@ -35,6 +35,7 @@ export interface Choice {
export interface Hotspot {
id: string
label: string
labelKey?: string
targetScene: string
x: number
y: number

View File

@@ -125,6 +125,7 @@
{
"id": "hs_desk",
"label": "查看书桌",
"labelKey": "scene.investigation_site.hotspot.desk",
"targetScene": "desk_detail",
"x": 154, "y": 144, "width": 230, "height": 101,
"effects": [
@@ -135,12 +136,14 @@
{
"id": "hs_window",
"label": "查看窗户",
"labelKey": "scene.investigation_site.hotspot.window",
"targetScene": "corridor",
"x": 602, "y": 43, "width": 192, "height": 202
},
{
"id": "hs_closet",
"label": "检查衣柜",
"labelKey": "scene.investigation_site.hotspot.closet",
"targetScene": "desk_detail",
"x": 422, "y": 346, "width": 128, "height": 187,
"conditions": [

View File

@@ -1,6 +1,7 @@
<script setup lang="ts">
import { ref, computed, onMounted, onUnmounted } from 'vue'
import type { Hotspot } from '@engine/types'
import { useI18n } from '@/composables/useI18n'
const props = defineProps<{
hotspots: Hotspot[]
@@ -9,6 +10,8 @@ const props = defineProps<{
contentSize?: { w: number; h: number } | null
}>()
const { t } = useI18n()
const emit = defineEmits<{
clickHotspot: [hotspotId: string]
}>()
@@ -87,9 +90,9 @@ const hotspotRects = computed<Rect[]>(() => {
class="hotspot-rect"
:style="hotspotRects[i] as any"
@click.stop="emit('clickHotspot', hs.id)"
:title="hs.label"
:title="t(hs.labelKey || hs.label)"
>
<span class="hotspot-label">{{ hs.label }}</span>
<span class="hotspot-label">{{ t(hs.labelKey || hs.label) }}</span>
</div>
</div>
</template>

View File

@@ -36,5 +36,14 @@
"antiMistap": "Anti Mistap",
"pauseEnabled": "Pause Enabled",
"none": "None"
},
"scene": {
"investigation_site": {
"hotspot": {
"desk": "Examine Desk",
"window": "Check Window",
"closet": "Inspect Closet"
}
}
}
}

View File

@@ -36,5 +36,14 @@
"antiMistap": "防误触延迟",
"pauseEnabled": "可暂停",
"none": "无"
},
"scene": {
"investigation_site": {
"hotspot": {
"desk": "查看书桌",
"window": "查看窗户",
"closet": "检查衣柜"
}
}
}
}