diff --git a/js/app.js b/js/app.js index ecdc9d2..c143d05 100644 --- a/js/app.js +++ b/js/app.js @@ -1,5 +1,7 @@ 'use strict'; (function() { + Helpers.validateSaveVersion(); + var game = new Game.Game(); game.load(); @@ -11,8 +13,6 @@ var allObjects = game.allObjects; var lastSaved; - UI.validateVersion(lab.version); - var app = angular.module('particleClicker', []); app.filter('niceNumber', ['$filter', function($filter) { diff --git a/js/gameobjects.js b/js/gameobjects.js index 2a544fb..dccf0b5 100644 --- a/js/gameobjects.js +++ b/js/gameobjects.js @@ -21,7 +21,6 @@ var GameObjects = (function() { var Lab = function() { GameObject.apply(this, [{ key : 'lab', - version : 0.9, state : { name : 'Give your lab an awesome name!', detector : 1, diff --git a/js/helpers.js b/js/helpers.js index bdde8c6..7617d7d 100644 --- a/js/helpers.js +++ b/js/helpers.js @@ -68,12 +68,21 @@ var Helpers = (function () { return str.join(', '); }; + + var saveVersion = '1.0'; + var validateSaveVersion = function () { + var ver = ObjectStorage.load('saveVersion'); + if (typeof ver === 'undefined' || ver != saveVersion) { + ObjectStorage.clear(); + ObjectStorage.save('saveVersion', saveVersion); + } + }; return { loadFile: loadFile, formatNumberPostfix: formatNumberPostfix, formatTime: formatTime, - version: '0.9', + validateSaveVersion: validateSaveVersion, analytics: '' }; })(); diff --git a/js/ui.js b/js/ui.js index b7f1df6..0db1056 100644 --- a/js/ui.js +++ b/js/ui.js @@ -140,25 +140,6 @@ var UI = (function () { window.setTimeout(remove(alert), 2000); } - var validateVersion = function(version) { - if (version != Helpers.version) { - var alert = '