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({ @@ -137,11 +137,14 @@ let game = new Vue({
},
created() {
this.storageNames = {
lastVersion: 'lastVersion',
resources: 'resources' + this.version,
buildings: 'buildings' + this.version,
currentQuest: 'currentQuest' + this.version
}
this.checkVersion();
this.checkBuildings();
this.loadResourcesFromStorage();
this.currentQuest = JSON.parse(localStorage.getItem(this.storageNames.currentQuest));
@ -150,6 +153,16 @@ let game = new Vue({ @@ -150,6 +153,16 @@ let game = new Vue({
this.reloadBuildings();
},
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() {
let savedBuildings = JSON.parse(localStorage.getItem(this.storageNames.buildings));
@ -540,6 +553,15 @@ let game = new Vue({ @@ -540,6 +553,15 @@ let game = new Vue({
});
},
sendSystemNotification(message) {
iziToast.show({
color: 'red',
message: message,
position: 'topCenter',
timeout: 7000,
});
},
sendWarning(message) {
iziToast.show({
color: 'red',

Loading…
Cancel
Save