Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/menu.js
Show First 20 Lines • Show All 849 Lines • ▼ Show 20 Lines | barterButton.Buy.onPress = function() { | ||||
Engine.PostNetworkCommand({ | Engine.PostNetworkCommand({ | ||||
"type": "barter", | "type": "barter", | ||||
"sell": g_BarterSell, | "sell": g_BarterSell, | ||||
"buy": resourceCode, | "buy": resourceCode, | ||||
"amount": amountToSell | "amount": amountToSell | ||||
}); | }); | ||||
}; | }; | ||||
barterButton.Buy.hidden = isSelected; | // Cannot sell non-currency for non-currency | ||||
let currencyCodes = g_ResourceData.GetCodes("currency"); | |||||
Stan: I guess you can inline that variable :) | |||||
FreagarachAuthorUnsubmitted Not Done Inline Actions
;) Freagarach: > Could be replaced by
> ```
> let currencyCodes = g_ResourceData.GetCodes("currency");
>
>… | |||||
barterButton.Buy.hidden = isSelected || !currencyCodes.some(x => x == g_BarterSell || x == resourceCode); | |||||
barterButton.Buy.enabled = controlsPlayer(player); | barterButton.Buy.enabled = controlsPlayer(player); | ||||
barterButton.Sell.hidden = false; | barterButton.Sell.hidden = false; | ||||
selectionIcon.hidden = !isSelected; | selectionIcon.hidden = !isSelected; | ||||
} | } | ||||
function updateBarterButtons() | function updateBarterButtons() | ||||
{ | { | ||||
let playerState = GetSimState().players[g_ViewedPlayer]; | let playerState = GetSimState().players[g_ViewedPlayer]; | ||||
▲ Show 20 Lines • Show All 414 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
I guess you can inline that variable :)