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;
|
CPos targetCell;
|
||||||
int2 location;
|
int2 location;
|
||||||
int2 dragLocation;
|
int2 dragLocation;
|
||||||
bool beginDrag;
|
bool activated;
|
||||||
bool dragStarted;
|
bool dragStarted;
|
||||||
Arrow currentArrow;
|
Arrow currentArrow;
|
||||||
|
|
||||||
@@ -64,27 +64,27 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Down)
|
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Down)
|
||||||
{
|
{
|
||||||
if (!beginDrag)
|
if (!activated)
|
||||||
{
|
{
|
||||||
targetCell = cell;
|
targetCell = cell;
|
||||||
location = mi.Location;
|
location = mi.Location;
|
||||||
beginDrag = true;
|
activated = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
yield break;
|
yield break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!activated)
|
||||||
|
yield break;
|
||||||
|
|
||||||
if (mi.Event == MouseInputEvent.Move)
|
if (mi.Event == MouseInputEvent.Move)
|
||||||
{
|
{
|
||||||
if (beginDrag)
|
dragLocation = mi.Location;
|
||||||
{
|
var angle = AngleBetween(location, dragLocation);
|
||||||
dragLocation = mi.Location;
|
currentArrow = GetArrow(angle);
|
||||||
var angle = AngleBetween(location, dragLocation);
|
dragStarted = true;
|
||||||
currentArrow = GetArrow(angle);
|
|
||||||
dragStarted = true;
|
|
||||||
|
|
||||||
yield break;
|
yield break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mi.Button == MouseButton.Left && mi.Event == MouseInputEvent.Up)
|
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)
|
IEnumerable<IRenderable> IOrderGenerator.RenderAboveShroud(WorldRenderer wr, World world)
|
||||||
{
|
{
|
||||||
if (!beginDrag)
|
if (!activated)
|
||||||
return Enumerable.Empty<IRenderable>();
|
return Enumerable.Empty<IRenderable>();
|
||||||
|
|
||||||
var targetPalette = wr.Palette(targetPlaceholderCursorPalette);
|
var targetPalette = wr.Palette(targetPlaceholderCursorPalette);
|
||||||
@@ -134,7 +134,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
return renderables;
|
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
|
// Starting at (0, -1) and rotating in CCW
|
||||||
static double AngleBetween(int2 p1, int2 p2)
|
static double AngleBetween(int2 p1, int2 p2)
|
||||||
|
|||||||
@@ -8,18 +8,6 @@ Container@PLAYER_WIDGETS:
|
|||||||
X: 10
|
X: 10
|
||||||
Y: 10
|
Y: 10
|
||||||
Children:
|
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:
|
SupportPowers@SUPPORT_PALETTE:
|
||||||
IconSize: 62, 46
|
IconSize: 62, 46
|
||||||
IconSpriteOffset: -1, -1
|
IconSpriteOffset: -1, -1
|
||||||
@@ -28,6 +16,17 @@ Container@PLAYER_WIDGETS:
|
|||||||
HoldText: ON HOLD
|
HoldText: ON HOLD
|
||||||
HotkeyPrefix: SupportPower
|
HotkeyPrefix: SupportPower
|
||||||
HotkeyCount: 6
|
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:
|
SupportPowerTimer@SUPPORT_POWER_TIMER:
|
||||||
X: 80
|
X: 80
|
||||||
Y: 10
|
Y: 10
|
||||||
|
|||||||
Reference in New Issue
Block a user