Fix control group decoration position.
This commit is contained in:
@@ -69,33 +69,20 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
pipImages.PlayFetchIndex(Info.GroupSequence, () => (int)group);
|
pipImages.PlayFetchIndex(Info.GroupSequence, () => (int)group);
|
||||||
|
|
||||||
var bounds = self.VisualBounds;
|
var bounds = self.VisualBounds;
|
||||||
var halfSize = (0.5f * pipImages.Image.Size.XY).ToInt2();
|
var boundsOffset = 0.5f * new float2(bounds.Left + bounds.Right, bounds.Top + bounds.Bottom);
|
||||||
|
|
||||||
var boundsOffset = new int2(bounds.Left + bounds.Right, bounds.Top + bounds.Bottom) / 2;
|
|
||||||
var sizeOffset = -halfSize;
|
|
||||||
if (Info.ReferencePoint.HasFlag(ReferencePoints.Top))
|
if (Info.ReferencePoint.HasFlag(ReferencePoints.Top))
|
||||||
{
|
boundsOffset -= new float2(0, 0.5f * bounds.Height);
|
||||||
boundsOffset -= new int2(0, bounds.Height / 2);
|
|
||||||
sizeOffset += new int2(0, halfSize.Y);
|
if (Info.ReferencePoint.HasFlag(ReferencePoints.Bottom))
|
||||||
}
|
boundsOffset += new float2(0, 0.5f * bounds.Height);
|
||||||
else if (Info.ReferencePoint.HasFlag(ReferencePoints.Bottom))
|
|
||||||
{
|
|
||||||
boundsOffset += new int2(0, bounds.Height / 2);
|
|
||||||
sizeOffset -= new int2(0, halfSize.Y);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Info.ReferencePoint.HasFlag(ReferencePoints.Left))
|
if (Info.ReferencePoint.HasFlag(ReferencePoints.Left))
|
||||||
{
|
boundsOffset -= new float2(0.5f * bounds.Width, 0);
|
||||||
boundsOffset -= new int2(bounds.Width / 2, 0);
|
|
||||||
sizeOffset += new int2(halfSize.X, 0);
|
|
||||||
}
|
|
||||||
else if (Info.ReferencePoint.HasFlag(ReferencePoints.Right))
|
|
||||||
{
|
|
||||||
boundsOffset += new int2(bounds.Width / 2, 0);
|
|
||||||
sizeOffset -= new int2(halfSize.X, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
var pxPos = wr.Viewport.WorldToViewPx(wr.ScreenPxPosition(self.CenterPosition) + boundsOffset) + sizeOffset;
|
if (Info.ReferencePoint.HasFlag(ReferencePoints.Right))
|
||||||
|
boundsOffset += new float2(0.5f * bounds.Width, 0);
|
||||||
|
|
||||||
|
var pxPos = wr.Viewport.WorldToViewPx(wr.ScreenPxPosition(self.CenterPosition) + boundsOffset.ToInt2()) - (0.5f * pipImages.Image.Size.XY).ToInt2();
|
||||||
yield return new UISpriteRenderable(pipImages.Image, self.CenterPosition, pxPos, 0, palette, 1f);
|
yield return new UISpriteRenderable(pipImages.Image, self.CenterPosition, pxPos, 0, palette, 1f);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -194,7 +194,6 @@
|
|||||||
Beach: 80
|
Beach: 80
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
WithSpriteControlGroupDecoration:
|
WithSpriteControlGroupDecoration:
|
||||||
ReferencePoint: Top
|
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 12,17,0,-6
|
Bounds: 12,17,0,-6
|
||||||
Targetable:
|
Targetable:
|
||||||
|
|||||||
@@ -255,6 +255,7 @@ pips:
|
|||||||
Length: *
|
Length: *
|
||||||
groups: pdigits
|
groups: pdigits
|
||||||
Length: *
|
Length: *
|
||||||
|
Offset: 9, 5
|
||||||
pip-hazmat: pip-hazmat
|
pip-hazmat: pip-hazmat
|
||||||
Length: *
|
Length: *
|
||||||
|
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ pips:
|
|||||||
groups: DATA.R8
|
groups: DATA.R8
|
||||||
Start: 17
|
Start: 17
|
||||||
Length: 10
|
Length: 10
|
||||||
|
Offset: 3, 3
|
||||||
pickup-indicator: DATA.R8
|
pickup-indicator: DATA.R8
|
||||||
Start: 112
|
Start: 112
|
||||||
pip-empty: DATA.R8
|
pip-empty: DATA.R8
|
||||||
|
|||||||
@@ -191,7 +191,6 @@
|
|||||||
Beach: 80
|
Beach: 80
|
||||||
SelectionDecorations:
|
SelectionDecorations:
|
||||||
WithSpriteControlGroupDecoration:
|
WithSpriteControlGroupDecoration:
|
||||||
ReferencePoint: Top
|
|
||||||
Selectable:
|
Selectable:
|
||||||
Bounds: 12,18,0,-8
|
Bounds: 12,18,0,-8
|
||||||
Targetable:
|
Targetable:
|
||||||
|
|||||||
@@ -93,6 +93,7 @@ pips:
|
|||||||
groups:
|
groups:
|
||||||
Start: 8
|
Start: 8
|
||||||
Length: 10
|
Length: 10
|
||||||
|
Offset: 9, 5
|
||||||
medic:
|
medic:
|
||||||
Start: 20
|
Start: 20
|
||||||
# ready:
|
# ready:
|
||||||
|
|||||||
Reference in New Issue
Block a user