diff --git a/css/style.css b/css/style.css
index 1b4fdd7..23ecbe0 100644
--- a/css/style.css
+++ b/css/style.css
@@ -77,6 +77,10 @@ h1 br {
font-size: 14px; font-weight: bold;
}
+.achievements-button {
+ margin-top: -48px;
+}
+
#Status {
font-size: x-large;
}
@@ -104,4 +108,6 @@ h1 br {
position: absolute;
}
-
+#mylab {
+ margin-right: 48px;
+}
diff --git a/index.html b/index.html
index 2c175da..ab53ce6 100644
--- a/index.html
+++ b/index.html
@@ -30,7 +30,7 @@
+
+
+
+
+
+
+ -
+
+ {{ a.description }}
+ {{ a.time }}
+
+
+
+
+
+
+
diff --git a/js/achievements.js b/js/achievements.js
index fad27aa..2a15dff 100644
--- a/js/achievements.js
+++ b/js/achievements.js
@@ -2,6 +2,9 @@ var achievements =
{
list: [],
listSpecial: [],
+ listSummary: [],
+
+ startTime: new Date(),
count:
{
@@ -99,7 +102,37 @@ var achievements =
window.setTimeout(remove(alert), 2000);
achievements.list[i].alerted = true;
+
+ var a = $.extend(true, {}, achievements.list[i]);
+ a.time = achievements.timeFormatter(new Date().getTime() - achievements.startTime.getTime());
+ achievements.listSummary.push(a);
}
+ },
+
+ timeFormatter: function(msec)
+ {
+ var totals = Math.floor(msec / 1000);
+ var days = Math.floor(totals / (24 * 60 * 60));
+ var hours = Math.floor((totals % (24 * 60 * 60)) / (60 * 60));
+ var totalmin = (totals % (24 * 60 * 60)) % (60 * 60);
+ var mins = Math.floor(totalmin / 60);
+ var secs = totalmin % 60;
+
+ var str = [];
+ if (days > 0) {
+ str.push(days + ' day' + (days % 100 == 1 ? '' : 's'));
+ }
+ if (hours > 0) {
+ str.push(hours + ' h');
+ }
+ if (mins > 0) {
+ str.push(mins + ' min');
+ }
+ if (secs > 0) {
+ str.push(secs + ' s');
+ }
+
+ return str.join(', ');
}
};
diff --git a/js/game.js b/js/game.js
index 6558a99..f499add 100644
--- a/js/game.js
+++ b/js/game.js
@@ -198,6 +198,12 @@
return formatNiceNumber;
}]);
+ app.filter('reverse', ['$filter', function($filter) {
+ return function(items) {
+ return items.slice().reverse();
+ };
+ }]);
+
app.controller('DetectorController', function() {
this.click = function() {
lab.acquire(lab.detector.rate);
@@ -238,8 +244,9 @@
this.upgrades = upgrades;
});
- app.controller('AchievementsController', function ($scope) {
- scope.achievements = achievements.list;
+ app.controller('AchievementsController', function() {
+ this.achievements = achievements.listSummary;
+ this.achievementsAll = achievements.list;
});
achievements.setList(loadFile('json/achievements.json'));
diff --git a/json/achievements.json b/json/achievements.json
index 1fc4aac..ee638bf 100644
--- a/json/achievements.json
+++ b/json/achievements.json
@@ -1,12 +1,14 @@
[
{
"description": "You have just discovered ${name}!",
+ "icon": "glyphicon-cog",
"type": "research",
"target": "research",
"threshold": 1
},
{
"description": "You have hired your first ${name}!",
+ "icon": "glyphicon-user",
"type": "workers",
"target": "workers",
"threshold": 1