mirror of
https://github.com/wassname/cardsforscience.git
synced 2026-07-15 11:22:08 +08:00
Add formatting to counter updates
This commit is contained in:
+1
-1
@@ -55,7 +55,7 @@
|
||||
<div class="update-value" id="update-reputation"></div>
|
||||
</div>
|
||||
<div class="col-xs-4">
|
||||
<strong class="text-center">Funding</strong>
|
||||
<span class="text-center"><strong>Funding</strong></span>
|
||||
<br>
|
||||
{{ lc.lab.money | currency }}
|
||||
<div class="update-value" id="update-funding"></div>
|
||||
|
||||
+11
-8
@@ -33,21 +33,21 @@
|
||||
getGrant: function () {
|
||||
var addition = this.reputation * this.factor.rate; // TODO: adjust factor
|
||||
this.money += addition;
|
||||
showUpdateValue("#update-funding", addition);
|
||||
showUpdateValue("#update-funding", formatNiceNumber(addition));
|
||||
achievements.update('count', 'money', addition);
|
||||
},
|
||||
acquire: function(amount) {
|
||||
this.data += amount;
|
||||
achievements.update('count', 'data', amount);
|
||||
showUpdateValue("#update-data", amount);
|
||||
showUpdateValue("#update-data", formatNiceNumber(amount));
|
||||
},
|
||||
research: function(cost, reputation) {
|
||||
if (this.data >= cost) {
|
||||
this.data -= cost;
|
||||
this.reputation += reputation;
|
||||
achievements.update('count', 'reputation', reputation);
|
||||
showUpdateValue("#update-data", -cost);
|
||||
showUpdateValue("#update-reputation", reputation);
|
||||
showUpdateValue("#update-data", formatNiceNumber(-cost));
|
||||
showUpdateValue("#update-reputation", formatNiceNumber(reputation));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -55,7 +55,7 @@
|
||||
buy: function(cost) {
|
||||
if (this.money >= cost) {
|
||||
this.money -= cost;
|
||||
showUpdateValue("#update-funding", -cost);
|
||||
showUpdateValue("#update-funding", formatNiceNumber(-cost));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -177,8 +177,8 @@
|
||||
};
|
||||
}]);
|
||||
|
||||
app.filter('niceNumber', ['$filter', function($filter) {
|
||||
return function(number) {
|
||||
|
||||
function formatNiceNumber(number) {
|
||||
var abs = Math.abs(number);
|
||||
if (abs >= Math.pow(10, 12)) {
|
||||
number = (number / Math.pow(10, 12)).toFixed(1) + "T";
|
||||
@@ -192,7 +192,10 @@
|
||||
number = number.toFixed(0);
|
||||
}
|
||||
return number;
|
||||
};
|
||||
}
|
||||
|
||||
app.filter('niceNumber', ['$filter', function($filter) {
|
||||
return formatNiceNumber;
|
||||
}]);
|
||||
|
||||
app.controller('DetectorController', function() {
|
||||
|
||||
Reference in New Issue
Block a user