Kill Controller
This commit is contained in:
@@ -1,74 +0,0 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see LICENSE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Orders;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA
|
||||
{
|
||||
public class Controller
|
||||
{
|
||||
public IOrderGenerator orderGenerator = new UnitOrderGenerator();
|
||||
public Selection selection = new Selection();
|
||||
|
||||
public void CancelInputMode() { orderGenerator = new UnitOrderGenerator(); }
|
||||
|
||||
public bool ToggleInputMode<T>() where T : IOrderGenerator, new()
|
||||
{
|
||||
if (orderGenerator is T)
|
||||
{
|
||||
CancelInputMode();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
orderGenerator = new T();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void ApplyOrders(World world, float2 xy, MouseInput mi)
|
||||
{
|
||||
if (orderGenerator == null) return;
|
||||
|
||||
var orders = orderGenerator.Order(world, xy.ToInt2(), mi).ToArray();
|
||||
Game.orderManager.IssueOrders( orders );
|
||||
|
||||
// Find an actor with a phrase to say
|
||||
var done = false;
|
||||
foreach (var o in orders)
|
||||
{
|
||||
foreach (var v in o.Subject.traits.WithInterface<IOrderVoice>())
|
||||
{
|
||||
if (Sound.PlayVoice(v.VoicePhraseForOrder(o.Subject, o), o.Subject))
|
||||
{
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (done) break;
|
||||
}
|
||||
}
|
||||
|
||||
public float2 dragStart, dragEnd;
|
||||
public Pair<float2, float2>? SelectionBox
|
||||
{
|
||||
get
|
||||
{
|
||||
if (dragStart == dragEnd) return null;
|
||||
return Pair.New(Game.CellSize * dragStart, Game.CellSize * dragEnd);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,6 @@ namespace OpenRA
|
||||
|
||||
public static World world;
|
||||
internal static Viewport viewport;
|
||||
public static Controller controller;
|
||||
internal static UserSettings Settings;
|
||||
|
||||
internal static OrderManager orderManager;
|
||||
@@ -286,9 +285,8 @@ namespace OpenRA
|
||||
|
||||
if (isNetTick) orderManager.Tick(world);
|
||||
|
||||
controller.orderGenerator.Tick(world);
|
||||
controller.selection.Tick(world);
|
||||
|
||||
world.OrderGenerator.Tick(world);
|
||||
world.Selection.Tick(world);
|
||||
world.Tick();
|
||||
|
||||
PerfHistory.Tick();
|
||||
@@ -501,8 +499,6 @@ namespace OpenRA
|
||||
var resolution = GetResolution(settings, Game.Settings.WindowMode);
|
||||
Renderer = new Renderer(resolution, Game.Settings.WindowMode);
|
||||
resolution = Renderer.Resolution;
|
||||
|
||||
controller = new Controller();
|
||||
clientSize = new int2(resolution);
|
||||
|
||||
Sound.Initialize();
|
||||
|
||||
@@ -99,8 +99,8 @@ namespace OpenRA.Graphics
|
||||
|
||||
terrainRenderer.Draw(Game.viewport);
|
||||
|
||||
if (Game.controller.orderGenerator != null)
|
||||
Game.controller.orderGenerator.RenderBeforeWorld(world);
|
||||
if (world.OrderGenerator != null)
|
||||
world.OrderGenerator.RenderBeforeWorld(world);
|
||||
|
||||
Game.Renderer.SpriteRenderer.Flush();
|
||||
Game.Renderer.LineRenderer.Flush();
|
||||
@@ -109,10 +109,9 @@ namespace OpenRA.Graphics
|
||||
Game.Renderer.SpriteRenderer.DrawSprite(image.Sprite, image.Pos, image.Palette);
|
||||
uiOverlay.Draw(world);
|
||||
Game.Renderer.SpriteRenderer.Flush();
|
||||
DrawBandBox();
|
||||
|
||||
if (Game.controller.orderGenerator != null)
|
||||
Game.controller.orderGenerator.RenderAfterWorld(world);
|
||||
if (world.OrderGenerator != null)
|
||||
world.OrderGenerator.RenderAfterWorld(world);
|
||||
|
||||
if (world.LocalPlayer != null)
|
||||
world.LocalPlayer.Shroud.Draw();
|
||||
@@ -155,24 +154,6 @@ namespace OpenRA.Graphics
|
||||
}
|
||||
}
|
||||
|
||||
void DrawBandBox()
|
||||
{
|
||||
var selbox = Game.controller.SelectionBox;
|
||||
if (selbox == null) return;
|
||||
|
||||
var a = selbox.Value.First;
|
||||
var b = new float2(selbox.Value.Second.X - a.X, 0);
|
||||
var c = new float2(0, selbox.Value.Second.Y - a.Y);
|
||||
|
||||
Game.Renderer.LineRenderer.DrawLine(a, a + b, Color.White, Color.White);
|
||||
Game.Renderer.LineRenderer.DrawLine(a + b, a + b + c, Color.White, Color.White);
|
||||
Game.Renderer.LineRenderer.DrawLine(a + b + c, a + c, Color.White, Color.White);
|
||||
Game.Renderer.LineRenderer.DrawLine(a, a + c, Color.White, Color.White);
|
||||
|
||||
foreach (var u in world.SelectActorsInBox(selbox.Value.First, selbox.Value.Second))
|
||||
DrawSelectionBox(u, Color.Yellow);
|
||||
}
|
||||
|
||||
public void DrawSelectionBox(Actor selectedUnit, Color c)
|
||||
{
|
||||
var bounds = selectedUnit.GetBounds(true);
|
||||
|
||||
@@ -130,7 +130,6 @@
|
||||
<Compile Include="Traits\World\ChoosePaletteOnSelect.cs" />
|
||||
<Compile Include="Traits\World\Country.cs" />
|
||||
<Compile Include="Actor.cs" />
|
||||
<Compile Include="Controller.cs" />
|
||||
<Compile Include="Cursor.cs" />
|
||||
<Compile Include="GameRules\Footprint.cs" />
|
||||
<Compile Include="GameRules\Rules.cs" />
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Orders
|
||||
public IEnumerable<Order> Order(World world, int2 xy, MouseInput mi)
|
||||
{
|
||||
if (mi.Button == MouseButton.Right)
|
||||
Game.controller.CancelInputMode();
|
||||
world.CancelInputMode();
|
||||
return OrderInner(world, xy, mi);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace OpenRA.Orders
|
||||
.Any();
|
||||
|
||||
if (!hasStructure)
|
||||
Game.controller.CancelInputMode();
|
||||
world.CancelInputMode();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace OpenRA.Orders
|
||||
public IEnumerable<Order> Order(World world, int2 xy, MouseInput mi)
|
||||
{
|
||||
if (mi.Button == MouseButton.Right)
|
||||
Game.controller.CancelInputMode();
|
||||
world.CancelInputMode();
|
||||
|
||||
return InnerOrder(world, xy, mi);
|
||||
}
|
||||
@@ -58,7 +58,7 @@ namespace OpenRA.Orders
|
||||
{
|
||||
var producing = Producer.traits.Get<Traits.ProductionQueue>().CurrentItem( Rules.Info[ Building ].Category );
|
||||
if (producing == null || producing.Item != Building || producing.RemainingTime != 0)
|
||||
Game.controller.CancelInputMode();
|
||||
world.CancelInputMode();
|
||||
}
|
||||
|
||||
public void RenderAfterWorld( World world ) {}
|
||||
|
||||
@@ -1,65 +1,65 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see LICENSE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Orders
|
||||
{
|
||||
class UnitOrderGenerator : IOrderGenerator
|
||||
{
|
||||
public IEnumerable<Order> Order( World world, int2 xy, MouseInput mi )
|
||||
{
|
||||
var orders = Game.controller.selection.Actors
|
||||
.Select(a => a.Order(xy, mi))
|
||||
.Where(o => o != null)
|
||||
.ToArray();
|
||||
|
||||
var actorsInvolved = orders.Select(o => o.Subject).Distinct();
|
||||
if (actorsInvolved.Any())
|
||||
yield return new Order("CreateGroup", actorsInvolved.First().Owner.PlayerActor,
|
||||
string.Join(",", actorsInvolved.Select(a => a.ActorID.ToString()).ToArray()));
|
||||
|
||||
foreach (var o in orders)
|
||||
yield return o;
|
||||
}
|
||||
|
||||
public void Tick( World world ) {}
|
||||
|
||||
public void RenderBeforeWorld(World world)
|
||||
{
|
||||
foreach (var a in Game.controller.selection.Actors)
|
||||
foreach (var t in a.traits.WithInterface<IPreRenderSelection>())
|
||||
t.RenderBeforeWorld(a);
|
||||
}
|
||||
|
||||
public void RenderAfterWorld( World world )
|
||||
{
|
||||
foreach (var a in Game.controller.selection.Actors)
|
||||
foreach (var t in a.traits.WithInterface<IPostRenderSelection>())
|
||||
t.RenderAfterWorld(a);
|
||||
}
|
||||
|
||||
public string GetCursor( World world, int2 xy, MouseInput mi )
|
||||
{
|
||||
var c = Order(world, xy, mi)
|
||||
.Select(o => o.Subject.traits.WithInterface<IOrderCursor>()
|
||||
.Select(pc => pc.CursorForOrder(o.Subject, o)).FirstOrDefault(a => a != null))
|
||||
.FirstOrDefault(a => a != null);
|
||||
|
||||
return c ??
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
* see LICENSE.
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Orders
|
||||
{
|
||||
class UnitOrderGenerator : IOrderGenerator
|
||||
{
|
||||
public IEnumerable<Order> Order( World world, int2 xy, MouseInput mi )
|
||||
{
|
||||
var orders = world.Selection.Actors
|
||||
.Select(a => a.Order(xy, mi))
|
||||
.Where(o => o != null)
|
||||
.ToArray();
|
||||
|
||||
var actorsInvolved = orders.Select(o => o.Subject).Distinct();
|
||||
if (actorsInvolved.Any())
|
||||
yield return new Order("CreateGroup", actorsInvolved.First().Owner.PlayerActor,
|
||||
string.Join(",", actorsInvolved.Select(a => a.ActorID.ToString()).ToArray()));
|
||||
|
||||
foreach (var o in orders)
|
||||
yield return o;
|
||||
}
|
||||
|
||||
public void Tick( World world ) {}
|
||||
|
||||
public void RenderBeforeWorld(World world)
|
||||
{
|
||||
foreach (var a in world.Selection.Actors)
|
||||
foreach (var t in a.traits.WithInterface<IPreRenderSelection>())
|
||||
t.RenderBeforeWorld(a);
|
||||
}
|
||||
|
||||
public void RenderAfterWorld( World world )
|
||||
{
|
||||
foreach (var a in world.Selection.Actors)
|
||||
foreach (var t in a.traits.WithInterface<IPostRenderSelection>())
|
||||
t.RenderAfterWorld(a);
|
||||
}
|
||||
|
||||
public string GetCursor( World world, int2 xy, MouseInput mi )
|
||||
{
|
||||
var c = Order(world, xy, mi)
|
||||
.Select(o => o.Subject.traits.WithInterface<IOrderCursor>()
|
||||
.Select(pc => pc.CursorForOrder(o.Subject, o)).FirstOrDefault(a => a != null))
|
||||
.FirstOrDefault(a => a != null);
|
||||
|
||||
return c ??
|
||||
(world.FindUnitsAtMouse(mi.Location)
|
||||
.Any(a => a.Info.Traits.Contains<SelectableInfo>())
|
||||
? "select" : "default");
|
||||
}
|
||||
}
|
||||
}
|
||||
.Any(a => a.Info.Traits.Contains<SelectableInfo>())
|
||||
? "select" : "default");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace OpenRA.Traits
|
||||
|
||||
public void RenderAfterWorld (Actor self)
|
||||
{
|
||||
var force = Game.controller.GetModifiers().HasModifier(Modifiers.Alt);
|
||||
var force = Game.GetModifierKeys().HasModifier(Modifiers.Alt);
|
||||
if ((lifetime <= 0 || --lifetime <= 0) && !force)
|
||||
return;
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace OpenRA.Traits
|
||||
|
||||
public IEnumerable<Renderable> Render(Actor self)
|
||||
{
|
||||
if (self.Owner == self.World.LocalPlayer && Game.controller.selection.Actors.Contains(self))
|
||||
if (self.Owner == self.World.LocalPlayer && self.World.Selection.Actors.Contains(self))
|
||||
yield return Util.Centered(self,
|
||||
anim.Image, Util.CenterOfCell(rallyPoint));
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace OpenRA.Traits
|
||||
|
||||
void DrawControlGroup(Actor self, float2 basePosition)
|
||||
{
|
||||
var group = Game.controller.selection.GetControlGroupForActor(self);
|
||||
var group = self.World.Selection.GetControlGroupForActor(self);
|
||||
if (group == null) return;
|
||||
|
||||
var pipImages = new Animation("pips");
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace OpenRA.Traits
|
||||
{
|
||||
public void SelectionChanged()
|
||||
{
|
||||
var firstItem = Game.controller.selection.Actors.FirstOrDefault(
|
||||
var firstItem = Game.world.Selection.Actors.FirstOrDefault(
|
||||
a => a.World.LocalPlayer == a.Owner && a.traits.Contains<Production>());
|
||||
|
||||
if (firstItem == null)
|
||||
|
||||
@@ -348,7 +348,7 @@ namespace OpenRA.Widgets
|
||||
if (producing.Done)
|
||||
{
|
||||
if (unit.Traits.Contains<BuildingInfo>())
|
||||
Game.controller.orderGenerator = new PlaceBuildingOrderGenerator(player.PlayerActor, item);
|
||||
world.OrderGenerator = new PlaceBuildingOrderGenerator(player.PlayerActor, item);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -9,9 +9,12 @@
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using OpenRA.Orders;
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.FileFormats;
|
||||
|
||||
namespace OpenRA.Widgets
|
||||
{
|
||||
@@ -19,7 +22,26 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
public DefaultInputControllerWidget() : base() {}
|
||||
protected DefaultInputControllerWidget(DefaultInputControllerWidget widget) : base(widget) {}
|
||||
public override void DrawInner( World world ) { }
|
||||
|
||||
public override void DrawInner( World world )
|
||||
{
|
||||
var selbox = SelectionBox;
|
||||
if (selbox == null) return;
|
||||
|
||||
var a = selbox.Value.First;
|
||||
var b = new float2(selbox.Value.Second.X - a.X, 0);
|
||||
var c = new float2(0, selbox.Value.Second.Y - a.Y);
|
||||
|
||||
Game.Renderer.LineRenderer.DrawLine(a, a + b, Color.White, Color.White);
|
||||
Game.Renderer.LineRenderer.DrawLine(a + b, a + b + c, Color.White, Color.White);
|
||||
Game.Renderer.LineRenderer.DrawLine(a + b + c, a + c, Color.White, Color.White);
|
||||
Game.Renderer.LineRenderer.DrawLine(a, a + c, Color.White, Color.White);
|
||||
|
||||
foreach (var u in world.SelectActorsInBox(selbox.Value.First, selbox.Value.Second))
|
||||
world.WorldRenderer.DrawSelectionBox(u, Color.Yellow);
|
||||
|
||||
Game.Renderer.LineRenderer.Flush();
|
||||
}
|
||||
|
||||
static internal bool scrollUp = false;
|
||||
static internal bool scrollDown = false;
|
||||
@@ -36,7 +58,7 @@ namespace OpenRA.Widgets
|
||||
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Down)
|
||||
{
|
||||
dragStart = dragEnd = xy;
|
||||
Game.controller.ApplyOrders(world, xy, mi);
|
||||
ApplyOrders(world, xy, mi);
|
||||
}
|
||||
|
||||
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Move)
|
||||
@@ -44,10 +66,10 @@ namespace OpenRA.Widgets
|
||||
|
||||
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Up)
|
||||
{
|
||||
if (Game.controller.orderGenerator is UnitOrderGenerator)
|
||||
if (world.OrderGenerator is UnitOrderGenerator)
|
||||
{
|
||||
var newSelection = Game.world.SelectActorsInBox(Game.CellSize * dragStart, Game.CellSize * xy);
|
||||
Game.controller.selection.Combine(world, newSelection, mi.Modifiers.HasModifier(Modifiers.Shift), dragStart == xy);
|
||||
world.Selection.Combine(world, newSelection, mi.Modifiers.HasModifier(Modifiers.Shift), dragStart == xy);
|
||||
}
|
||||
|
||||
dragStart = dragEnd = xy;
|
||||
@@ -62,13 +84,42 @@ namespace OpenRA.Widgets
|
||||
dragStart = dragEnd = xy;
|
||||
|
||||
if (mi.Button == MouseButton.Right && mi.Event == MouseInputEvent.Down)
|
||||
Game.controller.ApplyOrders(world, xy, mi);
|
||||
|
||||
Game.controller.dragStart = dragStart;
|
||||
Game.controller.dragEnd = dragEnd;
|
||||
ApplyOrders(world, xy, mi);
|
||||
return true;
|
||||
}
|
||||
|
||||
public Pair<float2, float2>? SelectionBox
|
||||
{
|
||||
get
|
||||
{
|
||||
if (dragStart == dragEnd) return null;
|
||||
return Pair.New(Game.CellSize * dragStart, Game.CellSize * dragEnd);
|
||||
}
|
||||
}
|
||||
|
||||
public void ApplyOrders(World world, float2 xy, MouseInput mi)
|
||||
{
|
||||
if (world.OrderGenerator == null) return;
|
||||
|
||||
var orders = world.OrderGenerator.Order(world, xy.ToInt2(), mi).ToArray();
|
||||
Game.orderManager.IssueOrders( orders );
|
||||
|
||||
// Find an actor with a phrase to say
|
||||
var done = false;
|
||||
foreach (var o in orders)
|
||||
{
|
||||
foreach (var v in o.Subject.traits.WithInterface<IOrderVoice>())
|
||||
{
|
||||
if (Sound.PlayVoice(v.VoicePhraseForOrder(o.Subject, o), o.Subject))
|
||||
{
|
||||
done = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (done) break;
|
||||
}
|
||||
}
|
||||
|
||||
public override string GetCursor(int2 pos)
|
||||
{
|
||||
var world = Game.world;
|
||||
@@ -85,7 +136,7 @@ namespace OpenRA.Widgets
|
||||
Modifiers = Game.GetModifierKeys()
|
||||
};
|
||||
|
||||
return Game.controller.orderGenerator.GetCursor( world, Game.viewport.ViewToWorld(mi).ToInt2(), mi );
|
||||
return Game.world.OrderGenerator.GetCursor( world, Game.viewport.ViewToWorld(mi).ToInt2(), mi );
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -117,7 +168,7 @@ namespace OpenRA.Widgets
|
||||
}
|
||||
|
||||
if (e.KeyName.Length == 1 && char.IsDigit(e.KeyName[0]))
|
||||
Game.controller.selection.DoControlGroup(Game.world, e.KeyName[0] - '0', e.Modifiers);
|
||||
Game.world.Selection.DoControlGroup(Game.world, e.KeyName[0] - '0', e.Modifiers);
|
||||
|
||||
if (e.KeyChar == 08)
|
||||
GotoNextBase();
|
||||
@@ -151,20 +202,21 @@ namespace OpenRA.Widgets
|
||||
|
||||
public void GotoNextBase()
|
||||
{
|
||||
var bases = Game.world.Queries.OwnedBy[Game.world.LocalPlayer].WithTrait<BaseBuilding>().ToArray();
|
||||
var world = Game.world;
|
||||
var bases = world.Queries.OwnedBy[world.LocalPlayer].WithTrait<BaseBuilding>().ToArray();
|
||||
if (!bases.Any()) return;
|
||||
|
||||
var next = bases
|
||||
.Select( b => b.Actor )
|
||||
.SkipWhile(b => Game.controller.selection.Actors.Contains(b))
|
||||
.SkipWhile(b => world.Selection.Actors.Contains(b))
|
||||
.Skip(1)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (next == null)
|
||||
next = bases.Select(b => b.Actor).First();
|
||||
|
||||
Game.controller.selection.Combine(Game.world, new Actor[] { next }, false, true);
|
||||
Game.viewport.Center(Game.controller.selection.Actors);
|
||||
world.Selection.Combine(world, new Actor[] { next }, false, true);
|
||||
Game.viewport.Center(world.Selection.Actors);
|
||||
}
|
||||
|
||||
public override Widget Clone() { return new DefaultInputControllerWidget(this); }
|
||||
|
||||
@@ -74,7 +74,7 @@ namespace OpenRA.Widgets
|
||||
Modifiers = Game.GetModifierKeys()
|
||||
};
|
||||
|
||||
var cursor = Game.controller.orderGenerator.GetCursor( world, loc, mi );
|
||||
var cursor = Game.world.OrderGenerator.GetCursor( world, loc, mi );
|
||||
if (cursor == null)
|
||||
return "default";
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ using OpenRA.Collections;
|
||||
using OpenRA.Effects;
|
||||
using OpenRA.FileFormats;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Orders;
|
||||
using OpenRA.Support;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -56,6 +57,25 @@ namespace OpenRA
|
||||
|
||||
public readonly WorldRenderer WorldRenderer;
|
||||
|
||||
public IOrderGenerator OrderGenerator = new UnitOrderGenerator();
|
||||
public Selection Selection = new Selection();
|
||||
|
||||
public void CancelInputMode() { OrderGenerator = new UnitOrderGenerator(); }
|
||||
|
||||
public bool ToggleInputMode<T>() where T : IOrderGenerator, new()
|
||||
{
|
||||
if (OrderGenerator is T)
|
||||
{
|
||||
CancelInputMode();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
OrderGenerator = new T();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public World(Manifest manifest, Map map)
|
||||
{
|
||||
Timer.Time( "----World.ctor" );
|
||||
|
||||
Reference in New Issue
Block a user