Added MultiTap support

This commit is contained in:
Curtis S
2011-10-05 22:58:04 -06:00
committed by Chris Forbes
parent 5ced7e270c
commit 9fdfca6ee5
5 changed files with 144 additions and 8 deletions

View File

@@ -68,8 +68,26 @@ namespace OpenRA.Widgets
{
if (world.OrderGenerator is UnitOrderGenerator)
{
var newSelection = SelectActorsInBox(world, dragStart, xy);
world.Selection.Combine(world, newSelection, mi.Modifiers.HasModifier(Modifiers.Shift), dragStart == xy);
if (mi.MultiTapCount == 2)
{
var unit = world.FindUnitsAtMouse(mi.Location).FirstOrDefault();
Rectangle visibleWorld = Game.viewport.ViewBounds(world);
var newSelection = world.FindUnits(Game.viewport.ViewToWorldPx(new int2(visibleWorld.Left, visibleWorld.Top)),
Game.viewport.ViewToWorldPx(new int2(visibleWorld.Right, visibleWorld.Bottom)))
.Where(a => a.HasTrait<Selectable>()
&& a.World.LocalShroud.IsVisible(a)
&& unit != null
&& a.Info.Name == unit.Info.Name
&& a.Owner == unit.Owner);
world.Selection.Combine(world, newSelection, true, false);
}
else
{
var newSelection = SelectActorsInBox(world, dragStart, xy);
world.Selection.Combine(world, newSelection, mi.Modifiers.HasModifier(Modifiers.Shift), dragStart == xy);
}
}
dragStart = dragEnd = xy;