more refs to Game.world (UIOverlay)

This commit is contained in:
Bob
2010-01-21 13:52:31 +13:00
parent 02ce7990c0
commit b3911db149
4 changed files with 9 additions and 9 deletions

View File

@@ -77,7 +77,7 @@ namespace OpenRa.Graphics
foreach (var e in world.Effects)
DrawSpriteList(rect, e.Render());
uiOverlay.Draw();
uiOverlay.Draw( world );
spriteRenderer.Flush();

View File

@@ -49,7 +49,7 @@ namespace OpenRa.Orders
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)

View File

@@ -34,24 +34,24 @@ namespace OpenRa
return SheetBuilder.Add( data, new Size(Game.CellSize,Game.CellSize) );
}
public void Draw()
public void Draw( World world )
{
if (ShowUnitDebug)
for (var j = 0; j < 128; j++)
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);
}
public void DrawBuildingGrid( string name, BuildingInfo bi )
public void DrawBuildingGrid( World world, string name, BuildingInfo bi )
{
var position = Game.controller.MousePosition.ToInt2();
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 ) )
spriteRenderer.DrawSprite( ( isCloseEnough && Game.world.IsCellBuildable( t, bi.WaterBound
? UnitMovementType.Float : UnitMovementType.Wheel ) && !Game.world.Map.ContainsResource( t ) )
spriteRenderer.DrawSprite( ( isCloseEnough && world.IsCellBuildable( t, bi.WaterBound
? UnitMovementType.Float : UnitMovementType.Wheel ) && !world.Map.ContainsResource( t ) )
? buildOk : buildBlocked, Game.CellSize * t, 0 );
spriteRenderer.Flush();

View File

@@ -93,7 +93,7 @@ namespace OpenRa
{
return world.FindUnits(a, b)
.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)
.Select( g => g.AsEnumerable() )
.DefaultIfEmpty( new Actor[] {} )