improve loading process

This commit is contained in:
2023-06-20 19:37:27 +02:00
parent c2abfd6dfd
commit 3b9441b555
+14 -8
View File
@@ -248,12 +248,23 @@ export default defineComponent({
}
},
async mounted() {
this.quests = await loadAvailableQuests();
this.adventurersDatabase = await loadAdventurersForHire();
this.loadGame();
console.debug("Loading game data")
const promises = await Promise.all([
loadAvailableQuests(),
loadAdventurersForHire(),
]);
this.quests = promises[0] as { [key: string]: { [key: string]: Quest } };
this.adventurersDatabase = promises[1] as Array<Adventurer>;
console.debug("Game data loaded!")
this.loadGame();
this.adventurersDatabase = removeAlreadyHiredAdventurers(this.adventurersDatabase, this.adventurers);
// Wait a second to make sure at least most images load in behind the loader
setTimeout(() => {
this.loading = false;
}, 1000);
this.gameSaveTask = Number(setInterval(() => {
saveGame(new GameData({
adventurers: this.adventurers,
@@ -265,11 +276,6 @@ export default defineComponent({
}));
}, 10 * 1000));
// Wait a second to make sure at least most images load in behind the loader
setTimeout(() => {
this.loading = false;
}, 1000);
this.gameTickTask = Number(setInterval(() => {
this.updateMissives();