Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/gui/reference/structree/draw.js
Show All 9 Lines | |||||
/** | /** | ||||
* Draw the structree | * Draw the structree | ||||
* | * | ||||
* (Actually resizes and changes visibility of elements, and populates text) | * (Actually resizes and changes visibility of elements, and populates text) | ||||
*/ | */ | ||||
function draw() | function draw() | ||||
{ | { | ||||
let specificNamesPrimary = Engine.ConfigDB_GetValue("user", "gui.session.specificNamesPrimary") != "false"; | |||||
// Set basic state (positioning of elements mainly), but only once | // Set basic state (positioning of elements mainly), but only once | ||||
if (!Object.keys(g_DrawLimits).length) | if (!Object.keys(g_DrawLimits).length) | ||||
predraw(); | predraw(); | ||||
let leftMargin = Engine.GetGUIObjectByName("tree_display").size.left; | let leftMargin = Engine.GetGUIObjectByName("tree_display").size.left; | ||||
let defWidth = 96; | let defWidth = 96; | ||||
let defMargin = 4; | let defMargin = 4; | ||||
Show All 26 Lines | for (let stru of g_BuildList[g_SelectedCiv][pha]) | ||||
Engine.GetGUIObjectByName("phase["+i+"]_struct["+s+"]_icon").sprite = | Engine.GetGUIObjectByName("phase["+i+"]_struct["+s+"]_icon").sprite = | ||||
"stretched:session/portraits/"+stru.icon; | "stretched:session/portraits/"+stru.icon; | ||||
Engine.GetGUIObjectByName("phase["+i+"]_struct["+s+"]_icon").tooltip = | Engine.GetGUIObjectByName("phase["+i+"]_struct["+s+"]_icon").tooltip = | ||||
compileTooltip(stru); | compileTooltip(stru); | ||||
Engine.GetGUIObjectByName("phase["+i+"]_struct["+s+"]_name").caption = | Engine.GetGUIObjectByName("phase["+i+"]_struct["+s+"]_name").caption = | ||||
translate(stru.name.specific); | translate(specificNamesPrimary ? stru.name.specific : stru.name.generic); | ||||
setViewerOnPress("phase["+i+"]_struct["+s+"]_icon", stru.name.internal); | setViewerOnPress("phase["+i+"]_struct["+s+"]_icon", stru.name.internal); | ||||
thisEle.hidden = false; | thisEle.hidden = false; | ||||
for (let r in g_DrawLimits[pha].prodQuant) | for (let r in g_DrawLimits[pha].prodQuant) | ||||
{ | { | ||||
let p = 0; | let p = 0; | ||||
r = +r; // force int | r = +r; // force int | ||||
▲ Show 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | for (let trainer of g_TrainList[g_SelectedCiv]) | ||||
{ | { | ||||
error("\""+g_SelectedCiv+"\" has more unit trainers than can be supported by the current GUI layout"); | error("\""+g_SelectedCiv+"\" has more unit trainers than can be supported by the current GUI layout"); | ||||
break; | break; | ||||
} | } | ||||
trainer = g_ParsedData.units[trainer]; | trainer = g_ParsedData.units[trainer]; | ||||
Engine.GetGUIObjectByName("trainer["+t+"]_icon").sprite = "stretched:session/portraits/"+trainer.icon; | Engine.GetGUIObjectByName("trainer["+t+"]_icon").sprite = "stretched:session/portraits/"+trainer.icon; | ||||
Engine.GetGUIObjectByName("trainer["+t+"]_icon").tooltip = compileTooltip(trainer); | Engine.GetGUIObjectByName("trainer["+t+"]_icon").tooltip = compileTooltip(trainer); | ||||
Engine.GetGUIObjectByName("trainer["+t+"]_name").caption = translate(trainer.name.specific); | Engine.GetGUIObjectByName("trainer["+t+"]_name").caption = translate(specificNamesPrimary ? trainer.name.specific : trainer.name.generic); | ||||
setViewerOnPress("trainer["+t+"]_icon", trainer.name.internal); | setViewerOnPress("trainer["+t+"]_icon", trainer.name.internal); | ||||
thisEle.hidden = false; | thisEle.hidden = false; | ||||
let p = 0; | let p = 0; | ||||
if (trainer.production) | if (trainer.production) | ||||
for (let prodType in trainer.production) | for (let prodType in trainer.production) | ||||
for (let prod of trainer.production[prodType]) | for (let prod of trainer.production[prodType]) | ||||
{ | { | ||||
▲ Show 20 Lines • Show All 255 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator