improve the classic mouse behaivor
- don't require to deselect units to change selection - fix issue with broken building placement on right-click orders - don't select enemy units when left-click attacking - build palette won't interfere with unit orders anymore
This commit is contained in:
committed by
Chris Forbes
parent
d52394bb47
commit
b356cca528
@@ -57,7 +57,6 @@ namespace OpenRA.Widgets
|
||||
|
||||
var HasBox = (SelectionBox != null) ? true : false;
|
||||
var MultiClick = (mi.MultiTapCount >= 2) ? true : false;
|
||||
var NothingSelected = !world.Selection.Actors.Any();
|
||||
|
||||
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Down)
|
||||
{
|
||||
@@ -66,7 +65,8 @@ namespace OpenRA.Widgets
|
||||
|
||||
dragStart = dragEnd = xy;
|
||||
|
||||
if (UseClassicMouseStyle)
|
||||
//place buildings
|
||||
if (!UseClassicMouseStyle || (UseClassicMouseStyle && !world.Selection.Actors.Any()) )
|
||||
ApplyOrders(world, xy, mi);
|
||||
}
|
||||
|
||||
@@ -75,9 +75,18 @@ namespace OpenRA.Widgets
|
||||
|
||||
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Up)
|
||||
{
|
||||
if (world.OrderGenerator is UnitOrderGenerator)
|
||||
if (UseClassicMouseStyle && Focused)
|
||||
{
|
||||
if ((UseClassicMouseStyle && NothingSelected) || (!UseClassicMouseStyle))
|
||||
//order units around
|
||||
if (!HasBox && world.Selection.Actors.Any() && !MultiClick)
|
||||
{
|
||||
ApplyOrders(world, xy, mi);
|
||||
LoseFocus(mi);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (world.OrderGenerator is UnitOrderGenerator)
|
||||
{
|
||||
if (MultiClick)
|
||||
{
|
||||
@@ -86,7 +95,7 @@ namespace OpenRA.Widgets
|
||||
var visibleWorld = Game.viewport.ViewBounds(world);
|
||||
var topLeft = Game.viewport.ViewToWorldPx(new int2(visibleWorld.Left, visibleWorld.Top));
|
||||
var bottomRight = Game.viewport.ViewToWorldPx(new int2(visibleWorld.Right, visibleWorld.Bottom));
|
||||
var newSelection2 = SelectActorsInBox(world, topLeft, bottomRight,
|
||||
var newSelection2= SelectActorsInBox(world, topLeft, bottomRight,
|
||||
a => unit != null && a.Info.Name == unit.Info.Name && a.Owner == unit.Owner);
|
||||
|
||||
world.Selection.Combine(world, newSelection2, true, false);
|
||||
@@ -97,7 +106,6 @@ namespace OpenRA.Widgets
|
||||
world.Selection.Combine(world, newSelection, mi.Modifiers.HasModifier(Modifiers.Shift), dragStart == xy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dragStart = dragEnd = xy;
|
||||
LoseFocus(mi);
|
||||
@@ -110,7 +118,8 @@ namespace OpenRA.Widgets
|
||||
{
|
||||
if (UseClassicMouseStyle)
|
||||
world.Selection.Clear();
|
||||
else if (!HasBox) // don't issue orders while selecting
|
||||
|
||||
if (!HasBox) // don't issue orders while selecting
|
||||
ApplyOrders(world, xy, mi);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user