Index: ps/trunk/binaries/data/mods/public/gui/common/tooltips.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/common/tooltips.js
+++ ps/trunk/binaries/data/mods/public/gui/common/tooltips.js
@@ -1210,3 +1210,20 @@
// Translation: Appears in a tooltip to indicate that clicking the corresponding GUI element will open the Template Details GUI page.
return translate("Click to view more information.");
}
+
+/**
+ * @param {number} number - A number to shorten using SI prefix.
+ */
+function abbreviateLargeNumbers(number)
+{
+ if (number >= 1e6)
+ return Math.floor(number / 1e6) + translateWithContext("One letter abbreviation for million", 'M');
+
+ if (number >= 1e5)
+ return Math.floor(number / 1e3) + translateWithContext("One letter abbreviation for thousand", 'k');
+
+ if (number >= 1e4)
+ return (number / 1e3).toFixed(1).replace(/\.0$/, '') + translateWithContext("One letter abbreviation for thousand", 'k');
+
+ return number;
+}
Index: ps/trunk/binaries/data/mods/public/gui/session/styles.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/session/styles.xml
+++ ps/trunk/binaries/data/mods/public/gui/session/styles.xml
@@ -117,10 +117,10 @@
/>
Index: ps/trunk/binaries/data/mods/public/gui/session/top_panel/CounterPopulation.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/session/top_panel/CounterPopulation.js
+++ ps/trunk/binaries/data/mods/public/gui/session/top_panel/CounterPopulation.js
@@ -22,16 +22,14 @@
let total = 0;
for (let resCode of g_ResourceData.GetCodes())
total += playerState.resourceGatherers[resCode];
- // Do not show zeroes.
- this.stats.caption = total || "";
+
+ this.stats.caption = total ? coloredText(total, this.DefaultTotalGatherersColor) : 0;
this.isTrainingBlocked = playerState.trainingBlocked;
this.panel.tooltip =
- setStringTags(translate(this.PopulationTooltip), CounterManager.ResourceTitleTags) + "\n" +
- sprintf(translate(this.MaximumPopulationTooltip), { "popCap": playerState.popMax }) +
- getAllyStatTooltip(this.getTooltipData.bind(this)) + "\n" +
- (total > 0 ? sprintf(translate("Current gatherers: %(amount)s"), { "amount" : total }) : "");
+ setStringTags(translate(this.PopulationTooltip), CounterManager.ResourceTitleTags) +
+ getAllyStatTooltip(this.getTooltipData.bind(this)) + "\n" + this.CurrentGatherersTooltip;
}
getTooltipData(playerState, playername)
@@ -59,16 +57,22 @@
this.count.textcolor = newColor;
}
}
+// Translation: Do not insert spaces around the slash symbol for this exact string. Keep only one space between popLimit and popMax.
+CounterPopulation.prototype.CounterCaption = markForTranslation("%(popCount)s/%(popLimit)s (%(popMax)s)");
-CounterPopulation.prototype.CounterCaption = markForTranslation("%(popCount)s/%(popLimit)s");
-
-CounterPopulation.prototype.PopulationTooltip = markForTranslation("Population (current / limit)");
+CounterPopulation.prototype.PopulationTooltip = markForTranslation("Population: current/limit (max)");
-CounterPopulation.prototype.MaximumPopulationTooltip = markForTranslation("Maximum population: %(popCap)s");
-
-CounterPopulation.prototype.AllyPopulationTooltip = markForTranslation("%(popCount)s/%(popLimit)s/%(popMax)s");
+CounterPopulation.prototype.AllyPopulationTooltip = markForTranslation("%(popCount)s/%(popLimit)s (%(popMax)s)");
/**
+ * Storing the translated and formatted gatherer string in the prototype.
+ */
+CounterPopulation.prototype.CurrentGatherersTooltip = setStringTags(translate("Gatherers: current"), {"font": "sans-bold-16"});
+/**
+ * Color to highlight the total gatherers.
+ */
+CounterPopulation.prototype.DefaultTotalGatherersColor = "gold";
+/**
* Colors to flash when pop limit reached.
*/
CounterPopulation.prototype.DefaultPopulationColor = "white";
Index: ps/trunk/binaries/data/mods/public/gui/session/top_panel/CounterResource.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/session/top_panel/CounterResource.js
+++ ps/trunk/binaries/data/mods/public/gui/session/top_panel/CounterResource.js
@@ -14,11 +14,10 @@
rebuild(playerState, getAllyStatTooltip)
{
- this.count.caption = Math.floor(playerState.resourceCounts[this.resCode]);
+ this.count.caption = abbreviateLargeNumbers(Math.floor(playerState.resourceCounts[this.resCode]));
- // Do not show zeroes.
let gatherers = playerState.resourceGatherers[this.resCode];
- this.stats.caption = gatherers || "";
+ this.stats.caption = gatherers ? coloredText(gatherers, this.DefaultResourceGatherersColor) : 0;
// TODO: Set the tooltip only if hovered?
let description = g_ResourceData.GetResource(this.resCode).description;
@@ -28,8 +27,7 @@
this.panel.tooltip =
setStringTags(resourceNameFirstWord(this.resCode), CounterManager.ResourceTitleTags) +
description +
- getAllyStatTooltip(this.getTooltipData.bind(this)) + "\n" +
- (gatherers > 0 ? sprintf(translate("Gatherers: %(amount)s"), { "amount" : gatherers }) : "");
+ getAllyStatTooltip(this.getTooltipData.bind(this)) + "\n" + CounterPopulation.prototype.CurrentGatherersTooltip;
}
getTooltipData(playerState, playername)
@@ -41,3 +39,8 @@
};
}
}
+
+/**
+ * Color to highlight the resource gatherers.
+ */
+CounterResource.prototype.DefaultResourceGatherersColor = "gold";
Index: ps/trunk/binaries/data/mods/public/gui/session/top_panel/Counters.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/session/top_panel/Counters.xml
+++ ps/trunk/binaries/data/mods/public/gui/session/top_panel/Counters.xml
@@ -3,10 +3,10 @@