- QTESystem: add if (!this.active) return guard in setInterval/setTimeout callbacks to prevent false result from firing after successful key press - SaveLoadMenu: restore auto-save slot 0 row with blue styling, thumbnail, scene label, and read-only load button
237 lines
4.9 KiB
Vue
237 lines
4.9 KiB
Vue
<script setup lang="ts">
|
|
import type { SlotInfo } from '@/stores/gameStore'
|
|
|
|
defineProps<{
|
|
saves: SlotInfo[]
|
|
}>()
|
|
|
|
const emit = defineEmits<{
|
|
save: [slot: number]
|
|
load: [slot: number]
|
|
close: []
|
|
}>()
|
|
|
|
const maxSlots = 5
|
|
</script>
|
|
|
|
<template>
|
|
<div class="save-overlay" @click.self="emit('close')">
|
|
<div class="save-panel">
|
|
<h2 class="save-title">存档 / 读档</h2>
|
|
|
|
<div class="slot-list">
|
|
<div class="save-slot auto-save-slot">
|
|
<div class="slot-thumb">
|
|
<img
|
|
v-if="saves.find(s => s.slot === 0)?.thumbnail"
|
|
:src="saves.find(s => s.slot === 0)!.thumbnail"
|
|
class="thumb-img"
|
|
/>
|
|
<span v-else class="thumb-empty">自动</span>
|
|
</div>
|
|
<div class="slot-meta">
|
|
<div class="slot-label auto-save-label">自动存档</div>
|
|
<div class="slot-info" v-if="saves.find(s => s.slot === 0)">
|
|
{{ saves.find(s => s.slot === 0)!.sceneLabel }}
|
|
</div>
|
|
<div class="slot-info empty" v-else>暂无自动存档</div>
|
|
</div>
|
|
<div class="slot-actions">
|
|
<button
|
|
class="slot-btn load-btn"
|
|
:disabled="!saves.find(s => s.slot === 0)"
|
|
@click="emit('load', 0)"
|
|
>
|
|
读取
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div
|
|
v-for="slot in maxSlots"
|
|
:key="slot"
|
|
class="save-slot"
|
|
>
|
|
<div class="slot-thumb">
|
|
<img
|
|
v-if="saves.find(s => s.slot === slot)?.thumbnail"
|
|
:src="saves.find(s => s.slot === slot)!.thumbnail"
|
|
class="thumb-img"
|
|
/>
|
|
<span v-else class="thumb-empty">空</span>
|
|
</div>
|
|
<div class="slot-meta">
|
|
<div class="slot-label">存档 {{ slot }}</div>
|
|
<div class="slot-info" v-if="saves.find(s => s.slot === slot)">
|
|
{{ saves.find(s => s.slot === slot)!.sceneLabel }}
|
|
</div>
|
|
<div class="slot-info empty" v-else>空</div>
|
|
</div>
|
|
<div class="slot-actions">
|
|
<button class="slot-btn save-btn" @click="emit('save', slot)">保存</button>
|
|
<button
|
|
class="slot-btn load-btn"
|
|
:disabled="!saves.find(s => s.slot === slot)"
|
|
@click="emit('load', slot)"
|
|
>
|
|
读取
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="save-hint">游戏会在每次场景切换时自动保存到槽位 0</div>
|
|
<button class="close-btn" @click="emit('close')">关闭</button>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.save-overlay {
|
|
position: fixed;
|
|
inset: 0;
|
|
background: rgba(0, 0, 0, 0.85);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
z-index: 200;
|
|
}
|
|
|
|
.save-panel {
|
|
background: #1a1a2e;
|
|
border: 1px solid rgba(255, 255, 255, 0.15);
|
|
border-radius: 8px;
|
|
padding: 32px;
|
|
min-width: 480px;
|
|
max-width: 560px;
|
|
}
|
|
|
|
.save-title {
|
|
text-align: center;
|
|
font-size: 20px;
|
|
font-weight: 400;
|
|
letter-spacing: 2px;
|
|
margin-bottom: 24px;
|
|
color: #ddd;
|
|
}
|
|
|
|
.slot-list {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 8px;
|
|
}
|
|
|
|
.save-slot {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 12px;
|
|
padding: 10px 14px;
|
|
background: rgba(255, 255, 255, 0.05);
|
|
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
border-radius: 4px;
|
|
}
|
|
|
|
.auto-save-slot {
|
|
border-color: rgba(100, 200, 255, 0.3);
|
|
background: rgba(100, 200, 255, 0.06);
|
|
}
|
|
|
|
.auto-save-label {
|
|
color: #6cf;
|
|
}
|
|
|
|
.slot-thumb {
|
|
width: 64px;
|
|
height: 36px;
|
|
background: rgba(0, 0, 0, 0.4);
|
|
border-radius: 3px;
|
|
overflow: hidden;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.thumb-img {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
}
|
|
|
|
.thumb-empty {
|
|
font-size: 12px;
|
|
color: #444;
|
|
}
|
|
|
|
.slot-meta {
|
|
flex: 1;
|
|
min-width: 0;
|
|
}
|
|
|
|
.slot-label {
|
|
font-size: 12px;
|
|
color: #888;
|
|
}
|
|
|
|
.slot-info {
|
|
font-size: 13px;
|
|
color: #ccc;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
white-space: nowrap;
|
|
}
|
|
|
|
.slot-info.empty {
|
|
color: #555;
|
|
}
|
|
|
|
.slot-actions {
|
|
display: flex;
|
|
gap: 6px;
|
|
}
|
|
|
|
.slot-btn {
|
|
padding: 6px 14px;
|
|
font-size: 13px;
|
|
border: 1px solid rgba(255, 255, 255, 0.2);
|
|
border-radius: 3px;
|
|
cursor: pointer;
|
|
background: rgba(255, 255, 255, 0.08);
|
|
color: #ddd;
|
|
transition: background 0.2s;
|
|
}
|
|
|
|
.slot-btn:hover:not(:disabled) {
|
|
background: rgba(255, 255, 255, 0.18);
|
|
}
|
|
|
|
.slot-btn:disabled {
|
|
opacity: 0.35;
|
|
cursor: default;
|
|
}
|
|
|
|
.save-hint {
|
|
text-align: center;
|
|
font-size: 12px;
|
|
color: #555;
|
|
margin-top: 16px;
|
|
}
|
|
|
|
.close-btn {
|
|
display: block;
|
|
margin: 12px auto 0;
|
|
padding: 10px 32px;
|
|
font-size: 14px;
|
|
color: #888;
|
|
background: rgba(255, 255, 255, 0.06);
|
|
border: 1px solid rgba(255, 255, 255, 0.15);
|
|
border-radius: 4px;
|
|
cursor: pointer;
|
|
}
|
|
|
|
.close-btn:hover {
|
|
color: #ccc;
|
|
background: rgba(255, 255, 255, 0.1);
|
|
}
|
|
</style>
|