Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/minimap/MiniMapFlareButton.js
- This file was added.
/** | |||||
* If the button that this class manages is pressed, an idle unit having one of the given classes is selected. | |||||
*/ | |||||
class MiniMapFlareButton | |||||
{ | |||||
constructor() | |||||
{ | |||||
this.flareButton = Engine.GetGUIObjectByName("flareButton"); | |||||
this.flareButton.onPress = this.onPress.bind(this); | |||||
registerHotkeyChangeHandler(this.onHotkeyChange.bind(this)); | |||||
} | |||||
onHotkeyChange() | |||||
{ | |||||
this.flareButton.tooltip = | |||||
colorizeHotkey("%(hotkey)s" + " ", "session.flare") + | |||||
translate(this.Tooltip); | |||||
} | |||||
onPress() | |||||
{ | |||||
inputState = INPUT_PRESELECTEDACTION; | |||||
preSelectedAction = ACTION_FLARE; | |||||
} | |||||
getAction(target) | |||||
{ | |||||
return { | |||||
"type": "flare", | |||||
"cursor": "action-flare", | |||||
"target": target | |||||
}; | |||||
} | |||||
hotkeyActionCheck(target, selection) | |||||
{ | |||||
if (!Engine.HotkeyIsPressed("session.flare")) | |||||
return false; | |||||
return this.getAction(target); | |||||
} | |||||
preSelectedActionCheck(target, selection) | |||||
{ | |||||
if (preSelectedAction != ACTION_FLARE) | |||||
return false; | |||||
return this.getAction(target); | |||||
} | |||||
} | |||||
MiniMapFlareButton.prototype.Tooltip = markForTranslation("Send a flare to your allies"); |
Wildfire Games · Phabricator