add rollovers for health/production
This commit is contained in:
@@ -145,6 +145,13 @@ namespace OpenRA.Graphics
|
|||||||
Game.Renderer.LineRenderer.DrawLine(XY, XY + new float2(0, -4), 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)
|
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();
|
||||||
|
|||||||
@@ -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