Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/session/session.js
Show First 20 Lines • Show All 362 Lines • ▼ Show 20 Lines | function updateDiplomacyColorsButton() | ||||
Engine.GetGUIObjectByName("diplomacyColorsWindowButtonIcon").sprite = g_DiplomacyColorsToggle ? | Engine.GetGUIObjectByName("diplomacyColorsWindowButtonIcon").sprite = g_DiplomacyColorsToggle ? | ||||
"stretched:session/icons/diplomacy-on.png" : | "stretched:session/icons/diplomacy-on.png" : | ||||
"stretched:session/icons/diplomacy.png"; | "stretched:session/icons/diplomacy.png"; | ||||
updateDisplayedPlayerColors(); | updateDisplayedPlayerColors(); | ||||
} | } | ||||
/** | /** | ||||
* Updates the primary/secondary names in the simulation and GUI. | |||||
*/ | |||||
function updateDisplayedNames() | |||||
{ | |||||
g_SpecificNamesPrimary = Engine.ConfigDB_GetValue("user", "gui.session.howToShowNames") == 0 || Engine.ConfigDB_GetValue("user", "gui.session.howToShowNames") == 2; | |||||
g_ShowSecondaryNames = Engine.ConfigDB_GetValue("user", "gui.session.howToShowNames") == 0 || Engine.ConfigDB_GetValue("user", "gui.session.howToShowNames") == 1; | |||||
} | |||||
/** | |||||
* Updates the displayed colors of players in the simulation and GUI. | * Updates the displayed colors of players in the simulation and GUI. | ||||
*/ | */ | ||||
function updateDisplayedPlayerColors() | function updateDisplayedPlayerColors() | ||||
{ | { | ||||
if (g_DiplomacyColorsToggle) | if (g_DiplomacyColorsToggle) | ||||
{ | { | ||||
let getDiplomacyColor = stance => | let getDiplomacyColor = stance => | ||||
guiToRgbColor(Engine.ConfigDB_GetValue("user", "gui.session.diplomacycolors." + stance)) || | guiToRgbColor(Engine.ConfigDB_GetValue("user", "gui.session.diplomacycolors." + stance)) || | ||||
guiToRgbColor(Engine.ConfigDB_GetValue("default", "gui.session.diplomacycolors." + stance)); | guiToRgbColor(Engine.ConfigDB_GetValue("default", "gui.session.diplomacycolors." + stance)); | ||||
let teamRepresentatives = {}; | let teamRepresentatives = {}; | ||||
for (let i = 1; i < g_Players.length; ++i) | for (let i = 1; i < g_Players.length; ++i) | ||||
if (g_ViewedPlayer <= 0) | if (g_ViewedPlayer <= 0) | ||||
{ | { | ||||
// Observers and gaia see team colors | // Observers and gaia see team colors | ||||
let team = g_Players[i].team; | let team = g_Players[i].team; | ||||
g_DisplayedPlayerColors[i] = g_Players[teamRepresentatives[team] || i].color; | g_DisplayedPlayerColors[i] = g_Players[teamRepresentatives[team] || i].color; | ||||
if (team != -1 && !teamRepresentatives[team]) | if (team != -1 && !teamRepresentatives[team]) | ||||
teamRepresentatives[team] = i; | teamRepresentatives[team] = i; | ||||
} | } | ||||
else | else | ||||
Freagarach: Switches not nice apparently. | |||||
// Players see colors depending on diplomacy | // Players see colors depending on diplomacy | ||||
g_DisplayedPlayerColors[i] = | g_DisplayedPlayerColors[i] = | ||||
g_ViewedPlayer == i ? getDiplomacyColor("self") : | g_ViewedPlayer == i ? getDiplomacyColor("self") : | ||||
g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") : | g_Players[g_ViewedPlayer].isAlly[i] ? getDiplomacyColor("ally") : | ||||
g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") : | g_Players[g_ViewedPlayer].isNeutral[i] ? getDiplomacyColor("neutral") : | ||||
getDiplomacyColor("enemy"); | getDiplomacyColor("enemy"); | ||||
g_DisplayedPlayerColors[0] = g_Players[0].color; | g_DisplayedPlayerColors[0] = g_Players[0].color; | ||||
▲ Show 20 Lines • Show All 652 Lines • ▼ Show 20 Lines | function updatePanelEntities() | ||||
let panelEntIndex = ent => g_PanelEntityOrder.findIndex(entClass => | let panelEntIndex = ent => g_PanelEntityOrder.findIndex(entClass => | ||||
GetEntityState(ent).identity.classes.indexOf(entClass) != -1); | GetEntityState(ent).identity.classes.indexOf(entClass) != -1); | ||||
g_PanelEntities = g_PanelEntities.sort((panelEntA, panelEntB) => panelEntIndex(panelEntA.ent) - panelEntIndex(panelEntB.ent)); | g_PanelEntities = g_PanelEntities.sort((panelEntA, panelEntB) => panelEntIndex(panelEntA.ent) - panelEntIndex(panelEntB.ent)); | ||||
} | } | ||||
function createPanelEntityTooltip(panelEntState, template) | function createPanelEntityTooltip(panelEntState, template) | ||||
{ | { | ||||
let getPanelEntNameTooltip = panelEntState => "[font=\"sans-bold-16\"]" + template.name.specific + "[/font]"; | let primaryName = g_SpecificNamesPrimary ? template.name.specific : template.name.generic; | ||||
let secondaryName = g_SpecificNamesPrimary ? template.name.generic : template.name.specific; | |||||
let getPanelEntNameTooltip = panelEntState => setStringTags(primaryName || secondaryName, g_TooltipTextFormats.nameSecondary); | |||||
return [ | return [ | ||||
getPanelEntNameTooltip, | getPanelEntNameTooltip, | ||||
getCurrentHealthTooltip, | getCurrentHealthTooltip, | ||||
getAttackTooltip, | getAttackTooltip, | ||||
getArmorTooltip, | getArmorTooltip, | ||||
getEntityTooltip, | getEntityTooltip, | ||||
getAurasTooltip | getAurasTooltip | ||||
▲ Show 20 Lines • Show All 639 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Switches not nice apparently.