mirror of
https://github.com/danbulant/heaventaker
synced 2026-06-16 21:21:05 +00:00
better progress save
This commit is contained in:
parent
c1895d727b
commit
84ec786f5f
2 changed files with 5 additions and 2 deletions
|
|
@ -78,7 +78,7 @@
|
|||
}, 300);
|
||||
}
|
||||
console.log("selected", d);
|
||||
if(!d.flags || !d.flags.includes("nosave")) localStorage.setItem("dialog-page", next);
|
||||
if(!d.flags || !d.flags.includes("nosave")) localStorage.setItem("dialog-page", dialog[next].name);
|
||||
if(d.chapter) {
|
||||
if(!chaptersDone.includes(d.chapter)) {
|
||||
chaptersDone.push(d.chapter);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,11 @@
|
|||
import { writable } from "svelte/store";
|
||||
import { dialog } from "./dialog";
|
||||
|
||||
export const gameActive = writable(!!parseInt(localStorage.getItem("game-active")));
|
||||
gameActive.subscribe(t => {
|
||||
localStorage.setItem("game-active", t ? 1 : 0);
|
||||
});
|
||||
export const page = writable(parseInt(localStorage.getItem("dialog-page")) || 0);
|
||||
const startPage = localStorage.getItem("dialog-page");
|
||||
const startPageIndex = dialog.findIndex(t => t.name === startPage);
|
||||
export const page = writable(startPageIndex !== -1 ? startPageIndex : 0);
|
||||
export const menuActive = writable(false);
|
||||
Loading…
Reference in a new issue