mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-06-12 07:27:12 +08:00
Merge pull request #425 from Sebring/master
Showing total in stores tooltip - Issue #170
This commit is contained in:
@@ -182,6 +182,10 @@ div.row_val {
|
|||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
div.total {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
|
||||||
/* Notifications */
|
/* Notifications */
|
||||||
|
|
||||||
div#notifications {
|
div#notifications {
|
||||||
|
|||||||
@@ -885,6 +885,7 @@ var Room = {
|
|||||||
|
|
||||||
updateIncomeView: function() {
|
updateIncomeView: function() {
|
||||||
var stores = $('div#resources');
|
var stores = $('div#resources');
|
||||||
|
var totalIncome = {};
|
||||||
if(stores.length === 0 || typeof $SM.get('income') == 'undefined') return;
|
if(stores.length === 0 || typeof $SM.get('income') == 'undefined') return;
|
||||||
$('div.storeRow', stores).each(function(index, el) {
|
$('div.storeRow', stores).each(function(index, el) {
|
||||||
el = $(el);
|
el = $(el);
|
||||||
@@ -900,10 +901,19 @@ var Room = {
|
|||||||
.addClass('row_val')
|
.addClass('row_val')
|
||||||
.text(Engine.getIncomeMsg(income.stores[store], income.delay))
|
.text(Engine.getIncomeMsg(income.stores[store], income.delay))
|
||||||
.appendTo(tt);
|
.appendTo(tt);
|
||||||
|
if (totalIncome[store] === undefined || totalIncome[store]['income'] === undefined) {
|
||||||
|
totalIncome[store] = {};
|
||||||
|
totalIncome[store]['income'] = 0;
|
||||||
|
}
|
||||||
|
totalIncome[store]['income'] += Number(income.stores[store]);
|
||||||
|
totalIncome[store]['delay'] = income.delay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(tt.children().length > 0) {
|
if(tt.children().length > 0) {
|
||||||
|
var total = totalIncome[storeName]['income'];
|
||||||
|
$('<div>').addClass('total row_key').text(_('total')).appendTo(tt);
|
||||||
|
$('<div>').addClass('total row_val').text(Engine.getIncomeMsg(total, totalIncome[storeName]['delay'])).appendTo(tt);
|
||||||
tt.appendTo(el);
|
tt.appendTo(el);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user