Make all range circles fully configurable.
This commit is contained in:
committed by
Paul Chote
parent
214aa64ce3
commit
14fc0254c6
@@ -24,6 +24,21 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly int Cooldown = 0;
|
||||
public readonly int InitialDelay = 0;
|
||||
|
||||
[Desc("Range circle color when operational.")]
|
||||
public readonly Color CircleReadyColor = Color.FromArgb(128, Color.White);
|
||||
|
||||
[Desc("Range circle color when inactive.")]
|
||||
public readonly Color CircleBlockedColor = Color.FromArgb(128, Color.Red);
|
||||
|
||||
[Desc("Range circle line width.")]
|
||||
public readonly float CircleWidth = 1;
|
||||
|
||||
[Desc("Range circle border color.")]
|
||||
public readonly Color CircleBorderColor = Color.FromArgb(96, Color.Black);
|
||||
|
||||
[Desc("Range circle border width.")]
|
||||
public readonly float CircleBorderWidth = 3;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new BaseProvider(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -85,8 +100,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
self.CenterPosition,
|
||||
Info.Range,
|
||||
0,
|
||||
Color.FromArgb(128, Ready() ? Color.White : Color.Red),
|
||||
Color.FromArgb(96, Color.Black));
|
||||
Ready() ? Info.CircleReadyColor : Info.CircleBlockedColor,
|
||||
Info.CircleWidth,
|
||||
Info.CircleBorderColor,
|
||||
Info.CircleBorderWidth);
|
||||
}
|
||||
|
||||
IEnumerable<IRenderable> IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr)
|
||||
|
||||
@@ -29,8 +29,14 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
[Desc("Color of the circle and scanner update line.")]
|
||||
public readonly Color Color = Color.FromArgb(128, Color.LimeGreen);
|
||||
|
||||
[Desc("Contrast color of the circle and scanner update line.")]
|
||||
public readonly Color ContrastColor = Color.FromArgb(96, Color.Black);
|
||||
[Desc("Range circle line width.")]
|
||||
public readonly float Width = 1;
|
||||
|
||||
[Desc("Border color of the circle and scanner update line.")]
|
||||
public readonly Color BorderColor = Color.FromArgb(96, Color.Black);
|
||||
|
||||
[Desc("Range circle border width.")]
|
||||
public readonly float BorderWidth = 3;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new RenderDetectionCircle(init.Self, this); }
|
||||
}
|
||||
@@ -65,7 +71,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
info.UpdateLineTick,
|
||||
lineAngle,
|
||||
info.Color,
|
||||
info.ContrastColor);
|
||||
info.Width,
|
||||
info.BorderColor,
|
||||
info.BorderWidth);
|
||||
}
|
||||
|
||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
|
||||
|
||||
@@ -18,8 +18,20 @@ using OpenRA.Traits;
|
||||
namespace OpenRA.Mods.Common.Traits
|
||||
{
|
||||
// TODO: remove all the Render*Circle duplication
|
||||
class RenderJammerCircleInfo : TraitInfo<RenderJammerCircle>, IPlaceBuildingDecorationInfo
|
||||
class RenderJammerCircleInfo : TraitInfo, IPlaceBuildingDecorationInfo
|
||||
{
|
||||
[Desc("Range circle color.")]
|
||||
public readonly Color Color = Color.FromArgb(128, Color.Red);
|
||||
|
||||
[Desc("Range circle line width.")]
|
||||
public readonly float Width = 1;
|
||||
|
||||
[Desc("Range circle border color.")]
|
||||
public readonly Color BorderColor = Color.FromArgb(96, Color.Black);
|
||||
|
||||
[Desc("Range circle border width.")]
|
||||
public readonly float BorderWidth = 3;
|
||||
|
||||
public IEnumerable<IRenderable> RenderAnnotations(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
|
||||
{
|
||||
var jamsMissiles = ai.TraitInfoOrDefault<JamsMissilesInfo>();
|
||||
@@ -29,8 +41,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
centerPosition,
|
||||
jamsMissiles.Range,
|
||||
0,
|
||||
Color.FromArgb(128, Color.Red),
|
||||
Color.FromArgb(96, Color.Black));
|
||||
Color,
|
||||
Width,
|
||||
BorderColor,
|
||||
BorderWidth);
|
||||
}
|
||||
|
||||
foreach (var a in w.ActorsWithTrait<RenderJammerCircle>())
|
||||
@@ -38,10 +52,19 @@ namespace OpenRA.Mods.Common.Traits
|
||||
foreach (var r in a.Trait.RenderAnnotations(a.Actor, wr))
|
||||
yield return r;
|
||||
}
|
||||
|
||||
public override object Create(ActorInitializer init) { return new RenderJammerCircle(this); }
|
||||
}
|
||||
|
||||
class RenderJammerCircle : IRenderAnnotationsWhenSelected
|
||||
{
|
||||
readonly RenderJammerCircleInfo info;
|
||||
|
||||
public RenderJammerCircle(RenderJammerCircleInfo info)
|
||||
{
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public IEnumerable<IRenderable> RenderAnnotations(Actor self, WorldRenderer wr)
|
||||
{
|
||||
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer))
|
||||
@@ -54,8 +77,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
self.CenterPosition,
|
||||
jamsMissiles.Range,
|
||||
0,
|
||||
Color.FromArgb(128, Color.Red),
|
||||
Color.FromArgb(96, Color.Black));
|
||||
info.Color,
|
||||
info.Width,
|
||||
info.BorderColor,
|
||||
info.BorderWidth);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,15 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
[Desc("Color of the circle.")]
|
||||
public readonly Color Color = Color.FromArgb(128, Color.Yellow);
|
||||
|
||||
[Desc("Color of the border of the circle.")]
|
||||
[Desc("Range circle line width.")]
|
||||
public readonly float Width = 1;
|
||||
|
||||
[Desc("Color of the border.")]
|
||||
public readonly Color BorderColor = Color.FromArgb(96, Color.Black);
|
||||
|
||||
[Desc("Range circle border width.")]
|
||||
public readonly float BorderWidth = 3;
|
||||
|
||||
// Computed range
|
||||
Lazy<WDist> range;
|
||||
|
||||
@@ -51,7 +57,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
range.Value,
|
||||
0,
|
||||
Color,
|
||||
BorderColor);
|
||||
Width,
|
||||
BorderColor,
|
||||
BorderWidth);
|
||||
|
||||
var otherRanges = w.ActorsWithTrait<RenderRangeCircle>()
|
||||
.Where(a => a.Trait.Info.RangeCircleType == RangeCircleType)
|
||||
@@ -105,7 +113,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
range,
|
||||
0,
|
||||
Info.Color,
|
||||
Info.BorderColor);
|
||||
Info.Width,
|
||||
Info.BorderColor,
|
||||
Info.BorderWidth);
|
||||
}
|
||||
|
||||
IEnumerable<IRenderable> IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr)
|
||||
|
||||
@@ -23,8 +23,14 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Color of the circle.")]
|
||||
public readonly Color Color = Color.FromArgb(128, Color.Cyan);
|
||||
|
||||
[Desc("Contrast color of the circle.")]
|
||||
public readonly Color ContrastColor = Color.FromArgb(96, Color.Black);
|
||||
[Desc("Range circle line width.")]
|
||||
public readonly float Width = 1;
|
||||
|
||||
[Desc("Border color of the circle.")]
|
||||
public readonly Color BorderColor = Color.FromArgb(96, Color.Black);
|
||||
|
||||
[Desc("Range circle border width.")]
|
||||
public readonly float BorderWidth = 3;
|
||||
|
||||
public IEnumerable<IRenderable> RenderAnnotations(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
|
||||
{
|
||||
@@ -39,7 +45,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
localRange,
|
||||
0,
|
||||
Color,
|
||||
ContrastColor);
|
||||
Width,
|
||||
BorderColor,
|
||||
BorderWidth);
|
||||
|
||||
var otherRangeRenderables = w.ActorsWithTrait<RenderShroudCircle>()
|
||||
.SelectMany(a => a.Trait.RangeCircleRenderables(a.Actor, wr));
|
||||
@@ -78,7 +86,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
range,
|
||||
0,
|
||||
info.Color,
|
||||
info.ContrastColor);
|
||||
info.Width,
|
||||
info.BorderColor,
|
||||
info.BorderWidth);
|
||||
}
|
||||
|
||||
IEnumerable<IRenderable> IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr)
|
||||
|
||||
@@ -28,6 +28,15 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
[Desc("Color of the circle")]
|
||||
public readonly Color Color = Color.FromArgb(128, Color.White);
|
||||
|
||||
[Desc("Border width.")]
|
||||
public readonly float Width = 1;
|
||||
|
||||
[Desc("Color of the border.")]
|
||||
public readonly Color BorderColor = Color.FromArgb(96, Color.Black);
|
||||
|
||||
[Desc("Range circle border width.")]
|
||||
public readonly float BorderWidth = 3;
|
||||
|
||||
[Desc("If set, the color of the owning player will be used instead of `Color`.")]
|
||||
public readonly bool UsePlayerColor = false;
|
||||
|
||||
@@ -50,7 +59,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
Range,
|
||||
0,
|
||||
Color,
|
||||
Color.FromArgb(96, Color.Black));
|
||||
Width,
|
||||
BorderColor,
|
||||
BorderWidth);
|
||||
|
||||
foreach (var a in w.ActorsWithTrait<WithRangeCircle>())
|
||||
if (a.Trait.Info.Type == Type)
|
||||
@@ -92,7 +103,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
||||
Info.Range,
|
||||
0,
|
||||
Info.UsePlayerColor ? self.Owner.Color : Info.Color,
|
||||
Color.FromArgb(96, Color.Black));
|
||||
Info.Width,
|
||||
Info.BorderColor,
|
||||
Info.BorderWidth);
|
||||
}
|
||||
|
||||
IEnumerable<IRenderable> IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr)
|
||||
|
||||
Reference in New Issue
Block a user