Extract method to avoid nested ternaries

This commit is contained in:
Bartłomiej Dach 2020-02-10 20:27:46 +01:00
parent 7395f01919
commit e2950d7027
1 changed files with 9 additions and 1 deletions

View File

@ -150,7 +150,7 @@ private void load(IAPIProvider api, BeatmapManager beatmaps)
},
new OsuSpriteText
{
Text = BeatmapSet.Value.OnlineInfo.HasVideo ? (noVideo ? "without Video" : "with Video") : string.Empty,
Text = getVideoSuffixText(),
Font = OsuFont.GetFont(size: 11, weight: FontWeight.Bold)
},
};
@ -163,5 +163,13 @@ private void load(IAPIProvider api, BeatmapManager beatmaps)
private void userChanged(ValueChangedEvent<User> e) => button.Enabled.Value = !(e.NewValue is GuestUser);
private void enabledChanged(ValueChangedEvent<bool> e) => this.FadeColour(e.NewValue ? Color4.White : Color4.Gray, 200, Easing.OutQuint);
private string getVideoSuffixText()
{
if (!BeatmapSet.Value.OnlineInfo.HasVideo)
return string.Empty;
return noVideo ? "without Video" : "with Video";
}
}
}