more refs to Game.world (UIOverlay)
This commit is contained in:
@@ -77,7 +77,7 @@ namespace OpenRa.Graphics
|
|||||||
foreach (var e in world.Effects)
|
foreach (var e in world.Effects)
|
||||||
DrawSpriteList(rect, e.Render());
|
DrawSpriteList(rect, e.Render());
|
||||||
|
|
||||||
uiOverlay.Draw();
|
uiOverlay.Draw( world );
|
||||||
|
|
||||||
spriteRenderer.Flush();
|
spriteRenderer.Flush();
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ namespace OpenRa.Orders
|
|||||||
|
|
||||||
public void Render( World world )
|
public void Render( World world )
|
||||||
{
|
{
|
||||||
world.WorldRenderer.uiOverlay.DrawBuildingGrid( Building, BuildingInfo );
|
world.WorldRenderer.uiOverlay.DrawBuildingGrid( world, Building, BuildingInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
public Cursor GetCursor(World world, int2 xy, MouseInput mi)
|
public Cursor GetCursor(World world, int2 xy, MouseInput mi)
|
||||||
|
|||||||
@@ -34,24 +34,24 @@ namespace OpenRa
|
|||||||
return SheetBuilder.Add( data, new Size(Game.CellSize,Game.CellSize) );
|
return SheetBuilder.Add( data, new Size(Game.CellSize,Game.CellSize) );
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw()
|
public void Draw( World world )
|
||||||
{
|
{
|
||||||
if (ShowUnitDebug)
|
if (ShowUnitDebug)
|
||||||
for (var j = 0; j < 128; j++)
|
for (var j = 0; j < 128; j++)
|
||||||
for (var i = 0; i < 128; i++)
|
for (var i = 0; i < 128; i++)
|
||||||
if (Game.world.UnitInfluence.GetUnitsAt(new int2(i, j)).Any())
|
if (world.UnitInfluence.GetUnitsAt(new int2(i, j)).Any())
|
||||||
spriteRenderer.DrawSprite(unitDebug, Game.CellSize * new float2(i, j), 0);
|
spriteRenderer.DrawSprite(unitDebug, Game.CellSize * new float2(i, j), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawBuildingGrid( string name, BuildingInfo bi )
|
public void DrawBuildingGrid( World world, string name, BuildingInfo bi )
|
||||||
{
|
{
|
||||||
var position = Game.controller.MousePosition.ToInt2();
|
var position = Game.controller.MousePosition.ToInt2();
|
||||||
var topLeft = position - Footprint.AdjustForBuildingSize( bi );
|
var topLeft = position - Footprint.AdjustForBuildingSize( bi );
|
||||||
var isCloseEnough = Game.world.IsCloseEnoughToBase(Game.world.LocalPlayer, name, bi, topLeft);
|
var isCloseEnough = world.IsCloseEnoughToBase(world.LocalPlayer, name, bi, topLeft);
|
||||||
|
|
||||||
foreach( var t in Footprint.Tiles( name, bi, topLeft ) )
|
foreach( var t in Footprint.Tiles( name, bi, topLeft ) )
|
||||||
spriteRenderer.DrawSprite( ( isCloseEnough && Game.world.IsCellBuildable( t, bi.WaterBound
|
spriteRenderer.DrawSprite( ( isCloseEnough && world.IsCellBuildable( t, bi.WaterBound
|
||||||
? UnitMovementType.Float : UnitMovementType.Wheel ) && !Game.world.Map.ContainsResource( t ) )
|
? UnitMovementType.Float : UnitMovementType.Wheel ) && !world.Map.ContainsResource( t ) )
|
||||||
? buildOk : buildBlocked, Game.CellSize * t, 0 );
|
? buildOk : buildBlocked, Game.CellSize * t, 0 );
|
||||||
|
|
||||||
spriteRenderer.Flush();
|
spriteRenderer.Flush();
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ namespace OpenRa
|
|||||||
{
|
{
|
||||||
return world.FindUnits(a, b)
|
return world.FindUnits(a, b)
|
||||||
.Where( x => x.traits.Contains<Selectable>() )
|
.Where( x => x.traits.Contains<Selectable>() )
|
||||||
.GroupBy(x => (x.Owner == Game.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( new Actor[] {} )
|
||||||
|
|||||||
Reference in New Issue
Block a user