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() {
|
async mounted() {
|
||||||
this.quests = await loadAvailableQuests();
|
console.debug("Loading game data")
|
||||||
this.adventurersDatabase = await loadAdventurersForHire();
|
const promises = await Promise.all([
|
||||||
this.loadGame();
|
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);
|
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(() => {
|
this.gameSaveTask = Number(setInterval(() => {
|
||||||
saveGame(new GameData({
|
saveGame(new GameData({
|
||||||
adventurers: this.adventurers,
|
adventurers: this.adventurers,
|
||||||
@@ -265,11 +276,6 @@ export default defineComponent({
|
|||||||
}));
|
}));
|
||||||
}, 10 * 1000));
|
}, 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.gameTickTask = Number(setInterval(() => {
|
||||||
this.updateMissives();
|
this.updateMissives();
|
||||||
|
|||||||
Reference in New Issue
Block a user