Restored faulty left-click logic for now.
This commit is contained in:
@@ -27,6 +27,8 @@ namespace OpenRA
|
||||
{
|
||||
public static class Game
|
||||
{
|
||||
public static MouseButtonPreference mouseButtonPreference = new MouseButtonPreference();
|
||||
|
||||
public const int NetTickScale = 3; // 120 ms net tick for 40 ms local tick
|
||||
public const int Timestep = 40;
|
||||
public const int TimestepJankThreshold = 250; // Don't catch up for delays larger than 250ms
|
||||
|
||||
@@ -49,4 +49,25 @@ namespace OpenRA
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ namespace OpenRA.Orders
|
||||
if (self.Destroyed || !target.IsValidFor(self))
|
||||
return null;
|
||||
|
||||
if (mi.Button == MouseButton.Right)
|
||||
if (mi.Button == Game.mouseButtonPreference.Action)
|
||||
{
|
||||
foreach (var o in self.TraitsImplementing<IIssueOrder>()
|
||||
.SelectMany(trait => trait.Orders
|
||||
|
||||
@@ -130,6 +130,7 @@ namespace OpenRA
|
||||
public float ViewportEdgeScrollStep = 10f;
|
||||
public float UIScrollSpeed = 50f;
|
||||
|
||||
public bool UseClassicMouseStyle = false;
|
||||
public bool AlwaysShowStatusBars = false;
|
||||
public bool TeamHealthColors = false;
|
||||
|
||||
|
||||
@@ -55,6 +55,9 @@ namespace OpenRA.Widgets
|
||||
public override bool HandleMouseInput(MouseInput mi)
|
||||
{
|
||||
var xy = worldRenderer.Viewport.ViewToWorldPx(mi.Location);
|
||||
|
||||
var useClassicMouseStyle = Game.Settings.Game.UseClassicMouseStyle;
|
||||
|
||||
var hasBox = SelectionBox != null;
|
||||
var multiClick = mi.MultiTapCount >= 2;
|
||||
|
||||
@@ -66,6 +69,7 @@ namespace OpenRA.Widgets
|
||||
dragStart = xy;
|
||||
|
||||
// place buildings
|
||||
if(!useClassicMouseStyle)
|
||||
ApplyOrders(World, xy, mi);
|
||||
}
|
||||
|
||||
@@ -74,6 +78,18 @@ namespace OpenRA.Widgets
|
||||
|
||||
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Up)
|
||||
{
|
||||
if (useClassicMouseStyle && HasMouseFocus)
|
||||
{
|
||||
// order units around
|
||||
if (!hasBox && World.Selection.Actors.Any() && !multiClick)
|
||||
{
|
||||
ApplyOrders(World, xy, mi);
|
||||
YieldMouseFocus(mi);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (World.OrderGenerator is UnitOrderGenerator)
|
||||
{
|
||||
if (multiClick)
|
||||
@@ -97,9 +113,14 @@ namespace OpenRA.Widgets
|
||||
YieldMouseFocus(mi);
|
||||
}
|
||||
|
||||
// don't issue orders while selecting
|
||||
if (mi.Button == MouseButton.Right && mi.Event == MouseInputEvent.Down && !hasBox)
|
||||
if (mi.Button == MouseButton.Right && mi.Event == MouseInputEvent.Down)
|
||||
{
|
||||
if (useClassicMouseStyle)
|
||||
World.Selection.Clear();
|
||||
|
||||
if (!hasBox) // don't issue orders while selecting
|
||||
ApplyOrders(World, xy, mi);
|
||||
}
|
||||
|
||||
lastMousePosition = xy;
|
||||
|
||||
@@ -172,7 +193,7 @@ namespace OpenRA.Widgets
|
||||
var mi = new MouseInput
|
||||
{
|
||||
Location = screenPos,
|
||||
Button = MouseButton.Right,
|
||||
Button = Game.mouseButtonPreference.Action,
|
||||
Modifiers = Game.GetModifierKeys()
|
||||
};
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public IEnumerable<Order> Order(World world, CPos xy, MouseInput mi)
|
||||
{
|
||||
if (mi.Button == MouseButton.Left)
|
||||
if (mi.Button == Game.mouseButtonPreference.Cancel)
|
||||
{
|
||||
world.CancelInputMode();
|
||||
yield break;
|
||||
|
||||
@@ -312,6 +312,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
var gs = Game.Settings.Game;
|
||||
var ks = Game.Settings.Keys;
|
||||
|
||||
BindCheckboxPref(panel, "CLASSICORDERS_CHECKBOX", gs, "UseClassicMouseStyle");
|
||||
BindCheckboxPref(panel, "EDGESCROLL_CHECKBOX", gs, "ViewportEdgeScroll");
|
||||
BindCheckboxPref(panel, "LOCKMOUSE_CHECKBOX", gs, "LockMouseWindow");
|
||||
BindSliderPref(panel, "SCROLLSPEED_SLIDER", gs, "ViewportEdgeScrollStep");
|
||||
@@ -472,6 +473,7 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
||||
|
||||
return () =>
|
||||
{
|
||||
gs.UseClassicMouseStyle = dgs.UseClassicMouseStyle;
|
||||
gs.MouseScroll = dgs.MouseScroll;
|
||||
gs.LockMouseWindow = dgs.LockMouseWindow;
|
||||
gs.ViewportEdgeScroll = dgs.ViewportEdgeScroll;
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace OpenRA.Mods.Common.Widgets
|
||||
|
||||
if (actors.Any())
|
||||
world.OrderGenerator = new GenericSelectTarget(actors,
|
||||
"AttackMove", "attackmove", MouseButton.Right);
|
||||
"AttackMove", "attackmove", Game.mouseButtonPreference.Action);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -146,7 +146,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
|
||||
public IEnumerable<Order> Order(World world, CPos xy, MouseInput mi)
|
||||
{
|
||||
if (mi.Button == MouseButton.Left)
|
||||
if (mi.Button == Game.mouseButtonPreference.Cancel)
|
||||
{
|
||||
world.CancelInputMode();
|
||||
yield break;
|
||||
@@ -157,7 +157,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
.MaxByOrDefault(a => a.Info.Traits.Contains<SelectableInfo>()
|
||||
? a.Info.Traits.Get<SelectableInfo>().Priority : int.MinValue);
|
||||
|
||||
if (mi.Button == MouseButton.Right && underCursor == null)
|
||||
if (mi.Button == Game.mouseButtonPreference.Action && underCursor == null)
|
||||
{
|
||||
minelayer.World.CancelInputMode();
|
||||
yield return new Order("PlaceMinefield", minelayer, false) { TargetLocation = xy };
|
||||
|
||||
@@ -153,7 +153,7 @@ namespace OpenRA.Mods.RA.Traits
|
||||
|
||||
public IEnumerable<Order> Order(World world, CPos xy, MouseInput mi)
|
||||
{
|
||||
if (mi.Button == MouseButton.Left)
|
||||
if (mi.Button == Game.mouseButtonPreference.Cancel)
|
||||
{
|
||||
world.CancelInputMode();
|
||||
yield break;
|
||||
|
||||
@@ -320,53 +320,16 @@ Container@SETTINGS_PANEL:
|
||||
Font: Bold
|
||||
Text: Input
|
||||
Align: Center
|
||||
Checkbox@EDGESCROLL_CHECKBOX:
|
||||
Checkbox@CLASSICORDERS_CHECKBOX:
|
||||
X: 15
|
||||
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
|
||||
Height: 20
|
||||
Ticks: 5
|
||||
MinimumValue: 10
|
||||
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
|
||||
Font: Regular
|
||||
Text: Left-Click Orders
|
||||
Label@MOUSE_SCROLL_LABEL:
|
||||
X: PARENT_RIGHT - WIDTH - 120
|
||||
Y: 99
|
||||
Y: 39
|
||||
Width: 160
|
||||
Height: 20
|
||||
Font: Regular
|
||||
@@ -374,11 +337,55 @@ Container@SETTINGS_PANEL:
|
||||
Align: Right
|
||||
DropDownButton@MOUSE_SCROLL:
|
||||
X: PARENT_RIGHT - WIDTH - 15
|
||||
Y: 98
|
||||
Y: 38
|
||||
Width: 100
|
||||
Height: 25
|
||||
Font: Regular
|
||||
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:
|
||||
Y: 135
|
||||
Width: PARENT_RIGHT
|
||||
|
||||
@@ -324,53 +324,16 @@ Background@SETTINGS_PANEL:
|
||||
Width: PARENT_RIGHT - 10
|
||||
Height: PARENT_BOTTOM
|
||||
Children:
|
||||
Checkbox@EDGESCROLL_CHECKBOX:
|
||||
Checkbox@CLASSICORDERS_CHECKBOX:
|
||||
X: 15
|
||||
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
|
||||
Height: 20
|
||||
Ticks: 5
|
||||
MinimumValue: 10
|
||||
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
|
||||
Font: Regular
|
||||
Text: Left-Click Orders
|
||||
Label@MOUSE_SCROLL_LABEL:
|
||||
X: PARENT_RIGHT - WIDTH - 120
|
||||
Y: 99
|
||||
Y: 39
|
||||
Width: 160
|
||||
Height: 20
|
||||
Font: Regular
|
||||
@@ -378,11 +341,55 @@ Background@SETTINGS_PANEL:
|
||||
Align: Right
|
||||
DropDownButton@MOUSE_SCROLL:
|
||||
X: PARENT_RIGHT - WIDTH - 15
|
||||
Y: 98
|
||||
Y: 38
|
||||
Width: 100
|
||||
Height: 25
|
||||
Font: Regular
|
||||
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:
|
||||
Y: 135
|
||||
Width: PARENT_RIGHT
|
||||
|
||||
Reference in New Issue
Block a user