add rollovers for health/production

This commit is contained in:
Chris Forbes
2011-03-05 13:19:13 +13:00
parent d9881885aa
commit 298baac061
3 changed files with 48 additions and 21 deletions

View File

@@ -143,7 +143,14 @@ namespace OpenRA.Graphics
Game.Renderer.LineRenderer.DrawLine(xY, xY + new float2(0, -4), c, c);
Game.Renderer.LineRenderer.DrawLine(XY, XY + new float2(-4, 0), c, c);
Game.Renderer.LineRenderer.DrawLine(XY, XY + new float2(0, -4), c, c);
}
}
public void DrawRollover(Actor unit)
{
var selectable = unit.TraitOrDefault<Selectable>();
if (selectable != null)
selectable.DrawRollover(this, unit);
}
public void DrawLocus(Color c, int2[] cells)
{

View File

@@ -50,7 +50,24 @@ namespace OpenRA.Traits
DrawPips(wr, self, xY);
DrawTags(wr, self, new float2(.5f * (bounds.Left + bounds.Right), bounds.Top));
DrawUnitPath(self);
DrawExtraBars(self, xy, Xy);
}
public void DrawRollover(WorldRenderer wr, Actor self)
{
var bounds = self.GetBounds(false);
var xy = new float2(bounds.Left, bounds.Top);
var Xy = new float2(bounds.Right, bounds.Top);
var xY = new float2(bounds.Left, bounds.Bottom);
var XY = new float2(bounds.Right, bounds.Bottom);
DrawHealthBar(self, xy, Xy);
DrawExtraBars(self, xy, Xy);
}
void DrawExtraBars(Actor self, float2 xy, float2 Xy)
{
foreach (var extraBar in self.TraitsImplementing<ISelectionBar>())
{
var value = extraBar.GetValue();

View File

@@ -31,6 +31,9 @@ namespace OpenRA.Widgets
public override void DrawInner()
{
foreach( var u in SelectActorsInBox(world, Game.CellSize * dragStart, Game.CellSize * dragStart ))
worldRenderer.DrawRollover( u );
var selbox = SelectionBox;
if (selbox == null) return;