1
0
forked from 0ad/0ad

Allowed selections with only one group to also show the unit stats area

Split unit cycle back to 2 functions

This was SVN commit r7781.
This commit is contained in:
WhiteTreePaladin 2010-07-21 21:02:21 +00:00
parent ef0a80623c
commit 9a6c020fce
3 changed files with 22 additions and 9 deletions

View File

@ -37,6 +37,11 @@ EntityGroups.prototype.reset = function()
this.groups = [];
};
EntityGroups.prototype.getLength = function()
{
return this.groups.length;
};
EntityGroups.prototype.getPrimary = function()
{
return this.primary;

View File

@ -10,7 +10,8 @@ function resetCycleIndex()
displayedCycleIndex = 1;
}
function cycleThroughSelection(forward)
/*
function cycleThroughSelection(forward) // uses boolean to determine direction (forward or reverse)
{
var selection = g_Selection.toList();
@ -62,10 +63,9 @@ function cycleThroughSelection(forward)
}
}
}
*/
function cycleThroughSelection1()
function cycleThroughSelection()
{
var selection = g_Selection.toList();
@ -272,10 +272,18 @@ function updateSelectionDetails(simState)
var selectionGroup = g_Selection.groups.getGroup(entState.template);
var typeCount = g_Selection.groups.getGroup(entState.template).typeCount;
getGUIObjectByName("sdSelectionCount").caption = ((typeCount > 1)? displayedCycleIndex + "/" + typeCount : "");
// Show cycle area if there is more than one unit of that type
if (typeCount > 1)
getGUIObjectByName("sdCycleArea").hidden = false;
else
getGUIObjectByName("sdCycleArea").hidden = true;
var visible = !(typeCount > 1);
getGUIObjectByName("sdCycleArea").hidden = visible;
getGUIObjectByName("sdStatsArea").hidden = true;
// Hide stats area if there is more thanone group
if (g_Selection.groups.getLength() > 1)
getGUIObjectByName("sdStatsArea").hidden = true;
else
getGUIObjectByName("sdStatsArea").hidden = false;
}
else
{

View File

@ -319,13 +319,13 @@
<!-- Cycle through units area -->
<object size= "6 120 86 136" name="sdCycleArea" type="image" sprite="menuBackground">
<object name="sdIconButtonReverse" style="wheatArrowDn" type="button" size="0 0 16 16">
<action on="Press">cycleThroughSelection(false);</action>
<action on="Press">reverseCycleThroughSelection();</action>
</object>
<object name="sdSelectionCount" ghost="true" style="groupIconsCenteredText" type="text"/>
<object name="sdIconButtonForward" style="wheatArrowUp" type="button" size="100%-16 0 100% 16">
<action on="Press">cycleThroughSelection(true);</action>
<action on="Press">cycleThroughSelection();</action>
</object>
</object>