Several worlds: a Worlds list with load, rename and delete; old save migrates to World 1
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+9
-3
@@ -49,7 +49,7 @@ const SET_TABS = {
|
||||
{ k: 'save', label: 'Save', d: 'Saves to this browser.', type: 'button', text: 'Save now', fn: () => saveWorld('main'), ingame: true },
|
||||
{ k: 'export', label: 'World file', d: 'Download the world as a file you can keep or move to another browser.', type: 'button', text: 'Export', fn: exportWorld, ingame: true },
|
||||
{ k: 'import', label: 'Load a world file', type: 'button', text: 'Import', fn: () => $('importfile').click() },
|
||||
{ k: 'wipe', label: 'Delete saved worlds', d: 'Removes the saves stored in this browser.', type: 'button', text: 'Delete…', danger: true, fn: confirmWipe },
|
||||
{ k: 'wipe', label: 'Delete all worlds', d: 'Removes the saves stored in this browser.', type: 'button', text: 'Delete all worlds', danger: true, fn: confirmWipe },
|
||||
],
|
||||
};
|
||||
let setTab = 'Display';
|
||||
@@ -109,8 +109,14 @@ function toggleFullscreen() {
|
||||
} catch (e) { toast('Fullscreen is not available in this view.'); }
|
||||
}
|
||||
function confirmWipe() {
|
||||
dialog('Delete saved worlds?', '<p class="note">This removes the main save and the autosave from this browser. Exported world files are not affected.</p>', [
|
||||
dialog('Delete all worlds?', '<p class="note">This removes every world and its autosave from this browser. Exported world files are not affected.</p>', [
|
||||
{ label: 'Cancel', cls: 'ghost' },
|
||||
{ label: 'Delete saves', cls: 'danger', fn: async () => { try { await DB.del('main'); await DB.del('auto'); toast('Saves deleted.'); } catch (e) { toast('Could not reach browser storage.'); } refreshContinue(); } },
|
||||
{ label: 'Delete all worlds', cls: 'danger', fn: async () => {
|
||||
try {
|
||||
await worldWrite(() => DB.op('readwrite', st => st.clear()));
|
||||
GAME.worldId = ''; GAME.worldName = '';
|
||||
closeModal('m-dialog'); toast('All worlds deleted.'); await refreshContinue();
|
||||
} catch (e) { toast('Could not reach browser storage.'); }
|
||||
} },
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user