IOrderGenerator now renders itself (Removed various cast and is fails.). - Fixed silly bug in prev.
This commit is contained in:
@@ -92,10 +92,8 @@ namespace OpenRa.Game.Graphics
|
|||||||
DrawSelectionBox(u, Color.Yellow, false);
|
DrawSelectionBox(u, Color.Yellow, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var uog = Game.controller.orderGenerator as UnitOrderGenerator;
|
if( Game.controller.orderGenerator != null )
|
||||||
if (uog != null)
|
Game.controller.orderGenerator.Render();
|
||||||
foreach (var a in uog.selection)
|
|
||||||
DrawSelectionBox(a, Color.White, true);
|
|
||||||
|
|
||||||
lineRenderer.Flush();
|
lineRenderer.Flush();
|
||||||
|
|
||||||
@@ -111,7 +109,7 @@ namespace OpenRa.Game.Graphics
|
|||||||
PerfHistory.Render(renderer, lineRenderer);
|
PerfHistory.Render(renderer, lineRenderer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawSelectionBox(Actor selectedUnit, Color c, bool drawHealthBar)
|
public void DrawSelectionBox(Actor selectedUnit, Color c, bool drawHealthBar)
|
||||||
{
|
{
|
||||||
var center = selectedUnit.CenterLocation;
|
var center = selectedUnit.CenterLocation;
|
||||||
var size = selectedUnit.SelectedSize;
|
var size = selectedUnit.SelectedSize;
|
||||||
|
|||||||
@@ -8,5 +8,6 @@ namespace OpenRa.Game
|
|||||||
{
|
{
|
||||||
IEnumerable<Order> Order( int2 xy, bool lmb );
|
IEnumerable<Order> Order( int2 xy, bool lmb );
|
||||||
void Tick();
|
void Tick();
|
||||||
|
void Render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,5 +43,10 @@ namespace OpenRa.Game
|
|||||||
if( producing == null || producing.Item != Building.Name || producing.RemainingTime != 0 )
|
if( producing == null || producing.Item != Building.Name || producing.RemainingTime != 0 )
|
||||||
Game.world.AddFrameEndTask( _ => { Game.controller.orderGenerator = null; } );
|
Game.world.AddFrameEndTask( _ => { Game.controller.orderGenerator = null; } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Render()
|
||||||
|
{
|
||||||
|
Game.worldRenderer.uiOverlay.DrawBuildingGrid( Building );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ namespace OpenRa.Game.Traits.Activities
|
|||||||
umt = mobile.GetMovementType(),
|
umt = mobile.GetMovementType(),
|
||||||
checkForBlocked = false,
|
checkForBlocked = false,
|
||||||
};
|
};
|
||||||
var refineries = Game.world.Actors.Where( x => x.unitInfo.Name == "proc" ).ToList();
|
var refineries = Game.world.Actors.Where( x => x.unitInfo != null && x.unitInfo.Name == "proc" ).ToList();
|
||||||
if( refinery != null )
|
if( refinery != null )
|
||||||
search.AddInitialCell( refinery.Location + refineryDeliverOffset );
|
search.AddInitialCell( refinery.Location + refineryDeliverOffset );
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -41,14 +41,12 @@ namespace OpenRa.Game
|
|||||||
for (var i = 0; i < 128; i++)
|
for (var i = 0; i < 128; i++)
|
||||||
if (Game.UnitInfluence.GetUnitAt(new int2(i, j)) != null)
|
if (Game.UnitInfluence.GetUnitAt(new int2(i, j)) != null)
|
||||||
spriteRenderer.DrawSprite(unitDebug, Game.CellSize * new float2(i, j), 0);
|
spriteRenderer.DrawSprite(unitDebug, Game.CellSize * new float2(i, j), 0);
|
||||||
|
}
|
||||||
|
|
||||||
var placeBuilding = Game.controller.orderGenerator as PlaceBuilding;
|
public void DrawBuildingGrid( UnitInfo.BuildingInfo bi )
|
||||||
if (placeBuilding == null) return;
|
{
|
||||||
|
|
||||||
var position = Game.controller.MousePosition.ToInt2();
|
var position = Game.controller.MousePosition.ToInt2();
|
||||||
|
|
||||||
var bi = placeBuilding.Building;
|
|
||||||
|
|
||||||
var maxDistance = bi.Adjacent + 2; /* real-ra is weird. this is 1 GAP. */
|
var maxDistance = bi.Adjacent + 2; /* real-ra is weird. this is 1 GAP. */
|
||||||
|
|
||||||
if( ShowBuildDebug )
|
if( ShowBuildDebug )
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
|
||||||
|
|
||||||
namespace OpenRa.Game
|
namespace OpenRa.Game
|
||||||
{
|
{
|
||||||
@@ -28,5 +28,11 @@ namespace OpenRa.Game
|
|||||||
{
|
{
|
||||||
selection.RemoveAll(a => a.IsDead);
|
selection.RemoveAll(a => a.IsDead);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Render()
|
||||||
|
{
|
||||||
|
foreach( var a in selection )
|
||||||
|
Game.worldRenderer.DrawSelectionBox( a, Color.White, true );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user