From 3a7558c273bdebd2e7466173331f1100d9ece1e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Mail=C3=A4nder?= Date: Sun, 3 Jul 2016 12:26:29 +0200 Subject: [PATCH] Document and lint test pips and groups. --- .../Traits/Render/SelectionDecorations.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/Render/SelectionDecorations.cs b/OpenRA.Mods.Common/Traits/Render/SelectionDecorations.cs index a291aa224a..b4e3d5776d 100644 --- a/OpenRA.Mods.Common/Traits/Render/SelectionDecorations.cs +++ b/OpenRA.Mods.Common/Traits/Render/SelectionDecorations.cs @@ -34,6 +34,11 @@ namespace OpenRA.Mods.Common.Traits.Render public readonly Color SelectionBoxColor = Color.White; + public readonly string Image = "pips"; + + [Desc("Sprite sequence used to render the control group 0-9 numbers.")] + [SequenceReference("Image")] public readonly string GroupSequence = "groups"; + public object Create(ActorInitializer init) { return new SelectionDecorations(init.Self, this); } public int[] SelectionBoxBounds { get { return VisualBounds; } } @@ -104,9 +109,9 @@ namespace OpenRA.Mods.Common.Traits.Render if (group == null) yield break; - var pipImages = new Animation(self.World, "pips"); + var pipImages = new Animation(self.World, Info.Image); var pal = wr.Palette(Info.Palette); - pipImages.PlayFetchIndex("groups", () => (int)group); + pipImages.PlayFetchIndex(Info.GroupSequence, () => (int)group); pipImages.Tick(); var pos = basePosition - (0.5f * pipImages.Image.Size.XY).ToInt2() + new int2(9, 5); @@ -119,7 +124,7 @@ namespace OpenRA.Mods.Common.Traits.Render if (!pipSources.Any()) yield break; - var pipImages = new Animation(self.World, "pips"); + var pipImages = new Animation(self.World, Info.Image); pipImages.PlayRepeating(PipStrings[0]); var pipSize = pipImages.Image.Size.XY.ToInt2();