print version on startup, and whether the game has loaded
This commit is contained in:
parent
fbf8830b31
commit
e3d022df68
@ -36,7 +36,7 @@ def render_base_context():
|
|||||||
base_context["scripts"] = ["https://cdn.otl-hga.net/seagull/js/seagull.js"]
|
base_context["scripts"] = ["https://cdn.otl-hga.net/seagull/js/seagull.js"]
|
||||||
base_context["seagull_pic"] = "https://cdn.otl-hga.net/seagull/image/seagull.jpg"
|
base_context["seagull_pic"] = "https://cdn.otl-hga.net/seagull/image/seagull.jpg"
|
||||||
else: # dev, serve files from here
|
else: # dev, serve files from here
|
||||||
print(base_domain)
|
#print(base_domain)
|
||||||
base_context["styles"] = [app.url_for("static", filename="css/seagull.css")]
|
base_context["styles"] = [app.url_for("static", filename="css/seagull.css")]
|
||||||
base_context["scripts"] = [app.url_for("static", filename="js/seagull.js")]
|
base_context["scripts"] = [app.url_for("static", filename="js/seagull.js")]
|
||||||
base_context["seagull_pic"] = app.url_for("static", filename="image/seagull.jpg")
|
base_context["seagull_pic"] = app.url_for("static", filename="image/seagull.jpg")
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
const ver_numeric = 0;
|
||||||
|
const ver_string = "pre alpha";
|
||||||
|
|
||||||
const sleep = ms => new Promise(r => setTimeout(r, ms)); // sleep(int ms)
|
const sleep = ms => new Promise(r => setTimeout(r, ms)); // sleep(int ms)
|
||||||
|
|
||||||
var page_elements = {};
|
var page_elements = {};
|
||||||
@ -16,8 +19,14 @@ const gamestate_default = {
|
|||||||
function prepare_gamestate() {
|
function prepare_gamestate() {
|
||||||
var gamestate_loaded = window.localStorage.getItem("gamestate");
|
var gamestate_loaded = window.localStorage.getItem("gamestate");
|
||||||
|
|
||||||
if (gamestate_loaded == null) { gamestate = structuredClone(gamestate_default); }
|
if (gamestate_loaded == null) {
|
||||||
else { gamestate = JSON.parse(gamestate_loaded); }
|
record_log("Welcome to Seagull Game! We haven't found a save in your browser storage, so we're starting a new game!");
|
||||||
|
gamestate = structuredClone(gamestate_default);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
gamestate = JSON.parse(gamestate_loaded);
|
||||||
|
record_log("Welcome back! Game loaded.")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function record_log(text) {
|
function record_log(text) {
|
||||||
@ -95,7 +104,7 @@ document.addEventListener("DOMContentLoaded", function (ev) {
|
|||||||
|
|
||||||
prepare_gamestate();
|
prepare_gamestate();
|
||||||
|
|
||||||
record_log("It works!");
|
record_log("seagull game ver. " + ver_string);
|
||||||
page_elements["lbl_name"].innerHTML = gamestate["name"];
|
page_elements["lbl_name"].innerHTML = gamestate["name"];
|
||||||
page_elements["lbl_tick"].innerHTML = gamestate["tick"];
|
page_elements["lbl_tick"].innerHTML = gamestate["tick"];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user