fix: hotspot, demo, i18n and type updates
This commit is contained in:
@@ -35,6 +35,7 @@ export interface Choice {
|
|||||||
export interface Hotspot {
|
export interface Hotspot {
|
||||||
id: string
|
id: string
|
||||||
label: string
|
label: string
|
||||||
|
labelKey?: string
|
||||||
targetScene: string
|
targetScene: string
|
||||||
x: number
|
x: number
|
||||||
y: number
|
y: number
|
||||||
|
|||||||
@@ -125,6 +125,7 @@
|
|||||||
{
|
{
|
||||||
"id": "hs_desk",
|
"id": "hs_desk",
|
||||||
"label": "查看书桌",
|
"label": "查看书桌",
|
||||||
|
"labelKey": "scene.investigation_site.hotspot.desk",
|
||||||
"targetScene": "desk_detail",
|
"targetScene": "desk_detail",
|
||||||
"x": 154, "y": 144, "width": 230, "height": 101,
|
"x": 154, "y": 144, "width": 230, "height": 101,
|
||||||
"effects": [
|
"effects": [
|
||||||
@@ -135,12 +136,14 @@
|
|||||||
{
|
{
|
||||||
"id": "hs_window",
|
"id": "hs_window",
|
||||||
"label": "查看窗户",
|
"label": "查看窗户",
|
||||||
|
"labelKey": "scene.investigation_site.hotspot.window",
|
||||||
"targetScene": "corridor",
|
"targetScene": "corridor",
|
||||||
"x": 602, "y": 43, "width": 192, "height": 202
|
"x": 602, "y": 43, "width": 192, "height": 202
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"id": "hs_closet",
|
"id": "hs_closet",
|
||||||
"label": "检查衣柜",
|
"label": "检查衣柜",
|
||||||
|
"labelKey": "scene.investigation_site.hotspot.closet",
|
||||||
"targetScene": "desk_detail",
|
"targetScene": "desk_detail",
|
||||||
"x": 422, "y": 346, "width": 128, "height": 187,
|
"x": 422, "y": 346, "width": 128, "height": 187,
|
||||||
"conditions": [
|
"conditions": [
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
import { ref, computed, onMounted, onUnmounted } from 'vue'
|
||||||
import type { Hotspot } from '@engine/types'
|
import type { Hotspot } from '@engine/types'
|
||||||
|
import { useI18n } from '@/composables/useI18n'
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
hotspots: Hotspot[]
|
hotspots: Hotspot[]
|
||||||
@@ -9,6 +10,8 @@ const props = defineProps<{
|
|||||||
contentSize?: { w: number; h: number } | null
|
contentSize?: { w: number; h: number } | null
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
|
const { t } = useI18n()
|
||||||
|
|
||||||
const emit = defineEmits<{
|
const emit = defineEmits<{
|
||||||
clickHotspot: [hotspotId: string]
|
clickHotspot: [hotspotId: string]
|
||||||
}>()
|
}>()
|
||||||
@@ -87,9 +90,9 @@ const hotspotRects = computed<Rect[]>(() => {
|
|||||||
class="hotspot-rect"
|
class="hotspot-rect"
|
||||||
:style="hotspotRects[i] as any"
|
:style="hotspotRects[i] as any"
|
||||||
@click.stop="emit('clickHotspot', hs.id)"
|
@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>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -36,5 +36,14 @@
|
|||||||
"antiMistap": "Anti Mistap",
|
"antiMistap": "Anti Mistap",
|
||||||
"pauseEnabled": "Pause Enabled",
|
"pauseEnabled": "Pause Enabled",
|
||||||
"none": "None"
|
"none": "None"
|
||||||
|
},
|
||||||
|
"scene": {
|
||||||
|
"investigation_site": {
|
||||||
|
"hotspot": {
|
||||||
|
"desk": "Examine Desk",
|
||||||
|
"window": "Check Window",
|
||||||
|
"closet": "Inspect Closet"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -36,5 +36,14 @@
|
|||||||
"antiMistap": "防误触延迟",
|
"antiMistap": "防误触延迟",
|
||||||
"pauseEnabled": "可暂停",
|
"pauseEnabled": "可暂停",
|
||||||
"none": "无"
|
"none": "无"
|
||||||
|
},
|
||||||
|
"scene": {
|
||||||
|
"investigation_site": {
|
||||||
|
"hotspot": {
|
||||||
|
"desk": "查看书桌",
|
||||||
|
"window": "查看窗户",
|
||||||
|
"closet": "检查衣柜"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user