From 452caabd40f00c2867e16e7014c5fb1ed4b69766 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Feb 2019 17:06:49 +0900 Subject: [PATCH] Apply suggestions from code review Co-Authored-By: smoogipoo <1329837+smoogipoo@users.noreply.github.com> --- .../Objects/Drawables/Pieces/NotePiece.cs | 2 +- osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs | 2 +- .../UI/Components/ColumnHitObjectArea.cs | 2 +- osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs | 4 ++-- osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs | 6 +++--- osu.Game.Tests/Visual/TestCaseDrawableDate.cs | 2 +- osu.Game/Beatmaps/WorkingBeatmap.cs | 2 +- osu.Game/Overlays/BeatmapSet/Header.cs | 8 ++++---- osu.Game/Overlays/Music/PlaylistItem.cs | 2 +- osu.Game/Overlays/Settings/SettingsItem.cs | 4 ++-- osu.Game/Overlays/SocialOverlay.cs | 4 ++-- .../Screens/Multi/Match/Components/MatchChatDisplay.cs | 2 +- 12 files changed, 20 insertions(+), 20 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs index e8b6d6e9fa..4f76f83b8f 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs @@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces direction.BindTo(scrollingInfo.Direction); direction.BindValueChanged(e => { - colouredBox.Anchor = colouredBox.Origin = direction.Value == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; + colouredBox.Anchor = colouredBox.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; }, true); } diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs index 4d30066355..e19ba13c51 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs @@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Mania.UI.Components direction.BindTo(scrollingInfo.Direction); direction.BindValueChanged(e => { - backgroundOverlay.Anchor = backgroundOverlay.Origin = direction.Value == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; + backgroundOverlay.Anchor = backgroundOverlay.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; updateColours(); }, true); } diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs index 2d198c413c..7a4780e8cc 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs @@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Mania.UI.Components direction.BindTo(scrollingInfo.Direction); direction.BindValueChanged(e => { - Anchor anchor = direction.Value == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; + Anchor anchor = e.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; hitTargetBar.Anchor = hitTargetBar.Origin = anchor; hitTargetLine.Anchor = hitTargetLine.Origin = anchor; diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs index e6a73f557e..3124e62479 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs @@ -67,8 +67,8 @@ namespace osu.Game.Rulesets.Mania.UI.Components direction.BindValueChanged(e => { gradient.Colour = ColourInfo.GradientVertical( - direction.Value == ScrollingDirection.Up ? Color4.Black : Color4.Black.Opacity(0), - direction.Value == ScrollingDirection.Up ? Color4.Black.Opacity(0) : Color4.Black); + e.NewValue == ScrollingDirection.Up ? Color4.Black : Color4.Black.Opacity(0), + e.NewValue == ScrollingDirection.Up ? Color4.Black.Opacity(0) : Color4.Black); }, true); } diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs index 12b6ae8212..325a0172b9 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs @@ -183,13 +183,13 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor }; this.beatmap.BindTo(beatmap); - this.beatmap.ValueChanged += e => calculateScale(); + this.beatmap.ValueChanged += _ => calculateScale(); cursorScale = config.GetBindable(OsuSetting.GameplayCursorSize); - cursorScale.ValueChanged += e => calculateScale(); + cursorScale.ValueChanged += _ => calculateScale(); autoCursorScale = config.GetBindable(OsuSetting.AutoCursorSize); - autoCursorScale.ValueChanged += e => calculateScale(); + autoCursorScale.ValueChanged += _ => calculateScale(); calculateScale(); } diff --git a/osu.Game.Tests/Visual/TestCaseDrawableDate.cs b/osu.Game.Tests/Visual/TestCaseDrawableDate.cs index 199e8ef145..8d2182dd78 100644 --- a/osu.Game.Tests/Visual/TestCaseDrawableDate.cs +++ b/osu.Game.Tests/Visual/TestCaseDrawableDate.cs @@ -60,7 +60,7 @@ namespace osu.Game.Tests.Visual } }; - drawableDate.Current.ValueChanged += e => flash.FadeOutFromOne(500); + drawableDate.Current.ValueChanged += _ => flash.FadeOutFromOne(500); } } } diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 45642b0adb..2e36d87024 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -36,7 +36,7 @@ namespace osu.Game.Beatmaps BeatmapSetInfo = beatmapInfo.BeatmapSet; Metadata = beatmapInfo.Metadata ?? BeatmapSetInfo?.Metadata ?? new BeatmapMetadata(); - Mods.ValueChanged += e => applyRateAdjustments(); + Mods.ValueChanged += _ => applyRateAdjustments(); beatmap = new RecyclableLazy(() => { diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index 235ca4635d..38a0454a4c 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -223,7 +223,7 @@ namespace osu.Game.Overlays.BeatmapSet { case DownloadState.LocallyAvailable: // temporary for UX until new design is implemented. - downloadButtonsContainer.Child = new osu.Game.Overlays.Direct.DownloadButton(BeatmapSet.Value) + downloadButtonsContainer.Child = new osu.Game.Overlays.Direct.DownloadButton(e.NewValue) { Width = 50, RelativeSizeAxes = Axes.Y @@ -232,12 +232,12 @@ namespace osu.Game.Overlays.BeatmapSet case DownloadState.Downloading: case DownloadState.Downloaded: // temporary to avoid showing two buttons for maps with novideo. will be fixed in new beatmap overlay design. - downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); + downloadButtonsContainer.Child = new DownloadButton(e.NewValue); break; default: - downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); + downloadButtonsContainer.Child = new DownloadButton(e.NewValue); if (BeatmapSet.Value.OnlineInfo.HasVideo) - downloadButtonsContainer.Add(new DownloadButton(BeatmapSet.Value, true)); + downloadButtonsContainer.Add(new DownloadButton(e.NewValue, true)); break; } } diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 2d2592b8ed..1105995f62 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -100,7 +100,7 @@ namespace osu.Game.Overlays.Music titleBind = localisation.GetLocalisedString(new LocalisedString((metadata.TitleUnicode, metadata.Title))); artistBind = localisation.GetLocalisedString(new LocalisedString((metadata.ArtistUnicode, metadata.Artist))); - artistBind.BindValueChanged(e => recreateText(), true); + artistBind.BindValueChanged(_ => recreateText(), true); } private void recreateText() diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 71f2ef3c1d..de7e8bbd71 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -119,8 +119,8 @@ namespace osu.Game.Overlays.Settings set { bindable = value; - bindable.ValueChanged += e => UpdateState(); - bindable.DisabledChanged += disabled => UpdateState(); + bindable.ValueChanged += _ => UpdateState(); + bindable.DisabledChanged += _ => UpdateState(); } } diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index e96a7638cb..48b18f26cc 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -67,9 +67,9 @@ namespace osu.Game.Overlays } }; - Header.Tabs.Current.ValueChanged += e => Scheduler.AddOnce(updateSearch); + Header.Tabs.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch); - Filter.Tabs.Current.ValueChanged += e => Scheduler.AddOnce(updateSearch); + Filter.Tabs.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch); Filter.DisplayStyleControl.DisplayStyle.ValueChanged += e => recreatePanels(e.NewValue); Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += e => Scheduler.AddOnce(updateSearch); diff --git a/osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs b/osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs index 147b80049f..bd8e4c7335 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Multi.Match.Components { base.LoadComplete(); - roomId.BindValueChanged(e => updateChannel(), true); + roomId.BindValueChanged(_ => updateChannel(), true); } private void updateChannel()