Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/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"; | ||||
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 375 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 |
Wildfire Games · Phabricator