Changeset View
Standalone View
binaries/data/mods/public/gui/session/selection_details.js
Show First 20 Lines • Show All 78 Lines • ▼ Show 20 Lines | if (g_Players[entState.player].offline) | ||||
playerName = sprintf(translate("\\[OFFLINE] %(player)s"), { "player": playerName }); | playerName = sprintf(translate("\\[OFFLINE] %(player)s"), { "player": playerName }); | ||||
// Rank | // Rank | ||||
if (entState.identity && entState.identity.rank && entState.identity.classes) | if (entState.identity && entState.identity.rank && entState.identity.classes) | ||||
{ | { | ||||
Engine.GetGUIObjectByName("rankIcon").tooltip = sprintf(translate("%(rank)s Rank"), { | Engine.GetGUIObjectByName("rankIcon").tooltip = sprintf(translate("%(rank)s Rank"), { | ||||
"rank": translateWithContext("Rank", entState.identity.rank) | "rank": translateWithContext("Rank", entState.identity.rank) | ||||
}); | }); | ||||
Engine.GetGUIObjectByName("rankIcon").sprite = getRankIconSprite(entState); | Engine.GetGUIObjectByName("rankIcon").sprite = "stretched:session/icons/ranks/" + entState.identity.rank + ".png"; | ||||
bb: More icons have been added, so maybe we need to keep that ugly function...
(maybe store the… | |||||
Not Done Inline Actions
As we don't use them atm, I think I can leave it unchanged.
Could be a good idea when using new icons. (Would also improve modability and allow different icons for different units) Imarok: > More icons have been added, so maybe we need to keep that ugly function...
As we don't use… | |||||
Not Done Inline ActionsSo who not do it like that? saves us renaming the icon files (again) bb: So who not do it like that? saves us renaming the icon files (again) | |||||
Not Done Inline ActionsI thought this shouldn't be inside this patch. Imarok: I thought this shouldn't be inside this patch.
Also we don't have inheritance for ranks, so… | |||||
Not Done Inline ActionsIndeed adding to the templates doesn't look like a good solution, however renaming the files (again), to something which is inconsistent doens't look appealing either, so perhaps keeping the ugly function below is the cleanest solution for now bb: Indeed adding to the templates doesn't look like a good solution, however renaming the files… | |||||
Not Done Inline ActionsTo me it looks really clean, to rename the files to their corresponding rank. Imarok: To me it looks really clean, to rename the files to their corresponding rank. | |||||
Not Done Inline Actionswth, I was looking at the session/icon/ranks directory, nvm renaming in the session/icon is fine bb: wth, I was looking at the session/icon/ranks directory, nvm renaming in the session/icon is fine | |||||
Engine.GetGUIObjectByName("rankIcon").hidden = false; | Engine.GetGUIObjectByName("rankIcon").hidden = false; | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
Engine.GetGUIObjectByName("rankIcon").hidden = true; | Engine.GetGUIObjectByName("rankIcon").hidden = true; | ||||
Engine.GetGUIObjectByName("rankIcon").tooltip = ""; | Engine.GetGUIObjectByName("rankIcon").tooltip = ""; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 393 Lines • ▼ Show 20 Lines | function updateSelectionDetails() | ||||
// Fill out commands panel for specific unit selected (or first unit of primary group) | // Fill out commands panel for specific unit selected (or first unit of primary group) | ||||
updateUnitCommands(entStates, supplementalDetailsPanel, commandsPanel); | updateUnitCommands(entStates, supplementalDetailsPanel, commandsPanel); | ||||
// Show health bar for garrisoned units if the garrison panel is visible | // Show health bar for garrisoned units if the garrison panel is visible | ||||
if (Engine.GetGUIObjectByName("unitGarrisonPanel") && !Engine.GetGUIObjectByName("unitGarrisonPanel").hidden) | if (Engine.GetGUIObjectByName("unitGarrisonPanel") && !Engine.GetGUIObjectByName("unitGarrisonPanel").hidden) | ||||
updateGarrisonHealthBar(entStates[0], g_Selection.toList()); | updateGarrisonHealthBar(entStates[0], g_Selection.toList()); | ||||
} | } | ||||
function getRankIconSprite(entState) | |||||
{ | |||||
if (entState.identity.rank == "Elite") | |||||
return "stretched:session/icons/rank3.png"; | |||||
if (entState.identity.rank == "Advanced") | |||||
return "stretched:session/icons/rank2.png"; | |||||
if (entState.identity.classes.indexOf("CitizenSoldier") != -1) | |||||
return "stretched:session/icons/rank1.png"; | |||||
return ""; | |||||
} | |||||
function tradingGainString(gain, owner) | function tradingGainString(gain, owner) | ||||
{ | { | ||||
// Translation: Used in the trading gain tooltip | // Translation: Used in the trading gain tooltip | ||||
return sprintf(translate("%(gain)s (%(player)s)"), { | return sprintf(translate("%(gain)s (%(player)s)"), { | ||||
"gain": gain, | "gain": gain, | ||||
"player": GetSimState().players[owner].name | "player": GetSimState().players[owner].name | ||||
}); | }); | ||||
} | } | ||||
Show All 31 Lines |
More icons have been added, so maybe we need to keep that ugly function...
(maybe store the spritename in the identity component?)