Browse Source

Add version-check;

master
Nero Ignis 4 years ago
parent
commit
4e9e5d141a
  1. 22
      js/app.js

22
js/app.js

@ -137,11 +137,14 @@ let game = new Vue({
}, },
created() { created() {
this.storageNames = { this.storageNames = {
lastVersion: 'lastVersion',
resources: 'resources' + this.version, resources: 'resources' + this.version,
buildings: 'buildings' + this.version, buildings: 'buildings' + this.version,
currentQuest: 'currentQuest' + this.version currentQuest: 'currentQuest' + this.version
} }
this.checkVersion();
this.checkBuildings(); this.checkBuildings();
this.loadResourcesFromStorage(); this.loadResourcesFromStorage();
this.currentQuest = JSON.parse(localStorage.getItem(this.storageNames.currentQuest)); this.currentQuest = JSON.parse(localStorage.getItem(this.storageNames.currentQuest));
@ -150,6 +153,16 @@ let game = new Vue({
this.reloadBuildings(); this.reloadBuildings();
}, },
methods: { methods: {
checkVersion() {
let lastVersion = localStorage.getItem(this.storageNames.lastVersion);
if (lastVersion && lastVersion < this.version) {
this.sendSystemNotification('Your beta-progress has been resetted due to a new version of the game, we\'re very sorry about that.')
}
localStorage.setItem(this.storageNames.lastVersion, this.version);
},
checkBuildings() { checkBuildings() {
let savedBuildings = JSON.parse(localStorage.getItem(this.storageNames.buildings)); let savedBuildings = JSON.parse(localStorage.getItem(this.storageNames.buildings));
@ -540,6 +553,15 @@ let game = new Vue({
}); });
}, },
sendSystemNotification(message) {
iziToast.show({
color: 'red',
message: message,
position: 'topCenter',
timeout: 7000,
});
},
sendWarning(message) { sendWarning(message) {
iziToast.show({ iziToast.show({
color: 'red', color: 'red',

Loading…
Cancel
Save