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