Make support power icons configurable and testable.

This commit is contained in:
Matthias Mailänder
2020-03-21 11:57:52 +01:00
committed by atlimit8
parent 85096c4ba2
commit d187575a2c
3 changed files with 13 additions and 7 deletions

View File

@@ -23,7 +23,6 @@ namespace OpenRA.Mods.Common.Widgets
{
public readonly string TooltipTemplate = "SUPPORT_POWER_TOOLTIP";
public readonly string TooltipContainer;
readonly Animation icon;
readonly World world;
readonly WorldRenderer worldRenderer;
readonly Dictionary<string, Animation> clocks;
@@ -45,6 +44,7 @@ namespace OpenRA.Mods.Common.Widgets
readonly List<SupportPowersWidget.SupportPowerIcon> supportPowerIconsIcons = new List<SupportPowersWidget.SupportPowerIcon>();
readonly List<Rectangle> supportPowerIconsBounds = new List<Rectangle>();
Animation icon;
int lastIconIdx;
int currentTooltipToken;
@@ -54,7 +54,6 @@ namespace OpenRA.Mods.Common.Widgets
this.world = world;
this.worldRenderer = worldRenderer;
clocks = new Dictionary<string, Animation>();
icon = new Animation(world, "icon");
// Timers in replays should be synced to the effective game time, not the playback time.
timestep = world.Timestep;
@@ -125,6 +124,7 @@ namespace OpenRA.Mods.Common.Widgets
if (item == null || item.Info == null || item.Info.Icon == null)
continue;
icon = new Animation(worldRenderer.World, item.Info.IconImage);
icon.Play(item.Info.Icon);
var location = new float2(RenderBounds.Location) + new float2(power.i * (IconWidth + IconSpacing), 0);