From 64a3c4f310d8866b354453f016f454188be5013c Mon Sep 17 00:00:00 2001 From: IvarK Date: Thu, 17 Mar 2022 01:29:36 +0200 Subject: [PATCH] implement title screen modal, might be totally useless --- javascripts/core/app/modal.js | 2 + javascripts/core/storage/cloud-saving.js | 11 ++ javascripts/game.js | 3 +- src/components/modals/TitleScreenModal.vue | 124 +++++++++++++++++++++ 4 files changed, 139 insertions(+), 1 deletion(-) create mode 100644 src/components/modals/TitleScreenModal.vue diff --git a/javascripts/core/app/modal.js b/javascripts/core/app/modal.js index bf7a78141..aa023bcfe 100644 --- a/javascripts/core/app/modal.js +++ b/javascripts/core/app/modal.js @@ -1,4 +1,5 @@ import MessageModal from "@/components/modals/MessageModal"; +import TitleScreenModal from "@/components/modals/TitleScreenModal"; import CelestialQuoteModal from "@/components/modals/CelestialQuoteModal"; import CloudSaveConflictModal from "@/components/modals/cloud/CloudSaveConflictModal"; import CloudLoadConflictModal from "@/components/modals/cloud/CloudLoadConflictModal"; @@ -145,6 +146,7 @@ Modal.enterSpeedrun = new Modal(SpeedrunModeModal); Modal.changeName = new Modal(ChangeNameModal); Modal.armageddon = new Modal(ArmageddonModal); +Modal.titleScreenModal = new Modal(TitleScreenModal, true); Modal.confirmationOptions = new Modal(ConfirmationOptionsModal); Modal.infoDisplayOptions = new Modal(InfoDisplayOptionsModal); Modal.awayProgressOptions = new Modal(AwayProgressOptionsModal); diff --git a/javascripts/core/storage/cloud-saving.js b/javascripts/core/storage/cloud-saving.js index a682ea1dd..1e77c879a 100644 --- a/javascripts/core/storage/cloud-saving.js +++ b/javascripts/core/storage/cloud-saving.js @@ -128,6 +128,17 @@ export const Cloud = { return null; }, + async getCloudAntimatters() { + const save = await this.load(); + if (save === null) { + GameUI.notify.info(`No cloud save for user ${this.user.displayName}`); + return [10, 10, 10]; + } + + const root = GameSaveSerializer.deserialize(save); + return [0, 1, 2].map(id => root.saves[id]?.antimatter || 10); + }, + logout() { signOut(this.auth); }, diff --git a/javascripts/game.js b/javascripts/game.js index cfdf08aa0..7acbf26b1 100644 --- a/javascripts/game.js +++ b/javascripts/game.js @@ -3,6 +3,7 @@ import { DC } from "./core/constants.js"; import { SpeedrunMilestones } from "./core/speedrun.js"; import TWEEN from "tween.js"; import { deepmergeAll } from "@/utility/deepmerge"; +import { Modal } from "./core/globals.js"; if (GlobalErrorHandler.handled) { throw new Error("Initialization failed"); @@ -1067,7 +1068,7 @@ window.onload = function() { if (kong.enabled) { playFabLogin(); } - document.getElementById("loading").style.display = "none"; + Modal.titleScreenModal.show(); document.body.style.overflowY = "auto"; }, 500); }; diff --git a/src/components/modals/TitleScreenModal.vue b/src/components/modals/TitleScreenModal.vue new file mode 100644 index 000000000..5552e1da7 --- /dev/null +++ b/src/components/modals/TitleScreenModal.vue @@ -0,0 +1,124 @@ + + + + + \ No newline at end of file