Differential D2378 Diff 10168 ps/trunk/binaries/data/mods/public/gui/session/top_panel/IconButtons/TradeDialogButton.js
Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/session/top_panel/IconButtons/TradeDialogButton.js
Property | Old Value | New Value |
---|---|---|
svn:eol-style | null | native \ No newline at end of property |
/** | |||||
* This class handles the button which opens the diplomacy dialog. | |||||
*/ | |||||
class TradeDialogButton | |||||
{ | |||||
constructor(playerViewControl, tradeDialog) | |||||
{ | |||||
this.tradeButton = Engine.GetGUIObjectByName("tradeButton"); | |||||
this.tradeButton.onPress = tradeDialog.toggle.bind(tradeDialog); | |||||
this.isAvailable = | |||||
g_ResourceData.GetTradableCodes().length || | |||||
g_ResourceData.GetBarterableCodes().length; | |||||
playerViewControl.registerViewedPlayerChangeHandler(this.onViewedPlayerChange.bind(this)); | |||||
registerHotkeyChangeHandler(this.onHotkeyChange.bind(this)); | |||||
} | |||||
onHotkeyChange() | |||||
{ | |||||
this.tradeButton.tooltip = | |||||
colorizeHotkey("%(hotkey)s" + " ", "session.gui.barter.toggle") + | |||||
translate(this.Tooltip); | |||||
} | |||||
onViewedPlayerChange() | |||||
{ | |||||
this.tradeButton.hidden = g_ViewedPlayer < 1 || !this.isAvailable; | |||||
} | |||||
} | |||||
TradeDialogButton.prototype.Tooltip = markForTranslation("Barter & Trade"); |
Wildfire Games · Phabricator