1
0
forked from mirrors/0ad

* Adjusted position of buttons so they arc the Status Pane.

* Started work on health bars below selection/garrison row (hidden for
now, as it's buggy).
* Implemented Jason's civ emblem icons.

This was SVN commit r3613.
This commit is contained in:
Acumen
2006-03-08 19:13:56 +00:00
parent efffb34f4a
commit 78710b8ff1
12 changed files with 1202 additions and 3420 deletions
@@ -503,7 +503,7 @@
style="wheatBorderBlack"
type="button"
size="30 35 100%-30 100%-45"
sprite="pgSessionSetupCivSelTmp"
sprite="snEmblemHele"
tooltip_style="pgSessionSetupToolTip"
tooltip="Click here to change the civilization you would like to play."
/>
@@ -511,7 +511,7 @@
style="wheatTextHeadMaxBlack"
type="text"
size="30 100%-35 100%-30 100%-5"
>Pink Rabbits (i)
>Hellenes (i)
</object>
</object>
@@ -258,6 +258,17 @@
]]></action>
</object>
<object name="snStatusPaneEmblem"
style="snObject"
type="text"
>
<action on="Load"><![CDATA[
currCrd = getCrd ("snStatusPanePortrait");
addCrds (this.name, 0, 0, currCrd.coord[rb].x+currCrd.coord[rb].width-25,
currCrd.coord[rb].y, 25, 25);
]]></action>
</object>
<object name="snStatusPaneHealthBar"
style="snGreenBar"
type="progressbar"
@@ -499,52 +510,39 @@
type="button"
/>
<object name="snStatusPaneCommandGroup8" >
<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" />
</object>
<object name="snStatusPaneCommand9_1"
style="snPortrait"
type="button"
/>
<object name="snStatusPaneCommandGroup9" >
<object style="snPortrait" type="button" name="snStatusPaneCommand9_2" />
<object style="snPortrait" type="button" name="snStatusPaneCommand9_3" />
<object style="snPortrait" type="button" name="snStatusPaneCommand9_4" />
<object style="snPortrait" type="button" name="snStatusPaneCommand9_5" />
<object style="snPortrait" type="button" name="snStatusPaneCommand9_6" />
<object style="snPortrait" type="button" name="snStatusPaneCommand9_7" />
<object style="snPortrait" type="button" name="snStatusPaneCommand9_8" />
<object style="snPortrait" type="button" name="snStatusPaneCommand9_9" />
<object style="snPortrait" type="button" name="snStatusPaneCommand9_10" />
<object style="snPortrait" type="button" name="snStatusPaneCommand9_11" />
<object style="snPortrait" type="button" name="snStatusPaneCommand9_12" />
</object>
<object name="snStatusPaneCommand10_1"
style="snPortrait"
type="button"
/>
<object name="snStatusPaneCommandGroup10" >
<object style="snPortrait" type="button" name="snStatusPaneCommand10_2" />
<object style="snPortrait" type="button" name="snStatusPaneCommand10_3" />
<object style="snPortrait" type="button" name="snStatusPaneCommand10_4" />
<object style="snPortrait" type="button" name="snStatusPaneCommand10_5" />
<object style="snPortrait" type="button" name="snStatusPaneCommand10_6" />
<object style="snPortrait" type="button" name="snStatusPaneCommand10_7" />
<object style="snPortrait" type="button" name="snStatusPaneCommand10_8" />
<object style="snPortrait" type="button" name="snStatusPaneCommand10_9" />
<object style="snPortrait" type="button" name="snStatusPaneCommand10_10" />
<object style="snPortrait" type="button" name="snStatusPaneCommand10_11" />
<object style="snPortrait" type="button" name="snStatusPaneCommand10_12"
<object style="snPortrait" type="button" name="snStatusPaneCommand8_2">
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_2Bar" />
</object>
<object style="snPortrait" type="button" name="snStatusPaneCommand8_3">
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_3Bar" />
</object>
<object style="snPortrait" type="button" name="snStatusPaneCommand8_4">
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_4Bar" />
</object>
<object style="snPortrait" type="button" name="snStatusPaneCommand8_5">
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_5Bar" />
</object>
<object style="snPortrait" type="button" name="snStatusPaneCommand8_6">
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_6Bar" />
</object>
<object style="snPortrait" type="button" name="snStatusPaneCommand8_7">
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_7Bar" />
</object>
<object style="snPortrait" type="button" name="snStatusPaneCommand8_8">
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_8Bar" />
</object>
<object style="snPortrait" type="button" name="snStatusPaneCommand8_9">
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_9Bar" />
</object>
<object style="snPortrait" type="button" name="snStatusPaneCommand8_10">
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_10Bar" />
</object>
<object style="snPortrait" type="button" name="snStatusPaneCommand8_11">
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_11Bar" />
</object>
<object style="snPortrait" type="button" name="snStatusPaneCommand8_12"
>
<object style="snGreenBar" type="progressbar" name="snStatusPaneCommand8_12Bar" />
<action on="Load"><![CDATA[
defineCommandButtons(this.name);
]]></action>
@@ -13,16 +13,14 @@ function defineCommandButtons(command)
snStatusPaneCommand.button = new Object();
// Maximum number of buttons (either single or lists).
snStatusPaneCommand.tab.max = command.substring (command.lastIndexOf ("d")+1, command.lastIndexOf ("_")); // 10
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
// Number of tabs that have to be single buttons (no list).
snStatusPaneCommand.button.max = 5;
// When we reach this button, split the rows (remainder are vertical, not horizontal).
snStatusPaneCommand.split = 7;
snStatusPaneCommand.split = 5;
// Spacing between lists.
snStatusPaneCommand.span = 2;
snStatusPaneCommand.span = 1;
// Get the coordinates of the Status Pane background (referenced to determine command button locations).
currCrd = getCrd ("snStatusPaneBkg");
@@ -32,59 +30,105 @@ function defineCommandButtons(command)
{
tempGroupObject = getGUIObjectByName("snStatusPaneCommand" +
"Group" + tabLoop);
// Update each list under each tab.
for (var listLoop = 1; listLoop <= snStatusPaneCommand.list.max; listLoop++)
{
tempListObject = getGUIObjectByName("snStatusPaneCommand" +
tabLoop + "_" + listLoop);
// Set portrait to default.
// 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;
// Determine x and y position for current button.
// If we're doing the arc of commands.
if (tabLoop >= snStatusPaneCommand.split)
{
if (listLoop == 1)
{
var x = currCrd.coord[rb].x+currCrd.coord[rb].width-14;
if (tabLoop == snStatusPaneCommand.split && listLoop == 1)
var y = currCrd.coord[rb].y;
else
var y = Crd[Crd.last].coord[rb].y+Crd[Crd.last].coord[rb].height
+snStatusPaneCommand.span;
if (tabLoop > snStatusPaneCommand.split)
{
// Get the first tab.
firstTab = getCrd ("snStatusPaneCommand" + (snStatusPaneCommand.split) + "_" + listLoop);
// Get the previous tab.
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;
var barX = buttonX;
var barY = buttonY;
break;
}
// Set default portrait.
setPortrait (tempListObject.name, "IconCommand");
}
else
{
var x = Crd[Crd.last].coord[rb].x+Crd[Crd.last].coord[rb].width
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 y = Crd[Crd.last].coord[rb].y;
var buttonY = parentTab.coord[rb].y;
}
}
else
else // If we're doing the row of tabs,
{
// Set position of tab.
if (listLoop == 1)
{
if (tabLoop == 1 && listLoop == 1)
var x = currCrd.coord[rb].x;
var buttonX = currCrd.coord[rb].x;
else
var x = Crd[Crd.last].coord[rb].x+Crd[Crd.last].coord[rb].width
var buttonX = Crd[Crd.last].coord[rb].x+Crd[Crd.last].coord[rb].width
+snStatusPaneCommand.span;
var y = currCrd.coord[rb].y+currCrd.coord[rb].height-7;
var buttonY = currCrd.coord[rb].y+currCrd.coord[rb].height-7;
}
else
else // Set position of buttons under tab.
{
var x = Crd[Crd.last].coord[rb].x;
var y = Crd[Crd.last].coord[rb].y+Crd[Crd.last].coord[rb].height
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, x, y,
snConst.Portrait.Sml.Width, snConst.Portrait.Sml.Height);
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;
//console.write ("Done health bar " + "snStatusPaneCommand" + tabLoop + "_" + listLoop + "Bar:" + buttonX + " " + buttonY);
}
/*
// Store indexes to the button for easy future reference.
Crd[getCrd ("snStatusPaneCommand" + tabLoop + "_" + listLoop, true)].tab = tabLoop;
@@ -405,7 +449,6 @@ function refreshCommandButtons()
}
else
{
console.write ("No buttons");
// Ensure tabs should be cleanable.
listCounter = 1;
commandCounter = snStatusPaneCommand.split-1;
@@ -65,7 +65,6 @@ textCaption += '[font=verdana10][color="' + Math.round(selection[0].player.getCo
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=optimus12][color=gold]" + selection[0].traits.id.generic + "[/color][/font]";
console.write (textCaption);
getGUIObjectByName ("snStatusPaneText").caption = textCaption;
}
@@ -85,6 +84,16 @@ console.write (textCaption);
rankObject.hidden = true;
}
// Update civilisation emblem.
if ( selectionChanged )
{
emblemObject = getGUIObjectByName ("snStatusPaneEmblem");
if (selection[0].traits.id.civ_code != "gaia")
emblemObject.sprite = "snEmblem" + toTitleCase (selection[0].traits.id.civ_code);
else
emblemObject.sprite = "";
}
// Update garrison capacity.
if( shouldUpdateStat( "traits.garrison" ) )
{
@@ -135,8 +144,7 @@ console.write (textCaption);
}
// Refresh command buttons.
if( shouldUpdateStat( "actions" ) )
refreshCommandButtons();
refreshCommandButtons();
}
// ====================================================================
@@ -675,6 +675,48 @@
/>
</sprite>
<!--
==========================================
CIV EMBLEMS
==========================================
-->
<sprite name="snEmblemCelt">
<image texture="session/icons/emblems/celt.dds"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="snEmblemHele">
<image texture="session/icons/emblems/hele.dds"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="snEmblemIber">
<image texture="session/icons/emblems/iber.dds"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="snEmblemKart">
<image texture="session/icons/emblems/kart.dds"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="snEmblemPers">
<image texture="session/icons/emblems/pers.dds"
size="0 0 100% 100%"
/>
</sprite>
<sprite name="snEmblemRome">
<image texture="session/icons/emblems/rome.dds"
size="0 0 100% 100%"
/>
</sprite>
<!--
==========================================
STATUS PANE
@@ -2927,11 +2969,4 @@ NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET CONVERTED NOT YET
<image size="0 0 100% 100%" backcolor="50 50 50" />
</sprite>
<!-- TEMP GAME SETUP UI -->
<sprite name="pgSessionSetupCivSelTmp">
<image texture="global/icon/hele.dds" texture_size="0 0 100% 100%" size="0 0 100% 100%" />
</sprite>
</sprites>
+1033 -3335
View File
File diff suppressed because it is too large Load Diff