Change animations to use the proper SequenceProvider
Remove references to the global "Game" and use the SequenceProvider of the current world/map.
This commit is contained in:
@@ -63,9 +63,9 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
this.world = world;
|
||||
this.worldRenderer = worldRenderer;
|
||||
|
||||
cantBuild = new Animation("clock");
|
||||
cantBuild = new Animation(world, "clock");
|
||||
cantBuild.PlayFetchIndex("idle", () => 0);
|
||||
clock = new Animation("clock");
|
||||
clock = new Animation(world, "clock");
|
||||
VisibleQueues = new List<ProductionQueue>();
|
||||
CurrentQueue = null;
|
||||
}
|
||||
@@ -231,7 +231,7 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
{
|
||||
var rect = new RectangleF(origin.X + x * IconWidth, origin.Y + IconHeight * y, IconWidth, IconHeight);
|
||||
var drawPos = new float2(rect.Location);
|
||||
var icon = new Animation(RenderSimple.GetImage(item));
|
||||
var icon = new Animation(world, RenderSimple.GetImage(item));
|
||||
icon.Play(item.Traits.Get<TooltipInfo>().Icon);
|
||||
WidgetUtils.DrawSHPCentered(icon.Image, drawPos + iconOffset, worldRenderer);
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
{
|
||||
if (!clocks.ContainsKey(queue.Trait))
|
||||
{
|
||||
clocks.Add(queue.Trait, new Animation("clock"));
|
||||
clocks.Add(queue.Trait, new Animation(world, "clock"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
if (actor == null)
|
||||
continue;
|
||||
|
||||
var icon = new Animation(RenderSimple.GetImage(actor));
|
||||
var icon = new Animation(world, RenderSimple.GetImage(actor));
|
||||
icon.Play(actor.Traits.Get<TooltipInfo>().Icon);
|
||||
var location = new float2(RenderBounds.Location) + new float2(queue.i * (IconWidth + IconSpacing), 0);
|
||||
WidgetUtils.DrawSHPCentered(icon.Image, location + 0.5f * iconSize, worldRenderer, 0.5f);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
this.world = world;
|
||||
this.worldRenderer = worldRenderer;
|
||||
clocks = new Dictionary<string, Animation>();
|
||||
icon = new Animation("icon");
|
||||
icon = new Animation(world, "icon");
|
||||
}
|
||||
|
||||
protected ObserverSupportPowerIconsWidget(ObserverSupportPowerIconsWidget other)
|
||||
@@ -62,7 +62,7 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
{
|
||||
if (!clocks.ContainsKey(power.a.Key))
|
||||
{
|
||||
clocks.Add(power.a.Key, new Animation("clock"));
|
||||
clocks.Add(power.a.Key, new Animation(world, "clock"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,8 +44,8 @@ namespace OpenRA.Mods.RA.Widgets
|
||||
{
|
||||
base.Initialize(args);
|
||||
|
||||
icon = new Animation("icon");
|
||||
clock = new Animation("clock");
|
||||
icon = new Animation(world, "icon");
|
||||
clock = new Animation(world, "clock");
|
||||
}
|
||||
|
||||
public override Rectangle EventBounds
|
||||
|
||||
Reference in New Issue
Block a user