Implemented trait defined Rollovers.

This commit is contained in:
Andre Mohren
2018-11-06 19:47:51 +01:00
committed by Paul Chote
parent 7049f68fbd
commit 42446ac9ba
3 changed files with 14 additions and 8 deletions

View File

@@ -14,7 +14,6 @@ using System.Drawing;
using System.Linq;
using OpenRA.Graphics;
using OpenRA.Mods.Common.Effects;
using OpenRA.Mods.Common.Graphics;
using OpenRA.Orders;
using OpenRA.Traits;
using OpenRA.Widgets;
@@ -48,12 +47,11 @@ namespace OpenRA.Mods.Common.Widgets
void DrawRollover(Actor unit)
{
// TODO: Integrate this with SelectionDecorations to unhardcode the *Renderable
if (unit.Info.HasTraitInfo<SelectableInfo>())
{
var bounds = unit.TraitsImplementing<IDecorationBounds>().FirstNonEmptyBounds(unit, worldRenderer);
new SelectionBarsRenderable(unit, bounds, true, true).Render(worldRenderer);
}
var selectionDecorations = unit.TraitOrDefault<ISelectionDecorations>();
if (selectionDecorations == null)
return;
selectionDecorations.DrawRollover(unit, worldRenderer);
}
public override void Draw()