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

@@ -51,6 +51,6 @@ namespace OpenRA.Mods.Common.Traits.Render
}
Color ISelectionBar.GetColor() { return info.Color; }
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
bool ISelectionBar.DisplayWhenEmpty => false;
}
}

View File

@@ -78,6 +78,6 @@ namespace OpenRA.Mods.Common.Traits
}
}
bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } }
bool IRenderAnnotations.SpatiallyPartitionable => false;
}
}

View File

@@ -93,7 +93,7 @@ namespace OpenRA.Mods.Common.Traits
yield return new SpriteRenderable(n.Tile, n.Target.CenterPosition, WVec.Zero, -511, pal, 1f, 1f, float3.Ones, TintModifiers.IgnoreWorldTint, true);
}
bool IRenderAboveShroud.SpatiallyPartitionable { get { return false; } }
bool IRenderAboveShroud.SpatiallyPartitionable => false;
IEnumerable<IRenderable> IRenderAnnotationsWhenSelected.RenderAnnotations(Actor self, WorldRenderer wr)
{
@@ -130,7 +130,7 @@ namespace OpenRA.Mods.Common.Traits
return renderableCache.ToArray();
}
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
}
public static class LineTargetExts

View File

@@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.Traits.Render
}
Color ISelectionBar.GetColor() { return Info.Color; }
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
bool ISelectionBar.DisplayWhenEmpty => false;
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
{

View File

@@ -54,6 +54,6 @@ namespace OpenRA.Mods.Common.Traits.Render
}
Color ISelectionBar.GetColor() { return info.Color; }
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
bool ISelectionBar.DisplayWhenEmpty => false;
}
}

View File

@@ -98,6 +98,6 @@ namespace OpenRA.Mods.Common.Traits.Render
yield return new TextAnnotationRenderable(font, self.CenterPosition + offset, 0, color, aiSquadInfo);
}
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return true; } }
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => true;
}
}

View File

@@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.Traits.Render
info.BorderWidth);
}
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
void ITick.Tick(Actor self)
{

View File

@@ -84,6 +84,6 @@ namespace OpenRA.Mods.Common.Traits
}
}
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
}
}

View File

@@ -123,6 +123,6 @@ namespace OpenRA.Mods.Common.Traits.Render
return RangeCircleRenderables(wr);
}
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
}
}

View File

@@ -96,6 +96,6 @@ namespace OpenRA.Mods.Common.Traits
return RangeCircleRenderables(self, wr);
}
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
}
}

View File

@@ -118,13 +118,7 @@ namespace OpenRA.Mods.Common.Traits.Render
PaletteReference = null;
}
public bool IsVisible
{
get
{
return Animation.DisableFunc == null || !Animation.DisableFunc();
}
}
public bool IsVisible => Animation.DisableFunc == null || !Animation.DisableFunc();
public bool Tick()
{

View File

@@ -164,7 +164,8 @@ namespace OpenRA.Mods.Common.Traits.Render
yield return c.ScreenBounds(pos, wr, Info.Scale);
}
public string Image { get { return Info.Image ?? self.Info.Name; } }
public string Image => Info.Image ?? self.Info.Name;
public void Add(ModelAnimation m)
{
components.Add(m);

View File

@@ -64,7 +64,7 @@ namespace OpenRA.Mods.Common.Traits.Render
return DrawDecorations(self, wr);
}
bool IRenderAnnotations.SpatiallyPartitionable { get { return true; } }
bool IRenderAnnotations.SpatiallyPartitionable => true;
IEnumerable<IRenderable> DrawDecorations(Actor self, WorldRenderer wr)
{

View File

@@ -55,7 +55,7 @@ namespace OpenRA.Mods.Common.Traits.Render
}
Color ISelectionBar.GetColor() { return Info.Color; }
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
bool ISelectionBar.DisplayWhenEmpty => false;
void INotifyOwnerChanged.OnOwnerChanged(Actor self, Player oldOwner, Player newOwner)
{

View File

@@ -43,7 +43,7 @@ namespace OpenRA.Mods.Common.Traits.Render
value = duration > 0 ? remaining * 1f / duration : 0;
}
string IConditionTimerWatcher.Condition { get { return info.Condition; } }
string IConditionTimerWatcher.Condition => info.Condition;
float ISelectionBar.GetValue()
{
@@ -54,6 +54,6 @@ namespace OpenRA.Mods.Common.Traits.Render
}
Color ISelectionBar.GetColor() { return info.Color; }
bool ISelectionBar.DisplayWhenEmpty { get { return false; } }
bool ISelectionBar.DisplayWhenEmpty => false;
}
}

View File

@@ -69,8 +69,9 @@ namespace OpenRA.Mods.Common.Traits.Render
}
}
Sprite IProductionIconOverlay.Sprite { get { return sprite; } }
string IProductionIconOverlay.Palette { get { return info.Palette; } }
Sprite IProductionIconOverlay.Sprite => sprite;
string IProductionIconOverlay.Palette => info.Palette;
float2 IProductionIconOverlay.Offset(float2 iconSize)
{
var x = (sprite.Size.X - iconSize.X) / 2;

View File

@@ -89,7 +89,7 @@ namespace OpenRA.Mods.Common.Traits.Render
return true;
}
bool IDecoration.RequiresSelection { get { return Info.RequiresSelection; } }
bool IDecoration.RequiresSelection => Info.RequiresSelection;
protected abstract IEnumerable<IRenderable> RenderDecoration(Actor self, WorldRenderer wr, int2 pos);

View File

@@ -77,7 +77,7 @@ namespace OpenRA.Mods.Common.Traits.Render
AnimationState state;
IRenderInfantrySequenceModifier rsm;
bool IsModifyingSequence { get { return rsm != null && rsm.IsModifyingSequence; } }
bool IsModifyingSequence => rsm != null && rsm.IsModifyingSequence;
bool wasModifying;
// Allow subclasses to override the info that we use for rendering

View File

@@ -113,13 +113,13 @@ namespace OpenRA.Mods.Common.Traits.Render
return RenderRangeCircle(self, wr, RangeCircleVisibility.WhenSelected);
}
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable { get { return false; } }
bool IRenderAnnotationsWhenSelected.SpatiallyPartitionable => false;
IEnumerable<IRenderable> IRenderAnnotations.RenderAnnotations(Actor self, WorldRenderer wr)
{
return RenderRangeCircle(self, wr, RangeCircleVisibility.Always);
}
bool IRenderAnnotations.SpatiallyPartitionable { get { return false; } }
bool IRenderAnnotations.SpatiallyPartitionable => false;
}
}

View File

@@ -51,7 +51,7 @@ namespace OpenRA.Mods.Common.Traits.Render
anim = new Animation(self.World, Info.Image);
}
bool IDecoration.RequiresSelection { get { return true; } }
bool IDecoration.RequiresSelection => true;
IEnumerable<IRenderable> IDecoration.RenderDecoration(Actor self, WorldRenderer wr, ISelectionDecorations container)
{

View File

@@ -63,7 +63,7 @@ namespace OpenRA.Mods.Common.Traits.Render
label = new CachedTransform<int, string>(g => g.ToString());
}
bool IDecoration.RequiresSelection { get { return true; } }
bool IDecoration.RequiresSelection => true;
IEnumerable<IRenderable> IDecoration.RenderDecoration(Actor self, WorldRenderer wr, ISelectionDecorations container)
{