Browse Source

Adjust Version-Check to look on length of buildings;

master
Nero Ignis 4 years ago
parent
commit
5956ac6c95
  1. 12
      js/app.js

12
js/app.js

@ -1,7 +1,6 @@ @@ -1,7 +1,6 @@
let game = new Vue({
el: '#root',
data: {
version: 0.3,
money: 0,
loaded: false,
resources: {
@ -133,7 +132,7 @@ let game = new Vue({ @@ -133,7 +132,7 @@ let game = new Vue({
loadedIntervals: []
},
created() {
this.versionCheck();
this.checkBuildings();
this.money = this.getSavedMoney();
this.saveMoney();
@ -144,15 +143,12 @@ let game = new Vue({ @@ -144,15 +143,12 @@ let game = new Vue({
this.loaded = true;
},
methods: {
versionCheck() {
let lastVersion = localStorage.getItem('lastVersion');
checkBuildings() {
let savedBuildings = JSON.parse(localStorage.getItem('buildings'));
if ((lastVersion && lastVersion > this.version)) {
if (savedBuildings.length !== this.buildings.length) {
localStorage.setItem('buildings', this.buildings.stringify());
localStorage.setItem('lastVersion', this.version);
alert('Buildings have been resetted due to an important update.')
} else {
localStorage.setItem('lastVersion', this.version);
}
},

Loading…
Cancel
Save