Fixed the problem with clicking the Support Power button
This commit is contained in:
@@ -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<IRenderable> IOrderGenerator.RenderAboveShroud(WorldRenderer wr, World world)
|
||||
{
|
||||
if (!beginDrag)
|
||||
if (!activated)
|
||||
return Enumerable.Empty<IRenderable>();
|
||||
|
||||
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)
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user