From f241d67e5f79e8fea111bbf936215d7d67093804 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 18 Feb 2019 15:23:03 +0900 Subject: [PATCH] Use conditional operator isntead of if --- osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs | 5 +---- osu.Game/Screens/Play/Player.cs | 1 + osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs | 2 -- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 6ea8899876..d1c75f0e21 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -81,10 +81,7 @@ namespace osu.Game.Screens.Backgrounds private void updateBackgroundDim() { - if (UpdateDim) - FadeContainer?.FadeColour(OsuColour.Gray(1 - (float)DimLevel), 800, Easing.OutQuint); - else - FadeContainer?.FadeColour(Color4.White, 800, Easing.OutQuint); + FadeContainer?.FadeColour(UpdateDim ? OsuColour.Gray(1 - (float)DimLevel) : Color4.White, 800, Easing.OutQuint); } public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2526b2e3ab..5aed939c03 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -61,6 +61,7 @@ namespace osu.Game.Screens.Play public CursorContainer Cursor => RulesetContainer.Cursor; public bool ProvidingUserCursor => RulesetContainer?.Cursor != null && !RulesetContainer.HasReplayLoaded.Value; + protected float BackgroundOpacity => 1 - (float)DimLevel; private IAdjustableClock sourceClock; diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 24d0e1a19d..f2a57b2e1d 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -19,8 +19,6 @@ namespace osu.Game.Screens.Play protected const float BACKGROUND_FADE_DURATION = 800; - protected float BackgroundOpacity => 1 - (float)DimLevel; - #region User Settings protected Bindable DimLevel;