use rgba buttons for sell/repair/etc
This commit is contained in:
@@ -721,12 +721,14 @@ namespace OpenRA
|
|||||||
|
|
||||||
foreach (var cb in world.WorldActor.traits.WithInterface<IChromeButton>())
|
foreach (var cb in world.WorldActor.traits.WithInterface<IChromeButton>())
|
||||||
{
|
{
|
||||||
|
var state = cb.Enabled ? cb.Pressed ? "pressed" : "normal" : "disabled";
|
||||||
|
var image = ChromeProvider.GetImage(renderer, cb.Image + "-button", state);
|
||||||
|
|
||||||
|
origin.X -= (int)image.size.X + chromeButtonGap;
|
||||||
|
rgbaRenderer.DrawSprite(image, origin, "chrome");
|
||||||
|
|
||||||
var button = cb;
|
var button = cb;
|
||||||
var anim = new Animation(cb.Image);
|
AddButton(new RectangleF(origin.X, origin.Y, image.size.X, image.size.Y),
|
||||||
anim.Play(cb.Enabled ? cb.Pressed ? "pressed" : "normal" : "disabled");
|
|
||||||
origin.X -= (int)anim.Image.size.X + chromeButtonGap;
|
|
||||||
shpRenderer.DrawSprite(anim.Image, origin, "chrome");
|
|
||||||
AddButton(new RectangleF(origin.X, origin.Y, anim.Image.size.X, anim.Image.size.Y),
|
|
||||||
_ => { if (button.Enabled) button.OnClick(); });
|
_ => { if (button.Enabled) button.OnClick(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
class PowerDownButton : IChromeButton
|
class PowerDownButton : IChromeButton
|
||||||
{
|
{
|
||||||
public string Image { get { return "repair"; } } // todo: art
|
public string Image { get { return "power"; } }
|
||||||
public bool Enabled { get { return true; } }
|
public bool Enabled { get { return true; } }
|
||||||
public bool Pressed { get { return Game.controller.orderGenerator is PowerDownOrderGenerator; } }
|
public bool Pressed { get { return Game.controller.orderGenerator is PowerDownOrderGenerator; } }
|
||||||
public void OnClick() { Game.controller.ToggleInputMode<PowerDownOrderGenerator>(); }
|
public void OnClick() { Game.controller.ToggleInputMode<PowerDownOrderGenerator>(); }
|
||||||
|
|||||||
@@ -158,4 +158,19 @@
|
|||||||
<image name="unowned" x="16" y="0" width="16" height="16" />
|
<image name="unowned" x="16" y="0" width="16" height="16" />
|
||||||
<image name="owned" x="0" y="0" width="16" height="16" />
|
<image name="owned" x="0" y="0" width="16" height="16" />
|
||||||
</collection>
|
</collection>
|
||||||
|
<collection name="sell-button" src="dialog.png">
|
||||||
|
<image name="normal" x="0" y="448" width="33" height="28" />
|
||||||
|
<image name="pressed" x="33" y="448" width="33" height="28" />
|
||||||
|
<image name="disabled" x="66" y="448" width="33" height="28" />
|
||||||
|
</collection>
|
||||||
|
<collection name="repair-button" src="dialog.png">
|
||||||
|
<image name="normal" x="0" y="476" width="33" height="28" />
|
||||||
|
<image name="pressed" x="33" y="476" width="33" height="28" />
|
||||||
|
<image name="disabled" x="66" y="476" width="33" height="28" />
|
||||||
|
</collection>
|
||||||
|
<collection name="power-button" src="dialog.png">
|
||||||
|
<image name="normal" x="0" y="504" width="33" height="28" />
|
||||||
|
<image name="pressed" x="33" y="504" width="33" height="28" />
|
||||||
|
<image name="disabled" x="66" y="504" width="33" height="28" />
|
||||||
|
</collection>
|
||||||
</chrome>
|
</chrome>
|
||||||
|
|||||||
Reference in New Issue
Block a user