Use expression body syntax
This commit is contained in:
@@ -228,12 +228,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
public void Reset() { throw new NotSupportedException(); }
|
||||
public Actor Current
|
||||
{
|
||||
get { return current; }
|
||||
}
|
||||
public Actor Current => current;
|
||||
|
||||
object IEnumerator.Current { get { return current; } }
|
||||
object IEnumerator.Current => current;
|
||||
public void Dispose() { }
|
||||
public bool MoveNext()
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
bridges = new CellLayer<Actor>(world.Map);
|
||||
}
|
||||
|
||||
public Actor this[CPos cell] { get { return bridges[cell]; } }
|
||||
public Actor this[CPos cell] => bridges[cell];
|
||||
|
||||
public void Add(Actor b)
|
||||
{
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
.SelectMany(p => p.RenderAnnotations());
|
||||
}
|
||||
|
||||
bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } }
|
||||
bool IRenderAnnotations.SpatiallyPartitionable => false;
|
||||
|
||||
public EditorActorPreview Add(ActorReference reference) { return Add(NextActorName(), reference); }
|
||||
|
||||
|
||||
@@ -30,16 +30,11 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly Rectangle Bounds;
|
||||
public readonly SelectionBoxAnnotationRenderable SelectionBox;
|
||||
|
||||
public string Tooltip
|
||||
{
|
||||
get
|
||||
{
|
||||
return (tooltip == null ? " < " + Info.Name + " >" : tooltip.Name) + "\n" + Owner.Name + " (" + Owner.Faction + ")"
|
||||
+ "\nID: " + ID + "\nType: " + Info.Name;
|
||||
}
|
||||
}
|
||||
public string Tooltip =>
|
||||
(tooltip == null ? " < " + Info.Name + " >" : tooltip.Name) + "\n" + Owner.Name + " (" + Owner.Faction + ")"
|
||||
+ "\nID: " + ID + "\nType: " + Info.Name;
|
||||
|
||||
public string Type { get { return reference.Type; } }
|
||||
public string Type => reference.Type;
|
||||
|
||||
public string ID { get; set; }
|
||||
public PlayerReference Owner { get; set; }
|
||||
|
||||
@@ -137,7 +137,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return NoRenderables;
|
||||
}
|
||||
|
||||
bool IRenderAboveShroud.SpatiallyPartitionable { get { return false; } }
|
||||
bool IRenderAboveShroud.SpatiallyPartitionable => false;
|
||||
|
||||
public IEnumerable<IRenderable> RenderAnnotations(Actor self, WorldRenderer wr)
|
||||
{
|
||||
@@ -147,7 +147,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
return Type == EditorCursorType.Actor ? Actor.RenderAnnotations() : NoRenderables;
|
||||
}
|
||||
|
||||
bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } }
|
||||
bool IRenderAnnotations.SpatiallyPartitionable => false;
|
||||
|
||||
public int SetActor(WorldRenderer wr, ActorInfo actor, PlayerReference owner)
|
||||
{
|
||||
|
||||
@@ -106,6 +106,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
WVec.Zero, -511, palette, 1f, pasteAlpha * info.FootprintAlpha, float3.Ones, TintModifiers.IgnoreWorldTint, true);
|
||||
}
|
||||
|
||||
bool IRenderAboveShroud.SpatiallyPartitionable { get { return false; } }
|
||||
bool IRenderAboveShroud.SpatiallyPartitionable => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -70,9 +70,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
bool ICustomMovementLayer.EnabledForActor(ActorInfo a, LocomotorInfo li) { return enabled; }
|
||||
byte ICustomMovementLayer.Index { get { return CustomMovementLayerType.ElevatedBridge; } }
|
||||
bool ICustomMovementLayer.InteractsWithDefaultLayer { get { return true; } }
|
||||
bool ICustomMovementLayer.ReturnToGroundLayerOnIdle { get { return false; } }
|
||||
byte ICustomMovementLayer.Index => CustomMovementLayerType.ElevatedBridge;
|
||||
bool ICustomMovementLayer.InteractsWithDefaultLayer => true;
|
||||
bool ICustomMovementLayer.ReturnToGroundLayerOnIdle => false;
|
||||
|
||||
WPos ICustomMovementLayer.CenterOfCell(CPos cell)
|
||||
{
|
||||
|
||||
@@ -63,9 +63,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
bool ICustomMovementLayer.EnabledForActor(ActorInfo a, LocomotorInfo li) { return li is JumpjetLocomotorInfo; }
|
||||
byte ICustomMovementLayer.Index { get { return CustomMovementLayerType.Jumpjet; } }
|
||||
bool ICustomMovementLayer.InteractsWithDefaultLayer { get { return true; } }
|
||||
bool ICustomMovementLayer.ReturnToGroundLayerOnIdle { get { return true; } }
|
||||
byte ICustomMovementLayer.Index => CustomMovementLayerType.Jumpjet;
|
||||
bool ICustomMovementLayer.InteractsWithDefaultLayer => true;
|
||||
bool ICustomMovementLayer.ReturnToGroundLayerOnIdle => true;
|
||||
|
||||
WPos ICustomMovementLayer.CenterOfCell(CPos cell)
|
||||
{
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Can this actor transition on slopes?")]
|
||||
public readonly bool JumpjetTransitionOnRamps = true;
|
||||
|
||||
public override bool DisableDomainPassabilityCheck { get { return true; } }
|
||||
public override bool DisableDomainPassabilityCheck => true;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new JumpjetLocomotor(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -72,6 +72,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
prerequisites = info.Prerequisites;
|
||||
}
|
||||
|
||||
IEnumerable<string> ITechTreePrerequisite.ProvidesPrerequisites { get { return prerequisites; } }
|
||||
IEnumerable<string> ITechTreePrerequisite.ProvidesPrerequisites => prerequisites;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
public virtual bool DisableDomainPassabilityCheck { get { return false; } }
|
||||
public virtual bool DisableDomainPassabilityCheck => false;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new Locomotor(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -54,10 +54,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly bool IsMusicAvailable;
|
||||
public readonly bool AllowMuteBackgroundMusic;
|
||||
|
||||
public bool IsBackgroundMusicMuted
|
||||
{
|
||||
get { return AllowMuteBackgroundMusic && Game.Settings.Sound.MuteBackgroundMusic; }
|
||||
}
|
||||
public bool IsBackgroundMusicMuted => AllowMuteBackgroundMusic && Game.Settings.Sound.MuteBackgroundMusic;
|
||||
|
||||
public bool CurrentSongIsBackground { get; private set; }
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public override object Create(ActorInitializer init) { return new PaletteFromEmbeddedSpritePalette(this); }
|
||||
|
||||
string IProvidesCursorPaletteInfo.Palette { get { return CursorPalette ? Name : null; } }
|
||||
string IProvidesCursorPaletteInfo.Palette => CursorPalette ? Name : null;
|
||||
|
||||
ImmutablePalette IProvidesCursorPaletteInfo.ReadPalette(IReadOnlyFileSystem fileSystem)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public override object Create(ActorInitializer init) { return new PaletteFromFile(init.World, this); }
|
||||
|
||||
string IProvidesCursorPaletteInfo.Palette { get { return CursorPalette ? Name : null; } }
|
||||
string IProvidesCursorPaletteInfo.Palette => CursorPalette ? Name : null;
|
||||
|
||||
ImmutablePalette IProvidesCursorPaletteInfo.ReadPalette(IReadOnlyFileSystem fileSystem)
|
||||
{
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public override object Create(ActorInitializer init) { return new PaletteFromGimpOrJascFile(init.World, this); }
|
||||
|
||||
string IProvidesCursorPaletteInfo.Palette { get { return CursorPalette ? Name : null; } }
|
||||
string IProvidesCursorPaletteInfo.Palette => CursorPalette ? Name : null;
|
||||
|
||||
ImmutablePalette IProvidesCursorPaletteInfo.ReadPalette(IReadOnlyFileSystem fileSystem)
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
public override object Create(ActorInitializer init) { return new PaletteFromPng(init.World, this); }
|
||||
|
||||
string IProvidesCursorPaletteInfo.Palette { get { return CursorPalette ? Name : null; } }
|
||||
string IProvidesCursorPaletteInfo.Palette => CursorPalette ? Name : null;
|
||||
|
||||
ImmutablePalette IProvidesCursorPaletteInfo.ReadPalette(IReadOnlyFileSystem fileSystem)
|
||||
{
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
protected readonly CellLayer<ResourceLayerContents> Content;
|
||||
|
||||
public bool IsResourceLayerEmpty { get { return resCells < 1; } }
|
||||
public bool IsResourceLayerEmpty => resCells < 1;
|
||||
|
||||
int resCells;
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public class Selection : ISelection, INotifyCreated, INotifyOwnerChanged, ITick, IGameSaveTraitData
|
||||
{
|
||||
public int Hash { get; private set; }
|
||||
public IEnumerable<Actor> Actors { get { return actors; } }
|
||||
public IEnumerable<Actor> Actors => actors;
|
||||
|
||||
readonly HashSet<Actor> actors = new HashSet<Actor>();
|
||||
World world;
|
||||
|
||||
@@ -62,9 +62,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
bool ICustomMovementLayer.EnabledForActor(ActorInfo a, LocomotorInfo li) { return li is SubterraneanLocomotorInfo; }
|
||||
byte ICustomMovementLayer.Index { get { return CustomMovementLayerType.Subterranean; } }
|
||||
bool ICustomMovementLayer.InteractsWithDefaultLayer { get { return false; } }
|
||||
bool ICustomMovementLayer.ReturnToGroundLayerOnIdle { get { return true; } }
|
||||
byte ICustomMovementLayer.Index => CustomMovementLayerType.Subterranean;
|
||||
bool ICustomMovementLayer.InteractsWithDefaultLayer => false;
|
||||
bool ICustomMovementLayer.ReturnToGroundLayerOnIdle => true;
|
||||
|
||||
WPos ICustomMovementLayer.CenterOfCell(CPos cell)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
[Desc("Depth at which the subterranian condition is applied.")]
|
||||
public readonly WDist SubterraneanTransitionDepth = new WDist(-1024);
|
||||
|
||||
public override bool DisableDomainPassabilityCheck { get { return true; } }
|
||||
public override bool DisableDomainPassabilityCheck => true;
|
||||
|
||||
public override object Create(ActorInitializer init) { return new SubterraneanLocomotor(init.Self, this); }
|
||||
}
|
||||
|
||||
@@ -95,6 +95,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
}
|
||||
|
||||
bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } }
|
||||
bool IRenderAnnotations.SpatiallyPartitionable => false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
disposed = true;
|
||||
}
|
||||
|
||||
Sprite ITiledTerrainRenderer.MissingTile { get { return tileCache.MissingTile; } }
|
||||
Sprite ITiledTerrainRenderer.MissingTile => tileCache.MissingTile;
|
||||
|
||||
Sprite ITiledTerrainRenderer.TileSprite(TerrainTile r, int? variant)
|
||||
{
|
||||
|
||||
@@ -69,9 +69,9 @@ namespace OpenRA.Mods.Common.Traits
|
||||
}
|
||||
|
||||
bool ICustomMovementLayer.EnabledForActor(ActorInfo a, LocomotorInfo li) { return enabled; }
|
||||
byte ICustomMovementLayer.Index { get { return CustomMovementLayerType.Tunnel; } }
|
||||
bool ICustomMovementLayer.InteractsWithDefaultLayer { get { return false; } }
|
||||
bool ICustomMovementLayer.ReturnToGroundLayerOnIdle { get { return true; } }
|
||||
byte ICustomMovementLayer.Index => CustomMovementLayerType.Tunnel;
|
||||
bool ICustomMovementLayer.InteractsWithDefaultLayer => false;
|
||||
bool ICustomMovementLayer.ReturnToGroundLayerOnIdle => true;
|
||||
|
||||
WPos ICustomMovementLayer.CenterOfCell(CPos cell)
|
||||
{
|
||||
|
||||
@@ -34,10 +34,7 @@ namespace OpenRA.Mods.Common.Traits
|
||||
public readonly Color Color;
|
||||
public int Time;
|
||||
|
||||
public WDist OuterRange
|
||||
{
|
||||
get { return Range[Range.Length - 1]; }
|
||||
}
|
||||
public WDist OuterRange => Range[Range.Length - 1];
|
||||
|
||||
public WHImpact(WPos pos, WDist[] range, int time, Color color)
|
||||
{
|
||||
@@ -83,6 +80,6 @@ namespace OpenRA.Mods.Common.Traits
|
||||
impacts.RemoveAll(i => i.Time == 0);
|
||||
}
|
||||
|
||||
bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } }
|
||||
bool IRenderAnnotations.SpatiallyPartitionable => false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user