Make all range circles fully configurable.
This commit is contained in:
committed by
Paul Chote
parent
214aa64ce3
commit
14fc0254c6
@@ -56,6 +56,18 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
[VoiceReference]
|
[VoiceReference]
|
||||||
public readonly string Voice = "Action";
|
public readonly string Voice = "Action";
|
||||||
|
|
||||||
|
[Desc("Range circle color.")]
|
||||||
|
public readonly Color CircleColor = Color.FromArgb(128, Color.LawnGreen);
|
||||||
|
|
||||||
|
[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 PortableChrono(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new PortableChrono(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,8 +244,10 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
self.CenterPosition,
|
self.CenterPosition,
|
||||||
WDist.FromCells(self.Trait<PortableChrono>().Info.MaxDistance),
|
WDist.FromCells(self.Trait<PortableChrono>().Info.MaxDistance),
|
||||||
0,
|
0,
|
||||||
Color.FromArgb(128, Color.LawnGreen),
|
info.CircleColor,
|
||||||
Color.FromArgb(96, Color.Black));
|
info.CircleWidth,
|
||||||
|
info.CircleBorderColor,
|
||||||
|
info.CircleBorderWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi)
|
protected override string GetCursor(World world, CPos cell, int2 worldPixel, MouseInput mi)
|
||||||
|
|||||||
@@ -22,6 +22,18 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
{
|
{
|
||||||
class AttackOrderPowerInfo : SupportPowerInfo, Requires<AttackBaseInfo>
|
class AttackOrderPowerInfo : SupportPowerInfo, Requires<AttackBaseInfo>
|
||||||
{
|
{
|
||||||
|
[Desc("Range circle color.")]
|
||||||
|
public readonly Color CircleColor = 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 AttackOrderPower(init.Self, this); }
|
public override object Create(ActorInitializer init) { return new AttackOrderPower(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,21 +130,26 @@ namespace OpenRA.Mods.Cnc.Traits
|
|||||||
|
|
||||||
protected override IEnumerable<IRenderable> RenderAnnotations(WorldRenderer wr, World world)
|
protected override IEnumerable<IRenderable> RenderAnnotations(WorldRenderer wr, World world)
|
||||||
{
|
{
|
||||||
|
var info = instance.Info as AttackOrderPowerInfo;
|
||||||
foreach (var a in instance.Instances.Where(i => !i.IsTraitPaused))
|
foreach (var a in instance.Instances.Where(i => !i.IsTraitPaused))
|
||||||
{
|
{
|
||||||
yield return new RangeCircleAnnotationRenderable(
|
yield return new RangeCircleAnnotationRenderable(
|
||||||
a.Self.CenterPosition,
|
a.Self.CenterPosition,
|
||||||
attack.GetMinimumRange(),
|
attack.GetMinimumRange(),
|
||||||
0,
|
0,
|
||||||
Color.Red,
|
info.CircleColor,
|
||||||
Color.FromArgb(96, Color.Black));
|
info.CircleWidth,
|
||||||
|
info.CircleBorderColor,
|
||||||
|
info.CircleBorderWidth);
|
||||||
|
|
||||||
yield return new RangeCircleAnnotationRenderable(
|
yield return new RangeCircleAnnotationRenderable(
|
||||||
a.Self.CenterPosition,
|
a.Self.CenterPosition,
|
||||||
attack.GetMaximumRange(),
|
attack.GetMaximumRange(),
|
||||||
0,
|
0,
|
||||||
Color.Red,
|
info.CircleColor,
|
||||||
Color.FromArgb(96, Color.Black));
|
info.CircleWidth,
|
||||||
|
info.CircleBorderColor,
|
||||||
|
info.CircleBorderWidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,10 +23,12 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
readonly WAngle trailSeparation;
|
readonly WAngle trailSeparation;
|
||||||
readonly WAngle trailAngle;
|
readonly WAngle trailAngle;
|
||||||
readonly Color color;
|
readonly Color color;
|
||||||
readonly Color contrastColor;
|
readonly float width;
|
||||||
|
readonly Color borderColor;
|
||||||
|
readonly float borderWidth;
|
||||||
|
|
||||||
public DetectionCircleAnnotationRenderable(WPos centerPosition, WDist radius, int zOffset,
|
public DetectionCircleAnnotationRenderable(WPos centerPosition, WDist radius, int zOffset,
|
||||||
int lineTrails, WAngle trailSeparation, WAngle trailAngle, Color color, Color contrastColor)
|
int lineTrails, WAngle trailSeparation, WAngle trailAngle, Color color, float width, Color borderColor, float borderWidth)
|
||||||
{
|
{
|
||||||
this.centerPosition = centerPosition;
|
this.centerPosition = centerPosition;
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
@@ -35,7 +37,9 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
this.trailSeparation = trailSeparation;
|
this.trailSeparation = trailSeparation;
|
||||||
this.trailAngle = trailAngle;
|
this.trailAngle = trailAngle;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.contrastColor = contrastColor;
|
this.width = width;
|
||||||
|
this.borderColor = borderColor;
|
||||||
|
this.borderWidth = borderWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WPos Pos { get { return centerPosition; } }
|
public WPos Pos { get { return centerPosition; } }
|
||||||
@@ -46,19 +50,19 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
public IRenderable WithPalette(PaletteReference newPalette)
|
public IRenderable WithPalette(PaletteReference newPalette)
|
||||||
{
|
{
|
||||||
return new DetectionCircleAnnotationRenderable(centerPosition, radius, zOffset,
|
return new DetectionCircleAnnotationRenderable(centerPosition, radius, zOffset,
|
||||||
trailCount, trailSeparation, trailAngle, color, contrastColor);
|
trailCount, trailSeparation, trailAngle, color, width, borderColor, borderWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRenderable WithZOffset(int newOffset)
|
public IRenderable WithZOffset(int newOffset)
|
||||||
{
|
{
|
||||||
return new DetectionCircleAnnotationRenderable(centerPosition, radius, newOffset,
|
return new DetectionCircleAnnotationRenderable(centerPosition, radius, newOffset,
|
||||||
trailCount, trailSeparation, trailAngle, color, contrastColor);
|
trailCount, trailSeparation, trailAngle, color, width, borderColor, borderWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRenderable OffsetBy(WVec vec)
|
public IRenderable OffsetBy(WVec vec)
|
||||||
{
|
{
|
||||||
return new DetectionCircleAnnotationRenderable(centerPosition + vec, radius, zOffset,
|
return new DetectionCircleAnnotationRenderable(centerPosition + vec, radius, zOffset,
|
||||||
trailCount, trailSeparation, trailAngle, color, contrastColor);
|
trailCount, trailSeparation, trailAngle, color, width, borderColor, borderWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRenderable AsDecoration() { return this; }
|
public IRenderable AsDecoration() { return this; }
|
||||||
@@ -75,11 +79,11 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
var length = radius.Length * new WVec(angle.Cos(), angle.Sin(), 0) / 1024;
|
var length = radius.Length * new WVec(angle.Cos(), angle.Sin(), 0) / 1024;
|
||||||
var end = wr.Viewport.WorldToViewPx(wr.Screen3DPosition(centerPosition + length));
|
var end = wr.Viewport.WorldToViewPx(wr.Screen3DPosition(centerPosition + length));
|
||||||
var alpha = color.A - i * color.A / trailCount;
|
var alpha = color.A - i * color.A / trailCount;
|
||||||
cr.DrawLine(center, end, 3, Color.FromArgb(alpha, contrastColor));
|
cr.DrawLine(center, end, borderWidth, Color.FromArgb(alpha, borderColor));
|
||||||
cr.DrawLine(center, end, 1, Color.FromArgb(alpha, color));
|
cr.DrawLine(center, end, width, Color.FromArgb(alpha, color));
|
||||||
}
|
}
|
||||||
|
|
||||||
RangeCircleAnnotationRenderable.DrawRangeCircle(wr, centerPosition, radius, 1, color, 3, contrastColor);
|
RangeCircleAnnotationRenderable.DrawRangeCircle(wr, centerPosition, radius, width, color, borderWidth, borderColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RenderDebugGeometry(WorldRenderer wr) { }
|
public void RenderDebugGeometry(WorldRenderer wr) { }
|
||||||
|
|||||||
@@ -24,15 +24,19 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
readonly WDist radius;
|
readonly WDist radius;
|
||||||
readonly int zOffset;
|
readonly int zOffset;
|
||||||
readonly Color color;
|
readonly Color color;
|
||||||
readonly Color contrastColor;
|
readonly float width;
|
||||||
|
readonly Color borderColor;
|
||||||
|
readonly float borderWidth;
|
||||||
|
|
||||||
public RangeCircleAnnotationRenderable(WPos centerPosition, WDist radius, int zOffset, Color color, Color contrastColor)
|
public RangeCircleAnnotationRenderable(WPos centerPosition, WDist radius, int zOffset, Color color, float width, Color borderColor, float borderWidth)
|
||||||
{
|
{
|
||||||
this.centerPosition = centerPosition;
|
this.centerPosition = centerPosition;
|
||||||
this.radius = radius;
|
this.radius = radius;
|
||||||
this.zOffset = zOffset;
|
this.zOffset = zOffset;
|
||||||
this.color = color;
|
this.color = color;
|
||||||
this.contrastColor = contrastColor;
|
this.width = width;
|
||||||
|
this.borderColor = borderColor;
|
||||||
|
this.borderWidth = borderWidth;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WPos Pos { get { return centerPosition; } }
|
public WPos Pos { get { return centerPosition; } }
|
||||||
@@ -40,19 +44,19 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
public int ZOffset { get { return zOffset; } }
|
public int ZOffset { get { return zOffset; } }
|
||||||
public bool IsDecoration { get { return true; } }
|
public bool IsDecoration { get { return true; } }
|
||||||
|
|
||||||
public IRenderable WithPalette(PaletteReference newPalette) { return new RangeCircleAnnotationRenderable(centerPosition, radius, zOffset, color, contrastColor); }
|
public IRenderable WithPalette(PaletteReference newPalette) { return new RangeCircleAnnotationRenderable(centerPosition, radius, zOffset, color, width, borderColor, borderWidth); }
|
||||||
public IRenderable WithZOffset(int newOffset) { return new RangeCircleAnnotationRenderable(centerPosition, radius, newOffset, color, contrastColor); }
|
public IRenderable WithZOffset(int newOffset) { return new RangeCircleAnnotationRenderable(centerPosition, radius, newOffset, color, width, borderColor, borderWidth); }
|
||||||
public IRenderable OffsetBy(WVec vec) { return new RangeCircleAnnotationRenderable(centerPosition + vec, radius, zOffset, color, contrastColor); }
|
public IRenderable OffsetBy(WVec vec) { return new RangeCircleAnnotationRenderable(centerPosition + vec, radius, zOffset, color, width, borderColor, borderWidth); }
|
||||||
public IRenderable AsDecoration() { return this; }
|
public IRenderable AsDecoration() { return this; }
|
||||||
|
|
||||||
public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; }
|
public IFinalizedRenderable PrepareRender(WorldRenderer wr) { return this; }
|
||||||
public void Render(WorldRenderer wr)
|
public void Render(WorldRenderer wr)
|
||||||
{
|
{
|
||||||
DrawRangeCircle(wr, centerPosition, radius, 1, color, 3, contrastColor);
|
DrawRangeCircle(wr, centerPosition, radius, width, color, borderWidth, borderColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DrawRangeCircle(WorldRenderer wr, WPos centerPosition, WDist radius,
|
public static void DrawRangeCircle(WorldRenderer wr, WPos centerPosition, WDist radius,
|
||||||
float width, Color color, float contrastWidth, Color contrastColor)
|
float width, Color color, float borderWidth, Color borderColor)
|
||||||
{
|
{
|
||||||
var cr = Game.Renderer.RgbaColorRenderer;
|
var cr = Game.Renderer.RgbaColorRenderer;
|
||||||
var offset = new WVec(radius.Length, 0, 0);
|
var offset = new WVec(radius.Length, 0, 0);
|
||||||
@@ -61,8 +65,8 @@ namespace OpenRA.Mods.Common.Graphics
|
|||||||
var a = wr.Viewport.WorldToViewPx(wr.ScreenPosition(centerPosition + offset.Rotate(ref RangeCircleStartRotations[i])));
|
var a = wr.Viewport.WorldToViewPx(wr.ScreenPosition(centerPosition + offset.Rotate(ref RangeCircleStartRotations[i])));
|
||||||
var b = wr.Viewport.WorldToViewPx(wr.ScreenPosition(centerPosition + offset.Rotate(ref RangeCircleEndRotations[i])));
|
var b = wr.Viewport.WorldToViewPx(wr.ScreenPosition(centerPosition + offset.Rotate(ref RangeCircleEndRotations[i])));
|
||||||
|
|
||||||
if (contrastWidth > 0)
|
if (borderWidth > 0)
|
||||||
cr.DrawLine(a, b, contrastWidth, contrastColor);
|
cr.DrawLine(a, b, borderWidth, borderColor);
|
||||||
|
|
||||||
if (width > 0)
|
if (width > 0)
|
||||||
cr.DrawLine(a, b, width, color);
|
cr.DrawLine(a, b, width, color);
|
||||||
|
|||||||
@@ -24,6 +24,21 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
public readonly int Cooldown = 0;
|
public readonly int Cooldown = 0;
|
||||||
public readonly int InitialDelay = 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); }
|
public override object Create(ActorInitializer init) { return new BaseProvider(init.Self, this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -85,8 +100,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
self.CenterPosition,
|
self.CenterPosition,
|
||||||
Info.Range,
|
Info.Range,
|
||||||
0,
|
0,
|
||||||
Color.FromArgb(128, Ready() ? Color.White : Color.Red),
|
Ready() ? Info.CircleReadyColor : Info.CircleBlockedColor,
|
||||||
Color.FromArgb(96, Color.Black));
|
Info.CircleWidth,
|
||||||
|
Info.CircleBorderColor,
|
||||||
|
Info.CircleBorderWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerable<IRenderable> IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr)
|
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.")]
|
[Desc("Color of the circle and scanner update line.")]
|
||||||
public readonly Color Color = Color.FromArgb(128, Color.LimeGreen);
|
public readonly Color Color = Color.FromArgb(128, Color.LimeGreen);
|
||||||
|
|
||||||
[Desc("Contrast color of the circle and scanner update line.")]
|
[Desc("Range circle line width.")]
|
||||||
public readonly Color ContrastColor = Color.FromArgb(96, Color.Black);
|
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); }
|
public override object Create(ActorInitializer init) { return new RenderDetectionCircle(init.Self, this); }
|
||||||
}
|
}
|
||||||
@@ -65,7 +71,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
info.UpdateLineTick,
|
info.UpdateLineTick,
|
||||||
lineAngle,
|
lineAngle,
|
||||||
info.Color,
|
info.Color,
|
||||||
info.ContrastColor);
|
info.Width,
|
||||||
|
info.BorderColor,
|
||||||
|
info.BorderWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
|
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
|
||||||
|
|||||||
@@ -18,8 +18,20 @@ using OpenRA.Traits;
|
|||||||
namespace OpenRA.Mods.Common.Traits
|
namespace OpenRA.Mods.Common.Traits
|
||||||
{
|
{
|
||||||
// TODO: remove all the Render*Circle duplication
|
// 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)
|
public IEnumerable<IRenderable> RenderAnnotations(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
|
||||||
{
|
{
|
||||||
var jamsMissiles = ai.TraitInfoOrDefault<JamsMissilesInfo>();
|
var jamsMissiles = ai.TraitInfoOrDefault<JamsMissilesInfo>();
|
||||||
@@ -29,8 +41,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
centerPosition,
|
centerPosition,
|
||||||
jamsMissiles.Range,
|
jamsMissiles.Range,
|
||||||
0,
|
0,
|
||||||
Color.FromArgb(128, Color.Red),
|
Color,
|
||||||
Color.FromArgb(96, Color.Black));
|
Width,
|
||||||
|
BorderColor,
|
||||||
|
BorderWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var a in w.ActorsWithTrait<RenderJammerCircle>())
|
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))
|
foreach (var r in a.Trait.RenderAnnotations(a.Actor, wr))
|
||||||
yield return r;
|
yield return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override object Create(ActorInitializer init) { return new RenderJammerCircle(this); }
|
||||||
}
|
}
|
||||||
|
|
||||||
class RenderJammerCircle : IRenderAnnotationsWhenSelected
|
class RenderJammerCircle : IRenderAnnotationsWhenSelected
|
||||||
{
|
{
|
||||||
|
readonly RenderJammerCircleInfo info;
|
||||||
|
|
||||||
|
public RenderJammerCircle(RenderJammerCircleInfo info)
|
||||||
|
{
|
||||||
|
this.info = info;
|
||||||
|
}
|
||||||
|
|
||||||
public IEnumerable<IRenderable> RenderAnnotations(Actor self, WorldRenderer wr)
|
public IEnumerable<IRenderable> RenderAnnotations(Actor self, WorldRenderer wr)
|
||||||
{
|
{
|
||||||
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer))
|
if (!self.Owner.IsAlliedWith(self.World.RenderPlayer))
|
||||||
@@ -54,8 +77,10 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
self.CenterPosition,
|
self.CenterPosition,
|
||||||
jamsMissiles.Range,
|
jamsMissiles.Range,
|
||||||
0,
|
0,
|
||||||
Color.FromArgb(128, Color.Red),
|
info.Color,
|
||||||
Color.FromArgb(96, Color.Black));
|
info.Width,
|
||||||
|
info.BorderColor,
|
||||||
|
info.BorderWidth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -35,9 +35,15 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
[Desc("Color of the circle.")]
|
[Desc("Color of the circle.")]
|
||||||
public readonly Color Color = Color.FromArgb(128, Color.Yellow);
|
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);
|
public readonly Color BorderColor = Color.FromArgb(96, Color.Black);
|
||||||
|
|
||||||
|
[Desc("Range circle border width.")]
|
||||||
|
public readonly float BorderWidth = 3;
|
||||||
|
|
||||||
// Computed range
|
// Computed range
|
||||||
Lazy<WDist> range;
|
Lazy<WDist> range;
|
||||||
|
|
||||||
@@ -51,7 +57,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
range.Value,
|
range.Value,
|
||||||
0,
|
0,
|
||||||
Color,
|
Color,
|
||||||
BorderColor);
|
Width,
|
||||||
|
BorderColor,
|
||||||
|
BorderWidth);
|
||||||
|
|
||||||
var otherRanges = w.ActorsWithTrait<RenderRangeCircle>()
|
var otherRanges = w.ActorsWithTrait<RenderRangeCircle>()
|
||||||
.Where(a => a.Trait.Info.RangeCircleType == RangeCircleType)
|
.Where(a => a.Trait.Info.RangeCircleType == RangeCircleType)
|
||||||
@@ -105,7 +113,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
range,
|
range,
|
||||||
0,
|
0,
|
||||||
Info.Color,
|
Info.Color,
|
||||||
Info.BorderColor);
|
Info.Width,
|
||||||
|
Info.BorderColor,
|
||||||
|
Info.BorderWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerable<IRenderable> IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr)
|
IEnumerable<IRenderable> IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr)
|
||||||
|
|||||||
@@ -23,8 +23,14 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
[Desc("Color of the circle.")]
|
[Desc("Color of the circle.")]
|
||||||
public readonly Color Color = Color.FromArgb(128, Color.Cyan);
|
public readonly Color Color = Color.FromArgb(128, Color.Cyan);
|
||||||
|
|
||||||
[Desc("Contrast color of the circle.")]
|
[Desc("Range circle line width.")]
|
||||||
public readonly Color ContrastColor = Color.FromArgb(96, Color.Black);
|
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)
|
public IEnumerable<IRenderable> RenderAnnotations(WorldRenderer wr, World w, ActorInfo ai, WPos centerPosition)
|
||||||
{
|
{
|
||||||
@@ -39,7 +45,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
localRange,
|
localRange,
|
||||||
0,
|
0,
|
||||||
Color,
|
Color,
|
||||||
ContrastColor);
|
Width,
|
||||||
|
BorderColor,
|
||||||
|
BorderWidth);
|
||||||
|
|
||||||
var otherRangeRenderables = w.ActorsWithTrait<RenderShroudCircle>()
|
var otherRangeRenderables = w.ActorsWithTrait<RenderShroudCircle>()
|
||||||
.SelectMany(a => a.Trait.RangeCircleRenderables(a.Actor, wr));
|
.SelectMany(a => a.Trait.RangeCircleRenderables(a.Actor, wr));
|
||||||
@@ -78,7 +86,9 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
range,
|
range,
|
||||||
0,
|
0,
|
||||||
info.Color,
|
info.Color,
|
||||||
info.ContrastColor);
|
info.Width,
|
||||||
|
info.BorderColor,
|
||||||
|
info.BorderWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
IEnumerable<IRenderable> IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr)
|
IEnumerable<IRenderable> IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr)
|
||||||
|
|||||||
@@ -28,6 +28,15 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
[Desc("Color of the circle")]
|
[Desc("Color of the circle")]
|
||||||
public readonly Color Color = Color.FromArgb(128, Color.White);
|
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`.")]
|
[Desc("If set, the color of the owning player will be used instead of `Color`.")]
|
||||||
public readonly bool UsePlayerColor = false;
|
public readonly bool UsePlayerColor = false;
|
||||||
|
|
||||||
@@ -50,7 +59,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
Range,
|
Range,
|
||||||
0,
|
0,
|
||||||
Color,
|
Color,
|
||||||
Color.FromArgb(96, Color.Black));
|
Width,
|
||||||
|
BorderColor,
|
||||||
|
BorderWidth);
|
||||||
|
|
||||||
foreach (var a in w.ActorsWithTrait<WithRangeCircle>())
|
foreach (var a in w.ActorsWithTrait<WithRangeCircle>())
|
||||||
if (a.Trait.Info.Type == Type)
|
if (a.Trait.Info.Type == Type)
|
||||||
@@ -92,7 +103,9 @@ namespace OpenRA.Mods.Common.Traits.Render
|
|||||||
Info.Range,
|
Info.Range,
|
||||||
0,
|
0,
|
||||||
Info.UsePlayerColor ? self.Owner.Color : Info.Color,
|
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)
|
IEnumerable<IRenderable> IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr)
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
#region Copyright & License Information
|
||||||
|
/*
|
||||||
|
* Copyright 2007-2020 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, either version 3 of
|
||||||
|
* the License, or (at your option) any later version. For more
|
||||||
|
* information, see COPYING.
|
||||||
|
*/
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace OpenRA.Mods.Common.UpdateRules.Rules
|
||||||
|
{
|
||||||
|
public class RenameCircleContrast : UpdateRule
|
||||||
|
{
|
||||||
|
public override string Name { get { return "Rename 'ContrastColor' to 'BorderColor'."; } }
|
||||||
|
public override string Description
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return "RenderDetectionCircle and RenderShroudCircle ContrastColor have been renamed to BorderColor for consistency.";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override IEnumerable<string> UpdateActorNode(ModData modData, MiniYamlNode actorNode)
|
||||||
|
{
|
||||||
|
foreach (var rdc in actorNode.ChildrenMatching("RenderDetectionCircle"))
|
||||||
|
rdc.RenameChildrenMatching("ContrastColor", "BorderColor");
|
||||||
|
|
||||||
|
foreach (var rsc in actorNode.ChildrenMatching("RenderShroudCircle"))
|
||||||
|
rsc.RenameChildrenMatching("ContrastColor", "BorderColor");
|
||||||
|
|
||||||
|
yield break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -75,6 +75,7 @@ namespace OpenRA.Mods.Common.UpdateRules
|
|||||||
new RemoveMuzzleSplitFacings(),
|
new RemoveMuzzleSplitFacings(),
|
||||||
new RemoveTurnToDock(),
|
new RemoveTurnToDock(),
|
||||||
new RenameSmudgeSmokeFields(),
|
new RenameSmudgeSmokeFields(),
|
||||||
|
new RenameCircleContrast(),
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user