mirror of
https://github.com/tobspr/shapez.io.git
synced 2026-03-02 03:39:21 +00:00
V 1.0.1
This commit is contained in:
@@ -19,7 +19,7 @@ if (window.coreThreadLoadedCb) {
|
||||
}
|
||||
|
||||
console.log(
|
||||
`%cshapez.io ️%c\n© 2019 Tobias Springer IT Solutions\nCommit %c${G_BUILD_COMMIT_HASH}%c on %c${new Date(
|
||||
`%cshapez.io ️%c\n© 2020 Tobias Springer IT Solutions\nCommit %c${G_BUILD_COMMIT_HASH}%c on %c${new Date(
|
||||
G_BUILD_TIME
|
||||
).toLocaleString()}\n`,
|
||||
"font-size: 35px; font-family: Arial;font-weight: bold; padding: 10px 0;",
|
||||
|
||||
@@ -3,6 +3,8 @@ import { createLogger } from "../core/logging";
|
||||
import { findNiceValue, waitNextFrame } from "../core/utils";
|
||||
import { cachebust } from "../core/cachebust";
|
||||
import { PlatformWrapperImplBrowser } from "../platform/browser/wrapper";
|
||||
import { T } from "../translations";
|
||||
import { HUDModalDialogs } from "../game/hud/parts/modal_dialogs";
|
||||
|
||||
const logger = createLogger("state/preload");
|
||||
|
||||
@@ -44,9 +46,9 @@ export class PreloadState extends GameState {
|
||||
}
|
||||
}
|
||||
|
||||
// this.dialogs = new HUDModalDialogs(null, this.app);
|
||||
// const dialogsElement = document.body.querySelector(".modalDialogParent");
|
||||
// this.dialogs.initializeToElement(dialogsElement);
|
||||
this.dialogs = new HUDModalDialogs(null, this.app);
|
||||
const dialogsElement = document.body.querySelector(".modalDialogParent");
|
||||
this.dialogs.initializeToElement(dialogsElement);
|
||||
|
||||
this.statusText = this.htmlElement.querySelector(".loadingStatus > .desc");
|
||||
this.statusBar = this.htmlElement.querySelector(".loadingStatus > .bar > .inner");
|
||||
@@ -64,6 +66,42 @@ export class PreloadState extends GameState {
|
||||
startLoading() {
|
||||
this.setStatus("Booting")
|
||||
|
||||
.then(() => this.setStatus("Checking for updates"))
|
||||
.then(() => {
|
||||
if (G_IS_STANDALONE || true) {
|
||||
return Promise.race([
|
||||
new Promise(resolve => setTimeout(resolve, 10000)),
|
||||
fetch(
|
||||
"https://itch.io/api/1/x/wharf/latest?target=tobspr/shapezio&channel_name=windows",
|
||||
{
|
||||
cache: "no-cache",
|
||||
}
|
||||
)
|
||||
.then(res => res.json())
|
||||
.then(({ latest }) => {
|
||||
if (latest !== G_BUILD_VERSION) {
|
||||
const { ok, viewUpdate } = this.dialogs.showInfo(
|
||||
T.dialogs.newUpdate.title,
|
||||
T.dialogs.newUpdate.desc,
|
||||
["ok:good", "viewUpdate:good"]
|
||||
);
|
||||
|
||||
return new Promise(resolve => {
|
||||
ok.add(resolve);
|
||||
viewUpdate.add(() => {
|
||||
window.open("https://tobspr.itch.io/shapezio", "_blank");
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch(err => {
|
||||
logger.log("Failed to fetch version:", err);
|
||||
}),
|
||||
]);
|
||||
}
|
||||
})
|
||||
|
||||
.then(() => this.setStatus("Creating platform wrapper"))
|
||||
.then(() => this.app.platformWrapper.initialize())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user