From 09f4b69aef9d73d359f7eca7a5c8d10f60945116 Mon Sep 17 00:00:00 2001 From: teinarss Date: Sun, 14 Apr 2019 17:43:41 +0200 Subject: [PATCH] Fixed the problem with clicking the Support Power button --- .../SupportPowers/SelectDirectionalTarget.cs | 26 +++++++++---------- mods/ra/chrome/ingame-player.yaml | 23 ++++++++-------- 2 files changed, 24 insertions(+), 25 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs b/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs index 5d6db44ff3..3d4bb71cda 100644 --- a/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs +++ b/OpenRA.Mods.Common/Traits/SupportPowers/SelectDirectionalTarget.cs @@ -32,7 +32,7 @@ namespace OpenRA.Mods.Common.Traits CPos targetCell; int2 location; int2 dragLocation; - bool beginDrag; + bool activated; bool dragStarted; Arrow currentArrow; @@ -64,27 +64,27 @@ namespace OpenRA.Mods.Common.Traits if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Down) { - if (!beginDrag) + if (!activated) { targetCell = cell; location = mi.Location; - beginDrag = true; + activated = true; } yield break; } + if (!activated) + yield break; + if (mi.Event == MouseInputEvent.Move) { - if (beginDrag) - { - dragLocation = mi.Location; - var angle = AngleBetween(location, dragLocation); - currentArrow = GetArrow(angle); - dragStarted = true; + dragLocation = mi.Location; + var angle = AngleBetween(location, dragLocation); + currentArrow = GetArrow(angle); + dragStarted = true; - yield break; - } + yield break; } if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Up) @@ -117,7 +117,7 @@ namespace OpenRA.Mods.Common.Traits IEnumerable IOrderGenerator.RenderAboveShroud(WorldRenderer wr, World world) { - if (!beginDrag) + if (!activated) return Enumerable.Empty(); var targetPalette = wr.Palette(targetPlaceholderCursorPalette); @@ -134,7 +134,7 @@ namespace OpenRA.Mods.Common.Traits return renderables; } - string IOrderGenerator.GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi) { return beginDrag ? "invisible" : cursor; } + string IOrderGenerator.GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi) { return activated ? "invisible" : cursor; } // Starting at (0, -1) and rotating in CCW static double AngleBetween(int2 p1, int2 p2) diff --git a/mods/ra/chrome/ingame-player.yaml b/mods/ra/chrome/ingame-player.yaml index 477a377221..6dabfd3705 100644 --- a/mods/ra/chrome/ingame-player.yaml +++ b/mods/ra/chrome/ingame-player.yaml @@ -8,18 +8,6 @@ Container@PLAYER_WIDGETS: X: 10 Y: 10 Children: - Container@PALETTE_FOREGROUND: - Children: - Image@ICON_TEMPLATE: - Logic: AddFactionSuffixLogic - X: 0 - 2 - Y: 0 - 2 - Width: 62 - Height: 46 - ClickThrough: false - IgnoreMouseOver: true - ImageCollection: sidebar - ImageName: background-supportoverlay SupportPowers@SUPPORT_PALETTE: IconSize: 62, 46 IconSpriteOffset: -1, -1 @@ -28,6 +16,17 @@ Container@PLAYER_WIDGETS: HoldText: ON HOLD HotkeyPrefix: SupportPower HotkeyCount: 6 + Container@PALETTE_FOREGROUND: + Children: + Image@ICON_TEMPLATE: + Logic: AddFactionSuffixLogic + X: 0 - 2 + Y: 0 - 2 + Width: 62 + Height: 46 + IgnoreMouseOver: true + ImageCollection: sidebar + ImageName: background-supportoverlay SupportPowerTimer@SUPPORT_POWER_TIMER: X: 80 Y: 10