mirror of
https://gitea.wildfiregames.com/0ad/0ad
synced 2026-08-15 14:43:32 -07:00
- Toggle expanded minimap mode - Choose between round and square minimap shapes - `gui.session.minimap.position`, lets you switch between two positioning modes: panel-left and screen-left - `gui.session.minimap.size`, change size between 1.0 and 2.0, default is 1.0.
43 lines
1.1 KiB
JavaScript
43 lines
1.1 KiB
JavaScript
/**
|
|
* If the button that this class manages is pressed, the input state is switched to 'flare', letting the player send a flare by left-clicking on the map.
|
|
*/
|
|
class MiniMapFlareButton
|
|
{
|
|
constructor(playerViewControl)
|
|
{
|
|
this.flareButton = Engine.GetGUIObjectByName("flareButton");
|
|
|
|
this.flareButton.enabled = !g_IsReplay;
|
|
if (g_IsReplay)
|
|
return;
|
|
|
|
this.flareButton.onPress = this.onPress.bind(this);
|
|
registerHotkeyChangeHandler(this.onHotkeyChange.bind(this));
|
|
playerViewControl.registerViewedPlayerChangeHandler(this.rebuild.bind(this));
|
|
}
|
|
|
|
rebuild()
|
|
{
|
|
this.updateTooltip();
|
|
}
|
|
|
|
onHotkeyChange()
|
|
{
|
|
this.colorizedHotkey = colorizeHotkey("%(hotkey)s" + " ", "session.flare");
|
|
this.updateTooltip();
|
|
}
|
|
|
|
updateTooltip()
|
|
{
|
|
this.flareButton.tooltip = this.colorizedHotkey + (g_IsObserver ? this.ObserverTooltip : this.PlayerTooltip);
|
|
}
|
|
|
|
onPress()
|
|
{
|
|
if (inputState == INPUT_NORMAL)
|
|
inputState = INPUT_FLARE;
|
|
}
|
|
}
|
|
|
|
MiniMapFlareButton.prototype.PlayerTooltip = markForTranslation("Send a flare to your allies.");
|
|
MiniMapFlareButton.prototype.ObserverTooltip = markForTranslation("Send a flare to other observers.");
|