1
0
forked from 0ad/0ad

Added rank icon

Removed displayed rank name (functions still available)
Fixed error with color name

This was SVN commit r7675.
This commit is contained in:
WhiteTreePaladin 2010-07-03 15:06:31 +00:00
parent 9332a20998
commit e23d4d232a
5 changed files with 60 additions and 5 deletions

View File

@ -36,7 +36,7 @@ function selectionLayoutSingle()
getGUIObjectByName("selectionDetailsArmour").hidden = false;
getGUIObjectByName("selectionDetailsMainText").sprite = "";
getGUIObjectByName("selectionDetailsSpecific").sprite = "wheatWindowTitle";
getGUIObjectByName("selectionDetailsSpecific").sprite = "";
}
// Fills out information that most entities have
@ -48,10 +48,14 @@ function displayGeneralInfo(playerState, entState, template)
var iconTooltip = "";
// Is unit Elite?
var eliteStatus = isUnitElite(entState.template);
// var eliteStatus = isUnitElite(entState.template);
// Rank Icon
getGUIObjectByName("rankIconImage").sprite = "snIconSheetRank";
getGUIObjectByName("rankIconImage").cell_id = getRankCellId(entState.template);
// Specific Name
var name = (eliteStatus? "Elite " + template.name.specific : template.name.specific);
var name = template.name.specific; // (eliteStatus? "Elite " + template.name.specific : template.name.specific);
getGUIObjectByName("selectionDetailsSpecific").caption = name;
iconTooltip += "[font=\"serif-bold-16\"]" + name + "[/font]";

View File

@ -201,6 +201,53 @@ function damageTypesToText(dmg)
return dmgArray.join(", ");
}
/*
function isUnitElite(templateName)
{
var eliteStatus = false;
var firstWord = getTemplateFirstWord(templateName);
var endsWith = templateName.substring(templateName.length-2, templateName.length);
if (firstWord == "units" && endsWith == "_e")
eliteStatus = true;
return eliteStatus;
}
function getRankTitle(templateName)
{
var firstWord = getTemplateFirstWord(templateName);
var endsWith = templateName.substring(templateName.length-2, templateName.length);
if (firstWord == "units")
{
if (endsWith == "_e")
return " Elite";
else if (endsWith == "_a")
return " Advanced";
}
return "";
}
*/
function getRankCellId(templateName)
{
var firstWord = getTemplateFirstWord(templateName);
var endsWith = templateName.substring(templateName.length-2, templateName.length);
if (firstWord == "units")
{
if (endsWith == "_e")
return 0;
else if (endsWith == "_a")
return 1;
}
return -1;
}
function isUnitElite(templateName)
{
var eliteStatus = false;

View File

@ -315,6 +315,7 @@
<!-- Details text -->
<object size="10 0 100%-10 56" name="selectionDetailsMainText" type="image" sprite="wheatWindowTitle">
<object size="0 0 32 32" name="rankIconImage" type="image" cell_id="0" tooltip_style="snToolTip"/>
<object size="0 5 100% 30" name="selectionDetailsSpecific" type="text" style="largeBoldCenteredText" tooltip_style="snToolTip"/>
<object hidden="true" size="0 20 100% 40" name="selectionDetailsGeneric" type="text" font="serif-14"/>
<object size="0 30 100% 50" name="selectionDetailsPlayer" type="text" style="centeredText" font="serif-bold-14" tooltip_style="snToolTip"/>
@ -349,11 +350,14 @@
hidden="true"
z="0"
>
<!--
<object name="bronzeSquares"
type="image"
sprite="bronzeCommandsSquares"
size="56 10 414 100%"
/>
-->
<object name="unitConstructionPanel"
size="0 10 100% 33%"

View File

@ -34,7 +34,7 @@ function setupUnitPanel(guiName, usedPanels, playerState, unitEntState, items, c
name = getFullName(template);
// Tooltip
var tooltip = (isUnitElite(entType)? "Elite " + name : name ); // "Elite " is not formatted in bold, so may need custom versions of this later
var tooltip = name; //(isUnitElite(entType)? "Elite " + name : name );
if (guiName == "Selection")
{

View File

@ -28,7 +28,7 @@ GuiInterface.prototype.GetSimulationState = function(player)
var playerData = {
"name": cmpPlayer.GetName(),
"civ": cmpPlayer.GetCiv(),
"colour": cmpPlayer.GetColour(),
"color": cmpPlayer.GetColour(),
"popCount": cmpPlayer.GetPopulationCount(),
"popLimit": cmpPlayer.GetPopulationLimit(),
"resourceCounts": cmpPlayer.GetResourceCounts()