Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/gui/session/session.js
Show First 20 Lines • Show All 682 Lines • ▼ Show 20 Lines | function updateGroups() | ||||
}; | }; | ||||
for (let i in Engine.GetGUIObjectByName("unitGroupPanel").children) | for (let i in Engine.GetGUIObjectByName("unitGroupPanel").children) | ||||
{ | { | ||||
Engine.GetGUIObjectByName("unitGroupLabel[" + i + "]").caption = i; | Engine.GetGUIObjectByName("unitGroupLabel[" + i + "]").caption = i; | ||||
let button = Engine.GetGUIObjectByName("unitGroupButton[" + i + "]"); | let button = Engine.GetGUIObjectByName("unitGroupButton[" + i + "]"); | ||||
button.hidden = g_Groups.groups[i].getTotalCount() == 0; | button.hidden = g_Groups.groups[i].getTotalCount() == 0; | ||||
button.onpress = (function(i) { return function() { performGroup((Engine.HotkeyIsPressed("selection.add") ? "add" : "select"), i); }; })(i); | button.onPress = (function(i) { return function() { performGroup((Engine.HotkeyIsPressed("selection.add") ? "add" : "select"), i); }; })(i); | ||||
button.ondoublepress = (function(i) { return function() { performGroup("snap", i); }; })(i); | button.onDoublePress = (function(i) { return function() { performGroup("snap", i); }; })(i); | ||||
button.onpressright = (function(i) { return function() { performGroup("breakUp", i); }; })(i); | button.onPressRight = (function(i) { return function() { performGroup("breakUp", i); }; })(i); | ||||
// Choose the icon of the most common template (or the most costly if it's not unique) | // Choose the icon of the most common template (or the most costly if it's not unique) | ||||
if (g_Groups.groups[i].getTotalCount() > 0) | if (g_Groups.groups[i].getTotalCount() > 0) | ||||
{ | { | ||||
let icon = GetTemplateData(GetEntityState(g_Groups.groups[i].getEntsGrouped().reduce((pre, cur) => { | let icon = GetTemplateData(GetEntityState(g_Groups.groups[i].getEntsGrouped().reduce((pre, cur) => { | ||||
if (pre.ents.length == cur.ents.length) | if (pre.ents.length == cur.ents.length) | ||||
return getCostSum(pre.ents[0]) > getCostSum(cur.ents[0]) ? pre : cur; | return getCostSum(pre.ents[0]) > getCostSum(cur.ents[0]) ? pre : cur; | ||||
return pre.ents.length > cur.ents.length ? pre : cur; | return pre.ents.length > cur.ents.length ? pre : cur; | ||||
▲ Show 20 Lines • Show All 104 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator