Use expression body syntax

This commit is contained in:
teinarss
2021-02-25 20:52:13 +01:00
committed by Paul Chote
parent 555c43843b
commit 4a1e4f3e16
403 changed files with 1342 additions and 2031 deletions

View File

@@ -30,7 +30,7 @@ namespace OpenRA.Mods.Common.Graphics
{
public readonly ActorInfo Actor;
public readonly WorldRenderer WorldRenderer;
public World World { get { return WorldRenderer.World; } }
public World World => WorldRenderer.World;
readonly ActorReference reference;

View File

@@ -34,9 +34,9 @@ namespace OpenRA.Mods.Common.Graphics
this.color = color;
}
public WPos Pos { get { return pos; } }
public int ZOffset { get { return zOffset; } }
public bool IsDecoration { get { return true; } }
public WPos Pos => pos;
public int ZOffset => zOffset;
public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new BeamRenderable(pos, zOffset, length, shape, width, color); }
public IRenderable OffsetBy(WVec vec) { return new BeamRenderable(pos + vec, zOffset, length, shape, width, color); }

View File

@@ -34,9 +34,9 @@ namespace OpenRA.Mods.Common.Graphics
this.filled = filled;
}
public WPos Pos { get { return centerPosition; } }
public int ZOffset { get { return 0; } }
public bool IsDecoration { get { return true; } }
public WPos Pos => centerPosition;
public int ZOffset => 0;
public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new CircleAnnotationRenderable(centerPosition, radius, width, color, filled); }
public IRenderable OffsetBy(WVec vec) { return new CircleAnnotationRenderable(centerPosition + vec, radius, width, color, filled); }

View File

@@ -17,7 +17,7 @@ namespace OpenRA.Mods.Common.Graphics
{
public class ContrailRenderable : IRenderable, IFinalizedRenderable
{
public int Length { get { return trail.Length; } }
public int Length => trail.Length;
readonly World world;
readonly Color color;
@@ -45,9 +45,9 @@ namespace OpenRA.Mods.Common.Graphics
this.zOffset = zOffset;
}
public WPos Pos { get { return trail[Index(next - 1)]; } }
public int ZOffset { get { return zOffset; } }
public bool IsDecoration { get { return true; } }
public WPos Pos => trail[Index(next - 1)];
public int ZOffset => zOffset;
public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new ContrailRenderable(world, (WPos[])trail.Clone(), width, next, length, skip, color, newOffset); }
public IRenderable OffsetBy(WVec vec) { return new ContrailRenderable(world, trail.Select(pos => pos + vec).ToArray(), width, next, length, skip, color, zOffset); }

View File

@@ -99,21 +99,21 @@ namespace OpenRA.Mods.Common.Graphics
this.exception = exception;
}
public string Filename { get { return exception.FileName; } }
public string Filename => exception.FileName;
string ISpriteSequence.Name { get { throw exception; } }
int ISpriteSequence.Start { get { throw exception; } }
int ISpriteSequence.Length { get { throw exception; } }
int ISpriteSequence.Stride { get { throw exception; } }
int ISpriteSequence.Facings { get { throw exception; } }
int ISpriteSequence.Tick { get { throw exception; } }
int ISpriteSequence.ZOffset { get { throw exception; } }
int ISpriteSequence.ShadowStart { get { throw exception; } }
int ISpriteSequence.ShadowZOffset { get { throw exception; } }
int[] ISpriteSequence.Frames { get { throw exception; } }
Rectangle ISpriteSequence.Bounds { get { throw exception; } }
bool ISpriteSequence.IgnoreWorldTint { get { throw exception; } }
float ISpriteSequence.Scale { get { throw exception; } }
string ISpriteSequence.Name => throw exception;
int ISpriteSequence.Start => throw exception;
int ISpriteSequence.Length => throw exception;
int ISpriteSequence.Stride => throw exception;
int ISpriteSequence.Facings => throw exception;
int ISpriteSequence.Tick => throw exception;
int ISpriteSequence.ZOffset => throw exception;
int ISpriteSequence.ShadowStart => throw exception;
int ISpriteSequence.ShadowZOffset => throw exception;
int[] ISpriteSequence.Frames => throw exception;
Rectangle ISpriteSequence.Bounds => throw exception;
bool ISpriteSequence.IgnoreWorldTint => throw exception;
float ISpriteSequence.Scale => throw exception;
Sprite ISpriteSequence.GetSprite(int frame) { throw exception; }
Sprite ISpriteSequence.GetSprite(int frame, WAngle facing) { throw exception; }
Sprite ISpriteSequence.GetShadow(int frame, WAngle facing) { throw exception; }

View File

@@ -42,9 +42,9 @@ namespace OpenRA.Mods.Common.Graphics
this.borderWidth = borderWidth;
}
public WPos Pos { get { return centerPosition; } }
public int ZOffset { get { return zOffset; } }
public bool IsDecoration { get { return true; } }
public WPos Pos => centerPosition;
public int ZOffset => zOffset;
public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset)
{

View File

@@ -46,12 +46,12 @@ namespace OpenRA.Mods.Common.Graphics
this.bounds = bounds;
}
public WPos Pos { get { return pos; } }
public bool DisplayHealth { get { return displayHealth; } }
public bool DisplayExtra { get { return displayExtra; } }
public WPos Pos => pos;
public bool DisplayHealth => displayHealth;
public bool DisplayExtra => displayExtra;
public int ZOffset { get { return 0; } }
public bool IsDecoration { get { return true; } }
public int ZOffset => 0;
public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return this; }
public IRenderable OffsetBy(WVec vec) { return new IsometricSelectionBarsAnnotationRenderable(pos + vec, actor, bounds); }

View File

@@ -48,10 +48,10 @@ namespace OpenRA.Mods.Common.Graphics
this.color = color;
}
public WPos Pos { get { return pos; } }
public WPos Pos => pos;
public int ZOffset { get { return 0; } }
public bool IsDecoration { get { return true; } }
public int ZOffset => 0;
public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return this; }
public IRenderable OffsetBy(WVec vec) { return new IsometricSelectionBoxAnnotationRenderable(pos + vec, bounds, color); }

View File

@@ -39,9 +39,9 @@ namespace OpenRA.Mods.Common.Graphics
this.endColor = endColor;
}
public WPos Pos { get { return start; } }
public int ZOffset { get { return 0; } }
public bool IsDecoration { get { return true; } }
public WPos Pos => start;
public int ZOffset => 0;
public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new LineAnnotationRenderable(start, end, width, startColor, endColor); }
public IRenderable OffsetBy(WVec vec) { return new LineAnnotationRenderable(start + vec, end + vec, width, startColor, endColor); }

View File

@@ -65,14 +65,14 @@ namespace OpenRA.Mods.Common.Graphics
this.tintModifiers = tintModifiers;
}
public WPos Pos { get { return pos; } }
public PaletteReference Palette { get { return palette; } }
public int ZOffset { get { return zOffset; } }
public bool IsDecoration { get { return false; } }
public WPos Pos => pos;
public PaletteReference Palette => palette;
public int ZOffset => zOffset;
public bool IsDecoration => false;
public float Alpha { get { return alpha; } }
public float3 Tint { get { return tint; } }
public TintModifiers TintModifiers { get { return tintModifiers; } }
public float Alpha => alpha;
public float3 Tint => tint;
public TintModifiers TintModifiers => tintModifiers;
public IPalettedRenderable WithPalette(PaletteReference newPalette)
{

View File

@@ -30,9 +30,9 @@ namespace OpenRA.Mods.Common.Graphics
this.color = color;
}
public WPos Pos { get { return effectivePos; } }
public int ZOffset { get { return 0; } }
public bool IsDecoration { get { return true; } }
public WPos Pos => effectivePos;
public int ZOffset => 0;
public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new PolygonAnnotationRenderable(vertices, effectivePos, width, color); }
public IRenderable OffsetBy(WVec vec) { return new PolygonAnnotationRenderable(vertices.Select(v => v + vec).ToArray(), effectivePos + vec, width, color); }

View File

