var desktop_mode = true; var tick_meter_running = false; async function prepare_gamestate() { var gamestate_loaded = null; try { gamestate_loaded = await window.pywebview.api.load_data("gamestate"); } catch (exc) { console.error("no gamestate"); gamestate_loaded = null; } if (gamestate_loaded == null) { record_log("Welcome to Seagull Game! We haven't found a save in your app data, so we're starting a new game!"); gamestate = structuredClone(gamestate_default); } else { console.log(gamestate_loaded); gamestate = JSON.parse(gamestate_loaded); record_log("Welcome back! Game loaded.") } tick_meter_running = true; if (window.pywebview.api.debug_mode) { dev_toolbox(true); } } function save_game() { window.pywebview.api.save_data("gamestate", JSON.stringify(gamestate)); record_log("Game saved."); } function reset_game() { tick_meter_running = false; window.pywebview.api.delete_data("gamestate"); window.location.reload(); }