Track gameplay time for achievements

This commit is contained in:
Tadej Novak
2014-08-04 22:22:21 +02:00
parent 50c6c3c240
commit 62e285c16d
2 changed files with 3 additions and 0 deletions
+2
View File
@@ -5,6 +5,7 @@ var achievements =
listSummary: [],
startTime: new Date().getTime(),
lastSave: new Date().getTime(),
count:
{
@@ -53,6 +54,7 @@ var achievements =
restore: function()
{
achievements = $.extend({}, achievements, ObjectStorage.load('achievements'));
achievements.startTime = new Date().getTime() - (achievements.lastSave - achievements.startTime);
},
addWorkers: function(list)
+1
View File
@@ -109,6 +109,7 @@
$scope.saveNow = function() {
GameObjects.saveAll();
$scope.lastSaved = new Date();
achievements.lastSave = $scope.lastSaved.getTime();
};
$scope.restart = function() {
if (window.confirm('Do you really want to restart the game? All progress will be lost.')) {