init
This commit is contained in:
71
src/components/ChoicePanel.vue
Normal file
71
src/components/ChoicePanel.vue
Normal file
@@ -0,0 +1,71 @@
|
||||
<script setup lang="ts">
|
||||
import type { Choice } from '@engine/types'
|
||||
|
||||
const props = defineProps<{
|
||||
choices: Choice[]
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
choose: [index: number]
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="choice-panel" v-if="choices.length > 0">
|
||||
<div class="choice-prompt">做出你的选择</div>
|
||||
<div class="choice-list">
|
||||
<button
|
||||
v-for="(choice, index) in choices"
|
||||
:key="index"
|
||||
class="choice-btn"
|
||||
@click="emit('choose', index)"
|
||||
>
|
||||
{{ choice.text }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.choice-panel {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
background: linear-gradient(transparent, rgba(0, 0, 0, 0.85));
|
||||
padding: 40px 20px 30px;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
.choice-prompt {
|
||||
color: #ccc;
|
||||
font-size: 14px;
|
||||
text-align: center;
|
||||
margin-bottom: 16px;
|
||||
letter-spacing: 2px;
|
||||
}
|
||||
|
||||
.choice-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
max-width: 500px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
.choice-btn {
|
||||
padding: 14px 24px;
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: background 0.2s, border-color 0.2s;
|
||||
}
|
||||
|
||||
.choice-btn:hover {
|
||||
background: rgba(255, 255, 255, 0.25);
|
||||
border-color: rgba(255, 255, 255, 0.6);
|
||||
}
|
||||
</style>
|
||||
40
src/components/GamePlayer.vue
Normal file
40
src/components/GamePlayer.vue
Normal file
@@ -0,0 +1,40 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
|
||||
const emit = defineEmits<{
|
||||
videoReady: [el: HTMLVideoElement]
|
||||
}>()
|
||||
|
||||
const videoRef = ref<HTMLVideoElement | null>(null)
|
||||
|
||||
onMounted(() => {
|
||||
if (videoRef.value) {
|
||||
emit('videoReady', videoRef.value)
|
||||
}
|
||||
})
|
||||
|
||||
defineExpose({ videoRef })
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="game-player">
|
||||
<video ref="videoRef" class="player-video" preload="auto"></video>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.game-player {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background: #000;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.player-video {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user