Index: binaries/data/mods/public/gui/common/tooltips.js
===================================================================
--- binaries/data/mods/public/gui/common/tooltips.js
+++ binaries/data/mods/public/gui/common/tooltips.js
@@ -1210,3 +1210,19 @@
// 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.");
}
+
+/**
+ * Large numbers are shortened.
+ */
+function shortLargeNumbers(num) {
+ if (num >= 1000000) {
+ return Math.floor(num / 1000000) + translateWithContext("One letter abbreviation for million", 'M');
+ }
+ if (num >= 100000) {
+ return Math.floor(num / 1000) + ("One letter abbreviation for thousand", 'k');
+ }
+ if (num >= 1000) {
+ return (num / 1000).toFixed(1).replace(/\.0$/, '') + ("One letter abbreviation for thousand", 'k');
+ }
+ return num;
+}
Index: binaries/data/mods/public/gui/session/styles.xml
===================================================================
--- binaries/data/mods/public/gui/session/styles.xml
+++ binaries/data/mods/public/gui/session/styles.xml
@@ -116,11 +116,19 @@
text_valign="center"
/>
+
+
Index: binaries/data/mods/public/gui/session/top_panel/CounterPopulation.js
===================================================================
--- binaries/data/mods/public/gui/session/top_panel/CounterPopulation.js
+++ binaries/data/mods/public/gui/session/top_panel/CounterPopulation.js
@@ -23,13 +23,12 @@
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.DefaultGatherersColor) : "";
this.isTrainingBlocked = playerState.trainingBlocked;
this.panel.tooltip =
- setStringTags(translate(this.PopulationTooltip), CounterManager.ResourceTitleTags) + "\n" +
- sprintf(translate(this.MaximumPopulationTooltip), { "popCap": playerState.popMax }) +
+ setStringTags(translate(this.PopulationTooltip), CounterManager.ResourceTitleTags) +
getAllyStatTooltip(this.getTooltipData.bind(this)) + "\n" +
(total > 0 ? sprintf(translate("Current gatherers: %(amount)s"), { "amount" : total }) : "");
}
@@ -59,16 +58,18 @@
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 (max)");
-CounterPopulation.prototype.PopulationTooltip = markForTranslation("Population (current / limit)");
-
-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)");
/**
+ * Colors to highlight the resource and the total gatherers.
+ */
+CounterPopulation.prototype.DefaultGatherersColor = "gold";
+/**
* Colors to flash when pop limit reached.
*/
CounterPopulation.prototype.DefaultPopulationColor = "white";
Index: binaries/data/mods/public/gui/session/top_panel/CounterResource.js
===================================================================
--- binaries/data/mods/public/gui/session/top_panel/CounterResource.js
+++ binaries/data/mods/public/gui/session/top_panel/CounterResource.js
@@ -14,11 +14,12 @@
rebuild(playerState, getAllyStatTooltip)
{
- this.count.caption = Math.floor(playerState.resourceCounts[this.resCode]);
+ this.count.caption = shortLargeNumbers(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, CounterPopulation.prototype.DefaultGatherersColor) : "";
// TODO: Set the tooltip only if hovered?
let description = g_ResourceData.GetResource(this.resCode).description;
Index: binaries/data/mods/public/gui/session/top_panel/Counters.xml
===================================================================
--- binaries/data/mods/public/gui/session/top_panel/Counters.xml
+++ binaries/data/mods/public/gui/session/top_panel/Counters.xml
@@ -3,10 +3,10 @@