Route viewport centering via WorldRenderer.

This commit is contained in:
Paul Chote
2013-09-27 17:13:54 +12:00
parent b3d608092c
commit f575c20d38
21 changed files with 77 additions and 70 deletions

View File

@@ -22,12 +22,14 @@ namespace OpenRA.Mods.RA.Widgets
{
public class WorldCommandWidget : Widget
{
World world;
readonly World world;
readonly WorldRenderer worldRenderer;
[ObjectCreator.UseCtor]
public WorldCommandWidget(World world)
public WorldCommandWidget(World world, WorldRenderer worldRenderer)
{
this.world = world;
this.worldRenderer = worldRenderer;
}
public override string GetCursor(int2 pos) { return null; }
@@ -207,13 +209,13 @@ namespace OpenRA.Mods.RA.Widgets
if (eventNotifier.lastAttackTime < 0)
return true;
Game.viewport.Center(eventNotifier.lastAttackLocation.ToFloat2());
worldRenderer.Viewport.Center(eventNotifier.lastAttackLocation.CenterPosition);
return true;
}
bool ToSelection()
{
Game.viewport.Center(world.Selection.Actors);
worldRenderer.Viewport.Center(world.Selection.Actors);
return true;
}
}