feat: battle system, state manager enhancements, engine and demo updates
This commit is contained in:
114
src/components/BattleResult.vue
Normal file
114
src/components/BattleResult.vue
Normal file
@@ -0,0 +1,114 @@
|
||||
<script setup lang="ts">
|
||||
import type { BattleResultDef } from '@engine/types'
|
||||
import { useGameStore } from '@/stores/gameStore'
|
||||
import { useI18n } from '@/composables/useI18n'
|
||||
|
||||
defineProps<{
|
||||
result: BattleResultDef
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
continue: []
|
||||
}>()
|
||||
|
||||
const store = useGameStore()
|
||||
const { t } = useI18n()
|
||||
|
||||
function statValue(variable: string): number {
|
||||
return store.variable(variable)
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="battle-result-overlay" @click.self="emit('continue')" @keydown.escape="emit('continue')">
|
||||
<div class="battle-result-panel">
|
||||
<h2 class="result-title">{{ t(result.titleKey || result.title) }}</h2>
|
||||
|
||||
<div class="result-stats">
|
||||
<div class="result-stat" v-for="s in result.stats" :key="s.variable">
|
||||
<span class="rstat-label">{{ t(s.labelKey || s.label) }}</span>
|
||||
<span class="rstat-value">
|
||||
{{ statValue(s.variable) }}
|
||||
<span v-if="s.max !== undefined"> / {{ s.max }}</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="result-continue" @click="emit('continue')">{{ t('ui.continue') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.battle-result-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.85);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 200;
|
||||
}
|
||||
|
||||
.battle-result-panel {
|
||||
background: #1a1a2e;
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
border-radius: 10px;
|
||||
padding: 36px 40px;
|
||||
min-width: 340px;
|
||||
max-width: 440px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.result-title {
|
||||
font-size: 24px;
|
||||
font-weight: 400;
|
||||
color: #ffc107;
|
||||
letter-spacing: 4px;
|
||||
margin-bottom: 28px;
|
||||
}
|
||||
|
||||
.result-stats {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.result-stat {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
padding: 10px 16px;
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.rstat-label {
|
||||
font-size: 14px;
|
||||
color: #aaa;
|
||||
}
|
||||
|
||||
.rstat-value {
|
||||
font-size: 14px;
|
||||
color: #eee;
|
||||
}
|
||||
|
||||
.result-continue {
|
||||
margin-top: 24px;
|
||||
padding: 12px 48px;
|
||||
font-size: 16px;
|
||||
color: #fff;
|
||||
background: rgba(255, 255, 255, 0.08);
|
||||
border: 1px solid rgba(255, 255, 255, 0.2);
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
letter-spacing: 2px;
|
||||
transition: background 0.15s;
|
||||
}
|
||||
|
||||
.result-continue:hover {
|
||||
background: rgba(255, 255, 255, 0.15);
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user