fix: QTE false race condition + restore auto-save slot in menu
- 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
This commit is contained in:
@@ -37,6 +37,7 @@ export class QTESystem {
|
|||||||
document.addEventListener('keydown', this.keyHandler)
|
document.addEventListener('keydown', this.keyHandler)
|
||||||
|
|
||||||
this.timerId = setInterval(() => {
|
this.timerId = setInterval(() => {
|
||||||
|
if (!this.active) return
|
||||||
const elapsed = Date.now() - startTime
|
const elapsed = Date.now() - startTime
|
||||||
const remaining = Math.max(0, total - elapsed)
|
const remaining = Math.max(0, total - elapsed)
|
||||||
onUpdate(remaining / 1000, qte.timeLimit)
|
onUpdate(remaining / 1000, qte.timeLimit)
|
||||||
@@ -47,6 +48,7 @@ export class QTESystem {
|
|||||||
}, this.tickMs)
|
}, this.tickMs)
|
||||||
|
|
||||||
this.timeoutId = setTimeout(() => {
|
this.timeoutId = setTimeout(() => {
|
||||||
|
if (!this.active) return
|
||||||
this.clear()
|
this.clear()
|
||||||
onResult(false)
|
onResult(false)
|
||||||
}, total)
|
}, total)
|
||||||
|
|||||||
@@ -20,6 +20,33 @@ const maxSlots = 5
|
|||||||
<h2 class="save-title">存档 / 读档</h2>
|
<h2 class="save-title">存档 / 读档</h2>
|
||||||
|
|
||||||
<div class="slot-list">
|
<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
|
<div
|
||||||
v-for="slot in maxSlots"
|
v-for="slot in maxSlots"
|
||||||
:key="slot"
|
:key="slot"
|
||||||
@@ -104,6 +131,15 @@ const maxSlots = 5
|
|||||||
border-radius: 4px;
|
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 {
|
.slot-thumb {
|
||||||
width: 64px;
|
width: 64px;
|
||||||
height: 36px;
|
height: 36px;
|
||||||
|
|||||||
Reference in New Issue
Block a user