forked from 0ad/0ad
New GUI layout
Delete confirmation dialog Resource bar replaces resource quantity/icon Selected units are grouped by type regardless of rank Ranked units use the same icon "Basic" units are now considered to have the rank of "Basic" for grouping purposes This was SVN commit r8180.
This commit is contained in:
parent
0974a06321
commit
fa1dc05de2
@ -3,6 +3,8 @@ const SDL_BUTTON_MIDDLE = 2;
|
||||
const SDL_BUTTON_RIGHT = 3;
|
||||
const SDLK_RSHIFT = 303;
|
||||
const SDLK_LSHIFT = 304;
|
||||
const SDLK_RCTRL = 305;
|
||||
const SDLK_LCTRL = 306;
|
||||
|
||||
const MAX_SELECTION_SIZE = 32; // Limits selection size and ensures that there will not be too many selection items in the GUI
|
||||
|
||||
@ -30,6 +32,8 @@ var mouseIsOverObject = false;
|
||||
var specialKeyStates = {};
|
||||
specialKeyStates[SDLK_RSHIFT] = 0;
|
||||
specialKeyStates[SDLK_LSHIFT] = 0;
|
||||
specialKeyStates[SDLK_RCTRL] = 0;
|
||||
specialKeyStates[SDLK_LCTRL] = 0;
|
||||
// (TODO: maybe we should fix the hotkey system to be usable in this situation,
|
||||
// rather than hardcoding Shift into this code?)
|
||||
|
||||
@ -313,6 +317,7 @@ function handleInputBeforeGui(ev, hoveredObject)
|
||||
g_Selection.setHighlightList([]);
|
||||
g_Selection.reset();
|
||||
g_Selection.addList(ents);
|
||||
g_Selection.CreateSelectionGroups();
|
||||
|
||||
inputState = INPUT_NORMAL;
|
||||
return true;
|
||||
@ -719,12 +724,12 @@ function removeFromTrainingQueue(entity, id)
|
||||
}
|
||||
|
||||
// Called by unit selection buttons
|
||||
function changePrimarySelectionGroup(index)
|
||||
function changePrimarySelectionGroup(templateName)
|
||||
{
|
||||
if (specialKeyStates[SDLK_RSHIFT] || specialKeyStates[SDLK_LSHIFT])
|
||||
g_Selection.makePrimarySelection(index, true);
|
||||
if (specialKeyStates[SDLK_RCTRL] || specialKeyStates[SDLK_LCTRL])
|
||||
g_Selection.makePrimarySelection(templateName, true);
|
||||
else
|
||||
g_Selection.makePrimarySelection(index, false);
|
||||
g_Selection.makePrimarySelection(templateName, false);
|
||||
}
|
||||
|
||||
// Performs the specified command (delete, town bell, repair, etc.)
|
||||
@ -732,13 +737,25 @@ function performCommand(entity, commandName)
|
||||
{
|
||||
if (entity)
|
||||
{
|
||||
switch (commandName)
|
||||
var entState = GetEntityState(entity);
|
||||
var template = GetTemplateData(entState.template);
|
||||
var unitName = getEntityName(template);
|
||||
|
||||
var player = Engine.GetPlayerID();
|
||||
if (entState.player == player || g_DevSettings.controlAll)
|
||||
{
|
||||
case "delete":
|
||||
Engine.PostNetworkCommand({"type": "delete-entity", "entity": entity});
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch (commandName)
|
||||
{
|
||||
case "delete":
|
||||
var deleteFunction = function () { Engine.PostNetworkCommand({"type": "delete-entity", "entity": entity}); };
|
||||
var btCaptions = ["Yes", "No"];
|
||||
var btCode = [deleteFunction, null];
|
||||
messageBox(320, 180, "Are you sure you want to delete: " + unitName + "?", "Confirmation", 0, btCaptions, btCode);
|
||||
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,96 @@ function _playSound(ent)
|
||||
Engine.GuiInterfaceCall("PlaySound", { "name":"select", "entity":ent });
|
||||
}
|
||||
|
||||
//-------------------------------- -------------------------------- --------------------------------
|
||||
// EntityGroup class for managing grouped entities
|
||||
//-------------------------------- -------------------------------- --------------------------------
|
||||
function EntityGroup()
|
||||
{
|
||||
this.groupCounts = {};
|
||||
this.groupEntIDs = {};
|
||||
}
|
||||
|
||||
EntityGroup.prototype.create = function(entIDs)
|
||||
{
|
||||
this.groupCounts = {};
|
||||
var rankedTemplates = {};
|
||||
|
||||
for each (var entID in entIDs)
|
||||
{
|
||||
var entState = GetEntityState(entID);
|
||||
var rank = entState.identity.rank;
|
||||
var templateName = entState.template;
|
||||
var template = GetTemplateData(templateName);
|
||||
var unitName = template.name.specific || template.name.generic || "???";
|
||||
|
||||
if (rank)
|
||||
{
|
||||
if (rankedTemplates[unitName])
|
||||
{
|
||||
this.groupCounts[rankedTemplates[unitName]] += 1;
|
||||
this.groupEntIDs[unitName].push(entID);
|
||||
}
|
||||
else
|
||||
{
|
||||
rankedTemplates[unitName] = templateName;
|
||||
this.groupCounts[rankedTemplates[unitName]] = 1;
|
||||
this.groupEntIDs[unitName] = [entID];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.groupCounts[templateName])
|
||||
{
|
||||
this.groupCounts[templateName] += 1;
|
||||
this.groupEntIDs[unitName].push(entID);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.groupCounts[templateName] = 1;
|
||||
this.groupEntIDs[unitName] = [entID];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
EntityGroup.prototype.remove = function(templateName)
|
||||
{
|
||||
delete this.groupCounts[templateName];
|
||||
};
|
||||
|
||||
EntityGroup.prototype.getCount = function(templateName)
|
||||
{
|
||||
if (this.groupCounts[templateName])
|
||||
return this.groupCounts[templateName];
|
||||
else
|
||||
return 0;
|
||||
};
|
||||
|
||||
EntityGroup.prototype.getTemplateNames = function()
|
||||
{
|
||||
var templateNames = [];
|
||||
for (var templateName in this.groupCounts)
|
||||
templateNames.push(templateName);
|
||||
return templateNames;
|
||||
};
|
||||
|
||||
EntityGroup.prototype.getEntsByUnitName = function(unitName)
|
||||
{
|
||||
return this.groupEntIDs[unitName];
|
||||
};
|
||||
|
||||
|
||||
EntityGroup.prototype.getEntsByUnitNameInverse = function(unitName)
|
||||
{
|
||||
var ents = [];
|
||||
|
||||
for (var name in this.groupEntIDs)
|
||||
if (name != unitName)
|
||||
ents = ents.concat(this.groupEntIDs[name]);
|
||||
|
||||
return ents;
|
||||
};
|
||||
|
||||
//-------------------------------- -------------------------------- --------------------------------
|
||||
// EntitySelection class for managing the entity selection list and the primary selection
|
||||
//-------------------------------- -------------------------------- --------------------------------
|
||||
@ -33,36 +123,41 @@ function EntitySelection()
|
||||
// Public properties:
|
||||
//--------------------------------
|
||||
this.dirty = false; // set whenever the selection has changed
|
||||
this.groups = new EntityGroup();
|
||||
}
|
||||
|
||||
// Deselect everything but entities of the chosen type if the modifier is true
|
||||
// otherwise deselect just the chosen entity
|
||||
EntitySelection.prototype.makePrimarySelection = function(primaryIndex, modifierKey)
|
||||
EntitySelection.prototype.makePrimarySelection = function(primaryTemplateName, modifierKey)
|
||||
{
|
||||
var ents = [];
|
||||
var selection = this.toList();
|
||||
var entID;
|
||||
|
||||
// Find an entID of a unit of the same type
|
||||
for (var i = 0; i < selection.length; i++)
|
||||
{
|
||||
var entState = GetEntityState(selection[i]);
|
||||
if (!entState)
|
||||
continue;
|
||||
if (entState.template == primaryTemplateName)
|
||||
entID = selection[i];
|
||||
}
|
||||
|
||||
var primaryEntState = GetEntityState(entID);
|
||||
if (!primaryEntState)
|
||||
return;
|
||||
var primaryTemplate = GetTemplateData(primaryTemplateName);
|
||||
var primaryUnitName = primaryTemplate.name.specific || primaryTemplate.name.generic || "???";
|
||||
|
||||
var ents = [];
|
||||
if (modifierKey)
|
||||
{
|
||||
var primaryEntState = GetEntityState(selection[primaryIndex]);
|
||||
if (!primaryEntState)
|
||||
return;
|
||||
|
||||
for (var i = 0; i < selection.length; i++)
|
||||
{
|
||||
var entState = GetEntityState(selection[i]);
|
||||
if (!entState)
|
||||
continue;
|
||||
if (entState.template == primaryEntState.template)
|
||||
ents.push(selection[i]);
|
||||
}
|
||||
}
|
||||
ents = this.groups.getEntsByUnitNameInverse(primaryUnitName);
|
||||
else
|
||||
{
|
||||
ents.push(selection[primaryIndex]);
|
||||
}
|
||||
ents = this.groups.getEntsByUnitName(primaryUnitName);
|
||||
|
||||
this.reset();
|
||||
this.addList(ents);
|
||||
this.CreateSelectionGroups();
|
||||
}
|
||||
|
||||
// Get a list of the template names
|
||||
@ -80,6 +175,12 @@ EntitySelection.prototype.getTemplateNames = function()
|
||||
return templateNames;
|
||||
}
|
||||
|
||||
// Make selection groups
|
||||
EntitySelection.prototype.CreateSelectionGroups = function()
|
||||
{
|
||||
this.groups.create(this.toList());
|
||||
};
|
||||
|
||||
// Update the selection to take care of changes (like units that have been killed)
|
||||
EntitySelection.prototype.update = function()
|
||||
{
|
||||
@ -94,7 +195,10 @@ EntitySelection.prototype.update = function()
|
||||
}
|
||||
}
|
||||
if (numberRemoved > 0)
|
||||
{
|
||||
this.dirty = true;
|
||||
this.groups.create(this.toList());
|
||||
}
|
||||
};
|
||||
|
||||
EntitySelection.prototype.toggle = function(ent)
|
||||
@ -138,6 +242,7 @@ EntitySelection.prototype.reset = function()
|
||||
_setMotionOverlay(this.toList(), false);
|
||||
this.selected = {};
|
||||
this.dirty = true;
|
||||
this.groups = new EntityGroup();
|
||||
};
|
||||
|
||||
EntitySelection.prototype.toList = function()
|
||||
|
@ -2,31 +2,31 @@ const RESOURCE_ICON_CELL_IDS = {food : 0, wood : 1, stone : 2, metal : 3};
|
||||
|
||||
function layoutSelectionMultiple()
|
||||
{
|
||||
getGUIObjectByName("sdSpecific").hidden = true;
|
||||
getGUIObjectByName("sdIcon").hidden = true;
|
||||
getGUIObjectByName("sdStatsArea").hidden = true;
|
||||
getGUIObjectByName("sdHealth").hidden = true;
|
||||
getGUIObjectByName("sdStamina").hidden = true;
|
||||
// getGUIObjectByName("specific").hidden = true;
|
||||
// getGUIObjectByName("iconBorder").hidden = true;
|
||||
// getGUIObjectByName("statsArea").hidden = true;
|
||||
// getGUIObjectByName("health").hidden = true;
|
||||
// getGUIObjectByName("stamina").hidden = true;
|
||||
}
|
||||
|
||||
function layoutSelectionSingle(entState)
|
||||
{
|
||||
getGUIObjectByName("sdSpecific").hidden = false;
|
||||
getGUIObjectByName("sdIcon").hidden = false;
|
||||
getGUIObjectByName("sdStatsArea").hidden = false;
|
||||
|
||||
getGUIObjectByName("specific").hidden = false;
|
||||
getGUIObjectByName("iconBorder").hidden = false;
|
||||
// getGUIObjectByName("sdStatsArea").hidden = false;
|
||||
|
||||
if (entState.hitpoints != undefined)
|
||||
getGUIObjectByName("sdHealth").hidden = false;
|
||||
getGUIObjectByName("health").hidden = false;
|
||||
else
|
||||
getGUIObjectByName("sdHealth").hidden = true;
|
||||
getGUIObjectByName("health").hidden = true;
|
||||
|
||||
var player = Engine.GetPlayerID();
|
||||
if (entState.player == player || g_DevSettings.controlAll)
|
||||
{
|
||||
if (entState.stamina != undefined)
|
||||
getGUIObjectByName("sdStamina").hidden = false;
|
||||
getGUIObjectByName("stamina").hidden = false;
|
||||
else
|
||||
getGUIObjectByName("sdStamina").hidden = true;
|
||||
getGUIObjectByName("stamina").hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
@ -37,99 +37,93 @@ function displayGeneralInfo(entState, template)
|
||||
var specificName = "[font=\"serif-bold-18\"]" + template.name.specific + "[/font]";
|
||||
var genericName = template.name.generic != template.name.specific? template.name.generic : "";
|
||||
|
||||
var rank = entState.identity.rank? "[font=\"serif-bold-18\"]" + entState.identity.rank + " [/font]" : "";
|
||||
var civName = getFormalCivName(toTitleCase(g_Players[entState.player].civ));
|
||||
|
||||
var playerName = g_Players[entState.player].name;
|
||||
var playerColor = g_Players[entState.player].color.r + " " + g_Players[entState.player].color.g + " " +
|
||||
g_Players[entState.player].color.b+ " " + g_Players[entState.player].color.a;
|
||||
|
||||
// Rank
|
||||
getGUIObjectByName("rankIcon").cell_id = getRankIconCellId(entState);
|
||||
|
||||
// Hitpoints
|
||||
var hitpoints = "";
|
||||
|
||||
if (entState.hitpoints)
|
||||
{
|
||||
var unitHealthBar = getGUIObjectByName("sdHealthBar");
|
||||
var unitHealthBar = getGUIObjectByName("healthBar");
|
||||
var healthSize = unitHealthBar.size;
|
||||
healthSize.rright = 100*Math.max(0, Math.min(1, entState.hitpoints / entState.maxHitpoints));
|
||||
healthSize.rtop = 100-100*Math.max(0, Math.min(1, entState.hitpoints / entState.maxHitpoints));
|
||||
unitHealthBar.size = healthSize;
|
||||
|
||||
|
||||
hitpoints = "[font=\"serif-bold-13\"]Hitpoints [/font]" + entState.hitpoints + "/" + entState.maxHitpoints;
|
||||
getGUIObjectByName("sdHealth").tooltip = hitpoints;
|
||||
getGUIObjectByName("health").tooltip = hitpoints;
|
||||
}
|
||||
|
||||
// Resource stats
|
||||
var resources = "";
|
||||
var resourceType = "";
|
||||
var resourceCellID = -1;
|
||||
|
||||
if (entState.resourceSupply)
|
||||
{
|
||||
resources = Math.ceil(+entState.resourceSupply.amount) + "/" + entState.resourceSupply.max + " ";
|
||||
resources = Math.ceil(+entState.resourceSupply.amount) + "/" + entState.resourceSupply.max;
|
||||
resourceType = entState.resourceSupply.type["generic"];
|
||||
resourceCellID = RESOURCE_ICON_CELL_IDS[resourceType];
|
||||
|
||||
getGUIObjectByName("sdResources").hidden = false;
|
||||
getGUIObjectByName("sdAttack").hidden = true;
|
||||
getGUIObjectByName("sdArmour").hidden = true;
|
||||
var unitResourceBar = getGUIObjectByName("resourceBar");
|
||||
var resourceSize = unitResourceBar.size;
|
||||
|
||||
resourceSize.rtop = 100-100*Math.max(0, Math.min(1, +entState.resourceSupply.amount / entState.resourceSupply.max));
|
||||
unitResourceBar.size = resourceSize;
|
||||
|
||||
var unitResources = getGUIObjectByName("resources");
|
||||
unitResources.tooltip = "[font=\"serif-bold-13\"]Resources: [/font]" + resources + " " + resourceType;
|
||||
|
||||
if (!entState.hitpoints)
|
||||
unitResources.size = getGUIObjectByName("health").size;
|
||||
else
|
||||
unitResources.size = getGUIObjectByName("stamina").size;
|
||||
|
||||
getGUIObjectByName("resources").hidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
getGUIObjectByName("sdResources").hidden = true;
|
||||
getGUIObjectByName("sdAttack").hidden = false;
|
||||
getGUIObjectByName("sdArmour").hidden = false;
|
||||
getGUIObjectByName("resources").hidden = true;
|
||||
}
|
||||
|
||||
// Set Captions
|
||||
getGUIObjectByName("sdSpecific").caption = rank + specificName;
|
||||
getGUIObjectByName("sdPlayer").caption = playerName;
|
||||
getGUIObjectByName("sdPlayer").textcolor = playerColor;
|
||||
getGUIObjectByName("sdAttackStats").caption = damageTypesToTextStacked(entState.attack);
|
||||
getGUIObjectByName("sdArmourStats").caption = damageTypesToTextStacked(entState.armour);
|
||||
getGUIObjectByName("sdResourceStats").caption = resources;
|
||||
getGUIObjectByName("sdResourceIcon").cell_id = resourceCellID;
|
||||
getGUIObjectByName("specific").caption = specificName;
|
||||
getGUIObjectByName("player").caption = playerName;
|
||||
getGUIObjectByName("player").textcolor = playerColor;
|
||||
|
||||
// Icon image
|
||||
if (template.icon_sheet && typeof template.icon_cell)
|
||||
{
|
||||
getGUIObjectByName("sdIconImage").sprite = template.icon_sheet;
|
||||
getGUIObjectByName("sdIconImage").cell_id = template.icon_cell;
|
||||
getGUIObjectByName("icon").sprite = template.icon_sheet;
|
||||
getGUIObjectByName("icon").cell_id = template.icon_cell;
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: we should require all entities to have icons, so this case never occurs
|
||||
getGUIObjectByName("sdIconImage").sprite = "bkFillBlack";
|
||||
getGUIObjectByName("icon").sprite = "bkFillBlack";
|
||||
}
|
||||
|
||||
// TODO: need to change color of icon outline with the playerColor
|
||||
//getGUIObjectByName("sdIconOutline");
|
||||
|
||||
// Tooltips
|
||||
// getGUIObjectByName("sdSpecific").tooltip = genericName;
|
||||
getGUIObjectByName("sdPlayer").tooltip = civName != GAIA? civName : ""; // Don't need civ tooltip for Gaia Player - redundant
|
||||
getGUIObjectByName("sdHealth").tooltip = hitpoints;
|
||||
getGUIObjectByName("attackIcon").tooltip = damageTypesToText(entState.attack);
|
||||
getGUIObjectByName("armourIcon").tooltip = damageTypesToText(entState.armour);
|
||||
getGUIObjectByName("player").tooltip = civName != GAIA? civName : ""; // Don't need civ tooltip for Gaia Player - redundant
|
||||
getGUIObjectByName("health").tooltip = hitpoints;
|
||||
|
||||
// Icon Tooltip
|
||||
var iconTooltip = "";
|
||||
|
||||
|
||||
if (genericName)
|
||||
iconTooltip = "[font=\"serif-bold-16\"]" + genericName + "[/font]";
|
||||
|
||||
if (template.tooltip)
|
||||
iconTooltip += "\n[font=\"serif-13\"]" + template.tooltip + "[/font]";
|
||||
|
||||
/*
|
||||
if (entState.hitpoints)
|
||||
iconTooltip += "\n" + hitpoints;
|
||||
if (entState.attack)
|
||||
iconTooltip += "\n[font=\"serif-bold-13\"]Attack: [/font]" + damageTypesToText(entState.attack);
|
||||
if (entState.armour)
|
||||
iconTooltip += "\n[font=\"serif-bold-13\"]Armour: [/font]" + damageTypesToText(entState.armour);
|
||||
if (entState.resourceSupply)
|
||||
iconTooltip += "\n[font=\"serif-bold-13\"]Resources: [/font]" + resources + "[font=\"serif-12\"]" + resourceType + "[/font]";
|
||||
*/
|
||||
|
||||
getGUIObjectByName("sdIcon").tooltip = iconTooltip;
|
||||
getGUIObjectByName("iconBorder").tooltip = iconTooltip;
|
||||
}
|
||||
|
||||
// Updates middle entity Selection Details Panel
|
||||
@ -145,6 +139,7 @@ function updateSelectionDetails()
|
||||
{
|
||||
detailsPanel.hidden = true;
|
||||
commandsPanel.hidden = true;
|
||||
getGUIObjectByName("unitSelectionPanel").hidden = true;
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -31,13 +31,13 @@
|
||||
<!-- ALPHA LABELS (alpha, build time, revision) -->
|
||||
<!-- ================================ ================================ -->
|
||||
|
||||
<!-- Displays Alpha name and number -->
|
||||
<object size="100%-170 0 100%-8 25" name="alphaLabel" type="text" style="centeredText" font="serif-bold-16" textcolor="white">
|
||||
<action on="Load"><![CDATA[this.caption = "ALPHA I : Argonaut";]]></action>
|
||||
<!-- Displays Alpha name and number (Alpha 2 Bellerophon) -->
|
||||
<object size="100%-200 0 100%-8 25" 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%-170 25 100%-8 45" name="buildTimeLabel" type="text" style="centeredText" font="serif-12" textcolor="white">
|
||||
<object size="100%-200 25 100%-8 45" name="buildTimeLabel" type="text" style="centeredText" font="serif-12" textcolor="white">
|
||||
<action on="Load"><![CDATA[this.caption = buildTime(0) + " (" + buildTime(2) + ")";]]></action>
|
||||
</object>
|
||||
|
||||
@ -184,7 +184,7 @@
|
||||
<object name="settingsOptions"
|
||||
size="30 30 100%-30 150"
|
||||
type="image"
|
||||
style="sessionPanelStyle"
|
||||
style="sessionPanel"
|
||||
>
|
||||
<!-- Settings / shadows -->
|
||||
<object size="0 10 100%-80 35" type="text" style="settingsText" ghost="true">Enable Shadows</object>
|
||||
@ -295,162 +295,170 @@
|
||||
</object>
|
||||
|
||||
<!-- ================================ ================================ -->
|
||||
<!-- Bottom-left Minimap and Resource Panel-->
|
||||
<!-- Player resource bar -->
|
||||
<!-- ================================ ================================ -->
|
||||
<object
|
||||
name="mapAndResourcePanel"
|
||||
style="sessionPanelStyle"
|
||||
size="0 100%-175 272 100%"
|
||||
type="image"
|
||||
z="30"
|
||||
size="50%-300 -4 50%+300 28"
|
||||
type="image"
|
||||
style="resourcePanel"
|
||||
z="140"
|
||||
>
|
||||
<!-- Minimap -->
|
||||
<object name="minimap">
|
||||
<object
|
||||
size="24 100%-164 164 100%-24"
|
||||
type="image"
|
||||
style="wheatWindow"
|
||||
/>
|
||||
|
||||
<object name="minimapDisplay"
|
||||
type="minimap"
|
||||
size="6 100%-182 182 100%-6"
|
||||
>
|
||||
<action on="WorldClick">handleMinimapEvent(arguments[0]);</action>
|
||||
</object>
|
||||
<!-- Food -->
|
||||
<object size="50 4 150 100%" type="image" style="resourceCounter" tooltip="Food" >
|
||||
<object size="0 0 28 24" type="image" style="resourceIcon" cell_id="0"/>
|
||||
<object size="28 0 150 24" type="text" style="resourceText" name="resourceFood"/>
|
||||
</object>
|
||||
|
||||
<!-- Player resource bar -->
|
||||
<object
|
||||
size="188 100%-130 100% 100%-2"
|
||||
>
|
||||
<!-- Food -->
|
||||
<object size="0 0 100% 26" type="image" style="resourceCounter" tooltip="Food" >
|
||||
<object size="0 0 28 24" type="image" style="resourceIcon" cell_id="0"/>
|
||||
<object size="28 0 100% 24" type="text" style="resourceText" name="resourceFood"/>
|
||||
</object>
|
||||
<!-- Wood -->
|
||||
<object size="150 4 250 100%" type="image" style="resourceCounter" tooltip="Wood">
|
||||
<object size="0 0 28 24" type="image" style="resourceIcon" cell_id="1"/>
|
||||
<object size="28 0 250 24" type="text" style="resourceText" name="resourceWood"/>
|
||||
</object>
|
||||
|
||||
<!-- Wood -->
|
||||
<object size="0 26 100% 52" type="image" style="resourceCounter" tooltip="Wood">
|
||||
<object size="0 0 28 24" type="image" style="resourceIcon" cell_id="1"/>
|
||||
<object size="28 0 100% 24" type="text" style="resourceText" name="resourceWood"/>
|
||||
</object>
|
||||
<!-- Stone -->
|
||||
<object size="250 4 350 100%" type="image" style="resourceCounter" tooltip="Stone">
|
||||
<object size="0 0 28 24" type="image" style="resourceIcon" cell_id="2"/>
|
||||
<object size="28 0 350 24" type="text" style="resourceText" name="resourceStone"/>
|
||||
</object>
|
||||
|
||||
<!-- Stone -->
|
||||
<object size="0 52 100%78" type="image" style="resourceCounter" tooltip="Stone">
|
||||
<object size="0 0 28 24" type="image" style="resourceIcon" cell_id="2"/>
|
||||
<object size="28 0 100% 24" type="text" style="resourceText" name="resourceStone"/>
|
||||
</object>
|
||||
<!-- Metal -->
|
||||
<object size="350 4 450 100%" type="image" style="resourceCounter" tooltip="Metal">
|
||||
<object size="0 0 28 24" type="image" style="resourceIcon" cell_id="3"/>
|
||||
<object size="28 0 450 24" type="text" style="resourceText" name="resourceMetal"/>
|
||||
</object>
|
||||
|
||||
<!-- Metal -->
|
||||
<object size="0 78 100% 104" type="image" style="resourceCounter" tooltip="Metal">
|
||||
<object size="0 0 28 24" type="image" style="resourceIcon" cell_id="3"/>
|
||||
<object size="28 0 100% 24" type="text" style="resourceText" name="resourceMetal"/>
|
||||
</object>
|
||||
|
||||
<!-- Population -->
|
||||
<object size="0 104 100% 130" type="image" style="resourceCounter" tooltip="Population (current / maximum)">
|
||||
<object size="0 0 28 24" type="image" style="resourceIcon" cell_id="4"/>
|
||||
<object size="28 0 100% 24" type="text" style="resourceText" name="resourcePop"/>
|
||||
</object>
|
||||
<!-- Population -->
|
||||
<object size="450 4 550 100%" type="image" style="resourceCounter" tooltip="Population (current / maximum)">
|
||||
<object size="0 0 28 24" type="image" style="resourceIcon" cell_id="4"/>
|
||||
<object size="28 0 550 24" type="text" style="resourceText" name="resourcePop"/>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<!-- ================================ ================================ -->
|
||||
<!-- Bottom-middle selected-units and unit details panel ("Selection Details" is Abbreviated as "sd") -->
|
||||
<!-- Unit Selection Area -->
|
||||
<!-- ================================ ================================ -->
|
||||
<object name="unitSelectionPanel"
|
||||
size="50%-300 20 50%+300 60"
|
||||
>
|
||||
<object size="0 0 100% 100%">
|
||||
<repeat count="13">
|
||||
<object name="unitSelectionButton[n]" hidden="true" style="iconButton" type="button" size="0 0 36 36" z="100">
|
||||
<object name="unitSelectionIcon[n]" type="image" ghost="true" size="1 1 35 35"/>
|
||||
<object name="unitSelectionCount[n]" ghost="true" style="groupIconsText" type="text" size="0 0 100% 100%"/>
|
||||
</object>
|
||||
</repeat>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<!-- ================================ ================================ -->
|
||||
<!-- Minimap -->
|
||||
<!-- ================================ ================================ -->
|
||||
<object
|
||||
name="minimapPanel"
|
||||
size="100%-180 100%-180 100% 100%"
|
||||
type="image"
|
||||
style="insetWheatWindow"
|
||||
>
|
||||
<object name="minimap"
|
||||
type="minimap"
|
||||
size="6 6 100%-6 100%-6"
|
||||
>
|
||||
<action on="WorldClick">handleMinimapEvent(arguments[0]);</action>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<!-- ================================ ================================ -->
|
||||
<!-- Details Panel -->
|
||||
<!-- ================================ ================================ -->
|
||||
<object name="selectionDetails"
|
||||
type="image"
|
||||
style="sessionPanelStyle"
|
||||
size="282 100%-170 585 100%"
|
||||
style="sessionPanel"
|
||||
size="22 100%-160 202 100%"
|
||||
hidden="true"
|
||||
z="20"
|
||||
>
|
||||
<!-- Unit Selection Area -->
|
||||
<object name="unitSelectionPanel"
|
||||
size="4 6 274 56"
|
||||
>
|
||||
<object size="0 0 100% 47">
|
||||
<repeat count="32">
|
||||
<object name="unitSelectionButton[n]" hidden="true" style="iconButton" type="button" size="0 0 36 36">
|
||||
<object name="unitSelectionIcon[n]" type="image" ghost="true" size="3 3 34 34"/>
|
||||
<object size="0 100%-3 100% 100%" name="unitSelectionHealth[n]" ghost="true">
|
||||
<object size="0 0 100% 100%" name="unitSelectionHealthBackground[n]" type="image" sprite="sdHealthBackground" ghost="true"/>
|
||||
<object size="0 0 100% 100%" name="unitSelectionHealthForeground[n]" type="image" sprite="sdHealthForeground" ghost="true"/>
|
||||
</object>
|
||||
<!-- Big unit icon -->
|
||||
<object size= "50%-53 -10 50%+53 96" type="image" name="iconBorder" style="insetWheatWindow" tooltip_style="snToolTip">
|
||||
<object size= "3 3 100%-3 100%-3" type="image" name="icon" ghost="true"/>
|
||||
<object size="100%-32 0 100% 32" name="rankIcon" type="image" cell_id="-1" sprite="snIconSheetRank" ghost="true"/>
|
||||
|
||||
<!-- Health bar -->
|
||||
<object size="100%+8 16 100%+18 100%" type="image" name="health" tooltip="Hitpoints" tooltip_style="snToolTip">
|
||||
<object type="image" sprite="healthBackground" ghost="true"/>
|
||||
<object type="image" sprite="healthForeground" ghost="true" name="healthBar"/>
|
||||
<object type="image" sprite="statsBarShader" ghost="true"/>
|
||||
</object>
|
||||
|
||||
<!-- Stamina bar -->
|
||||
<object size="100%+20 16 100%+30 100%" type="image" name="stamina" tooltip="Stamina" tooltip_style="snToolTip">
|
||||
<object type="image" sprite="staminaBackground" ghost="true"/>
|
||||
<object type="image" sprite="staminaForeground" ghost="true" name="staminaBar"/>
|
||||
<object type="image" sprite="statsBarShader" ghost="true"/>
|
||||
</object>
|
||||
|
||||
<!-- Resource bar -->
|
||||
<object size="100%+8 16 100%+18 100%" type="image" name="resources" tooltip="Resources" tooltip_style="snToolTip">
|
||||
<object type="image" sprite="resourceBackground" ghost="true"/>
|
||||
<object type="image" sprite="resourceForeground" ghost="true" name="resourceBar"/>
|
||||
<object type="image" sprite="statsBarShader" ghost="true"/>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<!-- Stats -->
|
||||
<object size="-2 6 40 96" name="statsArea" type="image">
|
||||
<!-- Attack icon -->
|
||||
<object size="0 0 40 40" type="image" name="attackIcon" sprite="snIconSheetStance" cell_id="1" tooltip_style="snToolTip"/>
|
||||
|
||||
<!-- Armour icon -->
|
||||
<object size="0 40 40 80" type="image" name="armourIcon" sprite="snIconSheetStance" cell_id="3" tooltip_style="snToolTip"/>
|
||||
</object>
|
||||
|
||||
<!-- Names -->
|
||||
<object size="50%-112 100%-60 50%+112 100%" name="names" type="image" style="sessionPanel">
|
||||
<!-- Specific Name -->
|
||||
<object size="0 -4 100% 30" name="specific" type="text" style="centeredText" font="serif-bold-18" tooltip_style="snToolTip"/>
|
||||
|
||||
<!-- Player Name -->
|
||||
<object size="0 26 100% 100%-2" name="player" type="text" style="centeredText" font="serif-bold-stroke-14" tooltip_style="snToolTip"/>
|
||||
</object>
|
||||
|
||||
<!-- Unit Commands -->
|
||||
<object name="unitCommandPanel"
|
||||
size="50%-112 100%-30 50%+112 100%"
|
||||
type="image"
|
||||
style="sessionPanel"
|
||||
z="30"
|
||||
>
|
||||
<object size="0 2 100% 100%-2">
|
||||
<repeat count="8">
|
||||
<object name="unitCommandButton[n]" hidden="true" style="iconButton" type="button" size="0 0 27 27">
|
||||
<object name="unitCommandIcon[n]" ghost="true" type="image" size="3 3 24 24" style="commandIcon"/>
|
||||
</object>
|
||||
</repeat>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<!-- Big unit icon -->
|
||||
<object size= "8 30 88 110" name="sdIcon" type="image" tooltip_style="snToolTip">
|
||||
<object type="image" name="sdIconOutline" style="sdIconOutline" ghost="true"/>
|
||||
<object type="image" name="sdIconImage" ghost="true"/>
|
||||
<object size="100%-24 -6 100%+6 24" name="sdRankIcon" type="image" cell_id="-1" sprite="snIconSheetRank" ghost="true"/>
|
||||
</object>
|
||||
|
||||
<!-- Health bar -->
|
||||
<object size="8 112 88 118" type="image" name="sdHealth" tooltip="Hitpoints" tooltip_style="snToolTip">
|
||||
<object type="image" sprite="sdHealthBackground" ghost="true"/>
|
||||
<object type="image" sprite="sdHealthForeground" ghost="true" name="sdHealthBar"/>
|
||||
</object>
|
||||
|
||||
<!-- Stamina bar -->
|
||||
<object size="8 120 88 126" type="image" name="sdStamina" tooltip="Stamina" tooltip_style="snToolTip">
|
||||
<object type="image" sprite="sdStaminaBackground" ghost="true"/>
|
||||
<object type="image" sprite="sdStaminaForeground" ghost="true" name="sdStaminaBar"/>
|
||||
</object>
|
||||
|
||||
<!-- Specific Name -->
|
||||
<object size="2 0 100% 26" name="sdSpecific" type="text" style="leftAlignedText" font="serif-bold-18" tooltip_style="snToolTip"/>
|
||||
|
||||
<!-- Stats -->
|
||||
<object size="86 30 100% 100%" name="sdStatsArea" type="image">
|
||||
<!-- Player Name -->
|
||||
<object size="0 0 100% 24" name="sdPlayer" type="text" style="centeredText" font="serif-bold-stroke-14" tooltip_style="snToolTip"/>
|
||||
|
||||
<!-- Attack stats -->
|
||||
<object size="12 32 100% 100%" type="image" name="sdAttack" tooltip="" tooltip_style="snToolTip">
|
||||
<object size="-4 -8 36 36" type="image" name="sdAttackImage" ghost="true" sprite="snIconSheetStance" cell_id="1"/>
|
||||
<object size="30 0 100% 100%" type="text" name="sdAttackStats" style="statsText"/>
|
||||
</object>
|
||||
|
||||
<!-- Armour stats -->
|
||||
<object size="108 32 100% 100%" type="image" name="sdArmour" tooltip="" tooltip_style="snToolTip">
|
||||
<object size="-4 -4 36 36" type="image" name="sdArmourImage" ghost="true" sprite="snIconSheetStance" cell_id="3"/>
|
||||
<object size="30 0 100% 100%" type="text" name="sdArmourStats" style="statsText"/>
|
||||
</object>
|
||||
|
||||
<!-- Resource Quantity -->
|
||||
<object hidden="true" size="60 40 100% 60" type="image" name="sdResources" tooltip="" tooltip_style="snToolTip">
|
||||
<object size="0 0 28 24" name="sdResourceIcon" type="image" style="resourceIcon" cell_id="0"/>
|
||||
<object size="28 0 100% 100%" name="sdResourceStats" type="text" style="resourceStatsText"/>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
</object>
|
||||
</object> <!-- END OF SELECTION DETAILS -->
|
||||
|
||||
<!-- ================================ ================================ -->
|
||||
<!-- Bottom-right commands panel -->
|
||||
<!--Commands Panel -->
|
||||
<!-- ================================ ================================ -->
|
||||
<object name="unitCommands"
|
||||
type="image"
|
||||
style="sessionPanelStyle"
|
||||
size="595 100%-175 1024 100%"
|
||||
style="sessionPanel"
|
||||
size="204 100%-104 676 100%"
|
||||
hidden="true"
|
||||
z="50"
|
||||
>
|
||||
<object name="unitConstructionPanel"
|
||||
size="0 3 100% 100%"
|
||||
size="28 4 100% 100%"
|
||||
>
|
||||
<object size="-2 -2 54 54" type="image" sprite="snIconSheetTab" tooltip_style="snToolTip"
|
||||
cell_id="0" tooltip="Construction"/>
|
||||
<!--<object size="-2 -2 54 54" type="image" sprite="snIconSheetTab" tooltip_style="snToolTip"
|
||||
cell_id="0" tooltip="Construction"/>-->
|
||||
|
||||
<object size="54 0 100% 50">
|
||||
<repeat count="24">
|
||||
<object name="unitConstructionButton[n]" hidden="true" style="iconButton" type="button" size="0 0 45 45">
|
||||
<object name="unitConstructionIcon[n]" type="image" ghost="true" size="3 3 42 42"/>
|
||||
<object size="0 0 100% 50">
|
||||
<repeat count="18">
|
||||
<object name="unitConstructionButton[n]" hidden="true" style="iconButton" type="button" size="0 0 48 48">
|
||||
<object name="unitConstructionIcon[n]" type="image" ghost="true" size="1 1 47 47"/>
|
||||
</object>
|
||||
</repeat>
|
||||
</object>
|
||||
@ -490,32 +498,32 @@
|
||||
</object>
|
||||
|
||||
<object name="unitTrainingPanel"
|
||||
size="0 3 100% 100%"
|
||||
size="0 0 100% 100%"
|
||||
>
|
||||
<object size="-2 -2 54 54" type="image" sprite="snIconSheetTab" tooltip_style="snToolTip"
|
||||
cell_id="2" tooltip="Training"/>
|
||||
<!--<object size="-2 -2 54 54" type="image" sprite="snIconSheetTab" tooltip_style="snToolTip"
|
||||
cell_id="2" tooltip="Training"/>-->
|
||||
|
||||
<object size="54 0 100% 50">
|
||||
<repeat count="24">
|
||||
<object name="unitTrainingButton[n]" hidden="true" style="iconButton" type="button" size="0 0 45 45">
|
||||
<object name="unitTrainingIcon[n]" type="image" ghost="true" size="3 3 42 42"/>
|
||||
<object size="28 4 100% 100%">
|
||||
<repeat count="18">
|
||||
<object name="unitTrainingButton[n]" hidden="true" style="iconButton" type="button" size="0 0 48 48">
|
||||
<object name="unitTrainingIcon[n]" type="image" ghost="true" size="1 1 47 47"/>
|
||||
</object>
|
||||
</repeat>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<object name="unitQueuePanel"
|
||||
style="sessionPanelStyle"
|
||||
size="80 -46 100% 100%-180"
|
||||
style="sessionPanel"
|
||||
size="0 -52 100% 0"
|
||||
type="image"
|
||||
>
|
||||
<object size="-2 -2 44 44" type="image" sprite="snIconSheetTab" tooltip_style="snToolTip"
|
||||
cell_id="3" tooltip="Production queue"/>
|
||||
<object size="-2 -4 54 52" type="image" sprite="snIconSheetTab" tooltip_style="snToolTip"
|
||||
cell_id="3" tooltip="Production queue" />
|
||||
|
||||
<object size="44 3 100% 100%">
|
||||
<repeat count="24">
|
||||
<object name="unitQueueButton[n]" hidden="true" style="iconButton" type="button" size="0 0 36 36">
|
||||
<object name="unitQueueIcon[n]" ghost="true" type="image" size="3 3 34 34"/>
|
||||
<object size="54 4 100% 100%">
|
||||
<repeat count="18">
|
||||
<object name="unitQueueButton[n]" hidden="true" style="iconButton" type="button" size="0 0 42 42">
|
||||
<object name="unitQueueIcon[n]" ghost="true" type="image" size="1 1 41 41"/>
|
||||
<object name="unitQueueCount[n]" ghost="true" style="iconButtonCount" type="text"/>
|
||||
<object name="unitQueueProgress[n]" ghost="true" style="iconButtonProgress" type="text"/>
|
||||
</object>
|
||||
@ -523,24 +531,10 @@
|
||||
</object>
|
||||
</object>
|
||||
|
||||
<object name="unitCommandPanel"
|
||||
style="sessionPanelStyle"
|
||||
size="0 100%-28 100% 100%"
|
||||
type="image"
|
||||
>
|
||||
<object size="3 0 100% 100%">
|
||||
<repeat count="24">
|
||||
<object name="unitCommandButton[n]" hidden="true" style="iconButton" type="button" size="0 0 27 27">
|
||||
<object name="unitCommandIcon[n]" ghost="true" type="image" size="3 3 24 24" style="commandIcon"/>
|
||||
</object>
|
||||
</repeat>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
</object> <!-- END OF SN OBJECT -->
|
||||
|
||||
<!-- ================================ ================================ -->
|
||||
<!-- Selection bandbox -->
|
||||
<!-- ================================ ================================ -->
|
||||
@ -562,6 +556,5 @@
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
|
||||
</objects>
|
||||
|
@ -106,23 +106,131 @@
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="sdIconOutline">
|
||||
<image backcolor="blue"/>
|
||||
<sprite name="mainPanel">
|
||||
<!-- (currently this is all a hack - need proper textures) -->
|
||||
<image
|
||||
texture="global/titlebar/middle_gold_fern.dds"
|
||||
texture_size="0 0 64 8"
|
||||
size="0 -2 100% 0"
|
||||
/>
|
||||
<image
|
||||
texture="global/titlebar/middle_gold_fern.dds"
|
||||
texture_size="0 0 64 32"
|
||||
size="0 100%-2 100% 100%+2"
|
||||
/>
|
||||
<image
|
||||
texture="global/border/corner_bronze.dds"
|
||||
texture_size="0 0 16 100%"
|
||||
size="-2 -2 0 100%+2"
|
||||
/>
|
||||
<image
|
||||
texture="global/border/corner_bronze.dds"
|
||||
texture_size="0 0 16 100%"
|
||||
size="100% 0%-2 100%+2 100%+2"
|
||||
/>
|
||||
<image
|
||||
texture="global/tile/sandstone.dds"
|
||||
texture_size="0 0 128 128"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="insetWheatWindow">
|
||||
<!-- middle -->
|
||||
<image texture="global/tile/sandstone.dds"
|
||||
texture_size="0 0 128 128"
|
||||
size="15 15 100%-15 100%-15"
|
||||
/>
|
||||
|
||||
<!-- Sides -->
|
||||
<image texture="global/border/top_marble.dds"
|
||||
texture_size="0 0 128 32"
|
||||
size="15 0 100%-15 15"
|
||||
/>
|
||||
<image texture="global/border/right_marble.dds"
|
||||
texture_size="0 0 32 128"
|
||||
size="100% 15 100%-15 100%-15"
|
||||
/>
|
||||
<image texture="global/border/bottom_marble.dds"
|
||||
texture_size="0 0 128 32"
|
||||
size="15 100% 100%-15 100%-15"
|
||||
/>
|
||||
<image texture="global/border/left_marble.dds"
|
||||
texture_size="0 0 32 128"
|
||||
size="0 15 15 100%-15"
|
||||
/>
|
||||
|
||||
<!-- corners -->
|
||||
<image texture="global/border/corner_bronze.dds"
|
||||
real_texture_placement="0 0 15 15"
|
||||
size="0 0 16 16"
|
||||
/>
|
||||
<image texture="global/border/corner_bronze.dds"
|
||||
real_texture_placement="0 0 15 15"
|
||||
size="100%-16 0 100% 16"
|
||||
/>
|
||||
<image texture="global/border/corner_bronze.dds"
|
||||
real_texture_placement="0 0 15 15"
|
||||
size="100%-16 100%-16 100% 100%"
|
||||
/>
|
||||
<image texture="global/border/corner_bronze.dds"
|
||||
real_texture_placement="0 0 15 15"
|
||||
size="0 100%-16 16 100%"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="sdHealthBackground">
|
||||
<sprite name="titleBar">
|
||||
<image texture="global/titlebar/left_gold_fern.dds"
|
||||
real_texture_placement="0 0 64 30"
|
||||
size="0%+0 0% 64 0%+30"
|
||||
/>
|
||||
<image texture="global/titlebar/middle_gold_fern.dds"
|
||||
real_texture_placement="0 0 64 30"
|
||||
size="64 0% 100%-64 0%+30"
|
||||
/>
|
||||
<image texture="global/titlebar/right_gold_fern.dds"
|
||||
real_texture_placement="0 0 64 30"
|
||||
size="100%-64 0% 100%+0 0%+30"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="statsBarShader">
|
||||
<image backcolor="0 0 0 192" size="0 0 100% 1"/>
|
||||
<image backcolor="0 0 0 192" size="100%-1 1 100% 100%-1"/>
|
||||
<image backcolor="0 0 0 192" size="0 100%-1 100% 100%"/>
|
||||
<image backcolor="0 0 0 192" size="0 1 1 100%-1"/>
|
||||
|
||||
<image backcolor="0 0 0 128" size="0 1 100% 2"/>
|
||||
<image backcolor="0 0 0 128" size="100%-2 2 100%-1 100%-2"/>
|
||||
<image backcolor="0 0 0 128" size="0 100%-2 100% 100%-1"/>
|
||||
<image backcolor="0 0 0 128" size="1 2 2 100%-2"/>
|
||||
|
||||
<image backcolor="0 0 0 64" size="0 2 100% 3"/>
|
||||
<image backcolor="0 0 0 64" size="100%-3 3 100%-2 100%-3"/>
|
||||
<image backcolor="0 0 0 64" size="0 100%-3 100% 100%-2"/>
|
||||
<image backcolor="0 0 0 64" size="2 3 3 100%-3"/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="healthBackground">
|
||||
<image backcolor="red"/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="sdHealthForeground">
|
||||
<sprite name="healthForeground">
|
||||
<image backcolor="green"/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="sdStaminaBackground">
|
||||
<sprite name="resourceBackground">
|
||||
<image backcolor="darkgray"/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="resourceForeground">
|
||||
<image backcolor="255 165 0"/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="staminaBackground">
|
||||
<image backcolor="black"/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="sdStaminaForeground">
|
||||
<sprite name="staminaForeground">
|
||||
<image backcolor="blue"/>
|
||||
</sprite>
|
||||
|
||||
|
@ -22,13 +22,25 @@
|
||||
text_valign="center"
|
||||
/>
|
||||
|
||||
<style name="sessionPanelStyle"
|
||||
sprite="veryThinWheatWindowSand"
|
||||
buffer_zone="10"
|
||||
<style name="sessionPanel"
|
||||
sprite="mainPanel"
|
||||
buffer_zone="2"
|
||||
text_align="left"
|
||||
text_valign="top"
|
||||
/>
|
||||
|
||||
<style name="insetWheatWindow"
|
||||
sprite="insetWheatWindow"
|
||||
/>
|
||||
|
||||
<style name="resourcePanel"
|
||||
size="50%-150 0 50%+150 32"
|
||||
font="serif-bold-18"
|
||||
sprite="titleBar"
|
||||
text_align="center"
|
||||
text_valign="center"
|
||||
/>
|
||||
|
||||
<style name="statsText"
|
||||
font="serif-bold-12"
|
||||
ghost="true"
|
||||
@ -59,10 +71,6 @@
|
||||
sprite_disabled="snIconSheetCommandDisabled"
|
||||
ghost="true"
|
||||
/>
|
||||
|
||||
<style name="sdIconOutline"
|
||||
sprite="sdIconOutline"
|
||||
/>
|
||||
|
||||
<style name="iconButton"
|
||||
sprite="snIconPortrait"
|
||||
@ -87,10 +95,10 @@
|
||||
/>
|
||||
|
||||
<style name="groupIconsText"
|
||||
font="mono-stroke-10"
|
||||
textcolor="255 255 255"
|
||||
text_align="left"
|
||||
text_valign="bottom"
|
||||
font="serif-bold-stroke-14"
|
||||
textcolor="white"
|
||||
text_align="center"
|
||||
text_valign="center"
|
||||
/>
|
||||
|
||||
<style name="groupIconsCenteredText"
|
||||
|
@ -6,8 +6,8 @@ const CONSTRUCTION = "Construction";
|
||||
const COMMAND = "Command";
|
||||
|
||||
// Constants used by the Queue or Garrison panel
|
||||
const UNIT_PANEL_BASE = -47; // The offset above the main panel (will often be negative)
|
||||
const UNIT_PANEL_HEIGHT = 37; // The height needed for a row of buttons
|
||||
const UNIT_PANEL_BASE = -50; // The offset above the main panel (will often be negative)
|
||||
const UNIT_PANEL_HEIGHT = 43; // 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, "Training": 0, "Construction": 0, "Command": 0};
|
||||
@ -15,6 +15,71 @@ var g_unitPanelButtons = {"Selection": 0, "Queue": 0, "Training": 0, "Constructi
|
||||
// Unit panels are panels with row(s) of buttons
|
||||
var g_unitPanels = ["Selection", "Queue", "Training", "Construction", "Research", "Stance", "Formation", "Command"];
|
||||
|
||||
// Lay out a row of centered buttons (does not work inside a loop like the other function)
|
||||
function layoutButtonRowCentered(rowNumber, guiName, startIndex, endIndex, width)
|
||||
{
|
||||
var buttonSideLength = getGUIObjectByName("unit"+guiName+"Button[0]").size.bottom;
|
||||
var buttonSpacer = buttonSideLength+1;
|
||||
var colNumber = 0;
|
||||
|
||||
// Collect buttons
|
||||
var buttons = [];
|
||||
var icons = [];
|
||||
|
||||
for (var i = startIndex; i < endIndex; i++)
|
||||
{
|
||||
var button = getGUIObjectByName("unit"+guiName+"Button["+i+"]");
|
||||
var icon = getGUIObjectByName("unit"+guiName+"Icon["+i+"]");
|
||||
|
||||
if (button)
|
||||
{
|
||||
buttons.push(button);
|
||||
icons.push(icon);
|
||||
}
|
||||
}
|
||||
|
||||
// Location of middle button
|
||||
var middleIndex = Math.ceil(buttons.length/2);
|
||||
|
||||
// Determine whether even or odd number of buttons
|
||||
var center = (buttons.length/2 == Math.ceil(buttons.length/2))? Math.ceil(width/2) : Math.ceil(width/2+buttonSpacer/2);
|
||||
|
||||
// Left Side
|
||||
for (var i = middleIndex-1; i >= 0; i--)
|
||||
{
|
||||
if (buttons[i])
|
||||
{
|
||||
var icon = icons[i];
|
||||
var size = buttons[i].size;
|
||||
size.left = center - buttonSpacer*colNumber - buttonSideLength;
|
||||
size.right = center - buttonSpacer*colNumber;
|
||||
size.top = buttonSpacer*rowNumber;
|
||||
size.bottom = buttonSpacer*rowNumber + buttonSideLength;
|
||||
buttons[i].size = size;
|
||||
colNumber++;
|
||||
}
|
||||
}
|
||||
|
||||
// Right Side
|
||||
center += 1; // add spacing to center buttons
|
||||
colNumber = 0; // reset to 0
|
||||
|
||||
for (var i = middleIndex; i < buttons.length; i++)
|
||||
{
|
||||
if (buttons[i])
|
||||
{
|
||||
var icon = icons[i];
|
||||
var size = buttons[i].size;
|
||||
size.left = center + buttonSpacer*colNumber;
|
||||
size.right = center + buttonSpacer*colNumber + buttonSideLength;
|
||||
size.top = buttonSpacer*rowNumber;
|
||||
size.bottom = buttonSpacer*rowNumber + buttonSideLength;
|
||||
buttons[i].size = size;
|
||||
colNumber++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Lay out button rows
|
||||
function layoutButtonRow(rowNumber, guiName, buttonSideLength, buttonSpacer, startIndex, endIndex)
|
||||
{
|
||||
@ -23,15 +88,19 @@ function layoutButtonRow(rowNumber, guiName, buttonSideLength, buttonSpacer, sta
|
||||
for (var i = startIndex; i < endIndex; i++)
|
||||
{
|
||||
var button = getGUIObjectByName("unit"+guiName+"Button["+i+"]");
|
||||
var size = button.size;
|
||||
|
||||
size.left = buttonSpacer*colNumber;
|
||||
size.right = buttonSpacer*colNumber + buttonSideLength;
|
||||
size.top = buttonSpacer*rowNumber;
|
||||
size.bottom = buttonSpacer*rowNumber + buttonSideLength;
|
||||
|
||||
button.size = size;
|
||||
colNumber++;
|
||||
|
||||
if (button)
|
||||
{
|
||||
var size = button.size;
|
||||
|
||||
size.left = buttonSpacer*colNumber;
|
||||
size.right = buttonSpacer*colNumber + buttonSideLength;
|
||||
size.top = buttonSpacer*rowNumber;
|
||||
size.bottom = buttonSpacer*rowNumber + buttonSideLength;
|
||||
|
||||
button.size = size;
|
||||
colNumber++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,10 +109,14 @@ function setupUnitPanel(guiName, usedPanels, unitEntState, items, callback)
|
||||
{
|
||||
usedPanels[guiName] = 1;
|
||||
var selection = g_Selection.toList();
|
||||
|
||||
var numberOfItems = items.length;
|
||||
if ((numberOfItems > 24) && (guiName != "Selection"))
|
||||
numberOfItems = 24;
|
||||
|
||||
if (numberOfItems > 8 && guiName == "Command")
|
||||
numberOfItems = 8;
|
||||
else if (numberOfItems > 13 && guiName == "Selection")
|
||||
numberOfItems = 13;
|
||||
else if (numberOfItems > 18)
|
||||
numberOfItems = 18;
|
||||
|
||||
var i;
|
||||
for (i = 0; i < numberOfItems; i++)
|
||||
@ -61,27 +134,9 @@ function setupUnitPanel(guiName, usedPanels, unitEntState, items, callback)
|
||||
switch (guiName)
|
||||
{
|
||||
case SELECTION:
|
||||
var entState = GetEntityState(selection[i]);
|
||||
if (!entState)
|
||||
continue;
|
||||
|
||||
var rank = entState.identity.rank? "[font=\"serif-bold-16\"]" + entState.identity.rank + " [/font]" : "";
|
||||
var tooltip = rank + getEntityName(template);
|
||||
var unitHealth = getGUIObjectByName("unitSelectionHealth["+i+"]");
|
||||
|
||||
if (entState.hitpoints)
|
||||
{
|
||||
var unitHealthBar = getGUIObjectByName("unitSelectionHealthForeground["+i+"]");
|
||||
var healthSize = unitHealthBar.size;
|
||||
healthSize.rright = 100*Math.max(0, Math.min(1, entState.hitpoints / entState.maxHitpoints));
|
||||
unitHealthBar.size = healthSize;
|
||||
tooltip += " [font=\"serif-9\"](" + entState.hitpoints + "/" + entState.maxHitpoints + ")[/font]";
|
||||
unitHealth.hidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
unitHealth.hidden = true;
|
||||
}
|
||||
var tooltip = getEntityName(template);
|
||||
var count = g_Selection.groups.getCount(item);
|
||||
getGUIObjectByName("unit"+guiName+"Count["+i+"]").caption = (count > 1 ? count : "");
|
||||
break;
|
||||
|
||||
case QUEUE:
|
||||
@ -130,8 +185,7 @@ function setupUnitPanel(guiName, usedPanels, unitEntState, items, callback)
|
||||
button.tooltip = tooltip;
|
||||
|
||||
// Button Function
|
||||
var parameter = ((guiName == "Selection")? i : item);
|
||||
button.onpress = (function(e) { return function() { callback(e) } })(parameter); // (need nested functions to get the closure right)
|
||||
button.onpress = (function(e) { return function() { callback(e) } })(item); // (need nested functions to get the closure right)
|
||||
|
||||
// Get icon image
|
||||
if (guiName == "Command")
|
||||
@ -148,7 +202,7 @@ 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;
|
||||
var rowLength = ((guiName == "Command")? 15 : 8);
|
||||
var rowLength = 9;//guiName == "Command"? 1 : 9;
|
||||
var numRows = Math.ceil(numButtons / rowLength);
|
||||
var buttonSideLength = getGUIObjectByName("unit"+guiName+"Button[0]").size.bottom;
|
||||
var buttonSpacer = buttonSideLength+1;
|
||||
@ -163,8 +217,19 @@ function setupUnitPanel(guiName, usedPanels, unitEntState, items, callback)
|
||||
}
|
||||
|
||||
// Layout buttons
|
||||
for (var i = 0; i < numRows; i++)
|
||||
layoutButtonRow(i, guiName, buttonSideLength, buttonSpacer, rowLength*i, rowLength*(i+1) );
|
||||
if (guiName == "Selection")
|
||||
{
|
||||
layoutButtonRowCentered(0, guiName, 0, numButtons, 600);
|
||||
}
|
||||
else if (guiName == "Command")
|
||||
{
|
||||
layoutButtonRowCentered(0, guiName, 0, numButtons, 224);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var i = 0; i < numRows; i++)
|
||||
layoutButtonRow(i, guiName, buttonSideLength, buttonSpacer, rowLength*i, rowLength*(i+1) );
|
||||
}
|
||||
|
||||
// Hide any buttons we're no longer using
|
||||
for (i = numButtons; i < g_unitPanelButtons[guiName]; ++i)
|
||||
@ -205,28 +270,20 @@ function updateUnitCommands(entState, commandsPanel, selection)
|
||||
setupUnitPanel("Queue", usedPanels, entState, entState.training.queue,
|
||||
function (item) { removeFromTrainingQueue(entState.id, item.id); } );
|
||||
|
||||
/*
|
||||
// HACK: displays all command buttons
|
||||
var commands = [];
|
||||
for (var i = 0; i < 15; i++)
|
||||
commands.push("test"+i);
|
||||
commands[4] = "delete";
|
||||
*/
|
||||
var commands = getEntityCommandsList(entState);
|
||||
|
||||
if (commands.length)
|
||||
setupUnitPanel("Command", usedPanels, entState, commands,
|
||||
function (item) { performCommand(entState.id, item); } );
|
||||
|
||||
if (selection.length > 1)
|
||||
setupUnitPanel("Selection", usedPanels, entState, g_Selection.getTemplateNames(),
|
||||
setupUnitPanel("Selection", usedPanels, entState, g_Selection.groups.getTemplateNames(),
|
||||
function (entType) { changePrimarySelectionGroup(entType); } );
|
||||
|
||||
|
||||
commandsPanel.hidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
getGUIObjectByName("sdStamina").hidden = true;
|
||||
getGUIObjectByName("stamina").hidden = true;
|
||||
commandsPanel.hidden = true;
|
||||
}
|
||||
|
||||
|
@ -134,6 +134,10 @@ function getEntityCommandsList(entState)
|
||||
{
|
||||
var commands = [];
|
||||
commands.push("delete");
|
||||
//commands.push("command1");
|
||||
//commands.push("command2");
|
||||
//commands.push("command3");
|
||||
//commands.push("command4");
|
||||
return commands;
|
||||
}
|
||||
|
||||
@ -168,6 +172,30 @@ function getEntityNameWithGenericType(template)
|
||||
return "[font=\"serif-bold-16\"]" + name + "[/font]";
|
||||
}
|
||||
|
||||
function getEntityRankedName(entState)
|
||||
{
|
||||
var template = GetTemplateData(entState.template)
|
||||
var rank = entState.identity.rank;
|
||||
if (rank)
|
||||
return rank + " " + template.name.specific;
|
||||
else
|
||||
return template.name.specific;
|
||||
}
|
||||
|
||||
function getRankIconCellId(entState)
|
||||
{
|
||||
var template = GetTemplateData(entState.template)
|
||||
var rank = entState.identity.rank;
|
||||
if (rank)
|
||||
{
|
||||
if (rank == "Elite")
|
||||
return 0;
|
||||
else if (rank == "Advanced")
|
||||
return 1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
function getFormalCivName(civ)
|
||||
{
|
||||
switch (civ)
|
||||
|
@ -3,6 +3,7 @@
|
||||
<Identity>
|
||||
<GenericName>Cavalry</GenericName>
|
||||
<Classes datatype="tokens">Mounted Organic</Classes>
|
||||
<Rank>Basic</Rank>
|
||||
</Identity>
|
||||
<Promotion>
|
||||
<Req>900</Req>
|
||||
|
@ -3,6 +3,7 @@
|
||||
<Identity>
|
||||
<GenericName>Infantry</GenericName>
|
||||
<Classes datatype="tokens">Foot Organic</Classes>
|
||||
<Rank>Basic</Rank>
|
||||
</Identity>
|
||||
<Promotion>
|
||||
<Req>600</Req>
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Entity parent="units/hele_cavalry_swordsman_b">
|
||||
<Identity>
|
||||
<IconCell>19</IconCell>
|
||||
<Rank>Advanced</Rank>
|
||||
</Identity>
|
||||
<Promotion>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<Civ>hele</Civ>
|
||||
<SpecificName>Hyppikon</SpecificName>
|
||||
<IconSheet>snPortraitSheetHele</IconSheet>
|
||||
<IconCell>18</IconCell>
|
||||
<IconCell>20</IconCell>
|
||||
<History>Cavalry were made up of the upper class since they were the only ones who could afford the breeding and caring for horses. Initially they were missile troops who avoided close combat, throwing javelins and spears at enemy troops. Later on thanks to developments by the Macedonians they began to close with enemy troops to use their swords. As with all ancient horsemen the hyppikon did not have stirrups or a saddle.</History>
|
||||
</Identity>
|
||||
<Promotion>
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Entity parent="units/hele_cavalry_swordsman_a">
|
||||
<Identity>
|
||||
<IconCell>20</IconCell>
|
||||
<Rank>Elite</Rank>
|
||||
</Identity>
|
||||
<ResourceGatherer>
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Entity parent="units/hele_infantry_archer_b">
|
||||
<Identity>
|
||||
<IconCell>10</IconCell>
|
||||
<Rank>Advanced</Rank>
|
||||
</Identity>
|
||||
<Promotion>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<Civ>hele</Civ>
|
||||
<SpecificName>Toxotes Kretikos</SpecificName>
|
||||
<IconSheet>snPortraitSheetHele</IconSheet>
|
||||
<IconCell>9</IconCell>
|
||||
<IconCell>11</IconCell>
|
||||
<History>Archers were used in Hellenistic armies to support the phalanx by splitting up enemy formations. The best Greek archers were from Crete, but mercenaries from Scythia and Asia Minor were sometimes employed. Hellenistic archers wore their quivers on their backs and the more successful ones were able to procure armor.</History>
|
||||
</Identity>
|
||||
<Promotion>
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Entity parent="units/hele_infantry_archer_a">
|
||||
<Identity>
|
||||
<IconCell>11</IconCell>
|
||||
<Rank>Elite</Rank>
|
||||
</Identity>
|
||||
<ResourceGatherer>
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Entity parent="units/hele_infantry_javelinist_b">
|
||||
<Identity>
|
||||
<IconCell>7</IconCell>
|
||||
<Rank>Advanced</Rank>
|
||||
</Identity>
|
||||
<Promotion>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<Civ>hele</Civ>
|
||||
<SpecificName>Peltast Thrakikos</SpecificName>
|
||||
<IconSheet>snPortraitSheetHele</IconSheet>
|
||||
<IconCell>6</IconCell>
|
||||
<IconCell>8</IconCell>
|
||||
<History>Peltasts were javelinists originating in Thrace but their form of combat was widely copied by the Hellenes, Macedonians, and Persians. Equipped with a small oval or crescent shield, a peltast would charge at enemy formations whilst hurling his javelins then fall back to avoid close combat. They wore no armor and were at a significant disadvantage against heavy infantry and cavalry, relying on their speed and skill for survival. Thracians sold their services to Hellene cities as mercenaries and added a much needed ranged and skirmishing ability to Hellenic armies.</History>
|
||||
</Identity>
|
||||
<Promotion>
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Entity parent="units/hele_infantry_javelinist_a">
|
||||
<Identity>
|
||||
<IconCell>8</IconCell>
|
||||
<Rank>Elite</Rank>
|
||||
</Identity>
|
||||
<ResourceGatherer>
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Entity parent="units/hele_infantry_spearman_b">
|
||||
<Identity>
|
||||
<IconCell>4</IconCell>
|
||||
<Rank>Advanced</Rank>
|
||||
</Identity>
|
||||
<Promotion>
|
||||
|
@ -4,7 +4,7 @@
|
||||
<Civ>hele</Civ>
|
||||
<SpecificName>Hoplites</SpecificName>
|
||||
<IconSheet>snPortraitSheetHele</IconSheet>
|
||||
<IconCell>3</IconCell>
|
||||
<IconCell>5</IconCell>
|
||||
<History>Hoplites were the very symbol of Hellenistic prestige and citizenship, armed with a spear and a large round, bronze-coated shield known as an aspis. Armor was heavy, with bronze helmets and a cuirass of either bronze or linen, in addition to greaves. Hoplites fought in a tight formation called a phalanx, guarding each other with their shields while they attacked the enemy with their 2.5 meter spear or short iron sword.</History>
|
||||
</Identity>
|
||||
<Promotion>
|
||||
|
@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Entity parent="units/hele_infantry_spearman_a">
|
||||
<Identity>
|
||||
<IconCell>5</IconCell>
|
||||
<Rank>Elite</Rank>
|
||||
</Identity>
|
||||
<ResourceGatherer>
|
||||
|
Loading…
Reference in New Issue
Block a user