Display the number of idle workers in that respective button.
Patch by: @Langbart Differential revision: https://code.wildfiregames.com/D4217 This was SVN commit r25882.
This commit is contained in:
parent
0c2c071aac
commit
6b903e4a92
@ -25,6 +25,16 @@
|
||||
mouse_event_mask="texture:session/minimap-idle.png"
|
||||
/>
|
||||
|
||||
<!-- Total number of idle workers -->
|
||||
<object name="totalNumberIdleWorkers"
|
||||
type="text"
|
||||
size="85% 89% 97% 98%"
|
||||
style="totalNumberIdleWorkersCount"
|
||||
z="100"
|
||||
text_align="right"
|
||||
text_valign="bottom"
|
||||
/>
|
||||
|
||||
<!-- Diplomacy Colors Button -->
|
||||
<object name="diplomacyColorsButton"
|
||||
type="button"
|
||||
|
@ -6,6 +6,7 @@ class MiniMapIdleWorkerButton
|
||||
constructor(playerViewControl, idleClasses)
|
||||
{
|
||||
this.idleWorkerButton = Engine.GetGUIObjectByName("idleWorkerButton");
|
||||
this.totalNumberIdleWorkers = Engine.GetGUIObjectByName("totalNumberIdleWorkers");
|
||||
this.idleWorkerButton.onKeyDown = this.onKeyDown.bind(this);
|
||||
this.idleWorkerButton.onMouseLeftPress = this.onKeyDown.bind(this);
|
||||
this.idleClasses = idleClasses;
|
||||
@ -24,11 +25,13 @@ class MiniMapIdleWorkerButton
|
||||
|
||||
rebuild()
|
||||
{
|
||||
this.idleWorkerButton.enabled = Engine.GuiInterfaceCall("HasIdleUnits", {
|
||||
const totalNumberIdleWorkers = Engine.GuiInterfaceCall("FindIdleUnits", {
|
||||
"viewedPlayer": g_ViewedPlayer,
|
||||
"idleClasses": this.idleClasses,
|
||||
"excludeUnits": []
|
||||
});
|
||||
}).length;
|
||||
this.idleWorkerButton.enabled = totalNumberIdleWorkers > 0;
|
||||
this.totalNumberIdleWorkers.caption = totalNumberIdleWorkers ? setStringTags(totalNumberIdleWorkers, this.DefaultTotalNumberIdleWorkersTags) : "";
|
||||
}
|
||||
|
||||
onKeyDown()
|
||||
@ -37,4 +40,9 @@ class MiniMapIdleWorkerButton
|
||||
}
|
||||
}
|
||||
|
||||
MiniMapIdleWorkerButton.prototype.Tooltip = markForTranslation("Find idle worker");
|
||||
MiniMapIdleWorkerButton.prototype.Tooltip = markForTranslation("Find idle worker\nNumber of idle workers.");
|
||||
|
||||
MiniMapIdleWorkerButton.prototype.DefaultTotalNumberIdleWorkersTags = {
|
||||
"font": "sans-bold-stroke-14",
|
||||
"color": "white"
|
||||
};
|
||||
|
@ -124,6 +124,14 @@
|
||||
text_valign="bottom"
|
||||
/>
|
||||
|
||||
<style name="totalNumberIdleWorkersCount"
|
||||
textcolor="200 200 200"
|
||||
font="sans-bold-stroke-14"
|
||||
ghost="true"
|
||||
text_align="center"
|
||||
text_valign="center"
|
||||
/>
|
||||
|
||||
<style name="StatsTextLeft"
|
||||
font="sans-stroke-12"
|
||||
textcolor="white"
|
||||
|
Loading…
Reference in New Issue
Block a user