use TickRender() for RenderSprites and PaletteModifier
This commit is contained in:
4
OpenRA.Game/Traits/Render/RenderSprites.cs
Executable file → Normal file
4
OpenRA.Game/Traits/Render/RenderSprites.cs
Executable file → Normal file
@@ -31,7 +31,7 @@ namespace OpenRA.Traits
|
||||
public virtual object Create(ActorInitializer init) { return new RenderSprites(init.self); }
|
||||
}
|
||||
|
||||
public class RenderSprites : IRender, ITick, INotifyOwnerChanged, INotifyEffectiveOwnerChanged
|
||||
public class RenderSprites : IRender, ITickRender, INotifyOwnerChanged, INotifyEffectiveOwnerChanged
|
||||
{
|
||||
class AnimationWrapper
|
||||
{
|
||||
@@ -126,7 +126,7 @@ namespace OpenRA.Traits
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void Tick(Actor self)
|
||||
public virtual void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
foreach (var a in anims.Values)
|
||||
a.Animation.Animation.Tick();
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.RA
|
||||
public override object Create(ActorInitializer init) { return new AttackGarrisoned(init.self, this); }
|
||||
}
|
||||
|
||||
public class AttackGarrisoned : AttackFollow, INotifyPassengerEntered, INotifyPassengerExited, IRender
|
||||
public class AttackGarrisoned : AttackFollow, INotifyPassengerEntered, INotifyPassengerExited, IRender, ITickRender
|
||||
{
|
||||
public readonly FirePort[] Ports;
|
||||
|
||||
@@ -183,10 +183,8 @@ namespace OpenRA.Mods.RA
|
||||
yield return r;
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
public void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
base.Tick(self);
|
||||
|
||||
// Take a copy so that Tick() can remove animations
|
||||
foreach (var m in muzzles.ToList())
|
||||
m.Animation.Tick();
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
class ChronoshiftPaletteEffectInfo : TraitInfo<ChronoshiftPaletteEffect> { }
|
||||
|
||||
public class ChronoshiftPaletteEffect : IPaletteModifier, ITick
|
||||
public class ChronoshiftPaletteEffect : IPaletteModifier, ITickRender
|
||||
{
|
||||
const int chronoEffectLength = 60;
|
||||
int remainingFrames;
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA
|
||||
remainingFrames = chronoEffectLength;
|
||||
}
|
||||
|
||||
public void Tick(Actor self)
|
||||
public void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
if (remainingFrames > 0)
|
||||
remainingFrames--;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
public class CloakPaletteEffectInfo : TraitInfo<CloakPaletteEffect> { }
|
||||
|
||||
public class CloakPaletteEffect : IPaletteModifier, ITick
|
||||
public class CloakPaletteEffect : IPaletteModifier, ITickRender
|
||||
{
|
||||
float t = 0;
|
||||
string paletteName = "cloak";
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.RA
|
||||
}
|
||||
}
|
||||
|
||||
public void Tick(Actor self)
|
||||
public void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
t += 0.25f;
|
||||
if (t >= 256) t = 0;
|
||||
|
||||
0
OpenRA.Mods.RA/Effects/Bullet.cs
Executable file → Normal file
0
OpenRA.Mods.RA/Effects/Bullet.cs
Executable file → Normal file
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Effects
|
||||
this.b = a.Trait<IronCurtainable>();
|
||||
}
|
||||
|
||||
public void Tick( World world )
|
||||
public void Tick(World world)
|
||||
{
|
||||
if (a.IsDead() || b.GetDamageModifier(null, null) > 0)
|
||||
world.AddFrameEndTask(w => w.Remove(this));
|
||||
|
||||
0
OpenRA.Mods.RA/Effects/Missile.cs
Executable file → Normal file
0
OpenRA.Mods.RA/Effects/Missile.cs
Executable file → Normal file
0
OpenRA.Mods.RA/Effects/NukeLaunch.cs
Executable file → Normal file
0
OpenRA.Mods.RA/Effects/NukeLaunch.cs
Executable file → Normal file
0
OpenRA.Mods.RA/Effects/RepairIndicator.cs
Executable file → Normal file
0
OpenRA.Mods.RA/Effects/RepairIndicator.cs
Executable file → Normal file
@@ -23,10 +23,10 @@ namespace OpenRA.Mods.RA
|
||||
public object Create(ActorInitializer init) { return new LightPaletteRotator(this); }
|
||||
}
|
||||
|
||||
class LightPaletteRotator : ITick, IPaletteModifier
|
||||
class LightPaletteRotator : ITickRender, IPaletteModifier
|
||||
{
|
||||
float t = 0;
|
||||
public void Tick(Actor self)
|
||||
public void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
t += .5f;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace OpenRA.Mods.RA
|
||||
{
|
||||
class NukePaletteEffectInfo : TraitInfo<NukePaletteEffect> { }
|
||||
|
||||
public class NukePaletteEffect : IPaletteModifier, ITick
|
||||
public class NukePaletteEffect : IPaletteModifier, ITickRender
|
||||
{
|
||||
const int nukeEffectLength = 20;
|
||||
int remainingFrames;
|
||||
@@ -27,7 +27,7 @@ namespace OpenRA.Mods.RA
|
||||
remainingFrames = nukeEffectLength;
|
||||
}
|
||||
|
||||
public void Tick(Actor self)
|
||||
public void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
if (remainingFrames > 0)
|
||||
remainingFrames--;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
@@ -43,9 +44,9 @@ namespace OpenRA.Mods.RA.Render
|
||||
DefaultAnimation.PlayFetchIndex(NormalizeSequence(DefaultAnimation, e.DamageState, info.Sequence), () => adjacent);
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
base.Tick(self);
|
||||
base.TickRender(wr, self);
|
||||
|
||||
if (!dirty)
|
||||
return;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
}
|
||||
}
|
||||
|
||||
class RenderBuildingWarFactory : RenderBuilding, INotifyBuildComplete, ITick, INotifyProduction, INotifySold, ISync
|
||||
class RenderBuildingWarFactory : RenderBuilding, INotifyBuildComplete, ITickRender, INotifyProduction, INotifySold, ISync
|
||||
{
|
||||
Animation roof;
|
||||
[Sync] bool isOpen;
|
||||
@@ -62,9 +62,9 @@ namespace OpenRA.Mods.RA.Render
|
||||
buildComplete = true;
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
base.Tick(self);
|
||||
base.TickRender(wr, self);
|
||||
if (isOpen && !self.World.ActorMap.GetUnitsAt(openExit).Any( a => a != self ))
|
||||
{
|
||||
isOpen = false;
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using OpenRA.Traits;
|
||||
using OpenRA.Graphics;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
{
|
||||
@@ -31,7 +32,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
intendedSprite = disguise.AsSprite;
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
if (disguise.AsSprite != intendedSprite)
|
||||
{
|
||||
@@ -40,7 +41,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
UpdatePalette();
|
||||
}
|
||||
|
||||
base.Tick(self);
|
||||
base.TickRender(wr, self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
new Animation(self.World, image);
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
var desiredState = harv.Fullness * (info.ImagesByFullness.Length - 1) / 100;
|
||||
var desiredImage = info.ImagesByFullness[desiredState];
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
if (DefaultAnimation.Name != desiredImage)
|
||||
DefaultAnimation.ChangeImage(desiredImage, "idle");
|
||||
|
||||
base.Tick(self);
|
||||
base.TickRender(wr, self);
|
||||
}
|
||||
|
||||
public void Harvested(Actor self, ResourceType resource)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2013 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.RA.Effects;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -79,9 +80,9 @@ namespace OpenRA.Mods.RA.Render
|
||||
Attacking(self, target);
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
base.Tick(self);
|
||||
base.TickRender(wr, self);
|
||||
|
||||
if ((State == AnimationState.Moving || dirty) && !move.IsMoving)
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
@@ -8,6 +8,7 @@
|
||||
*/
|
||||
#endregion
|
||||
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
@@ -43,13 +44,13 @@ namespace OpenRA.Mods.RA.Render
|
||||
return base.AllowIdleAnimation(self) && !sc.Panicking;
|
||||
}
|
||||
|
||||
public override void Tick (Actor self)
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
if (wasPanic != sc.Panicking)
|
||||
dirty = true;
|
||||
|
||||
wasPanic = sc.Panicking;
|
||||
base.Tick(self);
|
||||
base.TickRender(wr, self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
@@ -41,7 +42,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
|
||||
public bool ShouldBeOpen()
|
||||
{
|
||||
if (self.CenterPosition.Z > 0 || move.IsMoving)
|
||||
if (self.CenterPosition.Z > 0 || move.IsMoving || cargo.CurrentAdjacentCells == null)
|
||||
return false;
|
||||
|
||||
return cargo.CurrentAdjacentCells.Any(c => self.World.Map.Contains(c)
|
||||
@@ -70,14 +71,14 @@ namespace OpenRA.Mods.RA.Render
|
||||
PlayCustomAnimBackwards(self, info.OpenAnim, null);
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
if (ShouldBeOpen())
|
||||
Open();
|
||||
else
|
||||
Close();
|
||||
|
||||
base.Tick(self);
|
||||
base.TickRender(wr, self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Linq;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Traits;
|
||||
|
||||
namespace OpenRA.Mods.RA.Render
|
||||
@@ -34,13 +35,13 @@ namespace OpenRA.Mods.RA.Render
|
||||
.Single(a => a.Info.Name == info.Armament);
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
var sequence = (armament.IsReloading ? "empty-" : "") + (attack.IsAttacking ? "aim" : "idle");
|
||||
if (sequence != DefaultAnimation.CurrentSequence.Name)
|
||||
DefaultAnimation.ReplaceAnim(sequence);
|
||||
|
||||
base.Tick(self);
|
||||
base.TickRender(wr, self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
public object Create(ActorInitializer init) { return new WithMuzzleFlash(init.self, this); }
|
||||
}
|
||||
|
||||
class WithMuzzleFlash : INotifyAttack, IRender, ITick
|
||||
class WithMuzzleFlash : INotifyAttack, IRender, ITickRender
|
||||
{
|
||||
Dictionary<Barrel, bool> visible = new Dictionary<Barrel, bool>();
|
||||
Dictionary<Barrel, AnimationWithOffset> anims = new Dictionary<Barrel, AnimationWithOffset>();
|
||||
@@ -95,7 +95,7 @@ namespace OpenRA.Mods.RA.Render
|
||||
}
|
||||
}
|
||||
|
||||
public void Tick(Actor self)
|
||||
public void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
foreach (var a in anims.Values)
|
||||
a.Animation.Tick();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#region Copyright & License Information
|
||||
/*
|
||||
* Copyright 2007-2011 The OpenRA Developers (see AUTHORS)
|
||||
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
|
||||
* This file is part of OpenRA, which is free software. It is made
|
||||
* available to you under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation. For more information,
|
||||
@@ -9,6 +9,7 @@
|
||||
#endregion
|
||||
|
||||
using OpenRA.GameRules;
|
||||
using OpenRA.Graphics;
|
||||
using OpenRA.Mods.RA.Render;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -98,13 +99,13 @@ namespace OpenRA.Mods.RA
|
||||
return base.AllowIdleAnimation(self) && !tc.IsProne;
|
||||
}
|
||||
|
||||
public override void Tick(Actor self)
|
||||
public override void TickRender(WorldRenderer wr, Actor self)
|
||||
{
|
||||
if (wasProne != tc.IsProne)
|
||||
dirty = true;
|
||||
|
||||
wasProne = tc.IsProne;
|
||||
base.Tick(self);
|
||||
base.TickRender(wr, self);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace OpenRA.Mods.RA
|
||||
public object Create(ActorInitializer init) { return new WaterPaletteRotation(init.world, this); }
|
||||
}
|
||||
|
||||
class WaterPaletteRotation : ITick, IPaletteModifier
|
||||
class WaterPaletteRotation : ITickRender, IPaletteModifier
|
||||
{
|
||||
float t = 0;
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace OpenRA.Mods.RA
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public void Tick(Actor self) { t += .25f; }
|
||||
public void TickRender(WorldRenderer wr, Actor self) { t += .25f; }
|
||||
|
||||
uint[] temp = new uint[7]; /* allocating this on the fly actually hurts our profile */
|
||||
|
||||
|
||||
0
OpenRA.Mods.RA/Widgets/SupportPowerBinWidget.cs
Executable file → Normal file
0
OpenRA.Mods.RA/Widgets/SupportPowerBinWidget.cs
Executable file → Normal file
Reference in New Issue
Block a user