Remove legacy tag rendering.
This commit is contained in:
@@ -35,7 +35,6 @@ namespace OpenRA.Traits
|
||||
|
||||
// depends on the order of pips in WorldRenderer.cs!
|
||||
public enum PipType { Transparent, Green, Yellow, Red, Gray, Blue, Ammo, AmmoEmpty }
|
||||
public enum TagType { None }
|
||||
|
||||
[Flags]
|
||||
public enum Stance
|
||||
@@ -250,7 +249,6 @@ namespace OpenRA.Traits
|
||||
public interface ILoadsPlayerPalettes { void LoadPlayerPalettes(WorldRenderer wr, string playerName, HSLColor playerColor, bool replaceExisting); }
|
||||
public interface IPaletteModifier { void AdjustPalette(IReadOnlyDictionary<string, MutablePalette> b); }
|
||||
public interface IPips { IEnumerable<PipType> GetPips(Actor self); }
|
||||
public interface ITags { IEnumerable<TagType> GetTags(); }
|
||||
public interface ISelectionBar { float GetValue(); Color GetColor(); }
|
||||
|
||||
public interface IPositionableInfo : ITraitInfo { }
|
||||
|
||||
@@ -42,7 +42,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
// depends on the order of pips in TraitsInterfaces.cs!
|
||||
static readonly string[] PipStrings = { "pip-empty", "pip-green", "pip-yellow", "pip-red", "pip-gray", "pip-blue", "pip-ammo", "pip-ammoempty" };
|
||||
static readonly string[] TagStrings = { "" };
|
||||
|
||||
public readonly SelectionDecorationsInfo Info;
|
||||
readonly Actor self;
|
||||
@@ -90,16 +89,12 @@ namespace OpenRA.Mods.Common.Traits
|
||||
var pos = wr.ScreenPxPosition(self.CenterPosition);
|
||||
var tl = wr.Viewport.WorldToViewPx(pos + new int2(b.Left, b.Top));
|
||||
var bl = wr.Viewport.WorldToViewPx(pos + new int2(b.Left, b.Bottom));
|
||||
var tm = wr.Viewport.WorldToViewPx(pos + new int2((b.Left + b.Right) / 2, b.Top));
|
||||
|
||||
foreach (var r in DrawControlGroup(wr, self, tl))
|
||||
yield return r;
|
||||
|
||||
foreach (var r in DrawPips(wr, self, bl))
|
||||
yield return r;
|
||||
|
||||
foreach (var r in DrawTags(wr, self, tm))
|
||||
yield return r;
|
||||
}
|
||||
|
||||
IEnumerable<IRenderable> DrawControlGroup(WorldRenderer wr, Actor self, int2 basePosition)
|
||||
@@ -153,28 +148,5 @@ namespace OpenRA.Mods.Common.Traits
|
||||
pipxyOffset = new int2(0, pipxyOffset.Y - (pipSize.Y + 1));
|
||||
}
|
||||
}
|
||||
|
||||
IEnumerable<IRenderable> DrawTags(WorldRenderer wr, Actor self, int2 basePosition)
|
||||
{
|
||||
var tagImages = new Animation(self.World, "pips");
|
||||
var pal = wr.Palette(Info.Palette);
|
||||
var tagxyOffset = new int2(0, 6);
|
||||
|
||||
foreach (var tags in self.TraitsImplementing<ITags>())
|
||||
{
|
||||
foreach (var tag in tags.GetTags())
|
||||
{
|
||||
if (tag == TagType.None)
|
||||
continue;
|
||||
|
||||
tagImages.PlayRepeating(TagStrings[(int)tag]);
|
||||
var pos = basePosition + tagxyOffset - (0.5f * tagImages.Image.Size).ToInt2();
|
||||
yield return new UISpriteRenderable(tagImages.Image, self.CenterPosition, pos, 0, pal, 1f);
|
||||
|
||||
// Increment row
|
||||
tagxyOffset = tagxyOffset.WithY(tagxyOffset.Y + 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user