remove self parameter from IPostRenderSelection.RenderAfterWorld
This commit is contained in:
@@ -102,7 +102,7 @@ namespace OpenRA.Graphics
|
|||||||
foreach (var a in world.Selection.Actors)
|
foreach (var a in world.Selection.Actors)
|
||||||
if (!a.Destroyed)
|
if (!a.Destroyed)
|
||||||
foreach (var t in a.TraitsImplementing<IPostRenderSelection>())
|
foreach (var t in a.TraitsImplementing<IPostRenderSelection>())
|
||||||
t.RenderAfterWorld(this, a);
|
t.RenderAfterWorld(this);
|
||||||
|
|
||||||
Game.Renderer.Flush();
|
Game.Renderer.Flush();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,17 +18,18 @@ namespace OpenRA.Traits
|
|||||||
{
|
{
|
||||||
public readonly int Ticks = 60;
|
public readonly int Ticks = 60;
|
||||||
|
|
||||||
public virtual object Create(ActorInitializer init) { return new DrawLineToTarget(this); }
|
public virtual object Create(ActorInitializer init) { return new DrawLineToTarget(init.self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class DrawLineToTarget : IPostRenderSelection
|
public class DrawLineToTarget : IPostRenderSelection
|
||||||
{
|
{
|
||||||
|
Actor self;
|
||||||
DrawLineToTargetInfo Info;
|
DrawLineToTargetInfo Info;
|
||||||
Target target;
|
Target target;
|
||||||
Color c;
|
Color c;
|
||||||
int lifetime;
|
int lifetime;
|
||||||
|
|
||||||
public DrawLineToTarget(DrawLineToTargetInfo info) { this.Info = info; }
|
public DrawLineToTarget(Actor self, DrawLineToTargetInfo info) { this.self = self; this.Info = info; }
|
||||||
|
|
||||||
public void SetTarget(Actor self, Target target, Color c, bool display)
|
public void SetTarget(Actor self, Target target, Color c, bool display)
|
||||||
{
|
{
|
||||||
@@ -39,7 +40,7 @@ namespace OpenRA.Traits
|
|||||||
lifetime = Info.Ticks;
|
lifetime = Info.Ticks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RenderAfterWorld(WorldRenderer wr, Actor self)
|
public void RenderAfterWorld(WorldRenderer wr)
|
||||||
{
|
{
|
||||||
if (self.IsIdle) return;
|
if (self.IsIdle) return;
|
||||||
|
|
||||||
|
|||||||
@@ -14,22 +14,27 @@ using OpenRA.Graphics;
|
|||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
public class SelectableInfo : TraitInfo<Selectable>
|
public class SelectableInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
public readonly int Priority = 10;
|
public readonly int Priority = 10;
|
||||||
public readonly int[] Bounds = null;
|
public readonly int[] Bounds = null;
|
||||||
[VoiceReference] public readonly string Voice = null;
|
[VoiceReference] public readonly string Voice = null;
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new Selectable(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Selectable : IPostRenderSelection
|
public class Selectable : IPostRenderSelection
|
||||||
{
|
{
|
||||||
public void RenderAfterWorld (WorldRenderer wr, Actor self)
|
Actor self;
|
||||||
|
|
||||||
|
public Selectable(Actor self) { this.self = self; }
|
||||||
|
|
||||||
|
public void RenderAfterWorld(WorldRenderer wr)
|
||||||
{
|
{
|
||||||
var bounds = self.Bounds.Value;
|
var bounds = self.Bounds.Value;
|
||||||
|
|
||||||
var xy = new float2(bounds.Left, bounds.Top);
|
var xy = new float2(bounds.Left, bounds.Top);
|
||||||
var Xy = new float2(bounds.Right, bounds.Top);
|
var Xy = new float2(bounds.Right, bounds.Top);
|
||||||
var xY = new float2(bounds.Left, bounds.Bottom);
|
|
||||||
|
|
||||||
wr.DrawSelectionBox(self, Color.White);
|
wr.DrawSelectionBox(self, Color.White);
|
||||||
DrawHealthBar(self, xy, Xy);
|
DrawHealthBar(self, xy, Xy);
|
||||||
|
|||||||
@@ -14,7 +14,10 @@ using OpenRA.Graphics;
|
|||||||
|
|
||||||
namespace OpenRA.Traits
|
namespace OpenRA.Traits
|
||||||
{
|
{
|
||||||
public class SelectionDecorationsInfo : TraitInfo<SelectionDecorations> {}
|
public class SelectionDecorationsInfo : ITraitInfo
|
||||||
|
{
|
||||||
|
public object Create(ActorInitializer init) { return new SelectionDecorations(init.self); }
|
||||||
|
}
|
||||||
|
|
||||||
public class SelectionDecorations : IPostRenderSelection
|
public class SelectionDecorations : IPostRenderSelection
|
||||||
{
|
{
|
||||||
@@ -22,7 +25,11 @@ namespace OpenRA.Traits
|
|||||||
static readonly string[] pipStrings = { "pip-empty", "pip-green", "pip-yellow", "pip-red", "pip-gray", "pip-blue" };
|
static readonly string[] pipStrings = { "pip-empty", "pip-green", "pip-yellow", "pip-red", "pip-gray", "pip-blue" };
|
||||||
static readonly string[] tagStrings = { "", "tag-fake", "tag-primary" };
|
static readonly string[] tagStrings = { "", "tag-fake", "tag-primary" };
|
||||||
|
|
||||||
public void RenderAfterWorld (WorldRenderer wr, Actor self)
|
Actor self;
|
||||||
|
|
||||||
|
public SelectionDecorations(Actor self) { this.self = self; }
|
||||||
|
|
||||||
|
public void RenderAfterWorld(WorldRenderer wr)
|
||||||
{
|
{
|
||||||
var bounds = self.Bounds.Value;
|
var bounds = self.Bounds.Value;
|
||||||
|
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ namespace OpenRA.Traits
|
|||||||
|
|
||||||
public interface IPostRender { void RenderAfterWorld(WorldRenderer wr, Actor self); }
|
public interface IPostRender { void RenderAfterWorld(WorldRenderer wr, Actor self); }
|
||||||
|
|
||||||
public interface IPostRenderSelection { void RenderAfterWorld(WorldRenderer wr, Actor self); }
|
public interface IPostRenderSelection { void RenderAfterWorld(WorldRenderer wr); }
|
||||||
public interface IPreRenderSelection { void RenderBeforeWorld(WorldRenderer wr, Actor self); }
|
public interface IPreRenderSelection { void RenderBeforeWorld(WorldRenderer wr, Actor self); }
|
||||||
public interface IRenderAsTerrain { IEnumerable<Renderable> RenderAsTerrain(Actor self); }
|
public interface IRenderAsTerrain { IEnumerable<Renderable> RenderAsTerrain(Actor self); }
|
||||||
|
|
||||||
|
|||||||
@@ -18,12 +18,14 @@ using OpenRA.Traits;
|
|||||||
|
|
||||||
namespace OpenRA.Mods.RA
|
namespace OpenRA.Mods.RA
|
||||||
{
|
{
|
||||||
class MinelayerInfo : TraitInfo<Minelayer>
|
class MinelayerInfo : ITraitInfo
|
||||||
{
|
{
|
||||||
[ActorReference] public readonly string Mine = "minv";
|
[ActorReference] public readonly string Mine = "minv";
|
||||||
[ActorReference] public readonly string[] RearmBuildings = { "fix" };
|
[ActorReference] public readonly string[] RearmBuildings = { "fix" };
|
||||||
|
|
||||||
public readonly float MinefieldDepth = 1.5f;
|
public readonly float MinefieldDepth = 1.5f;
|
||||||
|
|
||||||
|
public object Create(ActorInitializer init) { return new Minelayer(init.self); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class Minelayer : IIssueOrder, IResolveOrder, IPostRenderSelection, ISync
|
class Minelayer : IIssueOrder, IResolveOrder, IPostRenderSelection, ISync
|
||||||
@@ -31,6 +33,9 @@ namespace OpenRA.Mods.RA
|
|||||||
/* [Sync] when sync can cope with arrays! */
|
/* [Sync] when sync can cope with arrays! */
|
||||||
public int2[] minefield = null;
|
public int2[] minefield = null;
|
||||||
[Sync] int2 minefieldStart;
|
[Sync] int2 minefieldStart;
|
||||||
|
Actor self;
|
||||||
|
|
||||||
|
public Minelayer(Actor self) { this.self = self; }
|
||||||
|
|
||||||
public IEnumerable<IOrderTargeter> Orders
|
public IEnumerable<IOrderTargeter> Orders
|
||||||
{
|
{
|
||||||
@@ -138,7 +143,7 @@ namespace OpenRA.Mods.RA
|
|||||||
public string GetCursor(World world, int2 xy, MouseInput mi) { lastMousePos = xy; return "ability"; } /* todo */
|
public string GetCursor(World world, int2 xy, MouseInput mi) { lastMousePos = xy; return "ability"; } /* todo */
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RenderAfterWorld(WorldRenderer wr, Actor self)
|
public void RenderAfterWorld(WorldRenderer wr)
|
||||||
{
|
{
|
||||||
if (self.Owner != self.World.LocalPlayer)
|
if (self.Owner != self.World.LocalPlayer)
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user