Add key handling to order generators.
This commit is contained in:
@@ -22,5 +22,6 @@ namespace OpenRA
|
|||||||
IEnumerable<IRenderable> RenderAboveShroud(WorldRenderer wr, World world);
|
IEnumerable<IRenderable> RenderAboveShroud(WorldRenderer wr, World world);
|
||||||
string GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi);
|
string GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi);
|
||||||
void Deactivate();
|
void Deactivate();
|
||||||
|
bool HandleKeyPress(KeyInput e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,6 +86,8 @@ namespace OpenRA.Orders
|
|||||||
|
|
||||||
public void Deactivate() { }
|
public void Deactivate() { }
|
||||||
|
|
||||||
|
bool IOrderGenerator.HandleKeyPress(KeyInput e) { return false; }
|
||||||
|
|
||||||
// Used for classic mouse orders, determines whether or not action at xy is move or select
|
// Used for classic mouse orders, determines whether or not action at xy is move or select
|
||||||
public virtual bool InputOverridesSelection(WorldRenderer wr, World world, int2 xy, MouseInput mi)
|
public virtual bool InputOverridesSelection(WorldRenderer wr, World world, int2 xy, MouseInput mi)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
IEnumerable<IRenderable> IOrderGenerator.RenderAboveShroud(WorldRenderer wr, World world) { return RenderAboveShroud(wr, world); }
|
IEnumerable<IRenderable> IOrderGenerator.RenderAboveShroud(WorldRenderer wr, World world) { return RenderAboveShroud(wr, world); }
|
||||||
string IOrderGenerator.GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi) { return GetCursor(world, cell, worldPixel, mi); }
|
string IOrderGenerator.GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi) { return GetCursor(world, cell, worldPixel, mi); }
|
||||||
void IOrderGenerator.Deactivate() { }
|
void IOrderGenerator.Deactivate() { }
|
||||||
|
bool IOrderGenerator.HandleKeyPress(KeyInput e) { return false; }
|
||||||
|
|
||||||
protected abstract void Tick(World world);
|
protected abstract void Tick(World world);
|
||||||
protected abstract IEnumerable<IRenderable> Render(WorldRenderer wr, World world);
|
protected abstract IEnumerable<IRenderable> Render(WorldRenderer wr, World world);
|
||||||
|
|||||||
@@ -144,6 +144,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
string IOrderGenerator.GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi) { return cursor; }
|
string IOrderGenerator.GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi) { return cursor; }
|
||||||
|
|
||||||
|
bool IOrderGenerator.HandleKeyPress(KeyInput e) { return false; }
|
||||||
|
|
||||||
void IOrderGenerator.Deactivate()
|
void IOrderGenerator.Deactivate()
|
||||||
{
|
{
|
||||||
if (activated)
|
if (activated)
|
||||||
|
|||||||
@@ -495,7 +495,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return world.OrderGenerator.HandleKeyPress(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollDirection CheckForDirections()
|
ScrollDirection CheckForDirections()
|
||||||
|
|||||||
Reference in New Issue
Block a user