Make use of the grayscale opion.

Move some icon files to a more adequate location.
Closes #1214 as that was already commited and this commit fixes some
minor issues.

This was SVN commit r11459.
This commit is contained in:
leper 2012-04-08 22:56:11 +00:00
parent f3a393d2e5
commit c93f17827f
67 changed files with 22 additions and 66 deletions

View File

@ -590,10 +590,10 @@
<!-- Stats -->
<object size="8 36 50%-48 100%" name="statsArea" type="image">
<!-- Attack icon -->
<object hidden="true" size="0 0 48 48" type="image" name="attackIcon" sprite="stretched:session/icons/single/stance-aggressive.png" tooltip_style="sessionToolTip"/>
<object hidden="true" size="0 0 48 48" type="image" name="attackIcon" sprite="stretched:session/icons/stances/aggressive.png" tooltip_style="sessionToolTip"/>
<!-- Armour icon "0 48 48 96"-->
<object size="0 0 48 48" type="image" name="armourIcon" sprite="stretched:session/icons/single/stance-defensive.png" tooltip_style="sessionToolTip"/>
<object size="0 0 48 48" type="image" name="armourIcon" sprite="stretched:session/icons/stances/defensive.png" tooltip_style="sessionToolTip"/>
<!-- Resource carrying icon/counter -->
<object size="0 40 48 88" type="image" name="resourceCarryingIcon" style="resourceIcon"/>

View File

@ -4,7 +4,7 @@
<sprite name="groupsIcon">
<image
texture="session/icons/single/groups.png"
texture="session/icons/groups.png"
size="0 0 100% 100%"
/>
</sprite>

View File

@ -301,7 +301,7 @@ function setupUnitPanel(guiName, usedPanels, unitEntState, items, callback)
button.enabled = formationOk;
if (!formationOk)
{
icon.sprite = "stretched:grayscale:session/icons/formations/formation-"+item.replace(/\s+/,'').toLowerCase()+".png";
icon.sprite = "stretched:grayscale:session/icons/formations/"+item.replace(/\s+/,'').toLowerCase()+".png";
// Display a meaningful tooltip why the formation is disabled
var requirements = Engine.GuiInterfaceCall("GetFormationRequirements", {
@ -329,9 +329,11 @@ function setupUnitPanel(guiName, usedPanels, unitEntState, items, callback)
});
if (formationSelected)
icon.sprite = "stretched:session/icons/formations/formation-"+item.replace(/\s+/,'').toLowerCase()+"-selected.png";
// TODO: add another layer on top displaying icons/corners.png
// If doing this move the icon.sprite code out of the if (!formationOk) else block
icon.sprite = "stretched:session/icons/formations/"+item.replace(/\s+/,'').toLowerCase()+"-selected.png";
else
icon.sprite = "stretched:session/icons/formations/formation-"+item.replace(/\s+/,'').toLowerCase()+".png";
icon.sprite = "stretched:session/icons/formations/"+item.replace(/\s+/,'').toLowerCase()+".png";
}
}
else if (guiName == "Stance")
@ -342,9 +344,10 @@ function setupUnitPanel(guiName, usedPanels, unitEntState, items, callback)
});
if (stanceSelected)
icon.sprite = "stretched:session/icons/single/stance-"+item+"-select.png";
// TODO: add another layer on top displaying icons/corners.png
icon.sprite = "stretched:session/icons/stances/"+item+"-selected.png";
else
icon.sprite = "stretched:session/icons/single/stance-"+item+".png";
icon.sprite = "stretched:session/icons/stances/"+item+".png";
}
else if (guiName == "Command")
{
@ -416,8 +419,11 @@ function setupUnitTradingPanel(unitEntState, selection)
button.tooltip = "Set " + resource + " as trading goods";
var icon = getGUIObjectByName("unitTradingIcon["+i+"]");
var preferredGoods = unitEntState.trader.preferredGoods;
var imageNameSuffix = (resource == preferredGoods) ? "selected" : "inactive";
icon.sprite = "stretched:session/resources/" + resource + "_" + imageNameSuffix + ".png";
// TODO: We should remove this and add another layer on top of the button that displays
// icons/corners.png to mark the selected button.
var imageNameSuffix = (resource == preferredGoods) ? "_selected" : "";
var grayscale = (resource != preferredGoods) ? "grayscale:" : "";
icon.sprite = "stretched:"+grayscale+"session/icons/resources/" + resource + imageNameSuffix + ".png";
}
}
@ -437,7 +443,11 @@ function setupUnitBarterPanel(unitEntState)
{
var action = BARTER_ACTIONS[j];
var imageNameSuffix = (j == 0 && i == g_barterSell) ? "selected" : "inactive";
// TODO: We should remove this and add another layer on top of the button that displays
// icons/corners.png to mark the selected button.
var imageNameSuffix = (j == 0 && i == g_barterSell) ? "_selected" : "";
// We gray out the not selected icons in 'sell' row
var grayscale = (j == 0 && i != g_barterSell) ? "grayscale:" : "";
var icon = getGUIObjectByName("unitBarter" + action + "Icon["+i+"]");
var button = getGUIObjectByName("unitBarter" + action + "Button["+i+"]");
@ -455,7 +465,7 @@ function setupUnitBarterPanel(unitEntState)
{
button.enabled = true;
button.tooltip = action + " " + resource;
icon.sprite = "stretched:session/resources/" + resource + "_" + imageNameSuffix + ".png";
icon.sprite = "stretched:"+grayscale+"session/icons/resources/" + resource + imageNameSuffix + ".png";
var sellPrice = unitEntState.barterMarket.prices["sell"][BARTER_RESOURCES[g_barterSell]];
var buyPrice = unitEntState.barterMarket.prices["buy"][resource];
amountToBuy = "+" + Math.round(sellPrice / buyPrice * amountToSell);