read support power icons from sequences

so that d2k can grab them from DATA.R8
This commit is contained in:
Matthias Mailänder
2013-08-17 11:37:32 +02:00
parent 376a6c7a5d
commit efb55d4cb9
16 changed files with 88 additions and 219 deletions

View File

@@ -32,7 +32,7 @@ namespace OpenRA.Mods.Cnc.Widgets
readonly WorldRenderer worldRenderer;
readonly SupportPowerManager spm;
Dictionary<string, Sprite> iconSprites;
Animation icon;
Animation clock;
Dictionary<Rectangle, SupportPowerIcon> icons = new Dictionary<Rectangle, SupportPowerIcon>();
@@ -52,12 +52,7 @@ namespace OpenRA.Mods.Cnc.Widgets
tooltipContainer = Lazy.New(() =>
Ui.Root.Get<TooltipContainerWidget>(TooltipContainer));
iconSprites = Rules.Info.Values.SelectMany(u => u.Traits.WithInterface<SupportPowerInfo>())
.Select(u => u.Image).Distinct()
.ToDictionary(
u => u,
u => Game.modData.SpriteLoader.LoadAllSprites(u)[0]);
icon = new Animation("icon");
clock = new Animation("clock");
}
@@ -78,11 +73,12 @@ namespace OpenRA.Mods.Cnc.Widgets
foreach (var p in powers)
{
var rect = new Rectangle(rb.X + 1, rb.Y + i * (48 + Spacing) + 1, 64, 48);
icon.Play(p.Info.Icon);
var power = new SupportPowerIcon()
{
Power = p,
Pos = new float2(rect.Location),
Sprite = iconSprites[p.Info.Image]
Sprite = icon.Image
};
icons.Add(rect, power);