Overhaul WithDecoration trait.
This commit is contained in:
@@ -20,16 +20,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Flags]
|
[Flags]
|
||||||
public enum ReferencePoints
|
public enum ReferencePoints
|
||||||
{
|
{
|
||||||
Top = 0,
|
Center = 0,
|
||||||
VCenter = 1,
|
Top = 1,
|
||||||
Bottom = 2,
|
Bottom = 2,
|
||||||
|
Left = 4,
|
||||||
Left = 0 << 2,
|
Right = 8,
|
||||||
HCenter = 1 << 2,
|
|
||||||
Right = 2 << 2,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Desc("Displays a custom animation if conditions are satisfied.")]
|
[Desc("Displays a custom UI overlay relative to the selection box.")]
|
||||||
public class WithDecorationInfo : UpgradableTraitInfo
|
public class WithDecorationInfo : UpgradableTraitInfo
|
||||||
{
|
{
|
||||||
[Desc("Image used for this decoration. Defaults to the actor's type.")]
|
[Desc("Image used for this decoration. Defaults to the actor's type.")]
|
||||||
@@ -41,131 +39,96 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Palette to render the sprite in. Reference the world actor's PaletteFrom* traits.")]
|
[Desc("Palette to render the sprite in. Reference the world actor's PaletteFrom* traits.")]
|
||||||
[PaletteReference] public readonly string Palette = "chrome";
|
[PaletteReference] public readonly string Palette = "chrome";
|
||||||
|
|
||||||
[Desc("Point in the actor's bounding box used as reference for offsetting the decoration image. " +
|
[Desc("Point in the actor's selection box used as reference for offsetting the decoration image. " +
|
||||||
"Possible values are any combination of Top, VCenter, Bottom and Left, HCenter, Right separated by a comma.")]
|
"Possible values are combinations of Center, Top, Bottom, Left, Right.")]
|
||||||
public readonly ReferencePoints ReferencePoint = ReferencePoints.Top | ReferencePoints.Left;
|
public readonly ReferencePoints ReferencePoint = ReferencePoints.Top | ReferencePoints.Left;
|
||||||
|
|
||||||
[Desc("Pixel offset relative to the actor's bounding box' reference point.")]
|
|
||||||
public readonly int2 Offset = int2.Zero;
|
|
||||||
|
|
||||||
[Desc("The Z offset to apply when rendering this decoration.")]
|
[Desc("The Z offset to apply when rendering this decoration.")]
|
||||||
public readonly int ZOffset = 1;
|
public readonly int ZOffset = 1;
|
||||||
|
|
||||||
[Desc("Visual scale of the image.")]
|
[Desc("Player stances who can view the decoration.")]
|
||||||
public readonly float Scale = 1f;
|
public readonly Stance Stances = Stance.Ally;
|
||||||
|
|
||||||
[Desc("Should this be visible to allied players?")]
|
|
||||||
public readonly bool ShowToAllies = true;
|
|
||||||
|
|
||||||
[Desc("Should this be visible to enemy players?")]
|
|
||||||
public readonly bool ShowToEnemies = false;
|
|
||||||
|
|
||||||
[Desc("Should this be visible only when selected?")]
|
[Desc("Should this be visible only when selected?")]
|
||||||
public readonly bool SelectionDecoration = false;
|
public readonly bool RequiresSelection = false;
|
||||||
|
|
||||||
public override object Create(ActorInitializer init) { return new WithDecoration(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new WithDecoration(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class WithDecoration : UpgradableTrait<WithDecorationInfo>, IRender, IPostRenderSelection
|
public class WithDecoration : UpgradableTrait<WithDecorationInfo>, ITick, IRender, IPostRenderSelection
|
||||||
{
|
{
|
||||||
readonly WithDecorationInfo info;
|
protected readonly Animation Anim;
|
||||||
|
|
||||||
readonly string image;
|
readonly string image;
|
||||||
readonly Animation anim;
|
|
||||||
readonly Actor self;
|
readonly Actor self;
|
||||||
|
|
||||||
public WithDecoration(Actor self, WithDecorationInfo info)
|
public WithDecoration(Actor self, WithDecorationInfo info)
|
||||||
: base(info)
|
: base(info)
|
||||||
{
|
{
|
||||||
this.info = info;
|
|
||||||
this.self = self;
|
this.self = self;
|
||||||
image = info.Image ?? self.Info.Name;
|
image = info.Image ?? self.Info.Name;
|
||||||
anim = new Animation(self.World, image, () => self.World.Paused);
|
Anim = new Animation(self.World, image, () => self.World.Paused);
|
||||||
anim.PlayRepeating(info.Sequence);
|
Anim.PlayRepeating(info.Sequence);
|
||||||
}
|
|
||||||
|
|
||||||
public void PlaySingleFrame(int frame)
|
|
||||||
{
|
|
||||||
anim.PlayFetchIndex(info.Sequence, () => frame);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual bool ShouldRender(Actor self) { return true; }
|
public virtual bool ShouldRender(Actor self) { return true; }
|
||||||
|
|
||||||
public IEnumerable<IRenderable> Render(Actor self, WorldRenderer wr)
|
public IEnumerable<IRenderable> Render(Actor self, WorldRenderer wr)
|
||||||
{
|
{
|
||||||
return !info.SelectionDecoration ? RenderInner(self, wr, self.Bounds) : Enumerable.Empty<IRenderable>();
|
return !Info.RequiresSelection ? RenderInner(self, wr) : Enumerable.Empty<IRenderable>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<IRenderable> RenderAfterWorld(WorldRenderer wr)
|
public IEnumerable<IRenderable> RenderAfterWorld(WorldRenderer wr)
|
||||||
{
|
{
|
||||||
return info.SelectionDecoration ? RenderInner(self, wr, self.VisualBounds) : Enumerable.Empty<IRenderable>();
|
return Info.RequiresSelection ? RenderInner(self, wr) : Enumerable.Empty<IRenderable>();
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerable<IRenderable> RenderInner(Actor self, WorldRenderer wr, Rectangle actorBounds)
|
IEnumerable<IRenderable> RenderInner(Actor self, WorldRenderer wr)
|
||||||
{
|
{
|
||||||
if (IsTraitDisabled)
|
if (IsTraitDisabled || self.IsDead || !self.IsInWorld || Anim == null)
|
||||||
return Enumerable.Empty<IRenderable>();
|
return Enumerable.Empty<IRenderable>();
|
||||||
|
|
||||||
if (self.IsDead || !self.IsInWorld)
|
if (self.World.RenderPlayer != null)
|
||||||
return Enumerable.Empty<IRenderable>();
|
|
||||||
|
|
||||||
if (anim == null)
|
|
||||||
return Enumerable.Empty<IRenderable>();
|
|
||||||
|
|
||||||
var allied = self.Owner.IsAlliedWith(self.World.RenderPlayer);
|
|
||||||
|
|
||||||
if (!allied && !info.ShowToEnemies)
|
|
||||||
return Enumerable.Empty<IRenderable>();
|
|
||||||
|
|
||||||
if (allied && !info.ShowToAllies)
|
|
||||||
return Enumerable.Empty<IRenderable>();
|
|
||||||
|
|
||||||
if (!ShouldRender(self))
|
|
||||||
return Enumerable.Empty<IRenderable>();
|
|
||||||
|
|
||||||
if (self.World.FogObscures(self))
|
|
||||||
return Enumerable.Empty<IRenderable>();
|
|
||||||
|
|
||||||
var pxPos = wr.ScreenPxPosition(self.CenterPosition);
|
|
||||||
actorBounds.Offset(pxPos.X, pxPos.Y);
|
|
||||||
|
|
||||||
var img = anim.Image;
|
|
||||||
var imgSize = img.Size.ToInt2();
|
|
||||||
|
|
||||||
switch (info.ReferencePoint & (ReferencePoints)3)
|
|
||||||
{
|
{
|
||||||
case ReferencePoints.Top:
|
var stance = self.Owner.Stances[self.World.RenderPlayer];
|
||||||
pxPos = pxPos.WithY(actorBounds.Top + imgSize.Y / 2);
|
if (!Info.Stances.HasStance(stance))
|
||||||
break;
|
return Enumerable.Empty<IRenderable>();
|
||||||
case ReferencePoints.VCenter:
|
|
||||||
pxPos = pxPos.WithY((actorBounds.Top + actorBounds.Bottom) / 2);
|
|
||||||
break;
|
|
||||||
case ReferencePoints.Bottom:
|
|
||||||
pxPos = pxPos.WithY(actorBounds.Bottom - imgSize.Y / 2);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (info.ReferencePoint & (ReferencePoints)(3 << 2))
|
if (!ShouldRender(self) || self.World.FogObscures(self))
|
||||||
|
return Enumerable.Empty<IRenderable>();
|
||||||
|
|
||||||
|
var bounds = self.VisualBounds;
|
||||||
|
var halfSize = (0.5f * Anim.Image.Size).ToInt2();
|
||||||
|
|
||||||
|
var boundsOffset = new int2(bounds.Left + bounds.Right, bounds.Top + bounds.Bottom) / 2;
|
||||||
|
var sizeOffset = -halfSize;
|
||||||
|
if (Info.ReferencePoint.HasFlag(ReferencePoints.Top))
|
||||||
{
|
{
|
||||||
case ReferencePoints.Left:
|
boundsOffset -= new int2(0, bounds.Height / 2);
|
||||||
pxPos = pxPos.WithX(actorBounds.Left + imgSize.X / 2);
|
sizeOffset += new int2(0, halfSize.Y);
|
||||||
break;
|
}
|
||||||
case ReferencePoints.HCenter:
|
else if (Info.ReferencePoint.HasFlag(ReferencePoints.Bottom))
|
||||||
pxPos = pxPos.WithX((actorBounds.Left + actorBounds.Right) / 2);
|
{
|
||||||
break;
|
boundsOffset += new int2(0, bounds.Height / 2);
|
||||||
case ReferencePoints.Right:
|
sizeOffset -= new int2(0, halfSize.Y);
|
||||||
pxPos = pxPos.WithX(actorBounds.Right - imgSize.X / 2);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pxPos += info.Offset;
|
if (Info.ReferencePoint.HasFlag(ReferencePoints.Left))
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
// HACK: Because WorldRenderer.Position() does not care about terrain height at the location
|
var pxPos = wr.Viewport.WorldToViewPx(wr.ScreenPxPosition(self.CenterPosition) + boundsOffset) + sizeOffset;
|
||||||
var renderPos = wr.ProjectedPosition(pxPos);
|
return new IRenderable[] { new UISpriteRenderable(Anim.Image, self.CenterPosition, pxPos, Info.ZOffset, wr.Palette(Info.Palette), 1f) };
|
||||||
renderPos = new WPos(renderPos.X, renderPos.Y + self.CenterPosition.Z, self.CenterPosition.Z);
|
|
||||||
|
|
||||||
anim.Tick();
|
|
||||||
|
|
||||||
return new IRenderable[] { new SpriteRenderable(img, renderPos, WVec.Zero, info.ZOffset, wr.Palette(info.Palette), info.Scale, true) };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Tick(Actor self) { Anim.Tick(); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
|
|
||||||
protected override void UpgradeLevelChanged(Actor self, int oldLevel, int newLevel)
|
protected override void UpgradeLevelChanged(Actor self, int oldLevel, int newLevel)
|
||||||
{
|
{
|
||||||
PlaySingleFrame(newLevel - 1);
|
Anim.PlayFetchIndex(Info.Sequence, () => newLevel - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,15 +30,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[PaletteReference] public readonly string Palette = "chrome";
|
[PaletteReference] public readonly string Palette = "chrome";
|
||||||
|
|
||||||
[Desc("Point on the production icon's used as reference for offsetting the overlay. ",
|
[Desc("Point on the production icon's used as reference for offsetting the overlay. ",
|
||||||
"Possible values are any combination of Top, VCenter, Bottom and Left, HCenter, Right separated by a comma.")]
|
"Possible values are combinations of Center, Top, Bottom, Left, Right.")]
|
||||||
public readonly ReferencePoints ReferencePoint = ReferencePoints.Top | ReferencePoints.Left;
|
public readonly ReferencePoints ReferencePoint = ReferencePoints.Top | ReferencePoints.Left;
|
||||||
|
|
||||||
[Desc("Pixel offset relative to the icon's reference point.")]
|
|
||||||
public readonly int2 Offset = int2.Zero;
|
|
||||||
|
|
||||||
[Desc("Visual scale of the overlay.")]
|
|
||||||
public readonly float Scale = 1f;
|
|
||||||
|
|
||||||
public object Create(ActorInitializer init) { return new VeteranProductionIconOverlay(init, this); }
|
public object Create(ActorInitializer init) { return new VeteranProductionIconOverlay(init, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,55 +70,30 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Sprite Sprite()
|
Sprite IProductionIconOverlay.Sprite { get { return sprite; } }
|
||||||
|
string IProductionIconOverlay.Palette { get { return info.Palette; } }
|
||||||
|
float2 IProductionIconOverlay.Offset(float2 iconSize)
|
||||||
{
|
{
|
||||||
return sprite;
|
float x = 0;
|
||||||
|
float y = 0;
|
||||||
|
if (info.ReferencePoint.HasFlag(ReferencePoints.Top))
|
||||||
|
y -= iconSize.Y / 2 - sprite.Size.Y / 2;
|
||||||
|
else if (info.ReferencePoint.HasFlag(ReferencePoints.Bottom))
|
||||||
|
y += iconSize.Y / 2 - sprite.Size.Y / 2;
|
||||||
|
|
||||||
|
if (info.ReferencePoint.HasFlag(ReferencePoints.Left))
|
||||||
|
x -= iconSize.X / 2 - sprite.Size.X / 2;
|
||||||
|
else if (info.ReferencePoint.HasFlag(ReferencePoints.Right))
|
||||||
|
x += iconSize.X / 2 - sprite.Size.X / 2;
|
||||||
|
|
||||||
|
return new float2(x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Palette()
|
bool IProductionIconOverlay.IsOverlayActive(ActorInfo ai)
|
||||||
{
|
|
||||||
return info.Palette;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float Scale()
|
|
||||||
{
|
|
||||||
return info.Scale;
|
|
||||||
}
|
|
||||||
|
|
||||||
public float2 Offset(float2 iconSize)
|
|
||||||
{
|
|
||||||
float offsetX = 0, offsetY = 0;
|
|
||||||
switch (info.ReferencePoint & (ReferencePoints)3)
|
|
||||||
{
|
|
||||||
case ReferencePoints.Top:
|
|
||||||
offsetY = (-iconSize.Y + sprite.Size.Y) / 2;
|
|
||||||
break;
|
|
||||||
case ReferencePoints.VCenter:
|
|
||||||
break;
|
|
||||||
case ReferencePoints.Bottom:
|
|
||||||
offsetY = (iconSize.Y - sprite.Size.Y) / 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (info.ReferencePoint & (ReferencePoints)(3 << 2))
|
|
||||||
{
|
|
||||||
case ReferencePoints.Left:
|
|
||||||
offsetX = (-iconSize.X + sprite.Size.X) / 2;
|
|
||||||
break;
|
|
||||||
case ReferencePoints.HCenter:
|
|
||||||
break;
|
|
||||||
case ReferencePoints.Right:
|
|
||||||
offsetX = (iconSize.X - sprite.Size.X) / 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return new float2(offsetX, offsetY) + info.Offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool IsOverlayActive(ActorInfo ai)
|
|
||||||
{
|
{
|
||||||
bool isActive;
|
bool isActive;
|
||||||
overlayActive.TryGetValue(ai, out isActive);
|
if (!overlayActive.TryGetValue(ai, out isActive))
|
||||||
|
return false;
|
||||||
|
|
||||||
return isActive;
|
return isActive;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,9 +77,8 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
|
|
||||||
public interface IProductionIconOverlay
|
public interface IProductionIconOverlay
|
||||||
{
|
{
|
||||||
Sprite Sprite();
|
Sprite Sprite { get; }
|
||||||
string Palette();
|
string Palette { get; }
|
||||||
float Scale();
|
|
||||||
float2 Offset(float2 iconSize);
|
float2 Offset(float2 iconSize);
|
||||||
bool IsOverlayActive(ActorInfo ai);
|
bool IsOverlayActive(ActorInfo ai);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ using System.Drawing;
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using OpenRA.Graphics;
|
using OpenRA.Graphics;
|
||||||
|
using OpenRA.Traits;
|
||||||
|
|
||||||
namespace OpenRA.Mods.Common.UtilityCommands
|
namespace OpenRA.Mods.Common.UtilityCommands
|
||||||
{
|
{
|
||||||
@@ -2702,6 +2703,44 @@ namespace OpenRA.Mods.Common.UtilityCommands
|
|||||||
node.Value.Nodes.Add(new MiniYamlNode("ParticleSize", "1, 1"));
|
node.Value.Nodes.Add(new MiniYamlNode("ParticleSize", "1, 1"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Overhauled the actor decorations traits
|
||||||
|
if (engineVersion < 20151226)
|
||||||
|
{
|
||||||
|
if (depth == 1 && (node.Key.StartsWith("WithDecoration") || node.Key.StartsWith("WithRankDecoration")))
|
||||||
|
{
|
||||||
|
node.Value.Nodes.RemoveAll(n => n.Key == "Scale");
|
||||||
|
node.Value.Nodes.RemoveAll(n => n.Key == "Offset");
|
||||||
|
var sd = node.Value.Nodes.FirstOrDefault(n => n.Key == "SelectionDecoration");
|
||||||
|
if (sd != null)
|
||||||
|
sd.Key = "RequiresSelection";
|
||||||
|
|
||||||
|
var reference = node.Value.Nodes.FirstOrDefault(n => n.Key == "ReferencePoint");
|
||||||
|
if (reference != null)
|
||||||
|
{
|
||||||
|
var values = FieldLoader.GetValue<string[]>("ReferencePoint", reference.Value.Value);
|
||||||
|
values = values.Where(v => v != "HCenter" && v != "VCenter").ToArray();
|
||||||
|
if (values.Length == 0)
|
||||||
|
values = new[] { "Center" };
|
||||||
|
|
||||||
|
reference.Value.Value = FieldSaver.FormatValue(values);
|
||||||
|
}
|
||||||
|
|
||||||
|
var stance = Stance.Ally;
|
||||||
|
var showToAllies = node.Value.Nodes.FirstOrDefault(n => n.Key == "ShowToAllies");
|
||||||
|
if (showToAllies != null && !FieldLoader.GetValue<bool>("ShowToAllies", showToAllies.Value.Value))
|
||||||
|
stance ^= Stance.Ally;
|
||||||
|
var showToEnemies = node.Value.Nodes.FirstOrDefault(n => n.Key == "ShowToEnemies");
|
||||||
|
if (showToEnemies != null && FieldLoader.GetValue<bool>("ShowToEnemies", showToEnemies.Value.Value))
|
||||||
|
stance |= Stance.Enemy;
|
||||||
|
|
||||||
|
if (stance != Stance.Ally)
|
||||||
|
node.Value.Nodes.Add(new MiniYamlNode("Stance", FieldSaver.FormatValue(stance)));
|
||||||
|
|
||||||
|
node.Value.Nodes.RemoveAll(n => n.Key == "ShowToAllies");
|
||||||
|
node.Value.Nodes.RemoveAll(n => n.Key == "ShowToEnemies");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
UpgradeActorRules(engineVersion, ref node.Value.Nodes, node, depth + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,10 +91,11 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
var location = new float2(RenderBounds.Location) + new float2(queue.i * (IconWidth + IconSpacing), 0);
|
var location = new float2(RenderBounds.Location) + new float2(queue.i * (IconWidth + IconSpacing), 0);
|
||||||
WidgetUtils.DrawSHPCentered(icon.Image, location + 0.5f * iconSize, worldRenderer.Palette(bi.IconPalette), 0.5f);
|
WidgetUtils.DrawSHPCentered(icon.Image, location + 0.5f * iconSize, worldRenderer.Palette(bi.IconPalette), 0.5f);
|
||||||
|
|
||||||
var pio = queue.Trait.Actor.Owner.PlayerActor.TraitsImplementing<IProductionIconOverlay>().FirstOrDefault();
|
var pio = queue.Trait.Actor.Owner.PlayerActor.TraitsImplementing<IProductionIconOverlay>()
|
||||||
if (pio != null && pio.IsOverlayActive(actor))
|
.FirstOrDefault(p => p.IsOverlayActive(actor));
|
||||||
WidgetUtils.DrawSHPCentered(pio.Sprite(), location + 0.5f * iconSize + pio.Offset(0.5f * iconSize),
|
if (pio != null)
|
||||||
worldRenderer.Palette(pio.Palette()), 0.5f * pio.Scale());
|
WidgetUtils.DrawSHPCentered(pio.Sprite, location + 0.5f * iconSize + pio.Offset(0.5f * iconSize),
|
||||||
|
worldRenderer.Palette(pio.Palette), 0.5f);
|
||||||
|
|
||||||
var clock = clocks[queue.Trait];
|
var clock = clocks[queue.Trait];
|
||||||
clock.PlayFetchIndex(ClockSequence,
|
clock.PlayFetchIndex(ClockSequence,
|
||||||
|
|||||||
@@ -374,8 +374,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
var buildableItems = CurrentQueue.BuildableItems();
|
var buildableItems = CurrentQueue.BuildableItems();
|
||||||
|
|
||||||
var pio = currentQueue.Actor.Owner.PlayerActor.TraitsImplementing<IProductionIconOverlay>().FirstOrDefault();
|
var pios = currentQueue.Actor.Owner.PlayerActor.TraitsImplementing<IProductionIconOverlay>();
|
||||||
var pioOffset = pio != null ? pio.Offset(IconSize) : new float2(0, 0);
|
|
||||||
|
|
||||||
// Icons
|
// Icons
|
||||||
foreach (var icon in icons.Values)
|
foreach (var icon in icons.Values)
|
||||||
@@ -383,8 +382,9 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
WidgetUtils.DrawSHPCentered(icon.Sprite, icon.Pos + iconOffset, icon.Palette);
|
WidgetUtils.DrawSHPCentered(icon.Sprite, icon.Pos + iconOffset, icon.Palette);
|
||||||
|
|
||||||
// Draw the ProductionIconOverlay's sprite
|
// Draw the ProductionIconOverlay's sprite
|
||||||
if (pio != null && pio.IsOverlayActive(icon.Actor))
|
var pio = pios.FirstOrDefault(p => p.IsOverlayActive(icon.Actor));
|
||||||
WidgetUtils.DrawSHPCentered(pio.Sprite(), icon.Pos + iconOffset + pioOffset, worldRenderer.Palette(pio.Palette()), pio.Scale());
|
if (pio != null)
|
||||||
|
WidgetUtils.DrawSHPCentered(pio.Sprite, icon.Pos + iconOffset + pio.Offset(IconSize), worldRenderer.Palette(pio.Palette), 1f);
|
||||||
|
|
||||||
// Build progress
|
// Build progress
|
||||||
if (icon.Queued.Count > 0)
|
if (icon.Queued.Count > 0)
|
||||||
|
|||||||
@@ -48,7 +48,6 @@
|
|||||||
Sequence: rank
|
Sequence: rank
|
||||||
Palette: effect
|
Palette: effect
|
||||||
ReferencePoint: Bottom, Right
|
ReferencePoint: Bottom, Right
|
||||||
Offset: 2, 2
|
|
||||||
UpgradeTypes: rank
|
UpgradeTypes: rank
|
||||||
ZOffset: 256
|
ZOffset: 256
|
||||||
UpgradeMinEnabledLevel: 1
|
UpgradeMinEnabledLevel: 1
|
||||||
|
|||||||
@@ -48,7 +48,6 @@
|
|||||||
Sequence: rank
|
Sequence: rank
|
||||||
Palette: effect
|
Palette: effect
|
||||||
ReferencePoint: Bottom, Right
|
ReferencePoint: Bottom, Right
|
||||||
Offset: 2, 2
|
|
||||||
UpgradeTypes: rank
|
UpgradeTypes: rank
|
||||||
ZOffset: 256
|
ZOffset: 256
|
||||||
UpgradeMinEnabledLevel: 1
|
UpgradeMinEnabledLevel: 1
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ construction_yard:
|
|||||||
Prerequisites: upgrade.conyard
|
Prerequisites: upgrade.conyard
|
||||||
Upgrades: stardecoration
|
Upgrades: stardecoration
|
||||||
WithDecoration@upgraded:
|
WithDecoration@upgraded:
|
||||||
SelectionDecoration: true
|
RequiresSelection: true
|
||||||
Image: pips
|
Image: pips
|
||||||
Sequence: tag-upgraded
|
Sequence: tag-upgraded
|
||||||
ReferencePoint: Top, Right
|
ReferencePoint: Top, Right
|
||||||
@@ -191,7 +191,7 @@ barracks:
|
|||||||
Prerequisites: upgrade.barracks
|
Prerequisites: upgrade.barracks
|
||||||
Upgrades: stardecoration
|
Upgrades: stardecoration
|
||||||
WithDecoration@upgraded:
|
WithDecoration@upgraded:
|
||||||
SelectionDecoration: true
|
RequiresSelection: true
|
||||||
Image: pips
|
Image: pips
|
||||||
Sequence: tag-upgraded
|
Sequence: tag-upgraded
|
||||||
ReferencePoint: Top, Right
|
ReferencePoint: Top, Right
|
||||||
@@ -359,7 +359,7 @@ light_factory:
|
|||||||
Prerequisites: upgrade.light
|
Prerequisites: upgrade.light
|
||||||
Upgrades: stardecoration
|
Upgrades: stardecoration
|
||||||
WithDecoration@upgraded:
|
WithDecoration@upgraded:
|
||||||
SelectionDecoration: true
|
RequiresSelection: true
|
||||||
Image: pips
|
Image: pips
|
||||||
Sequence: tag-upgraded
|
Sequence: tag-upgraded
|
||||||
ReferencePoint: Top, Right
|
ReferencePoint: Top, Right
|
||||||
@@ -432,7 +432,7 @@ heavy_factory:
|
|||||||
Prerequisites: upgrade.heavy
|
Prerequisites: upgrade.heavy
|
||||||
Upgrades: stardecoration
|
Upgrades: stardecoration
|
||||||
WithDecoration@upgraded:
|
WithDecoration@upgraded:
|
||||||
SelectionDecoration: true
|
RequiresSelection: true
|
||||||
Image: pips
|
Image: pips
|
||||||
Sequence: tag-upgraded
|
Sequence: tag-upgraded
|
||||||
ReferencePoint: Top, Right
|
ReferencePoint: Top, Right
|
||||||
@@ -782,7 +782,7 @@ high_tech_factory:
|
|||||||
Prerequisites: upgrade.hightech
|
Prerequisites: upgrade.hightech
|
||||||
Upgrades: stardecoration
|
Upgrades: stardecoration
|
||||||
WithDecoration@upgraded:
|
WithDecoration@upgraded:
|
||||||
SelectionDecoration: true
|
RequiresSelection: true
|
||||||
Image: pips
|
Image: pips
|
||||||
Sequence: tag-upgraded
|
Sequence: tag-upgraded
|
||||||
ReferencePoint: Top, Right
|
ReferencePoint: Top, Right
|
||||||
|
|||||||
@@ -47,7 +47,6 @@
|
|||||||
Sequence: rank
|
Sequence: rank
|
||||||
Palette: effect
|
Palette: effect
|
||||||
ReferencePoint: Bottom, Right
|
ReferencePoint: Bottom, Right
|
||||||
Offset: 2, 2
|
|
||||||
UpgradeTypes: rank
|
UpgradeTypes: rank
|
||||||
ZOffset: 256
|
ZOffset: 256
|
||||||
UpgradeMinEnabledLevel: 1
|
UpgradeMinEnabledLevel: 1
|
||||||
|
|||||||
@@ -218,7 +218,6 @@ SPY:
|
|||||||
Sequence: pip-disguise
|
Sequence: pip-disguise
|
||||||
Palette: effect
|
Palette: effect
|
||||||
ReferencePoint: Top, Right
|
ReferencePoint: Top, Right
|
||||||
Offset: 4, -2
|
|
||||||
ZOffset: 256
|
ZOffset: 256
|
||||||
UpgradeTypes: disguise
|
UpgradeTypes: disguise
|
||||||
UpgradeMinEnabledLevel: 1
|
UpgradeMinEnabledLevel: 1
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ Player:
|
|||||||
GlobalUpgradeManager:
|
GlobalUpgradeManager:
|
||||||
EnemyWatcher:
|
EnemyWatcher:
|
||||||
VeteranProductionIconOverlay:
|
VeteranProductionIconOverlay:
|
||||||
Offset: 2, 2
|
|
||||||
Image: iconchevrons
|
Image: iconchevrons
|
||||||
Sequence: veteran
|
Sequence: veteran
|
||||||
|
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ pips:
|
|||||||
pip-disguise: pip-disguise
|
pip-disguise: pip-disguise
|
||||||
Length: *
|
Length: *
|
||||||
Tick: 300
|
Tick: 300
|
||||||
|
Offset: 0, -6
|
||||||
|
|
||||||
v2:
|
v2:
|
||||||
idle:
|
idle:
|
||||||
@@ -370,6 +371,7 @@ rank:
|
|||||||
|
|
||||||
iconchevrons:
|
iconchevrons:
|
||||||
veteran:
|
veteran:
|
||||||
|
Offset: 2, 2
|
||||||
|
|
||||||
atomic:
|
atomic:
|
||||||
up: atomicup
|
up: atomicup
|
||||||
|
|||||||
@@ -65,7 +65,6 @@ CHAMSPY:
|
|||||||
Sequence: pip-disguise
|
Sequence: pip-disguise
|
||||||
Palette: pips
|
Palette: pips
|
||||||
ReferencePoint: Top, Right
|
ReferencePoint: Top, Right
|
||||||
Offset: 4, -2
|
|
||||||
ZOffset: 256
|
ZOffset: 256
|
||||||
UpgradeTypes: disguise
|
UpgradeTypes: disguise
|
||||||
UpgradeMinEnabledLevel: 1
|
UpgradeMinEnabledLevel: 1
|
||||||
|
|||||||
@@ -44,7 +44,6 @@
|
|||||||
Sequence: rank
|
Sequence: rank
|
||||||
Palette: ra
|
Palette: ra
|
||||||
ReferencePoint: Bottom, Right
|
ReferencePoint: Bottom, Right
|
||||||
Offset: 2, 2
|
|
||||||
UpgradeTypes: rank
|
UpgradeTypes: rank
|
||||||
ZOffset: 256
|
ZOffset: 256
|
||||||
UpgradeMinEnabledLevel: 1
|
UpgradeMinEnabledLevel: 1
|
||||||
|
|||||||
@@ -107,6 +107,8 @@ pips:
|
|||||||
pip-disguise: pip-disguise
|
pip-disguise: pip-disguise
|
||||||
Length: *
|
Length: *
|
||||||
Tick: 300
|
Tick: 300
|
||||||
|
Offset: 0, -6
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
pip-empty-building:
|
pip-empty-building:
|
||||||
pip-green-building:
|
pip-green-building:
|
||||||
|
|||||||
Reference in New Issue
Block a user