mirror of
https://github.com/YouHaveTrouble/GuildMaster.git
synced 2026-05-11 22:16:59 +00:00
improve loading process
This commit is contained in:
+14
-8
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user