add rollovers for health/production
This commit is contained in:
@@ -123,28 +123,35 @@ namespace OpenRA.Graphics
|
|||||||
Game.Renderer.LineRenderer.DrawLine(a + b, a + b + c, color, color);
|
Game.Renderer.LineRenderer.DrawLine(a + b, a + b + c, color, color);
|
||||||
Game.Renderer.LineRenderer.DrawLine(a + b + c, a + c, color, color);
|
Game.Renderer.LineRenderer.DrawLine(a + b + c, a + c, color, color);
|
||||||
Game.Renderer.LineRenderer.DrawLine(a, a + c, color, color);
|
Game.Renderer.LineRenderer.DrawLine(a, a + c, color, color);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void DrawSelectionBox(Actor selectedUnit, Color c)
|
||||||
|
{
|
||||||
|
var bounds = selectedUnit.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);
|
||||||
|
|
||||||
|
Game.Renderer.LineRenderer.DrawLine(xy, xy + new float2(4, 0), c, c);
|
||||||
|
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);
|
||||||
|
|
||||||
|
Game.Renderer.LineRenderer.DrawLine(xY, xY + new float2(4, 0), c, c);
|
||||||
|
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 DrawSelectionBox(Actor selectedUnit, Color c)
|
|
||||||
{
|
|
||||||
var bounds = selectedUnit.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);
|
|
||||||
|
|
||||||
Game.Renderer.LineRenderer.DrawLine(xy, xy + new float2(4, 0), c, c);
|
|
||||||
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);
|
|
||||||
|
|
||||||
Game.Renderer.LineRenderer.DrawLine(xY, xY + new float2(4, 0), c, c);
|
|
||||||
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 DrawLocus(Color c, int2[] cells)
|
public void DrawLocus(Color c, int2[] cells)
|
||||||
{
|
{
|
||||||
var dict = cells.ToDictionary(a => a, a => 0);
|
var dict = cells.ToDictionary(a => a, a => 0);
|
||||||
|
|||||||
@@ -50,7 +50,24 @@ namespace OpenRA.Traits
|
|||||||
DrawPips(wr, self, xY);
|
DrawPips(wr, self, xY);
|
||||||
DrawTags(wr, self, new float2(.5f * (bounds.Left + bounds.Right), bounds.Top));
|
DrawTags(wr, self, new float2(.5f * (bounds.Left + bounds.Right), bounds.Top));
|
||||||
DrawUnitPath(self);
|
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>())
|
foreach (var extraBar in self.TraitsImplementing<ISelectionBar>())
|
||||||
{
|
{
|
||||||
var value = extraBar.GetValue();
|
var value = extraBar.GetValue();
|
||||||
@@ -60,7 +77,7 @@ namespace OpenRA.Traits
|
|||||||
Xy.Y += 4;
|
Xy.Y += 4;
|
||||||
DrawSelectionBar(self, xy, Xy, extraBar.GetValue(), extraBar.GetColor());
|
DrawSelectionBar(self, xy, Xy, extraBar.GetValue(), extraBar.GetColor());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawSelectionBox(Actor self, float2 xy, float2 Xy, float2 xY, float2 XY, Color c)
|
void DrawSelectionBox(Actor self, float2 xy, float2 Xy, float2 xY, float2 XY, Color c)
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
public override void DrawInner()
|
public override void DrawInner()
|
||||||
{
|
{
|
||||||
|
foreach( var u in SelectActorsInBox(world, Game.CellSize * dragStart, Game.CellSize * dragStart ))
|
||||||
|
worldRenderer.DrawRollover( u );
|
||||||
|
|
||||||
var selbox = SelectionBox;
|
var selbox = SelectionBox;
|
||||||
if (selbox == null) return;
|
if (selbox == null) return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user