Delete old session GUI files.
This was SVN commit r7558.
This commit is contained in:
parent
cf85004f61
commit
6e6ae573e4
@ -1,418 +0,0 @@
|
||||
/*
|
||||
DESCRIPTION : Functions for "main game" session GUI.
|
||||
NOTES :
|
||||
*/
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function initSession()
|
||||
{
|
||||
// ============================================= CONSTANTS =================================================
|
||||
|
||||
snConst = new Object();
|
||||
|
||||
// Portraits (large and small).
|
||||
snConst.Portrait = new Object();
|
||||
snConst.Portrait.Sml = new Object();
|
||||
snConst.Portrait.Sml.Width = 45;
|
||||
snConst.Portrait.Sml.Height = snConst.Portrait.Sml.Width;
|
||||
snConst.Portrait.Lrg = new Object();
|
||||
snConst.Portrait.Lrg.Width = 64;
|
||||
snConst.Portrait.Lrg.Height = snConst.Portrait.Lrg.Width;
|
||||
|
||||
// Small icons (eg Movement Rate, Food).
|
||||
snConst.MiniIcon = new Object();
|
||||
snConst.MiniIcon.Width = 30;
|
||||
snConst.MiniIcon.Height = snConst.MiniIcon.Width;
|
||||
|
||||
// ============================================= GLOBALS =================================================
|
||||
|
||||
// Define cell reference constants for icon sheets.
|
||||
initCellReference();
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function initCellReference()
|
||||
{
|
||||
cellGroup = new Array();
|
||||
|
||||
// Define categories of cell groups by checking their reference files in the same locations as the icon sheets.
|
||||
addCellGroupCategory ("art/textures/ui/session/icons/sheets/");
|
||||
// (Note that we don't use this and we probably shouldn't, since the entities state which icon cell they should use; it makes it easier to remember which icon is used
|
||||
// for which unit if we have this reference sheet, though.)
|
||||
addCellGroupCategory ("art/textures/ui/session/portraits/sheets/");
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function addCellGroupCategory(iconSheetPath)
|
||||
{
|
||||
// Get array list of all icon sheet reference files.
|
||||
var iconSheets = buildDirEntList (iconSheetPath, "*.txt", true);
|
||||
// Alphabetically sort the array.
|
||||
iconSheets.sort();
|
||||
|
||||
// Seek through all icon sheets.
|
||||
for (var sheet = 0; sheet < iconSheets.length; sheet++)
|
||||
{
|
||||
// Get the current icon sheet name.
|
||||
var groupName = iconSheets[sheet];
|
||||
// Remove path and extension information so we just have the group name.
|
||||
groupName = groupName.replace (iconSheetPath, "");
|
||||
groupName = groupName.replace (".txt", "");
|
||||
groupName = toTitleCase(groupName);
|
||||
|
||||
// Get the elements from the current icon sheet.
|
||||
var iconArray = readFileLines (iconSheets[sheet]);
|
||||
|
||||
// For each row in the icon sheet file,
|
||||
for (var row = 0; row < iconArray.length; row++)
|
||||
{
|
||||
// Get the individual fields in the array as another array.
|
||||
var iconElements = iconArray[row].split (",");
|
||||
// Add this cell to the current group.
|
||||
addCell (groupName, iconElements[0], iconElements[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function addCell (group, cellID, cellName)
|
||||
{
|
||||
// Add a cell ID to a cell container group.
|
||||
|
||||
// If this array does not exist,
|
||||
if (!cellGroup[group])
|
||||
{
|
||||
// Create the container.
|
||||
cellGroup[group] = new Array();
|
||||
cellGroup[group].length = new Object(0);
|
||||
}
|
||||
|
||||
cellGroup[group][cellID] = new Array();
|
||||
cellGroup[group][cellID].id = new Object (cellGroup[group].length);
|
||||
cellGroup[group][cellID].name = new Object (cellName);
|
||||
|
||||
cellGroup[group].length++;
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function setPortrait(objectName, portraitString, portraitSuffix, portraitCell)
|
||||
{
|
||||
// Use this function as a shortcut to change a portrait object to a different portrait image.
|
||||
|
||||
// Accepts an object and specifies its default, rollover (lit) and disabled (gray) sprites.
|
||||
// Sprite Format: "sn""portraitString""portraitSuffix"
|
||||
// Sprite Format: "sn""portraitString""portraitSuffix""Over"
|
||||
// Sprite Format: "sn""portraitString""portraitSuffix""Disabled"
|
||||
// Note: Make sure the file follows this naming convention or bad things could happen.
|
||||
|
||||
// Get GUI object
|
||||
setPortraitGUIObject = getGUIObjectByName(objectName);
|
||||
|
||||
// Report error if object not found.
|
||||
if (!setPortraitGUIObject)
|
||||
{
|
||||
console.write ("setPortrait(): Failed to find object " + objectName + ".");
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Set the three portraits.
|
||||
if (portraitSuffix && portraitSuffix != "")
|
||||
setPortraitGUIObject.sprite = "sn" + portraitString + portraitSuffix;
|
||||
else
|
||||
setPortraitGUIObject.sprite = "sn" + portraitString;
|
||||
|
||||
setPortraitGUIObject.sprite_over = setPortraitGUIObject.sprite + "Over";
|
||||
setPortraitGUIObject.sprite_disabled = setPortraitGUIObject.sprite + "Disabled";
|
||||
|
||||
// If the source texture is a multi-frame image (icon sheet), specify correct cell.
|
||||
if (portraitCell && portraitCell != "")
|
||||
setPortraitGUIObject.cell_id = portraitCell;
|
||||
else
|
||||
setPortraitGUIObject.cell_id = "";
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function flipGUI (NewGUIType)
|
||||
{
|
||||
// Changes GUI to a different layout.
|
||||
|
||||
switch (NewGUIType)
|
||||
{
|
||||
// Set which GUI to use.
|
||||
case rb:
|
||||
case lb:
|
||||
case lt:
|
||||
case rt:
|
||||
GUIType = NewGUIType;
|
||||
break;
|
||||
default:
|
||||
// If no type specified, toggle.
|
||||
if (GUIType == rb)
|
||||
GUIType = lb;
|
||||
else
|
||||
if (GUIType == lb)
|
||||
GUIType = lt;
|
||||
else
|
||||
if (GUIType == lt)
|
||||
GUIType = rt;
|
||||
else
|
||||
GUIType = rb;
|
||||
break;
|
||||
}
|
||||
// Seek through all sizes created.
|
||||
for (var i = 0; i <= Crd.last; i++)
|
||||
{
|
||||
// Set their sizes to the stored value.
|
||||
getGUIObjectByName (Crd[i].name).size = Crd[i].size[GUIType];
|
||||
}
|
||||
|
||||
writeConsole("GUI flipped to size " + GUIType + ".");
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
// Update-on-alteration trickery...
|
||||
|
||||
// We don't really want to update every single time we get a
|
||||
// selection-changed or property-changed event; that could happen
|
||||
// a lot. Instead, use this bunch of globals to cache any changes
|
||||
// that happened between GUI updates.
|
||||
|
||||
// This boolean determines whether the selection has been changed.
|
||||
var selectionChanged = false;
|
||||
|
||||
// This boolean determines what the template of the selected object
|
||||
// was when last we looked
|
||||
var selectionTemplate = null;
|
||||
|
||||
// This array holds the name of all properties that need to be updated
|
||||
var selectionPropertiesChanged = new Array();
|
||||
|
||||
// This array holds a list of all the objects we hold property-change
|
||||
// watches on
|
||||
var propertyWatches = new Array();
|
||||
|
||||
// ====================================================================
|
||||
|
||||
// This function resets all the update variables, above
|
||||
|
||||
function resetUpdateVars()
|
||||
{
|
||||
if( selectionChanged )
|
||||
{
|
||||
for( watchedObject in propertyWatches )
|
||||
propertyWatches[watchedObject].unwatchAll( selectionWatchHandler ); // Remove the handler
|
||||
|
||||
propertyWatches = new Array();
|
||||
if( selection.length > 0 && selection[0] )
|
||||
{
|
||||
// Watch the object itself
|
||||
selection[0].watchAll( selectionWatchHandler );
|
||||
propertyWatches.push( selection[0] );
|
||||
// And every parent back up the tree (changes there will affect
|
||||
// displayed properties via inheritance)
|
||||
var parent = selection[0].template
|
||||
while( parent )
|
||||
{
|
||||
parent.watchAll( selectionWatchHandler );
|
||||
propertyWatches.push( selection[0] );
|
||||
parent = parent.parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
selectionChanged = false;
|
||||
if( selection.length > 0 && selection[0] )
|
||||
{
|
||||
selectionTemplate = selection[0].template;
|
||||
}
|
||||
else
|
||||
selectionTemplate = null;
|
||||
|
||||
selectionPropertiesChanged = new Array();
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
// This function returns whether we should update a particular statistic
|
||||
// in the GUI (e.g. "actions.attack") - this should happen if: the selection
|
||||
// changed, the selection had its template altered (changing lots of stuff)
|
||||
// or an assignment has been made to that stat or any property within that
|
||||
// stat.
|
||||
|
||||
function shouldUpdateStat( statname )
|
||||
{
|
||||
if( selectionChanged || ( selectionTemplate != selection[0].template ) )
|
||||
{
|
||||
return( true );
|
||||
}
|
||||
for( var property in selectionPropertiesChanged )
|
||||
{
|
||||
// If property starts with statname
|
||||
if( selectionPropertiesChanged[property].substring( 0, statname.length ) == statname )
|
||||
{
|
||||
return( true );
|
||||
}
|
||||
}
|
||||
return( false );
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
// This function is a handler for the 'selectionChanged' event,
|
||||
// it updates the selectionChanged flag
|
||||
|
||||
function selectionChangedHandler()
|
||||
{
|
||||
selectionChanged = true;
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
// Register it.
|
||||
addGlobalHandler( "selectionChanged", selectionChangedHandler );
|
||||
|
||||
// ====================================================================
|
||||
|
||||
// This function is a handler for a watch event; it updates the
|
||||
// selectionPropertiesChanged array.
|
||||
|
||||
function selectionWatchHandler( propname, oldvalue, newvalue )
|
||||
{
|
||||
selectionPropertiesChanged.push( propname );
|
||||
// This bit's important (watches allow the handler to change the value
|
||||
// before it gets written; we don't want to affect things, so make sure
|
||||
// the value we send back is the one that was going to be written)
|
||||
return( newvalue );
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function snRefresh()
|
||||
{
|
||||
// Updated each tick to refresh session controls if necessary.
|
||||
|
||||
// Don't process GUI when we're full-screen.
|
||||
if (getGUIObjectByName ("sn").hidden == false)
|
||||
{
|
||||
if (!selection.length) // If no entity selected,
|
||||
{
|
||||
// Hide Status Orb
|
||||
guiHide ("snStatusPane");
|
||||
|
||||
// Hide Group Pane.
|
||||
// guiHide ("snGroupPane");
|
||||
|
||||
getGlobal().MultipleEntitiesSelected = 0;
|
||||
}
|
||||
else // If at least one entity selected,
|
||||
{
|
||||
// Reveal Status Orb
|
||||
guiUnHide ("snStatusPane");
|
||||
|
||||
// (later, we need to base this on the selected unit's stats changing)
|
||||
refreshStatusPane();
|
||||
|
||||
// Check if a group of entities selected
|
||||
if (selection.length > 1)
|
||||
{
|
||||
// If a group pane isn't already open, and we don't have the same set as last time,
|
||||
if (selection.length != getGlobal().MultipleEntitiesSelected)
|
||||
{
|
||||
// (later, we need to base this on the selection changing)
|
||||
// refreshGroupPane();
|
||||
getGlobal().MultipleEntitiesSelected = selection.length;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
getGlobal().MultipleEntitiesSelected = 0;
|
||||
|
||||
// Hide Group Pane.
|
||||
// guiHide ("snGroupPane");
|
||||
}
|
||||
}
|
||||
|
||||
// Modify any resources given/taken
|
||||
// (later, we need to base this on a resource-changing event).
|
||||
// refreshResourcePool();
|
||||
|
||||
// Update Team Tray
|
||||
// (later, we need to base this on the player creating a group).
|
||||
// refreshTeamTray();
|
||||
|
||||
// Refresh handler that monitors whether property/selection has been updated.
|
||||
resetUpdateVars();
|
||||
|
||||
// Refresh resources
|
||||
refreshResources();
|
||||
}
|
||||
|
||||
if ( selectionChanged && getGUIObjectByName( "mn" ).hidden == false)
|
||||
{
|
||||
// Update manual if it's open.
|
||||
refreshManual();
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
|
||||
function confirmLeave()
|
||||
{
|
||||
if (isGameRunning())
|
||||
{
|
||||
endSession("return");
|
||||
}
|
||||
else
|
||||
{
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
playersList_init = false;
|
||||
|
||||
function togglePlayersList()
|
||||
{
|
||||
//Initialization of names and colors.
|
||||
if (!playersList_init)
|
||||
{
|
||||
playersList_init = true;
|
||||
var trueLength = 0;
|
||||
|
||||
for (var i=1; i<=players.length-1; i++)
|
||||
{
|
||||
if (players[i].active)
|
||||
trueLength++;
|
||||
}
|
||||
|
||||
for (var i=1; i<=trueLength; i++)
|
||||
{
|
||||
if (players[i].active)
|
||||
{
|
||||
getGUIObjectByName("Player_" + (i+8-trueLength)).caption = players[i].name;
|
||||
getGUIObjectByName("PlayerShadow_" + (i+8-trueLength)).caption = players[i].name;
|
||||
|
||||
var col_r = parseInt(players[i].getColour().r * 255);
|
||||
var col_g = parseInt(players[i].getColour().g * 255);
|
||||
var col_b = parseInt(players[i].getColour().b * 255);
|
||||
|
||||
getGUIObjectByName("Player_" + (i+8-trueLength)).textcolor = col_r + " " + col_g + " " + col_b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var pl = getGUIObjectByName("PlayersList");
|
||||
pl.hidden = ! pl.hidden;
|
||||
var pls = getGUIObjectByName("PlayersListShadow");
|
||||
pls.hidden = ! pls.hidden;
|
||||
}
|
@ -1,88 +0,0 @@
|
||||
/*
|
||||
DESCRIPTION : Functions for the "online manual" part of the Session GUI.
|
||||
NOTES :
|
||||
*/
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function addItemsRecursively (container, indent, fontName)
|
||||
{
|
||||
// List the tree of items in a container and store it in the string *recursiveString* by recursively calling the function. (Thanks, Philip.)
|
||||
|
||||
// Reset recursive string if this is the first call.
|
||||
if (indent == "")
|
||||
recursiveString = "";
|
||||
|
||||
for (var item in container)
|
||||
{
|
||||
// Skip null strings and function references.
|
||||
if (item != null && container[item] != null
|
||||
&& container[item].toString().substring (0, 1) != "\n" && item != "template")
|
||||
{
|
||||
// Root-level items are in bold.
|
||||
recursiveString += "[font=" + fontName;
|
||||
if (indent == "")
|
||||
recursiveString += "b]";
|
||||
else
|
||||
recursiveString += "]";
|
||||
|
||||
// Display the property name, and the value, if any.
|
||||
if (container[item] == true && container[item].toString() != true)
|
||||
recursiveString += indent + " " + item + "\n";
|
||||
else
|
||||
recursiveString += indent + " " + item + ": " + container[item] + "\n";
|
||||
|
||||
// Retrieve sub-items.
|
||||
if (typeof container[item] == 'object')
|
||||
addItemsRecursively (container[item], indent + "--", fontName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function refreshManual()
|
||||
{
|
||||
if (selection.length != 0)
|
||||
{
|
||||
// Display portrait.
|
||||
if (selection[0].traits.id.icon)
|
||||
{
|
||||
setPortrait ("mnPortrait", selection[0].traits.id.icon,
|
||||
"Button" + toTitleCase(selection[0].traits.id.civ_code), selection[0].traits.id.icon_cell);
|
||||
}
|
||||
|
||||
// Display rollover text.
|
||||
if (selection[0].traits.id.rollover)
|
||||
{
|
||||
var manualRollover = getGUIObjectByName("mnRollover");
|
||||
manualRollover.caption = selection[0].traits.id.rollover;
|
||||
}
|
||||
|
||||
// Display history text.
|
||||
if (selection[0].traits.id.rollover)
|
||||
{
|
||||
var manualHistory = getGUIObjectByName("mnHistory");
|
||||
manualHistory.caption = selection[0].traits.id.history;
|
||||
}
|
||||
|
||||
// Build manual text.
|
||||
var manualText = "";
|
||||
addItemsRecursively ( selection[0], "", "trebuchet14" );
|
||||
manualText += recursiveString;
|
||||
|
||||
// Close the manual string.
|
||||
manualText += "[/font]";
|
||||
|
||||
// Assign manual text to control.
|
||||
getGUIObjectByName("mnText").caption = manualText;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the player has removed the selection while the manual is open, close the manual.
|
||||
guiHide("mn");
|
||||
guiUnHide("sn");
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
@ -1,841 +0,0 @@
|
||||
/*
|
||||
DESCRIPTION : Functions for the Command Buttons orbitting the Status Pane.
|
||||
NOTES :
|
||||
*/
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function defineCommandButtons(command)
|
||||
{
|
||||
snStatusPaneCommand = new Array();
|
||||
snStatusPaneCommand.tab = new Object();
|
||||
snStatusPaneCommand.list = new Object();
|
||||
snStatusPaneCommand.button = new Object();
|
||||
|
||||
empty = false;
|
||||
|
||||
// Maximum number of buttons (either single or lists).
|
||||
snStatusPaneCommand.tab.max = command.substring (command.lastIndexOf ("d")+1, command.lastIndexOf ("_")); // 8
|
||||
// Maximum number of entries in a list.
|
||||
snStatusPaneCommand.list.max = command.substring (command.lastIndexOf ("_")+1, command.length); // 12
|
||||
|
||||
// When we reach this button, split the rows (remainder are vertical, not horizontal).
|
||||
snStatusPaneCommand.split = 5;
|
||||
// Spacing between lists.
|
||||
snStatusPaneCommand.span = 1;
|
||||
|
||||
// Get the coordinates of the Status Pane background (referenced to determine command button locations).
|
||||
var currCrd = getCrd ("snStatusPaneBkg");
|
||||
|
||||
// Update each tab.
|
||||
for (var tabLoop = 1; tabLoop <= snStatusPaneCommand.tab.max; tabLoop++)
|
||||
{
|
||||
var tempGroupObject = getGUIObjectByName("snStatusPaneCommand" +
|
||||
"Group" + tabLoop);
|
||||
|
||||
// Update each list under each tab.
|
||||
for (var listLoop = 1; listLoop <= snStatusPaneCommand.list.max; listLoop++)
|
||||
{
|
||||
var tempListObject = getGUIObjectByName("snStatusPaneCommand" +
|
||||
tabLoop + "_" + listLoop);
|
||||
|
||||
// Set default portrait.
|
||||
setPortrait (tempListObject.name, "IconPortrait");
|
||||
|
||||
// Width and height of buttons is always the same.
|
||||
var buttonWidth = snConst.Portrait.Sml.Width;
|
||||
var buttonHeight = snConst.Portrait.Sml.Height;
|
||||
|
||||
// If we're doing the arc of commands.
|
||||
if (tabLoop >= snStatusPaneCommand.split)
|
||||
{
|
||||
if (listLoop == 1)
|
||||
{
|
||||
if (tabLoop > snStatusPaneCommand.split)
|
||||
{
|
||||
// Get the first tab.
|
||||
var firstTab = getCrd ("snStatusPaneCommand" + (snStatusPaneCommand.split) + "_" + listLoop);
|
||||
// Get the previous tab.
|
||||
var lastTab = getCrd ("snStatusPaneCommand" + (tabLoop-1) + "_" + listLoop);
|
||||
}
|
||||
|
||||
// Set position of tab (it curves, so we need to specifically set each button position).
|
||||
switch (tabLoop)
|
||||
{
|
||||
case (snStatusPaneCommand.split):
|
||||
var buttonX = currCrd.coord[rb].x + currCrd.coord[rb].width - buttonWidth + 2;
|
||||
var buttonY = currCrd.coord[rb].y + currCrd.coord[rb].height - buttonHeight - 3.3;
|
||||
break;
|
||||
case (snStatusPaneCommand.split+1):
|
||||
var buttonX = lastTab.coord[rb].x + (lastTab.coord[rb].width/1.7);
|
||||
var buttonY = lastTab.coord[rb].y - (lastTab.coord[rb].height/1.3);
|
||||
break;
|
||||
case (snStatusPaneCommand.split+2):
|
||||
var buttonX = firstTab.coord[rb].x - (buttonWidth / 1.5);
|
||||
var buttonY = firstTab.coord[rb].y + (buttonHeight / 1.5);
|
||||
break;
|
||||
default:
|
||||
var buttonX = getCrd ("snStatusPaneCommand" + (snStatusPaneCommand.split+1) + "_" + listLoop).coord[rb].x;
|
||||
var buttonY = currCrd.coord[rb].y + 3;
|
||||
break;
|
||||
}
|
||||
|
||||
// Set default portrait.
|
||||
setPortrait (tempListObject.name, "IconCommand");
|
||||
}
|
||||
else
|
||||
{
|
||||
var parentTab = getCrd ("snStatusPaneCommand" + (tabLoop) + "_" + (listLoop - 1));
|
||||
// Set position of buttons under tab (parallel row to the right of it).
|
||||
var buttonX = parentTab.coord[rb].x+parentTab.coord[rb].width
|
||||
+snStatusPaneCommand.span;
|
||||
var buttonY = parentTab.coord[rb].y;
|
||||
}
|
||||
var barX = buttonX;
|
||||
var barY = 0;
|
||||
}
|
||||
else // If we're doing the row of tabs,
|
||||
{
|
||||
// Set position of tab.
|
||||
if (listLoop == 1)
|
||||
{
|
||||
if (tabLoop == 1 && listLoop == 1)
|
||||
var buttonX = currCrd.coord[rb].x;
|
||||
else
|
||||
var buttonX = Crd[Crd.last].coord[rb].x+Crd[Crd.last].coord[rb].width
|
||||
+snStatusPaneCommand.span;
|
||||
|
||||
var buttonY = currCrd.coord[rb].y+currCrd.coord[rb].height-7;
|
||||
}
|
||||
else // Set position of buttons under tab.
|
||||
{
|
||||
var buttonX = Crd[Crd.last].coord[rb].x;
|
||||
var buttonY = Crd[Crd.last].coord[rb].y+Crd[Crd.last].coord[rb].height
|
||||
+snStatusPaneCommand.span;
|
||||
}
|
||||
}
|
||||
|
||||
// Define dimensions of list buttons.
|
||||
addCrds ("snStatusPaneCommand" + tabLoop + "_" + listLoop, 0, 100, buttonX, buttonY,
|
||||
buttonWidth, buttonHeight);
|
||||
|
||||
// If we're defining the last button in the list, and it's not a tab,
|
||||
if (tabLoop == snStatusPaneCommand.tab.max && listLoop != 1)
|
||||
{
|
||||
// It has health bars (for the current selection). Set them up too.
|
||||
addCrds ("snStatusPaneCommand" + tabLoop + "_" + listLoop + "Bar", 0, 100, barX, barY,
|
||||
buttonWidth, 4);
|
||||
getGUIObjectByName ("snStatusPaneCommand" + tabLoop + "_" + listLoop + "Bar").hidden = false;
|
||||
getGUIObjectByName ("snStatusPaneCommand" + tabLoop + "_" + listLoop + "Bar").caption = 100;
|
||||
}
|
||||
/*
|
||||
// Store indexes to the button for easy future reference.
|
||||
Crd[getCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, true)].tab = tabLoop;
|
||||
Crd[getCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, true)].list = listLoop;
|
||||
// Create quantity and entity for create lists for future use.
|
||||
Crd[getCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, true)].entity = "";
|
||||
Crd[getCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, true)].quantity = 0;
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function updateTab (tab, type, cellSheet, attribute, attribute2, arrayCells)
|
||||
{
|
||||
// Refresh the next tab (and any buttons in its list, if appropriate), according to tabCounter.
|
||||
// tab: The name of the tab (eg research).
|
||||
// type: The type of button:
|
||||
// * production (Tab button, persistent list of buttons, click them to do things.)
|
||||
// * pick (Tab button holds current selection, click a button from the list to select a new option and close the tab.)
|
||||
// * command (Click "tab" button to do something; no list.)
|
||||
// cellSheet: * The cell sheet (icon group) containing this item's tab icon.
|
||||
// * production: Tends to be "Tab" (since they need a special tab icon), so defaults to this.
|
||||
// * pick: Usually a group that's the same as the tab name, so use this.
|
||||
// * command: Tends to be "Command" (though not always), so defaults to this.
|
||||
// * If no value is specified, it will use the above default for the type.
|
||||
// attribute: * For production & pick: the attribute containing the list of items to display
|
||||
// (eg selection[0].actions.create.list.research), which this entity must
|
||||
// have in order to update the tab with this list.
|
||||
// * For command: the attribute that the entity must have in order to have this command.
|
||||
// * If no value is specified, all entities have this attribute.
|
||||
// attribute2: * For pick: The variable used to store the current item in the pick that has been selected -- placed in the tab
|
||||
// (eg selection[0].actions.formation.curr)
|
||||
// arrayCells: * Optional attribute. If true, assume that items cannot all be found in the same cellSheet; check in attribute.sheet
|
||||
// for cell sheet name for each item.
|
||||
|
||||
// Store string form of attribute for future reference.
|
||||
attributeString = attribute;
|
||||
attribute2String = attribute2;
|
||||
|
||||
// If either attribute is not a valid property, return false.
|
||||
if (! ((validProperty (attributeString)) && (validProperty (attribute2String))) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Use the value of the attribute from this point forwards.
|
||||
attribute = eval (attribute);
|
||||
attribute2 = eval (attribute2);
|
||||
// String properties taken from entities can be a little confused about their variable type, so make sure they're considered strings.
|
||||
attribute2 = String (attribute2);
|
||||
|
||||
|
||||
// Set default values.
|
||||
if (cellSheet == "")
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case "command":
|
||||
cellSheet = "Command";
|
||||
break;
|
||||
case "pick":
|
||||
cellSheet = toTitleCase(tab);
|
||||
tab = attribute2.toLowerCase();
|
||||
// avoid, pick, Stance, .traits.ai.stance.list
|
||||
break;
|
||||
default:
|
||||
cellSheet = "Tab";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get tab.
|
||||
var tabObject = getGUIObjectByName ("snStatusPaneCommand" + tabCounter + "_1");
|
||||
guiUnHide (tabObject.name);
|
||||
|
||||
|
||||
setTabPortrait(type, tab, cellSheet, cellGroup, tabCounter);
|
||||
|
||||
setTooltip(type, tab, cellSheet, cellGroup, tabObject);
|
||||
|
||||
setEvents(type, tab, tabObject);
|
||||
|
||||
// Get group.
|
||||
var groupObject = getGUIObjectByName ("snStatusPaneCommand" + "Group" + tabCounter);
|
||||
|
||||
// If the list hasn't been hidden (tab is open), and it should have list items (it's not merely a command),
|
||||
if ( type != "command" && attribute != undefined )
|
||||
{
|
||||
if (tab == "queue")
|
||||
{
|
||||
var newAttribute = groupProductionItems(attribute);
|
||||
//ok, now split newAttribute into 2 arrays: 1 containing items, and another one containing nums.
|
||||
|
||||
var nums = new Array();
|
||||
attribute = new Array();
|
||||
|
||||
for (i=0; i<newAttribute.length; i++)
|
||||
{
|
||||
attribute.push(newAttribute[i].item);
|
||||
nums.push(newAttribute[i].num);
|
||||
}
|
||||
}
|
||||
|
||||
listArray = extractItemList(attribute, arrayCells);
|
||||
|
||||
// Populate the buttons in this tab's list.
|
||||
for (var createLoop = 1; createLoop < snStatusPaneCommand.list.max; createLoop++)
|
||||
{
|
||||
// (Skip research list for the moment, since we don't have any portraits for techs.
|
||||
// But we should remove the research condition later.)
|
||||
if (createLoop < listArray.length && type != "command")
|
||||
{
|
||||
// Get name of current button.
|
||||
var listObject = getGUIObjectByName ("snStatusPaneCommand" + tabCounter + "_" + (createLoop+1));
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case "pick":
|
||||
// Set tooltip.
|
||||
if (arrayCells == true)
|
||||
{
|
||||
// Check a .sheet property for each item in the list to know its cellsheet.
|
||||
listObject.tooltip = cellGroup[listArray[createLoop].sheet][listArray[createLoop]].name;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Assume each item uses the same cell sheet as the tab.
|
||||
if(cellGroup[cellSheet][listArray[createLoop]]) {
|
||||
listObject.tooltip = cellGroup[cellSheet][listArray[createLoop]].name;
|
||||
}
|
||||
else {
|
||||
listObject.tooltip = "(no name)";
|
||||
}
|
||||
}
|
||||
|
||||
// Set portrait.
|
||||
if(cellGroup[cellSheet][listArray[createLoop]]) {
|
||||
setPortrait (listObject.name, "IconSheet",
|
||||
cellSheet + "Button", cellGroup[cellSheet][listArray[createLoop]].id);
|
||||
}
|
||||
|
||||
// Store properties which we will need when doing the press event as a comma-delimited string.
|
||||
// * 0 Name of variable that contains the ".curr" value.
|
||||
// * 1 String name of current button's content.
|
||||
// * 2 Array list of tab items.
|
||||
// * 3 Name of tab (eg stance).
|
||||
// * 4 Tab number.
|
||||
// (Storing the properties in the hotkey is an evil hack, and we'll eventually need the hotkey, but since new properties cannot be
|
||||
// attached to controls, there doesn't seem to be much choice ... Maybe add a .container property for situations such as this?)
|
||||
listObject.hotkey = attribute2String + "," + listArray[createLoop] + "," + attributeString + "," + cellSheet.toLowerCase() + "," + tabCounter + ",";
|
||||
|
||||
// Set item function.
|
||||
|
||||
listObject.onPress = function (event)
|
||||
{
|
||||
// Extract the properties from the comma-delimited string.
|
||||
var tempArray = parseDelimiterString (this.hotkey, ",");
|
||||
|
||||
// Refresh tab so it displays the new .curr sprite.
|
||||
tabCounter = tempArray[4];
|
||||
updateTab (tempArray[3], "pick", "", tempArray[2], '"' + tempArray[1] + '"');
|
||||
|
||||
// Do case-specific stuff depending on name of tab.
|
||||
switch (tempArray[3])
|
||||
{
|
||||
case "stance":
|
||||
issueCommand(selection, true, NMT_SET_STANCE, tempArray[1]);
|
||||
break;
|
||||
case "formation":
|
||||
// Remove the selected units from any existing formation.
|
||||
removeFromFormation (selection);
|
||||
// Set the selected entities to the chosen formation name.
|
||||
createEntityFormation (selection, tempArray[0]);
|
||||
// If the player is choosing to "disband" the formation (disable "batallion mode"),
|
||||
if ( tempArray[0] == "Loose" && isFormationLocked (selection) )
|
||||
{
|
||||
// Unlock the formation so each entity can be individually selected.
|
||||
lockEntityFormation (false);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Lock the formation so the selection can be controlled as one unit.
|
||||
lockEntityFormation (true);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
var itemName = "?";
|
||||
|
||||
if (tab == "selection" || tab == "garrison" || tab == "research" || tab == "queue")
|
||||
{
|
||||
// Get name of item to display in list.
|
||||
// (These already know the full name of the entity tag, so we don't prefix it.)
|
||||
itemName = listArray[createLoop];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get name of item to display in list.
|
||||
itemName = selection[0].traits.id.civ_code + "_" + listArray[createLoop];
|
||||
}
|
||||
|
||||
setItemTooltip(tab, itemName, listObject, selection);
|
||||
setItemFunction(tab, listObject, selection);
|
||||
break;
|
||||
}
|
||||
|
||||
//Only for queue tab: write the number of queued similar items.
|
||||
if (tab == "queue")
|
||||
{
|
||||
listObject.caption = "[font=trebuchet14b] " + parseInt(attribute[createLoop-1].progress * 100) + "%[/font]";
|
||||
listObject.caption += "\n[font=trebuchet14b] (" + nums[createLoop-1] + ")[/font]";
|
||||
}
|
||||
else
|
||||
{
|
||||
listObject.caption = "";
|
||||
}
|
||||
|
||||
// Reveal portrait.
|
||||
guiUnHide (listObject.name);
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// Conceal this button.
|
||||
guiHide ("snStatusPaneCommand" + tabCounter + "_" + parseInt(createLoop+1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Default the list to closed and queue to opened
|
||||
|
||||
if (tab == "queue") {
|
||||
groupObject.hidden = false;
|
||||
}
|
||||
else {
|
||||
groupObject.hidden = true;
|
||||
}
|
||||
|
||||
tabCounter++;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function tryConstruction( name )
|
||||
{
|
||||
// Start the building placement cursor for the given template, if we have enough resources
|
||||
|
||||
var result = checkEntityReqs( localPlayer, getEntityTemplate( name ) );
|
||||
|
||||
if (result == true) // If the entry meets requirements to be built (i.e. resources)
|
||||
{
|
||||
// Show the building placement cursor
|
||||
startPlacing( name );
|
||||
}
|
||||
else
|
||||
{
|
||||
// If not, output the error message.
|
||||
showMessage(result);
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function refreshCommandButtons()
|
||||
{
|
||||
// Reset button counter.
|
||||
tabCounter = 1;
|
||||
|
||||
if ( selectionChanged )
|
||||
{
|
||||
// Update production lists (both types of Construction, Train). (Tab button, persistent buttons, click them to do things.)
|
||||
if (validProperty ("selection[0].actions.create.list"))
|
||||
{
|
||||
listRoot = selection[0].actions.create.list;
|
||||
for (listTab in listRoot)
|
||||
{
|
||||
if (listTab != "research") // Do research later.
|
||||
updateTab (listTab, "production", "Tab", "listRoot[listTab]", "");
|
||||
}
|
||||
}
|
||||
|
||||
// Update Barter. (Tab button, persistent buttons, click them to do things.)
|
||||
updateTab ("barter", "production", "Tab", "selection[0].actions.barter.list");
|
||||
|
||||
// Update pick lists (formation, stance, trade). (Tab button holds current selection, click a button to select a new option and close the tab.)
|
||||
updateTab ("stance", "pick", "", "selection[0].traits.ai.stance.list", "selection[0].traits.ai.stance.curr");
|
||||
|
||||
|
||||
// Update research. (Tab button, persistent buttons, click them to do things.)
|
||||
//updateTab ("research", "production", "", "selection[0].actions.create.list.research", "");
|
||||
|
||||
// End of production and pick lists. Store end position.
|
||||
var listCounter = tabCounter;
|
||||
|
||||
// Commands begin from this point.
|
||||
tabCounter = snStatusPaneCommand.split;
|
||||
// Update commands. (Click "tab" button to do something; no list.)
|
||||
//updateTab ("patrol", "command", "", "selection[0].actions.patrol", "");
|
||||
//updateTab ("townbell", "command", "", "selection[0].actions.townBell", "");
|
||||
updateTab ("rally", "command", "", "selection[0].actions.create.rally", "");
|
||||
//updateTab ("explore", "command", "", "selection[0].actions.explore", "");
|
||||
updateTab ("retreat", "command", "", "selection[0].actions.retreat", "");
|
||||
updateTab ("stop", "command", "", "selection[0].actions.stop", "");
|
||||
|
||||
// End of commands. Store end position.
|
||||
var commandCounter = tabCounter;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Ensure tabs should be cleanable.
|
||||
listCounter = 1;
|
||||
commandCounter = snStatusPaneCommand.split-1;
|
||||
}
|
||||
|
||||
if ( selectionChanged )
|
||||
{
|
||||
// Clear remaining buttons between the lists and commands.
|
||||
for (var commandClearLoop = listCounter; commandClearLoop <= snStatusPaneCommand.split-1; commandClearLoop++)
|
||||
{
|
||||
guiHide ("snStatusPaneCommand" + commandClearLoop + "_1");
|
||||
// If this slot could possibly contain a list, hide that too.
|
||||
guiHide ("snStatusPaneCommand" + "Group" + commandClearLoop);
|
||||
}
|
||||
for (var commandClearLoop = commandCounter; commandClearLoop <= snStatusPaneCommand.tab.max; commandClearLoop++)
|
||||
{
|
||||
guiHide ("snStatusPaneCommand" + commandClearLoop + "_1");
|
||||
// If this slot could possibly contain a list, hide that too.
|
||||
guiHide ("snStatusPaneCommand" + "Group" + commandClearLoop);
|
||||
}
|
||||
}
|
||||
|
||||
if ( selectionChanged )
|
||||
{
|
||||
// Do the selection/garrison list.
|
||||
tabCounter = snStatusPaneCommand.tab.max;
|
||||
|
||||
// If there are entities garrisoned in the current entity,
|
||||
if (selection[0].traits.garrison && selection[0].traits.garrison.curr > 0)
|
||||
{
|
||||
updateTab ("garrison", "production", "Tab", "selection", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
// If more than one entity is selected, list them.
|
||||
if (selection.length > 1)
|
||||
{
|
||||
tempArray = new Array();
|
||||
for ( var i = 0; i < selection.length; i++ )
|
||||
tempArray.push(selection[i].tag);
|
||||
updateTab ("selection", "production", "Tab", "tempArray", "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (selection.length == 1)
|
||||
{
|
||||
if (selection[0].productionQueue && selection[0].productionQueue.length > 0)
|
||||
{
|
||||
tabCounter = snStatusPaneCommand.tab.max;
|
||||
tempArray = new Array();
|
||||
var queue = selection[0].productionQueue;
|
||||
|
||||
for(var i=0; i < queue.length; i++)
|
||||
{
|
||||
tempArray.push(queue.get(i));
|
||||
}
|
||||
|
||||
updateTab("queue", "production", "Tab", "tempArray", "");
|
||||
}
|
||||
else
|
||||
{
|
||||
//hide the production queue if it is empty.
|
||||
tabCounter = snStatusPaneCommand.tab.max;
|
||||
var tabObject = getGUIObjectByName ("snStatusPaneCommand" + tabCounter + "_1");
|
||||
guiHide(tabObject.name);
|
||||
var groupObject = getGUIObjectByName ("snStatusPaneCommand" + "Group" + tabCounter);
|
||||
guiHide(groupObject.name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// ====================================================================
|
||||
|
||||
|
||||
function getProductionTooltip(template)
|
||||
{
|
||||
var tooltip = "[font=trebuchet14b]" + template.traits.id.specific + " (" + template.traits.id.generic + ")[/font]";
|
||||
|
||||
//Show required resources list
|
||||
if (template.traits.creation)
|
||||
{
|
||||
var first = true;
|
||||
if (template.traits.creation.resource.food > 0)
|
||||
{
|
||||
tooltip += (first ? "\n" : ", ");
|
||||
first = false;
|
||||
tooltip += "[font=tahoma10b]Food:[/font] " + template.traits.creation.resource.food
|
||||
}
|
||||
if (template.traits.creation.resource.wood > 0)
|
||||
{
|
||||
tooltip += (first ? "\n" : ", ");
|
||||
first = false;
|
||||
tooltip += "[font=tahoma10b]Wood:[/font] " + template.traits.creation.resource.wood;
|
||||
}
|
||||
if (template.traits.creation.resource.metal > 0)
|
||||
{
|
||||
tooltip += (first ? "\n" : ", ");
|
||||
first = false;
|
||||
tooltip += "[font=tahoma10b]Metal:[/font] " + template.traits.creation.resource.metal
|
||||
}
|
||||
if (template.traits.creation.resource.stone > 0)
|
||||
{
|
||||
tooltip += (first ? "\n" : ", ");
|
||||
first = false;
|
||||
tooltip += "[font=tahoma10b]Stone:[/font] " + template.traits.creation.resource.stone
|
||||
}
|
||||
}
|
||||
|
||||
if (template.traits.id.tooltip)
|
||||
{
|
||||
tooltip += "\n[font=tahoma10]" + template.traits.id.tooltip + "[/font]";
|
||||
}
|
||||
|
||||
return tooltip;
|
||||
}
|
||||
|
||||
|
||||
// ===================================================================================
|
||||
//entity is the name.
|
||||
function removeFromProductionQueue(selection, entity)
|
||||
{
|
||||
var queue = selection[0].productionQueue;
|
||||
|
||||
for(var i=0;i<queue.length;i++)
|
||||
{
|
||||
if (entity == queue.get(i).name) {
|
||||
queue.cancel(i);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// =====================================================================================
|
||||
|
||||
function groupProductionItems(l_attr)
|
||||
{
|
||||
var newAttribute = new Array();
|
||||
for (var i=0; i<l_attr.length && newAttribute.length < 8; i++) //allow max 8 items
|
||||
{
|
||||
var result = new Object();
|
||||
|
||||
result.num = 1;
|
||||
result.item = l_attr[i];
|
||||
|
||||
while (i < (l_attr.length-1) && result.item.name == l_attr[i+1].name)
|
||||
{
|
||||
i++;
|
||||
result.num++;
|
||||
}
|
||||
newAttribute.push(result);
|
||||
}
|
||||
|
||||
return newAttribute;
|
||||
}
|
||||
|
||||
// =====================================================================================
|
||||
|
||||
function setTooltip(type, tab, cellSheet, cellGroup, tabObject)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case "command":
|
||||
var tooltip = cellGroup[cellSheet][tab].name;
|
||||
tooltip += " " + cellSheet;
|
||||
break;
|
||||
case "pick":
|
||||
var tooltip = cellSheet;
|
||||
tooltip += " List\nCurrent " + cellSheet + ": " + cellGroup[cellSheet][tab].name;
|
||||
break;
|
||||
default:
|
||||
var tooltip = cellGroup[cellSheet][tab].name;
|
||||
tooltip += " " + cellSheet;
|
||||
break;
|
||||
}
|
||||
tabObject.tooltip = tooltip;
|
||||
}
|
||||
|
||||
// =====================================================================================
|
||||
|
||||
function setEvents(type, tab, tabObject)
|
||||
{
|
||||
if (type == "command")
|
||||
{
|
||||
if (tab == "rally")
|
||||
{
|
||||
tabObject.onPress = function (event)
|
||||
{
|
||||
setCursor("cursor-rally");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tabObject.onPress = function (event)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
tabObject.onMouseEnter = function (event)
|
||||
{
|
||||
var currTab = this.name.substring (this.name.lastIndexOf ("d")+1, this.name.lastIndexOf ("_"));
|
||||
// Seek through all list tabs. (Only the one being hovered should stay open.)
|
||||
for (var i = 1; i < snStatusPaneCommand.split; i++)
|
||||
{
|
||||
// If we've found the current tab,
|
||||
if (i == currTab)
|
||||
{
|
||||
// Click the tab button to toggle visibility of its list.
|
||||
guiToggle ( "snStatusPaneCommandGroup" + currTab );
|
||||
}
|
||||
else // If it's another list tab,
|
||||
{
|
||||
// Ensure this tab is hidden.
|
||||
guiHide ("snStatusPaneCommandGroup" + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Set tab function when user clicks tab.
|
||||
tabObject.onPress = function (event)
|
||||
{
|
||||
// Click the tab button to toggle visibility of its list.
|
||||
guiToggle ( "snStatusPaneCommandGroup" + this.name.substring (this.name.lastIndexOf ("d")+1, this.name.lastIndexOf ("_")) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =====================================================================================
|
||||
|
||||
function setTabPortrait(type, tab, cellSheet, cellGroup, tabCounter)
|
||||
{
|
||||
switch (tab)
|
||||
{
|
||||
case "selection":
|
||||
case "garrison":
|
||||
case "queue":
|
||||
// Temporarily (until we have the tab textures) force a particular cell ID
|
||||
cellGroup[cellSheet][tab].id = 2;
|
||||
|
||||
// Use the horizontal tab. (Extends right.)
|
||||
setPortrait ("snStatusPaneCommand" + tabCounter + "_1", "IconSheet",
|
||||
cellSheet + "Button_H", cellGroup[cellSheet][tab].id);
|
||||
break;
|
||||
default:
|
||||
if (type == "pick" && cellSheet != "Tab")
|
||||
{
|
||||
setPortrait ("snStatusPaneCommand" + tabCounter + "_1", "IconSheet",
|
||||
cellSheet + "TabButton", cellGroup[cellSheet][tab].id);
|
||||
}
|
||||
else
|
||||
{
|
||||
setPortrait ("snStatusPaneCommand" + tabCounter + "_1", "IconSheet",
|
||||
cellSheet + "Button", cellGroup[cellSheet][tab].id);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// =====================================================================================
|
||||
|
||||
function setItemTooltip(tab, itemName, listObject, selection)
|
||||
{
|
||||
switch (tab)
|
||||
{
|
||||
case "research":
|
||||
// Store name of tech to display in list in this button's coordinate.
|
||||
var tech = getTechnology(itemName, selection[0].player);
|
||||
Crd[getCrd (listObject.name, true)].entity = tech;
|
||||
|
||||
if(!tech) {
|
||||
listObject.tooltip = "Bad tech: " + itemName;
|
||||
}
|
||||
else {
|
||||
// Set tooltip.
|
||||
listObject.tooltip = Crd[getCrd (listObject.name, true)].entity.generic +
|
||||
" (" + Crd[getCrd (listObject.name, true)].entity.specific + ")";
|
||||
|
||||
// Set portrait.
|
||||
setPortrait (listObject.name,
|
||||
Crd[getCrd (listObject.name, true)].entity.icon,
|
||||
"Button",
|
||||
Crd[getCrd (listObject.name, true)].entity.icon_cell);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Store name of entity to display in list in this button's coordinate.
|
||||
Crd[getCrd (listObject.name, true)].entity = new Object(itemName);
|
||||
|
||||
// Set tooltip.
|
||||
var template = getEntityTemplate(itemName);
|
||||
if (!template) break;
|
||||
|
||||
//If there are several units selected, don't show this tooltip when moving the cursor over the selection tab.
|
||||
if (tab != "selection")
|
||||
{
|
||||
listObject.tooltip = getProductionTooltip(template);
|
||||
}
|
||||
else
|
||||
{
|
||||
listObject.tooltip = template.traits.id.specific;
|
||||
}
|
||||
|
||||
// Set portrait.
|
||||
setPortrait (listObject.name,
|
||||
template.traits.id.icon,
|
||||
"Button" + toTitleCase(selection[0].traits.id.civ_code),
|
||||
template.traits.id.icon_cell);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// =====================================================================================
|
||||
|
||||
function setItemFunction(tab, listObject, selection)
|
||||
{
|
||||
listObject.onPress = function (event)
|
||||
{
|
||||
switch (tab)
|
||||
{
|
||||
case "train":
|
||||
issueCommand(selection, true, NMT_PRODUCE, PRODUCTION_TRAIN, ""+(Crd[getCrd (this.name, true)].entity));
|
||||
break;
|
||||
case "research":
|
||||
// TODO: Remove this item from the production queue if right-clicked.
|
||||
issueCommand(selection, true, NMT_PRODUCE, PRODUCTION_RESEARCH, ""+(Crd[getCrd (this.name, true)].entity.name));
|
||||
break;
|
||||
case "barter":
|
||||
// Buy a quantity of this resource if left-clicked.
|
||||
// Sell a quantity of this resource if right-clicked.
|
||||
break;
|
||||
case "structCiv":
|
||||
case "structMil":
|
||||
// Select building placement cursor.
|
||||
tryConstruction( Crd[getCrd (this.name, true)].entity );
|
||||
break;
|
||||
case "garrison":
|
||||
// Remove this item from the entity's garrison inventory.
|
||||
break;
|
||||
case "selection":
|
||||
// Change the selection to this unit.
|
||||
break;
|
||||
case "queue":
|
||||
//Cancel this production item.
|
||||
removeFromProductionQueue(selection, Crd[getCrd(this.name, true)].entity);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// =====================================================================================
|
||||
|
||||
function extractItemList(attribute, arrayCells)
|
||||
{
|
||||
var listArray = new Array();
|
||||
// Insert blank array element at location 0 (to buffer array so items are in 1..n range).
|
||||
listArray.push("");
|
||||
|
||||
if (!attribute.length)
|
||||
{ // If it's a list where each element is a value, (entity list)
|
||||
for ( var i in attribute )
|
||||
{
|
||||
listArray.push(i);
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // If it's a list where each element is part of a numbered array, (array list)
|
||||
for ( var i = 0; i < attribute.length; i++ )
|
||||
{
|
||||
if (attribute[i].name) {
|
||||
if (attribute[i].name != "special_settlement")
|
||||
listArray.push(attribute[i].name);
|
||||
} else {
|
||||
if (attribute[i] != "special_settlement")
|
||||
listArray.push(attribute[i]);
|
||||
}
|
||||
|
||||
// If cell sheet for each item is stored in attribute.sheet, transfer that across too.
|
||||
if (arrayCells == true)
|
||||
{
|
||||
listArray[listArray.length-1].sheet = new Object(attribute[i].name.sheet);
|
||||
}
|
||||
}
|
||||
}
|
||||
return listArray;
|
||||
}
|
@ -1,191 +0,0 @@
|
||||
/*
|
||||
DESCRIPTION : Functions for the "Status Pane" section of the session GUI.
|
||||
NOTES :
|
||||
*/
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function refreshStatusPane()
|
||||
{
|
||||
// Update civilisation emblem.
|
||||
if ( selectionChanged )
|
||||
{
|
||||
var emblemObject = getGUIObjectByName ("snStatusPaneEmblem");
|
||||
if (selection[0].traits.id.civ_code != "gaia")
|
||||
emblemObject.sprite = "snStatusPaneEmblem" + toTitleCase (selection[0].traits.id.civ_code);
|
||||
else
|
||||
emblemObject.sprite = "";
|
||||
}
|
||||
|
||||
if ( shouldUpdateStat ( "traits.id.icon" ) )
|
||||
{
|
||||
// Update portrait
|
||||
if (validProperty("selection[0].traits.id.icon"))
|
||||
setPortrait ("snStatusPanePortrait", selection[0].traits.id.icon,
|
||||
toTitleCase(selection[0].traits.id.civ_code), selection[0].traits.id.icon_cell);
|
||||
}
|
||||
|
||||
// Update portrait tooltip.
|
||||
if ( shouldUpdateStat ( "traits.id.generic" ) )
|
||||
{
|
||||
getGUIObjectByName ("snStatusPanePortrait").tooltip = selection[0].traits.id.generic;
|
||||
}
|
||||
|
||||
// Update hitpoint bar.
|
||||
if ( selectionChanged || shouldUpdateStat ( "traits.health.max" ) || shouldUpdateStat ( "traits.health.curr" ) )
|
||||
{
|
||||
var barObject = getGUIObjectByName ("snStatusPaneHealthBar");
|
||||
var textObject = getGUIObjectByName ("snStatusPaneHealthBarText");
|
||||
if (selection[0].traits.health.max && selection[0].traits.health.max != 0)
|
||||
{
|
||||
barObject.caption = (selection[0].traits.health.curr * 100) / selection[0].traits.health.max;
|
||||
barObject.hidden = false;
|
||||
textObject.caption = "[font=verdana8][color=white]" + selection[0].traits.health.curr + "[/color][/font]";
|
||||
}
|
||||
else
|
||||
{
|
||||
barObject.hidden = true;
|
||||
textObject.caption = "";
|
||||
}
|
||||
}
|
||||
|
||||
// Update stamina bar.
|
||||
if ( selectionChanged || shouldUpdateStat ( "traits.stamina.max" ) || shouldUpdateStat ( "traits.stamina.curr" ) )
|
||||
{
|
||||
var barObject = getGUIObjectByName ("snStatusPaneStaminaBar");
|
||||
var textObject = getGUIObjectByName ("snStatusPaneStaminaBarText");
|
||||
if (selection[0].traits.stamina.max && selection[0].traits.stamina.max != 0)
|
||||
{
|
||||
barObject.caption = (selection[0].traits.stamina.curr * 100) / selection[0].traits.stamina.max;
|
||||
barObject.hidden = false;
|
||||
textObject.caption = "[font=verdana8][color=white]" + selection[0].traits.stamina.curr + "[/color][/font]";
|
||||
}
|
||||
else
|
||||
{
|
||||
barObject.hidden = true;
|
||||
textObject.caption = "";
|
||||
}
|
||||
}
|
||||
|
||||
// Update unit text panel.
|
||||
if ( shouldUpdateStat ("player") || shouldUpdateStat ( "traits.id.civ" ) || shouldUpdateStat ( "traits.id.generic" ) || shouldUpdateStat ( "traits.id.specific" ) )
|
||||
{
|
||||
var textCaption = "";
|
||||
textCaption += '[font=verdana10][color="' + Math.round(selection[0].player.getColour().r*255) + ' ' + Math.round(selection[0].player.getColour().g*255) + ' ' + Math.round(selection[0].player.getColour().b*255) + '"]' + selection[0].player.name + '[/color][/font]\n';
|
||||
textCaption += "[font=verdana10][color=white]" + selection[0].traits.id.civ + "[/color][/font]\n";
|
||||
textCaption += "[font=verdana10][color=white]" + selection[0].traits.id.specific + "[/color][/font]\n";
|
||||
textCaption += "[font=optimus14b][color=gold]" + selection[0].traits.id.generic + "[/color][/font]";
|
||||
getGUIObjectByName ("snStatusPaneText").caption = textCaption;
|
||||
}
|
||||
|
||||
// Update rank icon.
|
||||
if ( shouldUpdateStat ( "traits.promotion" ) )
|
||||
{
|
||||
var rankObject = getGUIObjectByName ("snStatusPaneRank");
|
||||
|
||||
// Don't show a rank icon for Basic or unranked units.
|
||||
if (selection[0].traits.promotion && selection[0].traits.promotion.rank > 1)
|
||||
{
|
||||
rankObject.cell_id = selection[0].traits.promotion.rank-2;
|
||||
rankObject.tooltip = "Next Promotion: " + selection[0].traits.promotion.curr + "/" + selection[0].traits.promotion.req;
|
||||
rankObject.hidden = false;
|
||||
}
|
||||
else
|
||||
rankObject.hidden = true;
|
||||
}
|
||||
|
||||
// Update garrison capacity.
|
||||
if( shouldUpdateStat( "traits.garrison" ) )
|
||||
{
|
||||
var guiObject = getGUIObjectByName("snStatusPaneGarrison");
|
||||
guiObject.caption = '';
|
||||
|
||||
if (selection[0].traits.garrison)
|
||||
{
|
||||
// Set garrison icon.
|
||||
getGUIObjectByName ("snStatusPaneGarrisonIcon").cell_id = cellGroup["Garrison"]["garrison"].id;
|
||||
if (selection[0].traits.garrison.curr && selection[0].traits.garrison.max)
|
||||
{
|
||||
guiObject.caption += '[color="blue"]' + selection[0].traits.garrison.curr + '/' + selection[0].traits.garrison.max + '[/color] ';
|
||||
}
|
||||
guiObject.hidden = false;
|
||||
getGUIObjectByName ("snStatusPaneGarrisonIcon").hidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
guiObject.hidden = true;
|
||||
getGUIObjectByName ("snStatusPaneGarrisonIcon").hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( shouldUpdateStat( "traits.supply" ) )
|
||||
{
|
||||
guiObject = getGUIObjectByName("snStatusPaneSupply");
|
||||
guiObject.caption = '';
|
||||
|
||||
if (selection[0].traits.supply)
|
||||
{
|
||||
if (selection[0].traits.supply.curr && selection[0].traits.supply.max && selection[0].traits.supply.type)
|
||||
{
|
||||
// Set resource icon.
|
||||
getGUIObjectByName ("snStatusPaneSupplyIcon").cell_id = cellGroup["Resource"][selection[0].traits.supply.type].id;
|
||||
// Special case for infinity.
|
||||
if (selection[0].traits.supply.curr == "0" && selection[0].traits.supply.max == "0")
|
||||
guiObject.caption += '[color="brown"] [icon="iconInfinity"] [/color] ';
|
||||
else
|
||||
guiObject.caption += '[color="brown"]' + selection[0].traits.supply.curr + '/' + selection[0].traits.supply.max + '[/color] ';
|
||||
}
|
||||
guiObject.hidden = false;
|
||||
getGUIObjectByName ("snStatusPaneSupplyIcon").hidden = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
guiObject.hidden = true;
|
||||
getGUIObjectByName ("snStatusPaneSupplyIcon").hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Update statistic icons.
|
||||
statCurr = 1;
|
||||
if (validProperty ("selection[0].actions.attack.melee.damage"))
|
||||
updateStat ("snStatusPaneStat_", "Attack", "rating", selection[0].actions.attack.melee.damage);
|
||||
if (validProperty ("selection[0].actions.attack.melee.range"))
|
||||
updateStat ("snStatusPaneStat_", "Statistic", "range", selection[0].actions.attack.melee.range);
|
||||
if (validProperty ("selection[0].actions.attack.ranged.damage"))
|
||||
updateStat ("snStatusPaneStat_", "Attack", "rating", selection[0].actions.attack.ranged.damage);
|
||||
if (validProperty ("selection[0].actions.attack.ranged.range"))
|
||||
updateStat ("snStatusPaneStat_", "Statistic", "range", selection[0].actions.attack.ranged.range);
|
||||
if (validProperty ("selection[0].traits.armour.value"))
|
||||
updateStat ("snStatusPaneStat_", "Armour", "rating", selection[0].traits.armour.value);
|
||||
if (validProperty ("selection[0].traits.vision.los"))
|
||||
updateStat ("snStatusPaneStat_", "Statistic", "vision", selection[0].traits.vision.los);
|
||||
|
||||
// Refresh command buttons.
|
||||
refreshCommandButtons();
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function updateStat (baseName, cellSheet, cell, statistic)
|
||||
{
|
||||
var textStat = getGUIObjectByName (baseName + statCurr);
|
||||
if( !textStat )
|
||||
{
|
||||
//console.write("No textStat for " + baseName + " " + statCurr);
|
||||
return;
|
||||
}
|
||||
textStat.sprite = "snIconSheet" + cellSheet;
|
||||
textStat.cell_id = cellGroup[cellSheet][cell].id;
|
||||
textStat.tooltip = cellGroup[cellSheet][cell].name;
|
||||
var iconStat = getGUIObjectByName (baseName + (statCurr + 1));
|
||||
|
||||
if (!isNaN(statistic)) {
|
||||
statistic = Math.ceil(statistic);
|
||||
}
|
||||
|
||||
iconStat.caption = statistic;
|
||||
iconStat.tooltip = cellGroup[cellSheet][cell].name + ": " + statistic + ".";
|
||||
statCurr = (statCurr + 2);
|
||||
}
|
||||
|
||||
// ====================================================================
|
@ -1,258 +0,0 @@
|
||||
/*
|
||||
DESCRIPTION : Functions for the world click handler and manipulating entities.
|
||||
NOTES :
|
||||
*/
|
||||
// ====================================================================
|
||||
|
||||
addGlobalHandler ("worldClick", worldClickHandler);
|
||||
|
||||
// ====================================================================
|
||||
|
||||
// The world-click handler - called whenever the user clicks the terrain
|
||||
function worldClickHandler(event)
|
||||
{
|
||||
args=new Array(null, null);
|
||||
|
||||
//console.write("worldClickHandler: button "+event.button+", clicks "+event.clicks);
|
||||
|
||||
if (isSelecting())
|
||||
{
|
||||
getGlobal().selectionWorldClickHandler(event);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Right button single- or double-clicks
|
||||
if (event.button == SDL_BUTTON_RIGHT && event.clicks <= 2)
|
||||
{
|
||||
var controlling = true;
|
||||
for (var i = 0; i < selection.length; i++) {
|
||||
if (! (selection[i].player.name == localPlayer.name)) {
|
||||
controlling = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!controlling) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.clicks == 1) {
|
||||
cmd = event.order;
|
||||
}
|
||||
else if (event.clicks == 2)
|
||||
{
|
||||
// Use the secondary order, or, if the entites didn't vote for any order
|
||||
// (i.e. we are using the default of NMT_GOTO), use the NMT_RUN
|
||||
if (event.order == NMT_GOTO )
|
||||
cmd = NMT_RUN;
|
||||
else
|
||||
cmd = event.secondaryOrder;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
//setting rally point
|
||||
if ( getCursorName() == "cursor-rally" )
|
||||
{
|
||||
for ( var i=0; i<selection.length; i++ )
|
||||
selection[i].setRallyPointAtCursor();
|
||||
setCursor("arrow-default");
|
||||
return;
|
||||
}
|
||||
switch (cmd)
|
||||
{
|
||||
// location target commands
|
||||
case NMT_GOTO:
|
||||
case NMT_RUN:
|
||||
case NMT_PATROL:
|
||||
if (event.queued)
|
||||
cmd = NMT_ADD_WAYPOINT;
|
||||
args[0]=event.x;
|
||||
args[1]=event.y;
|
||||
break;
|
||||
case NMT_ADD_WAYPOINT:
|
||||
args[0]=event.x;
|
||||
args[1]=event.y;
|
||||
break;
|
||||
// entity target commands
|
||||
case NMT_CONTACT_ACTION:
|
||||
args[0]=event.entity;
|
||||
if ( event.clicks == 1)
|
||||
args[1]=event.action;
|
||||
else
|
||||
args[1]=event.secondaryAction;
|
||||
break;
|
||||
//TODO: get rid of order() calls.
|
||||
case NMT_NOTIFY_REQUEST:
|
||||
if (event.clicks == 1)
|
||||
action = event.action;
|
||||
else
|
||||
action = event.secondaryAction;
|
||||
|
||||
if (event.entity.isIdle())
|
||||
{
|
||||
for (var i=0; i<selection.length;i++)
|
||||
{
|
||||
if (!selection[i].actions)
|
||||
continue;
|
||||
//console.write("Requesting notification for " + event.entity);
|
||||
//selection[i].requestNotification( event.entity, action, true, false );
|
||||
//selection[i].order( ORDER_GOTO, event.entity.position.x, event.entity.position.z - selection[i].actions.escort.distance, true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var i=0; i<selection.length;i++)
|
||||
{
|
||||
if (!selection[i].actions)
|
||||
continue;
|
||||
//console.write("Requesting notification for " + event.entity);
|
||||
//selection[i].requestNotification( event.entity, action, true, false );
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
default:
|
||||
console.write("worldClickHandler: Unknown order: "+cmd);
|
||||
return;
|
||||
}
|
||||
|
||||
if (cmd == NMT_CONTACT_ACTION) // For NMT_CONTACT_ACTION, add a third argument - whether to run
|
||||
issueCommand (selection, isOrderQueued(), cmd, args[0], args[1], event.clicks > 1);
|
||||
else
|
||||
issueCommand (selection, isOrderQueued(), cmd, args[0], args[1]);
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function selectEntity(handler)
|
||||
{
|
||||
endSelection();
|
||||
startSelection(function (event) {
|
||||
// Selection is performed when single-clicking the right mouse
|
||||
// button.
|
||||
if (event.button == SDL_BUTTON_RIGHT && event.clicks == 1)
|
||||
{
|
||||
handler(event.entity);
|
||||
}
|
||||
// End selection on first mouse-click
|
||||
endSelection();
|
||||
});
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function selectLocation(handler)
|
||||
{
|
||||
endSelection();
|
||||
startSelection(function (event) {
|
||||
// Selection is performed when single-clicking the right mouse
|
||||
// button.
|
||||
if (event.button == SDL_BUTTON_RIGHT && event.clicks == 1)
|
||||
{
|
||||
handler(event.x, event.y);
|
||||
}
|
||||
// End selection on first mouse-click
|
||||
endSelection();
|
||||
});
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function startSelection(handler)
|
||||
{
|
||||
gameView.startCustomSelection();
|
||||
getGlobal().selectionWorldClickHandler=handler;
|
||||
console.write("isSelecting(): "+isSelecting());
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function endSelection()
|
||||
{
|
||||
if (!isSelecting())
|
||||
return;
|
||||
|
||||
gameView.endCustomSelection();
|
||||
getGlobal().selectionWorldClickHandler = null;
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function isSelecting()
|
||||
{
|
||||
return getGlobal().selectionWorldClickHandler != null;
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function makeUnit (x, y, z, MakeUnitName)
|
||||
{
|
||||
// Spawn an entity at the given coordinates.
|
||||
|
||||
var dudeSpawnPoint = new Vector3D(x, y, z);
|
||||
new Entity(getEntityTemplate(MakeUnitName), dudeSpawnPoint, 1.0);
|
||||
// writeConsole(MakeUnitName + " created at " + DudeSpawnPoint);
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function validProperty (propertyName)
|
||||
{
|
||||
// Accepts a string representing an entity property (eg "selection[0].traits.id.generic")
|
||||
// and checks if all the elements (selection[0].traits, selection[0].traits.id, etc) are valid properties.
|
||||
// Returns false if any invalids are found. Returns true if the whole property is valid.
|
||||
|
||||
// An empty string is always successful.
|
||||
if (propertyName == "") return true;
|
||||
|
||||
// An undefined string is always unsuccessful.
|
||||
if (propertyName == undefined) return false;
|
||||
|
||||
// Store elements of the property as an array of strings.
|
||||
var splitArray = propertyName.toString().split (".");
|
||||
|
||||
// Seek through elements in array.
|
||||
var arrayString = "";
|
||||
for (var i = 0; i < splitArray.length; i++)
|
||||
{
|
||||
// Test each element combination of the string to ensure they are all valid.
|
||||
if (i > 0) arrayString += ".";
|
||||
arrayString += splitArray[i];
|
||||
|
||||
// If the property name is not valid, return false.
|
||||
if (!(eval (arrayString)))
|
||||
return false;
|
||||
}
|
||||
// If we managed to check them all, every element in the property is valid. Return true.
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function killSelectedEntities()
|
||||
{
|
||||
var allOwned = true;
|
||||
for (var i=0; i<selection.length && allOwned; i++)
|
||||
{
|
||||
if (localPlayer != selection[i].player)
|
||||
{
|
||||
allOwned = false;
|
||||
}
|
||||
}
|
||||
|
||||
if (allOwned)
|
||||
{
|
||||
for (i=0; i<selection.length; i++)
|
||||
{
|
||||
//TODO: send network msg, so the unit is killed everywhere
|
||||
console.write('killing....');
|
||||
selection[i].kill();
|
||||
issueCommand(selection[i], NMT_REMOVE_OBJECT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,194 +0,0 @@
|
||||
/*
|
||||
DESCRIPTION : Functions for manipulating players and their properties (eg resources).
|
||||
NOTES :
|
||||
*/
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function createResourceCounters()
|
||||
{
|
||||
resourceUIArray = new Array();
|
||||
|
||||
addResourceCounter(0, "food");
|
||||
addResourceCounter(1, "wood");
|
||||
addResourceCounter(2, "stone");
|
||||
addResourceCounter(3, "metal");
|
||||
addResourceCounter(4, "population");
|
||||
|
||||
refreshResource("Food", 0);
|
||||
refreshResource("Wood", 1);
|
||||
refreshResource("Stone", 2);
|
||||
refreshResource("Metal", 3);
|
||||
refreshResource("Population", 4);
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function addResourceCounter (index, resourceName)
|
||||
{
|
||||
// Creates a resource counter widget.
|
||||
|
||||
// Ensure resource name is lower-case.
|
||||
resourceName = resourceName.toLowerCase();
|
||||
|
||||
// We maintain a sorted array of the resource indexes so that the UI counters can be refreshed in centered order.
|
||||
// (We don't include Housing in the list, though, as it does not have its own resource counter.)
|
||||
if (resourceName != "housing")
|
||||
{
|
||||
// If it's an even index,
|
||||
if (index % 2 == 0)
|
||||
// Add it to the end of the UI array.
|
||||
resourceUIArray.push ( index );
|
||||
else
|
||||
// Add it to the beginning of the UI array,
|
||||
resourceUIArray.unshift ( index );
|
||||
}
|
||||
|
||||
//console.write( "Added " + resourceName /*+ " (" + resourceQty + ")"*/ );
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
// HACK: Keep track of old resource values so we only update resource counters as necessary.
|
||||
// We should really find a *much* faster way to render those counters, since resource values are bound to change quite quickly in a real game.
|
||||
var oldResources = new Object();
|
||||
|
||||
function refreshResources ()
|
||||
{
|
||||
// Refreshes all resource counters after update.
|
||||
|
||||
var resourcePool = localPlayer.resources;
|
||||
|
||||
var shouldRefresh = false;
|
||||
for (var currResource in resourcePool)
|
||||
{
|
||||
if( oldResources[currResource] != localPlayer.resources[currResource] )
|
||||
{
|
||||
oldResources[currResource] = localPlayer.resources[currResource].valueOf();
|
||||
shouldRefresh = true;
|
||||
}
|
||||
}
|
||||
|
||||
if( shouldRefresh )
|
||||
{
|
||||
for( var i=0; i<2; i++ ) // 2 refreshes seem to be necessary for proper alignment
|
||||
{
|
||||
var resourceCount = 0;
|
||||
for (var currResource in resourcePool)
|
||||
{
|
||||
if(currResource != "housing")
|
||||
{
|
||||
// Pass the array index of the resource as the second parameter (as we'll need that to determine the centered screen position of each counter).
|
||||
refreshResource (toTitleCase(currResource), resourceUIArray[resourceCount]);
|
||||
resourceCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function refreshResource (resourceName, resourceIndex)
|
||||
{
|
||||
// Refresh the onscreen counter for a given resource (called to recalculate the size of the coordinates, as these dynamically adjust depending on character length).
|
||||
|
||||
// Ensure resource name is title-case.
|
||||
resourceName = toTitleCase (resourceName);
|
||||
|
||||
// Ignore the "Housing" resource ... It doesn't work like normal resources and doesn't have a counter to resize.
|
||||
if (resourceName == "Housing")
|
||||
return;
|
||||
|
||||
// Get resource readout object.
|
||||
var resourceObject = getGUIObjectByName ("snResourceCounter_" + (resourceIndex + 1));
|
||||
// Get resource icon object.
|
||||
var resourceIconObject = getGUIObjectByName ("snResourceCounterIcon_" + (resourceIndex + 1));
|
||||
|
||||
// Update counter caption (since we need to have up-to-date text to determine the length of the counter).
|
||||
var caption = parseInt( localPlayer.resources[resourceName.toLowerCase()] );
|
||||
// The Population counter also lists the amount of available housing.
|
||||
if (resourceName == "Population")
|
||||
caption += "/" + localPlayer.resources["housing"];
|
||||
|
||||
resourceObject.caption = caption;
|
||||
|
||||
// Update counter tooltip.
|
||||
resourceObject.tooltip = resourceName + ": " + resourceObject.caption;
|
||||
|
||||
// Set resource icon.
|
||||
resourceIconObject.cell_id = cellGroup["Resource"][resourceName.toLowerCase()].id;
|
||||
|
||||
// Get the index of the resource readout to be resized.
|
||||
var crdResult = getCrd (resourceObject.name, true);
|
||||
// Get the index of the resource icon.
|
||||
var crdIconResult = getCrd (resourceIconObject.name, true);
|
||||
|
||||
// For each coordinate group stored for this control,
|
||||
for (var coordGroup in Crd[crdResult].coord)
|
||||
{
|
||||
// Set width of readout based on length of caption.
|
||||
Crd[crdResult].coord[coordGroup].width = snConst.MiniIcon.Width+5 + resourceObject.caption.length * 10;
|
||||
|
||||
// Set X and Y position and height so that resources always are immediately besides each other. (Except for the first resource (usually Food), which has the initial starting position)
|
||||
|
||||
// Determine starting position for the first resource (so that the resources wind up being centered across the screen).
|
||||
if (resourceIndex == 0)
|
||||
{
|
||||
// The first coordinate is in the exact centre of the screen.
|
||||
Crd[crdResult].coord[coordGroup].x = Math.round (-(Crd[crdResult].coord[coordGroup].width/2) - 5);
|
||||
}
|
||||
else
|
||||
{ // Resources other than the first one get stacked in sequence to the sides of it.
|
||||
|
||||
// If we're dealing with an "even" resource index,
|
||||
if (resourceIndex % 2 == 0)
|
||||
{
|
||||
// Put the counter to the right of the previous odd counter.
|
||||
Crd[crdResult].coord[coordGroup].x
|
||||
= Crd[crdResult-2].coord[coordGroup].x + Crd[crdResult-2].coord[coordGroup].width + 5;
|
||||
}
|
||||
else // We're dealing with an "odd" resource index.
|
||||
{
|
||||
// Put the counter to the left of the previous odd counter.
|
||||
if (resourceIndex == 1)
|
||||
Crd[crdResult].coord[coordGroup].x
|
||||
= Crd[crdResult-1].coord[coordGroup].x - Crd[crdResult].coord[coordGroup].width - 5;
|
||||
else
|
||||
Crd[crdResult].coord[coordGroup].x
|
||||
= Crd[crdResult-2].coord[coordGroup].x - Crd[crdResult].coord[coordGroup].width - 5;
|
||||
}
|
||||
|
||||
// Set Y position to the same as the previous counter.
|
||||
Crd[crdResult].coord[coordGroup].y
|
||||
= Crd[crdResult-1].coord[coordGroup].y;
|
||||
|
||||
// Set height of readout to the same as the previous counter.
|
||||
Crd[crdResult].coord[coordGroup].height
|
||||
= Crd[crdResult-1].coord[coordGroup].height;
|
||||
}
|
||||
|
||||
// Transfer to icon coordinates.
|
||||
Crd[crdIconResult].coord[coordGroup].width = 32;
|
||||
Crd[crdIconResult].coord[coordGroup].height = 32;
|
||||
Crd[crdIconResult].coord[coordGroup].x = Crd[crdResult].coord[coordGroup].x;
|
||||
Crd[crdIconResult].coord[coordGroup].y = Crd[crdResult].coord[coordGroup].y;
|
||||
|
||||
// Recalculate readout's size coordinates.
|
||||
Crd[crdResult].size[coordGroup] = calcCrdArray (Crd[crdResult].coord[coordGroup].rx, Crd[crdResult].coord[coordGroup].ry, Crd[crdResult].coord[coordGroup].x, Crd[crdResult].coord[coordGroup].y, Crd[crdResult].coord[coordGroup].width, Crd[crdResult].coord[coordGroup].height, Crd[crdResult].coord[coordGroup].rx2, Crd[crdResult].coord[coordGroup].ry2);
|
||||
|
||||
// Recalculate icon's size coordinates.
|
||||
Crd[crdIconResult].size[coordGroup] = calcCrdArray (Crd[crdIconResult].coord[coordGroup].rx, Crd[crdIconResult].coord[coordGroup].ry, Crd[crdIconResult].coord[coordGroup].x, Crd[crdIconResult].coord[coordGroup].y, Crd[crdIconResult].coord[coordGroup].width, Crd[crdIconResult].coord[coordGroup].height, Crd[crdIconResult].coord[coordGroup].rx2, Crd[crdIconResult].coord[coordGroup].ry2);
|
||||
|
||||
// If this coordinate is part of the currently active set, update the control onscreen too.
|
||||
if (coordGroup == GUIType)
|
||||
{
|
||||
// Update counter size.
|
||||
resourceObject.size = Crd[crdResult].size[GUIType];
|
||||
resourceIconObject.size = Crd[crdIconResult].size[GUIType];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
@ -44,22 +44,4 @@
|
||||
|
||||
<script file="gui/common/functions_page_pregame_load.js" />
|
||||
|
||||
<script file="gui/common/functions_page_session.js"/>
|
||||
|
||||
<script file="gui/common/functions_page_session_status_pane.js" />
|
||||
|
||||
<script file="gui/common/functions_page_session_status_commands.js" />
|
||||
|
||||
<script file="gui/common/functions_page_session_manual.js" />
|
||||
|
||||
<!--
|
||||
==========================================
|
||||
- INCLUDE SCRIPT - SIMULATION FUNCTIONS
|
||||
==========================================
|
||||
-->
|
||||
|
||||
<script file="gui/common/functions_sim_player.js"/>
|
||||
|
||||
<script file="gui/common/functions_sim_entity.js"/>
|
||||
|
||||
</objects>
|
||||
|
@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<page>
|
||||
<include>common/setup.xml</include>
|
||||
<include>common/styles.xml</include>
|
||||
<include>common/sprite1.xml</include>
|
||||
<include>common/init.xml</include>
|
||||
<include>common/icon_sprites.xml</include>
|
||||
<include>session/sprites.xml</include>
|
||||
<include>session/styles.xml</include>
|
||||
<include>session/session.xml</include>
|
||||
<include>session/manual.xml</include>
|
||||
<include>common/global.xml</include>
|
||||
</page>
|
@ -1,158 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
|
||||
|
||||
<!DOCTYPE objects SYSTEM "../gui.dtd">
|
||||
|
||||
<!--
|
||||
==========================================
|
||||
- ONLINE MANUAL DEFINITION -
|
||||
==========================================
|
||||
-->
|
||||
|
||||
<objects>
|
||||
|
||||
<object name="mn"
|
||||
hidden="true"
|
||||
hotkey="onlinehelp"
|
||||
>
|
||||
<action on="Press"><![CDATA[
|
||||
// Toggle manual if something selected.
|
||||
if (selection.length > 0)
|
||||
{
|
||||
// Ensure manual is refreshed.
|
||||
refreshManual();
|
||||
|
||||
// Open/Close the manual.
|
||||
guiToggle ("mn");
|
||||
guiToggle ("sn");
|
||||
}
|
||||
]]></action>
|
||||
|
||||
<object name="mnBkg"
|
||||
type="text"
|
||||
style="wheatWindow"
|
||||
tooltip_style="snToolTip"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
// Note: This is an example of addCrd() using the traditional "GUISize" size structure.
|
||||
// * rleft
|
||||
// * rtop
|
||||
// * x1
|
||||
// * y1
|
||||
// * x2
|
||||
// * y2
|
||||
// * rtop
|
||||
// * rbottom
|
||||
// While an unusual syntax, it means you can reference other stored coordinates with getCrd(),
|
||||
// and combine them with mathematical operations to create dynamic coordinates.
|
||||
addCrd (this.name, rb,
|
||||
10,
|
||||
10,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
90,
|
||||
90);
|
||||
]]></action>
|
||||
|
||||
<object name="mnPortrait"
|
||||
style="snPortrait"
|
||||
type="button"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
// Note: This is an example of addCrd() using a custom structure that saves a lot of extra
|
||||
// effort when you want to only reference one set of relative coordinates, and know the width
|
||||
// and height of your control. The function internally takes care of converting this to a
|
||||
// a "GUISize".
|
||||
// * rleft
|
||||
// * rtop
|
||||
// * x
|
||||
// * y
|
||||
// * width
|
||||
// * height
|
||||
// While an unusual syntax, it means you can also reference other stored coordinates with
|
||||
// getCrd(), and combine them with mathematical operations and variables to create dynamic
|
||||
// coordinates.
|
||||
addCrd (this.name, rb, 0, 0,
|
||||
10,
|
||||
10,
|
||||
snConst.Portrait.Lrg.Width,
|
||||
snConst.Portrait.Lrg.Height);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<!-- Gee needs to implement text clipping, so long text doesn't get clipped to these scroll windows yet. Scroll bars also don't block world input yet. -->
|
||||
<object name="mnRollover"
|
||||
type="text"
|
||||
style="wheatBorderBlack"
|
||||
font="trebuchet12"
|
||||
scrollbar="true"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
addCrd (this.name, rb,
|
||||
0,
|
||||
0,
|
||||
getCrd ("mnPortrait").coord[rb].x+getCrd ("mnPortrait").coord[rb].width+10,
|
||||
getCrd ("mnPortrait").coord[rb].y,
|
||||
(getCrd ("mnPortrait").coord[rb].x * -1),
|
||||
getCrd ("mnPortrait").coord[rb].y+getCrd ("mnPortrait").coord[rb].height,
|
||||
100,
|
||||
0);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<!-- Gee needs to implement text clipping, so long text doesn't get clipped to these scroll windows yet. Scroll bars also don't block world input yet. -->
|
||||
<object name="mnHistory"
|
||||
style="wheatBorderBlack"
|
||||
type="text"
|
||||
font="trebuchet12"
|
||||
scrollbar="true"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
addCrd (this.name, rb,
|
||||
0,
|
||||
100,
|
||||
getCrd ("mnPortrait").coord[rb].x,
|
||||
(getCrd ("mnRollover").coord[rb].height * -2),
|
||||
(getCrd ("mnPortrait").coord[rb].x * -1),
|
||||
(getCrd ("mnPortrait").coord[rb].y * -1),
|
||||
100,
|
||||
100);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="mnText"
|
||||
style="wheatBorderBlack"
|
||||
type="text"
|
||||
scrollbar="true"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
addCrd (this.name, rb,
|
||||
0,
|
||||
0,
|
||||
getCrd ("mnHistory").coord[rb].x,
|
||||
getCrd ("mnRollover").coord[rb].y+getCrd ("mnRollover").coord[rb].height+5,
|
||||
getCrd ("mnHistory").coord[rb].width,
|
||||
getCrd ("mnHistory").coord[rb].y+getCrd ("mnHistory").coord[rb].height-5,
|
||||
100,
|
||||
100);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="mnExitButton"
|
||||
style="wheatExit"
|
||||
type="button"
|
||||
tooltip="Click this button or hit the hotkey again to close this manual."
|
||||
>
|
||||
<action on="Press"><![CDATA[
|
||||
// Close manual.
|
||||
guiHide("mn");
|
||||
guiUnHide("sn");
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
</objects>
|
@ -1,83 +0,0 @@
|
||||
function init()
|
||||
{
|
||||
// Set starting UI layout.
|
||||
GUIType=rb;
|
||||
|
||||
// Set session UI sprites to match the skin for the player's civilisation.
|
||||
// (We don't have skins for all civs yet, so we're using the standard menu skin. But it should be settable from here later.)
|
||||
setSkin ("wheat");
|
||||
|
||||
// Set GUI coordinates to starting orientation.
|
||||
flipGUI (GUIType);
|
||||
|
||||
// Create resource pools for each player, etc.
|
||||
setupSession();
|
||||
}
|
||||
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function setupSession ()
|
||||
{
|
||||
// Do essentials that can only be done when the session has been loaded ...
|
||||
// For example, create the resource types, scores, etc, for each player.
|
||||
|
||||
/*
|
||||
if (sessionType == "Skirmish")
|
||||
{
|
||||
// Set up a bunch of players so we can see them pretty colours. :P
|
||||
console.write ("Setting Up Temporary Single Players");
|
||||
// The first player is by default allocated to the local player in SP, so
|
||||
// adding 7 players means that we'll have 8 players in total
|
||||
for (var i=0; i<7; i++)
|
||||
{
|
||||
g_GameAttributes.slots[i+1].assignLocal();
|
||||
console.write ("Slot "+(i+1)+" is assigned: " + g_GameAttributes.slots[i+1].assignment);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
// Select session peace track.
|
||||
curr_session_playlist_1 = newRandomSound("music", "peace");
|
||||
// Fade out main theme and fade in session theme.
|
||||
if (typeof curr_music != "undefined" && curr_music)
|
||||
crossFade(curr_music, curr_session_playlist_1, 1)
|
||||
|
||||
// Create the resouce counters
|
||||
createResourceCounters();
|
||||
|
||||
// Start refreshing the session controls.
|
||||
setInterval( snRefresh, 1, 100 );
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
|
||||
function endSession (closeType)
|
||||
{
|
||||
// Occurs when the player chooses to close the current game.
|
||||
|
||||
switch (closeType)
|
||||
{
|
||||
case ("return"):
|
||||
// If the player has chosen to quit game and return to main menu,
|
||||
|
||||
// End the session.
|
||||
endGame();
|
||||
|
||||
// Fade out current music and return to playing menu theme.
|
||||
//curr_music = newRandomSound("music", "menu");
|
||||
//crossFade(curr_session_playlist_1, curr_music, 1);
|
||||
|
||||
// Stop refreshing the session controls.
|
||||
cancelInterval();
|
||||
|
||||
// Swap GUIs to display main menu.
|
||||
Engine.SwitchGuiPage("page_pregame.xml");
|
||||
break;
|
||||
case ("exit"):
|
||||
// If the player has chosen to shutdown and immediately return to operating system,
|
||||
exit();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,911 +0,0 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1" standalone="no" ?>
|
||||
|
||||
<!DOCTYPE objects SYSTEM "../gui.dtd">
|
||||
|
||||
<!--
|
||||
==========================================
|
||||
- SESSION GUI -
|
||||
==========================================
|
||||
-->
|
||||
|
||||
<objects>
|
||||
|
||||
<script file="gui/session/session.js"/>
|
||||
|
||||
<object name="sn"
|
||||
hotkey="session.gui.toggle"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
initSession();
|
||||
]]></action>
|
||||
|
||||
<action on="Press"><![CDATA[
|
||||
guiToggle (this.name);
|
||||
]]></action>
|
||||
|
||||
<!-- EMPTY OBJECT TO END THE SESSION BUT WITH A CONFIRMATION BOX. (ESC key) -->
|
||||
<object name="snLeave"
|
||||
hotkey="leave"
|
||||
>
|
||||
<action on="Press"><![CDATA[
|
||||
btCaptions = ["Yes", "No!"];
|
||||
btCode = [confirmLeave, null];
|
||||
messageBox (400, 200, "Do you really want to quit?", "Confirmation", 0, btCaptions, btCode);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
|
||||
<!-- EMPTY OBJECT USED TO FLIP THE GUI TO VARIOUS ORIENTATIONS. -->
|
||||
<object name="snFlip"
|
||||
hotkey="session.gui.flip"
|
||||
>
|
||||
<action on="Press"><![CDATA[
|
||||
flipGUI();
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<!-- EMPTY OBJECT USED TO RETURN TO MAIN MENU. -->
|
||||
<object name="snReturn"
|
||||
hotkey="menu.resign"
|
||||
>
|
||||
<action on="Press"><![CDATA[
|
||||
console.write("Returning to main menu!");
|
||||
endSession("return");
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<!-- EMPTY OBJECT USED TO TOGGLE WATER RENDERING. -->
|
||||
<object name="snWaterToggle"
|
||||
hotkey="water.toggle"
|
||||
>
|
||||
<action on="Press"><![CDATA[
|
||||
toggleWater();
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<!-- EMPTY OBJECT USED TO RAISE WATER PLANE. -->
|
||||
<object name="snWaterRaise"
|
||||
hotkey="water.raise"
|
||||
>
|
||||
<action on="Press"><![CDATA[
|
||||
setWaterHeight( getWaterHeight() + 0.25 );
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<!-- EMPTY OBJECT USED TO LOWER WATER PLANE. -->
|
||||
<object name="snWaterLower"
|
||||
hotkey="water.lower"
|
||||
>
|
||||
<action on="Press"><![CDATA[
|
||||
setWaterHeight( getWaterHeight() - 0.25 );
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<!-- EMPTY OBJECT USED TO TOGGLE TERRITORY RENDERING. -->
|
||||
<object name="snTerritoryToggle"
|
||||
hotkey="territory.rendering.toggle"
|
||||
>
|
||||
<action on="Press"><![CDATA[
|
||||
toggleTerritoryRendering();
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<!-- EMPTY OBJECT USED TO KILL UNITS -->
|
||||
<object name="unitsKiller"
|
||||
hotkey="killUnit"
|
||||
>
|
||||
<action on="Press"><![CDATA[
|
||||
killSelectedEntities();
|
||||
]]>
|
||||
</action>
|
||||
</object>
|
||||
|
||||
<!-- GROUP: MINIMAP -->
|
||||
<object name="snMiniMap"
|
||||
hotkey="session.minimap.toggle"
|
||||
>
|
||||
<action on="Press"><![CDATA[
|
||||
guiToggle (this.name);
|
||||
]]></action>
|
||||
|
||||
<object name="snMiniMapDisplay"
|
||||
style="snObject"
|
||||
type="minimap"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
addCrds (this.name, 100, 100, 6, 6, 132, 132);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="snMiniMapBorder"
|
||||
style="snMiniMapBorder"
|
||||
type="image"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
addCrds (this.name, 100, 100, 0, 0, 172, 172);
|
||||
]]></action>
|
||||
|
||||
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
<object name="snMiniMapButtonGroup"
|
||||
>
|
||||
<object name="snMiniMapButtonArc_Up" style="snMiniMapArcUp" type="button"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
var currCrd = getCrd ("snMiniMapBorder");
|
||||
addCrds (this.name, 100, 100, currCrd.coord[rb].x+currCrd.coord[rb].width-32, currCrd.coord[rb].y+currCrd.coord[rb].height-83, 25, 52);
|
||||
]]></action>
|
||||
</object>
|
||||
<object name="snMiniMapButtonArc_Left" style="snMiniMapArcLeft" type="button"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
var currCrd = getCrd ("snMiniMapBorder");
|
||||
addCrds (this.name, 100, 100, currCrd.coord[rb].x+currCrd.coord[rb].width-83, currCrd.coord[rb].y+currCrd.coord[rb].height-32, 52, 25);
|
||||
]]></action>
|
||||
</object>
|
||||
<object name="snMiniMapButtonUp_1" style="snMiniMapButton" type="button" />
|
||||
<object name="snMiniMapButtonUp_2" style="snMiniMapButton" type="button" />
|
||||
<object name="snMiniMapButtonUp_3" style="snMiniMapButton" type="button"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
// Seek through this group of buttons (determining length from last object's name).
|
||||
var max = this.name.substring (this.name.lastIndexOf ("_")+1, this.name.length);
|
||||
for (var loop = 1; loop <= max; loop++)
|
||||
{
|
||||
var tempName = this.name.substring (0, this.name.lastIndexOf ("_")+1) + loop;
|
||||
// Set size/position.
|
||||
if (loop == 1)
|
||||
{
|
||||
currCrd = getCrd ("snMiniMapBorder");
|
||||
addCrds (tempName,
|
||||
100, 100,
|
||||
currCrd.coord[rb].x+currCrd.coord[rb].width-35,
|
||||
currCrd.coord[rb].y,
|
||||
30,
|
||||
30);
|
||||
}
|
||||
else
|
||||
{
|
||||
currCrd = getCrd (this.name.substring (0, this.name.lastIndexOf ("_")+1) + (loop - 1));
|
||||
addCrds (tempName,
|
||||
100, 100,
|
||||
currCrd.coord[rb].x,
|
||||
currCrd.coord[rb].y+currCrd.coord[rb].height+1,
|
||||
currCrd.coord[rb].width,
|
||||
currCrd.coord[rb].height);
|
||||
}
|
||||
// Set object properties.
|
||||
var tempObject = getGUIObjectByName (tempName);
|
||||
switch (loop)
|
||||
{
|
||||
case 1:
|
||||
tempObject.cell_id = cellGroup["Minimap"]["territories"].id;
|
||||
break;
|
||||
case 2:
|
||||
tempObject.cell_id = cellGroup["Minimap"]["terrain"].id;
|
||||
break;
|
||||
case 3:
|
||||
tempObject.cell_id = cellGroup["Minimap"]["chat"].id;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// Set tooltip.
|
||||
tempObject.tooltip = "This button doesn't do anything ... yet.";
|
||||
|
||||
}
|
||||
]]></action>
|
||||
</object>
|
||||
<object name="snMiniMapButtonLeft_1" style="snMiniMapButton" type="button" />
|
||||
<object name="snMiniMapButtonLeft_2" style="snMiniMapButton" type="button" />
|
||||
<object name="snMiniMapButtonLeft_3" style="snMiniMapButton" type="button"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
// Seek through this group of buttons (determining length from last object's name).
|
||||
var max = this.name.substring (this.name.lastIndexOf ("_")+1, this.name.length);
|
||||
for (var loop = 1; loop <= max; loop++)
|
||||
{
|
||||
var tempName = this.name.substring (0, this.name.lastIndexOf ("_")+1) + loop;
|
||||
// Set size/position.
|
||||
if (loop == 1)
|
||||
{
|
||||
var currCrd = getCrd ("snMiniMapBorder");
|
||||
addCrds (tempName,
|
||||
100, 100,
|
||||
currCrd.coord[rb].x,
|
||||
currCrd.coord[rb].y+currCrd.coord[rb].height-32,
|
||||
30,
|
||||
30);
|
||||
}
|
||||
else
|
||||
{
|
||||
var currCrd = getCrd (this.name.substring (0, this.name.lastIndexOf ("_")+1) + (loop - 1));
|
||||
addCrds (tempName,
|
||||
100, 100,
|
||||
currCrd.coord[rb].x+currCrd.coord[rb].width+1,
|
||||
currCrd.coord[rb].y,
|
||||
currCrd.coord[rb].width,
|
||||
currCrd.coord[rb].height);
|
||||
}
|
||||
// Set object properties.
|
||||
var tempObject = getGUIObjectByName (tempName);
|
||||
switch (loop)
|
||||
{
|
||||
case 1:
|
||||
tempObject.cell_id = cellGroup["Minimap"]["score"].id;
|
||||
break;
|
||||
case 2:
|
||||
tempObject.cell_id = cellGroup["Minimap"]["cycleobjects"].id;
|
||||
break;
|
||||
case 3:
|
||||
tempObject.cell_id = cellGroup["Minimap"]["friendorfoe"].id;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// Set tooltip.
|
||||
tempObject.tooltip = "This button doesn't do anything ... yet.";
|
||||
|
||||
}
|
||||
]]></action>
|
||||
</object>
|
||||
</object>
|
||||
|
||||
|
||||
<!-- GROUP: RESOURCE COUNTER -->
|
||||
<object name="snResourceCounter"
|
||||
hotkey="resourcepool.toggle"
|
||||
>
|
||||
<action on="Press"><![CDATA[
|
||||
guiToggle(this.name);
|
||||
]]></action>
|
||||
|
||||
<object name="snResourceCounter_1"
|
||||
style="snCounter"
|
||||
type="button"
|
||||
/>
|
||||
<object name="snResourceCounter_2"
|
||||
style="snCounter"
|
||||
type="button"
|
||||
/>
|
||||
<object name="snResourceCounter_3"
|
||||
style="snCounter"
|
||||
type="button"
|
||||
/>
|
||||
<object name="snResourceCounter_4"
|
||||
style="snCounter"
|
||||
type="button"
|
||||
/>
|
||||
<object name="snResourceCounter_5"
|
||||
style="snCounter"
|
||||
type="button"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
// Seek through this group of buttons (determining length from last object's name).
|
||||
var max = this.name.substring (this.name.lastIndexOf ("_")+1, this.name.length);
|
||||
for (var loop = 1; loop <= max; loop++)
|
||||
{
|
||||
// Get name of current object in group.
|
||||
var tempName = this.name.substring (0, this.name.lastIndexOf ("_")+1) + loop;
|
||||
// Create coordinates for object (the actual coordinates are refreshed when the
|
||||
// resource is updated, so at this point we don't sweat that they have the same
|
||||
// coordinates).
|
||||
addCrds (tempName, 50, 0, -200, 4,
|
||||
snConst.MiniIcon.Width+54, 32);
|
||||
}
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="snResourceCounterIcon_1"
|
||||
style="snResourceIcon"
|
||||
type="button"
|
||||
/>
|
||||
<object name="snResourceCounterIcon_2"
|
||||
style="snResourceIcon"
|
||||
type="button"
|
||||
/>
|
||||
<object name="snResourceCounterIcon_3"
|
||||
style="snResourceIcon"
|
||||
type="button"
|
||||
/>
|
||||
<object name="snResourceCounterIcon_4"
|
||||
style="snResourceIcon"
|
||||
type="button"
|
||||
/>
|
||||
<object name="snResourceCounterIcon_5"
|
||||
style="snResourceIcon"
|
||||
type="button"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
// Seek through this group of buttons (determining length from last object's name).
|
||||
var max = this.name.substring (this.name.lastIndexOf ("_")+1, this.name.length);
|
||||
for (var loop = 1; loop <= max; loop++)
|
||||
{
|
||||
// Get name of current object in group.
|
||||
var tempName = this.name.substring (0, this.name.lastIndexOf ("_")+1) + loop;
|
||||
// Create coordinates for object (the actual coordinates are refreshed when the
|
||||
// resource is updated, so at this point we don't sweat that they have the same
|
||||
// coordinates).
|
||||
addCrds (tempName, 50, 0, -200, 4,
|
||||
32, 32);
|
||||
}
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
<!-- PAUSE/UNPAUSE GAME TITLE. -->
|
||||
<object name="snPause"
|
||||
type="button"
|
||||
font="prospero18b"
|
||||
hidden="true"
|
||||
hotkey="pause"
|
||||
text_align="center"
|
||||
text_valign="center"
|
||||
textcolor="gold"
|
||||
>Game is Paused
|
||||
<action on="Load"><![CDATA[
|
||||
var currCrd = getCrd ("snResourceCounter_1")
|
||||
addCrds (this.name, 50, 0, -200, currCrd.coord[rb].y+currCrd.coord[rb].height, 200, currCrd.coord[rb].y+currCrd.coord[rb].height+52, 50, 0);
|
||||
]]></action>
|
||||
<action on="Press"><![CDATA[
|
||||
setPaused( !isPaused() );
|
||||
getGUIObjectByName (this.name).hidden = (!(getGUIObjectByName (this.name).hidden));
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<!-- This object contains the status messages like ´Insufficient wood..´, etc -->
|
||||
<object name="globalMessageUnder"
|
||||
type="text"
|
||||
style="globalMessageStyleUnder"
|
||||
>
|
||||
</object>
|
||||
|
||||
<object name="globalMessage"
|
||||
type="text"
|
||||
style="globalMessageStyle"
|
||||
>
|
||||
</object>
|
||||
|
||||
//Shadow
|
||||
<object name="PlayersListShadow"
|
||||
type="text"
|
||||
style="PlayersListStyleShadow"
|
||||
>
|
||||
|
||||
<object name="PlayerShadow_1"
|
||||
type="text"
|
||||
style="PlayerStyleShadow"
|
||||
>
|
||||
</object>
|
||||
|
||||
<object name="PlayerShadow_2"
|
||||
type="text"
|
||||
style="PlayerStyleShadow"
|
||||
>
|
||||
</object>
|
||||
|
||||
<object name="PlayerShadow_3"
|
||||
type="text"
|
||||
style="PlayerStyleShadow"
|
||||
>
|
||||
</object>
|
||||
|
||||
|
||||
<object name="PlayerShadow_4"
|
||||
type="text"
|
||||
style="PlayerStyleShadow"
|
||||
>
|
||||
</object>
|
||||
|
||||
<object name="PlayerShadow_5"
|
||||
type="text"
|
||||
style="PlayerStyleShadow"
|
||||
>
|
||||
</object>
|
||||
|
||||
<object name="PlayerShadow_6"
|
||||
type="text"
|
||||
style="PlayerStyleShadow"
|
||||
>
|
||||
</object>
|
||||
|
||||
<object name="PlayerShadow_7"
|
||||
type="text"
|
||||
style="PlayerStyleShadow"
|
||||
>
|
||||
</object>
|
||||
|
||||
<object name="PlayerShadow_8"
|
||||
type="text"
|
||||
style="PlayerStyleShadow"
|
||||
>
|
||||
<action on="Load">
|
||||
<![CDATA[
|
||||
//Sets correct coordinates for each text object.
|
||||
for (var i=1; i<=8; i++)
|
||||
{
|
||||
addCrds("PlayerShadow_"+i, 0, 0, 0, i*14+1, 1, 0, 100, 100);
|
||||
}
|
||||
|
||||
]]>
|
||||
</action>
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
<!-- Players list -->
|
||||
<object name="PlayersList"
|
||||
type="text"
|
||||
hotkey="session.ShowPlayersList"
|
||||
style="PlayersListStyle"
|
||||
>
|
||||
|
||||
<action on="Press"><![CDATA[
|
||||
togglePlayersList();
|
||||
]]></action>
|
||||
|
||||
<object name="Player_1"
|
||||
type="text"
|
||||
style="PlayerStyle"
|
||||
>
|
||||
</object>
|
||||
|
||||
<object name="Player_2"
|
||||
type="text"
|
||||
style="PlayerStyle"
|
||||
>
|
||||
</object>
|
||||
|
||||
<object name="Player_3"
|
||||
type="text"
|
||||
style="PlayerStyle"
|
||||
>
|
||||
</object>
|
||||
|
||||
|
||||
<object name="Player_4"
|
||||
type="text"
|
||||
style="PlayerStyle"
|
||||
>
|
||||
</object>
|
||||
|
||||
<object name="Player_5"
|
||||
type="text"
|
||||
style="PlayerStyle"
|
||||
>
|
||||
</object>
|
||||
|
||||
<object name="Player_6"
|
||||
type="text"
|
||||
style="PlayerStyle"
|
||||
>
|
||||
</object>
|
||||
|
||||
<object name="Player_7"
|
||||
type="text"
|
||||
style="PlayerStyle"
|
||||
>
|
||||
</object>
|
||||
|
||||
<object name="Player_8"
|
||||
type="text"
|
||||
style="PlayerStyle"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
//Sets correct coordinates for each text object.
|
||||
for (var i=1; i<=8; i++)
|
||||
{
|
||||
addCrds("Player_"+i, 0, 0, 0, i*14, 0, 0, 100, 100);
|
||||
}
|
||||
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
|
||||
|
||||
<!-- GROUP: STATUS PANE -->
|
||||
<object name="snStatusPane"
|
||||
hotkey="session.statuspane.toggle"
|
||||
>
|
||||
<action on="Press"><![CDATA[
|
||||
guiToggle (this.name);
|
||||
]]></action>
|
||||
|
||||
<!-- STATUS PANE -->
|
||||
<object name="snStatusPaneBkg"
|
||||
style="snStatusPane"
|
||||
type="image"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
addCrds (this.name, 0, 100, 0, 0, 256, 128);
|
||||
]]></action>
|
||||
|
||||
<object name="snStatusPaneEmblem"
|
||||
style="snStatusPane"
|
||||
type="image"
|
||||
z="10"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
var currCrd = getCrd ("snStatusPaneBkg");
|
||||
addCrds (this.name, 0, 0, currCrd.coord[rb].x, currCrd.coord[rb].y,
|
||||
currCrd.coord[rb].width, currCrd.coord[rb].height);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="snStatusPanePortrait"
|
||||
style="snPortrait"
|
||||
type="button"
|
||||
hotkey="selection.snap"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
addCrds (this.name, 0, 0, 7, 11,
|
||||
snConst.Portrait.Lrg.Width, snConst.Portrait.Lrg.Height);
|
||||
]]></action>
|
||||
<action on="Press"><![CDATA[
|
||||
// Focus the camera on the unit when his portrait is clicked.
|
||||
if (selection[0].position)
|
||||
setCameraTarget(selection[0].position);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="snStatusPaneRank"
|
||||
style="snObject"
|
||||
type="text"
|
||||
sprite="snIconSheetRank"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
var currCrd = getCrd ("snStatusPanePortrait");
|
||||
addCrds (this.name, 0, 0, currCrd.coord[rb].x,
|
||||
currCrd.coord[rb].y, 25, 25);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="snStatusPaneHealthBar"
|
||||
style="snGreenBar"
|
||||
type="progressbar"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
var currCrd = getCrd ("snStatusPanePortrait");
|
||||
addCrds (this.name, 0, 0, currCrd.coord[rb].x+1,
|
||||
currCrd.coord[rb].y+currCrd.coord[rb].height+3, 35, 8);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="snStatusPaneStaminaBar"
|
||||
style="snBlueBar"
|
||||
type="progressbar"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
var currCrd = getCrd ("snStatusPaneHealthBar");
|
||||
addCrds (this.name, 0, 0, currCrd.coord[rb].x,
|
||||
currCrd.coord[rb].y+currCrd.coord[rb].height, currCrd.coord[rb].width, currCrd.coord[rb].height);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="snStatusPaneHealthBarText"
|
||||
style="snObject"
|
||||
type="text"
|
||||
text_align="left"
|
||||
text_valign="center"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
var currCrd = getCrd ("snStatusPaneHealthBar");
|
||||
var currCrd2 = getCrd ("snStatusPanePortrait");
|
||||
addCrds (this.name, 0, 0, currCrd.coord[rb].x+currCrd.coord[rb].width, currCrd.coord[rb].y, currCrd2.coord[rb].width-currCrd.coord[rb].width-2, currCrd.coord[rb].height);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="snStatusPaneStaminaBarText"
|
||||
style="snObject"
|
||||
type="text"
|
||||
text_align="left"
|
||||
text_valign="center"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
var currCrd = getCrd ("snStatusPaneHealthBarText");
|
||||
var currCrd2 = getCrd ("snStatusPaneStaminaBar");
|
||||
addCrds (this.name, 0, 0, currCrd.coord[rb].x, currCrd2.coord[rb].y, currCrd.coord[rb].width, currCrd.coord[rb].height);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="snStatusPaneText"
|
||||
style="snObject"
|
||||
type="text"
|
||||
buffer_zone="5"
|
||||
text_align="left"
|
||||
text_valign="top"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
var currCrd = getCrd ("snStatusPanePortrait");
|
||||
addCrds (this.name, 0, 0, currCrd.coord[rb].x+currCrd.coord[rb].width+3,
|
||||
currCrd.coord[rb].y-1, 190, currCrd.coord[rb].height);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="snStatusPaneSupplyIcon"
|
||||
style="snObject"
|
||||
type="text"
|
||||
cell_id="0"
|
||||
sprite="snIconSheetResource"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
var currCrd = getCrd ("snStatusPaneText");
|
||||
addCrds (this.name, 0, 0, currCrd.coord[rb].x,
|
||||
currCrd.coord[rb].y+currCrd.coord[rb].height+2, 20, 20);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="snStatusPaneSupply"
|
||||
style="snObject"
|
||||
type="text"
|
||||
sprite="bkDarkGrayBorderBlack"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
var currCrd = getCrd ("snStatusPaneSupplyIcon");
|
||||
addCrds (this.name, 0, 0, currCrd.coord[rb].x+currCrd.coord[rb].width,
|
||||
currCrd.coord[rb].y, 64, currCrd.coord[rb].height);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="snStatusPaneGarrisonIcon"
|
||||
style="snObject"
|
||||
type="text"
|
||||
cell_id="0"
|
||||
sprite="snIconSheetGarrison"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
var currCrd = getCrd ("snStatusPaneSupply");
|
||||
var currCrd2 = getCrd ("snStatusPaneSupplyIcon");
|
||||
addCrds (this.name, 0, 0, currCrd.coord[rb].x+currCrd.coord[rb].width,
|
||||
currCrd.coord[rb].y, currCrd2.coord[rb].width, currCrd.coord[rb].height);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="snStatusPaneGarrison"
|
||||
style="snObject"
|
||||
type="text"
|
||||
sprite="bkDarkGrayBorderBlack"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
var currCrd = getCrd ("snStatusPaneSupply");
|
||||
var currCrd2 = getCrd ("snStatusPaneGarrisonIcon");
|
||||
addCrds (this.name, 0, 0, currCrd2.coord[rb].x+currCrd2.coord[rb].width, currCrd2.coord[rb].y, currCrd.coord[rb].width, currCrd.coord[rb].height);
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
<object name="snStatusPaneStat_1" style="snStat" type="button" />
|
||||
<object name="snStatusPaneStat_2" style="snStat" type="button" />
|
||||
<object name="snStatusPaneStat_3" style="snStat" type="button" />
|
||||
<object name="snStatusPaneStat_4" style="snStat" type="button" />
|
||||
<object name="snStatusPaneStat_5" style="snStat" type="button" />
|
||||
<object name="snStatusPaneStat_6" style="snStat" type="button" />
|
||||
<object name="snStatusPaneStat_7" style="snStat" type="button" />
|
||||
<object name="snStatusPaneStat_8" style="snStat" type="button"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
// Seek through this group of buttons (determining length from last object's name).
|
||||
var max = this.name.substring (this.name.lastIndexOf ("_")+1, this.name.length);
|
||||
var currCrd = getCrd ("snStatusPaneBkg");
|
||||
var currCrd3 = getCrd ("snStatusPanePortrait");
|
||||
for (loop = 1; loop <= max; loop++)
|
||||
{
|
||||
// Get name of current object in group.
|
||||
tempName = this.name.substring (0, this.name.lastIndexOf ("_")+1) + loop;
|
||||
|
||||
// Set width as either icon (odd) or text (even).
|
||||
if (loop % 2 == 0)
|
||||
tempWidth = (currCrd.coord[rb].width/max + 7);
|
||||
else
|
||||
tempWidth = 16;
|
||||
|
||||
if (loop == 1)
|
||||
{
|
||||
// Define first stat.
|
||||
addCrds (tempName, 0, 0, currCrd3.coord[rb].x,
|
||||
currCrd.coord[rb].y+currCrd.coord[rb].height-28,
|
||||
tempWidth, 16);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get previous stat.
|
||||
var currCrd2 = getCrd (this.name.substring (0, this.name.lastIndexOf ("_")+1) + (loop-1));
|
||||
// Align to the right of it.
|
||||
addCrds (tempName, 0, 0, currCrd2.coord[rb].x + currCrd2.coord[rb].width, currCrd2.coord[rb].y, tempWidth, currCrd2.coord[rb].height);
|
||||
}
|
||||
}
|
||||
]]></action>
|
||||
</object>
|
||||
|
||||
</object>
|
||||
|
||||
<!-- COMMAND BUTTONS (arc the Status Pane) -->
|
||||
<object name="snStatusPaneCommand1_1"
|
||||
style="snPortrait"
|
||||
type="button"
|
||||
z="100"
|
||||
>
|
||||
</object>
|
||||
<object name="snStatusPaneCommandGroup1" >
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand1_2" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand1_3" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand1_4" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand1_5" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand1_6" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand1_7" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand1_8" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand1_9" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand1_10" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand1_11" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand1_12" />
|
||||
</object>
|
||||
<object name="snStatusPaneCommand2_1"
|
||||
style="snPortrait"
|
||||
type="button"
|
||||
z="100"
|
||||
/>
|
||||
<object name="snStatusPaneCommandGroup2" >
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand2_2" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand2_3" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand2_4" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand2_5" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand2_6" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand2_7" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand2_8" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand2_9" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand2_10" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand2_11" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand2_12" />
|
||||
</object>
|
||||
<object name="snStatusPaneCommand3_1"
|
||||
style="snPortrait"
|
||||
type="button"
|
||||
z="100"
|
||||
/>
|
||||
<object name="snStatusPaneCommandGroup3" >
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand3_2" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand3_3" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand3_4" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand3_5" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand3_6" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand3_7" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand3_8" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand3_9" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand3_10" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand3_11" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand3_12" />
|
||||
</object>
|
||||
<object name="snStatusPaneCommand4_1"
|
||||
style="snPortrait"
|
||||
type="button"
|
||||
z="100"
|
||||
/>
|
||||
<object name="snStatusPaneCommandGroup4" >
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand4_2" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand4_3" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand4_4" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand4_5" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand4_6" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand4_7" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand4_8" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand4_9" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand4_10" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand4_11" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand4_12" />
|
||||
</object>
|
||||
<object name="snStatusPaneCommand5_1"
|
||||
style="snPortrait"
|
||||
type="button"
|
||||
z="100"
|
||||
/>
|
||||
<object name="snStatusPaneCommandGroup5" >
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand5_2" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand5_3" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand5_4" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand5_5" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand5_6" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand5_7" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand5_8" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand5_9" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand5_10" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand5_11" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand5_12" />
|
||||
</object>
|
||||
<object name="snStatusPaneCommand6_1"
|
||||
style="snPortrait"
|
||||
type="button"
|
||||
z="100"
|
||||
/>
|
||||
<object name="snStatusPaneCommandGroup6" >
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand6_2" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand6_3" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand6_4" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand6_5" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand6_6" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand6_7" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand6_8" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand6_9" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand6_10" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand6_11" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand6_12" />
|
||||
</object>
|
||||
<object name="snStatusPaneCommand7_1"
|
||||
style="snPortrait"
|
||||
type="button"
|
||||
z="100"
|
||||
/>
|
||||
<object name="snStatusPaneCommandGroup7" >
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand7_2" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand7_3" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand7_4" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand7_5" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand7_6" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand7_7" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand7_8" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand7_9" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand7_10" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand7_11" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand7_12" />
|
||||
</object>
|
||||
<object name="snStatusPaneCommand8_1"
|
||||
style="snPortrait"
|
||||
type="button"
|
||||
z="10"
|
||||
/>
|
||||
<object name="snStatusPaneCommandGroup8" >
|
||||
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_2Bar" />
|
||||
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_3Bar" />
|
||||
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_4Bar" />
|
||||
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_5Bar" />
|
||||
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_6Bar" />
|
||||
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_7Bar" />
|
||||
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_8Bar" />
|
||||
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_9Bar" />
|
||||
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_10Bar" />
|
||||
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_11Bar" />
|
||||
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_12Bar" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand8_2" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand8_3" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand8_4" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand8_5" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand8_6" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand8_7" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand8_8" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand8_9" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand8_10" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand8_11" />
|
||||
<object style="snPortrait" type="button" name="snStatusPaneCommand8_12"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
defineCommandButtons(this.name);
|
||||
]]></action>
|
||||
</object>
|
||||
</object>
|
||||
<!--
|
||||
<object name="snStatusPaneCommandProgress"
|
||||
style="snPortraitProgress"
|
||||
type="progressbar"
|
||||
hidden="true"
|
||||
>
|
||||
<action on="Load"><![CDATA[
|
||||
addCrds (this.name, 0, 100,
|
||||
getCrd ("snStatusPaneBkg").coord[rb].x
|
||||
+getCrd ("snStatusPaneBkg").coord[rb].width,
|
||||
getCrd ("snStatusPaneBkg").coord[rb].y+getCrd ("snStatusPaneBkg").coord[rb].height,
|
||||
snConst.Portrait.Sml.Width, snConst.Portrait.Sml.Height);
|
||||
]]></action>
|
||||
</object>
|
||||
-->
|
||||
</object>
|
||||
</object>
|
||||
|
||||
</objects>
|
||||
|
||||
|
||||
|
||||
|
@ -1,94 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<sprites>
|
||||
|
||||
<!--
|
||||
==========================================
|
||||
RESOURCE COUNTER
|
||||
==========================================
|
||||
-->
|
||||
|
||||
<sprite name="snCounter">
|
||||
<image texture="session/counter_tile.dds"
|
||||
real_texture_placement="0 0 32 32"
|
||||
size="0%+32 0% 100%-32 0%+32"
|
||||
/>
|
||||
<image texture="session/counter_edge.dds"
|
||||
real_texture_placement="0 0 32 32"
|
||||
size="100%-32 0% 100% 0%+32"
|
||||
/>
|
||||
<image texture="session/counter_icon.dds"
|
||||
real_texture_placement="0 0 32 32"
|
||||
size="0% 0% 0%+32 0%+32"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<!--
|
||||
==========================================
|
||||
STATUS PANE
|
||||
==========================================
|
||||
-->
|
||||
|
||||
<sprite name="snStatusPane">
|
||||
<image texture="session/status_pane.dds"
|
||||
size="0 0 100% 100%"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<!--
|
||||
==========================================
|
||||
STATUS PANE CIVILISATION OVERLAYS
|
||||
==========================================
|
||||
-->
|
||||
|
||||
<sprite name="snStatusPaneEmblemCart">
|
||||
<image texture="session/status_pane_cart.dds"
|
||||
size="0 0 100% 100%"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="snStatusPaneEmblemCelt">
|
||||
<image texture="session/status_pane_celt.dds"
|
||||
size="0 0 100% 100%"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="snStatusPaneEmblemHele">
|
||||
<image texture="session/status_pane_hele.dds"
|
||||
size="0 0 100% 100%"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="snStatusPaneEmblemIber">
|
||||
<image texture="session/status_pane_iber.dds"
|
||||
size="0 0 100% 100%"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="snStatusPaneEmblemPers">
|
||||
<image texture="session/status_pane_pers.dds"
|
||||
size="0 0 100% 100%"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<sprite name="snStatusPaneEmblemRome">
|
||||
<image texture="session/status_pane_rome.dds"
|
||||
size="0 0 100% 100%"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
<!--
|
||||
==========================================
|
||||
MINIMAP
|
||||
==========================================
|
||||
-->
|
||||
|
||||
<sprite name="snMiniMapBorder">
|
||||
<image texture="session/minimap_pane.dds"
|
||||
real_texture_placement="0 0 174 172"
|
||||
size="0 0 100% 100%"
|
||||
/>
|
||||
</sprite>
|
||||
|
||||
</sprites>
|
||||
|
@ -1,186 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<styles>
|
||||
<style name="snObject"
|
||||
tooltip_style="snToolTip"
|
||||
tooltip=""
|
||||
/>
|
||||
|
||||
<style name="snAction"
|
||||
sprite="snIconCommand"
|
||||
sprite_over="snIconCommandOver"
|
||||
sprite_disabled="snIconCommandDisabled"
|
||||
text_align="right"
|
||||
textcolor="255 255 255"
|
||||
tooltip_style="snToolTip"
|
||||
tooltip="(TBA)"
|
||||
/>
|
||||
|
||||
<style name="snPortrait"
|
||||
sprite="snIconPortrait"
|
||||
sprite_over="snIconPortraitOver"
|
||||
sprite_disabled="snIconPortraitDisabled"
|
||||
text_align="right"
|
||||
textcolor="255 255 255"
|
||||
tooltip_style="snToolTip"
|
||||
tooltip="(TBA)"
|
||||
/>
|
||||
|
||||
<style name="snPortraitProgress"
|
||||
sprite_background=""
|
||||
sprite_bar="bkTranslucent"
|
||||
text_align="center"
|
||||
text_valign="center"
|
||||
textcolor="255 255 255"
|
||||
tooltip_style="snToolTip"
|
||||
tooltip="(TBA)"
|
||||
/>
|
||||
|
||||
<style name="snIcon"
|
||||
ghost="true"
|
||||
/>
|
||||
|
||||
<style name="snResourceIcon"
|
||||
ghost="true"
|
||||
sprite="snIconSheetResource"
|
||||
z="100"
|
||||
/>
|
||||
|
||||
<style name="snStat"
|
||||
text_align="left"
|
||||
text_valign="center"
|
||||
font="tahoma14"
|
||||
textcolor="white"
|
||||
tooltip_style="snToolTip"
|
||||
ghost="true"
|
||||
/>
|
||||
|
||||
<style name="snCounter"
|
||||
sprite="snCounter"
|
||||
text_align="right"
|
||||
text_valign="center"
|
||||
font="tahoma14"
|
||||
textcolor="white"
|
||||
tooltip_style="snToolTip"
|
||||
ghost="false"
|
||||
/>
|
||||
|
||||
<style name="snStatusPane"
|
||||
sprite="snStatusPane"
|
||||
buffer_zone="10"
|
||||
text_align="left"
|
||||
text_valign="top"
|
||||
/>
|
||||
|
||||
<style name="snMiniMapBorder"
|
||||
sprite="snMiniMapBorder"
|
||||
buffer_zone="10"
|
||||
ghost="true"
|
||||
text_align="left"
|
||||
text_valign="top"
|
||||
/>
|
||||
|
||||
<style name="snMiniMapArcLeft"
|
||||
sprite="snIconArcLeft"
|
||||
sprite_over="snIconArcLeftOver"
|
||||
sprite_disabled="snIconArcLeftDisabled"
|
||||
tooltip_style="snToolTip"
|
||||
ghost="false"
|
||||
enabled="false"
|
||||
/>
|
||||
|
||||
<style name="snMiniMapArcUp"
|
||||
sprite="snIconArcUp"
|
||||
sprite_over="snIconArcUpOver"
|
||||
sprite_disabled="snIconArcUpDisabled"
|
||||
tooltip_style="snToolTip"
|
||||
ghost="false"
|
||||
enabled="false"
|
||||
/>
|
||||
|
||||
<style name="snMiniMapButton"
|
||||
text_align="left"
|
||||
text_valign="center"
|
||||
font="tahoma14"
|
||||
textcolor="white"
|
||||
tooltip_style="snToolTip"
|
||||
sprite="snIconSheetMiniMapButton"
|
||||
sprite_over="snIconSheetMiniMapButtonOver"
|
||||
sprite_disabled="snIconSheetMiniMapButtonDisabled"
|
||||
ghost="false"
|
||||
enabled="false"
|
||||
/>
|
||||
|
||||
<style name="snGreenBar"
|
||||
sprite_background=""
|
||||
sprite_bar="bkGreenBar"
|
||||
ghost="true"
|
||||
tooltip_style="snToolTip"
|
||||
tooltip="(TBA)"
|
||||
/>
|
||||
|
||||
<style name="snBlueBar"
|
||||
sprite_background=""
|
||||
sprite_bar="bkBlueBar"
|
||||
ghost="true"
|
||||
tooltip_style="snToolTip"
|
||||
tooltip="(TBA)"
|
||||
/>
|
||||
|
||||
<style name="globalMessageStyle"
|
||||
hidden="true"
|
||||
text_align="left"
|
||||
text_valign="top"
|
||||
textcolor="255 255 255"
|
||||
ghost="true"
|
||||
font="trebuchet14b"
|
||||
size="6 150 100% 30%"
|
||||
/>
|
||||
|
||||
<!-- This is for creating a small 1px. shadow so the text is visible on the bright maps. -->
|
||||
<style name="globalMessageStyleUnder"
|
||||
hidden="true"
|
||||
text_align="left"
|
||||
text_valign="top"
|
||||
textcolor="50 50 50"
|
||||
ghost="true"
|
||||
font="trebuchet14b"
|
||||
size="5 150 100% 30%"
|
||||
/>
|
||||
|
||||
|
||||
<style name="PlayersListStyle"
|
||||
hidden="true"
|
||||
text_align="right"
|
||||
text_valign="bottom"
|
||||
textcolor="white"
|
||||
ghost="true"
|
||||
font="trebuchet14b"
|
||||
size="100%-500 100%-320 100% 100%-180"
|
||||
/>
|
||||
|
||||
<style name="PlayersListStyleShadow"
|
||||
hidden="true"
|
||||
text_align="right"
|
||||
text_valign="bottom"
|
||||
textcolor="50 50 50"
|
||||
ghost="true"
|
||||
font="trebuchet14b"
|
||||
size="100%-500 100%-320 100% 100%-180"
|
||||
/>
|
||||
|
||||
<style name="PlayerStyle"
|
||||
ghost="true"
|
||||
textcolor="white"
|
||||
text_align="right"
|
||||
font="trebuchet14b"
|
||||
/>
|
||||
|
||||
<style name="PlayerStyleShadow"
|
||||
ghost="true"
|
||||
textcolor="50 50 50"
|
||||
text_align="right"
|
||||
font="trebuchet14b"
|
||||
/>
|
||||
|
||||
</styles>
|
Loading…
Reference in New Issue
Block a user