Changeset View
Standalone View
binaries/data/mods/public/gui/session/selection_details.js
Show First 20 Lines • Show All 295 Lines • ▼ Show 20 Lines | else | |||||||||
resourceCarryingText.hidden = true; | resourceCarryingText.hidden = true; | |||||||||
} | } | |||||||||
Engine.GetGUIObjectByName("player").caption = playerName; | Engine.GetGUIObjectByName("player").caption = playerName; | |||||||||
Engine.GetGUIObjectByName("playerColorBackground").sprite = | Engine.GetGUIObjectByName("playerColorBackground").sprite = | |||||||||
"color:" + g_DiplomacyColors.getPlayerColor(entState.player, 128); | "color:" + g_DiplomacyColors.getPlayerColor(entState.player, 128); | |||||||||
Engine.GetGUIObjectByName("primary").caption = primaryName; | let primaryElement = Engine.GetGUIObjectByName("primary"); | |||||||||
Lint: prefer-const: 'primaryElement' is never reassigned. Use 'const' instead. | ||||||||||
bbUnsubmitted Not Done Inline Actions
(Yes const looks weird but is correct) bb: (Yes const looks weird but is correct) | ||||||||||
primaryElement.caption = primaryName; | ||||||||||
Not Done Inline ActionsI guess this info should be left out of the XML then? Freagarach: I guess this info should be left out of the XML then?
Maybe two separate elements, one when… | ||||||||||
Not Done Inline ActionsWe can get rid of the magic numbers here, by storing the 2 in the xml (make some object containing the texts with has the 2 pixel spacing) and compute the height of the text by with .getTextSize().height. bb: We can get rid of the magic numbers here, by storing the 2 in the xml (make some object… | ||||||||||
const textDimension = primaryElement.size; | ||||||||||
Not Done Inline ActionsSame, we should compute the middle from the given box available. Again use some .getTextSize().height. bb: Same, we should compute the middle from the given box available. Again use some `.getTextSize(). | ||||||||||
bbUnsubmitted Not Done Inline Actions
bb: | ||||||||||
Not Done Inline ActionsIn fact even better maybe, is to just make the box of text be the full space and vAlign the text to centre bb: In fact even better maybe, is to just make the box of text be the full space and vAlign the… | ||||||||||
const margin = secondaryName ? 0 : 17; | ||||||||||
textDimension.bottom = textDimension.top + primaryElement.getTextSize().height + margin; | ||||||||||
Not Done Inline Actionsmerge this in the ternary above. Maybe we should store bb: merge this in the ternary above. Maybe we should store
`const hasSecondary = !secondaryName ||… | ||||||||||
primaryElement.size = textDimension; | ||||||||||
Engine.GetGUIObjectByName("secondary").caption = !secondaryName || primaryName == secondaryName ? "" : | Engine.GetGUIObjectByName("secondary").caption = !secondaryName || primaryName == secondaryName ? "" : | |||||||||
sprintf(translate("(%(secondaryName)s)"), { | sprintf(translate("(%(secondaryName)s)"), { | |||||||||
"secondaryName": secondaryName | "secondaryName": secondaryName | |||||||||
}); | }); | |||||||||
Not Done Inline Actionsmy bad, this naming is awful... bb: my bad, this naming is awful... | ||||||||||
let isGaia = playerState.civ == "gaia"; | let isGaia = playerState.civ == "gaia"; | |||||||||
Engine.GetGUIObjectByName("playerCivIcon").sprite = isGaia ? "" : "cropped:1.0, 0.15625 center:grayscale:" + civEmblem; | Engine.GetGUIObjectByName("playerCivIcon").sprite = isGaia ? "" : "cropped:1.0, 0.15625 center:grayscale:" + civEmblem; | |||||||||
Engine.GetGUIObjectByName("player").tooltip = isGaia ? "" : civName; | Engine.GetGUIObjectByName("player").tooltip = isGaia ? "" : civName; | |||||||||
// TODO: we should require all entities to have icons | // TODO: we should require all entities to have icons | |||||||||
Engine.GetGUIObjectByName("icon").sprite = template.icon ? ("stretched:session/portraits/" + template.icon) : "BackgroundBlack"; | Engine.GetGUIObjectByName("icon").sprite = template.icon ? ("stretched:session/portraits/" + template.icon) : "BackgroundBlack"; | |||||||||
if (template.icon) | if (template.icon) | |||||||||
▲ Show 20 Lines • Show All 256 Lines • Show Last 20 Lines |
'primaryElement' is never reassigned. Use 'const' instead.