Merge pull request #7501 from Bynnar18/leftclick
Reimplementing Left Click Orders with Fixes
This commit is contained in:
@@ -49,4 +49,23 @@ namespace OpenRA
|
|||||||
Sync.CheckSyncUnchanged(world, () => Ui.HandleInput(input));
|
Sync.CheckSyncUnchanged(world, () => Ui.HandleInput(input));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class MouseButtonPreference
|
||||||
|
{
|
||||||
|
public MouseButton Action
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Game.Settings.Game.UseClassicMouseStyle ? MouseButton.Left : MouseButton.Right;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public MouseButton Cancel
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Game.Settings.Game.UseClassicMouseStyle ? MouseButton.Right : MouseButton.Left;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -88,6 +88,20 @@ namespace OpenRA.Orders
|
|||||||
return cursorOrder != null ? cursorOrder.Cursor : (useSelect ? "select" : "default");
|
return cursorOrder != null ? cursorOrder.Cursor : (useSelect ? "select" : "default");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used for classic mouse orders, determines whether or not action at xy is move or select
|
||||||
|
public static bool InputOverridesSelection(World world, int2 xy, MouseInput mi)
|
||||||
|
{
|
||||||
|
var target = Target.FromActor(world.ScreenMap.ActorsAt(xy).WithHighestSelectionPriority());
|
||||||
|
var underCursor = world.Selection.Actors.WithHighestSelectionPriority();
|
||||||
|
|
||||||
|
var o = OrderForUnit(underCursor, target, mi);
|
||||||
|
|
||||||
|
if (o != null && o.Order.OverrideSelection)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static UnitOrderResult OrderForUnit(Actor self, Target target, MouseInput mi)
|
static UnitOrderResult OrderForUnit(Actor self, Target target, MouseInput mi)
|
||||||
{
|
{
|
||||||
if (self.Owner != self.World.LocalPlayer)
|
if (self.Owner != self.World.LocalPlayer)
|
||||||
@@ -96,7 +110,7 @@ namespace OpenRA.Orders
|
|||||||
if (self.Destroyed || !target.IsValidFor(self))
|
if (self.Destroyed || !target.IsValidFor(self))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
if (mi.Button == MouseButton.Right)
|
if (mi.Button == Game.Settings.Game.MouseButtonPreference.Action)
|
||||||
{
|
{
|
||||||
foreach (var o in self.TraitsImplementing<IIssueOrder>()
|
foreach (var o in self.TraitsImplementing<IIssueOrder>()
|
||||||
.SelectMany(trait => trait.Orders
|
.SelectMany(trait => trait.Orders
|
||||||
|
|||||||
@@ -127,9 +127,12 @@ namespace OpenRA
|
|||||||
public bool ViewportEdgeScroll = true;
|
public bool ViewportEdgeScroll = true;
|
||||||
public bool LockMouseWindow = false;
|
public bool LockMouseWindow = false;
|
||||||
public MouseScrollType MouseScroll = MouseScrollType.Standard;
|
public MouseScrollType MouseScroll = MouseScrollType.Standard;
|
||||||
|
public MouseButtonPreference MouseButtonPreference = new MouseButtonPreference();
|
||||||
public float ViewportEdgeScrollStep = 10f;
|
public float ViewportEdgeScrollStep = 10f;
|
||||||
public float UIScrollSpeed = 50f;
|
public float UIScrollSpeed = 50f;
|
||||||
|
public int SelectionDeadzone = 24;
|
||||||
|
|
||||||
|
public bool UseClassicMouseStyle = false;
|
||||||
public bool AlwaysShowStatusBars = false;
|
public bool AlwaysShowStatusBars = false;
|
||||||
public bool TeamHealthColors = false;
|
public bool TeamHealthColors = false;
|
||||||
|
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ namespace OpenRA.Traits
|
|||||||
int OrderPriority { get; }
|
int OrderPriority { get; }
|
||||||
bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor);
|
bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor);
|
||||||
bool IsQueued { get; }
|
bool IsQueued { get; }
|
||||||
|
bool OverrideSelection { get; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface IResolveOrder { void ResolveOrder(Actor self, Order order); }
|
public interface IResolveOrder { void ResolveOrder(Actor self, Order order); }
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
if (!IsDragging)
|
if (!IsDragging)
|
||||||
{
|
{
|
||||||
foreach (var u in SelectActorsInBox(World, lastMousePosition, lastMousePosition, _ => true))
|
foreach (var u in SelectActorsInBoxWithDeadzone(World, lastMousePosition, lastMousePosition, _ => true))
|
||||||
worldRenderer.DrawRollover(u);
|
worldRenderer.DrawRollover(u);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -48,13 +48,16 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
var selbox = SelectionBox;
|
var selbox = SelectionBox;
|
||||||
Game.Renderer.WorldLineRenderer.DrawRect(selbox.Value.First.ToFloat2(), selbox.Value.Second.ToFloat2(), Color.White);
|
Game.Renderer.WorldLineRenderer.DrawRect(selbox.Value.First.ToFloat2(), selbox.Value.Second.ToFloat2(), Color.White);
|
||||||
foreach (var u in SelectActorsInBox(World, selbox.Value.First, selbox.Value.Second, _ => true))
|
foreach (var u in SelectActorsInBoxWithDeadzone(World, selbox.Value.First, selbox.Value.Second, _ => true))
|
||||||
worldRenderer.DrawRollover(u);
|
worldRenderer.DrawRollover(u);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool HandleMouseInput(MouseInput mi)
|
public override bool HandleMouseInput(MouseInput mi)
|
||||||
{
|
{
|
||||||
var xy = worldRenderer.Viewport.ViewToWorldPx(mi.Location);
|
var xy = worldRenderer.Viewport.ViewToWorldPx(mi.Location);
|
||||||
|
|
||||||
|
var useClassicMouseStyle = Game.Settings.Game.UseClassicMouseStyle;
|
||||||
|
|
||||||
var hasBox = SelectionBox != null;
|
var hasBox = SelectionBox != null;
|
||||||
var multiClick = mi.MultiTapCount >= 2;
|
var multiClick = mi.MultiTapCount >= 2;
|
||||||
|
|
||||||
@@ -65,8 +68,15 @@ namespace OpenRA.Widgets
|
|||||||
|
|
||||||
dragStart = xy;
|
dragStart = xy;
|
||||||
|
|
||||||
// place buildings
|
// Place buildings, use support powers, and other non-unit things
|
||||||
|
if (!(World.OrderGenerator is UnitOrderGenerator))
|
||||||
|
{
|
||||||
ApplyOrders(World, xy, mi);
|
ApplyOrders(World, xy, mi);
|
||||||
|
dragStart = dragEnd = null;
|
||||||
|
YieldMouseFocus(mi);
|
||||||
|
lastMousePosition = xy;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Move && dragStart.HasValue)
|
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Move && dragStart.HasValue)
|
||||||
@@ -76,6 +86,24 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
if (World.OrderGenerator is UnitOrderGenerator)
|
if (World.OrderGenerator is UnitOrderGenerator)
|
||||||
{
|
{
|
||||||
|
if (useClassicMouseStyle && HasMouseFocus)
|
||||||
|
{
|
||||||
|
if (!hasBox && World.Selection.Actors.Any() && !multiClick)
|
||||||
|
{
|
||||||
|
if (!(World.ScreenMap.ActorsAt(xy).Where(x => x.HasTrait<Selectable>() && x.Trait<Selectable>().Info.Selectable &&
|
||||||
|
(x.Owner.IsAlliedWith(World.RenderPlayer) || !World.FogObscures(x))).Any() && !mi.Modifiers.HasModifier(Modifiers.Ctrl) &&
|
||||||
|
!mi.Modifiers.HasModifier(Modifiers.Alt) && UnitOrderGenerator.InputOverridesSelection(World, xy, mi)))
|
||||||
|
{
|
||||||
|
// Order units instead of selecting
|
||||||
|
ApplyOrders(World, xy, mi);
|
||||||
|
dragStart = dragEnd = null;
|
||||||
|
YieldMouseFocus(mi);
|
||||||
|
lastMousePosition = xy;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (multiClick)
|
if (multiClick)
|
||||||
{
|
{
|
||||||
var unit = World.ScreenMap.ActorsAt(xy)
|
var unit = World.ScreenMap.ActorsAt(xy)
|
||||||
@@ -88,7 +116,7 @@ namespace OpenRA.Widgets
|
|||||||
}
|
}
|
||||||
else if (dragStart.HasValue)
|
else if (dragStart.HasValue)
|
||||||
{
|
{
|
||||||
var newSelection = SelectActorsInBox(World, dragStart.Value, xy, _ => true);
|
var newSelection = SelectActorsInBoxWithDeadzone(World, dragStart.Value, xy, _ => true);
|
||||||
World.Selection.Combine(World, newSelection, mi.Modifiers.HasModifier(Modifiers.Shift), dragStart == xy);
|
World.Selection.Combine(World, newSelection, mi.Modifiers.HasModifier(Modifiers.Shift), dragStart == xy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -97,9 +125,17 @@ namespace OpenRA.Widgets
|
|||||||
YieldMouseFocus(mi);
|
YieldMouseFocus(mi);
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't issue orders while selecting
|
if (mi.Button == MouseButton.Right && mi.Event == MouseInputEvent.Down)
|
||||||
if (mi.Button == MouseButton.Right && mi.Event == MouseInputEvent.Down && !hasBox)
|
{
|
||||||
|
// Don't do anything while selecting
|
||||||
|
if (!hasBox)
|
||||||
|
{
|
||||||
|
if (useClassicMouseStyle)
|
||||||
|
World.Selection.Clear();
|
||||||
|
|
||||||
ApplyOrders(World, xy, mi);
|
ApplyOrders(World, xy, mi);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lastMousePosition = xy;
|
lastMousePosition = xy;
|
||||||
|
|
||||||
@@ -110,7 +146,7 @@ namespace OpenRA.Widgets
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return dragStart.HasValue && dragEnd.HasValue;
|
return dragStart.HasValue && dragEnd.HasValue && (dragStart.Value - dragEnd.Value).Length > Game.Settings.Game.SelectionDeadzone;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,7 +208,7 @@ namespace OpenRA.Widgets
|
|||||||
var mi = new MouseInput
|
var mi = new MouseInput
|
||||||
{
|
{
|
||||||
Location = screenPos,
|
Location = screenPos,
|
||||||
Button = MouseButton.Right,
|
Button = Game.Settings.Game.MouseButtonPreference.Action,
|
||||||
Modifiers = Game.GetModifierKeys()
|
Modifiers = Game.GetModifierKeys()
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -224,6 +260,14 @@ namespace OpenRA.Widgets
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static IEnumerable<Actor> SelectActorsInBoxWithDeadzone(World world, int2 a, int2 b, Func<Actor, bool> cond)
|
||||||
|
{
|
||||||
|
if (a == b || (a - b).Length > Game.Settings.Game.SelectionDeadzone)
|
||||||
|
return SelectActorsInBox(world, a, b, cond);
|
||||||
|
else
|
||||||
|
return SelectActorsInBox(world, b, b, cond);
|
||||||
|
}
|
||||||
|
|
||||||
static IEnumerable<Actor> SelectActorsInBox(World world, int2 a, int2 b, Func<Actor, bool> cond)
|
static IEnumerable<Actor> SelectActorsInBox(World world, int2 a, int2 b, Func<Actor, bool> cond)
|
||||||
{
|
{
|
||||||
return world.ScreenMap.ActorsInBox(a, b)
|
return world.ScreenMap.ActorsInBox(a, b)
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
|
|
||||||
public override IOrderGenerator OrderGenerator(string order, SupportPowerManager manager)
|
public override IOrderGenerator OrderGenerator(string order, SupportPowerManager manager)
|
||||||
{
|
{
|
||||||
|
// Clear selection if using Left-Click Orders
|
||||||
|
if (Game.Settings.Game.UseClassicMouseStyle)
|
||||||
|
manager.Self.World.Selection.Clear();
|
||||||
|
|
||||||
Sound.PlayToPlayer(manager.Self.Owner, Info.SelectTargetSound);
|
Sound.PlayToPlayer(manager.Self.Owner, Info.SelectTargetSound);
|
||||||
var info = Info as IonCannonPowerInfo;
|
var info = Info as IonCannonPowerInfo;
|
||||||
return new SelectGenericPowerTarget(order, manager, info.Cursor, MouseButton.Left);
|
return new SelectGenericPowerTarget(order, manager, info.Cursor, MouseButton.Left);
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
|
|
||||||
public string OrderID { get; private set; }
|
public string OrderID { get; private set; }
|
||||||
public int OrderPriority { get; private set; }
|
public int OrderPriority { get; private set; }
|
||||||
|
public bool OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -34,6 +34,10 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
producer = queue.Actor;
|
producer = queue.Actor;
|
||||||
building = name;
|
building = name;
|
||||||
|
|
||||||
|
// Clear selection if using Left-Click Orders
|
||||||
|
if (Game.Settings.Game.UseClassicMouseStyle)
|
||||||
|
producer.World.Selection.Clear();
|
||||||
|
|
||||||
var map = producer.World.Map;
|
var map = producer.World.Map;
|
||||||
var tileset = producer.World.TileSet.Id.ToLowerInvariant();
|
var tileset = producer.World.TileSet.Id.ToLowerInvariant();
|
||||||
buildingInfo = map.Rules.Actors[building].Traits.Get<BuildingInfo>();
|
buildingInfo = map.Rules.Actors[building].Traits.Get<BuildingInfo>();
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ namespace OpenRA.Mods.Common.Orders
|
|||||||
public string OrderID { get; private set; }
|
public string OrderID { get; private set; }
|
||||||
public int OrderPriority { get; private set; }
|
public int OrderPriority { get; private set; }
|
||||||
public bool? ForceAttack = null;
|
public bool? ForceAttack = null;
|
||||||
|
public bool OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
public abstract bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor);
|
public abstract bool CanTargetActor(Actor self, Actor target, TargetModifiers modifiers, ref string cursor);
|
||||||
public abstract bool CanTargetFrozenActor(Actor self, FrozenActor target, TargetModifiers modifiers, ref string cursor);
|
public abstract bool CanTargetFrozenActor(Actor self, FrozenActor target, TargetModifiers modifiers, ref string cursor);
|
||||||
|
|||||||
@@ -302,6 +302,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
public string OrderID { get { return "Move"; } }
|
public string OrderID { get { return "Move"; } }
|
||||||
public int OrderPriority { get { return 4; } }
|
public int OrderPriority { get { return 4; } }
|
||||||
|
public bool OverrideSelection { get { return false; } }
|
||||||
|
|
||||||
readonly AircraftInfo info;
|
readonly AircraftInfo info;
|
||||||
|
|
||||||
|
|||||||
@@ -194,6 +194,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public string OrderID { get; private set; }
|
public string OrderID { get; private set; }
|
||||||
public int OrderPriority { get; private set; }
|
public int OrderPriority { get; private set; }
|
||||||
|
public bool OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
bool CanTargetActor(Actor self, Target target, TargetModifiers modifiers, ref string cursor)
|
bool CanTargetActor(Actor self, Target target, TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -56,6 +56,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
public string OrderID { get { return "SetRallyPoint"; } }
|
public string OrderID { get { return "SetRallyPoint"; } }
|
||||||
public int OrderPriority { get { return 0; } }
|
public int OrderPriority { get { return 0; } }
|
||||||
|
public bool OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public IEnumerable<Order> Order(World world, CPos xy, MouseInput mi)
|
public IEnumerable<Order> Order(World world, CPos xy, MouseInput mi)
|
||||||
{
|
{
|
||||||
if (mi.Button == MouseButton.Left)
|
if (mi.Button == Game.Settings.Game.MouseButtonPreference.Cancel)
|
||||||
{
|
{
|
||||||
world.CancelInputMode();
|
world.CancelInputMode();
|
||||||
yield break;
|
yield break;
|
||||||
|
|||||||
@@ -445,6 +445,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public string OrderID { get { return "Harvest"; } }
|
public string OrderID { get { return "Harvest"; } }
|
||||||
public int OrderPriority { get { return 10; } }
|
public int OrderPriority { get { return 10; } }
|
||||||
public bool IsQueued { get; protected set; }
|
public bool IsQueued { get; protected set; }
|
||||||
|
public bool OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -619,6 +619,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
{
|
{
|
||||||
readonly MobileInfo unitType;
|
readonly MobileInfo unitType;
|
||||||
readonly bool rejectMove;
|
readonly bool rejectMove;
|
||||||
|
public bool OverrideSelection { get { return false; } }
|
||||||
|
|
||||||
public MoveOrderTargeter(Actor self, MobileInfo unitType)
|
public MoveOrderTargeter(Actor self, MobileInfo unitType)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -102,6 +102,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public SelectTarget(World world, string order, SupportPowerManager manager, GrantUpgradePower power)
|
public SelectTarget(World world, string order, SupportPowerManager manager, GrantUpgradePower power)
|
||||||
{
|
{
|
||||||
|
// Clear selection if using Left-Click Orders
|
||||||
|
if (Game.Settings.Game.UseClassicMouseStyle)
|
||||||
|
manager.Self.World.Selection.Clear();
|
||||||
|
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
this.order = order;
|
this.order = order;
|
||||||
this.power = power;
|
this.power = power;
|
||||||
|
|||||||
@@ -239,6 +239,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public SelectGenericPowerTarget(string order, SupportPowerManager manager, string cursor, MouseButton button)
|
public SelectGenericPowerTarget(string order, SupportPowerManager manager, string cursor, MouseButton button)
|
||||||
{
|
{
|
||||||
|
// Clear selection if using Left-Click Orders
|
||||||
|
if (Game.Settings.Game.UseClassicMouseStyle)
|
||||||
|
manager.Self.World.Selection.Clear();
|
||||||
|
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
this.order = order;
|
this.order = order;
|
||||||
this.cursor = cursor;
|
this.cursor = cursor;
|
||||||
|
|||||||
@@ -312,6 +312,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
var gs = Game.Settings.Game;
|
var gs = Game.Settings.Game;
|
||||||
var ks = Game.Settings.Keys;
|
var ks = Game.Settings.Keys;
|
||||||
|
|
||||||
|
BindCheckboxPref(panel, "CLASSICORDERS_CHECKBOX", gs, "UseClassicMouseStyle");
|
||||||
BindCheckboxPref(panel, "EDGESCROLL_CHECKBOX", gs, "ViewportEdgeScroll");
|
BindCheckboxPref(panel, "EDGESCROLL_CHECKBOX", gs, "ViewportEdgeScroll");
|
||||||
BindCheckboxPref(panel, "LOCKMOUSE_CHECKBOX", gs, "LockMouseWindow");
|
BindCheckboxPref(panel, "LOCKMOUSE_CHECKBOX", gs, "LockMouseWindow");
|
||||||
BindSliderPref(panel, "SCROLLSPEED_SLIDER", gs, "ViewportEdgeScrollStep");
|
BindSliderPref(panel, "SCROLLSPEED_SLIDER", gs, "ViewportEdgeScrollStep");
|
||||||
@@ -472,6 +473,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
|
|
||||||
return () =>
|
return () =>
|
||||||
{
|
{
|
||||||
|
gs.UseClassicMouseStyle = dgs.UseClassicMouseStyle;
|
||||||
gs.MouseScroll = dgs.MouseScroll;
|
gs.MouseScroll = dgs.MouseScroll;
|
||||||
gs.LockMouseWindow = dgs.LockMouseWindow;
|
gs.LockMouseWindow = dgs.LockMouseWindow;
|
||||||
gs.ViewportEdgeScroll = dgs.ViewportEdgeScroll;
|
gs.ViewportEdgeScroll = dgs.ViewportEdgeScroll;
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
if (actors.Any())
|
if (actors.Any())
|
||||||
world.OrderGenerator = new GenericSelectTarget(actors,
|
world.OrderGenerator = new GenericSelectTarget(actors,
|
||||||
"AttackMove", "attackmove", MouseButton.Right);
|
"AttackMove", "attackmove", Game.Settings.Game.MouseButtonPreference.Action);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
|
|
||||||
public IEnumerable<Order> Order(World world, CPos xy, MouseInput mi)
|
public IEnumerable<Order> Order(World world, CPos xy, MouseInput mi)
|
||||||
{
|
{
|
||||||
if (mi.Button == MouseButton.Left)
|
if (mi.Button == Game.Settings.Game.MouseButtonPreference.Cancel)
|
||||||
{
|
{
|
||||||
world.CancelInputMode();
|
world.CancelInputMode();
|
||||||
yield break;
|
yield break;
|
||||||
@@ -157,7 +157,7 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
.MaxByOrDefault(a => a.Info.Traits.Contains<SelectableInfo>()
|
.MaxByOrDefault(a => a.Info.Traits.Contains<SelectableInfo>()
|
||||||
? a.Info.Traits.Get<SelectableInfo>().Priority : int.MinValue);
|
? a.Info.Traits.Get<SelectableInfo>().Priority : int.MinValue);
|
||||||
|
|
||||||
if (mi.Button == MouseButton.Right && underCursor == null)
|
if (mi.Button == Game.Settings.Game.MouseButtonPreference.Action && underCursor == null)
|
||||||
{
|
{
|
||||||
minelayer.World.CancelInputMode();
|
minelayer.World.CancelInputMode();
|
||||||
yield return new Order("PlaceMinefield", minelayer, false) { TargetLocation = xy };
|
yield return new Order("PlaceMinefield", minelayer, false) { TargetLocation = xy };
|
||||||
@@ -197,6 +197,7 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
{
|
{
|
||||||
public string OrderID { get { return "BeginMinefield"; } }
|
public string OrderID { get { return "BeginMinefield"; } }
|
||||||
public int OrderPriority { get { return 5; } }
|
public int OrderPriority { get { return 5; } }
|
||||||
|
public bool OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
public string OrderID { get { return "PortableChronoTeleport"; } }
|
public string OrderID { get { return "PortableChronoTeleport"; } }
|
||||||
public int OrderPriority { get { return 5; } }
|
public int OrderPriority { get { return 5; } }
|
||||||
public bool IsQueued { get; protected set; }
|
public bool IsQueued { get; protected set; }
|
||||||
|
public bool OverrideSelection { get { return true; } }
|
||||||
|
|
||||||
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
|
||||||
{
|
{
|
||||||
@@ -153,7 +154,7 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
|
|
||||||
public IEnumerable<Order> Order(World world, CPos xy, MouseInput mi)
|
public IEnumerable<Order> Order(World world, CPos xy, MouseInput mi)
|
||||||
{
|
{
|
||||||
if (mi.Button == MouseButton.Left)
|
if (mi.Button == Game.Settings.Game.MouseButtonPreference.Cancel)
|
||||||
{
|
{
|
||||||
world.CancelInputMode();
|
world.CancelInputMode();
|
||||||
yield break;
|
yield break;
|
||||||
|
|||||||
@@ -101,6 +101,10 @@ namespace OpenRA.Mods.RA.Traits
|
|||||||
|
|
||||||
public SelectTarget(World world, string order, SupportPowerManager manager, ChronoshiftPower power)
|
public SelectTarget(World world, string order, SupportPowerManager manager, ChronoshiftPower power)
|
||||||
{
|
{
|
||||||
|
// Clear selection if using Left-Click Orders
|
||||||
|
if (Game.Settings.Game.UseClassicMouseStyle)
|
||||||
|
manager.Self.World.Selection.Clear();
|
||||||
|
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
this.order = order;
|
this.order = order;
|
||||||
this.power = power;
|
this.power = power;
|
||||||
|
|||||||
@@ -320,53 +320,16 @@ Container@SETTINGS_PANEL:
|
|||||||
Font: Bold
|
Font: Bold
|
||||||
Text: Input
|
Text: Input
|
||||||
Align: Center
|
Align: Center
|
||||||
Checkbox@EDGESCROLL_CHECKBOX:
|
Checkbox@CLASSICORDERS_CHECKBOX:
|
||||||
X: 15
|
X: 15
|
||||||
Y: 40
|
Y: 40
|
||||||
Width: 130
|
|
||||||
Height: 20
|
|
||||||
Font: Regular
|
|
||||||
Text: Edge Scrolling
|
|
||||||
Checkbox@LOCKMOUSE_CHECKBOX:
|
|
||||||
X: 15
|
|
||||||
Y: 70
|
|
||||||
Width: 130
|
|
||||||
Height: 20
|
|
||||||
Font: Regular
|
|
||||||
Text: Lock mouse to window
|
|
||||||
Label@SCROLL_SPEED_LABEL:
|
|
||||||
X: PARENT_RIGHT - WIDTH - 270
|
|
||||||
Y: 37
|
|
||||||
Width: 95
|
|
||||||
Height: 25
|
|
||||||
Text: Scroll Speed:
|
|
||||||
Align: Right
|
|
||||||
Slider@SCROLLSPEED_SLIDER:
|
|
||||||
X: PARENT_RIGHT - WIDTH - 15
|
|
||||||
Y: 43
|
|
||||||
Width: 250
|
Width: 250
|
||||||
Height: 20
|
Height: 20
|
||||||
Ticks: 5
|
Font: Regular
|
||||||
MinimumValue: 10
|
Text: Left-Click Orders
|
||||||
MaximumValue: 50
|
|
||||||
Label@UI_SCROLL_SPEED_LABEL:
|
|
||||||
X: PARENT_RIGHT - WIDTH - 270
|
|
||||||
Y: 67
|
|
||||||
Width: 95
|
|
||||||
Height: 25
|
|
||||||
Text: UI Scroll Speed:
|
|
||||||
Align: Right
|
|
||||||
Slider@UI_SCROLLSPEED_SLIDER:
|
|
||||||
X: PARENT_RIGHT - WIDTH - 15
|
|
||||||
Y: 73
|
|
||||||
Width: 250
|
|
||||||
Height: 20
|
|
||||||
Ticks: 5
|
|
||||||
MinimumValue: 1
|
|
||||||
MaximumValue: 100
|
|
||||||
Label@MOUSE_SCROLL_LABEL:
|
Label@MOUSE_SCROLL_LABEL:
|
||||||
X: PARENT_RIGHT - WIDTH - 120
|
X: PARENT_RIGHT - WIDTH - 120
|
||||||
Y: 99
|
Y: 39
|
||||||
Width: 160
|
Width: 160
|
||||||
Height: 20
|
Height: 20
|
||||||
Font: Regular
|
Font: Regular
|
||||||
@@ -374,11 +337,55 @@ Container@SETTINGS_PANEL:
|
|||||||
Align: Right
|
Align: Right
|
||||||
DropDownButton@MOUSE_SCROLL:
|
DropDownButton@MOUSE_SCROLL:
|
||||||
X: PARENT_RIGHT - WIDTH - 15
|
X: PARENT_RIGHT - WIDTH - 15
|
||||||
Y: 98
|
Y: 38
|
||||||
Width: 100
|
Width: 100
|
||||||
Height: 25
|
Height: 25
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Enabled
|
Text: Enabled
|
||||||
|
Checkbox@EDGESCROLL_CHECKBOX:
|
||||||
|
X: 15
|
||||||
|
Y: 70
|
||||||
|
Width: 130
|
||||||
|
Height: 20
|
||||||
|
Font: Regular
|
||||||
|
Text: Edge Scrolling
|
||||||
|
Checkbox@LOCKMOUSE_CHECKBOX:
|
||||||
|
X: 15
|
||||||
|
Y: 100
|
||||||
|
Width: 130
|
||||||
|
Height: 20
|
||||||
|
Font: Regular
|
||||||
|
Text: Lock mouse to window
|
||||||
|
Label@SCROLL_SPEED_LABEL:
|
||||||
|
X: PARENT_RIGHT - WIDTH - 270
|
||||||
|
Y: 67
|
||||||
|
Width: 95
|
||||||
|
Height: 25
|
||||||
|
Text: Scroll Speed:
|
||||||
|
Align: Right
|
||||||
|
Slider@SCROLLSPEED_SLIDER:
|
||||||
|
X: PARENT_RIGHT - WIDTH - 15
|
||||||
|
Y: 73
|
||||||
|
Width: 250
|
||||||
|
Height: 20
|
||||||
|
Ticks: 5
|
||||||
|
MinimumValue: 10
|
||||||
|
MaximumValue: 50
|
||||||
|
Label@UI_SCROLL_SPEED_LABEL:
|
||||||
|
X: PARENT_RIGHT - WIDTH - 270
|
||||||
|
Y: 97
|
||||||
|
Width: 95
|
||||||
|
Height: 25
|
||||||
|
Text: UI Scroll Speed:
|
||||||
|
Align: Right
|
||||||
|
Slider@UI_SCROLLSPEED_SLIDER:
|
||||||
|
X: PARENT_RIGHT - WIDTH - 15
|
||||||
|
Y: 103
|
||||||
|
Width: 250
|
||||||
|
Height: 20
|
||||||
|
Ticks: 5
|
||||||
|
MinimumValue: 1
|
||||||
|
MaximumValue: 100
|
||||||
Label@HOTKEYS_TITLE:
|
Label@HOTKEYS_TITLE:
|
||||||
Y: 135
|
Y: 135
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
|
|||||||
@@ -324,53 +324,16 @@ Background@SETTINGS_PANEL:
|
|||||||
Width: PARENT_RIGHT - 10
|
Width: PARENT_RIGHT - 10
|
||||||
Height: PARENT_BOTTOM
|
Height: PARENT_BOTTOM
|
||||||
Children:
|
Children:
|
||||||
Checkbox@EDGESCROLL_CHECKBOX:
|
Checkbox@CLASSICORDERS_CHECKBOX:
|
||||||
X: 15
|
X: 15
|
||||||
Y: 40
|
Y: 40
|
||||||
Width: 130
|
|
||||||
Height: 20
|
|
||||||
Font: Regular
|
|
||||||
Text: Edge Scrolling
|
|
||||||
Checkbox@LOCKMOUSE_CHECKBOX:
|
|
||||||
X: 15
|
|
||||||
Y: 70
|
|
||||||
Width: 130
|
|
||||||
Height: 20
|
|
||||||
Font: Regular
|
|
||||||
Text: Lock mouse to window
|
|
||||||
Label@SCROLL_SPEED_LABEL:
|
|
||||||
X: PARENT_RIGHT - WIDTH - 270
|
|
||||||
Y: 37
|
|
||||||
Width: 95
|
|
||||||
Height: 25
|
|
||||||
Text: Scroll Speed:
|
|
||||||
Align: Right
|
|
||||||
Slider@SCROLLSPEED_SLIDER:
|
|
||||||
X: PARENT_RIGHT - WIDTH - 15
|
|
||||||
Y: 43
|
|
||||||
Width: 250
|
Width: 250
|
||||||
Height: 20
|
Height: 20
|
||||||
Ticks: 5
|
Font: Regular
|
||||||
MinimumValue: 10
|
Text: Left-Click Orders
|
||||||
MaximumValue: 50
|
|
||||||
Label@UI_SCROLL_SPEED_LABEL:
|
|
||||||
X: PARENT_RIGHT - WIDTH - 270
|
|
||||||
Y: 67
|
|
||||||
Width: 95
|
|
||||||
Height: 25
|
|
||||||
Text: UI Scroll Speed:
|
|
||||||
Align: Right
|
|
||||||
Slider@UI_SCROLLSPEED_SLIDER:
|
|
||||||
X: PARENT_RIGHT - WIDTH - 15
|
|
||||||
Y: 73
|
|
||||||
Width: 250
|
|
||||||
Height: 20
|
|
||||||
Ticks: 5
|
|
||||||
MinimumValue: 1
|
|
||||||
MaximumValue: 100
|
|
||||||
Label@MOUSE_SCROLL_LABEL:
|
Label@MOUSE_SCROLL_LABEL:
|
||||||
X: PARENT_RIGHT - WIDTH - 120
|
X: PARENT_RIGHT - WIDTH - 120
|
||||||
Y: 99
|
Y: 39
|
||||||
Width: 160
|
Width: 160
|
||||||
Height: 20
|
Height: 20
|
||||||
Font: Regular
|
Font: Regular
|
||||||
@@ -378,11 +341,55 @@ Background@SETTINGS_PANEL:
|
|||||||
Align: Right
|
Align: Right
|
||||||
DropDownButton@MOUSE_SCROLL:
|
DropDownButton@MOUSE_SCROLL:
|
||||||
X: PARENT_RIGHT - WIDTH - 15
|
X: PARENT_RIGHT - WIDTH - 15
|
||||||
Y: 98
|
Y: 38
|
||||||
Width: 100
|
Width: 100
|
||||||
Height: 25
|
Height: 25
|
||||||
Font: Regular
|
Font: Regular
|
||||||
Text: Enabled
|
Text: Enabled
|
||||||
|
Checkbox@EDGESCROLL_CHECKBOX:
|
||||||
|
X: 15
|
||||||
|
Y: 70
|
||||||
|
Width: 130
|
||||||
|
Height: 20
|
||||||
|
Font: Regular
|
||||||
|
Text: Edge Scrolling
|
||||||
|
Checkbox@LOCKMOUSE_CHECKBOX:
|
||||||
|
X: 15
|
||||||
|
Y: 100
|
||||||
|
Width: 130
|
||||||
|
Height: 20
|
||||||
|
Font: Regular
|
||||||
|
Text: Lock mouse to window
|
||||||
|
Label@SCROLL_SPEED_LABEL:
|
||||||
|
X: PARENT_RIGHT - WIDTH - 270
|
||||||
|
Y: 67
|
||||||
|
Width: 95
|
||||||
|
Height: 25
|
||||||
|
Text: Scroll Speed:
|
||||||
|
Align: Right
|
||||||
|
Slider@SCROLLSPEED_SLIDER:
|
||||||
|
X: PARENT_RIGHT - WIDTH - 15
|
||||||
|
Y: 73
|
||||||
|
Width: 250
|
||||||
|
Height: 20
|
||||||
|
Ticks: 5
|
||||||
|
MinimumValue: 10
|
||||||
|
MaximumValue: 50
|
||||||
|
Label@UI_SCROLL_SPEED_LABEL:
|
||||||
|
X: PARENT_RIGHT - WIDTH - 270
|
||||||
|
Y: 97
|
||||||
|
Width: 95
|
||||||
|
Height: 25
|
||||||
|
Text: UI Scroll Speed:
|
||||||
|
Align: Right
|
||||||
|
Slider@UI_SCROLLSPEED_SLIDER:
|
||||||
|
X: PARENT_RIGHT - WIDTH - 15
|
||||||
|
Y: 103
|
||||||
|
Width: 250
|
||||||
|
Height: 20
|
||||||
|
Ticks: 5
|
||||||
|
MinimumValue: 1
|
||||||
|
MaximumValue: 100
|
||||||
Label@HOTKEYS_TITLE:
|
Label@HOTKEYS_TITLE:
|
||||||
Y: 135
|
Y: 135
|
||||||
Width: PARENT_RIGHT
|
Width: PARENT_RIGHT
|
||||||
|
|||||||
Reference in New Issue
Block a user