chore: sync latest changes
This commit is contained in:
156
src/components/AchievementPanel.vue
Normal file
156
src/components/AchievementPanel.vue
Normal file
@@ -0,0 +1,156 @@
|
||||
<script setup lang="ts">
|
||||
import type { AchievementDef } from '@engine/types'
|
||||
|
||||
defineProps<{
|
||||
definitions: AchievementDef[]
|
||||
unlockedIds: Set<string>
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
close: []
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="ach-overlay" @click.self="emit('close')" @keydown.escape="emit('close')">
|
||||
<div class="ach-panel">
|
||||
<h2 class="ach-title">成就</h2>
|
||||
|
||||
<div class="ach-list">
|
||||
<div
|
||||
v-for="ach in definitions"
|
||||
:key="ach.id"
|
||||
class="ach-card"
|
||||
:class="{ locked: !unlockedIds.has(ach.id), hidden: ach.hidden && !unlockedIds.has(ach.id) }"
|
||||
>
|
||||
<div class="ach-icon">
|
||||
<img v-if="ach.icon" :src="ach.icon" class="ach-img" />
|
||||
<span v-else class="ach-star">{{ unlockedIds.has(ach.id) ? '⭐' : '🔒' }}</span>
|
||||
</div>
|
||||
<div class="ach-body">
|
||||
<div class="ach-title-text">
|
||||
{{ !unlockedIds.has(ach.id) && ach.hidden ? '???' : ach.title }}
|
||||
</div>
|
||||
<div class="ach-desc-text">
|
||||
{{ !unlockedIds.has(ach.id) && ach.hidden ? '' : ach.description }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button class="ach-close" @click="emit('close')">关闭</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.ach-overlay {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(0, 0, 0, 0.88);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
z-index: 200;
|
||||
}
|
||||
|
||||
.ach-panel {
|
||||
background: #1a1a2e;
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
border-radius: 10px;
|
||||
padding: 36px 40px;
|
||||
min-width: 420px;
|
||||
max-width: 520px;
|
||||
max-height: 80vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.ach-title {
|
||||
text-align: center;
|
||||
font-size: 22px;
|
||||
font-weight: 400;
|
||||
color: #ddd;
|
||||
letter-spacing: 3px;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.ach-list {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 8px;
|
||||
overflow-y: auto;
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
.ach-card {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
padding: 12px 14px;
|
||||
background: rgba(255, 255, 255, 0.04);
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
border-radius: 6px;
|
||||
}
|
||||
|
||||
.ach-card.locked {
|
||||
opacity: 0.4;
|
||||
}
|
||||
|
||||
.ach-card.hidden {
|
||||
opacity: 0.2;
|
||||
}
|
||||
|
||||
.ach-icon {
|
||||
width: 36px;
|
||||
height: 36px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.ach-star {
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.ach-img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.ach-body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 2px;
|
||||
}
|
||||
|
||||
.ach-title-text {
|
||||
font-size: 14px;
|
||||
color: #eee;
|
||||
}
|
||||
|
||||
.ach-desc-text {
|
||||
font-size: 12px;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
.ach-close {
|
||||
margin-top: 20px;
|
||||
padding: 10px 36px;
|
||||
font-size: 14px;
|
||||
color: #888;
|
||||
background: rgba(255, 255, 255, 0.05);
|
||||
border: 1px solid rgba(255, 255, 255, 0.12);
|
||||
border-radius: 4px;
|
||||
cursor: pointer;
|
||||
transition: background 0.15s, color 0.15s;
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
.ach-close:hover {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
color: #ccc;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user