killed PrepareOverlay
This commit is contained in:
@@ -94,6 +94,8 @@ namespace OpenRa.Game
|
||||
}
|
||||
}
|
||||
|
||||
public float2 MousePosition { get { return dragEnd; } }
|
||||
|
||||
public Cursor ChooseCursor()
|
||||
{
|
||||
var c = (orderGenerator is UnitOrderGenerator) ? orderGenerator.Order(dragEnd.ToInt2(), false)
|
||||
|
||||
@@ -7,7 +7,6 @@ namespace OpenRa.Game
|
||||
interface IOrderGenerator
|
||||
{
|
||||
IEnumerable<Order> Order( int2 xy, bool lmb );
|
||||
void PrepareOverlay( int2 xy );
|
||||
void Tick();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,10 +118,6 @@ namespace OpenRa.Game
|
||||
Event = MouseInputEvent.Move,
|
||||
Location = new int2(e.Location)
|
||||
});
|
||||
|
||||
if (Game.controller.orderGenerator != null)
|
||||
Game.controller.orderGenerator.PrepareOverlay(
|
||||
((1 / 24f) * (new float2(e.Location) + Game.viewport.Location)).ToInt2());
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(MouseEventArgs e)
|
||||
|
||||
@@ -37,18 +37,9 @@ namespace OpenRa.Game
|
||||
}
|
||||
else // rmb
|
||||
{
|
||||
Game.world.AddFrameEndTask( _ =>
|
||||
{
|
||||
Game.controller.orderGenerator = null;
|
||||
Game.worldRenderer.uiOverlay.KillOverlay();
|
||||
} );
|
||||
Game.world.AddFrameEndTask( _ => { Game.controller.orderGenerator = null; } );
|
||||
}
|
||||
}
|
||||
|
||||
public void PrepareOverlay(int2 xy)
|
||||
{
|
||||
Game.worldRenderer.uiOverlay.SetCurrentOverlay(xy, Name);
|
||||
}
|
||||
|
||||
public void Tick() { }
|
||||
}
|
||||
|
||||
@@ -39,11 +39,14 @@ namespace OpenRa.Game
|
||||
for (var j = 0; j < 128; j++)
|
||||
for (var i = 0; i < 128; i++)
|
||||
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;
|
||||
if (placeBuilding == null) return;
|
||||
|
||||
var position = Game.controller.MousePosition.ToInt2();
|
||||
|
||||
if (!hasOverlay) return;
|
||||
|
||||
var bi = (UnitInfo.BuildingInfo)Rules.UnitInfo[name];
|
||||
var bi = (UnitInfo.BuildingInfo)Rules.UnitInfo[placeBuilding.Name];
|
||||
|
||||
var maxDistance = bi.Adjacent + 2; /* real-ra is weird. this is 1 GAP. */
|
||||
var tooFarFromBase = !Footprint.Tiles(bi, position).Any(
|
||||
@@ -56,21 +59,5 @@ namespace OpenRa.Game
|
||||
|
||||
spriteRenderer.Flush();
|
||||
}
|
||||
|
||||
bool hasOverlay;
|
||||
int2 position;
|
||||
string name;
|
||||
|
||||
public void KillOverlay()
|
||||
{
|
||||
hasOverlay = false;
|
||||
}
|
||||
|
||||
public void SetCurrentOverlay(int2 cell, string name)
|
||||
{
|
||||
hasOverlay = true;
|
||||
position = cell;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,5 @@ namespace OpenRa.Game
|
||||
{
|
||||
selection.RemoveAll(a => a.IsDead);
|
||||
}
|
||||
|
||||
public void PrepareOverlay(int2 xy) {}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@ namespace OpenRa.Game
|
||||
Game.world.Add( new Actor( building.Name, order.TargetLocation - GameRules.Footprint.AdjustForBuildingSize( building.Name ), order.Player ) );
|
||||
|
||||
Game.controller.orderGenerator = null;
|
||||
Game.worldRenderer.uiOverlay.KillOverlay();
|
||||
|
||||
order.Player.FinishProduction(Rules.UnitCategory[building.Name]);
|
||||
} );
|
||||
|
||||
Reference in New Issue
Block a user