Use expression body for property get/set where possible

This commit is contained in:
Dean Herbert
2019-02-28 13:58:19 +09:00
parent 94a389319d
commit 42be7857d1
130 changed files with 297 additions and 403 deletions

View File

@ -26,10 +26,7 @@ namespace osu.Game.Graphics.UserInterface
/// </summary>
public float Length
{
get
{
return length;
}
get => length;
set
{
length = MathHelper.Clamp(value, 0, 1);
@ -39,35 +36,20 @@ namespace osu.Game.Graphics.UserInterface
public Color4 BackgroundColour
{
get
{
return background.Colour;
}
set
{
background.Colour = value;
}
get => background.Colour;
set => background.Colour = value;
}
public Color4 AccentColour
{
get
{
return bar.Colour;
}
set
{
bar.Colour = value;
}
get => bar.Colour;
set => bar.Colour = value;
}
private BarDirection direction = BarDirection.LeftToRight;
public BarDirection Direction
{
get
{
return direction;
}
get => direction;
set
{
direction = value;

View File

@ -19,10 +19,7 @@ namespace osu.Game.Graphics.UserInterface
private BarDirection direction = BarDirection.BottomToTop;
public new BarDirection Direction
{
get
{
return direction;
}
get => direction;
set
{
direction = value;

View File

@ -57,7 +57,7 @@ namespace osu.Game.Graphics.UserInterface
public Visibility State
{
get { return state; }
get => state;
set
{
if (value == state) return;

View File

@ -156,10 +156,7 @@ namespace osu.Game.Graphics.UserInterface
private Color4 buttonColour;
public Color4 ButtonColour
{
get
{
return buttonColour;
}
get => buttonColour;
set
{
buttonColour = value;
@ -171,10 +168,7 @@ namespace osu.Game.Graphics.UserInterface
private Color4 backgroundColour = OsuColour.Gray(34);
public Color4 BackgroundColour
{
get
{
return backgroundColour;
}
get => backgroundColour;
set
{
backgroundColour = value;
@ -185,10 +179,7 @@ namespace osu.Game.Graphics.UserInterface
private string text;
public string Text
{
get
{
return text;
}
get => text;
set
{
text = value;

View File

@ -19,7 +19,7 @@ namespace osu.Game.Graphics.UserInterface
/// </summary>
public Color4 IconColour
{
get { return iconColour ?? Color4.White; }
get => iconColour ?? Color4.White;
set
{
iconColour = value;
@ -34,8 +34,8 @@ namespace osu.Game.Graphics.UserInterface
/// </summary>
public Color4 IconHoverColour
{
get { return iconHoverColour ?? IconColour; }
set { iconHoverColour = value; }
get => iconHoverColour ?? IconColour;
set => iconHoverColour = value;
}
/// <summary>
@ -43,8 +43,8 @@ namespace osu.Game.Graphics.UserInterface
/// </summary>
public FontAwesome Icon
{
get { return icon.Icon; }
set { icon.Icon = value; }
get => icon.Icon;
set => icon.Icon = value;
}
/// <summary>
@ -52,8 +52,8 @@ namespace osu.Game.Graphics.UserInterface
/// </summary>
public Vector2 IconScale
{
get { return icon.Scale; }
set { icon.Scale = value; }
get => icon.Scale;
set => icon.Scale = value;
}
/// <summary>

View File

@ -44,7 +44,7 @@ namespace osu.Game.Graphics.UserInterface
/// </summary>
public IEnumerable<float> Values
{
get { return values; }
get => values;
set
{
values = value.ToArray();

View File

@ -74,7 +74,7 @@ namespace osu.Game.Graphics.UserInterface
private bool glowing;
public bool Glowing
{
get { return glowing; }
get => glowing;
set
{
glowing = value;
@ -94,10 +94,7 @@ namespace osu.Game.Graphics.UserInterface
public bool Expanded
{
set
{
this.ResizeTo(new Vector2(value ? EXPANDED_SIZE : COLLAPSED_SIZE, 12), 500, Easing.OutQuint);
}
set => this.ResizeTo(new Vector2(value ? EXPANDED_SIZE : COLLAPSED_SIZE, 12), 500, Easing.OutQuint);
}
private readonly Bindable<bool> current = new Bindable<bool>();
@ -118,7 +115,7 @@ namespace osu.Game.Graphics.UserInterface
private Color4 accentColour;
public Color4 AccentColour
{
get { return accentColour; }
get => accentColour;
set
{
accentColour = value;
@ -130,7 +127,7 @@ namespace osu.Game.Graphics.UserInterface
private Color4 glowingAccentColour;
public Color4 GlowingAccentColour
{
get { return glowingAccentColour; }
get => glowingAccentColour;
set
{
glowingAccentColour = value;
@ -142,7 +139,7 @@ namespace osu.Game.Graphics.UserInterface
private Color4 glowColour;
public Color4 GlowColour
{
get { return glowColour; }
get => glowColour;
set
{
glowColour = value;

View File

@ -33,7 +33,7 @@ namespace osu.Game.Graphics.UserInterface
public string LabelText
{
get { return labelSpriteText?.Text; }
get => labelSpriteText?.Text;
set
{
if (labelSpriteText != null)
@ -43,7 +43,7 @@ namespace osu.Game.Graphics.UserInterface
public MarginPadding LabelPadding
{
get { return labelSpriteText?.Padding ?? new MarginPadding(); }
get => labelSpriteText?.Padding ?? new MarginPadding();
set
{
if (labelSpriteText != null)

View File

@ -19,7 +19,7 @@ namespace osu.Game.Graphics.UserInterface
private Color4 accentColour;
public Color4 AccentColour
{
get { return accentColour; }
get => accentColour;
set
{
accentColour = value;
@ -85,7 +85,7 @@ namespace osu.Game.Graphics.UserInterface
private Color4 accentColour;
public Color4 AccentColour
{
get { return accentColour; }
get => accentColour;
set
{
accentColour = value;
@ -105,7 +105,7 @@ namespace osu.Game.Graphics.UserInterface
private Color4? accentColour;
public Color4 AccentColour
{
get { return accentColour ?? nonAccentSelectedColour; }
get => accentColour ?? nonAccentSelectedColour;
set
{
accentColour = value;
@ -159,8 +159,8 @@ namespace osu.Game.Graphics.UserInterface
{
public string Text
{
get { return Label.Text; }
set { Label.Text = value; }
get => Label.Text;
set => Label.Text = value;
}
public readonly OsuSpriteText Label;
@ -203,8 +203,8 @@ namespace osu.Game.Graphics.UserInterface
protected readonly SpriteText Text;
protected override string Label
{
get { return Text.Text; }
set { Text.Text = value; }
get => Text.Text;
set => Text.Text = value;
}
protected readonly SpriteIcon Icon;
@ -212,7 +212,7 @@ namespace osu.Game.Graphics.UserInterface
private Color4 accentColour;
public virtual Color4 AccentColour
{
get { return accentColour; }
get => accentColour;
set
{
accentColour = value;

View File

@ -125,7 +125,7 @@ namespace osu.Game.Graphics.UserInterface
{
public string Text
{
get { return NormalText.Text; }
get => NormalText.Text;
set
{
NormalText.Text = value;

View File

@ -37,7 +37,7 @@ namespace osu.Game.Graphics.UserInterface
private Color4 accentColour;
public Color4 AccentColour
{
get { return accentColour; }
get => accentColour;
set
{
accentColour = value;

View File

@ -60,7 +60,7 @@ namespace osu.Game.Graphics.UserInterface
private Color4 accentColour;
public Color4 AccentColour
{
get { return accentColour; }
get => accentColour;
set
{
accentColour = value;
@ -103,7 +103,7 @@ namespace osu.Game.Graphics.UserInterface
private Color4 accentColour;
public Color4 AccentColour
{
get { return accentColour; }
get => accentColour;
set
{
accentColour = value;
@ -224,10 +224,7 @@ namespace osu.Game.Graphics.UserInterface
{
public override Color4 AccentColour
{
get
{
return base.AccentColour;
}
get => base.AccentColour;
set
{

View File

@ -26,7 +26,7 @@ namespace osu.Game.Graphics.UserInterface
private Color4? accentColour;
public Color4 AccentColour
{
get { return accentColour.GetValueOrDefault(); }
get => accentColour.GetValueOrDefault();
set
{
accentColour = value;
@ -41,8 +41,8 @@ namespace osu.Game.Graphics.UserInterface
public string Text
{
get { return text.Text; }
set { text.Text = value; }
get => text.Text;
set => text.Text = value;
}
private const float transition_length = 500;

View File

@ -18,7 +18,7 @@ namespace osu.Game.Graphics.UserInterface
public Color4 FillColour
{
set { fill.FadeColour(value, 150, Easing.OutQuint); }
set => fill.FadeColour(value, 150, Easing.OutQuint);
}
public Color4 BackgroundColour
@ -32,12 +32,12 @@ namespace osu.Game.Graphics.UserInterface
public double EndTime
{
set { CurrentNumber.MaxValue = value; }
set => CurrentNumber.MaxValue = value;
}
public double CurrentTime
{
set { CurrentNumber.Value = value; }
set => CurrentNumber.Value = value;
}
public ProgressBar()

View File

@ -45,10 +45,7 @@ namespace osu.Game.Graphics.UserInterface
/// </summary>
public virtual T DisplayedCount
{
get
{
return displayedCount;
}
get => displayedCount;
set
{
@ -70,8 +67,8 @@ namespace osu.Game.Graphics.UserInterface
public Color4 AccentColour
{
get { return DisplayedCountSpriteText.Colour; }
set { DisplayedCountSpriteText.Colour = value; }
get => DisplayedCountSpriteText.Colour;
set => DisplayedCountSpriteText.Colour = value;
}
/// <summary>

View File

@ -41,10 +41,7 @@ namespace osu.Game.Graphics.UserInterface
/// </summary>
public float CountStars
{
get
{
return countStars;
}
get => countStars;
set
{

View File

@ -31,10 +31,7 @@ namespace osu.Game.Graphics.UserInterface
public bool MatchingFilter
{
set
{
this.FadeTo(value ? 1 : 0);
}
set => this.FadeTo(value ? 1 : 0);
}
}
}

View File

@ -48,10 +48,7 @@ namespace osu.Game.Graphics.UserInterface
public override Anchor Origin
{
get
{
return base.Origin;
}
get => base.Origin;
set
{
@ -155,18 +152,12 @@ namespace osu.Game.Graphics.UserInterface
public FontAwesome Icon
{
set
{
bouncingIcon.Icon = value;
}
set => bouncingIcon.Icon = value;
}
public string Text
{
set
{
text.Text = value;
}
set => text.Text = value;
}
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => IconLayer.ReceivePositionalInputAt(screenSpacePos) || TextLayer.ReceivePositionalInputAt(screenSpacePos);
@ -217,7 +208,7 @@ namespace osu.Game.Graphics.UserInterface
private readonly SpriteIcon icon;
public FontAwesome Icon { set { icon.Icon = value; } }
public FontAwesome Icon { set => icon.Icon = value; }
public BouncingIcon()
{