Session 12: Save Slot System (3 slots, autosave toggle, cross-slot import/export) + fix goldenBlooms field missing from reset()/switchSlot empty-state
This commit is contained in:
@@ -11,6 +11,7 @@ const UI = {
|
||||
this.renderBuildings();
|
||||
this.renderUpgrades();
|
||||
this.renderAchievements();
|
||||
this.updateSlotUI();
|
||||
this.update();
|
||||
},
|
||||
|
||||
@@ -41,6 +42,9 @@ const UI = {
|
||||
|
||||
// Golden Starbloom countdown badge
|
||||
this.updateGoldenBloomBadge();
|
||||
|
||||
// Save Slot System highlight / toggle state
|
||||
this.updateSlotUI();
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -297,6 +301,30 @@ const UI = {
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Reflect the active save slot highlight and autosave toggle state.
|
||||
*/
|
||||
updateSlotUI() {
|
||||
// Highlight the selected slot button.
|
||||
document.querySelectorAll('.slot-btn').forEach(btn => {
|
||||
const idx = parseInt(btn.dataset.slot, 10);
|
||||
btn.classList.toggle('active', idx === Game.state.activeSlot);
|
||||
btn.disabled = idx === Game.state.activeSlot;
|
||||
});
|
||||
|
||||
// Reflect the autosave toggle state.
|
||||
const autosaveBtn = document.getElementById('autosave-btn');
|
||||
if (autosaveBtn) {
|
||||
if (Game.state.autoSave) {
|
||||
autosaveBtn.classList.add('on');
|
||||
autosaveBtn.textContent = 'ON';
|
||||
} else {
|
||||
autosaveBtn.classList.remove('on');
|
||||
autosaveBtn.textContent = 'OFF';
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Show floating text animation
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user