Health bar shows average for multiple selections
Center panel texture shrunk and dark tile texture is tiled over the panels better Command icons reference new sheet This was SVN commit r8236.
This commit is contained in:
parent
fcedcae052
commit
8a01e11db7
BIN
binaries/data/mods/public/art/textures/ui/session/panel_bg.png
(Stored with Git LFS)
BIN
binaries/data/mods/public/art/textures/ui/session/panel_bg.png
(Stored with Git LFS)
Binary file not shown.
@ -158,9 +158,14 @@ function updateSelectionDetails()
|
||||
|
||||
// Fill out general info and display it
|
||||
if (selection.length == 1)
|
||||
{
|
||||
layoutSelectionSingle();
|
||||
displayGeneralInfo(entState, template); // must come after layout functions
|
||||
}
|
||||
else
|
||||
{
|
||||
layoutSelectionMultiple();
|
||||
}
|
||||
|
||||
if (entState.hitpoints != undefined)
|
||||
getGUIObjectByName("health").hidden = false;
|
||||
@ -175,8 +180,6 @@ function updateSelectionDetails()
|
||||
//else
|
||||
// getGUIObjectByName("stamina").hidden = true;
|
||||
}
|
||||
|
||||
displayGeneralInfo(entState, template); // must come after layout functions
|
||||
|
||||
// Show Panels
|
||||
detailsPanel.hidden = false;
|
||||
|
@ -32,12 +32,12 @@
|
||||
<!-- ================================ ================================ -->
|
||||
|
||||
<!-- Displays Alpha name and number (Alpha 2 Bellerophon) -->
|
||||
<object size="100%-200 28 100% 48" name="alphaLabel" type="text" style="centeredText" font="serif-bold-16" textcolor="white">
|
||||
<object size="100%-200 32 100% 52" name="alphaLabel" type="text" style="centeredText" font="serif-bold-16" textcolor="white">
|
||||
<action on="Load"><![CDATA[this.caption = "ALPHA II : Bxxxxxxxxxx";]]></action>
|
||||
</object>
|
||||
|
||||
<!-- Displays build date and revision number-->
|
||||
<object size="100%-200 48 100% 58" name="buildTimeLabel" type="text" style="centeredText" font="serif-12" textcolor="white">
|
||||
<object size="100%-200 52 100% 62" name="buildTimeLabel" type="text" style="centeredText" font="serif-12" textcolor="white">
|
||||
<action on="Load"><![CDATA[this.caption = buildTime(0) + " (" + buildTime(2) + ")";]]></action>
|
||||
</object>
|
||||
|
||||
@ -524,8 +524,8 @@
|
||||
>
|
||||
<object size="0 0 100% 100%">
|
||||
<repeat count="9">
|
||||
<object name="unitCommandButton[n]" hidden="true" style="iconButton" type="button" size="0 0 28 28">
|
||||
<object name="unitCommandIcon[n]" ghost="true" type="image" size="1 1 25 25" style="commandIcon"/>
|
||||
<object name="unitCommandButton[n]" hidden="true" style="iconButton" type="button" size="0 0 32 32" tooltip_style="snToolTipBottom">
|
||||
<object name="unitCommandIcon[n]" ghost="true" type="image" size="0 0 32 32" style="commandIcon"/>
|
||||
</object>
|
||||
</repeat>
|
||||
</object>
|
||||
@ -595,15 +595,15 @@
|
||||
</object>
|
||||
|
||||
<object name="unitQueuePanel"
|
||||
size="3 100%-51 100% 100%-3"
|
||||
size="4 -56 100% 0"
|
||||
type="image"
|
||||
style="sessionPanelDark"
|
||||
sprite="genericPanel"
|
||||
>
|
||||
<object size="-4 -3 52 53" type="image" sprite="snIconSheetTab" tooltip_style="snToolTip" cell_id="3" tooltip="Production queue">
|
||||
<object size="-4 -2 52 54" type="image" sprite="snIconSheetTab" tooltip_style="snToolTip" cell_id="3" tooltip="Production queue">
|
||||
<object name="queueProgress" ghost="true" style="iconButtonProgress" type="text"/>
|
||||
</object>
|
||||
|
||||
<object size="48 5 100% 100%">
|
||||
<object size="48 6 100% 100%">
|
||||
<repeat count="16">
|
||||
<object name="unitQueueButton[n]" hidden="true" style="iconButton" type="button" size="0 0 40 40">
|
||||
<object name="unitQueueIcon[n]" ghost="true" type="image" size="1 1 39 39"/>
|
||||
|
@ -16,7 +16,7 @@
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<!-- NEED TO MORE FORMATIONS TO A MORE APPROPRIATE PLACE -->
|
||||
<!-- ICONS NEED BETTER PLACE -->
|
||||
<sprite name="formation">
|
||||
<image
|
||||
texture="session/icons/sheets/formation_select.png"
|
||||
@ -25,7 +25,6 @@
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<!-- NEED TO MORE FORMATIONS TO A MORE APPROPRIATE PLACE -->
|
||||
<sprite name="formation_disabled">
|
||||
<image
|
||||
texture="session/icons/sheets/formation_nonselect.png"
|
||||
@ -33,6 +32,24 @@
|
||||
size="0 0 100% 100%"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="commands">
|
||||
<image
|
||||
texture="session/icons/sheets/commands.png"
|
||||
cell_size="32 32"
|
||||
size="0 0 100% 100%"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<sprite name="menuButton">
|
||||
<image
|
||||
@ -82,6 +99,7 @@
|
||||
<sprite name="genericPanel">
|
||||
<image
|
||||
texture="global/tile/tile_dark.png"
|
||||
texture_size="0 0 100% 100%"
|
||||
size="0 0 100% 100%"
|
||||
/>
|
||||
|
||||
@ -154,7 +172,8 @@
|
||||
<sprite name="mapPanel">
|
||||
<image
|
||||
texture="session/map_bg.png"
|
||||
texture_size="0 0 212 212"
|
||||
texture_size="0 0 100% 100%"
|
||||
size="0 0 100% 100%"
|
||||
/>
|
||||
<!-- Sides -->
|
||||
<image
|
||||
@ -257,7 +276,7 @@
|
||||
<sprite name="bottomMiddle">
|
||||
<image
|
||||
texture="session/panel_bg.png"
|
||||
real_texture_placement="0 0 512 256"
|
||||
texture_size="0 0 100% 100%"
|
||||
size="0 0 100% 100%"
|
||||
/>
|
||||
|
||||
@ -310,6 +329,7 @@
|
||||
<sprite name="bottomRight">
|
||||
<image
|
||||
texture="global/tile/tile_dark.png"
|
||||
texture_size="0 0 256 256"
|
||||
size="0 0 100% 100%"
|
||||
/>
|
||||
|
||||
|
@ -90,8 +90,7 @@
|
||||
/>
|
||||
|
||||
<style name="commandIcon"
|
||||
sprite="snIconSheetCommand"
|
||||
sprite_disabled="snIconSheetCommandDisabled"
|
||||
sprite="commands"
|
||||
ghost="true"
|
||||
/>
|
||||
|
||||
@ -205,7 +204,7 @@
|
||||
font="serif-bold-stroke-14"
|
||||
textcolor="white"
|
||||
text_align="center"
|
||||
text_valign="bottom"
|
||||
text_valign="top"
|
||||
/>
|
||||
|
||||
</styles>
|
||||
|
@ -8,8 +8,8 @@ const CONSTRUCTION = "Construction";
|
||||
const COMMAND = "Command";
|
||||
|
||||
// Constants used by the Queue or Garrison panel
|
||||
const UNIT_PANEL_BASE = -48; // The offset above the main panel (will often be negative)
|
||||
const UNIT_PANEL_HEIGHT = 41; // The height needed for a row of buttons
|
||||
const UNIT_PANEL_BASE = -52; // The offset above the main panel (will often be negative)
|
||||
const UNIT_PANEL_HEIGHT = 44; // The height needed for a row of buttons
|
||||
|
||||
// The number of currently visible buttons (used to optimise showing/hiding)
|
||||
var g_unitPanelButtons = {"Selection": 0, "Queue": 0, "Formation": 0, "Garrison": 0, "Training": 0, "Construction": 0, "Command": 0};
|
||||
@ -107,12 +107,16 @@ function layoutButtonRow(rowNumber, guiName, buttonSideLength, buttonSpacer, sta
|
||||
}
|
||||
|
||||
// Sets up "unit panels" - the panels with rows of icons (Helper function for updateUnitDisplay)
|
||||
|
||||
function setupUnitPanel(guiName, usedPanels, unitEntState, items, callback)
|
||||
{
|
||||
usedPanels[guiName] = 1;
|
||||
var selection = g_Selection.toList();
|
||||
var numberOfItems = items.length;
|
||||
|
||||
var selection = g_Selection.toList();
|
||||
var averageHealth = 0;
|
||||
var maxHealth = 0;
|
||||
|
||||
if (guiName == "Selection")
|
||||
{
|
||||
if (numberOfItems > 12)
|
||||
@ -157,6 +161,29 @@ function setupUnitPanel(guiName, usedPanels, unitEntState, items, callback)
|
||||
var tooltip = getEntityName(template);
|
||||
var count = g_Selection.groups.getCount(item);
|
||||
getGUIObjectByName("unit"+guiName+"Count["+i+"]").caption = (count > 1 ? count : "");
|
||||
|
||||
var entState = GetEntityState(selection[i])
|
||||
if (entState)
|
||||
{
|
||||
if (entState.hitpoints)
|
||||
{
|
||||
averageHealth += entState.hitpoints*count;
|
||||
maxHealth += entState.maxHitpoints*count;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == numberOfItems-1)
|
||||
{
|
||||
var unitHealthBar = getGUIObjectByName("healthBar");
|
||||
var healthSize = unitHealthBar.size;
|
||||
|
||||
healthSize.rtop = 100-100*Math.max(0, Math.min(1, averageHealth / maxHealth));
|
||||
unitHealthBar.size = healthSize;
|
||||
|
||||
var hitpoints = "[font=\"serif-bold-13\"]Hitpoints [/font]" + averageHealth + "/" + maxHealth;
|
||||
getGUIObjectByName("health").tooltip = hitpoints;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case QUEUE:
|
||||
@ -243,6 +270,16 @@ function setupUnitPanel(guiName, usedPanels, unitEntState, items, callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Position the visible buttons (TODO: if there's lots, maybe they should be squeezed together to fit)
|
||||
var numButtons = i;
|
||||
|
||||
|
@ -159,7 +159,7 @@ function getCommandCellId(commandName)
|
||||
switch (commandName)
|
||||
{
|
||||
case "delete":
|
||||
return 4;
|
||||
return 1;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user