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:
Pavlos Touboulidis
2014-05-11 03:05:47 +03:00
parent 6eabc6adf5
commit b560268495
52 changed files with 132 additions and 117 deletions

View File

@@ -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);

View File

@@ -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);

View File

@@ -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"));
}
}

View File

@@ -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