@@ -40,9 +40,9 @@ namespace OpenRA.Mods.Common.Graphics
angle = new WAngle(ticks * info.HelixAngleDeltaPerTick.Angle);
}
public WPos Pos { get { return pos; } }
public int ZOffset { get { return zOffset; } }
public bool IsDecoration { get { return true; } }
public WPos Pos => pos;
public int ZOffset => zOffset;
public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new RailgunHelixRenderable(pos, newOffset, railgun, info, ticks); }
public IRenderable OffsetBy(WVec vec) { return new RailgunHelixRenderable(pos + vec, zOffset, railgun, info, ticks); }

View File

@@ -39,9 +39,9 @@ namespace OpenRA.Mods.Common.Graphics
this.borderWidth = borderWidth;
}
public WPos Pos { get { return centerPosition; } }
public int ZOffset { get { return zOffset; } }
public bool IsDecoration { get { return true; } }
public WPos Pos => centerPosition;
public int ZOffset => zOffset;
public bool IsDecoration => true;
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, width, borderColor, borderWidth); }

View File

@@ -37,12 +37,12 @@ namespace OpenRA.Mods.Common.Graphics
this.decorationBounds = decorationBounds;
}
public WPos Pos { get { return pos; } }
public bool DisplayHealth { get { return displayHealth; } }
public bool DisplayExtra { get { return displayExtra; } }
public WPos Pos => pos;
public bool DisplayHealth => displayHealth;
public bool DisplayExtra => displayExtra;
public int ZOffset { get { return 0; } }
public bool IsDecoration { get { return true; } }
public int ZOffset => 0;
public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return this; }
public IRenderable OffsetBy(WVec vec) { return new SelectionBarsAnnotationRenderable(pos + vec, actor, decorationBounds); }

View File

@@ -30,10 +30,10 @@ namespace OpenRA.Mods.Common.Graphics
this.color = color;
}
public WPos Pos { get { return pos; } }
public WPos Pos => pos;
public int ZOffset { get { return 0; } }
public bool IsDecoration { get { return true; } }
public int ZOffset => 0;
public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return this; }
public IRenderable OffsetBy(WVec vec) { return new SelectionBoxAnnotationRenderable(pos + vec, decorationBounds, color); }

View File

@@ -42,9 +42,9 @@ namespace OpenRA.Mods.Common.Graphics
ChromeMetrics.Get<Color>("TextContrastColorLight"),
text) { }
public WPos Pos { get { return pos; } }
public int ZOffset { get { return zOffset; } }
public bool IsDecoration { get { return true; } }
public WPos Pos => pos;
public int ZOffset => zOffset;
public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new TextAnnotationRenderable(font, pos, zOffset, color, text); }
public IRenderable OffsetBy(WVec vec) { return new TextAnnotationRenderable(font, pos + vec, zOffset, color, text); }

View File

@@ -51,10 +51,10 @@ namespace OpenRA.Mods.Common.Graphics
shadowPalette = shadow;
}
public WPos Pos { get { return effectiveWorldPos; } }
public PaletteReference Palette { get { return palette; } }
public int ZOffset { get { return zOffset; } }
public bool IsDecoration { get { return false; } }
public WPos Pos => effectiveWorldPos;
public PaletteReference Palette => palette;
public int ZOffset => zOffset;
public bool IsDecoration => false;
public IPalettedRenderable WithPalette(PaletteReference newPalette)
{

View File

@@ -44,9 +44,9 @@ namespace OpenRA.Mods.Common.Graphics
ChromeMetrics.Get<Color>("TextContrastColorLight"),
text) { }
public WPos Pos { get { return effectiveWorldPos; } }
public int ZOffset { get { return zOffset; } }
public bool IsDecoration { get { return true; } }
public WPos Pos => effectiveWorldPos;
public int ZOffset => zOffset;
public bool IsDecoration => true;
public IRenderable WithZOffset(int newOffset) { return new UITextRenderable(font, effectiveWorldPos, screenPos, zOffset, color, text); }
public IRenderable OffsetBy(WVec vec) { return new UITextRenderable(font, effectiveWorldPos + vec, screenPos, zOffset, color, text); }