dont show yellow selection boxen
This commit is contained in:
@@ -31,11 +31,14 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
public override void DrawInner()
|
public override void DrawInner()
|
||||||
{
|
{
|
||||||
foreach( var u in SelectActorsInBox(world, Game.CellSize * dragStart, Game.CellSize * dragStart ))
|
var selbox = SelectionBox;
|
||||||
worldRenderer.DrawRollover( u );
|
if (selbox == null)
|
||||||
|
{
|
||||||
var selbox = SelectionBox;
|
foreach (var u in SelectActorsInBox(world, Game.CellSize * dragStart, Game.CellSize * dragStart))
|
||||||
if (selbox == null) return;
|
worldRenderer.DrawRollover(u);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var a = selbox.Value.First;
|
var a = selbox.Value.First;
|
||||||
var b = new float2(selbox.Value.Second.X - a.X, 0);
|
var b = new float2(selbox.Value.Second.X - a.X, 0);
|
||||||
@@ -44,10 +47,10 @@ namespace OpenRA.Widgets
|
|||||||
Game.Renderer.LineRenderer.DrawLine(a, a + b, Color.White, Color.White);
|
Game.Renderer.LineRenderer.DrawLine(a, a + b, Color.White, Color.White);
|
||||||
Game.Renderer.LineRenderer.DrawLine(a + b, a + b + c, Color.White, Color.White);
|
Game.Renderer.LineRenderer.DrawLine(a + b, a + b + c, Color.White, Color.White);
|
||||||
Game.Renderer.LineRenderer.DrawLine(a + b + c, a + c, Color.White, Color.White);
|
Game.Renderer.LineRenderer.DrawLine(a + b + c, a + c, Color.White, Color.White);
|
||||||
Game.Renderer.LineRenderer.DrawLine(a, a + c, Color.White, Color.White);
|
Game.Renderer.LineRenderer.DrawLine(a, a + c, Color.White, Color.White);
|
||||||
|
|
||||||
foreach (var u in SelectActorsInBox(world, selbox.Value.First, selbox.Value.Second))
|
foreach (var u in SelectActorsInBox(world, selbox.Value.First, selbox.Value.Second))
|
||||||
worldRenderer.DrawSelectionBox(u, Color.Yellow);
|
worldRenderer.DrawRollover(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
float2 dragStart, dragEnd;
|
float2 dragStart, dragEnd;
|
||||||
@@ -139,6 +142,7 @@ namespace OpenRA.Widgets
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static readonly Actor[] NoActors = {};
|
||||||
IEnumerable<Actor> SelectActorsInBox(World world, float2 a, float2 b)
|
IEnumerable<Actor> SelectActorsInBox(World world, float2 a, float2 b)
|
||||||
{
|
{
|
||||||
return world.FindUnits(a, b)
|
return world.FindUnits(a, b)
|
||||||
@@ -146,7 +150,7 @@ namespace OpenRA.Widgets
|
|||||||
.GroupBy(x => (x.Owner == world.LocalPlayer) ? x.Info.Traits.Get<SelectableInfo>().Priority : 0)
|
.GroupBy(x => (x.Owner == world.LocalPlayer) ? x.Info.Traits.Get<SelectableInfo>().Priority : 0)
|
||||||
.OrderByDescending(g => g.Key)
|
.OrderByDescending(g => g.Key)
|
||||||
.Select( g => g.AsEnumerable() )
|
.Select( g => g.AsEnumerable() )
|
||||||
.DefaultIfEmpty( new Actor[] {} )
|
.DefaultIfEmpty( NoActors )
|
||||||
.FirstOrDefault();
|
.FirstOrDefault();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user