From befe57e12ef017b9cffdf9bb2a4239b0ae9ecdf1 Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sat, 17 Nov 2018 15:23:52 +0300 Subject: [PATCH 001/327] Stop PreviewTrack on Completed event --- osu.Game/Audio/PreviewTrack.cs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/osu.Game/Audio/PreviewTrack.cs b/osu.Game/Audio/PreviewTrack.cs index 3c9122b941..9fe1c3d2eb 100644 --- a/osu.Game/Audio/PreviewTrack.cs +++ b/osu.Game/Audio/PreviewTrack.cs @@ -28,6 +28,7 @@ namespace osu.Game.Audio private void load() { track = GetTrack(); + track.Completed += Stop; } /// @@ -50,15 +51,6 @@ namespace osu.Game.Audio /// public bool IsRunning => track?.IsRunning ?? false; - protected override void Update() - { - base.Update(); - - // Todo: Track currently doesn't signal its completion, so we have to handle it manually - if (hasStarted && track.HasCompleted) - Stop(); - } - private ScheduledDelegate startDelegate; /// From c4fc87b69a6acfaf94afecad4d0f45d3cf0d190c Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Sat, 17 Nov 2018 15:39:40 +0300 Subject: [PATCH 002/327] Move to next track on Completed event --- osu.Game/Overlays/MusicController.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index f282b757cd..790aab16d0 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -253,9 +253,6 @@ namespace osu.Game.Overlays progressBar.CurrentTime = track.CurrentTime; playButton.Icon = track.IsRunning ? FontAwesome.fa_pause_circle_o : FontAwesome.fa_play_circle_o; - - if (track.HasCompleted && !track.Looping && !beatmap.Disabled && beatmapSets.Any()) - next(); } else { @@ -333,9 +330,13 @@ namespace osu.Game.Overlays direction = last > next ? TransformDirection.Prev : TransformDirection.Next; } + + current.Track.Completed -= currentTrackCompleted; } current = beatmap; + if (current != null) + current.Track.Completed += currentTrackCompleted; progressBar.CurrentTime = 0; @@ -344,6 +345,12 @@ namespace osu.Game.Overlays queuedDirection = null; } + private void currentTrackCompleted() + { + if (!beatmap.Disabled && beatmapSets.Any()) + next(); + } + private ScheduledDelegate pendingBeatmapSwitch; private void updateDisplay(WorkingBeatmap beatmap, TransformDirection direction) From 6f8a2e6ff240ef63505f3bcf2f84c03e786a4b68 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Thu, 13 Dec 2018 14:55:28 +0900 Subject: [PATCH 003/327] Use LifetimeManagementContainer This is a significant performance boost for gameplay, especially for long or stroyboard-heavy maps. --- .../Connections/ConnectionRenderer.cs | 2 +- .../Connections/FollowPointRenderer.cs | 4 ++-- .../Objects/Drawables/DrawableHitCircle.cs | 1 + .../Drawables/Pieces/ApproachCircle.cs | 2 ++ osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 23 ++++++++++++++++--- osu.Game/Rulesets/UI/HitObjectContainer.cs | 2 +- .../Drawables/DrawableStoryboardLayer.cs | 4 ++-- 7 files changed, 29 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/ConnectionRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/ConnectionRenderer.cs index f15be94b8a..dfbb503cbf 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/ConnectionRenderer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/ConnectionRenderer.cs @@ -10,7 +10,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections /// /// Connects hit objects visually, for example with follow points. /// - public abstract class ConnectionRenderer : Container + public abstract class ConnectionRenderer : LifetimeManagementContainer where T : HitObject { /// diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs index 61219d9bb9..ebcf6b33ba 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs @@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections private void update() { - Clear(); + ClearInternal(); if (hitObjects == null) return; @@ -86,7 +86,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections FollowPoint fp; - Add(fp = new FollowPoint + AddInternal(fp = new FollowPoint { Position = pointStartPosition, Rotation = rotation, diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 9b562745fa..c5d5717618 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -118,6 +118,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables ApproachCircle.FadeIn(Math.Min(HitObject.TimeFadeIn * 2, HitObject.TimePreempt)); ApproachCircle.ScaleTo(1.1f, HitObject.TimePreempt); + ApproachCircle.Expire(true); } protected override void UpdateCurrentState(ArmedState state) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ApproachCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ApproachCircle.cs index 07d99bda42..59d7b24ca9 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ApproachCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/ApproachCircle.cs @@ -12,6 +12,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { public class ApproachCircle : Container { + public override bool RemoveWhenNotAlive => false; + public ApproachCircle() { Anchor = Anchor.Centre; diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 3399fdb9a0..732ba5d7e8 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -16,7 +16,7 @@ namespace osu.Game.Rulesets.Osu.UI { public class OsuPlayfield : Playfield { - private readonly Container approachCircles; + private readonly ApproachCircleProxyContainer approachCircles; private readonly JudgementContainer judgementLayer; private readonly ConnectionRenderer connectionLayer; @@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Osu.UI Depth = 1, }, HitObjectContainer, - approachCircles = new Container + approachCircles = new ApproachCircleProxyContainer { RelativeSizeAxes = Axes.Both, Depth = -1, @@ -60,11 +60,23 @@ namespace osu.Game.Rulesets.Osu.UI var c = h as IDrawableHitObjectWithProxiedApproach; if (c != null) - approachCircles.Add(c.ProxiedLayer.CreateProxy()); + { + var original = c.ProxiedLayer; + // lifetime is set on LoadComplete so wait until it. + original.OnLoadComplete += addApproachCircleProxy; + } base.Add(h); } + private void addApproachCircleProxy(Drawable d) + { + var proxy = d.CreateProxy(); + proxy.LifetimeStart = d.LifetimeStart; + proxy.LifetimeEnd = d.LifetimeEnd; + approachCircles.Add(proxy); + } + public override void PostProcess() { connectionLayer.HitObjects = HitObjectContainer.Objects.Select(d => d.HitObject).OfType(); @@ -86,5 +98,10 @@ namespace osu.Game.Rulesets.Osu.UI } public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => HitObjectContainer.ReceivePositionalInputAt(screenSpacePos); + + private class ApproachCircleProxyContainer : LifetimeManagementContainer + { + public void Add(Drawable approachCircleProxy) => AddInternal(approachCircleProxy); + } } } diff --git a/osu.Game/Rulesets/UI/HitObjectContainer.cs b/osu.Game/Rulesets/UI/HitObjectContainer.cs index 261132c56b..73d44cca13 100644 --- a/osu.Game/Rulesets/UI/HitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/HitObjectContainer.cs @@ -9,7 +9,7 @@ using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.UI { - public class HitObjectContainer : CompositeDrawable + public class HitObjectContainer : LifetimeManagementContainer { public IEnumerable Objects => InternalChildren.Cast().OrderBy(h => h.HitObject.StartTime); public IEnumerable AliveObjects => AliveInternalChildren.Cast().OrderBy(h => h.HitObject.StartTime); diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardLayer.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardLayer.cs index 74eaab33ca..e06d226adf 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardLayer.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardLayer.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics.Containers; namespace osu.Game.Storyboards.Drawables { - public class DrawableStoryboardLayer : Container + public class DrawableStoryboardLayer : LifetimeManagementContainer { public StoryboardLayer Layer { get; private set; } public bool Enabled; @@ -29,7 +29,7 @@ namespace osu.Game.Storyboards.Drawables foreach (var element in Layer.Elements) { if (element.IsDrawable) - Add(element.CreateDrawable()); + AddInternal(element.CreateDrawable()); } } } From ab462a232f50977dd22a485e2a6296bcd022d320 Mon Sep 17 00:00:00 2001 From: Matthias Coenraerds Date: Fri, 4 Jan 2019 20:13:32 +0100 Subject: [PATCH 004/327] Implement clear scores on beatmap --- osu.Game/Scoring/ScoreManager.cs | 4 +- osu.Game/Screens/Select/ClearScoreDialog.cs | 46 +++++++++++++++++++ .../Select/Leaderboards/BeatmapLeaderboard.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 23 +++++++--- 4 files changed, 64 insertions(+), 11 deletions(-) create mode 100644 osu.Game/Screens/Select/ClearScoreDialog.cs diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index 663f441f2f..fc50178ba8 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -55,9 +55,7 @@ namespace osu.Game.Scoring public Score GetScore(ScoreInfo score) => new LegacyDatabasedScore(score, rulesets, beatmaps, Files.Store); - public List GetAllUsableScores() => ModelStore.ConsumableItems.Where(s => !s.DeletePending).ToList(); - - public IEnumerable QueryScores(Expression> query) => ModelStore.ConsumableItems.AsNoTracking().Where(query); + public IEnumerable GetAllUsableScores() => ModelStore.ConsumableItems.Where(s => !s.DeletePending); public ScoreInfo Query(Expression> query) => ModelStore.ConsumableItems.AsNoTracking().FirstOrDefault(query); } diff --git a/osu.Game/Screens/Select/ClearScoreDialog.cs b/osu.Game/Screens/Select/ClearScoreDialog.cs new file mode 100644 index 0000000000..38577902e9 --- /dev/null +++ b/osu.Game/Screens/Select/ClearScoreDialog.cs @@ -0,0 +1,46 @@ +using osu.Framework.Allocation; +using osu.Game.Beatmaps; +using osu.Game.Graphics; +using osu.Game.Overlays.Dialog; +using osu.Game.Scoring; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace osu.Game.Screens.Select +{ + public class ClearScoresDialog : PopupDialog + { + private ScoreManager manager; + + [BackgroundDependencyLoader] + private void load(ScoreManager beatmapManager) + { + manager = beatmapManager; + } + + public ClearScoresDialog(BeatmapSetInfo beatmap, IEnumerable scores, Action refresh) + { + BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}"; + + Icon = FontAwesome.fa_eraser; + HeaderText = $@"Clearing {scores.Count()} local score(s). Are you sure?"; + Buttons = new PopupDialogButton[] + { + new PopupDialogOkButton + { + Text = @"Yes. Please.", + Action = () => + { + manager.Delete(scores.ToList()); + refresh(); + } + }, + new PopupDialogCancelButton + { + Text = @"No, I'm still attached.", + }, + }; + } + } +} diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index 9f8726c86a..8d91be9ca1 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Select.Leaderboards { if (Scope == BeatmapLeaderboardScope.Local) { - Scores = scoreManager.QueryScores(s => s.Beatmap.ID == Beatmap.ID).ToArray(); + Scores = scoreManager.GetAllUsableScores().Where(s => s.Beatmap.ID == Beatmap.ID).ToArray(); PlaceholderState = Scores.Any() ? PlaceholderState.Successful : PlaceholderState.NoScores; return null; } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index f65cc0e49d..e70ff42418 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -1,11 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Collections.Generic; -using System.Linq; -using osuTK; -using osuTK.Input; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -13,8 +8,8 @@ using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Logging; using osu.Framework.Input.Events; +using osu.Framework.Logging; using osu.Framework.Screens; using osu.Framework.Threading; using osu.Game.Beatmaps; @@ -31,6 +26,11 @@ using osu.Game.Screens.Menu; using osu.Game.Screens.Play; using osu.Game.Screens.Select.Options; using osu.Game.Skinning; +using osuTK; +using osuTK.Input; +using System; +using System.Collections.Generic; +using System.Linq; namespace osu.Game.Screens.Select { @@ -227,7 +227,7 @@ namespace osu.Game.Screens.Select BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.fa_trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue); BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1); - BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, null, Key.Number2); + BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapSetInfo), Key.Number2); } if (this.beatmaps == null) @@ -625,6 +625,15 @@ namespace osu.Game.Screens.Select dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap)); } + private void clearScores(BeatmapSetInfo beatmap) + { + if (beatmap == null || beatmap.ID <= 0) return; + + if (BeatmapDetails.Leaderboard.Scores == null || !BeatmapDetails.Leaderboard.Scores.Any()) return; + + dialogOverlay?.Push(new ClearScoresDialog(beatmap, BeatmapDetails.Leaderboard.Scores, () => BeatmapDetails.Leaderboard.RefreshScores())); + } + public override bool OnPressed(GlobalAction action) { if (!IsCurrentScreen) return false; From 3879348ee4d4384680371a7b33976dab81462e76 Mon Sep 17 00:00:00 2001 From: Matthias Coenraerds Date: Fri, 4 Jan 2019 20:13:32 +0100 Subject: [PATCH 005/327] Implement clear scores on beatmap --- osu.Game/Scoring/ScoreManager.cs | 4 +- osu.Game/Screens/Select/ClearScoreDialog.cs | 49 +++++++++++++++++++ .../Select/Leaderboards/BeatmapLeaderboard.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 23 ++++++--- 4 files changed, 67 insertions(+), 11 deletions(-) create mode 100644 osu.Game/Screens/Select/ClearScoreDialog.cs diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index 663f441f2f..fc50178ba8 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -55,9 +55,7 @@ namespace osu.Game.Scoring public Score GetScore(ScoreInfo score) => new LegacyDatabasedScore(score, rulesets, beatmaps, Files.Store); - public List GetAllUsableScores() => ModelStore.ConsumableItems.Where(s => !s.DeletePending).ToList(); - - public IEnumerable QueryScores(Expression> query) => ModelStore.ConsumableItems.AsNoTracking().Where(query); + public IEnumerable GetAllUsableScores() => ModelStore.ConsumableItems.Where(s => !s.DeletePending); public ScoreInfo Query(Expression> query) => ModelStore.ConsumableItems.AsNoTracking().FirstOrDefault(query); } diff --git a/osu.Game/Screens/Select/ClearScoreDialog.cs b/osu.Game/Screens/Select/ClearScoreDialog.cs new file mode 100644 index 0000000000..4051d76e99 --- /dev/null +++ b/osu.Game/Screens/Select/ClearScoreDialog.cs @@ -0,0 +1,49 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Allocation; +using osu.Game.Beatmaps; +using osu.Game.Graphics; +using osu.Game.Overlays.Dialog; +using osu.Game.Scoring; +using System; +using System.Collections.Generic; +using System.Linq; + +namespace osu.Game.Screens.Select +{ + public class ClearScoresDialog : PopupDialog + { + private ScoreManager manager; + + [BackgroundDependencyLoader] + private void load(ScoreManager beatmapManager) + { + manager = beatmapManager; + } + + public ClearScoresDialog(BeatmapSetInfo beatmap, IEnumerable scores, Action refresh) + { + BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}"; + + Icon = FontAwesome.fa_eraser; + HeaderText = $@"Clearing {scores.Count()} local score(s). Are you sure?"; + Buttons = new PopupDialogButton[] + { + new PopupDialogOkButton + { + Text = @"Yes. Please.", + Action = () => + { + manager.Delete(scores.ToList()); + refresh(); + } + }, + new PopupDialogCancelButton + { + Text = @"No, I'm still attached.", + }, + }; + } + } +} diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index 9f8726c86a..8d91be9ca1 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Select.Leaderboards { if (Scope == BeatmapLeaderboardScope.Local) { - Scores = scoreManager.QueryScores(s => s.Beatmap.ID == Beatmap.ID).ToArray(); + Scores = scoreManager.GetAllUsableScores().Where(s => s.Beatmap.ID == Beatmap.ID).ToArray(); PlaceholderState = Scores.Any() ? PlaceholderState.Successful : PlaceholderState.NoScores; return null; } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index f65cc0e49d..e70ff42418 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -1,11 +1,6 @@ // Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE -using System; -using System.Collections.Generic; -using System.Linq; -using osuTK; -using osuTK.Input; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -13,8 +8,8 @@ using osu.Framework.Audio.Track; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Logging; using osu.Framework.Input.Events; +using osu.Framework.Logging; using osu.Framework.Screens; using osu.Framework.Threading; using osu.Game.Beatmaps; @@ -31,6 +26,11 @@ using osu.Game.Screens.Menu; using osu.Game.Screens.Play; using osu.Game.Screens.Select.Options; using osu.Game.Skinning; +using osuTK; +using osuTK.Input; +using System; +using System.Collections.Generic; +using System.Linq; namespace osu.Game.Screens.Select { @@ -227,7 +227,7 @@ namespace osu.Game.Screens.Select BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.fa_trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue); BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1); - BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, null, Key.Number2); + BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapSetInfo), Key.Number2); } if (this.beatmaps == null) @@ -625,6 +625,15 @@ namespace osu.Game.Screens.Select dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap)); } + private void clearScores(BeatmapSetInfo beatmap) + { + if (beatmap == null || beatmap.ID <= 0) return; + + if (BeatmapDetails.Leaderboard.Scores == null || !BeatmapDetails.Leaderboard.Scores.Any()) return; + + dialogOverlay?.Push(new ClearScoresDialog(beatmap, BeatmapDetails.Leaderboard.Scores, () => BeatmapDetails.Leaderboard.RefreshScores())); + } + public override bool OnPressed(GlobalAction action) { if (!IsCurrentScreen) return false; From 6d44672bfa35769d550863f63d2e537c7b94bc5f Mon Sep 17 00:00:00 2001 From: Matthias Coenraerds Date: Fri, 4 Jan 2019 20:32:52 +0100 Subject: [PATCH 006/327] Filename does not match contained type --- .../{ClearScoreDialog.cs => BeatmapClearScoresDialog.cs} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename osu.Game/Screens/Select/{ClearScoreDialog.cs => BeatmapClearScoresDialog.cs} (88%) diff --git a/osu.Game/Screens/Select/ClearScoreDialog.cs b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs similarity index 88% rename from osu.Game/Screens/Select/ClearScoreDialog.cs rename to osu.Game/Screens/Select/BeatmapClearScoresDialog.cs index 4051d76e99..e14fae56a5 100644 --- a/osu.Game/Screens/Select/ClearScoreDialog.cs +++ b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs @@ -12,7 +12,7 @@ using System.Linq; namespace osu.Game.Screens.Select { - public class ClearScoresDialog : PopupDialog + public class BeatmapClearScoresDialog : PopupDialog { private ScoreManager manager; @@ -22,7 +22,7 @@ namespace osu.Game.Screens.Select manager = beatmapManager; } - public ClearScoresDialog(BeatmapSetInfo beatmap, IEnumerable scores, Action refresh) + public BeatmapClearScoresDialog(BeatmapSetInfo beatmap, IEnumerable scores, Action refresh) { BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}"; From a93c26ccfd50d93fdc1cfcbd49f2562f6252ce7a Mon Sep 17 00:00:00 2001 From: Matthias Coenraerds Date: Fri, 4 Jan 2019 20:32:52 +0100 Subject: [PATCH 007/327] Filename does not match contained type --- .../{ClearScoreDialog.cs => BeatmapClearScoresDialog.cs} | 4 ++-- osu.Game/Screens/Select/SongSelect.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename osu.Game/Screens/Select/{ClearScoreDialog.cs => BeatmapClearScoresDialog.cs} (88%) diff --git a/osu.Game/Screens/Select/ClearScoreDialog.cs b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs similarity index 88% rename from osu.Game/Screens/Select/ClearScoreDialog.cs rename to osu.Game/Screens/Select/BeatmapClearScoresDialog.cs index 4051d76e99..e14fae56a5 100644 --- a/osu.Game/Screens/Select/ClearScoreDialog.cs +++ b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs @@ -12,7 +12,7 @@ using System.Linq; namespace osu.Game.Screens.Select { - public class ClearScoresDialog : PopupDialog + public class BeatmapClearScoresDialog : PopupDialog { private ScoreManager manager; @@ -22,7 +22,7 @@ namespace osu.Game.Screens.Select manager = beatmapManager; } - public ClearScoresDialog(BeatmapSetInfo beatmap, IEnumerable scores, Action refresh) + public BeatmapClearScoresDialog(BeatmapSetInfo beatmap, IEnumerable scores, Action refresh) { BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}"; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index e70ff42418..c194a191a6 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -631,7 +631,7 @@ namespace osu.Game.Screens.Select if (BeatmapDetails.Leaderboard.Scores == null || !BeatmapDetails.Leaderboard.Scores.Any()) return; - dialogOverlay?.Push(new ClearScoresDialog(beatmap, BeatmapDetails.Leaderboard.Scores, () => BeatmapDetails.Leaderboard.RefreshScores())); + dialogOverlay?.Push(new BeatmapClearScoresDialog(beatmap, BeatmapDetails.Leaderboard.Scores, () => BeatmapDetails.Leaderboard.RefreshScores())); } public override bool OnPressed(GlobalAction action) From 472325b885b4ba54e2b9c4a7383c0d2997298d51 Mon Sep 17 00:00:00 2001 From: Matthias Coenraerds Date: Sun, 6 Jan 2019 13:37:30 +0100 Subject: [PATCH 008/327] Verify leaderboard scope to be local --- osu.Game/Screens/Select/SongSelect.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index c194a191a6..d651243a51 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -24,6 +24,7 @@ using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Edit; using osu.Game.Screens.Menu; using osu.Game.Screens.Play; +using osu.Game.Screens.Select.Leaderboards; using osu.Game.Screens.Select.Options; using osu.Game.Skinning; using osuTK; @@ -627,6 +628,8 @@ namespace osu.Game.Screens.Select private void clearScores(BeatmapSetInfo beatmap) { + if (BeatmapDetails.Leaderboard.Scope != BeatmapLeaderboardScope.Local) return; + if (beatmap == null || beatmap.ID <= 0) return; if (BeatmapDetails.Leaderboard.Scores == null || !BeatmapDetails.Leaderboard.Scores.Any()) return; From 562c9e56fbda6c85dc2ab98402296ec461232eeb Mon Sep 17 00:00:00 2001 From: Matthias Coenraerds Date: Sun, 6 Jan 2019 13:38:43 +0100 Subject: [PATCH 009/327] Fix naming --- osu.Game/Screens/Select/BeatmapClearScoresDialog.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs index e14fae56a5..45a192d2ad 100644 --- a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs +++ b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs @@ -17,9 +17,9 @@ namespace osu.Game.Screens.Select private ScoreManager manager; [BackgroundDependencyLoader] - private void load(ScoreManager beatmapManager) + private void load(ScoreManager scoreManager) { - manager = beatmapManager; + manager = scoreManager; } public BeatmapClearScoresDialog(BeatmapSetInfo beatmap, IEnumerable scores, Action refresh) From 097062caf78bd7985fa4d1af9b675743191a6671 Mon Sep 17 00:00:00 2001 From: Microgolf Date: Tue, 8 Jan 2019 17:57:03 +0100 Subject: [PATCH 010/327] Addresses requested changes --- osu.Game/Scoring/ScoreManager.cs | 4 +++- osu.Game/Screens/Select/BeatmapClearScoresDialog.cs | 7 +++---- osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 6 +++--- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/osu.Game/Scoring/ScoreManager.cs b/osu.Game/Scoring/ScoreManager.cs index fc50178ba8..663f441f2f 100644 --- a/osu.Game/Scoring/ScoreManager.cs +++ b/osu.Game/Scoring/ScoreManager.cs @@ -55,7 +55,9 @@ namespace osu.Game.Scoring public Score GetScore(ScoreInfo score) => new LegacyDatabasedScore(score, rulesets, beatmaps, Files.Store); - public IEnumerable GetAllUsableScores() => ModelStore.ConsumableItems.Where(s => !s.DeletePending); + public List GetAllUsableScores() => ModelStore.ConsumableItems.Where(s => !s.DeletePending).ToList(); + + public IEnumerable QueryScores(Expression> query) => ModelStore.ConsumableItems.AsNoTracking().Where(query); public ScoreInfo Query(Expression> query) => ModelStore.ConsumableItems.AsNoTracking().FirstOrDefault(query); } diff --git a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs index 45a192d2ad..c99e9eb428 100644 --- a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs +++ b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs @@ -22,12 +22,11 @@ namespace osu.Game.Screens.Select manager = scoreManager; } - public BeatmapClearScoresDialog(BeatmapSetInfo beatmap, IEnumerable scores, Action refresh) + public BeatmapClearScoresDialog(BeatmapInfo beatmap, Action refresh) { BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}"; - Icon = FontAwesome.fa_eraser; - HeaderText = $@"Clearing {scores.Count()} local score(s). Are you sure?"; + HeaderText = $@"Clearing all local scores. Are you sure?"; Buttons = new PopupDialogButton[] { new PopupDialogOkButton @@ -35,7 +34,7 @@ namespace osu.Game.Screens.Select Text = @"Yes. Please.", Action = () => { - manager.Delete(scores.ToList()); + manager.Delete(manager.QueryScores(s => !s.DeletePending && s.Beatmap.ID == beatmap.ID).ToList()); refresh(); } }, diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index 8d91be9ca1..0ecf36fddd 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Select.Leaderboards { if (Scope == BeatmapLeaderboardScope.Local) { - Scores = scoreManager.GetAllUsableScores().Where(s => s.Beatmap.ID == Beatmap.ID).ToArray(); + Scores = scoreManager.QueryScores(s => !s.DeletePending && s.Beatmap.ID == Beatmap.ID).ToArray(); PlaceholderState = Scores.Any() ? PlaceholderState.Successful : PlaceholderState.NoScores; return null; } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index d651243a51..9d8e58a496 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -228,7 +228,7 @@ namespace osu.Game.Screens.Select BeatmapOptions.AddButton(@"Delete", @"all difficulties", FontAwesome.fa_trash, colours.Pink, () => delete(Beatmap.Value.BeatmapSetInfo), Key.Number4, float.MaxValue); BeatmapOptions.AddButton(@"Remove", @"from unplayed", FontAwesome.fa_times_circle_o, colours.Purple, null, Key.Number1); - BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapSetInfo), Key.Number2); + BeatmapOptions.AddButton(@"Clear", @"local scores", FontAwesome.fa_eraser, colours.Purple, () => clearScores(Beatmap.Value.BeatmapInfo), Key.Number2); } if (this.beatmaps == null) @@ -626,7 +626,7 @@ namespace osu.Game.Screens.Select dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap)); } - private void clearScores(BeatmapSetInfo beatmap) + private void clearScores(BeatmapInfo beatmap) { if (BeatmapDetails.Leaderboard.Scope != BeatmapLeaderboardScope.Local) return; @@ -634,7 +634,7 @@ namespace osu.Game.Screens.Select if (BeatmapDetails.Leaderboard.Scores == null || !BeatmapDetails.Leaderboard.Scores.Any()) return; - dialogOverlay?.Push(new BeatmapClearScoresDialog(beatmap, BeatmapDetails.Leaderboard.Scores, () => BeatmapDetails.Leaderboard.RefreshScores())); + dialogOverlay?.Push(new BeatmapClearScoresDialog(beatmap, () => BeatmapDetails.Leaderboard.RefreshScores())); } public override bool OnPressed(GlobalAction action) From 8955d5de044e4ed5039608fff87b2aa08b5bb25e Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 29 Jan 2019 15:25:27 +0900 Subject: [PATCH 011/327] Update hit object result when lifetime is end --- .../Rulesets/Objects/Drawables/DrawableHitObject.cs | 10 ++++++++++ osu.Game/Rulesets/UI/HitObjectContainer.cs | 6 ++++++ 2 files changed, 16 insertions(+) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 06fe22a95e..62c43a0851 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -220,6 +220,16 @@ namespace osu.Game.Rulesets.Objects.Drawables OnNewResult?.Invoke(this, Result); } + /// + /// Should be called at least once after lifetime of this hit object is end. + /// + public void OnLifetimeEnd() + { + foreach (var nested in NestedHitObjects) + nested.OnLifetimeEnd(); + UpdateResult(false); + } + /// /// Processes this , checking if a scoring result has occurred. /// diff --git a/osu.Game/Rulesets/UI/HitObjectContainer.cs b/osu.Game/Rulesets/UI/HitObjectContainer.cs index 00632b3d3e..2f3a384e95 100644 --- a/osu.Game/Rulesets/UI/HitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/HitObjectContainer.cs @@ -31,5 +31,11 @@ namespace osu.Game.Rulesets.UI int i = yObj.HitObject.StartTime.CompareTo(xObj.HitObject.StartTime); return i == 0 ? CompareReverseChildID(x, y) : i; } + + protected override void OnChildLifetimeBoundaryCrossed(LifetimeBoundaryCrossedEvent e) + { + if (e.Kind == LifetimeBoundaryKind.End && e.Direction == LifetimeBoundaryCrossingDirection.Forward && e.Child is DrawableHitObject hitObject) + hitObject.OnLifetimeEnd(); + } } } From 902be0d059ca8fb4033e674bacafebe5dea2b7fb Mon Sep 17 00:00:00 2001 From: LeNitrous Date: Thu, 31 Jan 2019 17:03:43 +0800 Subject: [PATCH 012/327] add grow mod --- osu-resources | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs | 53 ++++++++++++++++++++++++ osu.Game.Rulesets.Osu/OsuRuleset.cs | 1 + 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs diff --git a/osu-resources b/osu-resources index 677897728f..9880089b4e 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 677897728f4332fa1200e0280ca02c4b987c6c47 +Subproject commit 9880089b4e8fcd78d68f30c8a40d43bf8dccca86 diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs new file mode 100644 index 0000000000..5ab1ea698b --- /dev/null +++ b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs @@ -0,0 +1,53 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using osu.Framework.Graphics; +using osu.Game.Graphics; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osuTK; + +namespace osu.Game.Rulesets.Osu.Mods +{ + internal class OsuModGrow : Mod, IApplicableToDrawableHitObjects + { + public override string Name => "Grow"; + public override string Acronym => "GR"; + public override FontAwesome Icon => FontAwesome.fa_arrows_v; + public override ModType Type => ModType.Fun; + public override string Description => "Hit them at the right size!"; + public override double ScoreMultiplier => 1; + + public void ApplyToDrawableHitObjects(IEnumerable drawables) + { + foreach (var drawable in drawables) + { + if (drawable is DrawableSpinner spinner) + return; + + drawable.ApplyCustomUpdateState += applyCustomState; + } + } + + protected virtual void applyCustomState(DrawableHitObject drawable, ArmedState state) + { + var hitObject = (OsuHitObject) drawable.HitObject; + + double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; + double scaleDuration = hitObject.TimePreempt + 1; + + var originalScale = drawable.Scale; + drawable.Scale /= 2; + + using (drawable.BeginAbsoluteSequence(appearTime, true)) + drawable.ScaleTo(originalScale, scaleDuration, Easing.OutSine); + + if (drawable is DrawableHitCircle circle) + using (circle.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt)) + circle.ApproachCircle.Hide(); + } + } +} \ No newline at end of file diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 12d0a28a8f..200f4af3da 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -124,6 +124,7 @@ namespace osu.Game.Rulesets.Osu return new Mod[] { new OsuModTransform(), new OsuModWiggle(), + new OsuModGrow() }; default: return new Mod[] { }; From a8d30f6aee41f38fcbdd35df05e3a010675e9f5b Mon Sep 17 00:00:00 2001 From: LeNitrous Date: Thu, 31 Jan 2019 17:05:50 +0800 Subject: [PATCH 013/327] remove unused using --- osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs index 5ab1ea698b..b64cfa3ef2 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs @@ -8,7 +8,6 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; -using osuTK; namespace osu.Game.Rulesets.Osu.Mods { From 7e2f4af00dd2d47212f1208857bccc936b057e0d Mon Sep 17 00:00:00 2001 From: LeNitrous Date: Thu, 31 Jan 2019 17:58:09 +0800 Subject: [PATCH 014/327] remove whitespaces --- osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs index b64cfa3ef2..8235a2d6a9 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs @@ -26,13 +26,12 @@ namespace osu.Game.Rulesets.Osu.Mods { if (drawable is DrawableSpinner spinner) return; - drawable.ApplyCustomUpdateState += applyCustomState; } } protected virtual void applyCustomState(DrawableHitObject drawable, ArmedState state) - { + { var hitObject = (OsuHitObject) drawable.HitObject; double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; From 30292f44da289b8112ea757e87acfbd0bfee460a Mon Sep 17 00:00:00 2001 From: HoLLy Date: Thu, 31 Jan 2019 17:57:59 +0100 Subject: [PATCH 015/327] Fix Catch diffcalc being off --- .../Difficulty/CatchDifficultyCalculator.cs | 2 ++ osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index a0b813478d..a54e8a06db 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -41,6 +41,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty var catcher = new CatcherArea.Catcher(beatmap.BeatmapInfo.BaseDifficulty); float halfCatchWidth = catcher.CatchWidth * 0.5f; + halfCatchWidth *= 0.8f; + var difficultyHitObjects = new List(); foreach (var hitObject in beatmap.HitObjects) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index d79f106310..7de06223d3 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Catch.UI { public class CatcherArea : Container { - public const float CATCHER_SIZE = 100; + public const float CATCHER_SIZE = 106.75f; protected internal readonly Catcher MovableCatcher; @@ -447,6 +447,7 @@ namespace osu.Game.Rulesets.Catch.UI Size = new Vector2(CATCHER_SIZE); // Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling. + // OriginPosition = new Vector2(-0.02f, 0.06f) * CATCHER_SIZE; OriginPosition = new Vector2(-0.02f, 0.06f) * CATCHER_SIZE; } From be6b5419c4aec827ea5aa9023ae8e1a8acab6eeb Mon Sep 17 00:00:00 2001 From: HoLLy Date: Thu, 31 Jan 2019 18:10:44 +0100 Subject: [PATCH 016/327] Remove uncommented line Didn't mean to push this --- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 7de06223d3..438bfaef55 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -447,7 +447,6 @@ namespace osu.Game.Rulesets.Catch.UI Size = new Vector2(CATCHER_SIZE); // Sets the origin roughly to the centre of the catcher's plate to allow for correct scaling. - // OriginPosition = new Vector2(-0.02f, 0.06f) * CATCHER_SIZE; OriginPosition = new Vector2(-0.02f, 0.06f) * CATCHER_SIZE; } From f6318d36706e0ea69a7d97b106bdc7246ba7c3d3 Mon Sep 17 00:00:00 2001 From: HoLLy Date: Fri, 1 Feb 2019 13:06:36 +0100 Subject: [PATCH 017/327] Add comment explaining *= 0.8f --- osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index a54e8a06db..265fbbd55c 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -41,6 +41,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty var catcher = new CatcherArea.Catcher(beatmap.BeatmapInfo.BaseDifficulty); float halfCatchWidth = catcher.CatchWidth * 0.5f; + // We're only using 80% of the catcher's width to simulate imperfect gameplay. halfCatchWidth *= 0.8f; var difficultyHitObjects = new List(); From d3721707fb7bebb3c9d1c0b0f8ab9dc5e2a4645b Mon Sep 17 00:00:00 2001 From: Roman Kapustin Date: Fri, 8 Feb 2019 19:48:56 +0300 Subject: [PATCH 018/327] Update framework --- osu.Game/osu.Game.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 596190fcf7..e87b43ac93 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -16,7 +16,7 @@ - + From cfe14dcdb1bfc381c334f3233a90bfdbec0bd5e7 Mon Sep 17 00:00:00 2001 From: Michael Manis Date: Sun, 10 Feb 2019 18:31:39 -0500 Subject: [PATCH 019/327] Options for handing unknown beatmap source --- osu.Game/Screens/Select/BeatmapDetails.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 8877775bba..61c8635a39 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -181,9 +181,12 @@ namespace osu.Game.Screens.Select ratingsContainer.FadeIn(transition_duration); advanced.Beatmap = Beatmap; description.Text = Beatmap.Version; + //source.Text = string.IsNullOrEmpty(Beatmap.Metadata.Source) ? "Unknown source" : Beatmap.Metadata.Source; source.Text = Beatmap.Metadata.Source; tags.Text = Beatmap.Metadata.Tags; + tags.Margin = new MarginPadding { Top = string.IsNullOrEmpty(Beatmap.Metadata.Source) ? -2 * spacing : 0 }; + var requestedBeatmap = Beatmap; if (requestedBeatmap.Metrics == null) { @@ -331,6 +334,11 @@ namespace osu.Game.Screens.Select }; } + public MarginPadding Margin + { + set => textContainer.Margin = value; + } + public string Text { set @@ -340,7 +348,6 @@ namespace osu.Game.Screens.Select textContainer.FadeOut(transition_duration); return; } - setTextAsync(value); } } From 5fbdbcf2090564ee9645f49c9073346918a2286e Mon Sep 17 00:00:00 2001 From: Michael Manis Date: Tue, 12 Feb 2019 15:30:42 -0500 Subject: [PATCH 020/327] removed 'unknown source' line --- osu.Game/Screens/Select/BeatmapDetails.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 61c8635a39..161208f9ab 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -181,7 +181,6 @@ namespace osu.Game.Screens.Select ratingsContainer.FadeIn(transition_duration); advanced.Beatmap = Beatmap; description.Text = Beatmap.Version; - //source.Text = string.IsNullOrEmpty(Beatmap.Metadata.Source) ? "Unknown source" : Beatmap.Metadata.Source; source.Text = Beatmap.Metadata.Source; tags.Text = Beatmap.Metadata.Tags; From f50a0be29d63f5c5b049ab54c9583d4d1ed00ecc Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 14 Feb 2019 16:22:14 +0900 Subject: [PATCH 021/327] Add osu! difficulty calculator test --- .../OsuDifficultyCalculatorTest.cs | 32 ++++ .../Testing/Beatmaps/diffcalc-test.osu | 167 ++++++++++++++++++ .../Beatmaps/DifficultyCalculatorTest.cs | 44 +++++ 3 files changed, 243 insertions(+) create mode 100644 osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs create mode 100644 osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/diffcalc-test.osu create mode 100644 osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs diff --git a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs new file mode 100644 index 0000000000..b8b5e3bb36 --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs @@ -0,0 +1,32 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Diagnostics; +using NUnit.Framework; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Difficulty; +using osu.Game.Rulesets.Osu.Difficulty; +using osu.Game.Tests.Beatmaps; + +namespace osu.Game.Rulesets.Osu.Tests +{ + [TestFixture] + public class OsuDifficultyCalculatorTest : DifficultyCalculatorTest + { + protected override string ResourceAssembly => "osu.Game.Rulesets.Osu"; + + [Test] + public new void Test() + { + base.Test(6.9311449688341344, "diffcalc-test"); + } + + private void openUsingShellExecute(string path) => Process.Start(new ProcessStartInfo + { + FileName = path, + UseShellExecute = true //see https://github.com/dotnet/corefx/issues/10361 + }); + + protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset(), beatmap); + } +} diff --git a/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/diffcalc-test.osu b/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/diffcalc-test.osu new file mode 100644 index 0000000000..4b42cd4ffd --- /dev/null +++ b/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/diffcalc-test.osu @@ -0,0 +1,167 @@ +osu file format v14 + +[General] +StackLeniency: 0.3 +Mode: 0 + +[Difficulty] +CircleSize:4 +OverallDifficulty:7 +ApproachRate:8.3 +SliderMultiplier:1.6 +SliderTickRate:1 + +[TimingPoints] +500,500,4,2,1,50,1,0 +62500,-500,4,2,1,50,0,0 +71000,-100,4,2,1,50,0,0 + +[HitObjects] +// Circles spaced 1 beat apart, with increasing jump distance +126,112,500,5,0,0:0:0:0: +130,155,1000,1,0,0:0:0:0: +131,269,1500,1,0,0:0:0:0: +341,269,2000,1,0,0:0:0:0: +113,95,2500,1,0,0:0:0:0: + +// Circles spaced 1/2 beat apart, with increasing jump distance +108,104,3500,5,0,0:0:0:0: +110,145,3750,1,0,0:0:0:0: +115,262,4000,1,0,0:0:0:0: +285,265,4250,1,0,0:0:0:0: +458,48,4500,1,0,0:0:0:0: +35,199,4750,1,0,0:0:0:0: +251,340,5000,1,0,0:0:0:0: +20,352,5250,1,0,0:0:0:0: +426,62,5500,1,0,0:0:0:0: + +// Circles spaced 1/4 beat apart, with increasing jump distances +211,138,6500,5,0,0:0:0:0: +99,256,6625,1,0,0:0:0:0: +68,129,6750,1,0,0:0:0:0: +371,340,6875,1,0,0:0:0:0: +241,219,7000,1,0,0:0:0:0: +252,148,7125,1,0,0:0:0:0: +434,97,7250,1,0,0:0:0:0: +40,38,7375,1,0,0:0:0:0: +114,334,7500,1,0,0:0:0:0: +301,19,7625,1,0,0:0:0:0: +441,241,7750,1,0,0:0:0:0: +121,91,7875,1,0,0:0:0:0: +270,384,8000,1,0,0:0:0:0: +488,92,8125,1,0,0:0:0:0: +332,82,8250,1,0,0:0:0:0: +108,240,8375,1,0,0:0:0:0: +281,268,8500,1,0,0:0:0:0: + +// Constant spaced circles spaced 1/2 beat apart, small jump distances, changing angles +252,191,9500,5,0,0:0:0:0: +356,191,9750,1,0,0:0:0:0: +311,268,10000,1,0,0:0:0:0: +190,270,10250,1,0,0:0:0:0: +107,199,10500,1,0,0:0:0:0: +172,105,10750,1,0,0:0:0:0: +297,102,11000,1,0,0:0:0:0: +373,178,11250,1,0,0:0:0:0: +252,195,11500,1,0,0:0:0:0: + +// Constant spaced circles spaced 1/2 beat apart, large jump distances, changing angles +140,187,12500,5,0,0:0:0:0: +451,331,12750,1,0,0:0:0:0: +46,338,13000,1,0,0:0:0:0: +204,50,13250,1,0,0:0:0:0: +464,162,13500,1,0,0:0:0:0: +252,346,13750,1,0,0:0:0:0: +13,175,14000,1,0,0:0:0:0: +488,181,14250,1,0,0:0:0:0: +251,187,14500,1,0,0:0:0:0: + +// Constant spaced circles spaced 1/4 beat apart, small jump distances, changing angles +188,192,15500,5,0,0:0:0:0: +298,194,15625,1,0,0:0:0:0: +317,84,15750,1,0,0:0:0:0: +185,85,15875,1,0,0:0:0:0: +77,200,16000,1,0,0:0:0:0: +184,303,16125,1,0,0:0:0:0: +295,225,16250,1,0,0:0:0:0: +300,84,16375,1,0,0:0:0:0: +144,82,16500,1,0,0:0:0:0: +141,215,16625,1,0,0:0:0:0: +314,184,16750,1,0,0:0:0:0: +188,192,16875,1,0,0:0:0:0: +188,192,17000,1,0,0:0:0:0: + +// Constant spaced circles spaced 1/4 beat apart, large jump distances, changing angles +97,192,18000,5,0,0:0:0:0: +336,38,18125,1,0,0:0:0:0: +440,322,18250,1,0,0:0:0:0: +39,331,18375,1,0,0:0:0:0: +98,39,18500,1,0,0:0:0:0: +460,179,18625,1,0,0:0:0:0: +245,338,18750,1,0,0:0:0:0: +12,184,18875,1,0,0:0:0:0: +250,41,19000,1,0,0:0:0:0: +265,193,19125,1,0,0:0:0:0: +486,22,19250,1,0,0:0:0:0: +411,205,19375,1,0,0:0:0:0: +107,198,19500,1,0,0:0:0:0: + +// Short sliders spaced 1 beat apart +28,108,20500,2,0,L|196:107,1,160 +25,177,21500,2,0,L|193:176,1,160 +26,308,22500,2,0,L|194:307,1,160 +320,89,23500,2,0,L|488:88,1,160 + +// Short sliders spaced 1/2 beat apart +28,108,25000,6,0,L|196:107,1,160 +27,173,25750,2,0,L|195:172,1,160 +25,292,26500,2,0,L|193:291,1,160 +340,213,27250,2,0,L|508:212,1,160 +21,44,28000,2,0,L|189:43,1,160 + +// Short sliders spaced 1/4 beat apart +28,108,29500,6,0,L|196:107,1,160 +30,169,30125,2,0,L|198:168,1,160 +35,282,30750,2,0,L|203:281,1,160 +327,286,31375,2,0,L|495:285,1,160 +51,61,32000,2,0,L|219:60,1,160 + +// Large, medium-paced slider shapes +// PerfectCurve +66,86,33500,6,0,P|246:348|427:44,1,800 +66,86,36500,2,0,P|246:348|427:44,1,800 +66,86,39500,2,0,P|246:348|427:44,1,800 +// Linear +66,72,42500,2,0,B|419:65|419:65|66:316|66:316|426:318,1,1120 +66,72,46500,2,0,B|419:65|419:65|66:316|66:316|426:318,1,1120 +66,72,50500,2,0,B|419:65|419:65|66:316|66:316|426:318,1,1120 +// Bezier +76,287,54500,2,0,B|440:325|138:128|470:302|500:30|130:85|66:82,1,640 +76,287,57000,2,0,B|440:325|138:128|470:302|500:30|130:85|66:82,1,640 +76,287,59500,2,0,B|440:325|138:128|470:302|500:30|130:85|66:82,1,640 + +// Large slow slider with many ticks +81,170,62500,6,0,P|263:78|168:268,1,480 + +// Fast slider with many repeats +102,152,71000,6,0,L|175:153,18,64 + +// Slider-circle combos, spaced 1/2 beat apart +106,204,75500,6,0,P|275:33|171:304,1,800 +255,179,78250,1,0,0:0:0:0: +106,204,78500,2,0,P|275:33|171:304,1,800 +255,179,81250,1,0,0:0:0:0: +106,204,81500,2,0,P|275:33|171:304,1,800 + +// Circle-spinner combos, spaced 1/2 beat apart +82,69,85000,5,0,0:0:0:0: +256,192,85250,8,0,86000,0:0:0:0: +83,69,86250,5,0,0:0:0:0: +256,192,86500,12,0,87000,0:0:0:0: + +// Spinner-spinner combos, spaced 1/2 beat apart +256,192,88000,12,0,89000,0:0:0:0: +256,192,89250,12,0,90250,0:0:0:0: +256,192,90500,12,0,91500,0:0:0:0: +256,192,91750,12,0,92750,0:0:0:0: +256,192,93000,12,0,94000,0:0:0:0: diff --git a/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs b/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs new file mode 100644 index 0000000000..c6a7ff7cf4 --- /dev/null +++ b/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs @@ -0,0 +1,44 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.IO; +using System.Reflection; +using NUnit.Framework; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.Formats; +using osu.Game.Rulesets.Difficulty; +using osu.Game.Rulesets.Mods; + +namespace osu.Game.Tests.Beatmaps +{ + [TestFixture] + public abstract class DifficultyCalculatorTest + { + private const string resource_namespace = "Testing.Beatmaps"; + + protected abstract string ResourceAssembly { get; } + + protected void Test(double expected, string name, params Mod[] mods) + => Assert.AreEqual(expected, CreateDifficultyCalculator(getBeatmap(name)).Calculate(mods).StarRating); + + private WorkingBeatmap getBeatmap(string name) + { + using (var resStream = openResource($"{resource_namespace}.{name}.osu")) + using (var stream = new StreamReader(resStream)) + { + var decoder = Decoder.GetDecoder(stream); + ((LegacyBeatmapDecoder)decoder).ApplyOffsets = false; + return new TestWorkingBeatmap(decoder.Decode(stream)); + } + } + + private Stream openResource(string name) + { + var localPath = Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path)); + return Assembly.LoadFrom(Path.Combine(localPath, $"{ResourceAssembly}.dll")).GetManifestResourceStream($@"{ResourceAssembly}.Resources.{name}"); + } + + protected abstract DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap); + } +} From 8ccde38824268fdfeb2a9cc5df9d46a480729e36 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Feb 2019 17:17:49 +0900 Subject: [PATCH 022/327] Remove github pull request template --- .github/pull_request_template.md | 8 -------- 1 file changed, 8 deletions(-) delete mode 100644 .github/pull_request_template.md diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md deleted file mode 100644 index 221e4746cb..0000000000 --- a/.github/pull_request_template.md +++ /dev/null @@ -1,8 +0,0 @@ -Add any details pertaining to developers above the break. - -- [ ] Depends on #PR -- Closes #ISSUE - ---- - -Add a sentence or two describing this change in plain english. This will be displayed on the [changelog](https://osu.ppy.sh/home/changelog). A single screenshot or short gif is also welcomed. \ No newline at end of file From e2a312a663da3044544ca4d1a1d6fce21bab8938 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 14 Feb 2019 17:47:53 +0900 Subject: [PATCH 023/327] Move user dimming logic into its own container --- .idea/.idea.osu/.idea/.name | 1 + .../Backgrounds/BackgroundScreenBeatmap.cs | 19 +++++-- .../UserDimmableBackgroundScreenBeatmap.cs | 57 +++++++++++++++++++ osu.Game/Screens/Play/Player.cs | 1 + .../Play/ScreenWithBeatmapBackground.cs | 6 +- 5 files changed, 76 insertions(+), 8 deletions(-) create mode 100644 .idea/.idea.osu/.idea/.name create mode 100644 osu.Game/Screens/Backgrounds/UserDimmableBackgroundScreenBeatmap.cs diff --git a/.idea/.idea.osu/.idea/.name b/.idea/.idea.osu/.idea/.name new file mode 100644 index 0000000000..21cb4db60e --- /dev/null +++ b/.idea/.idea.osu/.idea/.name @@ -0,0 +1 @@ +osu \ No newline at end of file diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 8706cc6668..4fe0f0627e 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -2,18 +2,24 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Textures; +using osu.Framework.Screens; using osu.Game.Beatmaps; +using osu.Game.Configuration; +using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; +using osuTK; namespace osu.Game.Screens.Backgrounds { public class BackgroundScreenBeatmap : BlurrableBackgroundScreen { - private WorkingBeatmap beatmap; + protected WorkingBeatmap beatmap; - public WorkingBeatmap Beatmap + public virtual WorkingBeatmap Beatmap { get { return beatmap; } set @@ -37,13 +43,18 @@ namespace osu.Game.Screens.Backgrounds } b.Depth = newDepth; - AddInternal(Background = b); + AddBackground(Background = b); Background.BlurSigma = BlurTarget; })); }); } } + protected virtual void AddBackground(Drawable d) + { + AddInternal(d); + } + public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null) { Beatmap = beatmap; @@ -57,7 +68,7 @@ namespace osu.Game.Screens.Backgrounds return base.Equals(other) && beatmap == otherBeatmapBackground.Beatmap; } - private class BeatmapBackground : Background + protected class BeatmapBackground : Background { private readonly WorkingBeatmap beatmap; diff --git a/osu.Game/Screens/Backgrounds/UserDimmableBackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/UserDimmableBackgroundScreenBeatmap.cs new file mode 100644 index 0000000000..2902626702 --- /dev/null +++ b/osu.Game/Screens/Backgrounds/UserDimmableBackgroundScreenBeatmap.cs @@ -0,0 +1,57 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Screens; +using osu.Game.Beatmaps; +using osu.Game.Configuration; +using osu.Game.Graphics; +using osuTK; + +namespace osu.Game.Screens.Backgrounds +{ + public class UserDimmableBackgroundScreenBeatmap : BackgroundScreenBeatmap + { + protected Bindable DimLevel; + protected float BackgroundOpacity => 1 - (float)DimLevel; + private Container fadeContainer; + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + DimLevel = config.GetBindable(OsuSetting.DimLevel); + fadeContainer = new Container { RelativeSizeAxes = Axes.Both}; + } + + protected override void AddBackground(Drawable d) + { + fadeContainer.Child = d; + InternalChild = fadeContainer; + } + + public override void OnEntering(IScreen last) + { + base.OnEntering(last); + DimLevel.ValueChanged += _ => updateBackgroundDim(); + updateBackgroundDim(); + } + public override void OnResuming(IScreen last) + { + base.OnResuming(last); + updateBackgroundDim(); + } + + public UserDimmableBackgroundScreenBeatmap(WorkingBeatmap beatmap = null) + :base(beatmap) + { + } + + private void updateBackgroundDim() + { + fadeContainer?.FadeColour(OsuColour.Gray(BackgroundOpacity), 800, Easing.OutQuint); + } + } +} diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 71b7b77e5d..fa9b05cd73 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -29,6 +29,7 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Scoring; +using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Ranking; using osu.Game.Skinning; using osu.Game.Storyboards.Drawables; diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 93ec7347c8..698fd7d98b 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -14,9 +14,9 @@ namespace osu.Game.Screens.Play { public abstract class ScreenWithBeatmapBackground : OsuScreen { - protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value); + protected override BackgroundScreen CreateBackground() => new UserDimmableBackgroundScreenBeatmap(Beatmap.Value); - protected new BackgroundScreenBeatmap Background => base.Background as BackgroundScreenBeatmap; + protected new UserDimmableBackgroundScreenBeatmap Background => base.Background as UserDimmableBackgroundScreenBeatmap; public override bool AllowBeatmapRulesetChange => false; @@ -43,7 +43,6 @@ namespace osu.Game.Screens.Play public override void OnEntering(IScreen last) { base.OnEntering(last); - DimLevel.ValueChanged += _ => UpdateBackgroundElements(); BlurLevel.ValueChanged += _ => UpdateBackgroundElements(); ShowStoryboard.ValueChanged += _ => UpdateBackgroundElements(); InitializeBackgroundElements(); @@ -68,7 +67,6 @@ namespace osu.Game.Screens.Play { if (!this.IsCurrentScreen()) return; - Background?.FadeColour(OsuColour.Gray(BackgroundOpacity), BACKGROUND_FADE_DURATION, Easing.OutQuint); Background?.BlurTo(new Vector2((float)BlurLevel.Value * 25), BACKGROUND_FADE_DURATION, Easing.OutQuint); } } From 1b61ec4ef402aa863671c552fc7f12aad2280517 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Feb 2019 18:05:23 +0900 Subject: [PATCH 024/327] First pass clean-up --- osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs | 46 +++++++++++++++--------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs index 8235a2d6a9..c7e43dc006 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs @@ -14,38 +14,50 @@ namespace osu.Game.Rulesets.Osu.Mods internal class OsuModGrow : Mod, IApplicableToDrawableHitObjects { public override string Name => "Grow"; + public override string Acronym => "GR"; + public override FontAwesome Icon => FontAwesome.fa_arrows_v; + public override ModType Type => ModType.Fun; + public override string Description => "Hit them at the right size!"; + public override double ScoreMultiplier => 1; public void ApplyToDrawableHitObjects(IEnumerable drawables) { foreach (var drawable in drawables) { - if (drawable is DrawableSpinner spinner) - return; - drawable.ApplyCustomUpdateState += applyCustomState; + switch (drawable) + { + case DrawableSpinner _: + continue; + default: + drawable.ApplyCustomUpdateState += ApplyCustomState; + break; + } } } - protected virtual void applyCustomState(DrawableHitObject drawable, ArmedState state) + protected virtual void ApplyCustomState(DrawableHitObject drawable, ArmedState state) { - var hitObject = (OsuHitObject) drawable.HitObject; + var h = (OsuHitObject)drawable.HitObject; - double appearTime = hitObject.StartTime - hitObject.TimePreempt - 1; - double scaleDuration = hitObject.TimePreempt + 1; + var scale = drawable.Scale; + using (drawable.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true)) + drawable.ScaleTo(scale / 2).Then().ScaleTo(scale, h.TimePreempt, Easing.OutSine); - var originalScale = drawable.Scale; - drawable.Scale /= 2; - - using (drawable.BeginAbsoluteSequence(appearTime, true)) - drawable.ScaleTo(originalScale, scaleDuration, Easing.OutSine); - - if (drawable is DrawableHitCircle circle) - using (circle.BeginAbsoluteSequence(hitObject.StartTime - hitObject.TimePreempt)) - circle.ApproachCircle.Hide(); + switch (drawable) + { + case DrawableHitCircle circle: + { + // we don't want to see the approach circle + using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true)) + circle.ApproachCircle.Hide(); + break; + } + } } } -} \ No newline at end of file +} From a09e0790e1815b8ddd4ab38af20d319aa56b31ea Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 14 Feb 2019 18:07:28 +0900 Subject: [PATCH 025/327] Fix storyboards not dimming --- osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 698fd7d98b..703a68a1c1 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using FFmpeg.AutoGen; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; @@ -43,6 +44,7 @@ namespace osu.Game.Screens.Play public override void OnEntering(IScreen last) { base.OnEntering(last); + DimLevel.ValueChanged += _ => UpdateBackgroundElements(); BlurLevel.ValueChanged += _ => UpdateBackgroundElements(); ShowStoryboard.ValueChanged += _ => UpdateBackgroundElements(); InitializeBackgroundElements(); From 3a74ad678a1f3e53eb650d767687227fc2ad2f43 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 14 Feb 2019 18:41:10 +0900 Subject: [PATCH 026/327] clean up unused includes --- osu.Game/Screens/Play/Player.cs | 1 - osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs | 2 -- 2 files changed, 3 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index fa9b05cd73..71b7b77e5d 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -29,7 +29,6 @@ using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Scoring; using osu.Game.Rulesets.UI; using osu.Game.Scoring; -using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Ranking; using osu.Game.Skinning; using osu.Game.Storyboards.Drawables; diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 703a68a1c1..a1665a85c8 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -1,13 +1,11 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using FFmpeg.AutoGen; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Screens; using osu.Game.Configuration; -using osu.Game.Graphics; using osu.Game.Screens.Backgrounds; using osuTK; From 810175235d17adca7f44647dfa496b1993ff48bf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 14 Feb 2019 18:47:05 +0900 Subject: [PATCH 027/327] Fix incorrect application of scaling in some cases Isolates different usages of hitcircle scale so they can't ever cause regressions. --- osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs | 21 ++++-- .../Objects/Drawables/DrawableHitCircle.cs | 67 ++++++++++++------- 2 files changed, 59 insertions(+), 29 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs index c7e43dc006..65e9eb7a1d 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModGrow.cs @@ -44,19 +44,30 @@ namespace osu.Game.Rulesets.Osu.Mods { var h = (OsuHitObject)drawable.HitObject; - var scale = drawable.Scale; - using (drawable.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true)) - drawable.ScaleTo(scale / 2).Then().ScaleTo(scale, h.TimePreempt, Easing.OutSine); + // apply grow effect + switch (drawable) + { + case DrawableSliderHead _: + case DrawableSliderTail _: + // special cases we should *not* be scaling. + break; + case DrawableSlider _: + case DrawableHitCircle _: + { + using (drawable.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true)) + drawable.ScaleTo(0.5f).Then().ScaleTo(1, h.TimePreempt, Easing.OutSine); + break; + } + } + // remove approach circles switch (drawable) { case DrawableHitCircle circle: - { // we don't want to see the approach circle using (circle.BeginAbsoluteSequence(h.StartTime - h.TimePreempt, true)) circle.ApproachCircle.Hide(); break; - } } } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index df0769982d..7dd2fa69ce 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -5,6 +5,7 @@ using System; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using osuTK; @@ -27,40 +28,58 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private readonly IBindable stackHeightBindable = new Bindable(); private readonly IBindable scaleBindable = new Bindable(); + private readonly Container explodeContainer; + + private readonly Container scaleContainer; + public DrawableHitCircle(HitCircle h) : base(h) { Origin = Anchor.Centre; Position = HitObject.StackedPosition; - Scale = new Vector2(h.Scale); InternalChildren = new Drawable[] { - glow = new GlowPiece(), - circle = new CirclePiece + scaleContainer = new Container { - Hit = () => + RelativeSizeAxes = Axes.Both, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Child = explodeContainer = new Container { - if (AllJudged) - return false; + RelativeSizeAxes = Axes.Both, + Origin = Anchor.Centre, + Anchor = Anchor.Centre, + Children = new Drawable[] + { + glow = new GlowPiece(), + circle = new CirclePiece + { + Hit = () => + { + if (AllJudged) + return false; - UpdateResult(true); - return true; - }, + UpdateResult(true); + return true; + }, + }, + number = new NumberPiece + { + Text = (HitObject.IndexInCurrentCombo + 1).ToString(), + }, + ring = new RingPiece(), + flash = new FlashPiece(), + explode = new ExplodePiece(), + ApproachCircle = new ApproachCircle + { + Alpha = 0, + Scale = new Vector2(4), + } + } + } }, - number = new NumberPiece - { - Text = (HitObject.IndexInCurrentCombo + 1).ToString(), - }, - ring = new RingPiece(), - flash = new FlashPiece(), - explode = new ExplodePiece(), - ApproachCircle = new ApproachCircle - { - Alpha = 0, - Scale = new Vector2(4), - } }; //may not be so correct @@ -72,7 +91,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); stackHeightBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); - scaleBindable.BindValueChanged(v => Scale = new Vector2(v)); + scaleBindable.BindValueChanged(v => scaleContainer.Scale = new Vector2(v), true); positionBindable.BindTo(HitObject.PositionBindable); stackHeightBindable.BindTo(HitObject.StackHeightBindable); @@ -156,8 +175,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables circle.FadeOut(); number.FadeOut(); - this.FadeOut(800) - .ScaleTo(Scale * 1.5f, 400, Easing.OutQuad); + this.FadeOut(800); + explodeContainer.ScaleTo(1.5f, 400, Easing.OutQuad); } Expire(); From 1550908edbe5ea8e46ba2a7acca95060f14915cf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 15 Feb 2019 11:56:33 +0900 Subject: [PATCH 028/327] Add tooltip to key configuration button --- .../Graphics/UserInterface/TriangleButton.cs | 2 +- .../Sections/Input/KeyboardSettings.cs | 1 + osu.Game/Overlays/Settings/SettingsButton.cs | 18 +++++++++++++++++- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/TriangleButton.cs b/osu.Game/Graphics/UserInterface/TriangleButton.cs index 31fe29fc3a..2375017878 100644 --- a/osu.Game/Graphics/UserInterface/TriangleButton.cs +++ b/osu.Game/Graphics/UserInterface/TriangleButton.cs @@ -27,7 +27,7 @@ namespace osu.Game.Graphics.UserInterface }); } - public IEnumerable FilterTerms => new[] { Text }; + public virtual IEnumerable FilterTerms => new[] { Text }; public bool MatchingFilter { diff --git a/osu.Game/Overlays/Settings/Sections/Input/KeyboardSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/KeyboardSettings.cs index efe3d782ae..3f1e77d482 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/KeyboardSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/KeyboardSettings.cs @@ -16,6 +16,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input new SettingsButton { Text = "Key configuration", + TooltipText = "Change global shortcut keys and gameplay bindings", Action = keyConfig.ToggleVisibility }, }; diff --git a/osu.Game/Overlays/Settings/SettingsButton.cs b/osu.Game/Overlays/Settings/SettingsButton.cs index 73cf855e18..ef98c28285 100644 --- a/osu.Game/Overlays/Settings/SettingsButton.cs +++ b/osu.Game/Overlays/Settings/SettingsButton.cs @@ -1,17 +1,33 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Collections.Generic; +using System.Linq; using osu.Framework.Graphics; +using osu.Framework.Graphics.Cursor; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Settings { - public class SettingsButton : TriangleButton + public class SettingsButton : TriangleButton, IHasTooltip { public SettingsButton() { RelativeSizeAxes = Axes.X; Padding = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS }; } + + public string TooltipText { get; set; } + + public override IEnumerable FilterTerms + { + get + { + if (TooltipText != null) + return base.FilterTerms.Append(TooltipText); + + return base.FilterTerms; + } + } } } From 8becd7ff92dbc82b451100ea7862e58bcb7badb4 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Feb 2019 12:49:48 +0900 Subject: [PATCH 029/327] Add a slider-spinner test case --- .../OsuDifficultyCalculatorTest.cs | 2 +- .../Resources/Testing/Beatmaps/diffcalc-test.osu | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs index b8b5e3bb36..5f290886c2 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public new void Test() { - base.Test(6.9311449688341344, "diffcalc-test"); + base.Test(6.931145117263422d, "diffcalc-test"); } private void openUsingShellExecute(string path) => Process.Start(new ProcessStartInfo diff --git a/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/diffcalc-test.osu b/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/diffcalc-test.osu index 4b42cd4ffd..bf345811a2 100644 --- a/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/diffcalc-test.osu +++ b/osu.Game.Rulesets.Osu/Resources/Testing/Beatmaps/diffcalc-test.osu @@ -156,7 +156,7 @@ SliderTickRate:1 // Circle-spinner combos, spaced 1/2 beat apart 82,69,85000,5,0,0:0:0:0: 256,192,85250,8,0,86000,0:0:0:0: -83,69,86250,5,0,0:0:0:0: +384,189,86250,5,0,0:0:0:0: 256,192,86500,12,0,87000,0:0:0:0: // Spinner-spinner combos, spaced 1/2 beat apart @@ -165,3 +165,15 @@ SliderTickRate:1 256,192,90500,12,0,91500,0:0:0:0: 256,192,91750,12,0,92750,0:0:0:0: 256,192,93000,12,0,94000,0:0:0:0: + +// Slider-spinner combos, spaced 1/2 beat apart +49,89,95000,6,0,L|214:87,1,160 +256,192,95625,12,0,96500,0:0:0:0: +12,299,96625,6,0,L|177:297,1,160 +256,192,97250,12,0,98125,0:0:0:0: +295,107,98250,6,0,L|460:105,1,160 +256,192,98875,12,0,99750,0:0:0:0: +279,325,99875,6,0,L|444:323,1,160 +256,192,100500,12,0,101375,0:0:0:0: +197,197,101500,6,0,L|362:195,1,160 +256,192,102125,12,0,103000,0:0:0:0: From 280081d58938cd3294a59d63fc6645aed26eaad2 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Feb 2019 14:42:42 +0900 Subject: [PATCH 030/327] Fix beatmap ruleset not being set --- .../OsuDifficultyCalculatorTest.cs | 2 ++ osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs index 5f290886c2..7f6591ffcf 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs @@ -28,5 +28,7 @@ namespace osu.Game.Rulesets.Osu.Tests }); protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset(), beatmap); + + protected override Ruleset CreateRuleset() => new OsuRuleset(); } } diff --git a/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs b/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs index c6a7ff7cf4..108fa8ff71 100644 --- a/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs +++ b/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs @@ -7,6 +7,7 @@ using System.Reflection; using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Formats; +using osu.Game.Rulesets; using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Mods; @@ -29,7 +30,11 @@ namespace osu.Game.Tests.Beatmaps { var decoder = Decoder.GetDecoder(stream); ((LegacyBeatmapDecoder)decoder).ApplyOffsets = false; - return new TestWorkingBeatmap(decoder.Decode(stream)); + + var working = new TestWorkingBeatmap(decoder.Decode(stream)); + working.BeatmapInfo.Ruleset = CreateRuleset().RulesetInfo; + + return working; } } @@ -40,5 +45,7 @@ namespace osu.Game.Tests.Beatmaps } protected abstract DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap); + + protected abstract Ruleset CreateRuleset(); } } From c3138db390580eec48530eaf67aa1fa9e16c80a3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Feb 2019 14:42:52 +0900 Subject: [PATCH 031/327] Cleanup osu difficulty test --- .../OsuDifficultyCalculatorTest.cs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs index 7f6591ffcf..4926a81034 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Diagnostics; using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty; @@ -15,18 +14,12 @@ namespace osu.Game.Rulesets.Osu.Tests { protected override string ResourceAssembly => "osu.Game.Rulesets.Osu"; - [Test] - public new void Test() + [TestCase(6.931145117263422, "diffcalc-test")] + public void Test(double expected, string name) { - base.Test(6.931145117263422d, "diffcalc-test"); + base.Test(expected, name); } - private void openUsingShellExecute(string path) => Process.Start(new ProcessStartInfo - { - FileName = path, - UseShellExecute = true //see https://github.com/dotnet/corefx/issues/10361 - }); - protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset(), beatmap); protected override Ruleset CreateRuleset() => new OsuRuleset(); From aa0bb7ca1109e965ddd19f0bb3d59221a70d386f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Feb 2019 14:44:26 +0900 Subject: [PATCH 032/327] Add taiko difficulty calculator tests --- .../TaikoDifficultyCalculatorTest.cs | 27 ++ .../Testing/Beatmaps/diffcalc-test-strong.osu | 257 ++++++++++++++++ .../Testing/Beatmaps/diffcalc-test.osu | 285 ++++++++++++++++++ 3 files changed, 569 insertions(+) create mode 100644 osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs create mode 100644 osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/diffcalc-test-strong.osu create mode 100644 osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/diffcalc-test.osu diff --git a/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs new file mode 100644 index 0000000000..112834e84c --- /dev/null +++ b/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs @@ -0,0 +1,27 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Difficulty; +using osu.Game.Rulesets.Taiko.Difficulty; +using osu.Game.Tests.Beatmaps; + +namespace osu.Game.Rulesets.Taiko.Tests +{ + public class TaikoDifficultyCalculatorTest : DifficultyCalculatorTest + { + protected override string ResourceAssembly => "osu.Game.Rulesets.Taiko"; + + [TestCase(2.9811336589467095, "diffcalc-test")] + [TestCase(2.9811336589467095, "diffcalc-test-strong")] + public void Test(double expected, string name) + { + base.Test(expected, name); + } + + protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoDifficultyCalculator(new TaikoRuleset(), beatmap); + + protected override Ruleset CreateRuleset() => new TaikoRuleset(); + } +} diff --git a/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/diffcalc-test-strong.osu b/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/diffcalc-test-strong.osu new file mode 100644 index 0000000000..33510eceb7 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/diffcalc-test-strong.osu @@ -0,0 +1,257 @@ +osu file format v14 + +[General] +Mode: 1 + +[Difficulty] +CircleSize:4 +OverallDifficulty:7 +ApproachRate:8.3 +SliderMultiplier:1.6 +SliderTickRate:1 + +[TimingPoints] +500,500,4,2,1,50,1,0 +62500,-500,4,2,1,50,0,0 +71000,-100,4,2,1,50,0,0 + +[HitObjects] +// Same as diffcalc-test with finishers on every note +142,122,0,5,4,0:0:0:0: +142,122,125,1,4,0:0:0:0: +142,122,250,1,4,0:0:0:0: +142,122,375,1,4,0:0:0:0: +142,122,500,1,4,0:0:0:0: +142,122,625,1,4,0:0:0:0: +142,122,750,1,4,0:0:0:0: +142,122,875,1,4,0:0:0:0: +142,122,1000,1,4,0:0:0:0: +142,122,1125,1,4,0:0:0:0: +142,122,1250,1,4,0:0:0:0: +142,122,1375,1,4,0:0:0:0: +142,122,1500,1,4,0:0:0:0: +119,106,2500,1,6,0:0:0:0: +119,106,2625,1,6,0:0:0:0: +119,106,2750,1,6,0:0:0:0: +119,106,2875,1,6,0:0:0:0: +119,106,3000,1,6,0:0:0:0: +119,106,3125,1,6,0:0:0:0: +119,106,3250,1,6,0:0:0:0: +119,106,3375,1,6,0:0:0:0: +119,106,3500,1,6,0:0:0:0: +119,106,3625,1,6,0:0:0:0: +119,106,3750,1,6,0:0:0:0: +119,106,3875,1,6,0:0:0:0: +119,106,4000,1,6,0:0:0:0: +136,90,5000,1,4,0:0:0:0: +136,90,5125,1,6,0:0:0:0: +136,90,5250,1,4,0:0:0:0: +136,90,5375,1,6,0:0:0:0: +136,90,5500,1,4,0:0:0:0: +136,90,5625,1,6,0:0:0:0: +136,90,5750,1,4,0:0:0:0: +136,90,5875,1,6,0:0:0:0: +136,90,6000,1,4,0:0:0:0: +136,90,6125,1,6,0:0:0:0: +136,90,6250,1,4,0:0:0:0: +136,90,6375,1,6,0:0:0:0: +136,90,6500,1,4,0:0:0:0: +86,113,7500,1,4,0:0:0:0: +86,113,7625,1,4,0:0:0:0: +86,113,7750,1,6,0:0:0:0: +86,113,7875,1,6,0:0:0:0: +86,113,8000,1,4,0:0:0:0: +86,113,8125,1,4,0:0:0:0: +86,113,8250,1,6,0:0:0:0: +86,113,8375,1,6,0:0:0:0: +86,113,8500,1,4,0:0:0:0: +86,113,8625,1,4,0:0:0:0: +86,113,8750,1,6,0:0:0:0: +86,113,8875,1,6,0:0:0:0: +86,113,9000,1,4,0:0:0:0: +146,90,10000,1,4,0:0:0:0: +146,90,10125,1,4,0:0:0:0: +146,90,10250,1,4,0:0:0:0: +146,90,10375,1,6,0:0:0:0: +146,90,10500,1,6,0:0:0:0: +146,90,10625,1,6,0:0:0:0: +146,90,10750,1,4,0:0:0:0: +146,90,10875,1,4,0:0:0:0: +146,90,11000,1,4,0:0:0:0: +146,90,11125,1,6,0:0:0:0: +146,90,11250,1,6,0:0:0:0: +146,90,11375,1,6,0:0:0:0: +146,90,11500,1,4,0:0:0:0: +146,90,11625,1,4,0:0:0:0: +146,90,11750,1,4,0:0:0:0: +146,90,11875,1,6,0:0:0:0: +146,90,12000,1,6,0:0:0:0: +146,90,12125,1,6,0:0:0:0: +146,90,12250,1,4,0:0:0:0: +146,90,12375,1,4,0:0:0:0: +146,90,12500,1,4,0:0:0:0: +69,99,13500,1,4,0:0:0:0: +69,99,13625,1,4,0:0:0:0: +69,99,13750,1,4,0:0:0:0: +69,99,13875,1,6,0:0:0:0: +69,99,14000,1,4,0:0:0:0: +69,99,14125,1,4,0:0:0:0: +69,99,14250,1,4,0:0:0:0: +69,99,14375,1,6,0:0:0:0: +69,99,14500,1,4,0:0:0:0: +69,99,14625,1,4,0:0:0:0: +69,99,14750,1,4,0:0:0:0: +69,99,14875,1,6,0:0:0:0: +69,99,15000,1,4,0:0:0:0: +69,99,15125,1,4,0:0:0:0: +69,99,15250,1,4,0:0:0:0: +69,99,15375,1,6,0:0:0:0: +69,99,15500,1,4,0:0:0:0: +83,89,16500,1,4,0:0:0:0: +83,89,16625,1,6,0:0:0:0: +83,89,16750,1,6,0:0:0:0: +83,89,16875,1,4,0:0:0:0: +83,89,17000,1,4,0:0:0:0: +83,89,17125,1,4,0:0:0:0: +83,89,17250,1,6,0:0:0:0: +83,89,17375,1,6,0:0:0:0: +83,89,17500,1,6,0:0:0:0: +83,89,17625,1,6,0:0:0:0: +83,89,17750,1,4,0:0:0:0: +83,89,17875,1,4,0:0:0:0: +83,89,18000,1,4,0:0:0:0: +83,89,18125,1,4,0:0:0:0: +83,89,18250,1,4,0:0:0:0: +83,89,18375,1,6,0:0:0:0: +83,89,18500,1,6,0:0:0:0: +83,89,18625,1,6,0:0:0:0: +83,89,18750,1,6,0:0:0:0: +83,89,18875,1,4,0:0:0:0: +83,89,19000,1,4,0:0:0:0: +83,89,19125,1,4,0:0:0:0: +83,89,19250,1,4,0:0:0:0: +83,89,19375,1,6,0:0:0:0: +83,89,19500,1,6,0:0:0:0: +83,89,19625,1,4,0:0:0:0: +84,122,20500,1,4,0:0:0:0: +84,122,20625,2,4,L|217:123,1,120 +84,122,21125,1,4,0:0:0:0: +84,122,21250,2,4,L|217:123,1,120 +84,122,21750,1,4,0:0:0:0: +84,122,21875,2,4,L|217:123,1,120 +84,122,22375,1,4,0:0:0:0: +84,122,22500,2,4,L|217:123,1,120 +84,122,23000,1,4,0:0:0:0: +84,122,23125,2,4,L|217:123,1,120 +99,106,24500,1,4,0:0:0:0: +99,106,24625,1,4,0:0:0:0: +99,106,24750,2,4,L|194:107,1,80 +99,106,25125,1,4,0:0:0:0: +99,106,25250,1,4,0:0:0:0: +99,106,25375,2,4,L|194:107,1,80 +99,106,25750,1,4,0:0:0:0: +99,106,25875,1,4,0:0:0:0: +99,106,26000,2,4,L|194:107,1,80 +99,106,26375,1,4,0:0:0:0: +99,106,26500,1,4,0:0:0:0: +99,106,26625,2,4,L|194:107,1,80 +99,106,27000,1,4,0:0:0:0: +99,106,27125,1,4,0:0:0:0: +99,106,27250,2,4,L|194:107,1,80 +121,103,28500,1,4,0:0:0:0: +121,103,28625,1,4,0:0:0:0: +121,103,28750,1,4,0:0:0:0: +121,103,28875,2,4,L|190:103,1,40 +121,103,29125,1,4,0:0:0:0: +121,103,29250,1,4,0:0:0:0: +121,103,29375,1,4,0:0:0:0: +121,103,29500,2,4,L|190:103,1,40 +121,103,29750,1,4,0:0:0:0: +121,103,29875,1,4,0:0:0:0: +121,103,30000,1,4,0:0:0:0: +121,103,30125,2,4,L|190:103,1,40 +121,103,30375,1,4,0:0:0:0: +121,103,30500,1,4,0:0:0:0: +121,103,30625,1,4,0:0:0:0: +121,103,30750,2,4,L|190:103,1,40 +121,103,31000,1,4,0:0:0:0: +121,103,31125,1,4,0:0:0:0: +121,103,31250,1,4,0:0:0:0: +121,103,31375,2,4,L|190:103,1,40 +121,103,32500,1,4,0:0:0:0: +121,103,32625,1,6,0:0:0:0: +121,103,32750,1,4,0:0:0:0: +121,103,32875,2,4,L|190:103,1,40 +121,103,33125,1,4,0:0:0:0: +121,103,33250,1,6,0:0:0:0: +121,103,33375,1,4,0:0:0:0: +121,103,33500,2,4,L|190:103,1,40 +121,103,33750,1,4,0:0:0:0: +121,103,33875,1,6,0:0:0:0: +121,103,34000,1,4,0:0:0:0: +121,103,34125,2,4,L|190:103,1,40 +121,103,34375,1,4,0:0:0:0: +121,103,34500,1,6,0:0:0:0: +121,103,34625,1,4,0:0:0:0: +121,103,34750,2,4,L|190:103,1,40 +121,103,35000,1,4,0:0:0:0: +121,103,35125,1,6,0:0:0:0: +121,103,35250,1,4,0:0:0:0: +121,103,35375,2,4,L|190:103,1,40 +121,103,36500,1,4,0:0:0:0: +121,103,36625,1,4,0:0:0:0: +121,103,36750,1,6,0:0:0:0: +121,103,36875,2,4,L|190:103,1,40 +121,103,37125,1,4,0:0:0:0: +121,103,37250,1,4,0:0:0:0: +121,103,37375,1,6,0:0:0:0: +121,103,37500,2,4,L|190:103,1,40 +121,103,37750,1,4,0:0:0:0: +121,103,37875,1,4,0:0:0:0: +121,103,38000,1,6,0:0:0:0: +121,103,38125,2,4,L|190:103,1,40 +121,103,38375,1,4,0:0:0:0: +121,103,38500,1,4,0:0:0:0: +121,103,38625,1,6,0:0:0:0: +121,103,38750,2,4,L|190:103,1,40 +121,103,39000,1,4,0:0:0:0: +121,103,39125,1,4,0:0:0:0: +121,103,39250,1,6,0:0:0:0: +121,103,39375,2,4,L|190:103,1,40 +107,106,40500,1,4,0:0:0:0: +107,106,40625,1,4,0:0:0:0: +107,106,40750,1,6,0:0:0:0: +107,106,40875,1,6,0:0:0:0: +46,112,41000,2,4,L|214:112,1,160 +107,106,41625,1,4,0:0:0:0: +107,106,41750,1,4,0:0:0:0: +107,106,41875,1,6,0:0:0:0: +107,106,42000,1,6,0:0:0:0: +46,112,42125,2,4,L|214:112,1,160 +107,106,42750,1,4,0:0:0:0: +107,106,42875,1,4,0:0:0:0: +107,106,43000,1,6,0:0:0:0: +107,106,43125,1,6,0:0:0:0: +46,112,43250,2,4,L|214:112,1,160 +107,106,43875,1,4,0:0:0:0: +107,106,44000,1,4,0:0:0:0: +107,106,44125,1,6,0:0:0:0: +107,106,44250,1,6,0:0:0:0: +46,112,44375,2,4,L|214:112,1,160 +107,106,45000,1,4,0:0:0:0: +107,106,45125,1,4,0:0:0:0: +107,106,45250,1,6,0:0:0:0: +107,106,45375,1,6,0:0:0:0: +46,112,45500,2,4,L|214:112,1,160 +256,192,47000,12,4,47500,0:0:0:0: +256,192,47625,12,4,48000,0:0:0:0: +256,192,48125,12,4,48500,0:0:0:0: +256,192,48625,12,4,49000,0:0:0:0: +256,192,50000,12,4,50500,0:0:0:0: +183,143,50625,5,4,0:0:0:0: +256,192,50750,12,4,51250,0:0:0:0: +114,106,51375,5,4,0:0:0:0: +256,192,51625,12,4,52125,0:0:0:0: +154,143,52250,5,4,0:0:0:0: +256,192,52375,12,4,52875,0:0:0:0: +116,111,53000,5,4,0:0:0:0: diff --git a/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/diffcalc-test.osu b/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/diffcalc-test.osu new file mode 100644 index 0000000000..15326162ea --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Resources/Testing/Beatmaps/diffcalc-test.osu @@ -0,0 +1,285 @@ +osu file format v14 + +[General] +Mode: 1 + +[Difficulty] +CircleSize:4 +OverallDifficulty:7 +ApproachRate:8.3 +SliderMultiplier:1.6 +SliderTickRate:1 + +[TimingPoints] +500,500,4,2,1,50,1,0 +62500,-500,4,2,1,50,0,0 +71000,-100,4,2,1,50,0,0 + +[HitObjects] +// dd, spaced 1/4 beat apart +142,122,0,5,0,0:0:0:0: +142,122,125,1,0,0:0:0:0: +142,122,250,1,0,0:0:0:0: +142,122,375,1,0,0:0:0:0: +142,122,500,1,0,0:0:0:0: +142,122,625,1,0,0:0:0:0: +142,122,750,1,0,0:0:0:0: +142,122,875,1,0,0:0:0:0: +142,122,1000,1,0,0:0:0:0: +142,122,1125,1,0,0:0:0:0: +142,122,1250,1,0,0:0:0:0: +142,122,1375,1,0,0:0:0:0: +142,122,1500,1,0,0:0:0:0: + +// kk, spaced 1/4 beat apart +119,106,2500,1,2,0:0:0:0: +119,106,2625,1,2,0:0:0:0: +119,106,2750,1,2,0:0:0:0: +119,106,2875,1,2,0:0:0:0: +119,106,3000,1,2,0:0:0:0: +119,106,3125,1,2,0:0:0:0: +119,106,3250,1,2,0:0:0:0: +119,106,3375,1,2,0:0:0:0: +119,106,3500,1,2,0:0:0:0: +119,106,3625,1,2,0:0:0:0: +119,106,3750,1,2,0:0:0:0: +119,106,3875,1,2,0:0:0:0: +119,106,4000,1,2,0:0:0:0: + +// dk, spaced 1/4 beat apart +136,90,5000,1,0,0:0:0:0: +136,90,5125,1,2,0:0:0:0: +136,90,5250,1,0,0:0:0:0: +136,90,5375,1,2,0:0:0:0: +136,90,5500,1,0,0:0:0:0: +136,90,5625,1,2,0:0:0:0: +136,90,5750,1,0,0:0:0:0: +136,90,5875,1,2,0:0:0:0: +136,90,6000,1,0,0:0:0:0: +136,90,6125,1,2,0:0:0:0: +136,90,6250,1,0,0:0:0:0: +136,90,6375,1,2,0:0:0:0: +136,90,6500,1,0,0:0:0:0: + +// ddkk, spaced 1/4 beat apart +86,113,7500,1,0,0:0:0:0: +86,113,7625,1,0,0:0:0:0: +86,113,7750,1,2,0:0:0:0: +86,113,7875,1,2,0:0:0:0: +86,113,8000,1,0,0:0:0:0: +86,113,8125,1,0,0:0:0:0: +86,113,8250,1,2,0:0:0:0: +86,113,8375,1,2,0:0:0:0: +86,113,8500,1,0,0:0:0:0: +86,113,8625,1,0,0:0:0:0: +86,113,8750,1,2,0:0:0:0: +86,113,8875,1,2,0:0:0:0: +86,113,9000,1,0,0:0:0:0: + +// dddkkk, spaced 1/4 beat apart +146,90,10000,1,0,0:0:0:0: +146,90,10125,1,0,0:0:0:0: +146,90,10250,1,0,0:0:0:0: +146,90,10375,1,2,0:0:0:0: +146,90,10500,1,2,0:0:0:0: +146,90,10625,1,2,0:0:0:0: +146,90,10750,1,0,0:0:0:0: +146,90,10875,1,0,0:0:0:0: +146,90,11000,1,0,0:0:0:0: +146,90,11125,1,2,0:0:0:0: +146,90,11250,1,2,0:0:0:0: +146,90,11375,1,2,0:0:0:0: +146,90,11500,1,0,0:0:0:0: +146,90,11625,1,0,0:0:0:0: +146,90,11750,1,0,0:0:0:0: +146,90,11875,1,2,0:0:0:0: +146,90,12000,1,2,0:0:0:0: +146,90,12125,1,2,0:0:0:0: +146,90,12250,1,0,0:0:0:0: +146,90,12375,1,0,0:0:0:0: +146,90,12500,1,0,0:0:0:0: + +// dddk, spaced 1/4 beat apart +69,99,13500,1,0,0:0:0:0: +69,99,13625,1,0,0:0:0:0: +69,99,13750,1,0,0:0:0:0: +69,99,13875,1,2,0:0:0:0: +69,99,14000,1,0,0:0:0:0: +69,99,14125,1,0,0:0:0:0: +69,99,14250,1,0,0:0:0:0: +69,99,14375,1,2,0:0:0:0: +69,99,14500,1,0,0:0:0:0: +69,99,14625,1,0,0:0:0:0: +69,99,14750,1,0,0:0:0:0: +69,99,14875,1,2,0:0:0:0: +69,99,15000,1,0,0:0:0:0: +69,99,15125,1,0,0:0:0:0: +69,99,15250,1,0,0:0:0:0: +69,99,15375,1,2,0:0:0:0: +69,99,15500,1,0,0:0:0:0: + +// arbitrary pattern, spaced 1/4 beat apart +83,89,16500,1,0,0:0:0:0: +83,89,16625,1,2,0:0:0:0: +83,89,16750,1,2,0:0:0:0: +83,89,16875,1,0,0:0:0:0: +83,89,17000,1,0,0:0:0:0: +83,89,17125,1,0,0:0:0:0: +83,89,17250,1,2,0:0:0:0: +83,89,17375,1,2,0:0:0:0: +83,89,17500,1,2,0:0:0:0: +83,89,17625,1,2,0:0:0:0: +83,89,17750,1,0,0:0:0:0: +83,89,17875,1,0,0:0:0:0: +83,89,18000,1,0,0:0:0:0: +83,89,18125,1,0,0:0:0:0: +83,89,18250,1,0,0:0:0:0: +83,89,18375,1,2,0:0:0:0: +83,89,18500,1,2,0:0:0:0: +83,89,18625,1,2,0:0:0:0: +83,89,18750,1,2,0:0:0:0: +83,89,18875,1,0,0:0:0:0: +83,89,19000,1,0,0:0:0:0: +83,89,19125,1,0,0:0:0:0: +83,89,19250,1,0,0:0:0:0: +83,89,19375,1,2,0:0:0:0: +83,89,19500,1,2,0:0:0:0: +83,89,19625,1,0,0:0:0:0: + +// d-slider pattern, spaced 1/4 beat apart +84,122,20500,1,0,0:0:0:0: +84,122,20625,2,0,L|217:123,1,120 +84,122,21125,1,0,0:0:0:0: +84,122,21250,2,0,L|217:123,1,120 +84,122,21750,1,0,0:0:0:0: +84,122,21875,2,0,L|217:123,1,120 +84,122,22375,1,0,0:0:0:0: +84,122,22500,2,0,L|217:123,1,120 +84,122,23000,1,0,0:0:0:0: +84,122,23125,2,0,L|217:123,1,120 + +// dd-slider pattern, spaced 1/4 beat apart +99,106,24500,1,0,0:0:0:0: +99,106,24625,1,0,0:0:0:0: +99,106,24750,2,0,L|194:107,1,80 +99,106,25125,1,0,0:0:0:0: +99,106,25250,1,0,0:0:0:0: +99,106,25375,2,0,L|194:107,1,80 +99,106,25750,1,0,0:0:0:0: +99,106,25875,1,0,0:0:0:0: +99,106,26000,2,0,L|194:107,1,80 +99,106,26375,1,0,0:0:0:0: +99,106,26500,1,0,0:0:0:0: +99,106,26625,2,0,L|194:107,1,80 +99,106,27000,1,0,0:0:0:0: +99,106,27125,1,0,0:0:0:0: +99,106,27250,2,0,L|194:107,1,80 + +// ddd-slider pattern, spaced 1/4 beat apart +121,103,28500,1,0,0:0:0:0: +121,103,28625,1,0,0:0:0:0: +121,103,28750,1,0,0:0:0:0: +121,103,28875,2,0,L|190:103,1,40 +121,103,29125,1,0,0:0:0:0: +121,103,29250,1,0,0:0:0:0: +121,103,29375,1,0,0:0:0:0: +121,103,29500,2,0,L|190:103,1,40 +121,103,29750,1,0,0:0:0:0: +121,103,29875,1,0,0:0:0:0: +121,103,30000,1,0,0:0:0:0: +121,103,30125,2,0,L|190:103,1,40 +121,103,30375,1,0,0:0:0:0: +121,103,30500,1,0,0:0:0:0: +121,103,30625,1,0,0:0:0:0: +121,103,30750,2,0,L|190:103,1,40 +121,103,31000,1,0,0:0:0:0: +121,103,31125,1,0,0:0:0:0: +121,103,31250,1,0,0:0:0:0: +121,103,31375,2,0,L|190:103,1,40 + +// dkd-slider pattern, spaced 1/4 beat apart +121,103,32500,1,0,0:0:0:0: +121,103,32625,1,2,0:0:0:0: +121,103,32750,1,0,0:0:0:0: +121,103,32875,2,0,L|190:103,1,40 +121,103,33125,1,0,0:0:0:0: +121,103,33250,1,2,0:0:0:0: +121,103,33375,1,0,0:0:0:0: +121,103,33500,2,0,L|190:103,1,40 +121,103,33750,1,0,0:0:0:0: +121,103,33875,1,2,0:0:0:0: +121,103,34000,1,0,0:0:0:0: +121,103,34125,2,0,L|190:103,1,40 +121,103,34375,1,0,0:0:0:0: +121,103,34500,1,2,0:0:0:0: +121,103,34625,1,0,0:0:0:0: +121,103,34750,2,0,L|190:103,1,40 +121,103,35000,1,0,0:0:0:0: +121,103,35125,1,2,0:0:0:0: +121,103,35250,1,0,0:0:0:0: +121,103,35375,2,0,L|190:103,1,40 + +//ddk-slider pattern, spaced 1/4 beat apart +121,103,36500,1,0,0:0:0:0: +121,103,36625,1,0,0:0:0:0: +121,103,36750,1,2,0:0:0:0: +121,103,36875,2,0,L|190:103,1,40 +121,103,37125,1,0,0:0:0:0: +121,103,37250,1,0,0:0:0:0: +121,103,37375,1,2,0:0:0:0: +121,103,37500,2,0,L|190:103,1,40 +121,103,37750,1,0,0:0:0:0: +121,103,37875,1,0,0:0:0:0: +121,103,38000,1,2,0:0:0:0: +121,103,38125,2,0,L|190:103,1,40 +121,103,38375,1,0,0:0:0:0: +121,103,38500,1,0,0:0:0:0: +121,103,38625,1,2,0:0:0:0: +121,103,38750,2,0,L|190:103,1,40 +121,103,39000,1,0,0:0:0:0: +121,103,39125,1,0,0:0:0:0: +121,103,39250,1,2,0:0:0:0: +121,103,39375,2,0,L|190:103,1,40 + +//ddkk-slider pattern, spaced 1/4 beat apart +107,106,40500,1,0,0:0:0:0: +107,106,40625,1,0,0:0:0:0: +107,106,40750,1,2,0:0:0:0: +107,106,40875,1,2,0:0:0:0: +46,112,41000,2,0,L|214:112,1,160 +107,106,41625,1,0,0:0:0:0: +107,106,41750,1,0,0:0:0:0: +107,106,41875,1,2,0:0:0:0: +107,106,42000,1,2,0:0:0:0: +46,112,42125,2,0,L|214:112,1,160 +107,106,42750,1,0,0:0:0:0: +107,106,42875,1,0,0:0:0:0: +107,106,43000,1,2,0:0:0:0: +107,106,43125,1,2,0:0:0:0: +46,112,43250,2,0,L|214:112,1,160 +107,106,43875,1,0,0:0:0:0: +107,106,44000,1,0,0:0:0:0: +107,106,44125,1,2,0:0:0:0: +107,106,44250,1,2,0:0:0:0: +46,112,44375,2,0,L|214:112,1,160 +107,106,45000,1,0,0:0:0:0: +107,106,45125,1,0,0:0:0:0: +107,106,45250,1,2,0:0:0:0: +107,106,45375,1,2,0:0:0:0: +46,112,45500,2,0,L|214:112,1,160 + +// spinner-spinner pattern, spaced 1/4 beat apart +256,192,47000,12,0,47500,0:0:0:0: +256,192,47625,12,0,48000,0:0:0:0: +256,192,48125,12,0,48500,0:0:0:0: +256,192,48625,12,0,49000,0:0:0:0: + +// spinner-d pattern, spaced 1/4 beat apart +256,192,50000,12,0,50500,0:0:0:0: +183,143,50625,5,0,0:0:0:0: +256,192,50750,12,0,51250,0:0:0:0: +114,106,51375,5,0,0:0:0:0: +256,192,51625,12,0,52125,0:0:0:0: +154,143,52250,5,0,0:0:0:0: +256,192,52375,12,0,52875,0:0:0:0: +116,111,53000,5,0,0:0:0:0: From 09e717d2198925d79aaffcccad8d408bd1c2c18e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Feb 2019 15:49:51 +0900 Subject: [PATCH 033/327] Add catch difficulty calculator tests --- .../CatchDifficultyCalculatorTest.cs | 24 +++ .../Testing/Beatmaps/diffcalc-test.osu | 138 ++++++++++++++++++ .../OsuDifficultyCalculatorTest.cs | 4 +- .../TaikoDifficultyCalculatorTest.cs | 4 +- 4 files changed, 164 insertions(+), 6 deletions(-) create mode 100644 osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs create mode 100644 osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/diffcalc-test.osu diff --git a/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs new file mode 100644 index 0000000000..91bc537902 --- /dev/null +++ b/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs @@ -0,0 +1,24 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Catch.Difficulty; +using osu.Game.Rulesets.Difficulty; +using osu.Game.Tests.Beatmaps; + +namespace osu.Game.Rulesets.Catch.Tests +{ + public class CatchDifficultyCalculatorTest : DifficultyCalculatorTest + { + protected override string ResourceAssembly => "osu.Game.Rulesets.Catch"; + + [TestCase(3.8664391043534758, "diffcalc-test")] + public void Test(double expected, string name) + => base.Test(expected, name); + + protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchDifficultyCalculator(new CatchRuleset(), beatmap); + + protected override Ruleset CreateRuleset() => new CatchRuleset(); + } +} diff --git a/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/diffcalc-test.osu b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/diffcalc-test.osu new file mode 100644 index 0000000000..ebad654404 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Resources/Testing/Beatmaps/diffcalc-test.osu @@ -0,0 +1,138 @@ +osu file format v14 + +[General] +StackLeniency: 0.3 +Mode: 2 + +[Difficulty] +CircleSize:4 +OverallDifficulty:7 +ApproachRate:8.3 +SliderMultiplier:1.6 +SliderTickRate:1 + +[TimingPoints] +500,500,4,2,1,50,1,0 +34500,-50,4,2,1,50,0,0 + +[HitObjects] +// fruits spaced 1/1 beat apart +32,128,0,5,0,0:0:0:0: +96,128,500,1,0,0:0:0:0: +160,128,1000,1,0,0:0:0:0: +224,128,1500,1,0,0:0:0:0: +288,128,2000,1,0,0:0:0:0: +352,128,2500,1,0,0:0:0:0: +416,128,3000,1,0,0:0:0:0: +480,128,3500,1,0,0:0:0:0: + +// fruits spaced 1/2 beat apart +32,160,4500,1,0,0:0:0:0: +64,160,4750,1,0,0:0:0:0: +96,160,5000,1,0,0:0:0:0: +128,160,5250,1,0,0:0:0:0: +160,160,5500,1,0,0:0:0:0: +192,160,5750,1,0,0:0:0:0: +224,160,6000,1,0,0:0:0:0: +256,160,6250,1,0,0:0:0:0: +288,160,6500,1,0,0:0:0:0: + +// fruits spaced 1/4 beat apart +96,128,7500,1,0,0:0:0:0: +128,128,7625,1,0,0:0:0:0: +160,128,7750,1,0,0:0:0:0: +192,128,7875,1,0,0:0:0:0: +224,128,8000,1,0,0:0:0:0: +256,128,8125,1,0,0:0:0:0: +288,128,8250,1,0,0:0:0:0: +320,128,8375,1,0,0:0:0:0: +352,128,8500,1,0,0:0:0:0: + +// fruit hyperdashes, spaced 1/2 beat apart +32,160,9500,1,0,0:0:0:0: +480,160,9750,1,0,0:0:0:0: +32,160,10000,1,0,0:0:0:0: +480,160,10250,1,0,0:0:0:0: +32,160,10500,1,0,0:0:0:0: +480,160,10750,1,0,0:0:0:0: +32,160,11000,1,0,0:0:0:0: + +// fruit hyperdashes, spaced 1/4 beat apart +32,192,12000,1,0,0:0:0:0: +480,192,12125,1,0,0:0:0:0: +32,192,12250,1,0,0:0:0:0: +480,192,12375,1,0,0:0:0:0: +32,192,12500,1,0,0:0:0:0: +480,192,12625,1,0,0:0:0:0: +32,192,12750,1,0,0:0:0:0: +480,192,12875,1,0,0:0:0:0: +32,192,13000,1,0,0:0:0:0: + +// stream + hyperdash + stream, spaced 1/4 beat apart +32,192,14000,1,0,0:0:0:0: +64,192,14125,1,0,0:0:0:0: +96,192,14250,1,0,0:0:0:0: +128,192,14375,1,0,0:0:0:0: +480,192,14500,1,0,0:0:0:0: +448,192,14625,1,0,0:0:0:0: +416,192,14750,1,0,0:0:0:0: +384,192,14875,1,0,0:0:0:0: +32,192,15000,1,0,0:0:0:0: + +// basic sliders +32,192,16000,2,0,L|192:192,1,160 +224,192,17000,2,0,L|384:192,1,160 +416,192,17875,2,0,L|480:192,1,40 + +// slider hyperdashes, spaced 1/4 beat apart +32,192,19000,2,0,L|128:192,1,80 +480,192,19375,2,0,L|384:192,1,80 +352,192,19750,2,0,L|256:192,1,80 +0,192,20125,2,0,L|128:192,1,120 + +// stream + slider hyperdashes, spaced 1/4 beat apart +32,192,21500,1,0,0:0:0:0: +64,192,21625,1,0,0:0:0:0: +96,192,21750,1,0,0:0:0:0: +512,192,21875,2,0,L|320:192,1,160 +320,192,22500,1,0,0:0:0:0: +288,192,22625,1,0,0:0:0:0: +256,192,22750,1,0,0:0:0:0: +0,192,22875,2,0,L|64:192,1,40 + +// streams, spaced 1/4 beat apart +64,192,24000,1,0,0:0:0:0: +160,192,24125,1,0,0:0:0:0: +64,192,24250,1,0,0:0:0:0: +160,192,24375,1,0,0:0:0:0: +64,192,24500,1,0,0:0:0:0: +160,192,24625,1,0,0:0:0:0: +64,192,24750,1,0,0:0:0:0: +160,192,24875,1,0,0:0:0:0: +64,192,25000,1,0,0:0:0:0: +160,192,25125,1,0,0:0:0:0: +64,192,25250,1,0,0:0:0:0: +160,192,25375,1,0,0:0:0:0: +64,192,25500,1,0,0:0:0:0: + +// stream + spinner combo, spaced 1/4 beat apart +256,192,26500,12,0,27000,0:0:0:0: +128,192,27250,5,0,0:0:0:0: +128,192,27375,1,0,0:0:0:0: +160,192,27500,1,0,0:0:0:0: +192,192,27625,1,0,0:0:0:0: +256,192,27750,12,0,28500,0:0:0:0: +192,192,28625,5,0,0:0:0:0: +224,192,28750,1,0,0:0:0:0: +256,192,28875,1,0,0:0:0:0: +256,192,29000,1,0,0:0:0:0: +256,192,29125,12,0,29500,0:0:0:0: + +// long slow slider +0,192,30500,6,0,B|480:192|480:192|0:192,2,960 + +// long fast slider +0,192,37500,6,0,B|480:192|480:192|0:192,2,960 + +// long hyperdash slider +0,192,41500,2,0,P|544:192|544:192,5,480 diff --git a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs index 4926a81034..e55dc1f902 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs @@ -16,9 +16,7 @@ namespace osu.Game.Rulesets.Osu.Tests [TestCase(6.931145117263422, "diffcalc-test")] public void Test(double expected, string name) - { - base.Test(expected, name); - } + => base.Test(expected, name); protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset(), beatmap); diff --git a/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs index 112834e84c..299f84fb1f 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs @@ -16,9 +16,7 @@ namespace osu.Game.Rulesets.Taiko.Tests [TestCase(2.9811336589467095, "diffcalc-test")] [TestCase(2.9811336589467095, "diffcalc-test-strong")] public void Test(double expected, string name) - { - base.Test(expected, name); - } + => base.Test(expected, name); protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoDifficultyCalculator(new TaikoRuleset(), beatmap); From 6da9f94ae3dd9404a3c2fb8c93dd205055185174 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 15 Feb 2019 16:17:01 +0900 Subject: [PATCH 034/327] Fix regression with background dim --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 65 +++++++++++++++++++ osu.Game/Configuration/OsuConfigManager.cs | 2 +- .../Backgrounds/BackgroundScreenBeatmap.cs | 48 ++++++++++++-- .../UserDimmableBackgroundScreenBeatmap.cs | 57 ---------------- osu.Game/Screens/Play/Player.cs | 4 ++ .../Play/ScreenWithBeatmapBackground.cs | 4 +- 6 files changed, 116 insertions(+), 64 deletions(-) create mode 100644 osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs delete mode 100644 osu.Game/Screens/Backgrounds/UserDimmableBackgroundScreenBeatmap.cs diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs new file mode 100644 index 0000000000..69faf99416 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -0,0 +1,65 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using NUnit.Framework.Internal; +using osu.Framework.Allocation; +using osu.Game.Configuration; +using osu.Game.Graphics; +using osu.Game.Rulesets; +using osu.Game.Screens; +using osu.Game.Screens.Backgrounds; +using osu.Game.Screens.Play; + +namespace osu.Game.Tests.Visual +{ + public class TestCaseBackgroundScreenBeatmap : TestCasePlayer + { + + [BackgroundDependencyLoader] + private void load(OsuConfigManager manager) + { + LoadScreen(new DimAccessiblePlayer()); + } + + [Test] + public void EnableUserDimTest() + { + AddStep("Test User Dimming", () => ((DimAccessiblePlayer)Player).EnableScreenDim()); + AddAssert("Check screen dim", () => ((DimAccessiblePlayer)Player).AssertDimState()); + } + + protected override Player CreatePlayer(Ruleset ruleset) => new DimAccessiblePlayer(); + + private class DimAccessiblePlayer : Player + { + protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); + public void EnableScreenDim() + { + Background.UpdateDim.Value = true; + } + + public void DisableScreenDim() + { + Background.UpdateDim.Value = false; + } + + public bool AssertDimState() + { + return ((FadeAccessibleBackground)Background).AssertDimState(); + } + + private class FadeAccessibleBackground : BackgroundScreenBeatmap + { + public bool AssertDimState() + { + return FadeContainer.Colour == OsuColour.Gray(BackgroundOpacity); + } + } + } + } + + internal class SetupAttribute : Attribute + { + } +} diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 613efe1801..747dc7ddeb 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -170,6 +170,6 @@ namespace osu.Game.Configuration ScalingPositionY, ScalingSizeX, ScalingSizeY, - UIScale + UIScale, } } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 4fe0f0627e..be0d18f59e 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -18,6 +18,17 @@ namespace osu.Game.Screens.Backgrounds public class BackgroundScreenBeatmap : BlurrableBackgroundScreen { protected WorkingBeatmap beatmap; + protected Bindable DimLevel; + public Bindable UpdateDim; + + protected float BackgroundOpacity => 1 - (float)DimLevel; + protected Container FadeContainer; + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + DimLevel = config.GetBindable(OsuSetting.DimLevel); + } public virtual WorkingBeatmap Beatmap { @@ -31,6 +42,7 @@ namespace osu.Game.Screens.Backgrounds Schedule(() => { + FadeContainer = new Container { RelativeSizeAxes = Axes.Both }; LoadComponentAsync(new BeatmapBackground(beatmap), b => Schedule(() => { float newDepth = 0; @@ -41,23 +53,51 @@ namespace osu.Game.Screens.Backgrounds Background.FadeOut(250); Background.Expire(); } - b.Depth = newDepth; - AddBackground(Background = b); + FadeContainer.Child = Background = b; + InternalChild = FadeContainer; Background.BlurSigma = BlurTarget; })); }); } } - protected virtual void AddBackground(Drawable d) + public override void OnEntering(IScreen last) { - AddInternal(d); + base.OnEntering(last); + DimLevel.ValueChanged += _ => updateBackgroundDim(); + UpdateDim.ValueChanged += _ => updateBackgroundDim(); + updateBackgroundDim(); + } + public override void OnResuming(IScreen last) + { + base.OnResuming(last); + updateBackgroundDim(); + } + + public override bool OnExiting(IScreen last) + { + UpdateDim.Value = false; + return base.OnExiting(last); + } + + private void updateBackgroundDim() + { + if (UpdateDim) + FadeContainer?.FadeColour(OsuColour.Gray(BackgroundOpacity), 800, Easing.OutQuint); + else + FadeContainer?.FadeColour(OsuColour.Gray(1.0f), 800, Easing.InQuint); } public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null) { Beatmap = beatmap; + UpdateDim = new Bindable(); + } + + public void EnableUserDim() + { + UpdateDim.Value = true; } public override bool Equals(BackgroundScreen other) diff --git a/osu.Game/Screens/Backgrounds/UserDimmableBackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/UserDimmableBackgroundScreenBeatmap.cs deleted file mode 100644 index 2902626702..0000000000 --- a/osu.Game/Screens/Backgrounds/UserDimmableBackgroundScreenBeatmap.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Allocation; -using osu.Framework.Configuration; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Screens; -using osu.Game.Beatmaps; -using osu.Game.Configuration; -using osu.Game.Graphics; -using osuTK; - -namespace osu.Game.Screens.Backgrounds -{ - public class UserDimmableBackgroundScreenBeatmap : BackgroundScreenBeatmap - { - protected Bindable DimLevel; - protected float BackgroundOpacity => 1 - (float)DimLevel; - private Container fadeContainer; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - DimLevel = config.GetBindable(OsuSetting.DimLevel); - fadeContainer = new Container { RelativeSizeAxes = Axes.Both}; - } - - protected override void AddBackground(Drawable d) - { - fadeContainer.Child = d; - InternalChild = fadeContainer; - } - - public override void OnEntering(IScreen last) - { - base.OnEntering(last); - DimLevel.ValueChanged += _ => updateBackgroundDim(); - updateBackgroundDim(); - } - public override void OnResuming(IScreen last) - { - base.OnResuming(last); - updateBackgroundDim(); - } - - public UserDimmableBackgroundScreenBeatmap(WorkingBeatmap beatmap = null) - :base(beatmap) - { - } - - private void updateBackgroundDim() - { - fadeContainer?.FadeColour(OsuColour.Gray(BackgroundOpacity), 800, Easing.OutQuint); - } - } -} diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 71b7b77e5d..819a85e88e 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -247,6 +247,8 @@ namespace osu.Game.Screens.Play foreach (var mod in Beatmap.Value.Mods.Value.OfType()) mod.ApplyToScoreProcessor(ScoreProcessor); + + Background?.EnableUserDim(); } private void applyRateFromMods() @@ -395,6 +397,8 @@ namespace osu.Game.Screens.Play if (LoadedBeatmapSuccessfully) pauseContainer?.Pause(); + Background.UpdateDim.Value = false; + return true; } diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index a1665a85c8..dbfce3e628 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -13,9 +13,9 @@ namespace osu.Game.Screens.Play { public abstract class ScreenWithBeatmapBackground : OsuScreen { - protected override BackgroundScreen CreateBackground() => new UserDimmableBackgroundScreenBeatmap(Beatmap.Value); + protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value); - protected new UserDimmableBackgroundScreenBeatmap Background => base.Background as UserDimmableBackgroundScreenBeatmap; + protected new BackgroundScreenBeatmap Background => base.Background as BackgroundScreenBeatmap; public override bool AllowBeatmapRulesetChange => false; From e319a760b807ba9795355ab200c11a59c8cc0941 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 15 Feb 2019 16:25:44 +0900 Subject: [PATCH 035/327] Add mania difficulty calculator test --- .../ManiaDifficultyCalculatorTest.cs | 24 +++ .../Testing/Beatmaps/diffcalc-test.osu | 180 ++++++++++++++++++ 2 files changed, 204 insertions(+) create mode 100644 osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs create mode 100644 osu.Game.Rulesets.Mania/Resources/Testing/Beatmaps/diffcalc-test.osu diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs new file mode 100644 index 0000000000..05e2df796c --- /dev/null +++ b/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs @@ -0,0 +1,24 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Difficulty; +using osu.Game.Rulesets.Mania.Difficulty; +using osu.Game.Tests.Beatmaps; + +namespace osu.Game.Rulesets.Mania.Tests +{ + public class ManiaDifficultyCalculatorTest : DifficultyCalculatorTest + { + protected override string ResourceAssembly => "osu.Game.Rulesets.Mania"; + + [TestCase(2.2676066895468976, "diffcalc-test")] + public void Test(double expected, string name) + => base.Test(expected, name); + + protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new ManiaDifficultyCalculator(new ManiaRuleset(), beatmap); + + protected override Ruleset CreateRuleset() => new ManiaRuleset(); + } +} diff --git a/osu.Game.Rulesets.Mania/Resources/Testing/Beatmaps/diffcalc-test.osu b/osu.Game.Rulesets.Mania/Resources/Testing/Beatmaps/diffcalc-test.osu new file mode 100644 index 0000000000..4c877c6193 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Resources/Testing/Beatmaps/diffcalc-test.osu @@ -0,0 +1,180 @@ +osu file format v14 + +[General] +Mode: 3 + +[Difficulty] +CircleSize:4 +OverallDifficulty:7 +ApproachRate:8.3 +SliderMultiplier:1.6 +SliderTickRate:1 + +[TimingPoints] +500,500,4,2,1,50,1,0 +37500,-50,4,2,1,50,0,0 +41500,-25,4,2,1,50,0,0 + +[HitObjects] +// jacks spaced 1/1 beat apart +64,192,0,1,0,0:0:0:0: +64,192,500,1,0,0:0:0:0: +64,192,1000,1,0,0:0:0:0: +64,192,1500,1,0,0:0:0:0: +64,192,2000,1,0,0:0:0:0: +64,192,2500,1,0,0:0:0:0: + +// jacks spaced 1/2 beat apart +64,192,3500,1,0,0:0:0:0: +64,192,3750,1,0,0:0:0:0: +64,192,4000,1,0,0:0:0:0: +64,192,4250,1,0,0:0:0:0: +64,192,4500,1,0,0:0:0:0: +64,192,4750,1,0,0:0:0:0: +64,192,5000,1,0,0:0:0:0: +64,192,6000,1,0,0:0:0:0: + +// doubles jacks spaced 1/2 beat apart +192,192,6000,1,0,0:0:0:0: +64,192,6250,1,0,0:0:0:0: +192,192,6250,1,0,0:0:0:0: +64,192,6500,1,0,0:0:0:0: +192,192,6500,1,0,0:0:0:0: +64,192,6750,1,0,0:0:0:0: +192,192,6750,1,0,0:0:0:0: +64,192,7000,1,0,0:0:0:0: +192,192,7000,1,0,0:0:0:0: +64,192,7250,1,0,0:0:0:0: +192,192,7250,1,0,0:0:0:0: +64,192,7500,1,0,0:0:0:0: +192,192,7500,1,0,0:0:0:0: + +// trill spaced 1/2 beat apart +64,192,8500,1,0,0:0:0:0: +192,192,8750,1,0,0:0:0:0: +64,192,9000,1,0,0:0:0:0: +192,192,9250,1,0,0:0:0:0: +64,192,9500,1,0,0:0:0:0: +192,192,9750,1,0,0:0:0:0: +64,192,10000,1,0,0:0:0:0: +192,192,10250,1,0,0:0:0:0: +64,192,10500,1,0,0:0:0:0: + +// stair spaced 1/4 apart +64,192,11500,1,0,0:0:0:0: +192,192,11625,1,0,0:0:0:0: +320,192,11750,1,0,0:0:0:0: +448,192,11875,1,0,0:0:0:0: +320,192,12000,1,0,0:0:0:0: +192,192,12125,1,0,0:0:0:0: +64,192,12250,1,0,0:0:0:0: +192,192,12375,1,0,0:0:0:0: +320,192,12500,1,0,0:0:0:0: +448,192,12625,1,0,0:0:0:0: + +// jumpstreams? +64,192,13500,1,0,0:0:0:0: +192,192,13625,1,0,0:0:0:0: +320,192,13750,1,0,0:0:0:0: +448,192,13875,1,0,0:0:0:0: +320,192,14000,1,0,0:0:0:0: +192,192,14000,1,0,0:0:0:0: +64,192,14125,1,0,0:0:0:0: +192,192,14250,1,0,0:0:0:0: +320,192,14250,1,0,0:0:0:0: +448,192,14250,1,0,0:0:0:0: +64,192,14375,1,0,0:0:0:0: +64,192,14500,1,0,0:0:0:0: +320,192,14625,1,0,0:0:0:0: +448,192,14625,1,0,0:0:0:0: +192,192,14625,1,0,0:0:0:0: +192,192,14750,1,0,0:0:0:0: +64,192,14875,1,0,0:0:0:0: +192,192,15000,1,0,0:0:0:0: +320,192,15125,1,0,0:0:0:0: +448,192,15125,1,0,0:0:0:0: + +// double... jumps? +64,192,16000,1,0,0:0:0:0: +64,192,16250,1,0,0:0:0:0: +192,192,16250,1,0,0:0:0:0: +192,192,16500,1,0,0:0:0:0: +320,192,16500,1,0,0:0:0:0: +320,192,16750,1,0,0:0:0:0: +448,192,16750,1,0,0:0:0:0: +448,192,17000,1,0,0:0:0:0: + +// notes alongside hold +64,192,18000,128,0,18500:0:0:0:0: +192,192,18000,1,0,0:0:0:0: +192,192,18250,1,0,0:0:0:0: +192,192,18500,1,0,0:0:0:0: + +// notes overlapping hold +64,192,19500,1,0,0:0:0:0: +192,192,19625,128,0,20875:0:0:0:0: +64,192,19750,1,0,0:0:0:0: +64,192,20000,1,0,0:0:0:0: +64,192,20250,1,0,0:0:0:0: +64,192,20500,1,0,0:0:0:0: +64,192,20750,1,0,0:0:0:0: +64,192,21000,1,0,0:0:0:0: + +// simultaneous holds +64,192,22000,128,0,23000:0:0:0:0: +192,192,22000,128,0,23000:0:0:0:0: +320,192,22000,128,0,23000:0:0:0:0: +448,192,22000,128,0,23000:0:0:0:0: + +// hold stairs +64,192,24500,128,0,25500:0:0:0:0: +192,192,24625,128,0,25375:0:0:0:0: +320,192,24750,128,0,25250:0:0:0:0: +448,192,24875,128,0,25125:0:0:0:0: +448,192,25375,128,0,26375:0:0:0:0: +320,192,25500,128,0,26250:0:0:0:0: +192,192,25625,128,0,26125:0:0:0:0: +64,192,25750,128,0,26000:0:0:0:0: + +// quads +64,192,26500,1,0,0:0:0:0: +64,192,27500,1,0,0:0:0:0: +192,192,27500,1,0,0:0:0:0: +320,192,27500,1,0,0:0:0:0: +448,192,27500,1,0,0:0:0:0: +64,192,27750,1,0,0:0:0:0: +192,192,27750,1,0,0:0:0:0: +320,192,27750,1,0,0:0:0:0: +448,192,27750,1,0,0:0:0:0: +64,192,28000,1,0,0:0:0:0: +192,192,28000,1,0,0:0:0:0: +320,192,28000,1,0,0:0:0:0: +448,192,28000,1,0,0:0:0:0: +64,192,28250,1,0,0:0:0:0: +192,192,28250,1,0,0:0:0:0: +320,192,28250,1,0,0:0:0:0: +448,192,28250,1,0,0:0:0:0: +64,192,28500,1,0,0:0:0:0: +192,192,28500,1,0,0:0:0:0: +320,192,28500,1,0,0:0:0:0: +448,192,28500,1,0,0:0:0:0: + +// double-trills +64,192,29500,1,0,0:0:0:0: +192,192,29500,1,0,0:0:0:0: +320,192,29625,1,0,0:0:0:0: +448,192,29625,1,0,0:0:0:0: +64,192,29750,1,0,0:0:0:0: +192,192,29750,1,0,0:0:0:0: +320,192,29875,1,0,0:0:0:0: +448,192,29875,1,0,0:0:0:0: +64,192,30000,1,0,0:0:0:0: +192,192,30000,1,0,0:0:0:0: +320,192,30125,1,0,0:0:0:0: +448,192,30125,1,0,0:0:0:0: +64,192,30250,1,0,0:0:0:0: +192,192,30250,1,0,0:0:0:0: +320,192,30375,1,0,0:0:0:0: +448,192,30375,1,0,0:0:0:0: +64,192,30500,1,0,0:0:0:0: +192,192,30500,1,0,0:0:0:0: From ad9dae975dc3e98fef2084f997791383a3c128a9 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 15 Feb 2019 16:38:27 +0900 Subject: [PATCH 036/327] Add visual test for background dimming --- .idea/.idea.osu/.idea/.name | 1 - .../Visual/TestCaseBackgroundScreenBeatmap.cs | 33 ++++++++++++------- 2 files changed, 21 insertions(+), 13 deletions(-) delete mode 100644 .idea/.idea.osu/.idea/.name diff --git a/.idea/.idea.osu/.idea/.name b/.idea/.idea.osu/.idea/.name deleted file mode 100644 index 21cb4db60e..0000000000 --- a/.idea/.idea.osu/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -osu \ No newline at end of file diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 69faf99416..38c66ef2e6 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; -using NUnit.Framework.Internal; +using NUnit.Framework; using osu.Framework.Allocation; using osu.Game.Configuration; using osu.Game.Graphics; @@ -13,22 +13,25 @@ using osu.Game.Screens.Play; namespace osu.Game.Tests.Visual { + [TestFixture] public class TestCaseBackgroundScreenBeatmap : TestCasePlayer { - - [BackgroundDependencyLoader] - private void load(OsuConfigManager manager) - { - LoadScreen(new DimAccessiblePlayer()); - } - [Test] public void EnableUserDimTest() { AddStep("Test User Dimming", () => ((DimAccessiblePlayer)Player).EnableScreenDim()); + AddWaitStep(5, "Wait for dim"); AddAssert("Check screen dim", () => ((DimAccessiblePlayer)Player).AssertDimState()); } + [Test] + public void DisableUserDimTest() + { + AddStep("Test User Dimming", () => ((DimAccessiblePlayer)Player).DisableScreenDim()); + AddWaitStep(5, "Wait for dim"); + AddAssert("Check screen dim", () => ((DimAccessiblePlayer)Player).AssertUndimmed()); + } + protected override Player CreatePlayer(Ruleset ruleset) => new DimAccessiblePlayer(); private class DimAccessiblePlayer : Player @@ -49,17 +52,23 @@ namespace osu.Game.Tests.Visual return ((FadeAccessibleBackground)Background).AssertDimState(); } + public bool AssertUndimmed() + { + return ((FadeAccessibleBackground)Background).AssertUndimmed(); + } + private class FadeAccessibleBackground : BackgroundScreenBeatmap { public bool AssertDimState() { return FadeContainer.Colour == OsuColour.Gray(BackgroundOpacity); } + + public bool AssertUndimmed() + { + return FadeContainer.Colour == OsuColour.Gray(1.0f); + } } } } - - internal class SetupAttribute : Attribute - { - } } From 0a60f6dacdfac123210d762d173b1ebf8ccbe10e Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 15 Feb 2019 16:50:37 +0900 Subject: [PATCH 037/327] Documentation for tests and changes --- osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs | 9 ++++++--- osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 38c66ef2e6..aadc033a7c 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -1,10 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using NUnit.Framework; -using osu.Framework.Allocation; -using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Rulesets; using osu.Game.Screens; @@ -16,6 +13,9 @@ namespace osu.Game.Tests.Visual [TestFixture] public class TestCaseBackgroundScreenBeatmap : TestCasePlayer { + /// + /// Check if the fade container is properly being faded when screen dim is enabled. + /// [Test] public void EnableUserDimTest() { @@ -24,6 +24,9 @@ namespace osu.Game.Tests.Visual AddAssert("Check screen dim", () => ((DimAccessiblePlayer)Player).AssertDimState()); } + /// + /// Check if the fade container is properly being reset when screen dim is disabled. + /// [Test] public void DisableUserDimTest() { diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index dbfce3e628..9b79393092 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -41,6 +41,7 @@ namespace osu.Game.Screens.Play public override void OnEntering(IScreen last) { + // We need to update on dim here because player still needs to know if it needs to dim the storyboard base.OnEntering(last); DimLevel.ValueChanged += _ => UpdateBackgroundElements(); BlurLevel.ValueChanged += _ => UpdateBackgroundElements(); From 53b7fdd834717f15776710018a8f6824796f58c5 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 15 Feb 2019 16:57:53 +0900 Subject: [PATCH 038/327] Clean up test code and unused includes --- osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index be0d18f59e..9764bed971 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -11,13 +11,12 @@ using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; -using osuTK; namespace osu.Game.Screens.Backgrounds { public class BackgroundScreenBeatmap : BlurrableBackgroundScreen { - protected WorkingBeatmap beatmap; + private WorkingBeatmap beatmap; protected Bindable DimLevel; public Bindable UpdateDim; From fcc3cf3b7e6fd44d634ba6e43a46671a8e195b7d Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 15 Feb 2019 17:21:47 +0900 Subject: [PATCH 039/327] Remove extra comma --- osu.Game/Configuration/OsuConfigManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 747dc7ddeb..613efe1801 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -170,6 +170,6 @@ namespace osu.Game.Configuration ScalingPositionY, ScalingSizeX, ScalingSizeY, - UIScale, + UIScale } } From 57fcdf9a0b44081e1c77a572f1e606e26b5c0ace Mon Sep 17 00:00:00 2001 From: miterosan Date: Fri, 15 Feb 2019 23:47:22 +0100 Subject: [PATCH 040/327] Improve the buildscript --- .gitignore | 5 +++-- .vscode/launch.json | 14 ++++++++++++++ build.ps1 | 13 ++++++++----- build.cake => build/build.cake | 20 +++++++------------- {tools => build}/cakebuild.csproj | 0 5 files changed, 32 insertions(+), 20 deletions(-) rename build.cake => build/build.cake (77%) rename {tools => build}/cakebuild.csproj (100%) diff --git a/.gitignore b/.gitignore index f95a04e517..6186cb870d 100644 --- a/.gitignore +++ b/.gitignore @@ -11,8 +11,9 @@ *.userprefs ### Cake ### -tools/* -!tools/cakebuild.csproj +tools/** +build/tools/** + # Build results bin/[Dd]ebug/ diff --git a/.vscode/launch.json b/.vscode/launch.json index 10c6f02314..c3306c2db7 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -68,6 +68,20 @@ } }, "console": "internalConsole" + }, + { + "name": "Cake: Debug Script", + "type": "coreclr", + "request": "launch", + "program": "${workspaceRoot}/build/tools/Cake.CoreCLR/0.30.0/Cake.dll", + "args": [ + "${workspaceRoot}/build/build.cake", + "--debug", + "--verbosity=diagnostic" + ], + "cwd": "${workspaceRoot}/build", + "stopAtEntry": true, + "externalConsole": false } ] } diff --git a/build.ps1 b/build.ps1 index 9968673c90..c6a0bf6d4a 100644 --- a/build.ps1 +++ b/build.ps1 @@ -41,27 +41,28 @@ Param( [switch]$ShowDescription, [Alias("WhatIf", "Noop")] [switch]$DryRun, - [Parameter(Position=0,Mandatory=$false,ValueFromRemainingArguments=$true)] + [Parameter(Position = 0, Mandatory = $false, ValueFromRemainingArguments = $true)] [string[]]$ScriptArgs ) Write-Host "Preparing to run build script..." # Determine the script root for resolving other paths. -if(!$PSScriptRoot){ +if(!$PSScriptRoot) { $PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent } # Resolve the paths for resources used for debugging. -$TOOLS_DIR = Join-Path $PSScriptRoot "tools" -$CAKE_CSPROJ = Join-Path $TOOLS_DIR "cakebuild.csproj" +$BUILD_DIR = Join-Path $PSScriptRoot "build" +$TOOLS_DIR = Join-Path $BUILD_DIR "tools" +$CAKE_CSPROJ = Join-Path $BUILD_DIR "cakebuild.csproj" # Install the required tools locally. Write-Host "Restoring cake tools..." Invoke-Expression "dotnet restore `"$CAKE_CSPROJ`" --packages `"$TOOLS_DIR`"" | Out-Null # Find the Cake executable -$CAKE_EXECUTABLE = (Get-ChildItem -Path ./tools/cake.coreclr/ -Filter Cake.dll -Recurse).FullName +$CAKE_EXECUTABLE = (Get-ChildItem -Path "$TOOLS_DIR/cake.coreclr/" -Filter Cake.dll -Recurse).FullName # Build Cake arguments $cakeArguments = @("$Script"); @@ -75,5 +76,7 @@ $cakeArguments += $ScriptArgs # Start Cake Write-Host "Running build script..." +Push-Location -Path $BUILD_DIR Invoke-Expression "dotnet `"$CAKE_EXECUTABLE`" $cakeArguments" +Pop-Location exit $LASTEXITCODE diff --git a/build.cake b/build/build.cake similarity index 77% rename from build.cake rename to build/build.cake index bc7dfafb8c..411adea7dd 100644 --- a/build.cake +++ b/build/build.cake @@ -1,6 +1,7 @@ #addin "nuget:?package=CodeFileSanity&version=0.0.21" #addin "nuget:?package=JetBrains.ReSharper.CommandLineTools&version=2018.2.2" #tool "nuget:?package=NVika.MSBuild&version=1.0.1" +var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); /////////////////////////////////////////////////////////////////////////////// // ARGUMENTS @@ -9,30 +10,25 @@ var target = Argument("target", "Build"); var configuration = Argument("configuration", "Release"); -var osuSolution = new FilePath("./osu.sln"); +var rootDirectory = new DirectoryPath(".."); +var desktopProject = rootDirectory.CombineWithFilePath("osu.Desktop/osu.Desktop.csproj"); +var solution = rootDirectory.CombineWithFilePath("osu.sln"); /////////////////////////////////////////////////////////////////////////////// // TASKS /////////////////////////////////////////////////////////////////////////////// -Task("Restore") - .Does(() => { - DotNetCoreRestore(osuSolution.FullPath); - }); - Task("Compile") - .IsDependentOn("Restore") .Does(() => { - DotNetCoreBuild(osuSolution.FullPath, new DotNetCoreBuildSettings { + DotNetCoreBuild(solution.FullPath, new DotNetCoreBuildSettings { Configuration = configuration, - NoRestore = true, }); }); Task("Test") .IsDependentOn("Compile") .Does(() => { - var testAssemblies = GetFiles("**/*.Tests/bin/**/*.Tests.dll"); + var testAssemblies = GetFiles(rootDirectory + "/**/*.Tests/bin/**/*.Tests.dll"); DotNetCoreVSTest(testAssemblies, new DotNetCoreVSTestSettings { Logger = AppVeyor.IsRunningOnAppVeyor ? "Appveyor" : $"trx", @@ -46,9 +42,7 @@ Task("InspectCode") .WithCriteria(IsRunningOnWindows()) .IsDependentOn("Compile") .Does(() => { - var nVikaToolPath = GetFiles("./tools/NVika.MSBuild.*/tools/NVika.exe").First(); - - InspectCode(osuSolution, new InspectCodeSettings { + InspectCode(solution, new InspectCodeSettings { CachesHome = "inspectcode", OutputFile = "inspectcodereport.xml", }); diff --git a/tools/cakebuild.csproj b/build/cakebuild.csproj similarity index 100% rename from tools/cakebuild.csproj rename to build/cakebuild.csproj From ed67b580fa3bef31005fdb946e0e9a4ffc4e7845 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sat, 16 Feb 2019 00:02:08 +0100 Subject: [PATCH 041/327] Also apply the changes to build.sh --- build.sh | 1 + build/build.cake | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build.sh b/build.sh index caf1702f41..d2b88c65ae 100755 --- a/build.sh +++ b/build.sh @@ -6,6 +6,7 @@ echo "Preparing to run build script..." +cd build SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) TOOLS_DIR=$SCRIPT_DIR/tools CAKE_BINARY_PATH=$TOOLS_DIR/"cake.coreclr" diff --git a/build/build.cake b/build/build.cake index 411adea7dd..f27f443ee9 100644 --- a/build/build.cake +++ b/build/build.cake @@ -53,7 +53,7 @@ Task("InspectCode") Task("CodeFileSanity") .Does(() => { ValidateCodeSanity(new ValidateCodeSanitySettings { - RootDirectory = ".", + RootDirectory = rootDirectory.FullPath, IsAppveyorBuild = AppVeyor.IsRunningOnAppVeyor }); }); From c09346080f492714f850aac2f004553e24c76d27 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sat, 16 Feb 2019 14:51:20 +0100 Subject: [PATCH 042/327] Remove the unused desktop project variable --- build/build.cake | 1 - 1 file changed, 1 deletion(-) diff --git a/build/build.cake b/build/build.cake index f27f443ee9..81deeb3bc7 100644 --- a/build/build.cake +++ b/build/build.cake @@ -11,7 +11,6 @@ var target = Argument("target", "Build"); var configuration = Argument("configuration", "Release"); var rootDirectory = new DirectoryPath(".."); -var desktopProject = rootDirectory.CombineWithFilePath("osu.Desktop/osu.Desktop.csproj"); var solution = rootDirectory.CombineWithFilePath("osu.sln"); /////////////////////////////////////////////////////////////////////////////// From 97086342324789b333dcc01b5cad5bd4c170ce48 Mon Sep 17 00:00:00 2001 From: miterosan Date: Sun, 17 Feb 2019 13:57:14 +0100 Subject: [PATCH 043/327] Correct the path to the cakebuild.csproj. --- build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.sh b/build.sh index d2b88c65ae..8f1ef5b455 100755 --- a/build.sh +++ b/build.sh @@ -12,7 +12,7 @@ TOOLS_DIR=$SCRIPT_DIR/tools CAKE_BINARY_PATH=$TOOLS_DIR/"cake.coreclr" SCRIPT="build.cake" -CAKE_CSPROJ=$TOOLS_DIR/"cakebuild.csproj" +CAKE_CSPROJ=$SCRIPT_DIR/"cakebuild.csproj" # Parse arguments. CAKE_ARGUMENTS=() From 0a265c6d35ece031f0a4680b1896731b47cac026 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Feb 2019 11:54:25 +0900 Subject: [PATCH 044/327] Update osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs Co-Authored-By: nyquillerium --- osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 9764bed971..90b9a129d4 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -85,7 +85,7 @@ namespace osu.Game.Screens.Backgrounds if (UpdateDim) FadeContainer?.FadeColour(OsuColour.Gray(BackgroundOpacity), 800, Easing.OutQuint); else - FadeContainer?.FadeColour(OsuColour.Gray(1.0f), 800, Easing.InQuint); + FadeContainer?.FadeColour(OsuColour.Gray(1.0f), 800, Easing.OutQuint); } public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null) From df148f8787c1d743c0a4056a47111cba5a408468 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 18 Feb 2019 12:55:42 +0900 Subject: [PATCH 045/327] Fix background dim not being disabled on playerloader exit --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 1 + .../Screens/Backgrounds/BackgroundScreenBeatmap.cs | 12 +++--------- osu.Game/Screens/Play/Player.cs | 11 ++++++----- osu.Game/Screens/Play/PlayerLoader.cs | 1 + 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index aadc033a7c..a94f13b0b2 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -40,6 +40,7 @@ namespace osu.Game.Tests.Visual private class DimAccessiblePlayer : Player { protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); + public void EnableScreenDim() { Background.UpdateDim.Value = true; diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 90b9a129d4..6ea8899876 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -11,6 +11,7 @@ using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; +using osuTK.Graphics; namespace osu.Game.Screens.Backgrounds { @@ -20,7 +21,6 @@ namespace osu.Game.Screens.Backgrounds protected Bindable DimLevel; public Bindable UpdateDim; - protected float BackgroundOpacity => 1 - (float)DimLevel; protected Container FadeContainer; [BackgroundDependencyLoader] @@ -76,16 +76,15 @@ namespace osu.Game.Screens.Backgrounds public override bool OnExiting(IScreen last) { - UpdateDim.Value = false; return base.OnExiting(last); } private void updateBackgroundDim() { if (UpdateDim) - FadeContainer?.FadeColour(OsuColour.Gray(BackgroundOpacity), 800, Easing.OutQuint); + FadeContainer?.FadeColour(OsuColour.Gray(1 - (float)DimLevel), 800, Easing.OutQuint); else - FadeContainer?.FadeColour(OsuColour.Gray(1.0f), 800, Easing.OutQuint); + FadeContainer?.FadeColour(Color4.White, 800, Easing.OutQuint); } public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null) @@ -94,11 +93,6 @@ namespace osu.Game.Screens.Backgrounds UpdateDim = new Bindable(); } - public void EnableUserDim() - { - UpdateDim.Value = true; - } - public override bool Equals(BackgroundScreen other) { var otherBeatmapBackground = other as BackgroundScreenBeatmap; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e2decab69c..2526b2e3ab 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -248,7 +248,7 @@ namespace osu.Game.Screens.Play foreach (var mod in Beatmap.Value.Mods.Value.OfType()) mod.ApplyToScoreProcessor(ScoreProcessor); - Background?.EnableUserDim(); + Background.UpdateDim.Value = true; } private void applyRateFromMods() @@ -298,7 +298,7 @@ namespace osu.Game.Screens.Play if (RulesetContainer.ReplayScore == null) scoreManager.Import(score, true); - this.Push(CreateResults(score)); + this.Push(CreateResults(score)); onCompletionEvent = null; }); @@ -389,15 +389,16 @@ namespace osu.Game.Screens.Play { // In the case of replays, we may have changed the playback rate. applyRateFromMods(); - + Background.UpdateDim.Value = false; fadeOut(); return base.OnExiting(next); } if (LoadedBeatmapSuccessfully) + { pauseContainer?.Pause(); - - Background.UpdateDim.Value = false; + return true; + } return true; } diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index c55c05f61c..4bb126e0e2 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -242,6 +242,7 @@ namespace osu.Game.Screens.Play content.ScaleTo(0.7f, 150, Easing.InQuint); this.FadeOut(150); cancelLoad(); + Background.UpdateDim.Value = false; return base.OnExiting(next); } From a8faa942a6f074e1f0b5e16886e309e648ed37b5 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 12 Feb 2019 16:01:25 +0900 Subject: [PATCH 046/327] Implement new difficulty calculator structure --- .../CatchDifficultyCalculatorTest.cs | 2 +- osu.Game.Rulesets.Catch/CatchRuleset.cs | 2 +- ....cs => CatchLegacyDifficultyCalculator.cs} | 4 +- .../ManiaDifficultyCalculatorTest.cs | 2 +- ....cs => ManiaLegacyDifficultyCalculator.cs} | 4 +- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 2 +- .../OsuDifficultyCalculatorTest.cs | 2 +- ...or.cs => OsuLegacyDifficultyCalculator.cs} | 4 +- osu.Game.Rulesets.Osu/OsuRuleset.cs | 2 +- .../TaikoDifficultyCalculatorTest.cs | 2 +- ....cs => TaikoLegacyDifficultyCalculator.cs} | 4 +- osu.Game.Rulesets.Taiko/TaikoRuleset.cs | 2 +- ...DifficultyAdjustmentModCombinationsTest.cs | 16 +-- osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 2 +- .../Difficulty/DifficultyAttributes.cs | 8 +- .../Difficulty/DifficultyCalculator.cs | 104 +++++++++++------ .../Difficulty/LegacyDifficultyCalculator.cs | 107 ++++++++++++++++++ .../Preprocessing/DifficultyHitObject.cs | 32 ++++++ osu.Game/Rulesets/Difficulty/Skills/Skill.cs | 103 +++++++++++++++++ osu.Game/Rulesets/Difficulty/Utils/History.cs | 86 ++++++++++++++ osu.Game/Rulesets/Ruleset.cs | 2 +- .../Beatmaps/DifficultyCalculatorTest.cs | 2 +- 22 files changed, 430 insertions(+), 64 deletions(-) rename osu.Game.Rulesets.Catch/Difficulty/{CatchDifficultyCalculator.cs => CatchLegacyDifficultyCalculator.cs} (97%) rename osu.Game.Rulesets.Mania/Difficulty/{ManiaDifficultyCalculator.cs => ManiaLegacyDifficultyCalculator.cs} (97%) rename osu.Game.Rulesets.Osu/Difficulty/{OsuDifficultyCalculator.cs => OsuLegacyDifficultyCalculator.cs} (95%) rename osu.Game.Rulesets.Taiko/Difficulty/{TaikoDifficultyCalculator.cs => TaikoLegacyDifficultyCalculator.cs} (97%) create mode 100644 osu.Game/Rulesets/Difficulty/LegacyDifficultyCalculator.cs create mode 100644 osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs create mode 100644 osu.Game/Rulesets/Difficulty/Skills/Skill.cs create mode 100644 osu.Game/Rulesets/Difficulty/Utils/History.cs diff --git a/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs index 91bc537902..84f4fd9c99 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Catch.Tests public void Test(double expected, string name) => base.Test(expected, name); - protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchDifficultyCalculator(new CatchRuleset(), beatmap); + protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchLegacyDifficultyCalculator(new CatchRuleset(), beatmap); protected override Ruleset CreateRuleset() => new CatchRuleset(); } diff --git a/osu.Game.Rulesets.Catch/CatchRuleset.cs b/osu.Game.Rulesets.Catch/CatchRuleset.cs index a69070e93e..9b2bbc9bf7 100644 --- a/osu.Game.Rulesets.Catch/CatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/CatchRuleset.cs @@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Catch public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_fruits_o }; - public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchDifficultyCalculator(this, beatmap); + public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchLegacyDifficultyCalculator(this, beatmap); public override int? LegacyID => 2; diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchLegacyDifficultyCalculator.cs similarity index 97% rename from osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs rename to osu.Game.Rulesets.Catch/Difficulty/CatchLegacyDifficultyCalculator.cs index a0b813478d..0a0897d97b 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchLegacyDifficultyCalculator.cs @@ -12,7 +12,7 @@ using osu.Game.Rulesets.Catch.UI; namespace osu.Game.Rulesets.Catch.Difficulty { - public class CatchDifficultyCalculator : DifficultyCalculator + public class CatchLegacyDifficultyCalculator : LegacyDifficultyCalculator { /// /// In milliseconds. For difficulty calculation we will only look at the highest strain value in each time interval of size STRAIN_STEP. @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty private const double star_scaling_factor = 0.145; - public CatchDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) + public CatchLegacyDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) { } diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs index 05e2df796c..ef660b9ea8 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Mania.Tests public void Test(double expected, string name) => base.Test(expected, name); - protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new ManiaDifficultyCalculator(new ManiaRuleset(), beatmap); + protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new ManiaLegacyDifficultyCalculator(new ManiaRuleset(), beatmap); protected override Ruleset CreateRuleset() => new ManiaRuleset(); } diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaLegacyDifficultyCalculator.cs similarity index 97% rename from osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs rename to osu.Game.Rulesets.Mania/Difficulty/ManiaLegacyDifficultyCalculator.cs index b8588dbce2..02b03aca5d 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaLegacyDifficultyCalculator.cs @@ -13,7 +13,7 @@ using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Mania.Difficulty { - internal class ManiaDifficultyCalculator : DifficultyCalculator + internal class ManiaLegacyDifficultyCalculator : LegacyDifficultyCalculator { private const double star_scaling_factor = 0.018; @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty private readonly bool isForCurrentRuleset; - public ManiaDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) + public ManiaLegacyDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) { isForCurrentRuleset = beatmap.BeatmapInfo.Ruleset.Equals(ruleset.RulesetInfo); diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 57728dd134..7a2a539a9d 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -156,7 +156,7 @@ namespace osu.Game.Rulesets.Mania public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_mania_o }; - public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new ManiaDifficultyCalculator(this, beatmap); + public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new ManiaLegacyDifficultyCalculator(this, beatmap); public override int? LegacyID => 3; diff --git a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs index e55dc1f902..cc46ec7be3 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Tests public void Test(double expected, string name) => base.Test(expected, name); - protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset(), beatmap); + protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuLegacyDifficultyCalculator(new OsuRuleset(), beatmap); protected override Ruleset CreateRuleset() => new OsuRuleset(); } diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuLegacyDifficultyCalculator.cs similarity index 95% rename from osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs rename to osu.Game.Rulesets.Osu/Difficulty/OsuLegacyDifficultyCalculator.cs index 3d0a1dc266..d01f75df6b 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuLegacyDifficultyCalculator.cs @@ -13,12 +13,12 @@ using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Difficulty { - public class OsuDifficultyCalculator : DifficultyCalculator + public class OsuLegacyDifficultyCalculator : LegacyDifficultyCalculator { private const int section_length = 400; private const double difficulty_multiplier = 0.0675; - public OsuDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) + public OsuLegacyDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) { } diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 12d0a28a8f..6fa1532580 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -132,7 +132,7 @@ namespace osu.Game.Rulesets.Osu public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_osu_o }; - public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(this, beatmap); + public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuLegacyDifficultyCalculator(this, beatmap); public override PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => new OsuPerformanceCalculator(this, beatmap, score); diff --git a/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs index 299f84fb1f..e00f3da0b7 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Taiko.Tests public void Test(double expected, string name) => base.Test(expected, name); - protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoDifficultyCalculator(new TaikoRuleset(), beatmap); + protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoLegacyDifficultyCalculator(new TaikoRuleset(), beatmap); protected override Ruleset CreateRuleset() => new TaikoRuleset(); } diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoLegacyDifficultyCalculator.cs similarity index 97% rename from osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs rename to osu.Game.Rulesets.Taiko/Difficulty/TaikoLegacyDifficultyCalculator.cs index 2322446666..650b367e34 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoLegacyDifficultyCalculator.cs @@ -12,7 +12,7 @@ using osu.Game.Rulesets.Taiko.Objects; namespace osu.Game.Rulesets.Taiko.Difficulty { - internal class TaikoDifficultyCalculator : DifficultyCalculator + internal class TaikoLegacyDifficultyCalculator : LegacyDifficultyCalculator { private const double star_scaling_factor = 0.04125; @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty /// private const double decay_weight = 0.9; - public TaikoDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) + public TaikoLegacyDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) { } diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs index 7851a2f919..77a53858fe 100644 --- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs @@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Taiko public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_taiko_o }; - public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoDifficultyCalculator(this, beatmap); + public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoLegacyDifficultyCalculator(this, beatmap); public override PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => new TaikoPerformanceCalculator(this, beatmap, score); diff --git a/osu.Game.Tests/NonVisual/DifficultyAdjustmentModCombinationsTest.cs b/osu.Game.Tests/NonVisual/DifficultyAdjustmentModCombinationsTest.cs index 795c2244a2..f57f25e1ff 100644 --- a/osu.Game.Tests/NonVisual/DifficultyAdjustmentModCombinationsTest.cs +++ b/osu.Game.Tests/NonVisual/DifficultyAdjustmentModCombinationsTest.cs @@ -15,7 +15,7 @@ namespace osu.Game.Tests.NonVisual [Test] public void TestNoMods() { - var combinations = new TestDifficultyCalculator().CreateDifficultyAdjustmentModCombinations(); + var combinations = new TestLegacyDifficultyCalculator().CreateDifficultyAdjustmentModCombinations(); Assert.AreEqual(1, combinations.Length); Assert.IsTrue(combinations[0] is ModNoMod); @@ -24,7 +24,7 @@ namespace osu.Game.Tests.NonVisual [Test] public void TestSingleMod() { - var combinations = new TestDifficultyCalculator(new ModA()).CreateDifficultyAdjustmentModCombinations(); + var combinations = new TestLegacyDifficultyCalculator(new ModA()).CreateDifficultyAdjustmentModCombinations(); Assert.AreEqual(2, combinations.Length); Assert.IsTrue(combinations[0] is ModNoMod); @@ -34,7 +34,7 @@ namespace osu.Game.Tests.NonVisual [Test] public void TestDoubleMod() { - var combinations = new TestDifficultyCalculator(new ModA(), new ModB()).CreateDifficultyAdjustmentModCombinations(); + var combinations = new TestLegacyDifficultyCalculator(new ModA(), new ModB()).CreateDifficultyAdjustmentModCombinations(); Assert.AreEqual(4, combinations.Length); Assert.IsTrue(combinations[0] is ModNoMod); @@ -49,7 +49,7 @@ namespace osu.Game.Tests.NonVisual [Test] public void TestIncompatibleMods() { - var combinations = new TestDifficultyCalculator(new ModA(), new ModIncompatibleWithA()).CreateDifficultyAdjustmentModCombinations(); + var combinations = new TestLegacyDifficultyCalculator(new ModA(), new ModIncompatibleWithA()).CreateDifficultyAdjustmentModCombinations(); Assert.AreEqual(3, combinations.Length); Assert.IsTrue(combinations[0] is ModNoMod); @@ -60,7 +60,7 @@ namespace osu.Game.Tests.NonVisual [Test] public void TestDoubleIncompatibleMods() { - var combinations = new TestDifficultyCalculator(new ModA(), new ModB(), new ModIncompatibleWithA(), new ModIncompatibleWithAAndB()).CreateDifficultyAdjustmentModCombinations(); + var combinations = new TestLegacyDifficultyCalculator(new ModA(), new ModB(), new ModIncompatibleWithA(), new ModIncompatibleWithAAndB()).CreateDifficultyAdjustmentModCombinations(); Assert.AreEqual(8, combinations.Length); Assert.IsTrue(combinations[0] is ModNoMod); @@ -83,7 +83,7 @@ namespace osu.Game.Tests.NonVisual [Test] public void TestIncompatibleThroughBaseType() { - var combinations = new TestDifficultyCalculator(new ModAofA(), new ModIncompatibleWithAofA()).CreateDifficultyAdjustmentModCombinations(); + var combinations = new TestLegacyDifficultyCalculator(new ModAofA(), new ModIncompatibleWithAofA()).CreateDifficultyAdjustmentModCombinations(); Assert.AreEqual(3, combinations.Length); Assert.IsTrue(combinations[0] is ModNoMod); @@ -136,9 +136,9 @@ namespace osu.Game.Tests.NonVisual public override Type[] IncompatibleMods => new[] { typeof(ModA), typeof(ModB) }; } - private class TestDifficultyCalculator : DifficultyCalculator + private class TestLegacyDifficultyCalculator : LegacyDifficultyCalculator { - public TestDifficultyCalculator(params Mod[] mods) + public TestLegacyDifficultyCalculator(params Mod[] mods) : base(null, null) { DifficultyAdjustmentMods = mods; diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index 0aa1697bf8..eb9e221ca4 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new DummyBeatmapConverter { Beatmap = beatmap }; - public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => null; + public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => null; public override string Description => "dummy"; diff --git a/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs b/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs index d7654462d5..b1a88b8abd 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs @@ -8,7 +8,13 @@ namespace osu.Game.Rulesets.Difficulty public class DifficultyAttributes { public readonly Mod[] Mods; - public readonly double StarRating; + + public double StarRating; + + public DifficultyAttributes(Mod[] mods) + { + Mods = mods; + } public DifficultyAttributes(Mod[] mods, double starRating) { diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index 818d24508a..d7ae527bb1 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -1,56 +1,67 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; using System.Linq; -using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Framework.Timing; using osu.Game.Beatmaps; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Difficulty.Skills; using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Difficulty { - public abstract class DifficultyCalculator + public abstract class DifficultyCalculator : LegacyDifficultyCalculator { - private readonly Ruleset ruleset; - private readonly WorkingBeatmap beatmap; + /// + /// The length of each strain section. + /// + protected virtual int SectionLength => 400; protected DifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) + : base(ruleset, beatmap) { - this.ruleset = ruleset; - this.beatmap = beatmap; } - /// - /// Calculates the difficulty of the beatmap using a specific mod combination. - /// - /// The mods that should be applied to the beatmap. - /// A structure describing the difficulty of the beatmap. - public DifficultyAttributes Calculate(params Mod[] mods) + protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate) { - beatmap.Mods.Value = mods; - IBeatmap playableBeatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo); + var attributes = CreateDifficultyAttributes(mods); - var clock = new StopwatchClock(); - mods.OfType().ForEach(m => m.ApplyToClock(clock)); + if (!beatmap.HitObjects.Any()) + return attributes; - return Calculate(playableBeatmap, mods, clock.Rate); - } + var difficultyHitObjects = CreateDifficultyHitObjects(beatmap, timeRate).OrderBy(h => h.BaseObject.StartTime).ToList(); + var skills = CreateSkills(); - /// - /// Calculates the difficulty of the beatmap using all mod combinations applicable to the beatmap. - /// - /// A collection of structures describing the difficulty of the beatmap for each mod combination. - public IEnumerable CalculateAll() - { - foreach (var combination in CreateDifficultyAdjustmentModCombinations()) + double sectionLength = SectionLength * timeRate; + + // The first object doesn't generate a strain, so we begin with an incremented section end + double currentSectionEnd = Math.Ceiling(beatmap.HitObjects.First().StartTime / sectionLength) * sectionLength; + + foreach (DifficultyHitObject h in difficultyHitObjects) { - if (combination is MultiMod multi) - yield return Calculate(multi.Mods); - else - yield return Calculate(combination); + while (h.BaseObject.StartTime > currentSectionEnd) + { + foreach (Skill s in skills) + { + s.SaveCurrentPeak(); + s.StartNewSectionFrom(currentSectionEnd); + } + + currentSectionEnd += sectionLength; + } + + foreach (Skill s in skills) + s.Process(h); } + + // The peak strain will not be saved for the last section in the above loop + foreach (Skill s in skills) + s.SaveCurrentPeak(); + + PopulateAttributes(attributes, beatmap, skills, timeRate); + + return attributes; } /// @@ -96,12 +107,33 @@ namespace osu.Game.Rulesets.Difficulty protected virtual Mod[] DifficultyAdjustmentMods => Array.Empty(); /// - /// Calculates the difficulty of a using a specific combination. + /// Populates after difficulty has been processed. /// - /// The to compute the difficulty for. - /// The s that should be applied. + /// The to populate with information about the difficulty of . + /// The whose difficulty was processed. + /// The skills which processed the difficulty. /// The rate of time in . - /// A structure containing the difficulty attributes. - protected abstract DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate); + protected abstract void PopulateAttributes(DifficultyAttributes attributes, IBeatmap beatmap, Skill[] skills, double timeRate); + + /// + /// Enumerates s to be processed from s in the . + /// + /// The providing the s to enumerate. + /// The rate of time in . + /// The enumerated s. + protected abstract IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double timeRate); + + /// + /// Creates the s to calculate the difficulty of s. + /// + /// The s. + protected abstract Skill[] CreateSkills(); + + /// + /// Creates an empty . + /// + /// The s which difficulty is being processed with. + /// The empty . + protected abstract DifficultyAttributes CreateDifficultyAttributes(Mod[] mods); } } diff --git a/osu.Game/Rulesets/Difficulty/LegacyDifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/LegacyDifficultyCalculator.cs new file mode 100644 index 0000000000..15565ef847 --- /dev/null +++ b/osu.Game/Rulesets/Difficulty/LegacyDifficultyCalculator.cs @@ -0,0 +1,107 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using System.Linq; +using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Timing; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Mods; + +namespace osu.Game.Rulesets.Difficulty +{ + public abstract class LegacyDifficultyCalculator + { + private readonly Ruleset ruleset; + private readonly WorkingBeatmap beatmap; + + protected LegacyDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) + { + this.ruleset = ruleset; + this.beatmap = beatmap; + } + + /// + /// Calculates the difficulty of the beatmap using a specific mod combination. + /// + /// The mods that should be applied to the beatmap. + /// A structure describing the difficulty of the beatmap. + public DifficultyAttributes Calculate(params Mod[] mods) + { + beatmap.Mods.Value = mods; + IBeatmap playableBeatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo); + + var clock = new StopwatchClock(); + mods.OfType().ForEach(m => m.ApplyToClock(clock)); + + return Calculate(playableBeatmap, mods, clock.Rate); + } + + /// + /// Calculates the difficulty of the beatmap using all mod combinations applicable to the beatmap. + /// + /// A collection of structures describing the difficulty of the beatmap for each mod combination. + public IEnumerable CalculateAll() + { + foreach (var combination in CreateDifficultyAdjustmentModCombinations()) + { + if (combination is MultiMod multi) + yield return Calculate(multi.Mods); + else + yield return Calculate(combination); + } + } + + /// + /// Creates all combinations which adjust the difficulty. + /// + public Mod[] CreateDifficultyAdjustmentModCombinations() + { + return createDifficultyAdjustmentModCombinations(Enumerable.Empty(), DifficultyAdjustmentMods).ToArray(); + + IEnumerable createDifficultyAdjustmentModCombinations(IEnumerable currentSet, Mod[] adjustmentSet, int currentSetCount = 0, int adjustmentSetStart = 0) + { + switch (currentSetCount) + { + case 0: + // Initial-case: Empty current set + yield return new ModNoMod(); + break; + case 1: + yield return currentSet.Single(); + break; + default: + yield return new MultiMod(currentSet.ToArray()); + break; + } + + // Apply mods in the adjustment set recursively. Using the entire adjustment set would result in duplicate multi-mod mod + // combinations in further recursions, so a moving subset is used to eliminate this effect + for (int i = adjustmentSetStart; i < adjustmentSet.Length; i++) + { + var adjustmentMod = adjustmentSet[i]; + if (currentSet.Any(c => c.IncompatibleMods.Any(m => m.IsInstanceOfType(adjustmentMod)))) + continue; + + foreach (var combo in createDifficultyAdjustmentModCombinations(currentSet.Append(adjustmentMod), adjustmentSet, currentSetCount + 1, i + 1)) + yield return combo; + } + } + } + + /// + /// Retrieves all s which adjust the difficulty. + /// + protected virtual Mod[] DifficultyAdjustmentMods => Array.Empty(); + + /// + /// Calculates the difficulty of a using a specific combination. + /// + /// The to compute the difficulty for. + /// The s that should be applied. + /// The rate of time in . + /// A structure containing the difficulty attributes. + protected abstract DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate); + } +} diff --git a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs new file mode 100644 index 0000000000..77c9b7e47f --- /dev/null +++ b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs @@ -0,0 +1,32 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Rulesets.Objects; + +namespace osu.Game.Rulesets.Difficulty.Preprocessing +{ + public class DifficultyHitObject + { + /// + /// Milliseconds elapsed since the of the previous . + /// + public double DeltaTime { get; private set; } + + /// + /// The this refers to. + /// + public readonly HitObject BaseObject; + + /// + /// The previous to . + /// + public readonly HitObject LastObject; + + public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double timeRate) + { + BaseObject = hitObject; + LastObject = lastObject; + DeltaTime = (hitObject.StartTime - lastObject.StartTime) / timeRate; + } + } +} diff --git a/osu.Game/Rulesets/Difficulty/Skills/Skill.cs b/osu.Game/Rulesets/Difficulty/Skills/Skill.cs new file mode 100644 index 0000000000..fa7aa8f637 --- /dev/null +++ b/osu.Game/Rulesets/Difficulty/Skills/Skill.cs @@ -0,0 +1,103 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Difficulty.Utils; + +namespace osu.Game.Rulesets.Difficulty.Skills +{ + /// + /// Used to processes strain values of s, keep track of strain levels caused by the processed objects + /// and to calculate a final difficulty value representing the difficulty of hitting all the processed objects. + /// + public abstract class Skill + { + /// + /// Strain values are multiplied by this number for the given skill. Used to balance the value of different skills between each other. + /// + protected abstract double SkillMultiplier { get; } + + /// + /// Determines how quickly strain decays for the given skill. + /// For example a value of 0.15 indicates that strain decays to 15% of its original value in one second. + /// + protected abstract double StrainDecayBase { get; } + + /// + /// The weight by which each strain value decays. + /// + protected virtual double DecayWeight => 0.9; + + /// + /// s that were processed previously. They can affect the strain values of the following objects. + /// + protected readonly History Previous = new History(2); // Contained objects not used yet + + private double currentStrain = 1; // We keep track of the strain level at all times throughout the beatmap. + private double currentSectionPeak = 1; // We also keep track of the peak strain level in the current section. + private readonly List strainPeaks = new List(); + + /// + /// Process a and update current strain values accordingly. + /// + public void Process(DifficultyHitObject current) + { + currentStrain *= strainDecay(current.DeltaTime); + currentStrain += StrainValueOf(current) * SkillMultiplier; + + currentSectionPeak = Math.Max(currentStrain, currentSectionPeak); + + Previous.Push(current); + } + + /// + /// Saves the current peak strain level to the list of strain peaks, which will be used to calculate an overall difficulty. + /// + public void SaveCurrentPeak() + { + if (Previous.Count > 0) + strainPeaks.Add(currentSectionPeak); + } + + /// + /// Sets the initial strain level for a new section. + /// + /// The beginning of the new section in milliseconds. + public void StartNewSectionFrom(double offset) + { + // The maximum strain of the new section is not zero by default, strain decays as usual regardless of section boundaries. + // This means we need to capture the strain level at the beginning of the new section, and use that as the initial peak level. + if (Previous.Count > 0) + currentSectionPeak = currentStrain * strainDecay(offset - Previous[0].BaseObject.StartTime); + } + + /// + /// Returns the calculated difficulty value representing all processed s. + /// + public double DifficultyValue() + { + strainPeaks.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain. + + double difficulty = 0; + double weight = 1; + + // Difficulty is the weighted sum of the highest strains from every section. + foreach (double strain in strainPeaks) + { + difficulty += strain * weight; + weight *= DecayWeight; + } + + return difficulty; + } + + /// + /// Calculates the strain value of a . This value is affected by previously processed objects. + /// + protected abstract double StrainValueOf(DifficultyHitObject current); + + private double strainDecay(double ms) => Math.Pow(StrainDecayBase, ms / 1000); + } +} diff --git a/osu.Game/Rulesets/Difficulty/Utils/History.cs b/osu.Game/Rulesets/Difficulty/Utils/History.cs new file mode 100644 index 0000000000..d6647d5119 --- /dev/null +++ b/osu.Game/Rulesets/Difficulty/Utils/History.cs @@ -0,0 +1,86 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace osu.Game.Rulesets.Difficulty.Utils +{ + /// + /// An indexed stack with Push() only, which disposes items at the bottom after the capacity is full. + /// Indexing starts at the top of the stack. + /// + public class History : IEnumerable + { + public int Count { get; private set; } + + private readonly T[] array; + private readonly int capacity; + private int marker; // Marks the position of the most recently added item. + + /// + /// Initializes a new instance of the History class that is empty and has the specified capacity. + /// + /// The number of items the History can hold. + public History(int capacity) + { + if (capacity < 0) + throw new ArgumentOutOfRangeException(); + + this.capacity = capacity; + array = new T[capacity]; + marker = capacity; // Set marker to the end of the array, outside of the indexed range by one. + } + + /// + /// The most recently added item is returned at index 0. + /// + public T this[int i] + { + get + { + if (i < 0 || i > Count - 1) + throw new IndexOutOfRangeException(); + + i += marker; + if (i > capacity - 1) + i -= capacity; + + return array[i]; + } + } + + /// + /// Adds the item as the most recent one in the history. + /// The oldest item is disposed if the history is full. + /// + public void Push(T item) // Overwrite the oldest item instead of shifting every item by one with every addition. + { + if (marker == 0) + marker = capacity - 1; + else + --marker; + + array[marker] = item; + + if (Count < capacity) + ++Count; + } + + /// + /// Returns an enumerator which enumerates items in the history starting from the most recently added one. + /// + public IEnumerator GetEnumerator() + { + for (int i = marker; i < capacity; ++i) + yield return array[i]; + + if (Count == capacity) + for (int i = 0; i < marker; ++i) + yield return array[i]; + } + + IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); + } +} diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index ffab0abebf..75643a85dc 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -71,7 +71,7 @@ namespace osu.Game.Rulesets /// The . public virtual IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => null; - public abstract DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap); + public abstract LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap); public virtual PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => null; diff --git a/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs b/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs index 108fa8ff71..85ae1958ef 100644 --- a/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs +++ b/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs @@ -44,7 +44,7 @@ namespace osu.Game.Tests.Beatmaps return Assembly.LoadFrom(Path.Combine(localPath, $"{ResourceAssembly}.dll")).GetManifestResourceStream($@"{ResourceAssembly}.Resources.{name}"); } - protected abstract DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap); + protected abstract LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap); protected abstract Ruleset CreateRuleset(); } From 8eba94e8c9a31300877fd7b5b8aa895571a35369 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Feb 2019 14:46:32 +0900 Subject: [PATCH 047/327] Implement new difficulty calculator for Rulesets.Catch --- .../CatchDifficultyCalculatorTest.cs | 2 +- osu.Game.Rulesets.Catch/CatchRuleset.cs | 2 +- .../Difficulty/CatchDifficultyAttributes.cs | 4 +- .../Difficulty/CatchDifficultyCalculator.cs | 81 ++++++++++ .../Difficulty/CatchDifficultyHitObject.cs | 130 --------------- .../CatchLegacyDifficultyCalculator.cs | 148 ------------------ .../Preprocessing/CatchDifficultyHitObject.cs | 68 ++++++++ .../Difficulty/Skills/Movement.cs | 63 ++++++++ .../Objects/CatchHitObject.cs | 5 + 9 files changed, 221 insertions(+), 282 deletions(-) create mode 100644 osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs delete mode 100644 osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyHitObject.cs delete mode 100644 osu.Game.Rulesets.Catch/Difficulty/CatchLegacyDifficultyCalculator.cs create mode 100644 osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs create mode 100644 osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs diff --git a/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs index 84f4fd9c99..61fb4ca5d1 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Catch.Tests public void Test(double expected, string name) => base.Test(expected, name); - protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchLegacyDifficultyCalculator(new CatchRuleset(), beatmap); + protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchDifficultyCalculator(new CatchRuleset(), beatmap); protected override Ruleset CreateRuleset() => new CatchRuleset(); } diff --git a/osu.Game.Rulesets.Catch/CatchRuleset.cs b/osu.Game.Rulesets.Catch/CatchRuleset.cs index 9b2bbc9bf7..c539a47897 100644 --- a/osu.Game.Rulesets.Catch/CatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/CatchRuleset.cs @@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Catch public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_fruits_o }; - public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchLegacyDifficultyCalculator(this, beatmap); + public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchDifficultyCalculator(this, beatmap); public override int? LegacyID => 2; diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs index c6518cbf8a..8669543841 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs @@ -11,8 +11,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty public double ApproachRate; public int MaxCombo; - public CatchDifficultyAttributes(Mod[] mods, double starRating) - : base(mods, starRating) + public CatchDifficultyAttributes(Mod[] mods) + : base(mods) { } } diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs new file mode 100644 index 0000000000..99702235d5 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -0,0 +1,81 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using System.Linq; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Catch.Difficulty.Preprocessing; +using osu.Game.Rulesets.Catch.Difficulty.Skills; +using osu.Game.Rulesets.Catch.Objects; +using osu.Game.Rulesets.Catch.UI; +using osu.Game.Rulesets.Difficulty; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Difficulty.Skills; +using osu.Game.Rulesets.Mods; + +namespace osu.Game.Rulesets.Catch.Difficulty +{ + public class CatchDifficultyCalculator : DifficultyCalculator + { + private const double star_scaling_factor = 0.145; + + protected override int SectionLength => 750; + + private readonly float halfCatchWidth; + + public CatchDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) + : base(ruleset, beatmap) + { + var catcher = new CatcherArea.Catcher(beatmap.BeatmapInfo.BaseDifficulty); + halfCatchWidth = catcher.CatchWidth * 0.5f; + } + + protected override void PopulateAttributes(DifficultyAttributes attributes, IBeatmap beatmap, Skill[] skills, double timeRate) + { + var catchAttributes = (CatchDifficultyAttributes)attributes; + + // this is the same as osu!, so there's potential to share the implementation... maybe + double preempt = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate; + + catchAttributes.StarRating = Math.Sqrt(skills[0].DifficultyValue()) * star_scaling_factor; + catchAttributes.ApproachRate = preempt > 1200.0 ? -(preempt - 1800.0) / 120.0 : -(preempt - 1200.0) / 150.0 + 5.0; + catchAttributes.MaxCombo = beatmap.HitObjects.Count(h => h is Fruit) + beatmap.HitObjects.OfType().SelectMany(j => j.NestedHitObjects).Count(h => !(h is TinyDroplet)); + } + + protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double timeRate) + { + CatchHitObject lastObject = null; + + foreach (var hitObject in beatmap.HitObjects.OfType()) + { + if (lastObject == null) + { + lastObject = hitObject; + continue; + } + + switch (hitObject) + { + // We want to only consider fruits that contribute to the combo. Droplets are addressed as accuracy and spinners are not relevant for "skill" calculations. + case Fruit fruit: + yield return new CatchDifficultyHitObject(fruit, lastObject, timeRate, halfCatchWidth); + break; + case JuiceStream _: + foreach (var nested in hitObject.NestedHitObjects.OfType().Where(o => !(o is TinyDroplet))) + yield return new CatchDifficultyHitObject(nested, lastObject, timeRate, halfCatchWidth); + break; + } + + lastObject = hitObject; + } + } + + protected override Skill[] CreateSkills() => new Skill[] + { + new Movement(), + }; + + protected override DifficultyAttributes CreateDifficultyAttributes(Mod[] mods) => new CatchDifficultyAttributes(mods); + } +} diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyHitObject.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyHitObject.cs deleted file mode 100644 index fb16e117b1..0000000000 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyHitObject.cs +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using osu.Game.Rulesets.Catch.Objects; -using osu.Game.Rulesets.Catch.UI; -using osuTK; - -namespace osu.Game.Rulesets.Catch.Difficulty -{ - public class CatchDifficultyHitObject - { - internal static readonly double DECAY_BASE = 0.20; - private const float normalized_hitobject_radius = 41.0f; - private const float absolute_player_positioning_error = 16f; - private readonly float playerPositioningError; - - internal CatchHitObject BaseHitObject; - - /// - /// Measures jump difficulty. CtB doesn't have something like button pressing speed or accuracy - /// - internal double Strain = 1; - - /// - /// This is required to keep track of lazy player movement (always moving only as far as necessary) - /// Without this quick repeat sliders / weirdly shaped streams might become ridiculously overrated - /// - internal float PlayerPositionOffset; - internal float LastMovement; - - internal float NormalizedPosition; - internal float ActualNormalizedPosition => NormalizedPosition + PlayerPositionOffset; - - internal CatchDifficultyHitObject(CatchHitObject baseHitObject, float catcherWidthHalf) - { - BaseHitObject = baseHitObject; - - // We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps. - float scalingFactor = normalized_hitobject_radius / catcherWidthHalf; - - playerPositioningError = absolute_player_positioning_error; // * scalingFactor; - NormalizedPosition = baseHitObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor; - } - - private const double direction_change_bonus = 12.5; - internal void CalculateStrains(CatchDifficultyHitObject previousHitObject, double timeRate) - { - // Rather simple, but more specialized things are inherently inaccurate due to the big difference playstyles and opinions make. - // See Taiko feedback thread. - double timeElapsed = (BaseHitObject.StartTime - previousHitObject.BaseHitObject.StartTime) / timeRate; - double decay = Math.Pow(DECAY_BASE, timeElapsed / 1000); - - // Update new position with lazy movement. - PlayerPositionOffset = - MathHelper.Clamp( - previousHitObject.ActualNormalizedPosition, - NormalizedPosition - (normalized_hitobject_radius - playerPositioningError), - NormalizedPosition + (normalized_hitobject_radius - playerPositioningError)) // Obtain new lazy position, but be stricter by allowing for an error of a certain degree of the player. - - NormalizedPosition; // Subtract HitObject position to obtain offset - - LastMovement = DistanceTo(previousHitObject); - double addition = spacingWeight(LastMovement); - - if (NormalizedPosition < previousHitObject.NormalizedPosition) - { - LastMovement = -LastMovement; - } - - CatchHitObject previousHitCircle = previousHitObject.BaseHitObject; - - double additionBonus = 0; - double sqrtTime = Math.Sqrt(Math.Max(timeElapsed, 25)); - - // Direction changes give an extra point! - if (Math.Abs(LastMovement) > 0.1) - { - if (Math.Abs(previousHitObject.LastMovement) > 0.1 && Math.Sign(LastMovement) != Math.Sign(previousHitObject.LastMovement)) - { - double bonus = direction_change_bonus / sqrtTime; - - // Weight bonus by how - double bonusFactor = Math.Min(playerPositioningError, Math.Abs(LastMovement)) / playerPositioningError; - - // We want time to play a role twice here! - addition += bonus * bonusFactor; - - // Bonus for tougher direction switches and "almost" hyperdashes at this point - if (previousHitCircle != null && previousHitCircle.DistanceToHyperDash <= 10.0f / CatchPlayfield.BASE_WIDTH) - { - additionBonus += 0.3 * bonusFactor; - } - } - - // Base bonus for every movement, giving some weight to streams. - addition += 7.5 * Math.Min(Math.Abs(LastMovement), normalized_hitobject_radius * 2) / (normalized_hitobject_radius * 6) / sqrtTime; - } - - // Bonus for "almost" hyperdashes at corner points - if (previousHitCircle != null && previousHitCircle.DistanceToHyperDash <= 10.0f / CatchPlayfield.BASE_WIDTH) - { - if (!previousHitCircle.HyperDash) - { - additionBonus += 1.0; - } - else - { - // After a hyperdash we ARE in the correct position. Always! - PlayerPositionOffset = 0; - } - - addition *= 1.0 + additionBonus * ((10 - previousHitCircle.DistanceToHyperDash * CatchPlayfield.BASE_WIDTH) / 10); - } - - addition *= 850.0 / Math.Max(timeElapsed, 25); - - Strain = previousHitObject.Strain * decay + addition; - } - - private static double spacingWeight(float distance) - { - return Math.Pow(distance, 1.3) / 500; - } - - internal float DistanceTo(CatchDifficultyHitObject other) - { - return Math.Abs(ActualNormalizedPosition - other.ActualNormalizedPosition); - } - } -} diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchLegacyDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchLegacyDifficultyCalculator.cs deleted file mode 100644 index 0a0897d97b..0000000000 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchLegacyDifficultyCalculator.cs +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Collections.Generic; -using System.Linq; -using osu.Game.Beatmaps; -using osu.Game.Rulesets.Difficulty; -using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Catch.Objects; -using osu.Game.Rulesets.Catch.UI; - -namespace osu.Game.Rulesets.Catch.Difficulty -{ - public class CatchLegacyDifficultyCalculator : LegacyDifficultyCalculator - { - /// - /// In milliseconds. For difficulty calculation we will only look at the highest strain value in each time interval of size STRAIN_STEP. - /// This is to eliminate higher influence of stream over aim by simply having more HitObjects with high strain. - /// The higher this value, the less strains there will be, indirectly giving long beatmaps an advantage. - /// - private const double strain_step = 750; - - /// - /// The weighting of each strain value decays to this number * it's previous value - /// - private const double decay_weight = 0.94; - - private const double star_scaling_factor = 0.145; - - public CatchLegacyDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) - : base(ruleset, beatmap) - { - } - - protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate) - { - if (!beatmap.HitObjects.Any()) - return new CatchDifficultyAttributes(mods, 0); - - var catcher = new CatcherArea.Catcher(beatmap.BeatmapInfo.BaseDifficulty); - float halfCatchWidth = catcher.CatchWidth * 0.5f; - - var difficultyHitObjects = new List(); - - foreach (var hitObject in beatmap.HitObjects) - { - switch (hitObject) - { - // We want to only consider fruits that contribute to the combo. Droplets are addressed as accuracy and spinners are not relevant for "skill" calculations. - case Fruit fruit: - difficultyHitObjects.Add(new CatchDifficultyHitObject(fruit, halfCatchWidth)); - break; - case JuiceStream _: - difficultyHitObjects.AddRange(hitObject.NestedHitObjects.OfType().Where(o => !(o is TinyDroplet)).Select(o => new CatchDifficultyHitObject(o, halfCatchWidth))); - break; - } - } - - difficultyHitObjects.Sort((a, b) => a.BaseHitObject.StartTime.CompareTo(b.BaseHitObject.StartTime)); - - if (!calculateStrainValues(difficultyHitObjects, timeRate)) - return new CatchDifficultyAttributes(mods, 0); - - // this is the same as osu!, so there's potential to share the implementation... maybe - double preempt = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate; - double starRating = Math.Sqrt(calculateDifficulty(difficultyHitObjects, timeRate)) * star_scaling_factor; - - return new CatchDifficultyAttributes(mods, starRating) - { - ApproachRate = preempt > 1200.0 ? -(preempt - 1800.0) / 120.0 : -(preempt - 1200.0) / 150.0 + 5.0, - MaxCombo = difficultyHitObjects.Count - }; - } - - private bool calculateStrainValues(List objects, double timeRate) - { - CatchDifficultyHitObject lastObject = null; - - if (!objects.Any()) return false; - - // Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment. - foreach (var currentObject in objects) - { - if (lastObject != null) - currentObject.CalculateStrains(lastObject, timeRate); - - lastObject = currentObject; - } - - return true; - } - - private double calculateDifficulty(List objects, double timeRate) - { - // The strain step needs to be adjusted for the algorithm to be considered equal with speed changing mods - double actualStrainStep = strain_step * timeRate; - - // Find the highest strain value within each strain step - var highestStrains = new List(); - double intervalEndTime = actualStrainStep; - double maximumStrain = 0; // We need to keep track of the maximum strain in the current interval - - CatchDifficultyHitObject previousHitObject = null; - foreach (CatchDifficultyHitObject hitObject in objects) - { - // While we are beyond the current interval push the currently available maximum to our strain list - while (hitObject.BaseHitObject.StartTime > intervalEndTime) - { - highestStrains.Add(maximumStrain); - - // The maximum strain of the next interval is not zero by default! We need to take the last hitObject we encountered, take its strain and apply the decay - // until the beginning of the next interval. - if (previousHitObject == null) - { - maximumStrain = 0; - } - else - { - double decay = Math.Pow(CatchDifficultyHitObject.DECAY_BASE, (intervalEndTime - previousHitObject.BaseHitObject.StartTime) / 1000); - maximumStrain = previousHitObject.Strain * decay; - } - - // Go to the next time interval - intervalEndTime += actualStrainStep; - } - - // Obtain maximum strain - maximumStrain = Math.Max(hitObject.Strain, maximumStrain); - - previousHitObject = hitObject; - } - - // Build the weighted sum over the highest strains for each interval - double difficulty = 0; - double weight = 1; - highestStrains.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain. - - foreach (double strain in highestStrains) - { - difficulty += weight * strain; - weight *= decay_weight; - } - - return difficulty; - } - } -} diff --git a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs new file mode 100644 index 0000000000..5dbd60d700 --- /dev/null +++ b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs @@ -0,0 +1,68 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Game.Rulesets.Catch.Objects; +using osu.Game.Rulesets.Catch.UI; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Objects; +using osuTK; + +namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing +{ + public class CatchDifficultyHitObject : DifficultyHitObject + { + private const float normalized_hitobject_radius = 41.0f; + private const float absolute_player_positioning_error = 16f; + + public new CatchHitObject BaseObject => (CatchHitObject)base.BaseObject; + + public float MovementDistance { get; private set; } + /// + /// Milliseconds elapsed since the start time of the previous , with a minimum of 25ms. + /// + public readonly double StrainTime; + + private readonly float scalingFactor; + + private readonly CatchHitObject lastObject; + + public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double timeRate, float halfCatcherWidth) + : base(hitObject, lastObject, timeRate) + { + this.lastObject = (CatchHitObject)lastObject; + + // We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps. + scalingFactor = normalized_hitobject_radius / halfCatcherWidth; + + setDistances(); + + // Every strain interval is hard capped at the equivalent of 600 BPM streaming speed as a safety measure + StrainTime = Math.Max(25, DeltaTime); + } + + private void setDistances() + { + float lastPosition = getNormalizedPosition(lastObject); + float currentPosition = getNormalizedPosition(BaseObject); + + // After a hyperdash the player is assumed to be in the correct position + if (lastObject.LazyMovementDistance != null && !lastObject.HyperDash) + lastPosition += lastObject.LazyMovementDistance.Value; + + BaseObject.LazyMovementDistance = + MathHelper.Clamp( + lastPosition, + currentPosition - (normalized_hitobject_radius - absolute_player_positioning_error), + currentPosition + (normalized_hitobject_radius - absolute_player_positioning_error)) // Obtain new lazy position, but be stricter by allowing for an error of a certain degree of the player. + - currentPosition; // Subtract HitObject position to obtain offset + + MovementDistance = Math.Abs(currentPosition - lastPosition + BaseObject.LazyMovementDistance.Value); + + if (currentPosition < lastPosition) + MovementDistance *= -1; + } + + private float getNormalizedPosition(CatchHitObject hitObject) => hitObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor; + } +} diff --git a/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs b/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs new file mode 100644 index 0000000000..1626a9be1d --- /dev/null +++ b/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs @@ -0,0 +1,63 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Game.Rulesets.Catch.Difficulty.Preprocessing; +using osu.Game.Rulesets.Catch.UI; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Difficulty.Skills; + +namespace osu.Game.Rulesets.Catch.Difficulty.Skills +{ + public class Movement : Skill + { + private const float absolute_player_positioning_error = 16f; + private const float normalized_hitobject_radius = 41.0f; + private const double direction_change_bonus = 12.5; + + protected override double SkillMultiplier => 850; + protected override double StrainDecayBase => 0.2; + + protected override double DecayWeight => 0.94; + + protected override double StrainValueOf(DifficultyHitObject current) + { + var catchCurrent = (CatchDifficultyHitObject)current; + var catchPrevious = (CatchDifficultyHitObject)Previous[0]; + + var sqrtStrain = Math.Sqrt(catchCurrent.StrainTime); + + double distanceAddition = Math.Pow(Math.Abs(catchCurrent.MovementDistance), 1.3) / 500; + + double bonus = 0; + + if (Math.Abs(catchCurrent.MovementDistance) > 0.1) + { + if (catchPrevious.MovementDistance > 0.1 && Math.Sign(catchCurrent.MovementDistance) != Math.Sign(catchPrevious.MovementDistance)) + { + double bonusFactor = Math.Min(absolute_player_positioning_error, Math.Abs(catchCurrent.MovementDistance)) / absolute_player_positioning_error; + + distanceAddition += direction_change_bonus / sqrtStrain * bonusFactor; + + // Bonus for tougher direction switches and "almost" hyperdashes at this point + if (catchPrevious.BaseObject.DistanceToHyperDash <= 10 / CatchPlayfield.BASE_WIDTH) + bonus = 0.3 * bonusFactor; + } + + // Base bonus for every movement, giving some weight to streams. + distanceAddition += 7.5 * Math.Min(Math.Abs(catchCurrent.MovementDistance), normalized_hitobject_radius * 2) / (normalized_hitobject_radius * 6) / sqrtStrain; + } + + // Bonus for "almost" hyperdashes at corner points + if (catchPrevious.BaseObject.DistanceToHyperDash <= 10.0f / CatchPlayfield.BASE_WIDTH) + { + if (!catchPrevious.BaseObject.HyperDash) + bonus += 1.0; + + distanceAddition *= 1.0 + bonus * ((10 - catchPrevious.BaseObject.DistanceToHyperDash * CatchPlayfield.BASE_WIDTH) / 10); + } + + return distanceAddition / catchCurrent.StrainTime; + } + } +} diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index 2153b8dc85..aff18619fb 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -50,6 +50,11 @@ namespace osu.Game.Rulesets.Catch.Objects /// public CatchHitObject HyperDashTarget; + /// + /// The minimum distance to be moved from the last to hit this . + /// + internal float? LazyMovementDistance; + protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) { base.ApplyDefaultsToSelf(controlPointInfo, difficulty); From e02ae927b31f6eccbe673164cb7367d4515e8175 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Feb 2019 14:47:31 +0900 Subject: [PATCH 048/327] Fix nullrefs --- osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs b/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs index 1626a9be1d..8137437959 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs @@ -3,6 +3,7 @@ using System; using osu.Game.Rulesets.Catch.Difficulty.Preprocessing; +using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Skills; @@ -23,7 +24,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Skills protected override double StrainValueOf(DifficultyHitObject current) { var catchCurrent = (CatchDifficultyHitObject)current; - var catchPrevious = (CatchDifficultyHitObject)Previous[0]; + var catchPrevious = Previous.Count > 0 ? (CatchDifficultyHitObject)Previous[0] : null; var sqrtStrain = Math.Sqrt(catchCurrent.StrainTime); @@ -33,7 +34,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Skills if (Math.Abs(catchCurrent.MovementDistance) > 0.1) { - if (catchPrevious.MovementDistance > 0.1 && Math.Sign(catchCurrent.MovementDistance) != Math.Sign(catchPrevious.MovementDistance)) + if (catchPrevious != null && catchPrevious.MovementDistance > 0.1 && Math.Sign(catchCurrent.MovementDistance) != Math.Sign(catchPrevious.MovementDistance)) { double bonusFactor = Math.Min(absolute_player_positioning_error, Math.Abs(catchCurrent.MovementDistance)) / absolute_player_positioning_error; @@ -49,7 +50,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Skills } // Bonus for "almost" hyperdashes at corner points - if (catchPrevious.BaseObject.DistanceToHyperDash <= 10.0f / CatchPlayfield.BASE_WIDTH) + if (catchPrevious?.BaseObject is Fruit && catchPrevious.BaseObject.DistanceToHyperDash <= 10.0f / CatchPlayfield.BASE_WIDTH) { if (!catchPrevious.BaseObject.HyperDash) bonus += 1.0; From f6b13ca79dd271141ba6de8d18ec1fd1b69a599b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Sat, 16 Feb 2019 11:11:31 +0900 Subject: [PATCH 049/327] Rewrite catch diffcalc for readability + attempt to fix --- .../Preprocessing/CatchDifficultyHitObject.cs | 41 +++--------------- .../Difficulty/Skills/Movement.cs | 42 +++++++++++++------ 2 files changed, 36 insertions(+), 47 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs index 5dbd60d700..6ce45bbbde 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs @@ -6,63 +6,34 @@ using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Objects; -using osuTK; namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing { public class CatchDifficultyHitObject : DifficultyHitObject { private const float normalized_hitobject_radius = 41.0f; - private const float absolute_player_positioning_error = 16f; public new CatchHitObject BaseObject => (CatchHitObject)base.BaseObject; - public float MovementDistance { get; private set; } + public new CatchHitObject LastObject => (CatchHitObject)base.LastObject; + + public readonly float NormalizedPosition; + /// /// Milliseconds elapsed since the start time of the previous , with a minimum of 25ms. /// public readonly double StrainTime; - private readonly float scalingFactor; - - private readonly CatchHitObject lastObject; - public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double timeRate, float halfCatcherWidth) : base(hitObject, lastObject, timeRate) { - this.lastObject = (CatchHitObject)lastObject; - // We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps. - scalingFactor = normalized_hitobject_radius / halfCatcherWidth; + var scalingFactor = normalized_hitobject_radius / halfCatcherWidth; - setDistances(); + NormalizedPosition = BaseObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor; // Every strain interval is hard capped at the equivalent of 600 BPM streaming speed as a safety measure StrainTime = Math.Max(25, DeltaTime); } - - private void setDistances() - { - float lastPosition = getNormalizedPosition(lastObject); - float currentPosition = getNormalizedPosition(BaseObject); - - // After a hyperdash the player is assumed to be in the correct position - if (lastObject.LazyMovementDistance != null && !lastObject.HyperDash) - lastPosition += lastObject.LazyMovementDistance.Value; - - BaseObject.LazyMovementDistance = - MathHelper.Clamp( - lastPosition, - currentPosition - (normalized_hitobject_radius - absolute_player_positioning_error), - currentPosition + (normalized_hitobject_radius - absolute_player_positioning_error)) // Obtain new lazy position, but be stricter by allowing for an error of a certain degree of the player. - - currentPosition; // Subtract HitObject position to obtain offset - - MovementDistance = Math.Abs(currentPosition - lastPosition + BaseObject.LazyMovementDistance.Value); - - if (currentPosition < lastPosition) - MovementDistance *= -1; - } - - private float getNormalizedPosition(CatchHitObject hitObject) => hitObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor; } } diff --git a/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs b/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs index 8137437959..e06ca08fbe 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs @@ -3,10 +3,10 @@ using System; using osu.Game.Rulesets.Catch.Difficulty.Preprocessing; -using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Skills; +using osuTK; namespace osu.Game.Rulesets.Catch.Difficulty.Skills { @@ -21,43 +21,61 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Skills protected override double DecayWeight => 0.94; + private float lastPlayerPosition; + private float lastDistanceMoved; + protected override double StrainValueOf(DifficultyHitObject current) { var catchCurrent = (CatchDifficultyHitObject)current; - var catchPrevious = Previous.Count > 0 ? (CatchDifficultyHitObject)Previous[0] : null; - var sqrtStrain = Math.Sqrt(catchCurrent.StrainTime); + float playerPosition = MathHelper.Clamp( + lastPlayerPosition, + catchCurrent.NormalizedPosition - (normalized_hitobject_radius - absolute_player_positioning_error), + catchCurrent.NormalizedPosition + (normalized_hitobject_radius - absolute_player_positioning_error) + ); - double distanceAddition = Math.Pow(Math.Abs(catchCurrent.MovementDistance), 1.3) / 500; + float distanceMoved = playerPosition - lastPlayerPosition; + + double distanceAddition = Math.Pow(Math.Abs(distanceMoved), 1.3) / 500; + double sqrtStrain = Math.Sqrt(catchCurrent.StrainTime); double bonus = 0; - if (Math.Abs(catchCurrent.MovementDistance) > 0.1) + // Direction changes give an extra point! + if (Math.Abs(distanceMoved) > 0.1) { - if (catchPrevious != null && catchPrevious.MovementDistance > 0.1 && Math.Sign(catchCurrent.MovementDistance) != Math.Sign(catchPrevious.MovementDistance)) + if (Math.Abs(lastDistanceMoved) > 0.1 && Math.Sign(distanceMoved) != Math.Sign(lastDistanceMoved)) { - double bonusFactor = Math.Min(absolute_player_positioning_error, Math.Abs(catchCurrent.MovementDistance)) / absolute_player_positioning_error; + double bonusFactor = Math.Min(absolute_player_positioning_error, Math.Abs(distanceMoved)) / absolute_player_positioning_error; distanceAddition += direction_change_bonus / sqrtStrain * bonusFactor; // Bonus for tougher direction switches and "almost" hyperdashes at this point - if (catchPrevious.BaseObject.DistanceToHyperDash <= 10 / CatchPlayfield.BASE_WIDTH) + if (catchCurrent.LastObject.DistanceToHyperDash <= 10 / CatchPlayfield.BASE_WIDTH) bonus = 0.3 * bonusFactor; } // Base bonus for every movement, giving some weight to streams. - distanceAddition += 7.5 * Math.Min(Math.Abs(catchCurrent.MovementDistance), normalized_hitobject_radius * 2) / (normalized_hitobject_radius * 6) / sqrtStrain; + distanceAddition += 7.5 * Math.Min(Math.Abs(distanceMoved), normalized_hitobject_radius * 2) / (normalized_hitobject_radius * 6) / sqrtStrain; } // Bonus for "almost" hyperdashes at corner points - if (catchPrevious?.BaseObject is Fruit && catchPrevious.BaseObject.DistanceToHyperDash <= 10.0f / CatchPlayfield.BASE_WIDTH) + if (catchCurrent.LastObject.DistanceToHyperDash <= 10.0f / CatchPlayfield.BASE_WIDTH) { - if (!catchPrevious.BaseObject.HyperDash) + if (!catchCurrent.LastObject.HyperDash) bonus += 1.0; + else + { + // After a hyperdash we ARE in the correct position. Always! + playerPosition = catchCurrent.NormalizedPosition; + } - distanceAddition *= 1.0 + bonus * ((10 - catchPrevious.BaseObject.DistanceToHyperDash * CatchPlayfield.BASE_WIDTH) / 10); + distanceAddition *= 1.0 + bonus * ((10 - catchCurrent.LastObject.DistanceToHyperDash * CatchPlayfield.BASE_WIDTH) / 10); } + lastPlayerPosition = playerPosition; + lastDistanceMoved = distanceMoved; + return distanceAddition / catchCurrent.StrainTime; } } From 83cab2ba8ab23a476132993afb21c41253bd95f1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Feb 2019 14:48:19 +0900 Subject: [PATCH 050/327] Fix incorrect hitobject being used as the last hitobject --- .../Difficulty/CatchDifficultyCalculator.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index 99702235d5..d4110ab1e1 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -60,14 +60,16 @@ namespace osu.Game.Rulesets.Catch.Difficulty // We want to only consider fruits that contribute to the combo. Droplets are addressed as accuracy and spinners are not relevant for "skill" calculations. case Fruit fruit: yield return new CatchDifficultyHitObject(fruit, lastObject, timeRate, halfCatchWidth); + lastObject = hitObject; break; case JuiceStream _: foreach (var nested in hitObject.NestedHitObjects.OfType().Where(o => !(o is TinyDroplet))) + { yield return new CatchDifficultyHitObject(nested, lastObject, timeRate, halfCatchWidth); + lastObject = nested; + } break; } - - lastObject = hitObject; } } From 9463475202be48b011e955532de1596bcd1eb2b9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Feb 2019 14:51:30 +0900 Subject: [PATCH 051/327] Remove now unused member --- osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs index aff18619fb..2153b8dc85 100644 --- a/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs +++ b/osu.Game.Rulesets.Catch/Objects/CatchHitObject.cs @@ -50,11 +50,6 @@ namespace osu.Game.Rulesets.Catch.Objects /// public CatchHitObject HyperDashTarget; - /// - /// The minimum distance to be moved from the last to hit this . - /// - internal float? LazyMovementDistance; - protected override void ApplyDefaultsToSelf(ControlPointInfo controlPointInfo, BeatmapDifficulty difficulty) { base.ApplyDefaultsToSelf(controlPointInfo, difficulty); From 25d85b6eb4a53f32ff6687556d123a806e130365 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Feb 2019 14:54:21 +0900 Subject: [PATCH 052/327] Implement new difficulty calculator for Rulesets.Taiko --- .../TaikoDifficultyCalculatorTest.cs | 2 +- .../Preprocessing/TaikoDifficultyHitObject.cs | 20 +++ .../Difficulty/Skills/Strain.cs | 90 +++++++++++ .../Difficulty/TaikoDifficultyAttributes.cs | 4 +- .../Difficulty/TaikoDifficultyCalculator.cs | 56 +++++++ .../TaikoLegacyDifficultyCalculator.cs | 144 ------------------ .../Objects/TaikoHitObjectDifficulty.cs | 127 --------------- osu.Game.Rulesets.Taiko/TaikoRuleset.cs | 2 +- .../osu.Game.Rulesets.Taiko.csproj | 3 + 9 files changed, 173 insertions(+), 275 deletions(-) create mode 100644 osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs create mode 100644 osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs create mode 100644 osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs delete mode 100644 osu.Game.Rulesets.Taiko/Difficulty/TaikoLegacyDifficultyCalculator.cs delete mode 100644 osu.Game.Rulesets.Taiko/Objects/TaikoHitObjectDifficulty.cs diff --git a/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs index e00f3da0b7..16130c2c3d 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Taiko.Tests public void Test(double expected, string name) => base.Test(expected, name); - protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoLegacyDifficultyCalculator(new TaikoRuleset(), beatmap); + protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoDifficultyCalculator(new TaikoRuleset(), beatmap); protected override Ruleset CreateRuleset() => new TaikoRuleset(); } diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs new file mode 100644 index 0000000000..4d63d81663 --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs @@ -0,0 +1,20 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Taiko.Objects; + +namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing +{ + public class TaikoDifficultyHitObject : DifficultyHitObject + { + public readonly bool HasTypeChange; + + public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, double timeRate) + : base(hitObject, lastObject, timeRate) + { + HasTypeChange = lastObject is RimHit != hitObject is RimHit; + } + } +} diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs new file mode 100644 index 0000000000..c77e6a3afd --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs @@ -0,0 +1,90 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Difficulty.Skills; +using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing; +using osu.Game.Rulesets.Taiko.Objects; + +namespace osu.Game.Rulesets.Taiko.Difficulty.Skills +{ + public class Strain : Skill + { + private const double rhythm_change_base_threshold = 0.2; + private const double rhythm_change_base = 2.0; + + protected override double SkillMultiplier => 1; + protected override double StrainDecayBase => 0.3; + + private ColourSwitch lastColourSwitch = ColourSwitch.None; + + private int sameTypeCount; + + protected override double StrainValueOf(DifficultyHitObject current) + { + double addition = 1; + + // We get an extra addition if we are not a slider or spinner + if (Previous[0].BaseObject is Hit && current.BaseObject is Hit && current.BaseObject.StartTime - Previous[0].BaseObject.StartTime < 1000) + { + if (hasRhythmChange(current)) + addition += 1; + + if (hasColourChange(current)) + addition += 0.75; + } + + double additionFactor = 1; + + // Scale the addition factor linearly from 0.4 to 1 for DeltaTime from 0 to 50 + if (current.DeltaTime < 50) + additionFactor = 0.4 + 0.6 * current.DeltaTime / 50; + + return additionFactor * addition; + } + + private bool hasRhythmChange(DifficultyHitObject current) + { + // We don't want a division by zero if some random mapper decides to put two HitObjects at the same time. + if (current.DeltaTime == 0 || Previous[0].DeltaTime == 0) + return false; + + double timeElapsedRatio = Math.Max(Previous[0].DeltaTime / current.DeltaTime, current.DeltaTime / Previous[0].DeltaTime); + + if (timeElapsedRatio >= 8) + return false; + + double difference = Math.Log(timeElapsedRatio, rhythm_change_base) % 1.0; + + return difference > rhythm_change_base_threshold && difference < 1 - rhythm_change_base_threshold; + } + + private bool hasColourChange(DifficultyHitObject current) + { + var taikoCurrent = (TaikoDifficultyHitObject)current; + + if (!taikoCurrent.HasTypeChange) + { + sameTypeCount++; + return false; + } + + var oldColourSwitch = lastColourSwitch; + var newColourSwitch = sameTypeCount % 2 == 0 ? ColourSwitch.Even : ColourSwitch.Odd; + + lastColourSwitch = newColourSwitch; + sameTypeCount = 1; + + // We only want a bonus if the parity of the color switch changes + return oldColourSwitch != ColourSwitch.None && oldColourSwitch != newColourSwitch; + } + + private enum ColourSwitch + { + None, + Even, + Odd + } + } +} diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs index 3770f9601a..07721e2ac5 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs @@ -11,8 +11,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty public double GreatHitWindow; public int MaxCombo; - public TaikoDifficultyAttributes(Mod[] mods, double starRating) - : base(mods, starRating) + public TaikoDifficultyAttributes(Mod[] mods) + : base(mods) { } } diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs new file mode 100644 index 0000000000..3d18274bba --- /dev/null +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -0,0 +1,56 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using System.Linq; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Difficulty; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Difficulty.Skills; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Taiko.Difficulty.Preprocessing; +using osu.Game.Rulesets.Taiko.Difficulty.Skills; +using osu.Game.Rulesets.Taiko.Mods; +using osu.Game.Rulesets.Taiko.Objects; + +namespace osu.Game.Rulesets.Taiko.Difficulty +{ + public class TaikoDifficultyCalculator : DifficultyCalculator + { + private const double star_scaling_factor = 0.018; + + public TaikoDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) + : base(ruleset, beatmap) + { + } + + protected override void PopulateAttributes(DifficultyAttributes attributes, IBeatmap beatmap, Skill[] skills, double timeRate) + { + var taikoAttributes = (TaikoDifficultyAttributes)attributes; + + taikoAttributes.StarRating = skills.Single().DifficultyValue() * star_scaling_factor; + + // Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be removed in the future + taikoAttributes.GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate; + taikoAttributes.MaxCombo = beatmap.HitObjects.Count(h => h is Hit); + } + + protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double timeRate) + { + for (int i = 1; i < beatmap.HitObjects.Count; i++) + yield return new TaikoDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], timeRate); + } + + protected override Skill[] CreateSkills() => new Skill[] { new Strain() }; + + protected override DifficultyAttributes CreateDifficultyAttributes(Mod[] mods) => new TaikoDifficultyAttributes(mods); + + protected override Mod[] DifficultyAdjustmentMods => new Mod[] + { + new TaikoModDoubleTime(), + new TaikoModHalfTime(), + new TaikoModEasy(), + new TaikoModHardRock(), + }; + } +} diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoLegacyDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoLegacyDifficultyCalculator.cs deleted file mode 100644 index 650b367e34..0000000000 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoLegacyDifficultyCalculator.cs +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Collections.Generic; -using System.Linq; -using osu.Game.Beatmaps; -using osu.Game.Rulesets.Difficulty; -using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Taiko.Mods; -using osu.Game.Rulesets.Taiko.Objects; - -namespace osu.Game.Rulesets.Taiko.Difficulty -{ - internal class TaikoLegacyDifficultyCalculator : LegacyDifficultyCalculator - { - private const double star_scaling_factor = 0.04125; - - /// - /// In milliseconds. For difficulty calculation we will only look at the highest strain value in each time interval of size STRAIN_STEP. - /// This is to eliminate higher influence of stream over aim by simply having more HitObjects with high strain. - /// The higher this value, the less strains there will be, indirectly giving long beatmaps an advantage. - /// - private const double strain_step = 400; - - /// - /// The weighting of each strain value decays to this number * it's previous value - /// - private const double decay_weight = 0.9; - - public TaikoLegacyDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) - : base(ruleset, beatmap) - { - } - - protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate) - { - if (!beatmap.HitObjects.Any()) - return new TaikoDifficultyAttributes(mods, 0); - - var difficultyHitObjects = new List(); - - foreach (var hitObject in beatmap.HitObjects) - difficultyHitObjects.Add(new TaikoHitObjectDifficulty((TaikoHitObject)hitObject)); - - // Sort DifficultyHitObjects by StartTime of the HitObjects - just to make sure. - difficultyHitObjects.Sort((a, b) => a.BaseHitObject.StartTime.CompareTo(b.BaseHitObject.StartTime)); - - if (!calculateStrainValues(difficultyHitObjects, timeRate)) - return new TaikoDifficultyAttributes(mods, 0); - - double starRating = calculateDifficulty(difficultyHitObjects, timeRate) * star_scaling_factor; - - return new TaikoDifficultyAttributes(mods, starRating) - { - // Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be remoevd in the future - GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate, - MaxCombo = beatmap.HitObjects.Count(h => h is Hit) - }; - } - - private bool calculateStrainValues(List objects, double timeRate) - { - // Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment. - using (var hitObjectsEnumerator = objects.GetEnumerator()) - { - if (!hitObjectsEnumerator.MoveNext()) return false; - - TaikoHitObjectDifficulty current = hitObjectsEnumerator.Current; - - // First hitObject starts at strain 1. 1 is the default for strain values, so we don't need to set it here. See DifficultyHitObject. - while (hitObjectsEnumerator.MoveNext()) - { - var next = hitObjectsEnumerator.Current; - next?.CalculateStrains(current, timeRate); - current = next; - } - - return true; - } - } - - private double calculateDifficulty(List objects, double timeRate) - { - double actualStrainStep = strain_step * timeRate; - - // Find the highest strain value within each strain step - List highestStrains = new List(); - double intervalEndTime = actualStrainStep; - double maximumStrain = 0; // We need to keep track of the maximum strain in the current interval - - TaikoHitObjectDifficulty previousHitObject = null; - foreach (var hitObject in objects) - { - // While we are beyond the current interval push the currently available maximum to our strain list - while (hitObject.BaseHitObject.StartTime > intervalEndTime) - { - highestStrains.Add(maximumStrain); - - // The maximum strain of the next interval is not zero by default! We need to take the last hitObject we encountered, take its strain and apply the decay - // until the beginning of the next interval. - if (previousHitObject == null) - { - maximumStrain = 0; - } - else - { - double decay = Math.Pow(TaikoHitObjectDifficulty.DECAY_BASE, (intervalEndTime - previousHitObject.BaseHitObject.StartTime) / 1000); - maximumStrain = previousHitObject.Strain * decay; - } - - // Go to the next time interval - intervalEndTime += actualStrainStep; - } - - // Obtain maximum strain - maximumStrain = Math.Max(hitObject.Strain, maximumStrain); - - previousHitObject = hitObject; - } - - // Build the weighted sum over the highest strains for each interval - double difficulty = 0; - double weight = 1; - highestStrains.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain. - - foreach (double strain in highestStrains) - { - difficulty += weight * strain; - weight *= decay_weight; - } - - return difficulty; - } - - protected override Mod[] DifficultyAdjustmentMods => new Mod[] - { - new TaikoModDoubleTime(), - new TaikoModHalfTime(), - new TaikoModEasy(), - new TaikoModHardRock(), - }; - } -} diff --git a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObjectDifficulty.cs b/osu.Game.Rulesets.Taiko/Objects/TaikoHitObjectDifficulty.cs deleted file mode 100644 index 46dd7aa87f..0000000000 --- a/osu.Game.Rulesets.Taiko/Objects/TaikoHitObjectDifficulty.cs +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; - -namespace osu.Game.Rulesets.Taiko.Objects -{ - internal class TaikoHitObjectDifficulty - { - /// - /// Factor by how much individual / overall strain decays per second. - /// - /// - /// These values are results of tweaking a lot and taking into account general feedback. - /// - internal const double DECAY_BASE = 0.30; - - private const double type_change_bonus = 0.75; - private const double rhythm_change_bonus = 1.0; - private const double rhythm_change_base_threshold = 0.2; - private const double rhythm_change_base = 2.0; - - internal TaikoHitObject BaseHitObject; - - /// - /// Measures note density in a way - /// - internal double Strain = 1; - - private double timeElapsed; - private int sameTypeSince = 1; - - private bool isRim => BaseHitObject is RimHit; - - public TaikoHitObjectDifficulty(TaikoHitObject baseHitObject) - { - BaseHitObject = baseHitObject; - } - - internal void CalculateStrains(TaikoHitObjectDifficulty previousHitObject, double timeRate) - { - // Rather simple, but more specialized things are inherently inaccurate due to the big difference playstyles and opinions make. - // See Taiko feedback thread. - timeElapsed = (BaseHitObject.StartTime - previousHitObject.BaseHitObject.StartTime) / timeRate; - double decay = Math.Pow(DECAY_BASE, timeElapsed / 1000); - - double addition = 1; - - // Only if we are no slider or spinner we get an extra addition - if (previousHitObject.BaseHitObject is Hit && BaseHitObject is Hit - && BaseHitObject.StartTime - previousHitObject.BaseHitObject.StartTime < 1000) // And we only want to check out hitobjects which aren't so far in the past - { - addition += typeChangeAddition(previousHitObject); - addition += rhythmChangeAddition(previousHitObject); - } - - double additionFactor = 1.0; - // Scale AdditionFactor linearly from 0.4 to 1 for TimeElapsed from 0 to 50 - if (timeElapsed < 50.0) - additionFactor = 0.4 + 0.6 * timeElapsed / 50.0; - - Strain = previousHitObject.Strain * decay + addition * additionFactor; - } - - private TypeSwitch lastTypeSwitchEven = TypeSwitch.None; - private double typeChangeAddition(TaikoHitObjectDifficulty previousHitObject) - { - // If we don't have the same hit type, trigger a type change! - if (previousHitObject.isRim != isRim) - { - lastTypeSwitchEven = previousHitObject.sameTypeSince % 2 == 0 ? TypeSwitch.Even : TypeSwitch.Odd; - - // We only want a bonus if the parity of the type switch changes! - switch (previousHitObject.lastTypeSwitchEven) - { - case TypeSwitch.Even: - if (lastTypeSwitchEven == TypeSwitch.Odd) - return type_change_bonus; - break; - case TypeSwitch.Odd: - if (lastTypeSwitchEven == TypeSwitch.Even) - return type_change_bonus; - break; - } - } - // No type change? Increment counter and keep track of last type switch - else - { - lastTypeSwitchEven = previousHitObject.lastTypeSwitchEven; - sameTypeSince = previousHitObject.sameTypeSince + 1; - } - - return 0; - } - - private double rhythmChangeAddition(TaikoHitObjectDifficulty previousHitObject) - { - // We don't want a division by zero if some random mapper decides to put 2 HitObjects at the same time. - if (timeElapsed == 0 || previousHitObject.timeElapsed == 0) - return 0; - - double timeElapsedRatio = Math.Max(previousHitObject.timeElapsed / timeElapsed, timeElapsed / previousHitObject.timeElapsed); - - if (timeElapsedRatio >= 8) - return 0; - - double difference = Math.Log(timeElapsedRatio, rhythm_change_base) % 1.0; - - if (isWithinChangeThreshold(difference)) - return rhythm_change_bonus; - - return 0; - } - - private bool isWithinChangeThreshold(double value) - { - return value > rhythm_change_base_threshold && value < 1 - rhythm_change_base_threshold; - } - - private enum TypeSwitch - { - None, - Even, - Odd - } - } -} diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs index 77a53858fe..b4becae7c2 100644 --- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs @@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Taiko public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_taiko_o }; - public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoLegacyDifficultyCalculator(this, beatmap); + public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoDifficultyCalculator(this, beatmap); public override PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => new TaikoPerformanceCalculator(this, beatmap, score); diff --git a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index 002d6a7e8d..563ed2e7ca 100644 --- a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -10,4 +10,7 @@ + + + \ No newline at end of file From cb17cbcdc45d949a5ac610a15aa088bd7a828d9c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 14 Feb 2019 14:06:48 +0900 Subject: [PATCH 053/327] Fix taiko nullrefing --- osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs index c77e6a3afd..7ff5684b86 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs @@ -26,7 +26,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills double addition = 1; // We get an extra addition if we are not a slider or spinner - if (Previous[0].BaseObject is Hit && current.BaseObject is Hit && current.BaseObject.StartTime - Previous[0].BaseObject.StartTime < 1000) + if (current.LastObject is Hit && current.BaseObject is Hit && current.DeltaTime < 1000) { if (hasRhythmChange(current)) addition += 1; @@ -47,7 +47,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills private bool hasRhythmChange(DifficultyHitObject current) { // We don't want a division by zero if some random mapper decides to put two HitObjects at the same time. - if (current.DeltaTime == 0 || Previous[0].DeltaTime == 0) + if (current.DeltaTime == 0 || Previous.Count == 0 || Previous[0].DeltaTime == 0) return false; double timeElapsedRatio = Math.Max(Previous[0].DeltaTime / current.DeltaTime, current.DeltaTime / Previous[0].DeltaTime); From 46b979a412b68ca2eb2016176575fb1bbc554941 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Feb 2019 14:55:20 +0900 Subject: [PATCH 054/327] Fix colour changes not being reset --- osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs | 13 +++++++++---- .../Difficulty/TaikoDifficultyCalculator.cs | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs index 7ff5684b86..2465143b2b 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills private ColourSwitch lastColourSwitch = ColourSwitch.None; - private int sameTypeCount; + private int sameTypeCount = 1; protected override double StrainValueOf(DifficultyHitObject current) { @@ -28,11 +28,16 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills // We get an extra addition if we are not a slider or spinner if (current.LastObject is Hit && current.BaseObject is Hit && current.DeltaTime < 1000) { - if (hasRhythmChange(current)) - addition += 1; - if (hasColourChange(current)) addition += 0.75; + + if (hasRhythmChange(current)) + addition += 1; + } + else + { + lastColourSwitch = ColourSwitch.None; + sameTypeCount = 1; } double additionFactor = 1; diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs index 3d18274bba..1cdb3495ae 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty { public class TaikoDifficultyCalculator : DifficultyCalculator { - private const double star_scaling_factor = 0.018; + private const double star_scaling_factor = 0.04125; public TaikoDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) From 7f4643a83d58e01021beae9413be8a4c61a05fc3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Feb 2019 14:55:39 +0900 Subject: [PATCH 055/327] Adjust naming --- osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs index 2465143b2b..c6fe273b50 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Skills/Strain.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills private ColourSwitch lastColourSwitch = ColourSwitch.None; - private int sameTypeCount = 1; + private int sameColourCount = 1; protected override double StrainValueOf(DifficultyHitObject current) { @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills else { lastColourSwitch = ColourSwitch.None; - sameTypeCount = 1; + sameColourCount = 1; } double additionFactor = 1; @@ -71,15 +71,15 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Skills if (!taikoCurrent.HasTypeChange) { - sameTypeCount++; + sameColourCount++; return false; } var oldColourSwitch = lastColourSwitch; - var newColourSwitch = sameTypeCount % 2 == 0 ? ColourSwitch.Even : ColourSwitch.Odd; + var newColourSwitch = sameColourCount % 2 == 0 ? ColourSwitch.Even : ColourSwitch.Odd; lastColourSwitch = newColourSwitch; - sameTypeCount = 1; + sameColourCount = 1; // We only want a bonus if the parity of the color switch changes return oldColourSwitch != ColourSwitch.None && oldColourSwitch != newColourSwitch; From fd702690218dbb43ae81cf33f35dddc04da0cddd Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 12 Feb 2019 16:03:28 +0900 Subject: [PATCH 056/327] Implement new difficulty calculator for Rulesets.Osu --- .../OsuDifficultyCalculatorTest.cs | 2 +- .../Difficulty/OsuDifficultyAttributes.cs | 4 +- .../Difficulty/OsuDifficultyCalculator.cs | 82 ++++++++++++++ .../OsuLegacyDifficultyCalculator.cs | 94 ---------------- .../Preprocessing/OsuDifficultyBeatmap.cs | 50 --------- .../Preprocessing/OsuDifficultyHitObject.cs | 56 +++------- .../Difficulty/Skills/Aim.cs | 34 +++--- .../Difficulty/Skills/Skill.cs | 103 ------------------ .../Difficulty/Skills/Speed.cs | 22 ++-- .../Difficulty/Utils/History.cs | 86 --------------- osu.Game.Rulesets.Osu/OsuRuleset.cs | 2 +- 11 files changed, 137 insertions(+), 398 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs delete mode 100644 osu.Game.Rulesets.Osu/Difficulty/OsuLegacyDifficultyCalculator.cs delete mode 100644 osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyBeatmap.cs delete mode 100644 osu.Game.Rulesets.Osu/Difficulty/Skills/Skill.cs delete mode 100644 osu.Game.Rulesets.Osu/Difficulty/Utils/History.cs diff --git a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs index cc46ec7be3..edf3f35304 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Tests public void Test(double expected, string name) => base.Test(expected, name); - protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuLegacyDifficultyCalculator(new OsuRuleset(), beatmap); + protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset(), beatmap); protected override Ruleset CreateRuleset() => new OsuRuleset(); } diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs index fd54dc0260..9a9e72a056 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs @@ -14,8 +14,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty public double OverallDifficulty; public int MaxCombo; - public OsuDifficultyAttributes(Mod[] mods, double starRating) - : base(mods, starRating) + public OsuDifficultyAttributes(Mod[] mods) + : base(mods) { } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs new file mode 100644 index 0000000000..97a925360e --- /dev/null +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -0,0 +1,82 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Collections.Generic; +using System.Linq; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Difficulty; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Difficulty.Skills; +using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; +using osu.Game.Rulesets.Osu.Difficulty.Skills; +using osu.Game.Rulesets.Osu.Mods; +using osu.Game.Rulesets.Osu.Objects; + +namespace osu.Game.Rulesets.Osu.Difficulty +{ + public class OsuDifficultyCalculator : DifficultyCalculator + { + private const double difficulty_multiplier = 0.0675; + + public OsuDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) + : base(ruleset, beatmap) + { + } + + protected override void PopulateAttributes(DifficultyAttributes attributes, IBeatmap beatmap, Skill[] skills, double timeRate) + { + var osuAttributes = (OsuDifficultyAttributes)attributes; + + double aimRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier; + double speedRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier; + double starRating = aimRating + speedRating + Math.Abs(aimRating - speedRating) / 2; + + // Todo: These int casts are temporary to achieve 1:1 results with osu!stable, and should be removed in the future + double hitWindowGreat = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate; + double preempt = (int)BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate; + + int maxCombo = beatmap.HitObjects.Count; + // Add the ticks + tail of the slider. 1 is subtracted because the head circle would be counted twice (once for the slider itself in the line above) + maxCombo += beatmap.HitObjects.OfType().Sum(s => s.NestedHitObjects.Count - 1); + + osuAttributes.StarRating = starRating; + osuAttributes.AimStrain = aimRating; + osuAttributes.SpeedStrain = speedRating; + osuAttributes.ApproachRate = preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5; + osuAttributes.OverallDifficulty = (80 - hitWindowGreat) / 6; + osuAttributes.MaxCombo = maxCombo; + } + + protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double timeRate) + { + // The first jump is formed by the first two hitobjects of the map. + // If the map has less than two OsuHitObjects, the enumerator will not return anything. + for (int i = 1; i < beatmap.HitObjects.Count; i++) + { + var lastLast = i > 1 ? beatmap.HitObjects[i - 2] : null; + var last = beatmap.HitObjects[i - 1]; + var current = beatmap.HitObjects[i]; + + yield return new OsuDifficultyHitObject(lastLast, last, current, timeRate); + } + } + + protected override Skill[] CreateSkills() => new Skill[] + { + new Aim(), + new Speed() + }; + + protected override DifficultyAttributes CreateDifficultyAttributes(Mod[] mods) => new OsuDifficultyAttributes(mods); + + protected override Mod[] DifficultyAdjustmentMods => new Mod[] + { + new OsuModDoubleTime(), + new OsuModHalfTime(), + new OsuModEasy(), + new OsuModHardRock(), + }; + } +} diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuLegacyDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuLegacyDifficultyCalculator.cs deleted file mode 100644 index d01f75df6b..0000000000 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuLegacyDifficultyCalculator.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Linq; -using osu.Game.Beatmaps; -using osu.Game.Rulesets.Difficulty; -using osu.Game.Rulesets.Mods; -using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; -using osu.Game.Rulesets.Osu.Difficulty.Skills; -using osu.Game.Rulesets.Osu.Mods; -using osu.Game.Rulesets.Osu.Objects; - -namespace osu.Game.Rulesets.Osu.Difficulty -{ - public class OsuLegacyDifficultyCalculator : LegacyDifficultyCalculator - { - private const int section_length = 400; - private const double difficulty_multiplier = 0.0675; - - public OsuLegacyDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) - : base(ruleset, beatmap) - { - } - - protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate) - { - if (!beatmap.HitObjects.Any()) - return new OsuDifficultyAttributes(mods, 0); - - OsuDifficultyBeatmap difficultyBeatmap = new OsuDifficultyBeatmap(beatmap.HitObjects.Cast().ToList(), timeRate); - Skill[] skills = - { - new Aim(), - new Speed() - }; - - double sectionLength = section_length * timeRate; - - // The first object doesn't generate a strain, so we begin with an incremented section end - double currentSectionEnd = Math.Ceiling(beatmap.HitObjects.First().StartTime / sectionLength) * sectionLength; - - foreach (OsuDifficultyHitObject h in difficultyBeatmap) - { - while (h.BaseObject.StartTime > currentSectionEnd) - { - foreach (Skill s in skills) - { - s.SaveCurrentPeak(); - s.StartNewSectionFrom(currentSectionEnd); - } - - currentSectionEnd += sectionLength; - } - - foreach (Skill s in skills) - s.Process(h); - } - - // The peak strain will not be saved for the last section in the above loop - foreach (Skill s in skills) - s.SaveCurrentPeak(); - - double aimRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier; - double speedRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier; - double starRating = aimRating + speedRating + Math.Abs(aimRating - speedRating) / 2; - - // Todo: These int casts are temporary to achieve 1:1 results with osu!stable, and should be removed in the future - double hitWindowGreat = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate; - double preempt = (int)BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate; - - int maxCombo = beatmap.HitObjects.Count; - // Add the ticks + tail of the slider. 1 is subtracted because the head circle would be counted twice (once for the slider itself in the line above) - maxCombo += beatmap.HitObjects.OfType().Sum(s => s.NestedHitObjects.Count - 1); - - return new OsuDifficultyAttributes(mods, starRating) - { - AimStrain = aimRating, - SpeedStrain = speedRating, - ApproachRate = preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5, - OverallDifficulty = (80 - hitWindowGreat) / 6, - MaxCombo = maxCombo - }; - } - - protected override Mod[] DifficultyAdjustmentMods => new Mod[] - { - new OsuModDoubleTime(), - new OsuModHalfTime(), - new OsuModEasy(), - new OsuModHardRock(), - }; - } -} diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyBeatmap.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyBeatmap.cs deleted file mode 100644 index 068564d50c..0000000000 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyBeatmap.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using osu.Game.Rulesets.Osu.Objects; - -namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing -{ - /// - /// An enumerable container wrapping input as - /// which contains extra data required for difficulty calculation. - /// - public class OsuDifficultyBeatmap : IEnumerable - { - private readonly IEnumerator difficultyObjects; - - /// - /// Creates an enumerator, which preprocesses a list of s recieved as input, wrapping them as - /// which contains extra data required for difficulty calculation. - /// - public OsuDifficultyBeatmap(List objects, double timeRate) - { - // Sort OsuHitObjects by StartTime - they are not correctly ordered in some cases. - // This should probably happen before the objects reach the difficulty calculator. - difficultyObjects = createDifficultyObjectEnumerator(objects.OrderBy(h => h.StartTime).ToList(), timeRate); - } - - /// - /// Returns an enumerator that enumerates all s in the . - /// - public IEnumerator GetEnumerator() => difficultyObjects; - IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); - - private IEnumerator createDifficultyObjectEnumerator(List objects, double timeRate) - { - // The first jump is formed by the first two hitobjects of the map. - // If the map has less than two OsuHitObjects, the enumerator will not return anything. - for (int i = 1; i < objects.Count; i++) - { - var lastLast = i > 1 ? objects[i - 2] : null; - var last = objects[i - 1]; - var current = objects[i]; - - yield return new OsuDifficultyHitObject(lastLast, last, current, timeRate); - } - } - } -} diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 1ec12adb3b..31e69de6ab 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -1,24 +1,20 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System; using System.Linq; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Objects; using osuTK; namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing { - /// - /// A wrapper around extending it with additional data required for difficulty calculation. - /// - public class OsuDifficultyHitObject + public class OsuDifficultyHitObject : DifficultyHitObject { private const int normalized_radius = 52; - /// - /// The this refers to. - /// - public OsuHitObject BaseObject { get; } + protected new OsuHitObject BaseObject => (OsuHitObject)base.BaseObject; /// /// Normalized distance from the end position of the previous to the start position of this . @@ -30,40 +26,30 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing /// public double TravelDistance { get; private set; } - /// - /// Milliseconds elapsed since the StartTime of the previous . - /// - public double DeltaTime { get; private set; } - - /// - /// Milliseconds elapsed since the start time of the previous , with a minimum of 50ms. - /// - public double StrainTime { get; private set; } - /// /// Angle the player has to take to hit this . /// Calculated as the angle between the circles (current-2, current-1, current). /// public double? Angle { get; private set; } + /// + /// Milliseconds elapsed since the start time of the previous , with a minimum of 50ms. + /// + public readonly double StrainTime; + private readonly OsuHitObject lastLastObject; private readonly OsuHitObject lastObject; - private readonly double timeRate; - /// - /// Initializes the object calculating extra data required for difficulty calculation. - /// - public OsuDifficultyHitObject(OsuHitObject lastLastObject, OsuHitObject lastObject, OsuHitObject currentObject, double timeRate) + public OsuDifficultyHitObject(HitObject hitObject, HitObject lastLastObject, HitObject lastObject, double timeRate) + : base(hitObject, lastObject, timeRate) { - this.lastLastObject = lastLastObject; - this.lastObject = lastObject; - this.timeRate = timeRate; - - BaseObject = currentObject; + this.lastLastObject = (OsuHitObject)lastLastObject; + this.lastObject = (OsuHitObject)lastObject; setDistances(); - setTimingValues(); - // Calculate angle here + + // Every strain interval is hard capped at the equivalent of 375 BPM streaming speed as a safety measure + StrainTime = Math.Max(50, DeltaTime); } private void setDistances() @@ -102,14 +88,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing } } - private void setTimingValues() - { - DeltaTime = (BaseObject.StartTime - lastObject.StartTime) / timeRate; - - // Every strain interval is hard capped at the equivalent of 375 BPM streaming speed as a safety measure - StrainTime = Math.Max(50, DeltaTime); - } - private void computeSliderCursorPosition(Slider slider) { if (slider.LazyEndPosition != null) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index b5e57985e9..b2f2a3ac0b 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -2,6 +2,8 @@ // See the LICENCE file in the repository root for full licence text. using System; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Difficulty.Skills; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; namespace osu.Game.Rulesets.Osu.Difficulty.Skills @@ -17,33 +19,37 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double SkillMultiplier => 26.25; protected override double StrainDecayBase => 0.15; - protected override double StrainValueOf(OsuDifficultyHitObject current) + protected override double StrainValueOf(DifficultyHitObject current) { + var osuCurrent = (OsuDifficultyHitObject)current; + double result = 0; - const double scale = 90; - - double applyDiminishingExp(double val) => Math.Pow(val, 0.99); - if (Previous.Count > 0) { - if (current.Angle != null && current.Angle.Value > angle_bonus_begin) + var osuPrevious = (OsuDifficultyHitObject)Previous[0]; + + if (osuCurrent.Angle != null && osuCurrent.Angle.Value > angle_bonus_begin) { + const double scale = 90; + var angleBonus = Math.Sqrt( - Math.Max(Previous[0].JumpDistance - scale, 0) - * Math.Pow(Math.Sin(current.Angle.Value - angle_bonus_begin), 2) - * Math.Max(current.JumpDistance - scale, 0)); - result = 1.5 * applyDiminishingExp(Math.Max(0, angleBonus)) / Math.Max(timing_threshold, Previous[0].StrainTime); + Math.Max(osuPrevious.JumpDistance - scale, 0) + * Math.Pow(Math.Sin(osuCurrent.Angle.Value - angle_bonus_begin), 2) + * Math.Max(osuCurrent.JumpDistance - scale, 0)); + result = 1.5 * applyDiminishingExp(Math.Max(0, angleBonus)) / Math.Max(timing_threshold, osuPrevious.StrainTime); } } - double jumpDistanceExp = applyDiminishingExp(current.JumpDistance); - double travelDistanceExp = applyDiminishingExp(current.TravelDistance); + double jumpDistanceExp = applyDiminishingExp(osuCurrent.JumpDistance); + double travelDistanceExp = applyDiminishingExp(osuCurrent.TravelDistance); return Math.Max( - result + (jumpDistanceExp + travelDistanceExp + Math.Sqrt(travelDistanceExp * jumpDistanceExp)) / Math.Max(current.StrainTime, timing_threshold), - (Math.Sqrt(travelDistanceExp * jumpDistanceExp) + jumpDistanceExp + travelDistanceExp) / current.StrainTime + result + (jumpDistanceExp + travelDistanceExp + Math.Sqrt(travelDistanceExp * jumpDistanceExp)) / Math.Max(osuCurrent.StrainTime, timing_threshold), + (Math.Sqrt(travelDistanceExp * jumpDistanceExp) + jumpDistanceExp + travelDistanceExp) / osuCurrent.StrainTime ); } + + private double applyDiminishingExp(double val) => Math.Pow(val, 0.99); } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Skill.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Skill.cs deleted file mode 100644 index 2f23552eb9..0000000000 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Skill.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Collections.Generic; -using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; -using osu.Game.Rulesets.Osu.Difficulty.Utils; -using osu.Game.Rulesets.Osu.Objects; - -namespace osu.Game.Rulesets.Osu.Difficulty.Skills -{ - /// - /// Used to processes strain values of s, keep track of strain levels caused by the processed objects - /// and to calculate a final difficulty value representing the difficulty of hitting all the processed objects. - /// - public abstract class Skill - { - protected const double SINGLE_SPACING_THRESHOLD = 125; - protected const double STREAM_SPACING_THRESHOLD = 110; - - /// - /// Strain values are multiplied by this number for the given skill. Used to balance the value of different skills between each other. - /// - protected abstract double SkillMultiplier { get; } - - /// - /// Determines how quickly strain decays for the given skill. - /// For example a value of 0.15 indicates that strain decays to 15% of its original value in one second. - /// - protected abstract double StrainDecayBase { get; } - - /// - /// s that were processed previously. They can affect the strain values of the following objects. - /// - protected readonly History Previous = new History(2); // Contained objects not used yet - - private double currentStrain = 1; // We keep track of the strain level at all times throughout the beatmap. - private double currentSectionPeak = 1; // We also keep track of the peak strain level in the current section. - private readonly List strainPeaks = new List(); - - /// - /// Process an and update current strain values accordingly. - /// - public void Process(OsuDifficultyHitObject current) - { - currentStrain *= strainDecay(current.DeltaTime); - if (!(current.BaseObject is Spinner)) - currentStrain += StrainValueOf(current) * SkillMultiplier; - - currentSectionPeak = Math.Max(currentStrain, currentSectionPeak); - - Previous.Push(current); - } - - /// - /// Saves the current peak strain level to the list of strain peaks, which will be used to calculate an overall difficulty. - /// - public void SaveCurrentPeak() - { - if (Previous.Count > 0) - strainPeaks.Add(currentSectionPeak); - } - - /// - /// Sets the initial strain level for a new section. - /// - /// The beginning of the new section in milliseconds - public void StartNewSectionFrom(double offset) - { - // The maximum strain of the new section is not zero by default, strain decays as usual regardless of section boundaries. - // This means we need to capture the strain level at the beginning of the new section, and use that as the initial peak level. - if (Previous.Count > 0) - currentSectionPeak = currentStrain * strainDecay(offset - Previous[0].BaseObject.StartTime); - } - - /// - /// Returns the calculated difficulty value representing all processed s. - /// - public double DifficultyValue() - { - strainPeaks.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain. - - double difficulty = 0; - double weight = 1; - - // Difficulty is the weighted sum of the highest strains from every section. - foreach (double strain in strainPeaks) - { - difficulty += strain * weight; - weight *= 0.9; - } - - return difficulty; - } - - /// - /// Calculates the strain value of an . This value is affected by previously processed objects. - /// - protected abstract double StrainValueOf(OsuDifficultyHitObject current); - - private double strainDecay(double ms) => Math.Pow(StrainDecayBase, ms / 1000); - } -} diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index e78691ce53..de9a541ac9 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -2,6 +2,8 @@ // See the LICENCE file in the repository root for full licence text. using System; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Difficulty.Skills; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; namespace osu.Game.Rulesets.Osu.Difficulty.Skills @@ -11,6 +13,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills /// public class Speed : Skill { + private const double single_spacing_threshold = 125; + private const double angle_bonus_begin = 5 * Math.PI / 6; private const double pi_over_4 = Math.PI / 4; private const double pi_over_2 = Math.PI / 2; @@ -22,9 +26,11 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills private const double max_speed_bonus = 45; // ~330BPM private const double speed_balancing_factor = 40; - protected override double StrainValueOf(OsuDifficultyHitObject current) + protected override double StrainValueOf(DifficultyHitObject current) { - double distance = Math.Min(SINGLE_SPACING_THRESHOLD, current.TravelDistance + current.JumpDistance); + var osuCurrent = (OsuDifficultyHitObject)current; + + double distance = Math.Min(single_spacing_threshold, osuCurrent.TravelDistance + osuCurrent.JumpDistance); double deltaTime = Math.Max(max_speed_bonus, current.DeltaTime); double speedBonus = 1.0; @@ -32,20 +38,20 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills speedBonus = 1 + Math.Pow((min_speed_bonus - deltaTime) / speed_balancing_factor, 2); double angleBonus = 1.0; - if (current.Angle != null && current.Angle.Value < angle_bonus_begin) + if (osuCurrent.Angle != null && osuCurrent.Angle.Value < angle_bonus_begin) { - angleBonus = 1 + Math.Pow(Math.Sin(1.5 * (angle_bonus_begin - current.Angle.Value)), 2) / 3.57; - if (current.Angle.Value < pi_over_2) + angleBonus = 1 + Math.Pow(Math.Sin(1.5 * (angle_bonus_begin - osuCurrent.Angle.Value)), 2) / 3.57; + if (osuCurrent.Angle.Value < pi_over_2) { angleBonus = 1.28; - if (distance < 90 && current.Angle.Value < pi_over_4) + if (distance < 90 && osuCurrent.Angle.Value < pi_over_4) angleBonus += (1 - angleBonus) * Math.Min((90 - distance) / 10, 1); else if (distance < 90) - angleBonus += (1 - angleBonus) * Math.Min((90 - distance) / 10, 1) * Math.Sin((pi_over_2 - current.Angle.Value) / pi_over_4); + angleBonus += (1 - angleBonus) * Math.Min((90 - distance) / 10, 1) * Math.Sin((pi_over_2 - osuCurrent.Angle.Value) / pi_over_4); } } - return (1 + (speedBonus - 1) * 0.75) * angleBonus * (0.95 + speedBonus * Math.Pow(distance / SINGLE_SPACING_THRESHOLD, 3.5)) / current.StrainTime; + return (1 + (speedBonus - 1) * 0.75) * angleBonus * (0.95 + speedBonus * Math.Pow(distance / single_spacing_threshold, 3.5)) / osuCurrent.StrainTime; } } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/Utils/History.cs b/osu.Game.Rulesets.Osu/Difficulty/Utils/History.cs deleted file mode 100644 index e39351087e..0000000000 --- a/osu.Game.Rulesets.Osu/Difficulty/Utils/History.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace osu.Game.Rulesets.Osu.Difficulty.Utils -{ - /// - /// An indexed stack with Push() only, which disposes items at the bottom after the capacity is full. - /// Indexing starts at the top of the stack. - /// - public class History : IEnumerable - { - public int Count { get; private set; } - - private readonly T[] array; - private readonly int capacity; - private int marker; // Marks the position of the most recently added item. - - /// - /// Initializes a new instance of the History class that is empty and has the specified capacity. - /// - /// The number of items the History can hold. - public History(int capacity) - { - if (capacity < 0) - throw new ArgumentOutOfRangeException(); - - this.capacity = capacity; - array = new T[capacity]; - marker = capacity; // Set marker to the end of the array, outside of the indexed range by one. - } - - /// - /// The most recently added item is returned at index 0. - /// - public T this[int i] - { - get - { - if (i < 0 || i > Count - 1) - throw new IndexOutOfRangeException(); - - i += marker; - if (i > capacity - 1) - i -= capacity; - - return array[i]; - } - } - - /// - /// Adds the item as the most recent one in the history. - /// The oldest item is disposed if the history is full. - /// - public void Push(T item) // Overwrite the oldest item instead of shifting every item by one with every addition. - { - if (marker == 0) - marker = capacity - 1; - else - --marker; - - array[marker] = item; - - if (Count < capacity) - ++Count; - } - - /// - /// Returns an enumerator which enumerates items in the history starting from the most recently added one. - /// - public IEnumerator GetEnumerator() - { - for (int i = marker; i < capacity; ++i) - yield return array[i]; - - if (Count == capacity) - for (int i = 0; i < marker; ++i) - yield return array[i]; - } - - IEnumerator IEnumerable.GetEnumerator() => GetEnumerator(); - } -} diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 6fa1532580..aff91e0dcb 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -132,7 +132,7 @@ namespace osu.Game.Rulesets.Osu public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_osu_o }; - public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuLegacyDifficultyCalculator(this, beatmap); + public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(this, beatmap); public override PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => new OsuPerformanceCalculator(this, beatmap, score); From c930cc5fb548760654f7dc9c7088fedcd309da1c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 14 Feb 2019 12:11:03 +0900 Subject: [PATCH 057/327] Fix incorrect OsuDifficultyHitObject instantiation --- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 97a925360e..13d1621a39 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -59,7 +59,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty var last = beatmap.HitObjects[i - 1]; var current = beatmap.HitObjects[i]; - yield return new OsuDifficultyHitObject(lastLast, last, current, timeRate); + yield return new OsuDifficultyHitObject(current, lastLast, last, timeRate); } } From 659ec267b6d582bbe2f00a38078590f49ccd9045 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Feb 2019 14:58:33 +0900 Subject: [PATCH 058/327] Fix spinners increasing strain --- osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs | 4 ++++ osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs index b2f2a3ac0b..e74f4933b2 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Aim.cs @@ -5,6 +5,7 @@ using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Skills; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; +using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Difficulty.Skills { @@ -21,6 +22,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double StrainValueOf(DifficultyHitObject current) { + if (current.BaseObject is Spinner) + return 0; + var osuCurrent = (OsuDifficultyHitObject)current; double result = 0; diff --git a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs index de9a541ac9..46a81a9480 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Skills/Speed.cs @@ -5,6 +5,7 @@ using System; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Skills; using osu.Game.Rulesets.Osu.Difficulty.Preprocessing; +using osu.Game.Rulesets.Osu.Objects; namespace osu.Game.Rulesets.Osu.Difficulty.Skills { @@ -28,6 +29,9 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Skills protected override double StrainValueOf(DifficultyHitObject current) { + if (current.BaseObject is Spinner) + return 0; + var osuCurrent = (OsuDifficultyHitObject)current; double distance = Math.Min(single_spacing_threshold, osuCurrent.TravelDistance + osuCurrent.JumpDistance); From 68725dc005f85773144031367904f618f9653931 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 13 Feb 2019 15:49:30 +0900 Subject: [PATCH 059/327] Implement new difficulty calculator for Rulesets.Mania --- .../ManiaDifficultyCalculatorTest.cs | 2 +- .../Difficulty/ManiaDifficultyAttributes.cs | 4 +- .../Difficulty/ManiaDifficultyCalculator.cs | 96 ++++++++++ .../ManiaLegacyDifficultyCalculator.cs | 173 ------------------ .../Preprocessing/ManiaDifficultyHitObject.cs | 19 ++ .../Difficulty/Skills/Individual.cs | 47 +++++ .../Difficulty/Skills/Overall.cs | 56 ++++++ osu.Game.Rulesets.Mania/ManiaRuleset.cs | 2 +- .../Objects/ManiaHitObjectDifficulty.cs | 112 ------------ 9 files changed, 222 insertions(+), 289 deletions(-) create mode 100644 osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs delete mode 100644 osu.Game.Rulesets.Mania/Difficulty/ManiaLegacyDifficultyCalculator.cs create mode 100644 osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs create mode 100644 osu.Game.Rulesets.Mania/Difficulty/Skills/Individual.cs create mode 100644 osu.Game.Rulesets.Mania/Difficulty/Skills/Overall.cs delete mode 100644 osu.Game.Rulesets.Mania/Objects/ManiaHitObjectDifficulty.cs diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs index ef660b9ea8..a5c7e051d3 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Mania.Tests public void Test(double expected, string name) => base.Test(expected, name); - protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new ManiaLegacyDifficultyCalculator(new ManiaRuleset(), beatmap); + protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new ManiaDifficultyCalculator(new ManiaRuleset(), beatmap); protected override Ruleset CreateRuleset() => new ManiaRuleset(); } diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs index 2f614ea14b..4aa6cd730d 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs @@ -10,8 +10,8 @@ namespace osu.Game.Rulesets.Mania.Difficulty { public double GreatHitWindow; - public ManiaDifficultyAttributes(Mod[] mods, double starRating) - : base(mods, starRating) + public ManiaDifficultyAttributes(Mod[] mods) + : base(mods) { } } diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs new file mode 100644 index 0000000000..0abb339607 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs @@ -0,0 +1,96 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Collections.Generic; +using System.Linq; +using osu.Game.Beatmaps; +using osu.Game.Rulesets.Difficulty; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Difficulty.Skills; +using osu.Game.Rulesets.Mania.Beatmaps; +using osu.Game.Rulesets.Mania.Difficulty.Preprocessing; +using osu.Game.Rulesets.Mania.Difficulty.Skills; +using osu.Game.Rulesets.Mania.Mods; +using osu.Game.Rulesets.Mods; + +namespace osu.Game.Rulesets.Mania.Difficulty +{ + public class ManiaDifficultyCalculator : DifficultyCalculator + { + private const double star_scaling_factor = 0.018; + + private int columnCount; + + private readonly bool isForCurrentRuleset; + + public ManiaDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) + : base(ruleset, beatmap) + { + isForCurrentRuleset = beatmap.BeatmapInfo.Ruleset.Equals(ruleset.RulesetInfo); + } + + protected override void PopulateAttributes(DifficultyAttributes attributes, IBeatmap beatmap, Skill[] skills, double timeRate) + { + var maniaAttributes = (ManiaDifficultyAttributes)attributes; + + var overallStrain = skills.OfType().Single().DifficultyValue(); + var highestIndividual = skills.OfType().Max(s => s.DifficultyValue()); + + maniaAttributes.StarRating = (overallStrain + highestIndividual) * star_scaling_factor; + + // Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be removed in the future + maniaAttributes.GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate; + } + + protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double timeRate) + { + columnCount = ((ManiaBeatmap)beatmap).TotalColumns; + + for (int i = 1; i < beatmap.HitObjects.Count; i++) + yield return new ManiaDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], timeRate); + } + + protected override Skill[] CreateSkills() + { + var skills = new List { new Overall(columnCount) }; + + for (int i = 0; i < columnCount; i++) + skills.Add(new Individual(i, columnCount)); + + return skills.ToArray(); + } + + protected override DifficultyAttributes CreateDifficultyAttributes(Mod[] mods) => new ManiaDifficultyAttributes(mods); + + protected override Mod[] DifficultyAdjustmentMods + { + get + { + var mods = new Mod[] + { + new ManiaModDoubleTime(), + new ManiaModHalfTime(), + new ManiaModEasy(), + new ManiaModHardRock(), + }; + + if (isForCurrentRuleset) + return mods; + + // if we are a convert, we can be played in any key mod. + return mods.Concat(new Mod[] + { + new ManiaModKey1(), + new ManiaModKey2(), + new ManiaModKey3(), + new ManiaModKey4(), + new ManiaModKey5(), + new ManiaModKey6(), + new ManiaModKey7(), + new ManiaModKey8(), + new ManiaModKey9(), + }).ToArray(); + } + } + } +} diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaLegacyDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaLegacyDifficultyCalculator.cs deleted file mode 100644 index 02b03aca5d..0000000000 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaLegacyDifficultyCalculator.cs +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Collections.Generic; -using System.Linq; -using osu.Game.Beatmaps; -using osu.Game.Rulesets.Difficulty; -using osu.Game.Rulesets.Mania.Beatmaps; -using osu.Game.Rulesets.Mania.Mods; -using osu.Game.Rulesets.Mania.Objects; -using osu.Game.Rulesets.Mods; - -namespace osu.Game.Rulesets.Mania.Difficulty -{ - internal class ManiaLegacyDifficultyCalculator : LegacyDifficultyCalculator - { - private const double star_scaling_factor = 0.018; - - /// - /// In milliseconds. For difficulty calculation we will only look at the highest strain value in each time interval of size strain_step. - /// This is to eliminate higher influence of stream over aim by simply having more HitObjects with high strain. - /// The higher this value, the less strains there will be, indirectly giving long beatmaps an advantage. - /// - private const double strain_step = 400; - - /// - /// The weighting of each strain value decays to this number * it's previous value - /// - private const double decay_weight = 0.9; - - private readonly bool isForCurrentRuleset; - - public ManiaLegacyDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) - : base(ruleset, beatmap) - { - isForCurrentRuleset = beatmap.BeatmapInfo.Ruleset.Equals(ruleset.RulesetInfo); - } - - protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate) - { - if (!beatmap.HitObjects.Any()) - return new ManiaDifficultyAttributes(mods, 0); - - var difficultyHitObjects = new List(); - - int columnCount = ((ManiaBeatmap)beatmap).TotalColumns; - - // Sort DifficultyHitObjects by StartTime of the HitObjects - just to make sure. - // Note: Stable sort is done so that the ordering of hitobjects with equal start times doesn't change - difficultyHitObjects.AddRange(beatmap.HitObjects.Select(h => new ManiaHitObjectDifficulty((ManiaHitObject)h, columnCount)).OrderBy(h => h.BaseHitObject.StartTime)); - - if (!calculateStrainValues(difficultyHitObjects, timeRate)) - return new ManiaDifficultyAttributes(mods, 0); - - double starRating = calculateDifficulty(difficultyHitObjects, timeRate) * star_scaling_factor; - - return new ManiaDifficultyAttributes(mods, starRating) - { - // Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be remoevd in the future - GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate - }; - } - - private bool calculateStrainValues(List objects, double timeRate) - { - // Traverse hitObjects in pairs to calculate the strain value of NextHitObject from the strain value of CurrentHitObject and environment. - using (var hitObjectsEnumerator = objects.GetEnumerator()) - { - if (!hitObjectsEnumerator.MoveNext()) - return false; - - ManiaHitObjectDifficulty current = hitObjectsEnumerator.Current; - - // First hitObject starts at strain 1. 1 is the default for strain values, so we don't need to set it here. See DifficultyHitObject. - while (hitObjectsEnumerator.MoveNext()) - { - var next = hitObjectsEnumerator.Current; - next?.CalculateStrains(current, timeRate); - current = next; - } - - return true; - } - } - - private double calculateDifficulty(List objects, double timeRate) - { - double actualStrainStep = strain_step * timeRate; - - // Find the highest strain value within each strain step - List highestStrains = new List(); - double intervalEndTime = actualStrainStep; - double maximumStrain = 0; // We need to keep track of the maximum strain in the current interval - - ManiaHitObjectDifficulty previousHitObject = null; - foreach (var hitObject in objects) - { - // While we are beyond the current interval push the currently available maximum to our strain list - while (hitObject.BaseHitObject.StartTime > intervalEndTime) - { - highestStrains.Add(maximumStrain); - - // The maximum strain of the next interval is not zero by default! We need to take the last hitObject we encountered, take its strain and apply the decay - // until the beginning of the next interval. - if (previousHitObject == null) - { - maximumStrain = 0; - } - else - { - double individualDecay = Math.Pow(ManiaHitObjectDifficulty.INDIVIDUAL_DECAY_BASE, (intervalEndTime - previousHitObject.BaseHitObject.StartTime) / 1000); - double overallDecay = Math.Pow(ManiaHitObjectDifficulty.OVERALL_DECAY_BASE, (intervalEndTime - previousHitObject.BaseHitObject.StartTime) / 1000); - maximumStrain = previousHitObject.IndividualStrain * individualDecay + previousHitObject.OverallStrain * overallDecay; - } - - // Go to the next time interval - intervalEndTime += actualStrainStep; - } - - // Obtain maximum strain - double strain = hitObject.IndividualStrain + hitObject.OverallStrain; - maximumStrain = Math.Max(strain, maximumStrain); - - previousHitObject = hitObject; - } - - // Build the weighted sum over the highest strains for each interval - double difficulty = 0; - double weight = 1; - highestStrains.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain. - - foreach (double strain in highestStrains) - { - difficulty += weight * strain; - weight *= decay_weight; - } - - return difficulty; - } - - protected override Mod[] DifficultyAdjustmentMods - { - get - { - var mods = new Mod[] - { - new ManiaModDoubleTime(), - new ManiaModHalfTime(), - new ManiaModEasy(), - new ManiaModHardRock(), - }; - - if (isForCurrentRuleset) - return mods; - - // if we are a convert, we can be played in any key mod. - return mods.Concat(new Mod[] - { - new ManiaModKey1(), - new ManiaModKey2(), - new ManiaModKey3(), - new ManiaModKey4(), - new ManiaModKey5(), - new ManiaModKey6(), - new ManiaModKey7(), - new ManiaModKey8(), - new ManiaModKey9(), - }).ToArray(); - } - } - } -} diff --git a/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs b/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs new file mode 100644 index 0000000000..aa823e7586 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs @@ -0,0 +1,19 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Mania.Objects; +using osu.Game.Rulesets.Objects; + +namespace osu.Game.Rulesets.Mania.Difficulty.Preprocessing +{ + public class ManiaDifficultyHitObject : DifficultyHitObject + { + public new ManiaHitObject BaseObject => (ManiaHitObject)base.BaseObject; + + public ManiaDifficultyHitObject(HitObject hitObject, HitObject lastObject, double timeRate) + : base(hitObject, lastObject, timeRate) + { + } + } +} diff --git a/osu.Game.Rulesets.Mania/Difficulty/Skills/Individual.cs b/osu.Game.Rulesets.Mania/Difficulty/Skills/Individual.cs new file mode 100644 index 0000000000..059cd39641 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Difficulty/Skills/Individual.cs @@ -0,0 +1,47 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Linq; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Difficulty.Skills; +using osu.Game.Rulesets.Mania.Difficulty.Preprocessing; +using osu.Game.Rulesets.Mania.Objects; + +namespace osu.Game.Rulesets.Mania.Difficulty.Skills +{ + public class Individual : Skill + { + protected override double SkillMultiplier => 1; + protected override double StrainDecayBase => 0.125; + + private readonly double[] holdEndTimes; + + private readonly int column; + + public Individual(int column, int columnCount) + { + this.column = column; + + holdEndTimes = new double[columnCount]; + } + + protected override double StrainValueOf(DifficultyHitObject current) + { + var maniaCurrent = (ManiaDifficultyHitObject)current; + var endTime = (maniaCurrent.BaseObject as HoldNote)?.EndTime ?? maniaCurrent.BaseObject.StartTime; + + try + { + if (maniaCurrent.BaseObject.Column != column) + return 0; + + // We give a slight bonus if something is held meanwhile + return holdEndTimes.Any(t => t > endTime) ? 2.5 : 2; + } + finally + { + holdEndTimes[maniaCurrent.BaseObject.Column] = endTime; + } + } + } +} diff --git a/osu.Game.Rulesets.Mania/Difficulty/Skills/Overall.cs b/osu.Game.Rulesets.Mania/Difficulty/Skills/Overall.cs new file mode 100644 index 0000000000..ed25173d38 --- /dev/null +++ b/osu.Game.Rulesets.Mania/Difficulty/Skills/Overall.cs @@ -0,0 +1,56 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Difficulty.Skills; +using osu.Game.Rulesets.Mania.Difficulty.Preprocessing; +using osu.Game.Rulesets.Mania.Objects; + +namespace osu.Game.Rulesets.Mania.Difficulty.Skills +{ + public class Overall : Skill + { + protected override double SkillMultiplier => 1; + protected override double StrainDecayBase => 0.3; + + private readonly double[] holdEndTimes; + + private readonly int columnCount; + + public Overall(int columnCount) + { + this.columnCount = columnCount; + + holdEndTimes = new double[columnCount]; + } + + protected override double StrainValueOf(DifficultyHitObject current) + { + var maniaCurrent = (ManiaDifficultyHitObject)current; + var endTime = (maniaCurrent.BaseObject as HoldNote)?.EndTime ?? maniaCurrent.BaseObject.StartTime; + + double holdFactor = 1.0; // Factor in case something else is held + double holdAddition = 0; // Addition to the current note in case it's a hold and has to be released awkwardly + + for (int i = 0; i < columnCount; i++) + { + // If there is at least one other overlapping end or note, then we get an addition, buuuuuut... + if (current.BaseObject.StartTime < holdEndTimes[i] && endTime > holdEndTimes[i]) + holdAddition = 1.0; + + // ... this addition only is valid if there is _no_ other note with the same ending. + // Releasing multiple notes at the same time is just as easy as releasing one + if (endTime == holdEndTimes[i]) + holdAddition = 0; + + // We give a slight bonus if something is held meanwhile + if (holdEndTimes[i] > endTime) + holdFactor = 1.25; + } + + holdEndTimes[maniaCurrent.BaseObject.Column] = endTime; + + return (1 + holdAddition) * holdFactor; + } + } +} diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 7a2a539a9d..d86ee19802 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -156,7 +156,7 @@ namespace osu.Game.Rulesets.Mania public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_mania_o }; - public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new ManiaLegacyDifficultyCalculator(this, beatmap); + public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new ManiaDifficultyCalculator(this, beatmap); public override int? LegacyID => 3; diff --git a/osu.Game.Rulesets.Mania/Objects/ManiaHitObjectDifficulty.cs b/osu.Game.Rulesets.Mania/Objects/ManiaHitObjectDifficulty.cs deleted file mode 100644 index b6ea8c8665..0000000000 --- a/osu.Game.Rulesets.Mania/Objects/ManiaHitObjectDifficulty.cs +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Game.Rulesets.Objects.Types; -using System; - -namespace osu.Game.Rulesets.Mania.Objects -{ - internal class ManiaHitObjectDifficulty - { - /// - /// Factor by how much individual / overall strain decays per second. - /// - /// - /// These values are results of tweaking a lot and taking into account general feedback. - /// - internal const double INDIVIDUAL_DECAY_BASE = 0.125; - internal const double OVERALL_DECAY_BASE = 0.30; - - internal ManiaHitObject BaseHitObject; - - private readonly int beatmapColumnCount; - - private readonly double endTime; - private readonly double[] heldUntil; - - /// - /// Measures jacks or more generally: repeated presses of the same button - /// - private readonly double[] individualStrains; - - internal double IndividualStrain - { - get - { - return individualStrains[BaseHitObject.Column]; - } - - set - { - individualStrains[BaseHitObject.Column] = value; - } - } - - /// - /// Measures note density in a way - /// - internal double OverallStrain = 1; - - public ManiaHitObjectDifficulty(ManiaHitObject baseHitObject, int columnCount) - { - BaseHitObject = baseHitObject; - - endTime = (baseHitObject as IHasEndTime)?.EndTime ?? baseHitObject.StartTime; - - beatmapColumnCount = columnCount; - heldUntil = new double[beatmapColumnCount]; - individualStrains = new double[beatmapColumnCount]; - - for (int i = 0; i < beatmapColumnCount; ++i) - { - individualStrains[i] = 0; - heldUntil[i] = 0; - } - } - - internal void CalculateStrains(ManiaHitObjectDifficulty previousHitObject, double timeRate) - { - // TODO: Factor in holds - double timeElapsed = (BaseHitObject.StartTime - previousHitObject.BaseHitObject.StartTime) / timeRate; - double individualDecay = Math.Pow(INDIVIDUAL_DECAY_BASE, timeElapsed / 1000); - double overallDecay = Math.Pow(OVERALL_DECAY_BASE, timeElapsed / 1000); - - double holdFactor = 1.0; // Factor to all additional strains in case something else is held - double holdAddition = 0; // Addition to the current note in case it's a hold and has to be released awkwardly - - // Fill up the heldUntil array - for (int i = 0; i < beatmapColumnCount; ++i) - { - heldUntil[i] = previousHitObject.heldUntil[i]; - - // If there is at least one other overlapping end or note, then we get an addition, buuuuuut... - if (BaseHitObject.StartTime < heldUntil[i] && endTime > heldUntil[i]) - { - holdAddition = 1.0; - } - - // ... this addition only is valid if there is _no_ other note with the same ending. Releasing multiple notes at the same time is just as easy as releasing 1 - if (endTime == heldUntil[i]) - { - holdAddition = 0; - } - - // We give a slight bonus to everything if something is held meanwhile - if (heldUntil[i] > endTime) - { - holdFactor = 1.25; - } - - // Decay individual strains - individualStrains[i] = previousHitObject.individualStrains[i] * individualDecay; - } - - heldUntil[BaseHitObject.Column] = endTime; - - // Increase individual strain in own column - IndividualStrain += 2.0 * holdFactor; - - OverallStrain = previousHitObject.OverallStrain * overallDecay + (1.0 + holdAddition) * holdFactor; - } - } -} From 9cce9ce97c7bfda1bfe328dee6be550ce2fde57c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Feb 2019 15:00:32 +0900 Subject: [PATCH 060/327] Consider aggregate peaks --- .../Difficulty/ManiaDifficultyCalculator.cs | 37 +++++++++++++++++-- osu.Game/Rulesets/Difficulty/Skills/Skill.cs | 6 +++ 2 files changed, 39 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs index 0abb339607..523ac46515 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs @@ -33,15 +33,44 @@ namespace osu.Game.Rulesets.Mania.Difficulty { var maniaAttributes = (ManiaDifficultyAttributes)attributes; - var overallStrain = skills.OfType().Single().DifficultyValue(); - var highestIndividual = skills.OfType().Max(s => s.DifficultyValue()); - - maniaAttributes.StarRating = (overallStrain + highestIndividual) * star_scaling_factor; + maniaAttributes.StarRating = difficultyValue(skills) * star_scaling_factor; // Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be removed in the future maniaAttributes.GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate; } + private double difficultyValue(Skill[] skills) + { + // Preprocess the strains to find the maximum overall + individual (aggregate) strain from each section + var overall = skills.OfType().Single(); + var aggregatePeaks = new List(Enumerable.Repeat(0.0, overall.StrainPeaks.Count)); + + foreach (var individual in skills.OfType()) + { + for (int i = 0; i < individual.StrainPeaks.Count; i++) + { + double aggregate = individual.StrainPeaks[i] + overall.StrainPeaks[i]; + + if (aggregate > aggregatePeaks[i]) + aggregatePeaks[i] = aggregate; + } + } + + aggregatePeaks.Sort((a, b) => b.CompareTo(a)); // Sort from highest to lowest strain. + + double difficulty = 0; + double weight = 1; + + // Difficulty is the weighted sum of the highest strains from every section. + foreach (double strain in aggregatePeaks) + { + difficulty += strain * weight; + weight *= 0.9; + } + + return difficulty; + } + protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double timeRate) { columnCount = ((ManiaBeatmap)beatmap).TotalColumns; diff --git a/osu.Game/Rulesets/Difficulty/Skills/Skill.cs b/osu.Game/Rulesets/Difficulty/Skills/Skill.cs index fa7aa8f637..380531595a 100644 --- a/osu.Game/Rulesets/Difficulty/Skills/Skill.cs +++ b/osu.Game/Rulesets/Difficulty/Skills/Skill.cs @@ -14,6 +14,11 @@ namespace osu.Game.Rulesets.Difficulty.Skills /// public abstract class Skill { + /// + /// The peak strain for each section of the beatmap. + /// + public IList StrainPeaks => strainPeaks; + /// /// Strain values are multiplied by this number for the given skill. Used to balance the value of different skills between each other. /// @@ -37,6 +42,7 @@ namespace osu.Game.Rulesets.Difficulty.Skills private double currentStrain = 1; // We keep track of the strain level at all times throughout the beatmap. private double currentSectionPeak = 1; // We also keep track of the peak strain level in the current section. + private readonly List strainPeaks = new List(); /// From b47ced8c583d88cbec7fd5c89adc4f58ca3254b0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Feb 2019 15:01:14 +0900 Subject: [PATCH 061/327] Fix failing test --- osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs index a5c7e051d3..61ee322ce2 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Mania.Tests { protected override string ResourceAssembly => "osu.Game.Rulesets.Mania"; - [TestCase(2.2676066895468976, "diffcalc-test")] + [TestCase(2.3683365342338796d, "diffcalc-test")] public void Test(double expected, string name) => base.Test(expected, name); From ddc1ad848e3334f68d0d56ae2ffc0234f75d15b2 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Feb 2019 15:02:09 +0900 Subject: [PATCH 062/327] Fix failing test --- .../TaikoDifficultyCalculatorTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs index 16130c2c3d..a26b184766 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs @@ -13,8 +13,8 @@ namespace osu.Game.Rulesets.Taiko.Tests { protected override string ResourceAssembly => "osu.Game.Rulesets.Taiko"; - [TestCase(2.9811336589467095, "diffcalc-test")] - [TestCase(2.9811336589467095, "diffcalc-test-strong")] + [TestCase(2.9811338051242915d, "diffcalc-test")] + [TestCase(2.9811338051242915d, "diffcalc-test-strong")] public void Test(double expected, string name) => base.Test(expected, name); From 20f91106d9988154252a681d15841e3683594f47 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 18 Feb 2019 15:02:46 +0900 Subject: [PATCH 063/327] Fix failing test --- osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs index 61fb4ca5d1..c9831aad6d 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Catch.Tests { protected override string ResourceAssembly => "osu.Game.Rulesets.Catch"; - [TestCase(3.8664391043534758, "diffcalc-test")] + [TestCase(3.8701854263563118d, "diffcalc-test")] public void Test(double expected, string name) => base.Test(expected, name); From f241d67e5f79e8fea111bbf936215d7d67093804 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 18 Feb 2019 15:23:03 +0900 Subject: [PATCH 064/327] 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; From 79b12ef08547048be26e71cbb0a12ff5fc9b75f9 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 18 Feb 2019 15:29:39 +0900 Subject: [PATCH 065/327] Fix test build failure --- osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index a94f13b0b2..9f50759b04 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -65,7 +65,7 @@ namespace osu.Game.Tests.Visual { public bool AssertDimState() { - return FadeContainer.Colour == OsuColour.Gray(BackgroundOpacity); + return FadeContainer.Colour == OsuColour.Gray(1 - (float)DimLevel); } public bool AssertUndimmed() From 9be25c37589c3a3a33a3e7a6cbf96700d873af8e Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 18 Feb 2019 16:00:59 +0900 Subject: [PATCH 066/327] Fix unit tests --- osu.Game/Screens/Play/Player.cs | 3 ++- osu.Game/Screens/Play/PlayerLoader.cs | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 5aed939c03..2281324ce3 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -249,7 +249,8 @@ namespace osu.Game.Screens.Play foreach (var mod in Beatmap.Value.Mods.Value.OfType()) mod.ApplyToScoreProcessor(ScoreProcessor); - Background.UpdateDim.Value = true; + if (Background != null) + Background.UpdateDim.Value = true; } private void applyRateFromMods() diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 4bb126e0e2..4844883dfe 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -242,7 +242,9 @@ namespace osu.Game.Screens.Play content.ScaleTo(0.7f, 150, Easing.InQuint); this.FadeOut(150); cancelLoad(); - Background.UpdateDim.Value = false; + + if (Background != null) + Background.UpdateDim.Value = false; return base.OnExiting(next); } From 80800f29314ba5c8abd1d540646534578c6dd24c Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 18 Feb 2019 16:34:11 +0900 Subject: [PATCH 067/327] Match up fade behavior with current master --- osu.Game/Screens/Play/Player.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2281324ce3..a022088d18 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -248,9 +248,6 @@ namespace osu.Game.Screens.Play foreach (var mod in Beatmap.Value.Mods.Value.OfType()) mod.ApplyToScoreProcessor(ScoreProcessor); - - if (Background != null) - Background.UpdateDim.Value = true; } private void applyRateFromMods() @@ -302,6 +299,8 @@ namespace osu.Game.Screens.Play this.Push(CreateResults(score)); + Background.UpdateDim.Value = false; + onCompletionEvent = null; }); } @@ -349,6 +348,8 @@ namespace osu.Game.Screens.Play .Delay(250) .FadeIn(250); + Background.UpdateDim.Value = true; + Task.Run(() => { sourceClock.Reset(); @@ -391,7 +392,6 @@ namespace osu.Game.Screens.Play { // In the case of replays, we may have changed the playback rate. applyRateFromMods(); - Background.UpdateDim.Value = false; fadeOut(); return base.OnExiting(next); } @@ -409,7 +409,7 @@ namespace osu.Game.Screens.Play { float fadeOutDuration = instant ? 0 : 250; this.FadeOut(fadeOutDuration); - Background?.FadeColour(Color4.White, fadeOutDuration, Easing.OutQuint); + Background.UpdateDim.Value = false; } protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !pauseContainer.IsPaused; From 1d80674fbd04a3d5f4795644bb3150e32f8bddde Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 18 Feb 2019 17:11:38 +0900 Subject: [PATCH 068/327] Fix fadecontainer being added to multiple containers --- osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index d1c75f0e21..8b717f68d1 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -54,9 +54,9 @@ namespace osu.Game.Screens.Backgrounds } b.Depth = newDepth; FadeContainer.Child = Background = b; - InternalChild = FadeContainer; Background.BlurSigma = BlurTarget; })); + AddInternal(FadeContainer); }); } } From 4e07aba54852715882b3f5b53f5a5f1e96f78d61 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 18 Feb 2019 18:12:45 +0900 Subject: [PATCH 069/327] Make it so visual tests only load the osu ruleset --- osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs | 5 +++++ osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 9f50759b04..1c318ffbfe 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -4,6 +4,7 @@ using NUnit.Framework; using osu.Game.Graphics; using osu.Game.Rulesets; +using osu.Game.Rulesets.Osu; using osu.Game.Screens; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Play; @@ -13,6 +14,10 @@ namespace osu.Game.Tests.Visual [TestFixture] public class TestCaseBackgroundScreenBeatmap : TestCasePlayer { + public TestCaseBackgroundScreenBeatmap() : base(new OsuRuleset()) + { + } + /// /// Check if the fade container is properly being faded when screen dim is enabled. /// diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 8b717f68d1..312d760410 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -56,7 +56,8 @@ namespace osu.Game.Screens.Backgrounds FadeContainer.Child = Background = b; Background.BlurSigma = BlurTarget; })); - AddInternal(FadeContainer); + InternalChild = FadeContainer; + updateBackgroundDim(); }); } } From b353b6958763207cb95ea997319d4ac26e3c9c67 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 18 Feb 2019 18:58:34 +0900 Subject: [PATCH 070/327] Use a bindable for updating dim status instead --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 1c318ffbfe..1a41bff84c 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -2,9 +2,11 @@ // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; +using osu.Framework.Configuration; using osu.Game.Graphics; using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; +using osu.Game.Scoring; using osu.Game.Screens; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Play; @@ -18,13 +20,19 @@ namespace osu.Game.Tests.Visual { } + [SetUp] + public void Setup() + { + ((DimAccessiblePlayer)Player).UpdateBindables(); + } + /// /// Check if the fade container is properly being faded when screen dim is enabled. /// [Test] public void EnableUserDimTest() { - AddStep("Test User Dimming", () => ((DimAccessiblePlayer)Player).EnableScreenDim()); + AddStep("Test User Dimming", () => ((DimAccessiblePlayer)Player).DimEnabled.Value = true); AddWaitStep(5, "Wait for dim"); AddAssert("Check screen dim", () => ((DimAccessiblePlayer)Player).AssertDimState()); } @@ -35,7 +43,7 @@ namespace osu.Game.Tests.Visual [Test] public void DisableUserDimTest() { - AddStep("Test User Dimming", () => ((DimAccessiblePlayer)Player).DisableScreenDim()); + AddStep("Test User Undimming", () => ((DimAccessiblePlayer)Player).DimEnabled.Value = false); AddWaitStep(5, "Wait for dim"); AddAssert("Check screen dim", () => ((DimAccessiblePlayer)Player).AssertUndimmed()); } @@ -44,16 +52,13 @@ namespace osu.Game.Tests.Visual private class DimAccessiblePlayer : Player { + public Bindable DimEnabled; + protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); - public void EnableScreenDim() + public void UpdateBindables() { - Background.UpdateDim.Value = true; - } - - public void DisableScreenDim() - { - Background.UpdateDim.Value = false; + DimEnabled = Background.UpdateDim; } public bool AssertDimState() From af049004dde44028843f366af51d83e75c3e4ed4 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 18 Feb 2019 19:53:55 +0900 Subject: [PATCH 071/327] Add test cases for transitioning into pause overlay and into results --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 81 ++++++++++++++----- osu.Game/Screens/Play/Player.cs | 2 - 2 files changed, 60 insertions(+), 23 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 1a41bff84c..dc078aeeea 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -10,6 +10,9 @@ using osu.Game.Scoring; using osu.Game.Screens; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Play; +using osu.Game.Screens.Select; +using osu.Game.Users; +using osuTK.Graphics; namespace osu.Game.Tests.Visual { @@ -26,17 +29,6 @@ namespace osu.Game.Tests.Visual ((DimAccessiblePlayer)Player).UpdateBindables(); } - /// - /// Check if the fade container is properly being faded when screen dim is enabled. - /// - [Test] - public void EnableUserDimTest() - { - AddStep("Test User Dimming", () => ((DimAccessiblePlayer)Player).DimEnabled.Value = true); - AddWaitStep(5, "Wait for dim"); - AddAssert("Check screen dim", () => ((DimAccessiblePlayer)Player).AssertDimState()); - } - /// /// Check if the fade container is properly being reset when screen dim is disabled. /// @@ -45,11 +37,53 @@ namespace osu.Game.Tests.Visual { AddStep("Test User Undimming", () => ((DimAccessiblePlayer)Player).DimEnabled.Value = false); AddWaitStep(5, "Wait for dim"); - AddAssert("Check screen dim", () => ((DimAccessiblePlayer)Player).AssertUndimmed()); + AddAssert("Screen is undimmed", () => ((DimAccessiblePlayer)Player).AssertUndimmed()); + } + + /// + /// Check if the fade container is properly being faded when screen dim is enabled. + /// + [Test] + public void EnableUserDimTest() + { + AddStep("Test User Dimming", () => ((DimAccessiblePlayer)Player).DimEnabled.Value = true); + AddWaitStep(5, "Wait for dim"); + AddAssert("Screen is dimmed", () => ((DimAccessiblePlayer)Player).AssertDimState()); + } + + /// + /// Check if the fade container retains dim when pausing + /// + [Test] + public void PauseTest() + { + AddStep("Transition to Results", () => ((DimAccessiblePlayer)Player).TriggerExit()); + AddWaitStep(5, "Wait for dim"); + AddAssert("Screen is dimmed", () => ((DimAccessiblePlayer)Player).AssertDimState()); + } + + /// + /// Check if the fade container removes user dim when leaving the player + /// + [Test] + public void TransitionTest() + { + AddStep("Transition to Results", () => LoadScreen(new FadeAccesibleResults(new ScoreInfo { User = new User { Username = "osu!" }}))); + AddWaitStep(5, "Wait for dim"); + AddAssert("Screen is undimmed", () => ((DimAccessiblePlayer)Player).AssertUndimmed()); } protected override Player CreatePlayer(Ruleset ruleset) => new DimAccessiblePlayer(); + private class FadeAccesibleResults : SoloResults + { + public FadeAccesibleResults(ScoreInfo score) : base(score) + { + } + + protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); + } + private class DimAccessiblePlayer : Player { public Bindable DimEnabled; @@ -71,17 +105,22 @@ namespace osu.Game.Tests.Visual return ((FadeAccessibleBackground)Background).AssertUndimmed(); } - private class FadeAccessibleBackground : BackgroundScreenBeatmap + public void TriggerExit() { - public bool AssertDimState() - { - return FadeContainer.Colour == OsuColour.Gray(1 - (float)DimLevel); - } + OnExiting(new PlaySongSelect()); + } + } - public bool AssertUndimmed() - { - return FadeContainer.Colour == OsuColour.Gray(1.0f); - } + private class FadeAccessibleBackground : BackgroundScreenBeatmap + { + public bool AssertDimState() + { + return FadeContainer.Colour == OsuColour.Gray(1 - (float)DimLevel); + } + + public bool AssertUndimmed() + { + return FadeContainer.Colour == Color4.White; } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index a022088d18..2c0172b272 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -299,8 +299,6 @@ namespace osu.Game.Screens.Play this.Push(CreateResults(score)); - Background.UpdateDim.Value = false; - onCompletionEvent = null; }); } From 133c002d02829038d6b796dc9a4e73b9beb9e789 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Feb 2019 12:12:21 +0900 Subject: [PATCH 072/327] Fix test dlls being loaded as actual rulesets (and failing) --- osu.Game/Rulesets/RulesetStore.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/RulesetStore.cs b/osu.Game/Rulesets/RulesetStore.cs index 5283c5c3cf..0ebadd73d2 100644 --- a/osu.Game/Rulesets/RulesetStore.cs +++ b/osu.Game/Rulesets/RulesetStore.cs @@ -22,7 +22,8 @@ namespace osu.Game.Rulesets { AppDomain.CurrentDomain.AssemblyResolve += currentDomain_AssemblyResolve; - foreach (string file in Directory.GetFiles(Environment.CurrentDirectory, $"{ruleset_library_prefix}.*.dll")) + foreach (string file in Directory.GetFiles(Environment.CurrentDirectory, $"{ruleset_library_prefix}.*.dll") + .Where(f => !Path.GetFileName(f).Contains("Tests"))) loadRulesetFromFile(file); } @@ -124,7 +125,7 @@ namespace osu.Game.Rulesets } catch (Exception e) { - Logger.Error(e, "Failed to load ruleset"); + Logger.Error(e, $"Failed to load ruleset {filename}"); } } } From f8033a3b359dda92342e7d58405dc50293935cc3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Feb 2019 12:16:44 +0900 Subject: [PATCH 073/327] Give TestWorkingBeatmap a reference clock --- .../TestCaseTaikoPlayfield.cs | 2 +- .../Visual/TestCaseEditorCompose.cs | 2 +- .../Visual/TestCaseEditorSeekSnapping.cs | 2 +- .../Visual/TestCaseEditorSummaryTimeline.cs | 2 +- .../Visual/TestCasePlaybackControl.cs | 2 +- osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs | 87 +++++++++++++++++-- osu.Game/Tests/Visual/EditorTestCase.cs | 2 +- osu.Game/Tests/Visual/TestCasePlayer.cs | 2 +- 8 files changed, 89 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs index 2c02649102..00e1b649d9 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs @@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Taiko.Tests Ruleset = new TaikoRuleset().RulesetInfo }, ControlPointInfo = controlPointInfo - }); + }, Clock); Add(playfieldContainer = new Container { diff --git a/osu.Game.Tests/Visual/TestCaseEditorCompose.cs b/osu.Game.Tests/Visual/TestCaseEditorCompose.cs index 66e13545d9..a52454d684 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorCompose.cs +++ b/osu.Game.Tests/Visual/TestCaseEditorCompose.cs @@ -19,7 +19,7 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load() { - Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo); + Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo, Clock); Child = new ComposeScreen(); } } diff --git a/osu.Game.Tests/Visual/TestCaseEditorSeekSnapping.cs b/osu.Game.Tests/Visual/TestCaseEditorSeekSnapping.cs index 6cb9a1abfd..244f3b9d3d 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorSeekSnapping.cs +++ b/osu.Game.Tests/Visual/TestCaseEditorSeekSnapping.cs @@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual } }; - Beatmap.Value = new TestWorkingBeatmap(testBeatmap); + Beatmap.Value = new TestWorkingBeatmap(testBeatmap, Clock); Child = new TimingPointVisualiser(testBeatmap, 5000) { Clock = Clock }; } diff --git a/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs b/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs index b952582ef2..219b0d7b47 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs +++ b/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs @@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load() { - Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo); + Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo, Clock); Add(new SummaryTimeline { diff --git a/osu.Game.Tests/Visual/TestCasePlaybackControl.cs b/osu.Game.Tests/Visual/TestCasePlaybackControl.cs index 15b96d394a..60fd2fa79b 100644 --- a/osu.Game.Tests/Visual/TestCasePlaybackControl.cs +++ b/osu.Game.Tests/Visual/TestCasePlaybackControl.cs @@ -29,7 +29,7 @@ namespace osu.Game.Tests.Visual Size = new Vector2(200,100) }; - Beatmap.Value = new TestWorkingBeatmap(new Beatmap()); + Beatmap.Value = new TestWorkingBeatmap(new Beatmap(), Clock); Child = playback; } diff --git a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs index bfbfed082a..9a6d50ab11 100644 --- a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs +++ b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs @@ -1,29 +1,106 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Audio.Track; using osu.Framework.Graphics.Textures; +using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Rulesets; +using osuTK; namespace osu.Game.Tests.Beatmaps { public class TestWorkingBeatmap : WorkingBeatmap { - public TestWorkingBeatmap(RulesetInfo ruleset) - : this(new TestBeatmap(ruleset)) + private readonly TrackVirtualManual track; + private readonly IBeatmap beatmap; + + /// + /// Create an instance which creates a for the provided ruleset when requested. + /// + /// The target ruleset. + /// An optional clock which should be used instead of a stopwatch for virtual time progression. + public TestWorkingBeatmap(RulesetInfo ruleset, IFrameBasedClock referenceClock) + : this(new TestBeatmap(ruleset), referenceClock) { } - public TestWorkingBeatmap(IBeatmap beatmap) + /// + /// Create an instance which provides the when requested. + /// + /// The beatmap + /// An optional clock which should be used instead of a stopwatch for virtual time progression. + public TestWorkingBeatmap(IBeatmap beatmap, IFrameBasedClock referenceClock = null) : base(beatmap.BeatmapInfo) { this.beatmap = beatmap; + + if (referenceClock != null) + track = new TrackVirtualManual(referenceClock); } - private readonly IBeatmap beatmap; protected override IBeatmap GetBeatmap() => beatmap; protected override Texture GetBackground() => null; - protected override Track GetTrack() => null; + protected override Track GetTrack() => track; + } + + /// + /// A virtual track which tracks a reference clock. + /// + public class TrackVirtualManual : Track + { + private readonly IFrameBasedClock referenceClock; + private readonly ManualClock clock; + + private bool running; + private double offset; + + public TrackVirtualManual(IFrameBasedClock referenceClock) + { + this.referenceClock = referenceClock; + Length = double.PositiveInfinity; + clock = new ManualClock(); + } + + public override bool Seek(double seek) + { + offset = MathHelper.Clamp(seek, 0, Length) - referenceClock.CurrentTime; + return true; + } + + public override void Start() + { + running = true; + Seek(0); + } + + public override void Reset() + { + Seek(0); + base.Reset(); + } + + public override void Stop() + { + running = false; + } + + public override bool IsRunning => running; + + public override double CurrentTime => running ? clock.CurrentTime : 0; + + protected override void UpdateState() + { + base.UpdateState(); + + clock.CurrentTime = Math.Min(referenceClock.CurrentTime + offset, Length); + + if (CurrentTime >= Length) + { + Stop(); + RaiseCompleted(); + } + } } } diff --git a/osu.Game/Tests/Visual/EditorTestCase.cs b/osu.Game/Tests/Visual/EditorTestCase.cs index bc5f937480..b455ed2f05 100644 --- a/osu.Game/Tests/Visual/EditorTestCase.cs +++ b/osu.Game/Tests/Visual/EditorTestCase.cs @@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load() { - Beatmap.Value = new TestWorkingBeatmap(ruleset.RulesetInfo); + Beatmap.Value = new TestWorkingBeatmap(ruleset.RulesetInfo, Clock); LoadComponentAsync(new Editor(), LoadScreen); } diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs index a926a06295..60b630513a 100644 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ b/osu.Game/Tests/Visual/TestCasePlayer.cs @@ -99,7 +99,7 @@ namespace osu.Game.Tests.Visual private Player loadPlayerFor(Ruleset r) { var beatmap = CreateBeatmap(r); - var working = new TestWorkingBeatmap(beatmap); + var working = new TestWorkingBeatmap(beatmap, Clock); workingWeakReferences.Add(working); From 62fe5ad48117a278c658d55c28ee2997eb55271c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Feb 2019 12:35:52 +0900 Subject: [PATCH 074/327] Nest class --- osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs index 9a6d50ab11..aa4b3f3c03 100644 --- a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs +++ b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs @@ -43,63 +43,63 @@ namespace osu.Game.Tests.Beatmaps protected override IBeatmap GetBeatmap() => beatmap; protected override Texture GetBackground() => null; protected override Track GetTrack() => track; - } - /// - /// A virtual track which tracks a reference clock. - /// - public class TrackVirtualManual : Track - { - private readonly IFrameBasedClock referenceClock; - private readonly ManualClock clock; - - private bool running; - private double offset; - - public TrackVirtualManual(IFrameBasedClock referenceClock) + /// + /// A virtual track which tracks a reference clock. + /// + public class TrackVirtualManual : Track { - this.referenceClock = referenceClock; - Length = double.PositiveInfinity; - clock = new ManualClock(); - } + private readonly IFrameBasedClock referenceClock; + private readonly ManualClock clock; - public override bool Seek(double seek) - { - offset = MathHelper.Clamp(seek, 0, Length) - referenceClock.CurrentTime; - return true; - } + private bool running; + private double offset; - public override void Start() - { - running = true; - Seek(0); - } - - public override void Reset() - { - Seek(0); - base.Reset(); - } - - public override void Stop() - { - running = false; - } - - public override bool IsRunning => running; - - public override double CurrentTime => running ? clock.CurrentTime : 0; - - protected override void UpdateState() - { - base.UpdateState(); - - clock.CurrentTime = Math.Min(referenceClock.CurrentTime + offset, Length); - - if (CurrentTime >= Length) + public TrackVirtualManual(IFrameBasedClock referenceClock) { - Stop(); - RaiseCompleted(); + this.referenceClock = referenceClock; + Length = double.PositiveInfinity; + clock = new ManualClock(); + } + + public override bool Seek(double seek) + { + offset = MathHelper.Clamp(seek, 0, Length) - referenceClock.CurrentTime; + return true; + } + + public override void Start() + { + running = true; + Seek(0); + } + + public override void Reset() + { + Seek(0); + base.Reset(); + } + + public override void Stop() + { + running = false; + } + + public override bool IsRunning => running; + + public override double CurrentTime => running ? clock.CurrentTime : 0; + + protected override void UpdateState() + { + base.UpdateState(); + + clock.CurrentTime = Math.Min(referenceClock.CurrentTime + offset, Length); + + if (CurrentTime >= Length) + { + Stop(); + RaiseCompleted(); + } } } } From 0fce23a36bcb358f463971ea70a1dd735d2282ea Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Feb 2019 12:38:45 +0900 Subject: [PATCH 075/327] Fix test regression --- osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs | 2 +- osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs b/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs index 219b0d7b47..305924958b 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs +++ b/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs @@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load() { - Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo, Clock); + Beatmap.Value = new TestWorkingBeatmap(new OsuRuleset().RulesetInfo, null); Add(new SummaryTimeline { diff --git a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs index aa4b3f3c03..e6de9d37b2 100644 --- a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs +++ b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs @@ -20,7 +20,7 @@ namespace osu.Game.Tests.Beatmaps /// Create an instance which creates a for the provided ruleset when requested. /// /// The target ruleset. - /// An optional clock which should be used instead of a stopwatch for virtual time progression. + /// A clock which should be used instead of a stopwatch for virtual time progression. public TestWorkingBeatmap(RulesetInfo ruleset, IFrameBasedClock referenceClock) : this(new TestBeatmap(ruleset), referenceClock) { From 87dd7bcf6b2d31d7338c153c96b998f0bc70b37d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Feb 2019 13:02:33 +0900 Subject: [PATCH 076/327] Fix one more test regression --- osu.Game/Tests/Visual/EditorTestCase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Tests/Visual/EditorTestCase.cs b/osu.Game/Tests/Visual/EditorTestCase.cs index b455ed2f05..67a1cb6de3 100644 --- a/osu.Game/Tests/Visual/EditorTestCase.cs +++ b/osu.Game/Tests/Visual/EditorTestCase.cs @@ -24,7 +24,7 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load() { - Beatmap.Value = new TestWorkingBeatmap(ruleset.RulesetInfo, Clock); + Beatmap.Value = new TestWorkingBeatmap(ruleset.RulesetInfo, null); LoadComponentAsync(new Editor(), LoadScreen); } From af0bb4d5e8cdb14744c7330276c115c53af55a16 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 13:40:39 +0900 Subject: [PATCH 077/327] Remove mods from constructor --- osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs | 5 ++--- osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs b/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs index b1a88b8abd..d808ee528e 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyAttributes.cs @@ -7,13 +7,12 @@ namespace osu.Game.Rulesets.Difficulty { public class DifficultyAttributes { - public readonly Mod[] Mods; + public Mod[] Mods; public double StarRating; - public DifficultyAttributes(Mod[] mods) + public DifficultyAttributes() { - Mods = mods; } public DifficultyAttributes(Mod[] mods, double starRating) diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index d7ae527bb1..30fc698664 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -25,7 +25,8 @@ namespace osu.Game.Rulesets.Difficulty protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate) { - var attributes = CreateDifficultyAttributes(mods); + var attributes = CreateDifficultyAttributes(); + attributes.Mods = mods; if (!beatmap.HitObjects.Any()) return attributes; @@ -132,8 +133,7 @@ namespace osu.Game.Rulesets.Difficulty /// /// Creates an empty . /// - /// The s which difficulty is being processed with. /// The empty . - protected abstract DifficultyAttributes CreateDifficultyAttributes(Mod[] mods); + protected abstract DifficultyAttributes CreateDifficultyAttributes(); } } From 3784b673aec8a3139c622fb9935566834ee03756 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 13:51:19 +0900 Subject: [PATCH 078/327] History -> LimitedCapacityStack + re-xmldoc --- osu.Game/Rulesets/Difficulty/Skills/Skill.cs | 2 +- .../{History.cs => LimitedCapacityStack.cs} | 24 +++++++++++-------- 2 files changed, 15 insertions(+), 11 deletions(-) rename osu.Game/Rulesets/Difficulty/Utils/{History.cs => LimitedCapacityStack.cs} (69%) diff --git a/osu.Game/Rulesets/Difficulty/Skills/Skill.cs b/osu.Game/Rulesets/Difficulty/Skills/Skill.cs index fa7aa8f637..72bb686260 100644 --- a/osu.Game/Rulesets/Difficulty/Skills/Skill.cs +++ b/osu.Game/Rulesets/Difficulty/Skills/Skill.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Difficulty.Skills /// /// s that were processed previously. They can affect the strain values of the following objects. /// - protected readonly History Previous = new History(2); // Contained objects not used yet + protected readonly LimitedCapacityStack Previous = new LimitedCapacityStack(2); // Contained objects not used yet private double currentStrain = 1; // We keep track of the strain level at all times throughout the beatmap. private double currentSectionPeak = 1; // We also keep track of the peak strain level in the current section. diff --git a/osu.Game/Rulesets/Difficulty/Utils/History.cs b/osu.Game/Rulesets/Difficulty/Utils/LimitedCapacityStack.cs similarity index 69% rename from osu.Game/Rulesets/Difficulty/Utils/History.cs rename to osu.Game/Rulesets/Difficulty/Utils/LimitedCapacityStack.cs index d6647d5119..95b7d9b19d 100644 --- a/osu.Game/Rulesets/Difficulty/Utils/History.cs +++ b/osu.Game/Rulesets/Difficulty/Utils/LimitedCapacityStack.cs @@ -8,11 +8,13 @@ using System.Collections.Generic; namespace osu.Game.Rulesets.Difficulty.Utils { /// - /// An indexed stack with Push() only, which disposes items at the bottom after the capacity is full. - /// Indexing starts at the top of the stack. + /// An indexed stack with limited depth. Indexing starts at the top of the stack. /// - public class History : IEnumerable + public class LimitedCapacityStack : IEnumerable { + /// + /// The number of elements in the stack. + /// public int Count { get; private set; } private readonly T[] array; @@ -20,10 +22,10 @@ namespace osu.Game.Rulesets.Difficulty.Utils private int marker; // Marks the position of the most recently added item. /// - /// Initializes a new instance of the History class that is empty and has the specified capacity. + /// Constructs a new . /// - /// The number of items the History can hold. - public History(int capacity) + /// The number of items the stack can hold. + public LimitedCapacityStack(int capacity) { if (capacity < 0) throw new ArgumentOutOfRangeException(); @@ -34,8 +36,9 @@ namespace osu.Game.Rulesets.Difficulty.Utils } /// - /// The most recently added item is returned at index 0. + /// Retrieves the item at an index in the stack. /// + /// The index of the item to retrieve. The top of the stack is returned at index 0. public T this[int i] { get @@ -52,11 +55,12 @@ namespace osu.Game.Rulesets.Difficulty.Utils } /// - /// Adds the item as the most recent one in the history. - /// The oldest item is disposed if the history is full. + /// Pushes an item to this . /// - public void Push(T item) // Overwrite the oldest item instead of shifting every item by one with every addition. + /// The item to push. + public void Push(T item) { + // Overwrite the oldest item instead of shifting every item by one with every addition. if (marker == 0) marker = capacity - 1; else From 9d8ba4073c8eb5f29674cc0539961904620f5f7c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 14:17:23 +0900 Subject: [PATCH 079/327] Add tests for LimitedCapacityStack --- .../NonVisual/LimitedCapacityStackTest.cs | 115 ++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 osu.Game.Tests/NonVisual/LimitedCapacityStackTest.cs diff --git a/osu.Game.Tests/NonVisual/LimitedCapacityStackTest.cs b/osu.Game.Tests/NonVisual/LimitedCapacityStackTest.cs new file mode 100644 index 0000000000..1c78b63499 --- /dev/null +++ b/osu.Game.Tests/NonVisual/LimitedCapacityStackTest.cs @@ -0,0 +1,115 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using NUnit.Framework; +using osu.Game.Rulesets.Difficulty.Utils; + +namespace osu.Game.Tests.NonVisual +{ + [TestFixture] + public class LimitedCapacityStackTest + { + private const int capacity = 3; + + private LimitedCapacityStack stack; + + [SetUp] + public void Setup() + { + stack = new LimitedCapacityStack(capacity); + } + + [Test] + public void TestEmptyStack() + { + Assert.AreEqual(0, stack.Count); + + Assert.Throws(() => + { + int unused = stack[0]; + }); + + int count = 0; + foreach (var unused in stack) + count++; + + Assert.AreEqual(0, count); + } + + [TestCase(1)] + [TestCase(2)] + [TestCase(3)] + public void TestInRangeElements(int count) + { + // e.g. 0 -> 1 -> 2 + for (int i = 0; i < count; i++) + stack.Push(i); + + Assert.AreEqual(count, stack.Count); + + // e.g. 2 -> 1 -> 0 (reverse order) + for (int i = 0; i < stack.Count; i++) + Assert.AreEqual(count - 1 - i, stack[i]); + + // e.g. indices 3, 4, 5, 6 (out of range) + for (int i = stack.Count; i < stack.Count + capacity; i++) + { + Assert.Throws(() => + { + int unused = stack[i]; + }); + } + } + + [TestCase(4)] + [TestCase(5)] + [TestCase(6)] + public void TestOverflowElements(int count) + { + // e.g. 0 -> 1 -> 2 -> 3 + for (int i = 0; i < count; i++) + stack.Push(i); + + Assert.AreEqual(capacity, stack.Count); + + // e.g. 3 -> 2 -> 1 (reverse order) + for (int i = 0; i < stack.Count; i++) + Assert.AreEqual(count - 1 - i, stack[i]); + + // e.g. indices 3, 4, 5, 6 (out of range) + for (int i = stack.Count; i < stack.Count + capacity; i++) + { + Assert.Throws(() => + { + int unused = stack[i]; + }); + } + } + + [TestCase(1)] + [TestCase(2)] + [TestCase(3)] + [TestCase(4)] + [TestCase(5)] + [TestCase(6)] + public void TestEnumerator(int count) + { + // e.g. 0 -> 1 -> 2 -> 3 + for (int i = 0; i < count; i++) + stack.Push(i); + + int enumeratorCount = 0; + int expectedValue = count - 1; + + foreach (var item in stack) + { + Assert.AreEqual(expectedValue, item); + enumeratorCount++; + expectedValue--; + } + + Assert.AreEqual(stack.Count, enumeratorCount); + } + } +} From 93b7b51d0a018dadbe52bff79c9d1ab69a3ce4dc Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 14:29:23 +0900 Subject: [PATCH 080/327] timeRate -> clockRate --- .../CatchLegacyDifficultyCalculator.cs | 8 ++++---- .../ManiaLegacyDifficultyCalculator.cs | 8 ++++---- .../Difficulty/OsuLegacyDifficultyCalculator.cs | 10 +++++----- .../TaikoLegacyDifficultyCalculator.cs | 8 ++++---- .../DifficultyAdjustmentModCombinationsTest.cs | 2 +- .../Rulesets/Difficulty/DifficultyCalculator.cs | 16 ++++++++-------- .../Difficulty/LegacyDifficultyCalculator.cs | 4 ++-- .../Preprocessing/DifficultyHitObject.cs | 4 ++-- 8 files changed, 30 insertions(+), 30 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchLegacyDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchLegacyDifficultyCalculator.cs index 0a0897d97b..e1f17f309b 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchLegacyDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchLegacyDifficultyCalculator.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty { } - protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate) + protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate) { if (!beatmap.HitObjects.Any()) return new CatchDifficultyAttributes(mods, 0); @@ -59,12 +59,12 @@ namespace osu.Game.Rulesets.Catch.Difficulty difficultyHitObjects.Sort((a, b) => a.BaseHitObject.StartTime.CompareTo(b.BaseHitObject.StartTime)); - if (!calculateStrainValues(difficultyHitObjects, timeRate)) + if (!calculateStrainValues(difficultyHitObjects, clockRate)) return new CatchDifficultyAttributes(mods, 0); // this is the same as osu!, so there's potential to share the implementation... maybe - double preempt = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate; - double starRating = Math.Sqrt(calculateDifficulty(difficultyHitObjects, timeRate)) * star_scaling_factor; + double preempt = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / clockRate; + double starRating = Math.Sqrt(calculateDifficulty(difficultyHitObjects, clockRate)) * star_scaling_factor; return new CatchDifficultyAttributes(mods, starRating) { diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaLegacyDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaLegacyDifficultyCalculator.cs index 02b03aca5d..833454bf32 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaLegacyDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaLegacyDifficultyCalculator.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty isForCurrentRuleset = beatmap.BeatmapInfo.Ruleset.Equals(ruleset.RulesetInfo); } - protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate) + protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate) { if (!beatmap.HitObjects.Any()) return new ManiaDifficultyAttributes(mods, 0); @@ -50,15 +50,15 @@ namespace osu.Game.Rulesets.Mania.Difficulty // Note: Stable sort is done so that the ordering of hitobjects with equal start times doesn't change difficultyHitObjects.AddRange(beatmap.HitObjects.Select(h => new ManiaHitObjectDifficulty((ManiaHitObject)h, columnCount)).OrderBy(h => h.BaseHitObject.StartTime)); - if (!calculateStrainValues(difficultyHitObjects, timeRate)) + if (!calculateStrainValues(difficultyHitObjects, clockRate)) return new ManiaDifficultyAttributes(mods, 0); - double starRating = calculateDifficulty(difficultyHitObjects, timeRate) * star_scaling_factor; + double starRating = calculateDifficulty(difficultyHitObjects, clockRate) * star_scaling_factor; return new ManiaDifficultyAttributes(mods, starRating) { // Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be remoevd in the future - GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate + GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / clockRate }; } diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuLegacyDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuLegacyDifficultyCalculator.cs index d01f75df6b..137630fb85 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuLegacyDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuLegacyDifficultyCalculator.cs @@ -23,19 +23,19 @@ namespace osu.Game.Rulesets.Osu.Difficulty { } - protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate) + protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate) { if (!beatmap.HitObjects.Any()) return new OsuDifficultyAttributes(mods, 0); - OsuDifficultyBeatmap difficultyBeatmap = new OsuDifficultyBeatmap(beatmap.HitObjects.Cast().ToList(), timeRate); + OsuDifficultyBeatmap difficultyBeatmap = new OsuDifficultyBeatmap(beatmap.HitObjects.Cast().ToList(), clockRate); Skill[] skills = { new Aim(), new Speed() }; - double sectionLength = section_length * timeRate; + double sectionLength = section_length * clockRate; // The first object doesn't generate a strain, so we begin with an incremented section end double currentSectionEnd = Math.Ceiling(beatmap.HitObjects.First().StartTime / sectionLength) * sectionLength; @@ -66,8 +66,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty double starRating = aimRating + speedRating + Math.Abs(aimRating - speedRating) / 2; // Todo: These int casts are temporary to achieve 1:1 results with osu!stable, and should be removed in the future - double hitWindowGreat = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate; - double preempt = (int)BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate; + double hitWindowGreat = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / clockRate; + double preempt = (int)BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / clockRate; int maxCombo = beatmap.HitObjects.Count; // Add the ticks + tail of the slider. 1 is subtracted because the head circle would be counted twice (once for the slider itself in the line above) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoLegacyDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoLegacyDifficultyCalculator.cs index 650b367e34..22ee39541b 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoLegacyDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoLegacyDifficultyCalculator.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty { } - protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate) + protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate) { if (!beatmap.HitObjects.Any()) return new TaikoDifficultyAttributes(mods, 0); @@ -46,15 +46,15 @@ namespace osu.Game.Rulesets.Taiko.Difficulty // Sort DifficultyHitObjects by StartTime of the HitObjects - just to make sure. difficultyHitObjects.Sort((a, b) => a.BaseHitObject.StartTime.CompareTo(b.BaseHitObject.StartTime)); - if (!calculateStrainValues(difficultyHitObjects, timeRate)) + if (!calculateStrainValues(difficultyHitObjects, clockRate)) return new TaikoDifficultyAttributes(mods, 0); - double starRating = calculateDifficulty(difficultyHitObjects, timeRate) * star_scaling_factor; + double starRating = calculateDifficulty(difficultyHitObjects, clockRate) * star_scaling_factor; return new TaikoDifficultyAttributes(mods, starRating) { // Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be remoevd in the future - GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate, + GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / clockRate, MaxCombo = beatmap.HitObjects.Count(h => h is Hit) }; } diff --git a/osu.Game.Tests/NonVisual/DifficultyAdjustmentModCombinationsTest.cs b/osu.Game.Tests/NonVisual/DifficultyAdjustmentModCombinationsTest.cs index f57f25e1ff..cc73cd54a2 100644 --- a/osu.Game.Tests/NonVisual/DifficultyAdjustmentModCombinationsTest.cs +++ b/osu.Game.Tests/NonVisual/DifficultyAdjustmentModCombinationsTest.cs @@ -146,7 +146,7 @@ namespace osu.Game.Tests.NonVisual protected override Mod[] DifficultyAdjustmentMods { get; } - protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate) => throw new NotImplementedException(); + protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate) => throw new NotImplementedException(); } } } diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index 30fc698664..ecfca9c589 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Difficulty { } - protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate) + protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate) { var attributes = CreateDifficultyAttributes(); attributes.Mods = mods; @@ -31,10 +31,10 @@ namespace osu.Game.Rulesets.Difficulty if (!beatmap.HitObjects.Any()) return attributes; - var difficultyHitObjects = CreateDifficultyHitObjects(beatmap, timeRate).OrderBy(h => h.BaseObject.StartTime).ToList(); + var difficultyHitObjects = CreateDifficultyHitObjects(beatmap, clockRate).OrderBy(h => h.BaseObject.StartTime).ToList(); var skills = CreateSkills(); - double sectionLength = SectionLength * timeRate; + double sectionLength = SectionLength * clockRate; // The first object doesn't generate a strain, so we begin with an incremented section end double currentSectionEnd = Math.Ceiling(beatmap.HitObjects.First().StartTime / sectionLength) * sectionLength; @@ -60,7 +60,7 @@ namespace osu.Game.Rulesets.Difficulty foreach (Skill s in skills) s.SaveCurrentPeak(); - PopulateAttributes(attributes, beatmap, skills, timeRate); + PopulateAttributes(attributes, beatmap, skills, clockRate); return attributes; } @@ -113,16 +113,16 @@ namespace osu.Game.Rulesets.Difficulty /// The to populate with information about the difficulty of . /// The whose difficulty was processed. /// The skills which processed the difficulty. - /// The rate of time in . - protected abstract void PopulateAttributes(DifficultyAttributes attributes, IBeatmap beatmap, Skill[] skills, double timeRate); + /// The rate at which the gameplay clock is run at. + protected abstract void PopulateAttributes(DifficultyAttributes attributes, IBeatmap beatmap, Skill[] skills, double clockRate); /// /// Enumerates s to be processed from s in the . /// /// The providing the s to enumerate. - /// The rate of time in . + /// The rate at which the gameplay clock is run at. /// The enumerated s. - protected abstract IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double timeRate); + protected abstract IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate); /// /// Creates the s to calculate the difficulty of s. diff --git a/osu.Game/Rulesets/Difficulty/LegacyDifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/LegacyDifficultyCalculator.cs index 15565ef847..a1324601aa 100644 --- a/osu.Game/Rulesets/Difficulty/LegacyDifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/LegacyDifficultyCalculator.cs @@ -100,8 +100,8 @@ namespace osu.Game.Rulesets.Difficulty /// /// The to compute the difficulty for. /// The s that should be applied. - /// The rate of time in . + /// The rate at which the gameplay clock is run at. /// A structure containing the difficulty attributes. - protected abstract DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double timeRate); + protected abstract DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate); } } diff --git a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs index 77c9b7e47f..23a8740f3d 100644 --- a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs +++ b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs @@ -22,11 +22,11 @@ namespace osu.Game.Rulesets.Difficulty.Preprocessing /// public readonly HitObject LastObject; - public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double timeRate) + public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate) { BaseObject = hitObject; LastObject = lastObject; - DeltaTime = (hitObject.StartTime - lastObject.StartTime) / timeRate; + DeltaTime = (hitObject.StartTime - lastObject.StartTime) / clockRate; } } } From 7ed461aa8c31a55775fde83f39d273c8b4383542 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 14:30:59 +0900 Subject: [PATCH 081/327] XMLDoc DifficultyHitObject --- .../Preprocessing/DifficultyHitObject.cs | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs index 23a8740f3d..ebbffb5143 100644 --- a/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs +++ b/osu.Game/Rulesets/Difficulty/Preprocessing/DifficultyHitObject.cs @@ -5,23 +5,32 @@ using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Difficulty.Preprocessing { + /// + /// Wraps a and provides additional information to be used for difficulty calculation. + /// public class DifficultyHitObject { /// - /// Milliseconds elapsed since the of the previous . - /// - public double DeltaTime { get; private set; } - - /// - /// The this refers to. + /// The this wraps. /// public readonly HitObject BaseObject; /// - /// The previous to . + /// The last which occurs before . /// public readonly HitObject LastObject; + /// + /// Amount of time elapsed between and . + /// + public readonly double DeltaTime; + + /// + /// Creates a new . + /// + /// The which this wraps. + /// The last which occurs before in the beatmap. + /// The rate at which the gameplay clock is run at. public DifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate) { BaseObject = hitObject; From ade5763160835ef79f0794e709dd2da820f0b16c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 14:34:02 +0900 Subject: [PATCH 082/327] Fix post-merge errors --- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs | 6 ------ osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs index 9a9e72a056..6e991a1d08 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyAttributes.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using osu.Game.Rulesets.Difficulty; -using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Osu.Difficulty { @@ -13,10 +12,5 @@ namespace osu.Game.Rulesets.Osu.Difficulty public double ApproachRate; public double OverallDifficulty; public int MaxCombo; - - public OsuDifficultyAttributes(Mod[] mods) - : base(mods) - { - } } } diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 13d1621a39..9bbdb75343 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -69,7 +69,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty new Speed() }; - protected override DifficultyAttributes CreateDifficultyAttributes(Mod[] mods) => new OsuDifficultyAttributes(mods); + protected override DifficultyAttributes CreateDifficultyAttributes() => new OsuDifficultyAttributes(); protected override Mod[] DifficultyAdjustmentMods => new Mod[] { From 0609fcf7d4a2a06af0b04d91a6432aebe3008494 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Feb 2019 15:52:53 +0900 Subject: [PATCH 083/327] Fix TestCaseMultiScreen intermittent failures --- osu.Game.Tests/Visual/TestCaseMultiScreen.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseMultiScreen.cs b/osu.Game.Tests/Visual/TestCaseMultiScreen.cs index fc4037f58b..8faaefb0bd 100644 --- a/osu.Game.Tests/Visual/TestCaseMultiScreen.cs +++ b/osu.Game.Tests/Visual/TestCaseMultiScreen.cs @@ -26,7 +26,7 @@ namespace osu.Game.Tests.Visual Multiplayer multi = new Multiplayer(); AddStep(@"show", () => LoadScreen(multi)); - AddWaitStep(5); + AddUntilStep(() => multi.IsCurrentScreen(), "wait until current"); AddStep(@"exit", multi.Exit); } } From bf1782636368d6428d0c9b7219fd22dcc858bd34 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 16:30:29 +0900 Subject: [PATCH 084/327] Fix post-merge errors --- .../Difficulty/ManiaDifficultyAttributes.cs | 6 ------ .../Difficulty/ManiaDifficultyCalculator.cs | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs index 4aa6cd730d..3ff665d2c8 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyAttributes.cs @@ -2,17 +2,11 @@ // See the LICENCE file in the repository root for full licence text. using osu.Game.Rulesets.Difficulty; -using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Mania.Difficulty { public class ManiaDifficultyAttributes : DifficultyAttributes { public double GreatHitWindow; - - public ManiaDifficultyAttributes(Mod[] mods) - : base(mods) - { - } } } diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs index 523ac46515..1e7e16329a 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs @@ -89,7 +89,7 @@ namespace osu.Game.Rulesets.Mania.Difficulty return skills.ToArray(); } - protected override DifficultyAttributes CreateDifficultyAttributes(Mod[] mods) => new ManiaDifficultyAttributes(mods); + protected override DifficultyAttributes CreateDifficultyAttributes() => new ManiaDifficultyAttributes(); protected override Mod[] DifficultyAdjustmentMods { From 7ba0d090fc2a1491050c05c48219add0ad0306a8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 16:40:52 +0900 Subject: [PATCH 085/327] Fix post-merge errors --- .../Difficulty/TaikoDifficultyAttributes.cs | 6 ------ .../Difficulty/TaikoDifficultyCalculator.cs | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs index 07721e2ac5..75d3807bba 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyAttributes.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using osu.Game.Rulesets.Difficulty; -using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Taiko.Difficulty { @@ -10,10 +9,5 @@ namespace osu.Game.Rulesets.Taiko.Difficulty { public double GreatHitWindow; public int MaxCombo; - - public TaikoDifficultyAttributes(Mod[] mods) - : base(mods) - { - } } } diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs index 1cdb3495ae..e2c0ea7f46 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty protected override Skill[] CreateSkills() => new Skill[] { new Strain() }; - protected override DifficultyAttributes CreateDifficultyAttributes(Mod[] mods) => new TaikoDifficultyAttributes(mods); + protected override DifficultyAttributes CreateDifficultyAttributes() => new TaikoDifficultyAttributes(); protected override Mod[] DifficultyAdjustmentMods => new Mod[] { From 3abb281ad570ceebdd58a5d53457e031f24fd239 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 16:41:53 +0900 Subject: [PATCH 086/327] Fix post-merge errors --- .../Difficulty/CatchDifficultyAttributes.cs | 6 ------ .../Difficulty/CatchDifficultyCalculator.cs | 3 +-- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs index 8669543841..75f5b18607 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyAttributes.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using osu.Game.Rulesets.Difficulty; -using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Catch.Difficulty { @@ -10,10 +9,5 @@ namespace osu.Game.Rulesets.Catch.Difficulty { public double ApproachRate; public int MaxCombo; - - public CatchDifficultyAttributes(Mod[] mods) - : base(mods) - { - } } } diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index d4110ab1e1..f8ca066a4f 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -12,7 +12,6 @@ using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Skills; -using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Catch.Difficulty { @@ -78,6 +77,6 @@ namespace osu.Game.Rulesets.Catch.Difficulty new Movement(), }; - protected override DifficultyAttributes CreateDifficultyAttributes(Mod[] mods) => new CatchDifficultyAttributes(mods); + protected override DifficultyAttributes CreateDifficultyAttributes() => new CatchDifficultyAttributes(); } } From 618455f7ba3496591bc8ea2e8859e7ae74de3328 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Feb 2019 16:47:59 +0900 Subject: [PATCH 087/327] Remove exit step (needs login to show properly) --- osu.Game.Tests/Visual/TestCaseMultiScreen.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseMultiScreen.cs b/osu.Game.Tests/Visual/TestCaseMultiScreen.cs index 8faaefb0bd..ff95d5836d 100644 --- a/osu.Game.Tests/Visual/TestCaseMultiScreen.cs +++ b/osu.Game.Tests/Visual/TestCaseMultiScreen.cs @@ -26,8 +26,6 @@ namespace osu.Game.Tests.Visual Multiplayer multi = new Multiplayer(); AddStep(@"show", () => LoadScreen(multi)); - AddUntilStep(() => multi.IsCurrentScreen(), "wait until current"); - AddStep(@"exit", multi.Exit); } } } From 4504aee089f3a2dd6400ef98aaf3d8705196a353 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Feb 2019 16:50:56 +0900 Subject: [PATCH 088/327] Unnecessary using --- osu.Game.Tests/Visual/TestCaseMultiScreen.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseMultiScreen.cs b/osu.Game.Tests/Visual/TestCaseMultiScreen.cs index ff95d5836d..804e3c5b1f 100644 --- a/osu.Game.Tests/Visual/TestCaseMultiScreen.cs +++ b/osu.Game.Tests/Visual/TestCaseMultiScreen.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using NUnit.Framework; -using osu.Framework.Screens; using osu.Game.Screens.Multi; using osu.Game.Screens.Multi.Lounge; using osu.Game.Screens.Multi.Lounge.Components; From ca8b7f24b46f69c92478408f42a9a549a86d0e2c Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 17:36:33 +0900 Subject: [PATCH 089/327] Remove PopulateAttributes() --- .../Difficulty/DifficultyCalculator.cs | 22 +++++-------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index ecfca9c589..c6e54c52e7 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -25,14 +25,12 @@ namespace osu.Game.Rulesets.Difficulty protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate) { - var attributes = CreateDifficultyAttributes(); - attributes.Mods = mods; + var skills = CreateSkills(); if (!beatmap.HitObjects.Any()) - return attributes; + return CreateDifficultyAttributes(beatmap, mods, skills, clockRate); var difficultyHitObjects = CreateDifficultyHitObjects(beatmap, clockRate).OrderBy(h => h.BaseObject.StartTime).ToList(); - var skills = CreateSkills(); double sectionLength = SectionLength * clockRate; @@ -60,9 +58,7 @@ namespace osu.Game.Rulesets.Difficulty foreach (Skill s in skills) s.SaveCurrentPeak(); - PopulateAttributes(attributes, beatmap, skills, clockRate); - - return attributes; + return CreateDifficultyAttributes(beatmap, mods, skills, clockRate); } /// @@ -108,13 +104,13 @@ namespace osu.Game.Rulesets.Difficulty protected virtual Mod[] DifficultyAdjustmentMods => Array.Empty(); /// - /// Populates after difficulty has been processed. + /// Creates to describe beatmap's calculated difficulty. /// - /// The to populate with information about the difficulty of . /// The whose difficulty was processed. + /// The s that were applied during the process. /// The skills which processed the difficulty. /// The rate at which the gameplay clock is run at. - protected abstract void PopulateAttributes(DifficultyAttributes attributes, IBeatmap beatmap, Skill[] skills, double clockRate); + protected abstract DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate); /// /// Enumerates s to be processed from s in the . @@ -129,11 +125,5 @@ namespace osu.Game.Rulesets.Difficulty /// /// The s. protected abstract Skill[] CreateSkills(); - - /// - /// Creates an empty . - /// - /// The empty . - protected abstract DifficultyAttributes CreateDifficultyAttributes(); } } From 847f7d8658f1124dbac22b7c2d778538cb200b95 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 17:38:33 +0900 Subject: [PATCH 090/327] Adjust with PopulateAttributes() removal --- .../Difficulty/OsuDifficultyCalculator.cs | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 9bbdb75343..70ee7e251d 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -25,28 +25,32 @@ namespace osu.Game.Rulesets.Osu.Difficulty { } - protected override void PopulateAttributes(DifficultyAttributes attributes, IBeatmap beatmap, Skill[] skills, double timeRate) + protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate) { - var osuAttributes = (OsuDifficultyAttributes)attributes; + if (beatmap.HitObjects.Count == 0) + return new OsuDifficultyAttributes(); double aimRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier; double speedRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier; double starRating = aimRating + speedRating + Math.Abs(aimRating - speedRating) / 2; // Todo: These int casts are temporary to achieve 1:1 results with osu!stable, and should be removed in the future - double hitWindowGreat = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate; - double preempt = (int)BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate; + double hitWindowGreat = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / clockRate; + double preempt = (int)BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / clockRate; int maxCombo = beatmap.HitObjects.Count; // Add the ticks + tail of the slider. 1 is subtracted because the head circle would be counted twice (once for the slider itself in the line above) maxCombo += beatmap.HitObjects.OfType().Sum(s => s.NestedHitObjects.Count - 1); - osuAttributes.StarRating = starRating; - osuAttributes.AimStrain = aimRating; - osuAttributes.SpeedStrain = speedRating; - osuAttributes.ApproachRate = preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5; - osuAttributes.OverallDifficulty = (80 - hitWindowGreat) / 6; - osuAttributes.MaxCombo = maxCombo; + return new OsuDifficultyAttributes + { + StarRating = starRating, + AimStrain = aimRating, + SpeedStrain = speedRating, + ApproachRate = preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5, + OverallDifficulty = (80 - hitWindowGreat) / 6, + MaxCombo = maxCombo + }; } protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double timeRate) @@ -69,8 +73,6 @@ namespace osu.Game.Rulesets.Osu.Difficulty new Speed() }; - protected override DifficultyAttributes CreateDifficultyAttributes() => new OsuDifficultyAttributes(); - protected override Mod[] DifficultyAdjustmentMods => new Mod[] { new OsuModDoubleTime(), From 37f9ac6eca7b5816c0210f93ee7ef2ce40a1bc78 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 17:39:30 +0900 Subject: [PATCH 091/327] Populate mods too --- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 70ee7e251d..63d172d22b 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -45,6 +45,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty return new OsuDifficultyAttributes { StarRating = starRating, + Mods = mods, AimStrain = aimRating, SpeedStrain = speedRating, ApproachRate = preempt > 1200 ? (1800 - preempt) / 120 : (1200 - preempt) / 150 + 5, From f19a52b960c19f767ea134a8c5cf9b80901c46c2 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 17:40:35 +0900 Subject: [PATCH 092/327] Rename argument --- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 63d172d22b..b146d201cc 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -54,7 +54,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty }; } - protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double timeRate) + protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) { // The first jump is formed by the first two hitobjects of the map. // If the map has less than two OsuHitObjects, the enumerator will not return anything. @@ -64,7 +64,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty var last = beatmap.HitObjects[i - 1]; var current = beatmap.HitObjects[i]; - yield return new OsuDifficultyHitObject(current, lastLast, last, timeRate); + yield return new OsuDifficultyHitObject(current, lastLast, last, clockRate); } } From 2765ffa19093b796b38e8bf0efe3bcd2d7ebb486 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 17:42:24 +0900 Subject: [PATCH 093/327] Update with PopulateAttributes() removal --- .../Difficulty/CatchDifficultyCalculator.cs | 25 +++++++++++-------- .../Preprocessing/CatchDifficultyHitObject.cs | 4 +-- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index f8ca066a4f..d29dd4591e 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -12,6 +12,7 @@ using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Skills; +using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Catch.Difficulty { @@ -30,19 +31,23 @@ namespace osu.Game.Rulesets.Catch.Difficulty halfCatchWidth = catcher.CatchWidth * 0.5f; } - protected override void PopulateAttributes(DifficultyAttributes attributes, IBeatmap beatmap, Skill[] skills, double timeRate) + protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate) { - var catchAttributes = (CatchDifficultyAttributes)attributes; + if (beatmap.HitObjects.Count == 0) + return new CatchDifficultyAttributes(); // this is the same as osu!, so there's potential to share the implementation... maybe - double preempt = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / timeRate; + double preempt = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / clockRate; - catchAttributes.StarRating = Math.Sqrt(skills[0].DifficultyValue()) * star_scaling_factor; - catchAttributes.ApproachRate = preempt > 1200.0 ? -(preempt - 1800.0) / 120.0 : -(preempt - 1200.0) / 150.0 + 5.0; - catchAttributes.MaxCombo = beatmap.HitObjects.Count(h => h is Fruit) + beatmap.HitObjects.OfType().SelectMany(j => j.NestedHitObjects).Count(h => !(h is TinyDroplet)); + return new CatchDifficultyAttributes + { + StarRating = Math.Sqrt(skills[0].DifficultyValue()) * star_scaling_factor, + ApproachRate = preempt > 1200.0 ? -(preempt - 1800.0) / 120.0 : -(preempt - 1200.0) / 150.0 + 5.0, + MaxCombo = beatmap.HitObjects.Count(h => h is Fruit) + beatmap.HitObjects.OfType().SelectMany(j => j.NestedHitObjects).Count(h => !(h is TinyDroplet)) + }; } - protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double timeRate) + protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) { CatchHitObject lastObject = null; @@ -58,13 +63,13 @@ namespace osu.Game.Rulesets.Catch.Difficulty { // We want to only consider fruits that contribute to the combo. Droplets are addressed as accuracy and spinners are not relevant for "skill" calculations. case Fruit fruit: - yield return new CatchDifficultyHitObject(fruit, lastObject, timeRate, halfCatchWidth); + yield return new CatchDifficultyHitObject(fruit, lastObject, clockRate, halfCatchWidth); lastObject = hitObject; break; case JuiceStream _: foreach (var nested in hitObject.NestedHitObjects.OfType().Where(o => !(o is TinyDroplet))) { - yield return new CatchDifficultyHitObject(nested, lastObject, timeRate, halfCatchWidth); + yield return new CatchDifficultyHitObject(nested, lastObject, clockRate, halfCatchWidth); lastObject = nested; } break; @@ -76,7 +81,5 @@ namespace osu.Game.Rulesets.Catch.Difficulty { new Movement(), }; - - protected override DifficultyAttributes CreateDifficultyAttributes() => new CatchDifficultyAttributes(); } } diff --git a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs index 6ce45bbbde..6d00bb27b5 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs @@ -24,8 +24,8 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing /// public readonly double StrainTime; - public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double timeRate, float halfCatcherWidth) - : base(hitObject, lastObject, timeRate) + public CatchDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate, float halfCatcherWidth) + : base(hitObject, lastObject, clockRate) { // We will scale everything by this factor, so we can assume a uniform CircleSize among beatmaps. var scalingFactor = normalized_hitobject_radius / halfCatcherWidth; From 8459cf6ed0f28c08e0da4aebf8ce26d63c284bd6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 17:43:12 +0900 Subject: [PATCH 094/327] Missed argument --- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 31e69de6ab..930c711783 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -40,8 +40,8 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing private readonly OsuHitObject lastLastObject; private readonly OsuHitObject lastObject; - public OsuDifficultyHitObject(HitObject hitObject, HitObject lastLastObject, HitObject lastObject, double timeRate) - : base(hitObject, lastObject, timeRate) + public OsuDifficultyHitObject(HitObject hitObject, HitObject lastLastObject, HitObject lastObject, double clockRate) + : base(hitObject, lastObject, clockRate) { this.lastLastObject = (OsuHitObject)lastLastObject; this.lastObject = (OsuHitObject)lastObject; From 0ef15f5bd5156b04cd972e553ebd64c9f6b7ca67 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 17:45:16 +0900 Subject: [PATCH 095/327] Update with PopulateAttributes() removal --- .../Preprocessing/TaikoDifficultyHitObject.cs | 4 ++-- .../Difficulty/TaikoDifficultyCalculator.cs | 24 ++++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs index 4d63d81663..24345275c1 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/Preprocessing/TaikoDifficultyHitObject.cs @@ -11,8 +11,8 @@ namespace osu.Game.Rulesets.Taiko.Difficulty.Preprocessing { public readonly bool HasTypeChange; - public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, double timeRate) - : base(hitObject, lastObject, timeRate) + public TaikoDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate) + : base(hitObject, lastObject, clockRate) { HasTypeChange = lastObject is RimHit != hitObject is RimHit; } diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs index e2c0ea7f46..d973b80e12 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -24,27 +24,29 @@ namespace osu.Game.Rulesets.Taiko.Difficulty { } - protected override void PopulateAttributes(DifficultyAttributes attributes, IBeatmap beatmap, Skill[] skills, double timeRate) + protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate) { - var taikoAttributes = (TaikoDifficultyAttributes)attributes; + if (beatmap.HitObjects.Count == 0) + return new TaikoDifficultyAttributes(); - taikoAttributes.StarRating = skills.Single().DifficultyValue() * star_scaling_factor; - - // Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be removed in the future - taikoAttributes.GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate; - taikoAttributes.MaxCombo = beatmap.HitObjects.Count(h => h is Hit); + return new TaikoDifficultyAttributes + { + StarRating = skills.Single().DifficultyValue() * star_scaling_factor, + Mods = mods, + // Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be removed in the future + GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / clockRate, + MaxCombo = beatmap.HitObjects.Count(h => h is Hit), + }; } - protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double timeRate) + protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) { for (int i = 1; i < beatmap.HitObjects.Count; i++) - yield return new TaikoDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], timeRate); + yield return new TaikoDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], clockRate); } protected override Skill[] CreateSkills() => new Skill[] { new Strain() }; - protected override DifficultyAttributes CreateDifficultyAttributes() => new TaikoDifficultyAttributes(); - protected override Mod[] DifficultyAdjustmentMods => new Mod[] { new TaikoModDoubleTime(), From 1a645b511592f6a1b275b69d24e874c4c939369b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 17:45:52 +0900 Subject: [PATCH 096/327] Fix mods not being populated --- .../Difficulty/CatchDifficultyCalculator.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index d29dd4591e..9e6511b362 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate) { if (beatmap.HitObjects.Count == 0) - return new CatchDifficultyAttributes(); + return new CatchDifficultyAttributes { Mods = mods }; // this is the same as osu!, so there's potential to share the implementation... maybe double preempt = BeatmapDifficulty.DifficultyRange(beatmap.BeatmapInfo.BaseDifficulty.ApproachRate, 1800, 1200, 450) / clockRate; @@ -42,6 +42,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty return new CatchDifficultyAttributes { StarRating = Math.Sqrt(skills[0].DifficultyValue()) * star_scaling_factor, + Mods = mods, ApproachRate = preempt > 1200.0 ? -(preempt - 1800.0) / 120.0 : -(preempt - 1200.0) / 150.0 + 5.0, MaxCombo = beatmap.HitObjects.Count(h => h is Fruit) + beatmap.HitObjects.OfType().SelectMany(j => j.NestedHitObjects).Count(h => !(h is TinyDroplet)) }; From 21f9c813b20f48d0819d36f16c3963eec1a8cccb Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 17:46:18 +0900 Subject: [PATCH 097/327] Fix mods not being populated --- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index b146d201cc..3a0467a0c8 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate) { if (beatmap.HitObjects.Count == 0) - return new OsuDifficultyAttributes(); + return new OsuDifficultyAttributes { Mods = mods }; double aimRating = Math.Sqrt(skills[0].DifficultyValue()) * difficulty_multiplier; double speedRating = Math.Sqrt(skills[1].DifficultyValue()) * difficulty_multiplier; From c264a9cc74ad9b64026793a2c7ab9a7f1726ed84 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 17:46:40 +0900 Subject: [PATCH 098/327] Fix mods not being populated --- osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs index d973b80e12..bed0fd9479 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate) { if (beatmap.HitObjects.Count == 0) - return new TaikoDifficultyAttributes(); + return new TaikoDifficultyAttributes { Mods = mods }; return new TaikoDifficultyAttributes { From 5457097342ee87769bdb3fcf4557e482213b4765 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 17:48:00 +0900 Subject: [PATCH 099/327] Update with PopulateAttributes() removal --- .../Difficulty/ManiaDifficultyCalculator.cs | 22 ++++++++++--------- .../Preprocessing/ManiaDifficultyHitObject.cs | 4 ++-- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs index 1e7e16329a..548a5d1bca 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs @@ -29,14 +29,18 @@ namespace osu.Game.Rulesets.Mania.Difficulty isForCurrentRuleset = beatmap.BeatmapInfo.Ruleset.Equals(ruleset.RulesetInfo); } - protected override void PopulateAttributes(DifficultyAttributes attributes, IBeatmap beatmap, Skill[] skills, double timeRate) + protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate) { - var maniaAttributes = (ManiaDifficultyAttributes)attributes; + if (beatmap.HitObjects.Count == 0) + return new ManiaDifficultyAttributes { Mods = mods }; - maniaAttributes.StarRating = difficultyValue(skills) * star_scaling_factor; - - // Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be removed in the future - maniaAttributes.GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / timeRate; + return new ManiaDifficultyAttributes + { + StarRating = difficultyValue(skills) * star_scaling_factor, + Mods = mods, + // Todo: This int cast is temporary to achieve 1:1 results with osu!stable, and should be removed in the future + GreatHitWindow = (int)(beatmap.HitObjects.First().HitWindows.Great / 2) / clockRate, + }; } private double difficultyValue(Skill[] skills) @@ -71,12 +75,12 @@ namespace osu.Game.Rulesets.Mania.Difficulty return difficulty; } - protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double timeRate) + protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) { columnCount = ((ManiaBeatmap)beatmap).TotalColumns; for (int i = 1; i < beatmap.HitObjects.Count; i++) - yield return new ManiaDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], timeRate); + yield return new ManiaDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], clockRate); } protected override Skill[] CreateSkills() @@ -89,8 +93,6 @@ namespace osu.Game.Rulesets.Mania.Difficulty return skills.ToArray(); } - protected override DifficultyAttributes CreateDifficultyAttributes() => new ManiaDifficultyAttributes(); - protected override Mod[] DifficultyAdjustmentMods { get diff --git a/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs b/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs index aa823e7586..29ba934e9f 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/Preprocessing/ManiaDifficultyHitObject.cs @@ -11,8 +11,8 @@ namespace osu.Game.Rulesets.Mania.Difficulty.Preprocessing { public new ManiaHitObject BaseObject => (ManiaHitObject)base.BaseObject; - public ManiaDifficultyHitObject(HitObject hitObject, HitObject lastObject, double timeRate) - : base(hitObject, lastObject, timeRate) + public ManiaDifficultyHitObject(HitObject hitObject, HitObject lastObject, double clockRate) + : base(hitObject, lastObject, clockRate) { } } From 4dcf39846de896ebff28d5ae5536c99bf13fdaa9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 17:52:59 +0900 Subject: [PATCH 100/327] Pass beatmap to CreateSkills() --- .../Rulesets/Difficulty/DifficultyCalculator.cs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index c6e54c52e7..29ec9aae25 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Difficulty protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate) { - var skills = CreateSkills(); + var skills = CreateSkills(beatmap); if (!beatmap.HitObjects.Any()) return CreateDifficultyAttributes(beatmap, mods, skills, clockRate); @@ -106,9 +106,9 @@ namespace osu.Game.Rulesets.Difficulty /// /// Creates to describe beatmap's calculated difficulty. /// - /// The whose difficulty was processed. - /// The s that were applied during the process. - /// The skills which processed the difficulty. + /// The whose difficulty was calculated. + /// The s that difficulty was calculated with. + /// The skills which processed the beatmap. /// The rate at which the gameplay clock is run at. protected abstract DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate); @@ -121,9 +121,10 @@ namespace osu.Game.Rulesets.Difficulty protected abstract IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate); /// - /// Creates the s to calculate the difficulty of s. + /// Creates the s to calculate the difficulty of an . /// + /// The whose difficulty will be calculated.The s. - protected abstract Skill[] CreateSkills(); + protected abstract Skill[] CreateSkills(IBeatmap beatmap); } } From ea281e8596e51028a6e24b71cd5feca905dd5a57 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 17:54:00 +0900 Subject: [PATCH 101/327] Add beatmap argument --- osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index 9e6511b362..89f3a8c25e 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -78,7 +78,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty } } - protected override Skill[] CreateSkills() => new Skill[] + protected override Skill[] CreateSkills(IBeatmap beatmap) => new Skill[] { new Movement(), }; From 4efc03cdf0ab1e401f85d192ded9124e8e365d14 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 17:56:38 +0900 Subject: [PATCH 102/327] Add beatmap argument + fix crashes --- .../Difficulty/ManiaDifficultyCalculator.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs index 548a5d1bca..4790bde9ee 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs @@ -19,8 +19,6 @@ namespace osu.Game.Rulesets.Mania.Difficulty { private const double star_scaling_factor = 0.018; - private int columnCount; - private readonly bool isForCurrentRuleset; public ManiaDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) @@ -77,14 +75,15 @@ namespace osu.Game.Rulesets.Mania.Difficulty protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) { - columnCount = ((ManiaBeatmap)beatmap).TotalColumns; for (int i = 1; i < beatmap.HitObjects.Count; i++) yield return new ManiaDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], clockRate); } - protected override Skill[] CreateSkills() + protected override Skill[] CreateSkills(IBeatmap beatmap) { + int columnCount = ((ManiaBeatmap)beatmap).TotalColumns; + var skills = new List { new Overall(columnCount) }; for (int i = 0; i < columnCount; i++) From 5ff890434cdd2da760087b60629006bf3bec127b Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 17:57:29 +0900 Subject: [PATCH 103/327] Add beatmap argument --- osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs index bed0fd9479..685ad9949b 100644 --- a/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Taiko/Difficulty/TaikoDifficultyCalculator.cs @@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Taiko.Difficulty yield return new TaikoDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], clockRate); } - protected override Skill[] CreateSkills() => new Skill[] { new Strain() }; + protected override Skill[] CreateSkills(IBeatmap beatmap) => new Skill[] { new Strain() }; protected override Mod[] DifficultyAdjustmentMods => new Mod[] { From 03802930989a83dfdbbf3745757e0bab2fcf4e44 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 17:58:02 +0900 Subject: [PATCH 104/327] Add beatmap argument --- osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs index 3a0467a0c8..e2a1542574 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuDifficultyCalculator.cs @@ -68,7 +68,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty } } - protected override Skill[] CreateSkills() => new Skill[] + protected override Skill[] CreateSkills(IBeatmap beatmap) => new Skill[] { new Aim(), new Speed() From 703df770002511ab2bb58f20263117b7184144c6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 19:16:03 +0900 Subject: [PATCH 105/327] Update in-line with framework IsActive changes --- osu.Game/OsuGame.cs | 16 +++++++--------- osu.Game/Screens/Play/PauseContainer.cs | 2 +- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 7b4ff3d295..e3b3a9ed79 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -120,6 +120,8 @@ namespace osu.Game forwardLoggedErrorsToNotifications(); RavenLogger = new RavenLogger(this); + + IsActive.BindValueChanged(updateActiveState); } public void ToggleSettings() => settings.ToggleVisibility(); @@ -674,16 +676,12 @@ namespace osu.Game private readonly BindableDouble inactiveVolumeAdjust = new BindableDouble(); - protected override void OnDeactivated() + private void updateActiveState(bool isActive) { - base.OnDeactivated(); - Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeAdjust); - } - - protected override void OnActivated() - { - base.OnActivated(); - Audio.RemoveAdjustment(AdjustableProperty.Volume, inactiveVolumeAdjust); + if (isActive) + Audio.RemoveAdjustment(AdjustableProperty.Volume, inactiveVolumeAdjust); + else + Audio.AddAdjustment(AdjustableProperty.Volume, inactiveVolumeAdjust); } public bool OnReleased(GlobalAction action) => false; diff --git a/osu.Game/Screens/Play/PauseContainer.cs b/osu.Game/Screens/Play/PauseContainer.cs index 8dae0ab964..7889be493e 100644 --- a/osu.Game/Screens/Play/PauseContainer.cs +++ b/osu.Game/Screens/Play/PauseContainer.cs @@ -116,7 +116,7 @@ namespace osu.Game.Screens.Play protected override void Update() { // eagerly pause when we lose window focus (if we are locally playing). - if (!game.IsActive && CanPause) + if (!game.IsActive.Value && CanPause) Pause(); if (!IsPaused) From 49eadcb575fd9a37c322f407fd0aa77a846864c9 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 19 Feb 2019 19:44:09 +0900 Subject: [PATCH 106/327] Update active state immediately + fix potential nullref --- osu.Game/OsuGame.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index e3b3a9ed79..914ecba30d 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -120,8 +120,6 @@ namespace osu.Game forwardLoggedErrorsToNotifications(); RavenLogger = new RavenLogger(this); - - IsActive.BindValueChanged(updateActiveState); } public void ToggleSettings() => settings.ToggleVisibility(); @@ -185,6 +183,8 @@ namespace osu.Game configSkin.TriggerChange(); LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust); + + IsActive.BindValueChanged(updateActiveState, true); } private ExternalLinkOpener externalLinkOpener; From 2e375a918656886726b457cddd31c80f8deec720 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 19 Feb 2019 19:44:26 +0900 Subject: [PATCH 107/327] Add test cases for upwards traversal of screen stack --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 95 ++++++++++++++----- 1 file changed, 71 insertions(+), 24 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index dc078aeeea..53695b1247 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -3,30 +3,64 @@ using NUnit.Framework; using osu.Framework.Configuration; +using osu.Framework.Screens; +using osu.Game.Beatmaps; using osu.Game.Graphics; -using osu.Game.Rulesets; -using osu.Game.Rulesets.Osu; +using osu.Game.Rulesets.Osu.Objects; using osu.Game.Scoring; using osu.Game.Screens; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Play; -using osu.Game.Screens.Select; +using osu.Game.Tests.Beatmaps; using osu.Game.Users; +using osuTK; using osuTK.Graphics; namespace osu.Game.Tests.Visual { [TestFixture] - public class TestCaseBackgroundScreenBeatmap : TestCasePlayer + public class TestCaseBackgroundScreenBeatmap : ScreenTestCase { - public TestCaseBackgroundScreenBeatmap() : base(new OsuRuleset()) + private DummySongSelect songSelect; + protected Player Player; + public TestCaseBackgroundScreenBeatmap() { - } + AddStep("Load Song Select", () => + { + LoadComponentAsync(new DummySongSelect(), p => + { + songSelect = p; + LoadScreen(p); + }); + }); + AddUntilStep(() => songSelect?.IsLoaded ?? false, "Wait for song select to load"); + AddStep("Create beatmap", () => + { + Beatmap.Value = new TestWorkingBeatmap(new Beatmap + { + HitObjects = + { + new HitCircle() + { + StartTime = 3000, + Position = new Vector2(0, 0), + }, + new HitCircle() + { + StartTime = 15000, + Position = new Vector2(0, 0), + } + }, + }); + }); + AddStep("Load Player", () => + { + var p = new DimAccessiblePlayer(); + songSelect.Push(Player = p); + }); - [SetUp] - public void Setup() - { - ((DimAccessiblePlayer)Player).UpdateBindables(); + AddUntilStep(() => Player?.IsLoaded ?? false, "Wait for player to load"); + AddStep("Update bindables", () => ((DimAccessiblePlayer)Player).UpdateBindables()); } /// @@ -48,7 +82,7 @@ namespace osu.Game.Tests.Visual { AddStep("Test User Dimming", () => ((DimAccessiblePlayer)Player).DimEnabled.Value = true); AddWaitStep(5, "Wait for dim"); - AddAssert("Screen is dimmed", () => ((DimAccessiblePlayer)Player).AssertDimState()); + AddAssert("Screen is dimmed", () => ((DimAccessiblePlayer)Player).AssertDimmed()); } /// @@ -57,23 +91,41 @@ namespace osu.Game.Tests.Visual [Test] public void PauseTest() { - AddStep("Transition to Results", () => ((DimAccessiblePlayer)Player).TriggerExit()); + AddStep("Transition to Pause", () => ((DimAccessiblePlayer)Player).Exit()); AddWaitStep(5, "Wait for dim"); - AddAssert("Screen is dimmed", () => ((DimAccessiblePlayer)Player).AssertDimState()); + AddAssert("Screen is dimmed", () => ((DimAccessiblePlayer)Player).AssertDimmed()); } /// - /// Check if the fade container removes user dim when leaving the player + /// Check if the fade container removes user dim when suspending player for results /// [Test] public void TransitionTest() { - AddStep("Transition to Results", () => LoadScreen(new FadeAccesibleResults(new ScoreInfo { User = new User { Username = "osu!" }}))); + AddStep("Transition to Results", () => Player.Push(new FadeAccesibleResults(new ScoreInfo { User = new User { Username = "osu!" }}))); AddWaitStep(5, "Wait for dim"); AddAssert("Screen is undimmed", () => ((DimAccessiblePlayer)Player).AssertUndimmed()); } - protected override Player CreatePlayer(Ruleset ruleset) => new DimAccessiblePlayer(); + /// + /// Check if background gets undimmed when leaving the player for the previous screen + /// + [Test] + public void TransitionOutTest() + { + AddStep("Exit player", () => + { + Player.MakeCurrent(); + Player.Exit(); + }); + AddWaitStep(5, "Wait for dim"); + AddAssert("Screen is undimmed", () => ((DimAccessiblePlayer)Player).AssertUndimmed()); + } + + private class DummySongSelect : OsuScreen + { + protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); + } private class FadeAccesibleResults : SoloResults { @@ -95,25 +147,20 @@ namespace osu.Game.Tests.Visual DimEnabled = Background.UpdateDim; } - public bool AssertDimState() + public bool AssertDimmed() { - return ((FadeAccessibleBackground)Background).AssertDimState(); + return ((FadeAccessibleBackground)Background).AssertDimmed(); } public bool AssertUndimmed() { return ((FadeAccessibleBackground)Background).AssertUndimmed(); } - - public void TriggerExit() - { - OnExiting(new PlaySongSelect()); - } } private class FadeAccessibleBackground : BackgroundScreenBeatmap { - public bool AssertDimState() + public bool AssertDimmed() { return FadeContainer.Colour == OsuColour.Gray(1 - (float)DimLevel); } From 87717dcf9eade431480d8b3f9800b896fcc68e52 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 19 Feb 2019 19:57:55 +0900 Subject: [PATCH 108/327] Remove redundant constructors --- osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 53695b1247..89b9088681 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -40,12 +40,12 @@ namespace osu.Game.Tests.Visual { HitObjects = { - new HitCircle() + new HitCircle { StartTime = 3000, Position = new Vector2(0, 0), }, - new HitCircle() + new HitCircle { StartTime = 15000, Position = new Vector2(0, 0), From d6a2fe6891173c82c9309d5a56962c3f6707b392 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Feb 2019 10:29:08 +0900 Subject: [PATCH 109/327] Remove excess newline --- osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs index 4790bde9ee..59fed1031f 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaDifficultyCalculator.cs @@ -75,7 +75,6 @@ namespace osu.Game.Rulesets.Mania.Difficulty protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) { - for (int i = 1; i < beatmap.HitObjects.Count; i++) yield return new ManiaDifficultyHitObject(beatmap.HitObjects[i], beatmap.HitObjects[i - 1], clockRate); } From 2c76a039ca3ebab69ef0bc199e0692e1bb9cf8f8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Feb 2019 10:46:25 +0900 Subject: [PATCH 110/327] Remove unnecessary folder reference --- osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj index 563ed2e7ca..656ebcc7c2 100644 --- a/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj +++ b/osu.Game.Rulesets.Taiko/osu.Game.Rulesets.Taiko.csproj @@ -10,7 +10,4 @@ - - - - \ No newline at end of file + From b4bb87fee39516895d80bd431a6c98c18e233229 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Feb 2019 12:08:30 +0900 Subject: [PATCH 111/327] Make TrackVirtualTracking more accurate on seeks/stops --- osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs | 41 +++++++++++++++---- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs index e6de9d37b2..90f2449f53 100644 --- a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs +++ b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs @@ -50,28 +50,32 @@ namespace osu.Game.Tests.Beatmaps public class TrackVirtualManual : Track { private readonly IFrameBasedClock referenceClock; - private readonly ManualClock clock; + + private readonly ManualClock clock = new ManualClock(); private bool running; + + /// + /// Local offset added to the reference clock to resolve correct time. + /// private double offset; public TrackVirtualManual(IFrameBasedClock referenceClock) { this.referenceClock = referenceClock; Length = double.PositiveInfinity; - clock = new ManualClock(); } public override bool Seek(double seek) { - offset = MathHelper.Clamp(seek, 0, Length) - referenceClock.CurrentTime; + offset = MathHelper.Clamp(seek, 0, Length); + lastReferenceTime = null; return true; } public override void Start() { running = true; - Seek(0); } public override void Reset() @@ -82,18 +86,41 @@ namespace osu.Game.Tests.Beatmaps public override void Stop() { - running = false; + if (running) + { + running = false; + // on stopping, the current value should be transferred out of the clock, as we can no longer rely on + // the referenceClock (which will still be counting time). + offset = clock.CurrentTime; + lastReferenceTime = null; + } } public override bool IsRunning => running; - public override double CurrentTime => running ? clock.CurrentTime : 0; + private double? lastReferenceTime; + + public override double CurrentTime => clock.CurrentTime; protected override void UpdateState() { base.UpdateState(); - clock.CurrentTime = Math.Min(referenceClock.CurrentTime + offset, Length); + if (running) + { + double refTime = referenceClock.CurrentTime; + + if (!lastReferenceTime.HasValue) + { + // if the clock just started running, the current value should be transferred to the offset + // (to zero the progression of time). + offset -= refTime; + } + + lastReferenceTime = referenceClock.CurrentTime; + } + + clock.CurrentTime = Math.Min((lastReferenceTime ?? 0) + offset, Length); if (CurrentTime >= Length) { From f6d70e687b471dc9686a99ebbb97695df9e6f2c1 Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Wed, 20 Feb 2019 12:27:25 +0900 Subject: [PATCH 112/327] Use correct local variable Co-Authored-By: peppy --- osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs index 90f2449f53..90b5178169 100644 --- a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs +++ b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs @@ -117,7 +117,7 @@ namespace osu.Game.Tests.Beatmaps offset -= refTime; } - lastReferenceTime = referenceClock.CurrentTime; + lastReferenceTime = refTime; } clock.CurrentTime = Math.Min((lastReferenceTime ?? 0) + offset, Length); From d25d10d8fcc511059a4486b36dd209ab5318b3a4 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 20 Feb 2019 14:13:54 +0900 Subject: [PATCH 113/327] Fix position not being set for the first hitobject --- .../CatchDifficultyCalculatorTest.cs | 2 +- .../Difficulty/Preprocessing/CatchDifficultyHitObject.cs | 2 ++ osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs | 9 ++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs index c9831aad6d..fc2a153f49 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Catch.Tests { protected override string ResourceAssembly => "osu.Game.Rulesets.Catch"; - [TestCase(3.8701854263563118d, "diffcalc-test")] + [TestCase(3.8701758020428221d, "diffcalc-test")] public void Test(double expected, string name) => base.Test(expected, name); diff --git a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs index 6d00bb27b5..24e526ed19 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/Preprocessing/CatchDifficultyHitObject.cs @@ -18,6 +18,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing public new CatchHitObject LastObject => (CatchHitObject)base.LastObject; public readonly float NormalizedPosition; + public readonly float LastNormalizedPosition; /// /// Milliseconds elapsed since the start time of the previous , with a minimum of 25ms. @@ -31,6 +32,7 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Preprocessing var scalingFactor = normalized_hitobject_radius / halfCatcherWidth; NormalizedPosition = BaseObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor; + LastNormalizedPosition = LastObject.X * CatchPlayfield.BASE_WIDTH * scalingFactor; // Every strain interval is hard capped at the equivalent of 600 BPM streaming speed as a safety measure StrainTime = Math.Max(25, DeltaTime); diff --git a/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs b/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs index e06ca08fbe..d146153294 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/Skills/Movement.cs @@ -21,20 +21,23 @@ namespace osu.Game.Rulesets.Catch.Difficulty.Skills protected override double DecayWeight => 0.94; - private float lastPlayerPosition; + private float? lastPlayerPosition; private float lastDistanceMoved; protected override double StrainValueOf(DifficultyHitObject current) { var catchCurrent = (CatchDifficultyHitObject)current; + if (lastPlayerPosition == null) + lastPlayerPosition = catchCurrent.LastNormalizedPosition; + float playerPosition = MathHelper.Clamp( - lastPlayerPosition, + lastPlayerPosition.Value, catchCurrent.NormalizedPosition - (normalized_hitobject_radius - absolute_player_positioning_error), catchCurrent.NormalizedPosition + (normalized_hitobject_radius - absolute_player_positioning_error) ); - float distanceMoved = playerPosition - lastPlayerPosition; + float distanceMoved = playerPosition - lastPlayerPosition.Value; double distanceAddition = Math.Pow(Math.Abs(distanceMoved), 1.3) / 500; double sqrtStrain = Math.Sqrt(catchCurrent.StrainTime); From a2aa3ec5cbdf526d441bed261f9d2c265ec26b7a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 12 Feb 2019 13:04:46 +0900 Subject: [PATCH 114/327] Adjust sprite texts in-line with framework changes --- osu.Desktop/Overlays/VersionManager.cs | 5 +- .../TestCaseNotes.cs | 3 +- .../UI/DrawableManiaJudgement.cs | 3 +- osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs | 3 +- .../Objects/Drawables/Pieces/NumberPiece.cs | 4 +- .../Drawables/Pieces/SpinnerSpmCounter.cs | 7 +- .../Visual/TestCaseBeatSyncedContainer.cs | 5 +- osu.Game.Tests/Visual/TestCaseChatLink.cs | 2 +- .../Visual/TestCaseHoldToConfirmOverlay.cs | 3 +- .../Visual/TestCaseWaveContainer.cs | 2 +- .../Drawables/BeatmapSetOnlineStatusPill.cs | 7 +- .../Graphics/Cursor/OsuTooltipContainer.cs | 6 +- osu.Game/Graphics/DrawableDate.cs | 3 +- osu.Game/Graphics/OsuFont.cs | 71 +++++++++++++++++++ osu.Game/Graphics/Sprites/OsuSpriteText.cs | 4 +- .../UserInterface/BreadcrumbControl.cs | 2 +- .../Graphics/UserInterface/DialogButton.cs | 15 +--- osu.Game/Graphics/UserInterface/OsuButton.cs | 2 +- osu.Game/Graphics/UserInterface/OsuMenu.cs | 5 +- .../Graphics/UserInterface/OsuTabControl.cs | 4 +- .../UserInterface/OsuTabControlCheckbox.cs | 6 +- osu.Game/Graphics/UserInterface/OsuTextBox.cs | 4 +- .../Graphics/UserInterface/PageTabControl.cs | 4 +- .../UserInterface/PercentageCounter.cs | 2 +- .../Graphics/UserInterface/RollingCounter.cs | 14 +--- .../Graphics/UserInterface/ScoreCounter.cs | 2 +- .../Online/Leaderboards/LeaderboardScore.cs | 22 +++--- .../Online/Leaderboards/MessagePlaceholder.cs | 2 +- osu.Game/Online/Leaderboards/Placeholder.cs | 3 +- .../AccountCreation/ErrorTextFlowContainer.cs | 3 +- .../Overlays/AccountCreation/ScreenEntry.cs | 4 +- .../Overlays/AccountCreation/ScreenWarning.cs | 7 +- .../Overlays/AccountCreation/ScreenWelcome.cs | 6 +- osu.Game/Overlays/BeatmapSet/AuthorInfo.cs | 17 ++--- osu.Game/Overlays/BeatmapSet/BasicStats.cs | 3 +- osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs | 9 +-- .../BeatmapSet/Buttons/DownloadButton.cs | 12 ++-- osu.Game/Overlays/BeatmapSet/Header.cs | 9 +-- osu.Game/Overlays/BeatmapSet/Info.cs | 5 +- .../BeatmapSet/Scores/ClickableUsername.cs | 14 ++-- .../BeatmapSet/Scores/DrawableScore.cs | 9 ++- .../BeatmapSet/Scores/DrawableTopScore.cs | 12 +--- osu.Game/Overlays/BeatmapSet/SuccessRate.cs | 6 +- osu.Game/Overlays/Chat/ChatLine.cs | 11 ++- .../Chat/Selection/ChannelListItem.cs | 9 +-- .../Overlays/Chat/Selection/ChannelSection.cs | 4 +- .../Chat/Selection/ChannelSelectionOverlay.cs | 2 +- .../Chat/Tabs/ChannelSelectorTabItem.cs | 4 +- osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs | 5 +- osu.Game/Overlays/Dialog/PopupDialog.cs | 4 +- osu.Game/Overlays/Direct/DirectGridPanel.cs | 12 ++-- osu.Game/Overlays/Direct/DirectListPanel.cs | 12 ++-- osu.Game/Overlays/Direct/DirectPanel.cs | 5 +- osu.Game/Overlays/Direct/Header.cs | 2 +- osu.Game/Overlays/DirectOverlay.cs | 5 +- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 3 +- osu.Game/Overlays/KeyBindingOverlay.cs | 3 +- .../Overlays/MedalSplash/DrawableMedal.cs | 8 +-- osu.Game/Overlays/Mods/ModButton.cs | 3 +- osu.Game/Overlays/Mods/ModSection.cs | 3 +- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 13 ++-- osu.Game/Overlays/Music/PlaylistItem.cs | 9 +-- osu.Game/Overlays/MusicController.cs | 6 +- .../Notifications/NotificationSection.cs | 4 +- .../Notifications/ProgressNotification.cs | 5 +- .../Notifications/SimpleNotification.cs | 2 +- osu.Game/Overlays/OnScreenDisplay.cs | 9 +-- .../Overlays/Profile/Components/GradeBadge.cs | 4 +- .../Overlays/Profile/Header/BadgeContainer.cs | 5 +- osu.Game/Overlays/Profile/Header/RankGraph.cs | 12 ++-- osu.Game/Overlays/Profile/ProfileHeader.cs | 20 ++---- osu.Game/Overlays/Profile/ProfileSection.cs | 6 +- .../Sections/BeatmapMetadataContainer.cs | 7 +- .../Historical/DrawableMostPlayedRow.cs | 12 ++-- .../Profile/Sections/Kudosu/KudosuInfo.cs | 8 +-- .../Profile/Sections/PaginatedContainer.cs | 8 +-- .../Ranks/DrawablePerformanceScore.cs | 6 +- .../Sections/Ranks/DrawableProfileScore.cs | 3 +- .../Sections/Ranks/DrawableTotalScore.cs | 4 +- .../Sections/Recent/DrawableRecentActivity.cs | 2 +- .../SearchableList/HeaderTabControl.cs | 3 +- .../Sections/General/LoginSettings.cs | 5 +- osu.Game/Overlays/Settings/SettingsFooter.cs | 5 +- osu.Game/Overlays/Settings/SettingsHeader.cs | 4 +- osu.Game/Overlays/Settings/SettingsSection.cs | 2 +- .../Overlays/Settings/SettingsSubsection.cs | 3 +- osu.Game/Overlays/Social/Header.cs | 5 +- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 4 +- .../Toolbar/ToolbarNotificationButton.cs | 3 +- .../Overlays/Toolbar/ToolbarUserButton.cs | 3 +- osu.Game/Overlays/Volume/VolumeMeter.cs | 5 +- .../Rulesets/Judgements/DrawableJudgement.cs | 3 +- .../Edit/Components/Menus/EditorMenuBar.cs | 3 +- .../Edit/Components/PlaybackControl.cs | 5 +- .../Edit/Components/TimeInfoContainer.cs | 4 +- .../Compose/Components/BeatDivisorControl.cs | 2 +- .../LabelledComponents/LabelledTextBox.cs | 7 +- osu.Game/Screens/Menu/Button.cs | 1 - osu.Game/Screens/Menu/Disclaimer.cs | 22 ++---- osu.Game/Screens/Menu/IntroSequence.cs | 3 +- .../Screens/Multi/Components/BeatmapTitle.cs | 10 +-- .../Multi/Components/BeatmapTypeInfo.cs | 2 +- .../Multi/Components/ParticipantCount.cs | 10 ++- .../Multi/Components/RoomStatusInfo.cs | 5 +- osu.Game/Screens/Multi/Header.cs | 5 +- .../Multi/Lounge/Components/DrawableRoom.cs | 2 +- .../Lounge/Components/ParticipantInfo.cs | 5 +- .../Multi/Lounge/Components/RoomInspector.cs | 5 +- .../Multi/Match/Components/HeaderButton.cs | 3 +- .../Multi/Match/Components/HostInfo.cs | 4 +- .../Screens/Multi/Match/Components/Info.cs | 2 +- .../Match/Components/MatchSettingsOverlay.cs | 5 +- .../Components/RoomAvailabilityPicker.cs | 2 +- .../Ranking/Pages/RoomLeaderboardPage.cs | 4 +- osu.Game/Screens/Play/Break/BreakInfo.cs | 4 +- osu.Game/Screens/Play/Break/BreakInfoLine.cs | 5 +- .../Play/Break/RemainingTimeCounter.cs | 4 +- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 10 ++- osu.Game/Screens/Play/HUD/ComboCounter.cs | 6 +- .../Screens/Play/HUD/HoldForMenuButton.cs | 2 +- osu.Game/Screens/Play/HUD/ModDisplay.cs | 4 +- osu.Game/Screens/Play/KeyCounter.cs | 4 +- osu.Game/Screens/Play/PlayerLoader.cs | 9 +-- .../Play/PlayerSettings/PlaybackSettings.cs | 3 +- .../PlayerSettings/PlayerSettingsGroup.cs | 3 +- osu.Game/Screens/Play/SkipOverlay.cs | 3 +- osu.Game/Screens/Play/SongProgressInfo.cs | 6 +- .../Screens/Ranking/Pages/ScoreResultsPage.cs | 23 +++--- osu.Game/Screens/Ranking/Results.cs | 30 ++++---- osu.Game/Screens/ScreenWhiteBox.cs | 16 ++--- osu.Game/Screens/Select/BeatmapDetails.cs | 9 ++- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 19 ++--- .../Carousel/DrawableCarouselBeatmap.cs | 9 +-- .../Carousel/DrawableCarouselBeatmapSet.cs | 7 +- .../Screens/Select/Details/AdvancedStats.cs | 4 +- .../Screens/Select/Details/UserRatings.cs | 8 +-- .../Select/Options/BeatmapOptionsButton.cs | 4 +- osu.Game/Screens/Tournament/Drawings.cs | 7 +- osu.Game/Screens/Tournament/Group.cs | 7 +- osu.Game/Users/UserPanel.cs | 5 +- 140 files changed, 424 insertions(+), 514 deletions(-) create mode 100644 osu.Game/Graphics/OsuFont.cs diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index 5b67d528ae..b1677f6117 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -60,7 +60,7 @@ namespace osu.Desktop.Overlays { new OsuSpriteText { - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold), Text = game.Name }, new OsuSpriteText @@ -74,9 +74,8 @@ namespace osu.Desktop.Overlays { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - TextSize = 12, + Font = OsuFont.GetFont(Typeface.Venera, 12), Colour = colours.Yellow, - Font = @"Venera", Text = @"Development Build" }, new Sprite diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs index 2f4b51e372..84bb9e30b1 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs @@ -14,6 +14,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Graphics; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables; @@ -141,7 +142,7 @@ namespace osu.Game.Rulesets.Mania.Tests { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - TextSize = 14, + Font = OsuFont.GetFont(size: 14), Text = description } } diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs index 1469924bb2..b3d6777670 100644 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs @@ -3,6 +3,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Game.Graphics; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; @@ -19,7 +20,7 @@ namespace osu.Game.Rulesets.Mania.UI private void load() { if (JudgementText != null) - JudgementText.TextSize = 25; + JudgementText.Font = OsuFont.GetFont(JudgementText.Font, size: 25); } protected override void LoadComplete() diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs index d6b88c1c5f..1aabf9a904 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs @@ -16,6 +16,7 @@ using osuTK.Graphics; using osu.Game.Rulesets.Mods; using System.Linq; using NUnit.Framework; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; @@ -313,7 +314,7 @@ namespace osu.Game.Rulesets.Osu.Tests Origin = Anchor.Centre, Text = result.IsHit ? "Hit!" : "Miss!", Colour = result.IsHit ? Color4.Green : Color4.Red, - TextSize = 30, + Font = OsuFont.GetFont(size: 30), Position = osuObject.HitObject.StackedEndPosition + judgementOffsetDirection * new Vector2(0, 45) }); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs index bc354bc2b6..4a71d0c61b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; using osuTK.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; using osu.Game.Skinning; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces @@ -42,9 +43,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces }, s => s.GetTexture("Play/osu/hitcircle") == null), number = new SkinnableSpriteText("Play/osu/number-text", _ => new OsuSpriteText { - Font = @"Venera", + Font = OsuFont.GetFont(Typeface.Venera, 40), UseFullGlyphHeight = false, - TextSize = 40, }, restrictSize: false) { Text = @"1" diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs index e4d09b9306..bc9396dd0c 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces @@ -23,16 +24,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = @"0", - Font = @"Venera", - TextSize = 24 + Font = OsuFont.GetFont(Typeface.Venera, 24), }, new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = @"SPINS PER MINUTE", - Font = @"Venera", - TextSize = 12, + Font = OsuFont.GetFont(Typeface.Venera, 12), Y = 30 } }; diff --git a/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs b/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs index 85ef5963a5..127ee9e482 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs @@ -15,6 +15,7 @@ using osu.Game.Graphics.Sprites; using osu.Game.Overlays; using osuTK.Graphics; using osu.Framework.Lists; +using osu.Game.Graphics; namespace osu.Game.Tests.Visual { @@ -196,8 +197,8 @@ namespace osu.Game.Tests.Visual { AutoSizeAxes = Axes.Both; Direction = FillDirection.Horizontal; - Add(new OsuSpriteText { Text = header + @": ", TextSize = text_size }); - Add(valueText = new OsuSpriteText { TextSize = text_size }); + Add(new OsuSpriteText { Text = header + @": ", Font = OsuFont.GetFont(size: text_size) }); + Add(valueText = new OsuSpriteText { Font = OsuFont.GetFont(size: text_size) }); Margin = new MarginPadding(margin); } } diff --git a/osu.Game.Tests/Visual/TestCaseChatLink.cs b/osu.Game.Tests/Visual/TestCaseChatLink.cs index f119e6dc24..6c99684c2e 100644 --- a/osu.Game.Tests/Visual/TestCaseChatLink.cs +++ b/osu.Game.Tests/Visual/TestCaseChatLink.cs @@ -96,7 +96,7 @@ namespace osu.Game.Tests.Visual return true; } - bool isItalic() => newLine.ContentFlow.Where(d => d is OsuSpriteText).Cast().All(sprite => sprite.Font == "Exo2.0-MediumItalic"); + bool isItalic() => newLine.ContentFlow.Where(d => d is OsuSpriteText).Cast().All(sprite => sprite.Font.FontName == "Exo2.0-MediumItalic"); bool isShowingLinks() { diff --git a/osu.Game.Tests/Visual/TestCaseHoldToConfirmOverlay.cs b/osu.Game.Tests/Visual/TestCaseHoldToConfirmOverlay.cs index 046bd76f7e..f66bf34875 100644 --- a/osu.Game.Tests/Visual/TestCaseHoldToConfirmOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseHoldToConfirmOverlay.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using osu.Framework.Graphics; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Screens.Menu; @@ -22,7 +23,7 @@ namespace osu.Game.Tests.Visual Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = "Fired!", - TextSize = 50, + Font = OsuFont.GetFont(size: 50), Alpha = 0, }; diff --git a/osu.Game.Tests/Visual/TestCaseWaveContainer.cs b/osu.Game.Tests/Visual/TestCaseWaveContainer.cs index 56dcfc3cbb..07a282a1a7 100644 --- a/osu.Game.Tests/Visual/TestCaseWaveContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseWaveContainer.cs @@ -41,7 +41,7 @@ namespace osu.Game.Tests.Visual { Anchor = Anchor.Centre, Origin = Anchor.Centre, - TextSize = 20, + Font = OsuFont.GetFont(size: 20), Text = @"Wave Container", }, }, diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index 5e20ca8bc8..bdfcf051d4 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -4,6 +4,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osuTK.Graphics; @@ -31,8 +32,8 @@ namespace osu.Game.Beatmaps.Drawables public float TextSize { - get => statusText.TextSize; - set => statusText.TextSize = value; + get => statusText.Font.Size; + set => statusText.Font = OsuFont.GetFont(statusText.Font, size: value); } public MarginPadding TextPadding @@ -58,7 +59,7 @@ namespace osu.Game.Beatmaps.Drawables { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold) }, }; diff --git a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs index 8f451054ac..592eb93ecc 100644 --- a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs @@ -46,8 +46,6 @@ namespace osu.Game.Graphics.Cursor } } - private const float text_size = 16; - public OsuTooltip() { AutoSizeEasing = Easing.OutQuint; @@ -69,9 +67,7 @@ namespace osu.Game.Graphics.Cursor }, text = new OsuSpriteText { - TextSize = text_size, - Padding = new MarginPadding(5), - Font = @"Exo2.0-Regular", + Padding = new MarginPadding(5) } }; } diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index be1c9e0cfc..74bf790709 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -30,8 +30,7 @@ namespace osu.Game.Graphics public DrawableDate(DateTimeOffset date) { - Font = "Exo2.0-RegularItalic"; - + Font = OsuFont.GetFont(italics: true); Date = date; } diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs new file mode 100644 index 0000000000..7f8a5b1a79 --- /dev/null +++ b/osu.Game/Graphics/OsuFont.cs @@ -0,0 +1,71 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics.Sprites; + +namespace osu.Game.Graphics +{ + public struct OsuFont + { + public const float DEFAULT_FONT_SIZE = 16; + + public static FontUsage Default => GetFont(); + + public static FontUsage GetFont(FontUsage usage, Typeface? typeface = null, float? size = null, FontWeight? weight = null, bool? italics = null, bool? fixedWidth = null) + { + string familyString = typeface != null ? getFamilyString(typeface.Value) : usage.Family; + string weightString = weight != null ? getWeightString(familyString, weight.Value) : usage.Weight; + + return new FontUsage(usage, familyString, size, weightString, italics, fixedWidth); + } + + public static FontUsage GetFont(Typeface typeface = Typeface.Exo, float size = DEFAULT_FONT_SIZE, FontWeight weight = FontWeight.Regular, bool italics = false, bool fixedWidth = false) + => new FontUsage(getFamilyString(typeface), size, getWeightString(typeface, weight), italics, fixedWidth); + + private static string getFamilyString(Typeface typeface) + { + switch (typeface) + { + case Typeface.Exo: + return "Exo2.0"; + case Typeface.FontAwesome: + return "FontAwesome"; + case Typeface.Venera: + return "Venera"; + } + + return null; + } + + private static string getWeightString(Typeface typeface, FontWeight weight) + => getWeightString(getFamilyString(typeface), weight); + + private static string getWeightString(string family, FontWeight weight) + { + string weightString = weight.ToString(); + + // Only exo has an explicit "regular" weight, other fonts do not + if (family != "Exo2.0" && weight == FontWeight.Regular) + weightString = string.Empty; + + return weightString; + } + } + + public enum Typeface + { + Exo, + FontAwesome, + Venera, + } + + public enum FontWeight + { + Light, + Regular, + Medium, + SemiBold, + Bold, + Black + } +} diff --git a/osu.Game/Graphics/Sprites/OsuSpriteText.cs b/osu.Game/Graphics/Sprites/OsuSpriteText.cs index a0c025f4fa..ed771bb03f 100644 --- a/osu.Game/Graphics/Sprites/OsuSpriteText.cs +++ b/osu.Game/Graphics/Sprites/OsuSpriteText.cs @@ -9,12 +9,10 @@ namespace osu.Game.Graphics.Sprites { public class OsuSpriteText : SpriteText { - public const float FONT_SIZE = 16; - public OsuSpriteText() { Shadow = true; - TextSize = FONT_SIZE; + Font = OsuFont.Default; } } diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index b9196adda3..b7a4254642 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -82,7 +82,7 @@ namespace osu.Game.Graphics.UserInterface public BreadcrumbTabItem(T value) : base(value) { - Text.TextSize = 18; + Text.Font = OsuFont.GetFont(Text.Font, size: 18); Text.Margin = new MarginPadding { Vertical = 8 }; Padding = new MarginPadding { Right = padding + item_chevron_size }; Add(Chevron = new SpriteIcon diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 644f66a92d..665c3b9146 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -141,8 +141,7 @@ namespace osu.Game.Graphics.UserInterface Text = Text, Anchor = Anchor.Centre, Origin = Anchor.Centre, - TextSize = 28, - Font = "Exo2.0-Bold", + Font = OsuFont.GetFont(size: 28, weight: FontWeight.Bold), Shadow = true, ShadowColour = new Color4(0, 0, 0, 0.1f), Colour = Color4.White, @@ -197,18 +196,10 @@ namespace osu.Game.Graphics.UserInterface } } - private float textSize = 28; public float TextSize { - get - { - return textSize; - } - set - { - textSize = value; - spriteText.TextSize = value; - } + get => spriteText.Font.Size; + set => spriteText.Font = OsuFont.GetFont(spriteText.Font, size: value); } public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceivePositionalInputAt(screenSpacePos); diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 6ba461ad70..f9e2910cdf 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -84,7 +84,7 @@ namespace osu.Game.Graphics.UserInterface Depth = -1, Origin = Anchor.Centre, Anchor = Anchor.Centre, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold) }; } } diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index 0a1dfe8c41..7fcefee23a 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -149,7 +149,7 @@ namespace osu.Game.Graphics.UserInterface { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - TextSize = text_size, + Font = OsuFont.GetFont(size: text_size), Margin = new MarginPadding { Horizontal = margin_horizontal, Vertical = MARGIN_VERTICAL }, }, BoldText = new OsuSpriteText @@ -158,8 +158,7 @@ namespace osu.Game.Graphics.UserInterface Alpha = 0, Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - TextSize = text_size, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold), Margin = new MarginPadding { Horizontal = margin_horizontal, Vertical = MARGIN_VERTICAL }, } }; diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 7089b7a79a..7fac6bf7bb 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -159,7 +159,7 @@ namespace osu.Game.Graphics.UserInterface Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, Text = (value as IHasDescription)?.Description ?? (value as Enum)?.GetDescription() ?? value.ToString(), - TextSize = 14, + Font = OsuFont.GetFont(size: 14) }, Bar = new Box { @@ -173,7 +173,7 @@ namespace osu.Game.Graphics.UserInterface new HoverClickSounds() }; - Active.BindValueChanged(val => Text.Font = val ? @"Exo2.0-Bold" : @"Exo2.0", true); + Active.BindValueChanged(val => Text.Font = OsuFont.GetFont(Text.Font, weight: val ? FontWeight.Bold : FontWeight.Regular), true); } protected override void OnActivated() => fadeActive(); diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs index 0626534307..0a82a76867 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs @@ -94,11 +94,7 @@ namespace osu.Game.Graphics.UserInterface Direction = FillDirection.Horizontal, Children = new Drawable[] { - text = new OsuSpriteText - { - TextSize = 14, - Font = @"Exo2.0-Bold", - }, + text = new OsuSpriteText { Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold) }, icon = new SpriteIcon { Size = new Vector2(14), diff --git a/osu.Game/Graphics/UserInterface/OsuTextBox.cs b/osu.Game/Graphics/UserInterface/OsuTextBox.cs index a481edb06b..0cb94e755b 100644 --- a/osu.Game/Graphics/UserInterface/OsuTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTextBox.cs @@ -24,7 +24,7 @@ namespace osu.Game.Graphics.UserInterface protected override SpriteText CreatePlaceholder() => new OsuSpriteText { - Font = @"Exo2.0-MediumItalic", + Font = OsuFont.GetFont(weight: FontWeight.Medium, italics: true), Colour = new Color4(180, 180, 180, 255), Margin = new MarginPadding { Left = 2 }, }; @@ -57,7 +57,7 @@ namespace osu.Game.Graphics.UserInterface base.OnFocusLost(e); } - protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), TextSize = CalculatedTextSize }; + protected override Drawable GetDrawableCharacter(char c) => new OsuSpriteText { Text = c.ToString(), Font = OsuFont.GetFont(size: CalculatedTextSize) }; public virtual bool OnPressed(GlobalAction action) { diff --git a/osu.Game/Graphics/UserInterface/PageTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs index 904951da0e..cc21e24165 100644 --- a/osu.Game/Graphics/UserInterface/PageTabControl.cs +++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs @@ -45,7 +45,7 @@ namespace osu.Game.Graphics.UserInterface Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, Text = (value as Enum)?.GetDescription() ?? value.ToString(), - TextSize = 14, + Font = OsuFont.GetFont(size: 14) }, box = new Box { @@ -59,7 +59,7 @@ namespace osu.Game.Graphics.UserInterface new HoverClickSounds() }; - Active.BindValueChanged(val => Text.Font = val ? @"Exo2.0-Bold" : @"Exo2.0", true); + Active.BindValueChanged(val => Text.Font = OsuFont.GetFont(Text.Font, weight: val ? FontWeight.Bold : FontWeight.Regular), true); } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index 9205525af3..8c2849bd7b 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -22,7 +22,7 @@ namespace osu.Game.Graphics.UserInterface public PercentageCounter() { - DisplayedCountSpriteText.FixedWidth = true; + DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, fixedWidth: true); Current.Value = DisplayedCount = 1.0f; } diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 6e261a8fa7..f0730a7dc2 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -61,16 +61,11 @@ namespace osu.Game.Graphics.UserInterface public abstract void Increment(T amount); - private float textSize; public float TextSize { - get { return textSize; } - set - { - textSize = value; - DisplayedCountSpriteText.TextSize = value; - } + get => DisplayedCountSpriteText.Font.Size; + set => DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, size: value); } public Color4 AccentColour @@ -86,10 +81,7 @@ namespace osu.Game.Graphics.UserInterface { Children = new Drawable[] { - DisplayedCountSpriteText = new OsuSpriteText - { - Font = @"Venera" - }, + DisplayedCountSpriteText = new OsuSpriteText { Font = OsuFont.GetFont(Typeface.Venera) } }; TextSize = 40; diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index 944993d99c..0c1cb570ea 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -28,7 +28,7 @@ namespace osu.Game.Graphics.UserInterface /// How many leading zeroes the counter will have. public ScoreCounter(uint leading = 0) { - DisplayedCountSpriteText.FixedWidth = true; + DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, fixedWidth: true); LeadingZeroes = leading; } diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index 7373924612..3f346caea3 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -9,6 +9,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Events; using osu.Game.Graphics; using osu.Game.Graphics.Containers; @@ -75,9 +76,7 @@ namespace osu.Game.Online.Leaderboards { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = @"Exo2.0-MediumItalic", - TextSize = 22, - // ReSharper disable once ImpureMethodCallOnReadonlyValueField + Font = OsuFont.GetFont(size: 22, weight: FontWeight.Medium, italics: true), Text = RankPosition.ToString(), }, }, @@ -137,8 +136,7 @@ namespace osu.Game.Online.Leaderboards nameLabel = new OsuSpriteText { Text = user.Username, - Font = @"Exo2.0-BoldItalic", - TextSize = 23, + Font = OsuFont.GetFont(size: 23, weight: FontWeight.Bold, italics: true) }, new FillFlowContainer { @@ -187,7 +185,7 @@ namespace osu.Game.Online.Leaderboards Spacing = new Vector2(5f, 0f), Children = new Drawable[] { - scoreLabel = new GlowingSpriteText(score.TotalScore.ToString(@"N0"), @"Venera", 23, Color4.White, OsuColour.FromHex(@"83ccfa")), + scoreLabel = new GlowingSpriteText(score.TotalScore.ToString(@"N0"), OsuFont.GetFont(Typeface.Venera, 23), Color4.White, OsuColour.FromHex(@"83ccfa")), RankContainer = new Container { Size = new Vector2(40f, 20f), @@ -275,7 +273,7 @@ namespace osu.Game.Online.Leaderboards private class GlowingSpriteText : Container { - public GlowingSpriteText(string text, string font, int textSize, Color4 textColour, Color4 glowColour) + public GlowingSpriteText(string text, FontUsage font, Color4 textColour, Color4 glowColour) { AutoSizeAxes = Axes.Both; @@ -296,9 +294,7 @@ namespace osu.Game.Online.Leaderboards { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = font, - FixedWidth = true, - TextSize = textSize, + Font = OsuFont.GetFont(font, fixedWidth: true), Text = text, Colour = glowColour, Shadow = false, @@ -309,9 +305,7 @@ namespace osu.Game.Online.Leaderboards { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = font, - FixedWidth = true, - TextSize = textSize, + Font = OsuFont.GetFont(font, fixedWidth: true), Text = text, Colour = textColour, Shadow = false, @@ -369,7 +363,7 @@ namespace osu.Game.Online.Leaderboards }, }, }, - new GlowingSpriteText(statistic.Value, @"Exo2.0-Bold", 17, Color4.White, OsuColour.FromHex(@"83ccfa")) + new GlowingSpriteText(statistic.Value, OsuFont.GetFont(size: 17, weight: FontWeight.Bold), Color4.White, OsuColour.FromHex(@"83ccfa")) { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, diff --git a/osu.Game/Online/Leaderboards/MessagePlaceholder.cs b/osu.Game/Online/Leaderboards/MessagePlaceholder.cs index 441db0d922..86d59d2809 100644 --- a/osu.Game/Online/Leaderboards/MessagePlaceholder.cs +++ b/osu.Game/Online/Leaderboards/MessagePlaceholder.cs @@ -14,7 +14,7 @@ namespace osu.Game.Online.Leaderboards { AddIcon(FontAwesome.fa_exclamation_circle, cp => { - cp.TextSize = TEXT_SIZE; + cp.Font = OsuFont.GetFont(cp.Font, size: TEXT_SIZE); cp.Padding = new MarginPadding { Right = 10 }; }); diff --git a/osu.Game/Online/Leaderboards/Placeholder.cs b/osu.Game/Online/Leaderboards/Placeholder.cs index 72f9502753..675e224bee 100644 --- a/osu.Game/Online/Leaderboards/Placeholder.cs +++ b/osu.Game/Online/Leaderboards/Placeholder.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Graphics; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; namespace osu.Game.Online.Leaderboards @@ -12,7 +13,7 @@ namespace osu.Game.Online.Leaderboards protected const float TEXT_SIZE = 22; protected Placeholder() - : base(cp => cp.TextSize = TEXT_SIZE) + : base(cp => cp.Font = OsuFont.GetFont(cp.Font, size: TEXT_SIZE)) { Anchor = Anchor.Centre; Origin = Anchor.Centre; diff --git a/osu.Game/Overlays/AccountCreation/ErrorTextFlowContainer.cs b/osu.Game/Overlays/AccountCreation/ErrorTextFlowContainer.cs index bb436dbb2c..11c256130f 100644 --- a/osu.Game/Overlays/AccountCreation/ErrorTextFlowContainer.cs +++ b/osu.Game/Overlays/AccountCreation/ErrorTextFlowContainer.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using osu.Framework.Graphics; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osuTK.Graphics; @@ -13,7 +14,7 @@ namespace osu.Game.Overlays.AccountCreation private readonly List errorDrawables = new List(); public ErrorTextFlowContainer() - : base(cp => { cp.TextSize = 12; }) + : base(cp => cp.Font = OsuFont.GetFont(cp.Font, size: 12)) { } diff --git a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs index 407d2cfbf1..2400403ec8 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs @@ -61,10 +61,10 @@ namespace osu.Game.Overlays.AccountCreation { new OsuSpriteText { - TextSize = 20, Margin = new MarginPadding { Vertical = 10 }, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, + Font = OsuFont.GetFont(size: 20), Text = "Let's create an account!", }, usernameTextBox = new OsuTextBox @@ -129,7 +129,7 @@ namespace osu.Game.Overlays.AccountCreation usernameDescription.AddText("This will be your public presence. No profanity, no impersonation. Avoid exposing your own personal details, too!"); emailAddressDescription.AddText("Will be used for notifications, account verification and in the case you forget your password. No spam, ever."); - emailAddressDescription.AddText(" Make sure to get it right!", cp => cp.Font = "Exo2.0-Bold"); + emailAddressDescription.AddText(" Make sure to get it right!", cp => cp.Font = OsuFont.GetFont(cp.Font, weight: FontWeight.Bold)); passwordDescription.AddText("At least "); characterCheckText = passwordDescription.AddText("8 characters long"); diff --git a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs index 3cc84e3562..d1336f0a0e 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs @@ -83,14 +83,13 @@ namespace osu.Game.Overlays.AccountCreation }, new OsuSpriteText { - TextSize = 28, - Font = "Exo2.0-Light", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Colour = Color4.Red, + Font = OsuFont.GetFont(size: 28, weight: FontWeight.Light), Text = "Warning! 注意!", }, - multiAccountExplanationText = new OsuTextFlowContainer(cp => { cp.TextSize = 12; }) + multiAccountExplanationText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.GetFont(cp.Font, size: 12)) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y @@ -106,7 +105,7 @@ namespace osu.Game.Overlays.AccountCreation Text = "I understand. This account isn't for me.", Action = () => this.Push(new ScreenEntry()) }, - furtherAssistance = new LinkFlowContainer(cp => { cp.TextSize = 12; }) + furtherAssistance = new LinkFlowContainer(cp => cp.Font = OsuFont.GetFont(cp.Font, size: 12)) { Margin = new MarginPadding { Top = 20 }, Anchor = Anchor.TopCentre, diff --git a/osu.Game/Overlays/AccountCreation/ScreenWelcome.cs b/osu.Game/Overlays/AccountCreation/ScreenWelcome.cs index d4b8323394..f6ddb135ec 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenWelcome.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenWelcome.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Screens; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Settings; using osu.Game.Screens.Menu; @@ -40,17 +41,16 @@ namespace osu.Game.Overlays.AccountCreation }, new OsuSpriteText { - TextSize = 24, - Font = "Exo2.0-Light", Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, + Font = OsuFont.GetFont(size: 24, weight: FontWeight.Light), Text = "New Player Registration", }, new OsuSpriteText { - TextSize = 12, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, + Font = OsuFont.GetFont(size: 12), Text = "let's get you started", }, new SettingsButton diff --git a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs index c9907014ca..a47c20c244 100644 --- a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs +++ b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs @@ -11,6 +11,8 @@ using osuTK; using osuTK.Graphics; using osu.Game.Graphics.Containers; using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; namespace osu.Game.Overlays.BeatmapSet { @@ -47,8 +49,8 @@ namespace osu.Game.Overlays.BeatmapSet fields.Children = new Drawable[] { - new Field("mapped by", BeatmapSet.Metadata.Author.Username, @"Exo2.0-RegularItalic"), - new Field("submitted on", online.Submitted.ToString(@"MMMM d, yyyy"), @"Exo2.0-Bold") + new Field("mapped by", BeatmapSet.Metadata.Author.Username, OsuFont.GetFont(italics: true)), + new Field("submitted on", online.Submitted.ToString(@"MMMM d, yyyy"), OsuFont.GetFont(weight: FontWeight.Bold)) { Margin = new MarginPadding { Top = 5 }, }, @@ -56,11 +58,11 @@ namespace osu.Game.Overlays.BeatmapSet if (online.Ranked.HasValue) { - fields.Add(new Field("ranked on", online.Ranked.Value.ToString(@"MMMM d, yyyy"), @"Exo2.0-Bold")); + fields.Add(new Field("ranked on", online.Ranked.Value.ToString(@"MMMM d, yyyy"), OsuFont.GetFont(weight: FontWeight.Bold))); } else if (online.LastUpdated.HasValue) { - fields.Add(new Field("last updated on", online.LastUpdated.Value.ToString(@"MMMM d, yyyy"), @"Exo2.0-Bold")); + fields.Add(new Field("last updated on", online.LastUpdated.Value.ToString(@"MMMM d, yyyy"), OsuFont.GetFont(weight: FontWeight.Bold))); } } @@ -105,7 +107,7 @@ namespace osu.Game.Overlays.BeatmapSet private class Field : FillFlowContainer { - public Field(string first, string second, string secondFont) + public Field(string first, string second, FontUsage secondFont) { AutoSizeAxes = Axes.Both; Direction = FillDirection.Horizontal; @@ -115,13 +117,12 @@ namespace osu.Game.Overlays.BeatmapSet new OsuSpriteText { Text = $"{first} ", - TextSize = 13, + Font = OsuFont.GetFont(size: 13) }, new OsuSpriteText { Text = second, - TextSize = 13, - Font = secondFont, + Font = OsuFont.GetFont(secondFont, size: 13) }, }; } diff --git a/osu.Game/Overlays/BeatmapSet/BasicStats.cs b/osu.Game/Overlays/BeatmapSet/BasicStats.cs index af5998bfa1..ac2e5497af 100644 --- a/osu.Game/Overlays/BeatmapSet/BasicStats.cs +++ b/osu.Game/Overlays/BeatmapSet/BasicStats.cs @@ -136,9 +136,8 @@ namespace osu.Game.Overlays.BeatmapSet { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - TextSize = 13, - Font = @"Exo2.0-Bold", Margin = new MarginPadding { Left = 10 }, + Font = OsuFont.GetFont(size: 13, weight: FontWeight.Bold), }, }, }, diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs index c2edaf01ed..ab5c435941 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs @@ -107,15 +107,13 @@ namespace osu.Game.Overlays.BeatmapSet { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - TextSize = 20, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold) }, starRating = new OsuSpriteText { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - TextSize = 13, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: 13, weight: FontWeight.Bold), Text = "Star Difficulty", Alpha = 0, Margin = new MarginPadding { Bottom = 1 }, @@ -309,8 +307,7 @@ namespace osu.Game.Overlays.BeatmapSet { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Font = @"Exo2.0-SemiBoldItalic", - TextSize = 14, + Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold, italics: true) }, }; } diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs index 4d46d41c0f..0a9023646b 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs @@ -118,8 +118,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons new OsuSpriteText { Text = "Downloading...", - TextSize = 13, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: 13, weight: FontWeight.Bold) }, }; break; @@ -129,8 +128,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons new OsuSpriteText { Text = "Importing...", - TextSize = 13, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: 13, weight: FontWeight.Bold) }, }; break; @@ -143,14 +141,12 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons new OsuSpriteText { Text = "Download", - TextSize = 13, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: 13, weight: FontWeight.Bold) }, new OsuSpriteText { Text = BeatmapSet.Value.OnlineInfo.HasVideo && noVideo ? "without Video" : string.Empty, - TextSize = 11, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: 11, weight: FontWeight.Bold) }, }; this.FadeIn(200); diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index 8721a1ce5a..eb49cdf444 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -115,8 +115,7 @@ namespace osu.Game.Overlays.BeatmapSet { title = new OsuSpriteText { - Font = @"Exo2.0-BoldItalic", - TextSize = 37, + Font = OsuFont.GetFont(size: 37, weight: FontWeight.Bold, italics: true) }, externalLink = new ExternalLinkButton { @@ -126,11 +125,7 @@ namespace osu.Game.Overlays.BeatmapSet }, } }, - artist = new OsuSpriteText - { - Font = @"Exo2.0-SemiBoldItalic", - TextSize = 25, - }, + artist = new OsuSpriteText { Font = OsuFont.GetFont(size: 25, weight: FontWeight.SemiBold, italics: true) }, new Container { RelativeSizeAxes = Axes.X, diff --git a/osu.Game/Overlays/BeatmapSet/Info.cs b/osu.Game/Overlays/BeatmapSet/Info.cs index 3a32abe9cc..afff1f3270 100644 --- a/osu.Game/Overlays/BeatmapSet/Info.cs +++ b/osu.Game/Overlays/BeatmapSet/Info.cs @@ -156,7 +156,7 @@ namespace osu.Game.Overlays.BeatmapSet this.FadeIn(transition_duration); textFlow.Clear(); - textFlow.AddText(value, s => s.TextSize = 14); + textFlow.AddText(value, s => s.Font = OsuFont.GetFont(s.Font, size: 14)); } } @@ -177,8 +177,7 @@ namespace osu.Game.Overlays.BeatmapSet header = new OsuSpriteText { Text = title, - Font = @"Exo2.0-Bold", - TextSize = 14, + Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold), Shadow = false, Margin = new MarginPadding { Top = 20 }, }, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs index 0eb8b325d3..e88a3f3dfc 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Input.Events; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Users; @@ -30,21 +31,14 @@ namespace osu.Game.Overlays.BeatmapSet.Scores public float TextSize { - set - { - if (text.TextSize == value) return; - text.TextSize = value; - } - get { return text.TextSize; } + get => text.Font.Size; + set => text.Font = OsuFont.GetFont(text.Font, size: value); } public ClickableUsername() { AutoSizeAxes = Axes.Both; - Child = text = new OsuSpriteText - { - Font = @"Exo2.0-BoldItalic", - }; + Child = text = new OsuSpriteText { Font = OsuFont.GetFont(weight: FontWeight.Bold, italics: true) }; } [BackgroundDependencyLoader(true)] diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index 1f50385adc..3bab6d3f1d 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -46,7 +46,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Text = $"#{index + 1}", - Font = @"Exo2.0-RegularItalic", + Font = OsuFont.GetFont(italics: true), Margin = new MarginPadding { Left = side_margin } }, new DrawableFlag(score.User.Country) @@ -87,17 +87,16 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Anchor = Anchor.CentreLeft, Origin = Anchor.CentreRight, Text = $@"{score.TotalScore:N0}", - Font = @"Venera", + Font = OsuFont.GetFont(Typeface.Venera, fixedWidth: true), RelativePositionAxes = Axes.X, X = 0.75f, - FixedWidth = true, }, new OsuSpriteText { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreRight, Text = $@"{score.Accuracy:P2}", - Font = @"Exo2.0-RegularItalic", + Font = OsuFont.GetFont(italics: true), RelativePositionAxes = Axes.X, X = 0.85f }, @@ -106,7 +105,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Text = $"{score.Statistics[HitResult.Great]}/{score.Statistics[HitResult.Good]}/{score.Statistics[HitResult.Meh]}", - Font = @"Exo2.0-RegularItalic", + Font = OsuFont.GetFont(italics: true), Margin = new MarginPadding { Right = side_margin } }, }; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index c9551cf6f8..c5a77729c7 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -117,8 +117,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Anchor = Anchor.TopRight, Origin = Anchor.BottomRight, Text = "#1", - TextSize = 40, - Font = @"Exo2.0-BoldItalic", + Font = OsuFont.GetFont(size: 40, weight: FontWeight.Bold, italics: true), Y = height / 4, Margin = new MarginPadding { Right = margin } }, @@ -222,15 +221,10 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { headerText = new OsuSpriteText { - TextSize = 14, Text = header, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold) }, - valueText = new OsuSpriteText - { - TextSize = 25, - Font = @"Exo2.0-RegularItalic", - } + valueText = new OsuSpriteText { Font = OsuFont.GetFont(size: 25, italics: true) } }; } diff --git a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs index 28902561f4..0a844028fe 100644 --- a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs +++ b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs @@ -62,7 +62,7 @@ namespace osu.Game.Overlays.BeatmapSet Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = "Success Rate", - TextSize = 13, + Font = OsuFont.GetFont(size: 13) }, successRate = new Bar { @@ -79,7 +79,7 @@ namespace osu.Game.Overlays.BeatmapSet { Anchor = Anchor.TopRight, Origin = Anchor.TopCentre, - TextSize = 13, + Font = OsuFont.GetFont(size: 13), }, }, graphLabel = new OsuSpriteText @@ -87,7 +87,7 @@ namespace osu.Game.Overlays.BeatmapSet Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = "Points of Failure", - TextSize = 13, + Font = OsuFont.GetFont(size: 13), Margin = new MarginPadding { Vertical = 20 }, }, }, diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index 3e2ef07ef2..db8c284fba 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -87,9 +87,8 @@ namespace osu.Game.Overlays.Chat Drawable effectedUsername = username = new OsuSpriteText { - Font = @"Exo2.0-BoldItalic", Colour = hasBackground ? customUsernameColour : username_colours[message.Sender.Id % username_colours.Length], - TextSize = TextSize, + Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Bold, italics: true) }; if (hasBackground) @@ -138,9 +137,7 @@ namespace osu.Game.Overlays.Chat { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Font = @"Exo2.0-SemiBold", - FixedWidth = true, - TextSize = TextSize * 0.75f, + Font = OsuFont.GetFont(size: TextSize * 0.75f, weight: FontWeight.Bold, fixedWidth: true) }, new MessageSender(message.Sender) { @@ -162,13 +159,13 @@ namespace osu.Game.Overlays.Chat { if (Message.IsAction) { - t.Font = @"Exo2.0-MediumItalic"; + t.Font = OsuFont.GetFont(weight: FontWeight.Medium, italics: true); if (senderHasBackground) t.Colour = OsuColour.FromHex(message.Sender.Colour); } - t.TextSize = TextSize; + t.Font = OsuFont.GetFont(t.Font, size: TextSize); }) { AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs index 23dedf251f..a3f0bbb1f1 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs @@ -89,8 +89,7 @@ namespace osu.Game.Overlays.Chat.Selection name = new OsuSpriteText { Text = channel.ToString(), - TextSize = text_size, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: text_size, weight: FontWeight.Bold), Shadow = false, }, }, @@ -106,8 +105,7 @@ namespace osu.Game.Overlays.Chat.Selection topic = new OsuSpriteText { Text = channel.Topic, - TextSize = text_size, - Font = @"Exo2.0-SemiBold", + Font = OsuFont.GetFont(size: text_size, weight: FontWeight.SemiBold), Shadow = false, }, }, @@ -130,8 +128,7 @@ namespace osu.Game.Overlays.Chat.Selection new OsuSpriteText { Text = @"0", - TextSize = text_size, - Font = @"Exo2.0-SemiBold", + Font = OsuFont.GetFont(size: text_size, weight: FontWeight.SemiBold), Shadow = false, }, }, diff --git a/osu.Game/Overlays/Chat/Selection/ChannelSection.cs b/osu.Game/Overlays/Chat/Selection/ChannelSection.cs index 2af416f7c0..160bf05a2b 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelSection.cs @@ -7,6 +7,7 @@ using System.Linq; using osuTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Online.Chat; @@ -48,8 +49,7 @@ namespace osu.Game.Overlays.Chat.Selection { header = new OsuSpriteText { - TextSize = 15, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold), }, ChannelFlow = new FillFlowContainer { diff --git a/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs index 00de5fd5fd..2f11327145 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs @@ -110,7 +110,7 @@ namespace osu.Game.Overlays.Chat.Selection new OsuSpriteText { Text = @"Chat Channels", - TextSize = 20, + Font = OsuFont.GetFont(size: 20), Shadow = false, }, search = new HeaderSearchTextBox diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs index d7d299a2cf..158e191433 100644 --- a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs +++ b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs @@ -20,8 +20,8 @@ namespace osu.Game.Overlays.Chat.Tabs Icon.Alpha = 0; - Text.TextSize = 45; - TextBold.TextSize = 45; + Text.Font = OsuFont.GetFont(Text.Font, size: 45); + TextBold.Font = OsuFont.GetFont(Text.Font, size: 45); } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs index 7acd56c864..c9797998c3 100644 --- a/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs +++ b/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs @@ -90,7 +90,7 @@ namespace osu.Game.Overlays.Chat.Tabs Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, Text = value.ToString(), - TextSize = 18, + Font = OsuFont.GetFont(size: 18) }, TextBold = new OsuSpriteText { @@ -99,8 +99,7 @@ namespace osu.Game.Overlays.Chat.Tabs Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, Text = value.ToString(), - Font = @"Exo2.0-Bold", - TextSize = 18, + Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold) }, CloseButton = new TabCloseButton { diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index bf98d6ec49..a766e6efb7 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -171,7 +171,7 @@ namespace osu.Game.Overlays.Dialog }, }, }, - header = new OsuTextFlowContainer(t => t.TextSize = 25) + header = new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(t.Font, size: 25)) { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, @@ -180,7 +180,7 @@ namespace osu.Game.Overlays.Dialog Padding = new MarginPadding(15), TextAnchor = Anchor.TopCentre, }, - body = new OsuTextFlowContainer(t => t.TextSize = 18) + body = new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(t.Font, size: 18)) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 4ee6ff9698..a57413545e 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -75,13 +75,12 @@ namespace osu.Game.Overlays.Direct new OsuSpriteText { Text = new LocalisedString((SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title)), - TextSize = 18, - Font = @"Exo2.0-BoldItalic", + Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true) }, new OsuSpriteText { Text = new LocalisedString((SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist)), - Font = @"Exo2.0-BoldItalic", + Font = OsuFont.GetFont(weight: FontWeight.Bold, italics: true) }, }, }, @@ -127,15 +126,14 @@ namespace osu.Game.Overlays.Direct new OsuSpriteText { Text = "mapped by ", - TextSize = 14, + Font = OsuFont.GetFont(size: 14), Shadow = false, Colour = colours.Gray5, }, new OsuSpriteText { Text = SetInfo.Metadata.Author.Username, - TextSize = 14, - Font = @"Exo2.0-SemiBoldItalic", + Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold, italics: true), Shadow = false, Colour = colours.BlueDark, }, @@ -150,7 +148,7 @@ namespace osu.Game.Overlays.Direct new OsuSpriteText { Text = SetInfo.Metadata.Source, - TextSize = 14, + Font = OsuFont.GetFont(size: 14), Shadow = false, Colour = colours.Gray5, Alpha = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f, diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index cb74ae54a6..7bf372dff7 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -95,13 +95,12 @@ namespace osu.Game.Overlays.Direct new OsuSpriteText { Text = new LocalisedString((SetInfo.Metadata.TitleUnicode, SetInfo.Metadata.Title)), - TextSize = 18, - Font = @"Exo2.0-BoldItalic", + Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true) }, new OsuSpriteText { Text = new LocalisedString((SetInfo.Metadata.ArtistUnicode, SetInfo.Metadata.Artist)), - Font = @"Exo2.0-BoldItalic", + Font = OsuFont.GetFont(weight: FontWeight.Bold, italics: true) }, } }, @@ -161,13 +160,12 @@ namespace osu.Game.Overlays.Direct new OsuSpriteText { Text = "mapped by ", - TextSize = 14, + Font = OsuFont.GetFont(size: 14) }, new OsuSpriteText { Text = SetInfo.Metadata.Author.Username, - TextSize = 14, - Font = @"Exo2.0-SemiBoldItalic", + Font = OsuFont.GetFont(size: 14, weight: FontWeight.SemiBold, italics: true) }, }, }, @@ -176,7 +174,7 @@ namespace osu.Game.Overlays.Direct Text = SetInfo.Metadata.Source, Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - TextSize = 14, + Font = OsuFont.GetFont(size: 14), Alpha = string.IsNullOrEmpty(SetInfo.Metadata.Source) ? 0f : 1f, }, }, diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index f8f6fd9b53..e512852627 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -173,10 +173,7 @@ namespace osu.Game.Overlays.Direct Children = new Drawable[] { - text = new OsuSpriteText - { - Font = @"Exo2.0-SemiBoldItalic", - }, + text = new OsuSpriteText { Font = OsuFont.GetFont(weight: FontWeight.SemiBold, italics: true) }, new SpriteIcon { Icon = icon, diff --git a/osu.Game/Overlays/Direct/Header.cs b/osu.Game/Overlays/Direct/Header.cs index 267590f19a..d1478cf3b6 100644 --- a/osu.Game/Overlays/Direct/Header.cs +++ b/osu.Game/Overlays/Direct/Header.cs @@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Direct protected override Color4 BackgroundColour => OsuColour.FromHex(@"252f3a"); protected override DirectTab DefaultTab => DirectTab.Search; - protected override Drawable CreateHeaderText() => new OsuSpriteText { Text = @"osu!direct", TextSize = 25 }; + protected override Drawable CreateHeaderText() => new OsuSpriteText { Text = @"osu!direct", Font = OsuFont.GetFont(size: 25) }; protected override FontAwesome Icon => FontAwesome.fa_osu_chevron_down_o; public Header() diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 7dd59bf0bc..19ee7f23d7 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -105,12 +105,11 @@ namespace osu.Game.Overlays new OsuSpriteText { Text = "Found ", - TextSize = 15, + Font = OsuFont.GetFont(size: 15) }, resultCountsText = new OsuSpriteText { - TextSize = 15, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold) }, } }, diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index 3dad94c8fa..6bdaff19ee 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -349,8 +349,7 @@ namespace osu.Game.Overlays.KeyBinding }, Text = new OsuSpriteText { - Font = "Venera", - TextSize = 10, + Font = OsuFont.GetFont(Typeface.Venera, 10), Margin = new MarginPadding(5), Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Overlays/KeyBindingOverlay.cs b/osu.Game/Overlays/KeyBindingOverlay.cs index d0382a4264..300563dc59 100644 --- a/osu.Game/Overlays/KeyBindingOverlay.cs +++ b/osu.Game/Overlays/KeyBindingOverlay.cs @@ -73,8 +73,7 @@ namespace osu.Game.Overlays Anchor = Anchor.Centre, Origin = Anchor.Centre, Y = 15, - TextSize = 12, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), Text = @"back", }, } diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index a7579b4d4b..0ff29ba93e 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -63,8 +63,7 @@ namespace osu.Game.Overlays.MedalSplash Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = "Medal Unlocked".ToUpperInvariant(), - TextSize = 24, - Font = @"Exo2.0-Light", + Font = OsuFont.GetFont(size: 24, weight: FontWeight.Light), Alpha = 0f, Scale = new Vector2(1f / scale_when_unlocked), }, @@ -84,8 +83,7 @@ namespace osu.Game.Overlays.MedalSplash Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = medal.Name, - TextSize = 20, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: 20, weight: FontWeight.Bold), Alpha = 0f, Scale = new Vector2(1f / scale_when_full), }, @@ -107,7 +105,7 @@ namespace osu.Game.Overlays.MedalSplash { s.Anchor = Anchor.TopCentre; s.Origin = Anchor.TopCentre; - s.TextSize = 16; + s.Font = OsuFont.GetFont(s.Font, size: 16); }); medalContainer.OnLoadComplete = d => diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index e1fb8674de..f9cc19419c 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -14,6 +14,7 @@ using System; using System.Linq; using osu.Framework.Graphics.Cursor; using osu.Framework.Input.Events; +using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.Mods @@ -275,7 +276,7 @@ namespace osu.Game.Overlays.Mods Y = 75, Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, - TextSize = 18, + Font = OsuFont.GetFont(size: 18) }, new HoverClickSounds() }; diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index 0530f812e3..bf9efa75ea 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -11,6 +11,7 @@ using System; using System.Linq; using System.Collections.Generic; using osu.Framework.Input.Events; +using osu.Game.Graphics; namespace osu.Game.Overlays.Mods { @@ -123,7 +124,7 @@ namespace osu.Game.Overlays.Mods Origin = Anchor.TopLeft, Anchor = Anchor.TopLeft, Position = new Vector2(0f, 0f), - Font = @"Exo2.0-Bold" + Font = OsuFont.GetFont(weight: FontWeight.Bold) }, ButtonsContainer = new FillFlowContainer { diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 386dd01ebd..b219610e59 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -264,9 +264,8 @@ namespace osu.Game.Overlays.Mods { new OsuSpriteText { - Font = @"Exo2.0-Bold", Text = @"Gameplay Mods", - TextSize = 22, + Font = OsuFont.GetFont(size: 22, weight: FontWeight.Bold), Shadow = true, Margin = new MarginPadding { @@ -275,7 +274,7 @@ namespace osu.Game.Overlays.Mods }, new OsuTextFlowContainer(text => { - text.TextSize = 18; + text.Font = OsuFont.GetFont(text.Font, size: 18); text.Shadow = true; }) { @@ -365,7 +364,7 @@ namespace osu.Game.Overlays.Mods new OsuSpriteText { Text = @"Score Multiplier:", - TextSize = 30, + Font = OsuFont.GetFont(size: 30), Margin = new MarginPadding { Top = 5, @@ -374,8 +373,7 @@ namespace osu.Game.Overlays.Mods }, MultiplierLabel = new OsuSpriteText { - Font = @"Exo2.0-Bold", - TextSize = 30, + Font = OsuFont.GetFont(size: 30, weight: FontWeight.Bold), Margin = new MarginPadding { Top = 5 @@ -383,9 +381,8 @@ namespace osu.Game.Overlays.Mods }, UnrankedLabel = new OsuSpriteText { - Font = @"Exo2.0-Bold", Text = @"(Unranked)", - TextSize = 30, + Font = OsuFont.GetFont(size: 30, weight: FontWeight.Bold), Margin = new MarginPadding { Top = 5, diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 7c7b78afc7..470a05ad88 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -108,16 +108,11 @@ namespace osu.Game.Overlays.Music text.Clear(); //space after the title to put a space between the title and artist - titleSprites = text.AddText(titleBind.Value + @" ", sprite => - { - sprite.TextSize = 16; - sprite.Font = @"Exo2.0-Regular"; - }).OfType(); + titleSprites = text.AddText(titleBind.Value + @" ", sprite => sprite.Font = OsuFont.Default).OfType(); text.AddText(artistBind.Value, sprite => { - sprite.TextSize = 14; - sprite.Font = @"Exo2.0-Bold"; + sprite.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold); sprite.Colour = artistColour; sprite.Padding = new MarginPadding { Top = 1 }; }); diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index a70dc63c50..0169e11632 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -107,20 +107,18 @@ namespace osu.Game.Overlays Origin = Anchor.BottomCentre, Anchor = Anchor.TopCentre, Position = new Vector2(0, 40), - TextSize = 25, + Font = OsuFont.GetFont(size: 25, weight: FontWeight.Medium, italics: true), Colour = Color4.White, Text = @"Nothing to play", - Font = @"Exo2.0-MediumItalic" }, artist = new OsuSpriteText { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Position = new Vector2(0, 45), - TextSize = 15, + Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold, italics: true), Colour = Color4.White, Text = @"Nothing to play", - Font = @"Exo2.0-BoldItalic" }, new Container { diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index afbacfac52..6b0e17a482 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -102,13 +102,13 @@ namespace osu.Game.Overlays.Notifications titleText = new OsuSpriteText { Text = title.ToUpperInvariant(), - Font = @"Exo2.0-Black", + Font = OsuFont.GetFont(weight: FontWeight.Black) }, countText = new OsuSpriteText { Text = "3", Colour = colours.Yellow, - Font = @"Exo2.0-Black", + Font = OsuFont.GetFont(weight: FontWeight.Black) }, } }, diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index cf7b716665..623b76c12e 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -115,10 +115,7 @@ namespace osu.Game.Overlays.Notifications RelativeSizeAxes = Axes.Both, }); - Content.Add(textDrawable = new OsuTextFlowContainer(t => - { - t.TextSize = 16; - }) + Content.Add(textDrawable = new OsuTextFlowContainer(t => t.Font = OsuFont.Default) { Colour = OsuColour.Gray(128), AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Overlays/Notifications/SimpleNotification.cs b/osu.Game/Overlays/Notifications/SimpleNotification.cs index 283a412b2a..933e296656 100644 --- a/osu.Game/Overlays/Notifications/SimpleNotification.cs +++ b/osu.Game/Overlays/Notifications/SimpleNotification.cs @@ -59,7 +59,7 @@ namespace osu.Game.Overlays.Notifications } }); - Content.Add(textDrawable = new OsuTextFlowContainer(t => t.TextSize = 14) + Content.Add(textDrawable = new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(t.Font, size: 14)) { Colour = OsuColour.Gray(128), AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 42031ee07e..5e45fbf081 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -69,16 +69,14 @@ namespace osu.Game.Overlays textLine1 = new OsuSpriteText { Padding = new MarginPadding(10), - Font = @"Exo2.0-Black", + Font = OsuFont.GetFont(size: 14, weight: FontWeight.Black), Spacing = new Vector2(1, 0), - TextSize = 14, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, textLine2 = new OsuSpriteText { - TextSize = 24, - Font = @"Exo2.0-Light", + Font = OsuFont.GetFont(size: 24, weight: FontWeight.Light), Padding = new MarginPadding { Left = 10, Right = 10 }, Anchor = Anchor.Centre, Origin = Anchor.BottomCentre, @@ -105,8 +103,7 @@ namespace osu.Game.Overlays Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Margin = new MarginPadding { Bottom = 15 }, - Font = @"Exo2.0-Bold", - TextSize = 12, + Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold), Alpha = 0.3f, }, } diff --git a/osu.Game/Overlays/Profile/Components/GradeBadge.cs b/osu.Game/Overlays/Profile/Components/GradeBadge.cs index 4280f89cdf..ca56780663 100644 --- a/osu.Game/Overlays/Profile/Components/GradeBadge.cs +++ b/osu.Game/Overlays/Profile/Components/GradeBadge.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Overlays.Profile.Components @@ -36,8 +37,7 @@ namespace osu.Game.Overlays.Profile.Components { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - TextSize = 14, - Font = @"Exo2.0-Bold" + Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold) }); } diff --git a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs index 56cceae79c..2978d131f5 100644 --- a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs +++ b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs @@ -53,11 +53,10 @@ namespace osu.Game.Overlays.Profile.Header { badgeCountText = new OsuSpriteText { - Alpha = 0, - TextSize = 12, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Font = "Exo2.0-Regular" + Alpha = 0, + Font = OsuFont.GetFont(size: 12) }, new Container { diff --git a/osu.Game/Overlays/Profile/Header/RankGraph.cs b/osu.Game/Overlays/Profile/Header/RankGraph.cs index 09880f044c..c8a486e037 100644 --- a/osu.Game/Overlays/Profile/Header/RankGraph.cs +++ b/osu.Game/Overlays/Profile/Header/RankGraph.cs @@ -44,30 +44,26 @@ namespace osu.Game.Overlays.Profile.Header Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = "No recent plays", - TextSize = 14, - Font = @"Exo2.0-RegularItalic", + Font = OsuFont.GetFont(size: 14, italics: true) }, rankText = new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Font = @"Exo2.0-RegularItalic", - TextSize = primary_textsize + Font = OsuFont.GetFont(size: primary_textsize, italics: true), }, relativeText = new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Font = @"Exo2.0-RegularItalic", + Font = OsuFont.GetFont(size: secondary_textsize, italics: true), Y = 25, - TextSize = secondary_textsize }, performanceText = new OsuSpriteText { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Font = @"Exo2.0-RegularItalic", - TextSize = secondary_textsize + Font = OsuFont.GetFont(size: secondary_textsize, italics: true) }, graph = new RankChartLineGraph { diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 524b709a83..2cafe5c7f4 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -118,8 +118,7 @@ namespace osu.Game.Overlays.Profile usernameText = new OsuSpriteText { Text = user.Username, - Font = @"Exo2.0-RegularItalic", - TextSize = 30, + Font = OsuFont.GetFont(size: 30, italics: true) }, new ExternalLinkButton($@"https://osu.ppy.sh/users/{user.Id}") { @@ -166,7 +165,7 @@ namespace osu.Game.Overlays.Profile Y = cover_height, Colour = OsuColour.Gray(34), }, - infoTextLeft = new LinkFlowContainer(t => t.TextSize = 14) + infoTextLeft = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(t.Font, size: 14)) { X = UserProfileOverlay.CONTENT_X_MARGIN, Y = cover_height + 20, @@ -175,11 +174,7 @@ namespace osu.Game.Overlays.Profile ParagraphSpacing = 0.8f, LineSpacing = 0.2f }, - infoTextRight = new LinkFlowContainer(t => - { - t.TextSize = 14; - t.Font = @"Exo2.0-RegularItalic"; - }) + infoTextRight = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 14, italics: true)) { X = UserProfileOverlay.CONTENT_X_MARGIN + info_width + 20, Y = cover_height + 20, @@ -222,7 +217,7 @@ namespace osu.Game.Overlays.Profile Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Y = 11, - TextSize = 20 + Font = OsuFont.GetFont(size: 20) } } }, @@ -354,19 +349,18 @@ namespace osu.Game.Overlays.Profile colourBar.Show(); } - void boldItalic(SpriteText t) => t.Font = @"Exo2.0-BoldItalic"; + void boldItalic(SpriteText t) => t.Font = OsuFont.GetFont(t.Font, weight: FontWeight.Bold, italics: true); void lightText(SpriteText t) => t.Alpha = 0.8f; OsuSpriteText createScoreText(string text) => new OsuSpriteText { - TextSize = 14, + Font = OsuFont.GetFont(size: 14), Text = text }; OsuSpriteText createScoreNumberText(string text) => new OsuSpriteText { - TextSize = 14, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold), Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Text = text diff --git a/osu.Game/Overlays/Profile/ProfileSection.cs b/osu.Game/Overlays/Profile/ProfileSection.cs index f5f628f07b..3d041b90b6 100644 --- a/osu.Game/Overlays/Profile/ProfileSection.cs +++ b/osu.Game/Overlays/Profile/ProfileSection.cs @@ -35,8 +35,7 @@ namespace osu.Game.Overlays.Profile new OsuSpriteText { Text = Title, - TextSize = 20, - Font = @"Exo2.0-RegularItalic", + Font = OsuFont.GetFont(size: 20, italics: true), Margin = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN, @@ -67,8 +66,7 @@ namespace osu.Game.Overlays.Profile Add(new OsuSpriteText { Text = @"coming soon!", - TextSize = 16, - Font = @"Exo2.0-Medium", + Font = OsuFont.GetFont(weight: FontWeight.Medium), Colour = Color4.Gray, Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs index 3b673ec004..c0f3acffbf 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs @@ -7,6 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Localisation; using osu.Game.Beatmaps; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; @@ -48,15 +49,13 @@ namespace osu.Game.Overlays.Profile.Sections { Text = new LocalisedString(($"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ", $"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")), - TextSize = 15, - Font = "Exo2.0-SemiBoldItalic", + Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold, italics: true) }, new OsuSpriteText { Text = new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)), - TextSize = 12, Padding = new MarginPadding { Top = 3 }, - Font = "Exo2.0-RegularItalic", + Font = OsuFont.GetFont(size: 12, italics: true) }, }, }; diff --git a/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs b/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs index 942723479a..5e94b28730 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs @@ -6,6 +6,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osuTK; @@ -47,7 +48,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical new OsuSpriteText { Text = @"mapped by ", - TextSize = 12, + Font = OsuFont.GetFont(size: 12) }, mapperContainer = new OsuHoverContainer { @@ -57,8 +58,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical new OsuSpriteText { Text = beatmap.Metadata.AuthorString, - TextSize = 12, - Font = @"Exo2.0-MediumItalic" + Font = OsuFont.GetFont(size: 12, weight: FontWeight.Medium, italics: true) } } }, @@ -78,16 +78,14 @@ namespace osu.Game.Overlays.Profile.Sections.Historical Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Text = playCount.ToString(), - TextSize = 18, - Font = @"Exo2.0-SemiBoldItalic" + Font = OsuFont.GetFont(size: 18, weight: FontWeight.SemiBold, italics: true) }, new OsuSpriteText { Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Text = @"times played ", - TextSize = 12, - Font = @"Exo2.0-RegularItalic" + Font = OsuFont.GetFont(size: 12, italics: true) }, } }); diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 33b74a6d93..a46584cf91 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -107,21 +107,19 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Text = header + ":", - TextSize = 20, - Font = @"Exo2.0-RegularItalic", + Font = OsuFont.GetFont(size: 20, italics: true) }, valueText = new OsuSpriteText { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Text = "0", - TextSize = 40, + Font = OsuFont.GetFont(size: 40, italics: true), UseFullGlyphHeight = false, - Font = @"Exo2.0-RegularItalic" } } }, - new OsuTextFlowContainer(t => { t.TextSize = 19; }) + new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(t.Font, size: 19)) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs index 6439475a7b..a85e32da22 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs @@ -6,6 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; @@ -43,9 +44,8 @@ namespace osu.Game.Overlays.Profile.Sections { new OsuSpriteText { - TextSize = 15, Text = header, - Font = "Exo2.0-RegularItalic", + Font = OsuFont.GetFont(size: 15, italics: true), Margin = new MarginPadding { Top = 10, Bottom = 10 }, }, ItemsContainer = new FillFlowContainer @@ -63,7 +63,7 @@ namespace osu.Game.Overlays.Profile.Sections Origin = Anchor.TopCentre, Child = new OsuSpriteText { - TextSize = 14, + Font = OsuFont.GetFont(size: 14), Text = "show more", Padding = new MarginPadding {Vertical = 10, Horizontal = 15 }, } @@ -76,7 +76,7 @@ namespace osu.Game.Overlays.Profile.Sections }, MissingText = new OsuSpriteText { - TextSize = 14, + Font = OsuFont.GetFont(size: 14), Text = missing, Alpha = 0, }, diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawablePerformanceScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawablePerformanceScore.cs index c612169cfb..81faeb87b2 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawablePerformanceScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawablePerformanceScore.cs @@ -28,8 +28,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks Text = $"{pp:0}pp", Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - TextSize = 18, - Font = "Exo2.0-BoldItalic", + Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true) }); if (weight.HasValue) @@ -40,8 +39,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Colour = colour.GrayA, - TextSize = 11, - Font = "Exo2.0-RegularItalic", + Font = OsuFont.GetFont(size: 11, italics: true) }); } } diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs index 147b8dffca..d24c6ae84a 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs @@ -46,8 +46,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Colour = colour.GrayA, - TextSize = 11, - Font = "Exo2.0-RegularItalic" + Font = OsuFont.GetFont(size: 11, italics: true) }; RightFlowContainer.Add(text); diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableTotalScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableTotalScore.cs index 094d6032fd..8bfca08fe7 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableTotalScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableTotalScore.cs @@ -3,6 +3,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Scoring; @@ -23,8 +24,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks Text = Score.TotalScore.ToString("#,###"), Anchor = Anchor.TopRight, Origin = Anchor.TopRight, - TextSize = 18, - Font = "Exo2.0-BoldItalic", + Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold, italics: true) }); } } diff --git a/osu.Game/Overlays/Profile/Sections/Recent/DrawableRecentActivity.cs b/osu.Game/Overlays/Profile/Sections/Recent/DrawableRecentActivity.cs index a91aa78b70..7e721ac807 100644 --- a/osu.Game/Overlays/Profile/Sections/Recent/DrawableRecentActivity.cs +++ b/osu.Game/Overlays/Profile/Sections/Recent/DrawableRecentActivity.cs @@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Profile.Sections.Recent RightFlowContainer.Add(new DrawableDate(activity.CreatedAt) { - TextSize = 13, + Font = OsuFont.GetFont(size: 13), Colour = OsuColour.Gray(0xAA), Anchor = Anchor.TopRight, Origin = Anchor.TopRight, diff --git a/osu.Game/Overlays/SearchableList/HeaderTabControl.cs b/osu.Game/Overlays/SearchableList/HeaderTabControl.cs index 6fff17ab26..f6334c2637 100644 --- a/osu.Game/Overlays/SearchableList/HeaderTabControl.cs +++ b/osu.Game/Overlays/SearchableList/HeaderTabControl.cs @@ -3,6 +3,7 @@ using osuTK.Graphics; using osu.Framework.Graphics.UserInterface; +using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.SearchableList @@ -21,7 +22,7 @@ namespace osu.Game.Overlays.SearchableList { public HeaderTabItem(T value) : base(value) { - Text.TextSize = 16; + Text.Font = OsuFont.GetFont(Text.Font, size: 16); } } } diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 4fad999577..0e658c4925 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -78,7 +78,7 @@ namespace osu.Game.Overlays.Settings.Sections.General { Text = "ACCOUNT", Margin = new MarginPadding { Bottom = 5 }, - Font = @"Exo2.0-Black", + Font = OsuFont.GetFont(weight: FontWeight.Black), }, form = new LoginForm { @@ -134,8 +134,7 @@ namespace osu.Game.Overlays.Settings.Sections.General Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = "Signed in", - TextSize = 18, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold), Margin = new MarginPadding { Top = 5, Bottom = 5 }, }, }, diff --git a/osu.Game/Overlays/Settings/SettingsFooter.cs b/osu.Game/Overlays/Settings/SettingsFooter.cs index 7c50e2f254..e8c2c1ffe8 100644 --- a/osu.Game/Overlays/Settings/SettingsFooter.cs +++ b/osu.Game/Overlays/Settings/SettingsFooter.cs @@ -56,14 +56,13 @@ namespace osu.Game.Overlays.Settings Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = game.Name, - TextSize = 18, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: 18, weight: FontWeight.Bold), }, new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - TextSize = 14, + Font = OsuFont.GetFont(size: 14), Text = game.Version, Colour = DebugUtils.IsDebug ? colours.Red : Color4.White, }, diff --git a/osu.Game/Overlays/Settings/SettingsHeader.cs b/osu.Game/Overlays/Settings/SettingsHeader.cs index fceeec5166..fbf29f7ff5 100644 --- a/osu.Game/Overlays/Settings/SettingsHeader.cs +++ b/osu.Game/Overlays/Settings/SettingsHeader.cs @@ -38,7 +38,7 @@ namespace osu.Game.Overlays.Settings new OsuSpriteText { Text = heading, - TextSize = 40, + Font = OsuFont.GetFont(size: 40), Margin = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, @@ -49,7 +49,7 @@ namespace osu.Game.Overlays.Settings { Colour = colours.Pink, Text = subheading, - TextSize = 18, + Font = OsuFont.GetFont(size: 18), Margin = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index 4af9961ea8..cf8544af17 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -77,7 +77,7 @@ namespace osu.Game.Overlays.Settings { new OsuSpriteText { - TextSize = header_size, + Font = OsuFont.GetFont(size: header_size), Text = Header, Colour = colours.Yellow, Margin = new MarginPadding { Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS } diff --git a/osu.Game/Overlays/Settings/SettingsSubsection.cs b/osu.Game/Overlays/Settings/SettingsSubsection.cs index 4d0b0de7f9..9a3eeac5d0 100644 --- a/osu.Game/Overlays/Settings/SettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/SettingsSubsection.cs @@ -8,6 +8,7 @@ using osu.Game.Graphics.Sprites; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; +using osu.Game.Graphics; namespace osu.Game.Overlays.Settings { @@ -53,7 +54,7 @@ namespace osu.Game.Overlays.Settings { Text = Header.ToUpperInvariant(), Margin = new MarginPadding { Bottom = 10, Left = SettingsOverlay.CONTENT_MARGINS, Right = SettingsOverlay.CONTENT_MARGINS }, - Font = @"Exo2.0-Black", + Font = OsuFont.GetFont(weight: FontWeight.Black), }, FlowContent }); diff --git a/osu.Game/Overlays/Social/Header.cs b/osu.Game/Overlays/Social/Header.cs index de738247ec..fb72051a41 100644 --- a/osu.Game/Overlays/Social/Header.cs +++ b/osu.Game/Overlays/Social/Header.cs @@ -32,13 +32,12 @@ namespace osu.Game.Overlays.Social new OsuSpriteText { Text = "social ", - TextSize = 25, + Font = OsuFont.GetFont(size: 25), }, browser = new OsuSpriteText { Text = "browser", - TextSize = 25, - Font = @"Exo2.0-Light", + Font = OsuFont.GetFont(size: 25, weight: FontWeight.Light), }, }, }; diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 563411d833..32ab80d50f 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -129,15 +129,13 @@ namespace osu.Game.Overlays.Toolbar Anchor = TooltipAnchor, Origin = TooltipAnchor, Shadow = true, - TextSize = 22, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: 22, weight: FontWeight.Bold), }, tooltip2 = new OsuSpriteText { Anchor = TooltipAnchor, Origin = TooltipAnchor, Shadow = true, - TextSize = 16 } } } diff --git a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs index 4b83e08292..0c9b8d5171 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs @@ -99,11 +99,10 @@ namespace osu.Game.Overlays.Toolbar Anchor = Anchor.Centre, Origin = Anchor.Centre, Y = -1, - TextSize = 14, + Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold), Padding = new MarginPadding(5), Colour = Color4.White, UseFullGlyphHeight = true, - Font = "Exo2.0-Bold", } }; } diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs index 28a1d60c40..b9cc0fd9ce 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; using osu.Game.Online.API; using osu.Game.Users; using osuTK; @@ -20,7 +21,7 @@ namespace osu.Game.Overlays.Toolbar { AutoSizeAxes = Axes.X; - DrawableText.Font = @"Exo2.0-MediumItalic"; + DrawableText.Font = OsuFont.GetFont(weight: FontWeight.Medium, italics: true); Add(new OpaqueBackground { Depth = 1 }); diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index b7d13156de..3693a35ca5 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -140,8 +140,7 @@ namespace osu.Game.Overlays.Volume { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = "Venera", - TextSize = 0.16f * circleSize + Font = OsuFont.GetFont(Typeface.Venera, 0.16f * circleSize) }).WithEffect(new GlowEffect { Colour = Color4.Transparent, @@ -169,7 +168,7 @@ namespace osu.Game.Overlays.Volume { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = "Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold), Text = name } } diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index ced24b3308..a53a0698a1 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -58,10 +58,9 @@ namespace osu.Game.Rulesets.Judgements Child = new SkinnableDrawable($"Play/{Result.Type}", _ => JudgementText = new OsuSpriteText { Text = Result.Type.GetDescription().ToUpperInvariant(), - Font = @"Venera", + Font = OsuFont.GetFont(Typeface.Venera, 12), Colour = judgementColour(Result.Type), Scale = new Vector2(0.85f, 1), - TextSize = 12 }, restrictSize: false) }; } diff --git a/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs index 527900acf2..753fb5c132 100644 --- a/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs +++ b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs @@ -110,7 +110,8 @@ namespace osu.Game.Screens.Edit.Components.Menus { public TextContainer() { - NormalText.TextSize = BoldText.TextSize = 14; + NormalText.Font = OsuFont.GetFont(NormalText.Font, size: 14); + BoldText.Font = OsuFont.GetFont(BoldText.Font, size: 14); NormalText.Margin = BoldText.Margin = new MarginPadding { Horizontal = 10, Vertical = MARGIN_VERTICAL }; } } diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index 5d611d3bca..f58cd0cba6 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -127,15 +127,14 @@ namespace osu.Game.Screens.Edit.Components Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Text = $"{value:0%}", - TextSize = 14, + Font = OsuFont.GetFont(size: 14) }, textBold = new OsuSpriteText { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Text = $"{value:0%}", - TextSize = 14, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold), Alpha = 0, }, }; diff --git a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs index 3b58a3a1f7..0391074b11 100644 --- a/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs +++ b/osu.Game/Screens/Edit/Components/TimeInfoContainer.cs @@ -6,6 +6,7 @@ using osu.Game.Graphics.Sprites; using System; using osu.Framework.Allocation; using osu.Framework.Timing; +using osu.Game.Graphics; namespace osu.Game.Screens.Edit.Components { @@ -23,8 +24,7 @@ namespace osu.Game.Screens.Edit.Components { Origin = Anchor.BottomLeft, RelativePositionAxes = Axes.Y, - TextSize = 22, - FixedWidth = true, + Font = OsuFont.GetFont(size: 22, fixedWidth: true), Y = 0.5f, } }; diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs index f1bd70d4dd..12c33d1f87 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs @@ -118,7 +118,7 @@ namespace osu.Game.Screens.Edit.Compose.Components }, new Drawable[] { - new TextFlowContainer(s => s.TextSize = 14) + new TextFlowContainer(s => s.Font = OsuFont.GetFont(s.Font, size: 14)) { Padding = new MarginPadding { Horizontal = 15 }, Text = "beat snap divisor", diff --git a/osu.Game/Screens/Edit/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Setup/Components/LabelledComponents/LabelledTextBox.cs index 3340daa6b8..04dfcbefeb 100644 --- a/osu.Game/Screens/Edit/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -38,8 +38,8 @@ namespace osu.Game.Screens.Edit.Setup.Components.LabelledComponents public float LabelTextSize { - get => label.TextSize; - set => label.TextSize = value; + get => label.Font.Size; + set => label.Font = OsuFont.GetFont(label.Font, size: value); } public string PlaceholderText @@ -103,8 +103,7 @@ namespace osu.Game.Screens.Edit.Setup.Components.LabelledComponents Origin = Anchor.TopLeft, Padding = new MarginPadding { Left = default_label_left_padding, Top = default_label_top_padding }, Colour = Color4.White, - TextSize = default_label_text_size, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(size: default_label_text_size, weight: FontWeight.Bold), }, textBox = new OsuTextBox { diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index f73d6ba560..fc285fb724 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -118,7 +118,6 @@ namespace osu.Game.Screens.Menu AllowMultiline = false, Anchor = Anchor.Centre, Origin = Anchor.Centre, - TextSize = 16, Position = new Vector2(0, 35), Text = text } diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index c0ff37cc0b..c887c18a46 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -64,25 +64,13 @@ namespace osu.Game.Screens.Menu } }; - textFlow.AddText("This is an ", t => - { - t.TextSize = 30; - t.Font = @"Exo2.0-Light"; - }); - textFlow.AddText("early development build", t => - { - t.TextSize = 30; - t.Font = @"Exo2.0-SemiBold"; - }); + textFlow.AddText("This is an ", t => t.Font = OsuFont.GetFont(t.Font, size: 30, weight: FontWeight.Light)); + textFlow.AddText("early development build", t => t.Font = OsuFont.GetFont(t.Font, size: 30, weight: FontWeight.SemiBold)); - textFlow.AddParagraph("Things may not work as expected", t => t.TextSize = 20); + textFlow.AddParagraph("Things may not work as expected", t => t.Font = OsuFont.GetFont(t.Font, size: 20)); textFlow.NewParagraph(); - Action format = t => - { - t.TextSize = 15; - t.Font = @"Exo2.0-SemiBold"; - }; + Action format = t => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold); textFlow.AddParagraph("Detailed bug reports are welcomed via github issues.", format); textFlow.NewParagraph(); @@ -102,7 +90,7 @@ namespace osu.Game.Screens.Menu supporterDrawables.Add(heart = textFlow.AddIcon(FontAwesome.fa_heart, t => { t.Padding = new MarginPadding { Left = 5 }; - t.TextSize = 12; + t.Font = OsuFont.GetFont(t.Font, size: 12); t.Colour = colours.Pink; t.Origin = Anchor.Centre; }).First()); diff --git a/osu.Game/Screens/Menu/IntroSequence.cs b/osu.Game/Screens/Menu/IntroSequence.cs index 03a5b7ff46..98640ef38c 100644 --- a/osu.Game/Screens/Menu/IntroSequence.cs +++ b/osu.Game/Screens/Menu/IntroSequence.cs @@ -102,9 +102,8 @@ namespace osu.Game.Screens.Menu Origin = Anchor.Centre, Text = "welcome", Padding = new MarginPadding { Bottom = 10 }, - Font = @"Exo2.0-Light", + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 42), Alpha = 0, - TextSize = 42, Spacing = new Vector2(5), }, new CircularContainer diff --git a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs index dca0545035..774c2577aa 100644 --- a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs +++ b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Multi.Components CurrentBeatmap.BindValueChanged(v => updateText(), true); } - private float textSize = OsuSpriteText.FONT_SIZE; + private float textSize = OsuFont.DEFAULT_FONT_SIZE; public float TextSize { @@ -56,7 +56,7 @@ namespace osu.Game.Screens.Multi.Components if (CurrentBeatmap.Value == null) textFlow.AddText("No beatmap selected", s => { - s.TextSize = TextSize; + s.Font = OsuFont.GetFont(s.Font, size: TextSize); s.Colour = colours.PinkLight; }); else @@ -66,17 +66,17 @@ namespace osu.Game.Screens.Multi.Components new OsuSpriteText { Text = new LocalisedString((CurrentBeatmap.Value.Metadata.ArtistUnicode, CurrentBeatmap.Value.Metadata.Artist)), - TextSize = TextSize, + Font = OsuFont.GetFont(size: TextSize), }, new OsuSpriteText { Text = " - ", - TextSize = TextSize, + Font = OsuFont.GetFont(size: TextSize), }, new OsuSpriteText { Text = new LocalisedString((CurrentBeatmap.Value.Metadata.TitleUnicode, CurrentBeatmap.Value.Metadata.Title)), - TextSize = TextSize, + Font = OsuFont.GetFont(size: TextSize), } }, null, LinkAction.OpenBeatmap, CurrentBeatmap.Value.OnlineBeatmapID.ToString(), "Open beatmap"); } diff --git a/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs b/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs index 3904df2069..28fd324fd0 100644 --- a/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs +++ b/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs @@ -40,7 +40,7 @@ namespace osu.Game.Screens.Multi.Components Children = new Drawable[] { new BeatmapTitle(), - beatmapAuthor = new LinkFlowContainer(s => s.TextSize = 14) + beatmapAuthor = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(s.Font, size: 14)) { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, diff --git a/osu.Game/Screens/Multi/Components/ParticipantCount.cs b/osu.Game/Screens/Multi/Components/ParticipantCount.cs index 27bfc9a3f7..aa414ce4e6 100644 --- a/osu.Game/Screens/Multi/Components/ParticipantCount.cs +++ b/osu.Game/Screens/Multi/Components/ParticipantCount.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.Multi.Components @@ -34,19 +35,16 @@ namespace osu.Game.Screens.Multi.Components { count = new OsuSpriteText { - TextSize = text_size, - Font = @"Exo2.0-Bold" + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: text_size) }, slash = new OsuSpriteText { Text = @"/", - TextSize = text_size, - Font = @"Exo2.0-Light" + Font = OsuFont.GetFont(weight: FontWeight.Light, size: text_size) }, maxText = new OsuSpriteText { - TextSize = text_size, - Font = @"Exo2.0-Light" + Font = OsuFont.GetFont(weight: FontWeight.Light, size: text_size) }, } }; diff --git a/osu.Game/Screens/Multi/Components/RoomStatusInfo.cs b/osu.Game/Screens/Multi/Components/RoomStatusInfo.cs index 24a2d70b60..3c7736603a 100644 --- a/osu.Game/Screens/Multi/Components/RoomStatusInfo.cs +++ b/osu.Game/Screens/Multi/Components/RoomStatusInfo.cs @@ -34,10 +34,9 @@ namespace osu.Game.Screens.Multi.Components { statusPart = new StatusPart { - TextSize = 14, - Font = "Exo2.0-Bold" + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14) }, - endDatePart = new EndDatePart { TextSize = 14 } + endDatePart = new EndDatePart { Font = OsuFont.GetFont(size: 14) } } }; diff --git a/osu.Game/Screens/Multi/Header.cs b/osu.Game/Screens/Multi/Header.cs index 687a28b7a6..c6c8b63d99 100644 --- a/osu.Game/Screens/Multi/Header.cs +++ b/osu.Game/Screens/Multi/Header.cs @@ -64,12 +64,11 @@ namespace osu.Game.Screens.Multi new OsuSpriteText { Text = "multiplayer ", - TextSize = 25, + Font = OsuFont.GetFont(size: 25) }, screenType = new OsuSpriteText { - TextSize = 25, - Font = @"Exo2.0-Light", + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 25) }, }, }, diff --git a/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs index afe2b70524..c8a2db6706 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs @@ -155,7 +155,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components Spacing = new Vector2(5f), Children = new Drawable[] { - new RoomName { TextSize = 18 }, + new RoomName { Font = OsuFont.GetFont(size: 18) }, new ParticipantInfo(), }, }, diff --git a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs index 806bc92882..b327caa06b 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs @@ -81,7 +81,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components summary = new OsuSpriteText { Text = "0 participants", - TextSize = 14, + Font = OsuFont.GetFont(size: 14) } }, }, @@ -95,7 +95,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components if (v != null) { hostText.AddText("hosted by "); - hostText.AddLink(v.Username, null, LinkAction.OpenUserProfile, v.Id.ToString(), "Open profile", s => s.Font = "Exo2.0-BoldItalic"); + hostText.AddLink(v.Username, null, LinkAction.OpenUserProfile, v.Id.ToString(), "Open profile", + s => s.Font = OsuFont.GetFont(Typeface.Exo, weight: FontWeight.Medium, italics: true)); flagContainer.Child = new DrawableFlag(v.Country) { RelativeSizeAxes = Axes.Both }; } }, true); diff --git a/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs b/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs index 3e665ab27e..1121237202 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs @@ -96,7 +96,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, - TextSize = 30, + Font = OsuFont.GetFont(size: 30), Current = Name }, }, @@ -135,8 +135,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components AutoSizeAxes = Axes.Both, Child = new StatusText { - TextSize = 14, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14), } }, beatmapTypeInfo = new BeatmapTypeInfo(), diff --git a/osu.Game/Screens/Multi/Match/Components/HeaderButton.cs b/osu.Game/Screens/Multi/Match/Components/HeaderButton.cs index 8c9f99c446..f3412d0be7 100644 --- a/osu.Game/Screens/Multi/Match/Components/HeaderButton.cs +++ b/osu.Game/Screens/Multi/Match/Components/HeaderButton.cs @@ -41,8 +41,7 @@ namespace osu.Game.Screens.Multi.Match.Components Depth = -1, Origin = Anchor.Centre, Anchor = Anchor.Centre, - Font = @"Exo2.0-Light", - TextSize = 30, + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 30), }; } } diff --git a/osu.Game/Screens/Multi/Match/Components/HostInfo.cs b/osu.Game/Screens/Multi/Match/Components/HostInfo.cs index 942e03b306..6896e3edac 100644 --- a/osu.Game/Screens/Multi/Match/Components/HostInfo.cs +++ b/osu.Game/Screens/Multi/Match/Components/HostInfo.cs @@ -4,6 +4,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Online.Chat; using osu.Game.Users; @@ -53,7 +54,8 @@ namespace osu.Game.Screens.Multi.Match.Components { linkContainer.AddText("hosted by"); linkContainer.NewLine(); - linkContainer.AddLink(host.Username, null, LinkAction.OpenUserProfile, host.Id.ToString(), "View Profile", s => s.Font = "Exo2.0-BoldItalic"); + linkContainer.AddLink(host.Username, null, LinkAction.OpenUserProfile, host.Id.ToString(), "View Profile", + s => s.Font = OsuFont.GetFont(Typeface.Exo, weight: FontWeight.Bold, italics: true)); } } } diff --git a/osu.Game/Screens/Multi/Match/Components/Info.cs b/osu.Game/Screens/Multi/Match/Components/Info.cs index ec6dbb6d12..8f8f8ece12 100644 --- a/osu.Game/Screens/Multi/Match/Components/Info.cs +++ b/osu.Game/Screens/Multi/Match/Components/Info.cs @@ -62,7 +62,7 @@ namespace osu.Game.Screens.Multi.Match.Components { new OsuSpriteText { - TextSize = 30, + Font = OsuFont.GetFont(size: 30), Current = Name }, new RoomStatusInfo(), diff --git a/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs b/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs index c3169ebe94..a36b6274a3 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs @@ -148,7 +148,7 @@ namespace osu.Game.Screens.Multi.Match.Components }, typeLabel = new OsuSpriteText { - TextSize = 14, + Font = OsuFont.GetFont(size: 14), Colour = colours.Yellow }, }, @@ -364,8 +364,7 @@ namespace osu.Game.Screens.Multi.Match.Components { new OsuSpriteText { - TextSize = 12, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 12), Text = title.ToUpper(), }, content = new Container diff --git a/osu.Game/Screens/Multi/Match/Components/RoomAvailabilityPicker.cs b/osu.Game/Screens/Multi/Match/Components/RoomAvailabilityPicker.cs index 4e6ebf2135..e9dbd6982d 100644 --- a/osu.Game/Screens/Multi/Match/Components/RoomAvailabilityPicker.cs +++ b/osu.Game/Screens/Multi/Match/Components/RoomAvailabilityPicker.cs @@ -68,7 +68,7 @@ namespace osu.Game.Screens.Multi.Match.Components { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold), Text = value.GetDescription(), }, }; diff --git a/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs b/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs index 1b4c99d972..423b897813 100644 --- a/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs +++ b/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs @@ -80,7 +80,7 @@ namespace osu.Game.Screens.Multi.Ranking.Pages Action gray = s => s.Colour = colours.GrayC; Action white = s => { - s.TextSize *= 1.4f; + s.Font = OsuFont.GetFont(s.Font, size: s.Font.Size * 1.4f); s.Colour = colours.GrayF; }; @@ -91,7 +91,7 @@ namespace osu.Game.Screens.Multi.Ranking.Pages rankText.AddText($"#{index + 1} ", s => { - s.Font = "Exo2.0-Bold"; + s.Font = OsuFont.GetFont(s.Font, Typeface.Exo, weight: FontWeight.Bold); s.Colour = colours.YellowDark; }); diff --git a/osu.Game/Screens/Play/Break/BreakInfo.cs b/osu.Game/Screens/Play/Break/BreakInfo.cs index 39a5594450..a3d64d05a3 100644 --- a/osu.Game/Screens/Play/Break/BreakInfo.cs +++ b/osu.Game/Screens/Play/Break/BreakInfo.cs @@ -3,6 +3,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Scoring; using osuTK; @@ -29,8 +30,7 @@ namespace osu.Game.Screens.Play.Break Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = "current progress".ToUpperInvariant(), - TextSize = 15, - Font = "Exo2.0-Black", + Font = OsuFont.GetFont(weight: FontWeight.Black, size: 15), }, new FillFlowContainer { diff --git a/osu.Game/Screens/Play/Break/BreakInfoLine.cs b/osu.Game/Screens/Play/Break/BreakInfoLine.cs index d2b8b8c26a..3b4700cd66 100644 --- a/osu.Game/Screens/Play/Break/BreakInfoLine.cs +++ b/osu.Game/Screens/Play/Break/BreakInfoLine.cs @@ -34,7 +34,7 @@ namespace osu.Game.Screens.Play.Break Anchor = Anchor.Centre, Origin = Anchor.CentreRight, Text = name, - TextSize = 17, + Font = OsuFont.GetFont(size: 17), Margin = new MarginPadding { Right = margin } }, valueText = new OsuSpriteText @@ -42,8 +42,7 @@ namespace osu.Game.Screens.Play.Break Anchor = Anchor.Centre, Origin = Anchor.CentreLeft, Text = prefix + @"-", - TextSize = 17, - Font = "Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17), Margin = new MarginPadding { Left = margin } } }; diff --git a/osu.Game/Screens/Play/Break/RemainingTimeCounter.cs b/osu.Game/Screens/Play/Break/RemainingTimeCounter.cs index c85ce1b70b..6fa3e51be8 100644 --- a/osu.Game/Screens/Play/Break/RemainingTimeCounter.cs +++ b/osu.Game/Screens/Play/Break/RemainingTimeCounter.cs @@ -4,6 +4,7 @@ using System; using osu.Framework.Graphics; using osu.Framework.Graphics.UserInterface; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.Play.Break @@ -19,8 +20,7 @@ namespace osu.Game.Screens.Play.Break { Anchor = Anchor.Centre, Origin = Anchor.Centre, - TextSize = 33, - Font = "Venera", + Font = OsuFont.GetFont(Typeface.Venera, 33), }; } diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index dc0636c44f..c294a2d71f 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -88,11 +88,10 @@ namespace osu.Game.Screens.Play new OsuSpriteText { Text = Header, - Font = @"Exo2.0-Medium", + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 30), Spacing = new Vector2(5, 0), Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, - TextSize = 30, Colour = colours.Yellow, Shadow = true, ShadowColour = new Color4(0, 0, 0, 0.25f) @@ -260,22 +259,21 @@ namespace osu.Game.Screens.Play Text = "You've retried ", Shadow = true, ShadowColour = new Color4(0, 0, 0, 0.25f), - TextSize = 18 + Font = OsuFont.GetFont(size: 18), }, new OsuSpriteText { Text = $"{retries:n0}", - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 18), Shadow = true, ShadowColour = new Color4(0, 0, 0, 0.25f), - TextSize = 18 }, new OsuSpriteText { Text = $" time{(retries == 1 ? "" : "s")} in this session", Shadow = true, ShadowColour = new Color4(0, 0, 0, 0.25f), - TextSize = 18 + Font = OsuFont.GetFont(size: 18), } }; } diff --git a/osu.Game/Screens/Play/HUD/ComboCounter.cs b/osu.Game/Screens/Play/HUD/ComboCounter.cs index b45b1bb8a5..0b27d8e69e 100644 --- a/osu.Game/Screens/Play/HUD/ComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboCounter.cs @@ -5,6 +5,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.Play.HUD @@ -99,8 +100,9 @@ namespace osu.Game.Screens.Play.HUD set { textSize = value; - DisplayedCountSpriteText.TextSize = TextSize; - PopOutCount.TextSize = TextSize; + + DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, size: TextSize); + PopOutCount.Font = OsuFont.GetFont(PopOutCount.Font, size: TextSize); } } diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs index a0bcc3460b..8d0cabd683 100644 --- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs +++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs @@ -42,7 +42,7 @@ namespace osu.Game.Screens.Play.HUD text = new OsuSpriteText { Text = "hold for menu", - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold), Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft }, diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index d329902a2d..498a750b23 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -14,6 +14,7 @@ using osu.Game.Rulesets.UI; using osuTK; using osu.Game.Graphics.Containers; using osu.Framework.Input.Events; +using osu.Game.Graphics; namespace osu.Game.Screens.Play.HUD { @@ -60,8 +61,7 @@ namespace osu.Game.Screens.Play.HUD Anchor = Anchor.BottomCentre, Origin = Anchor.TopCentre, Text = @"/ UNRANKED /", - Font = @"Venera", - TextSize = 12, + Font = OsuFont.GetFont(Typeface.Venera, 12), } }; diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 9d8fb2a501..b795e03c81 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osuTK; using osuTK.Graphics; @@ -96,8 +97,7 @@ namespace osu.Game.Screens.Play new OsuSpriteText { Text = Name, - Font = @"Venera", - TextSize = 12, + Font = OsuFont.GetFont(Typeface.Venera, 12), Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativePositionAxes = Axes.Both, diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 58e59604dd..736477ada7 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -328,16 +328,14 @@ namespace osu.Game.Screens.Play new OsuSpriteText { Text = new LocalisedString((metadata.TitleUnicode, metadata.Title)), - TextSize = 36, - Font = @"Exo2.0-MediumItalic", + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 36, italics: true), Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, }, new OsuSpriteText { Text = new LocalisedString((metadata.ArtistUnicode, metadata.Artist)), - TextSize = 26, - Font = @"Exo2.0-MediumItalic", + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 26, italics: true), Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, }, @@ -365,8 +363,7 @@ namespace osu.Game.Screens.Play new OsuSpriteText { Text = beatmap?.BeatmapInfo?.Version, - TextSize = 26, - Font = @"Exo2.0-MediumItalic", + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 26, italics: true), Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Margin = new MarginPadding diff --git a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs index f752243c52..8bda5062b4 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs @@ -5,6 +5,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Timing; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.Play.PlayerSettings @@ -42,7 +43,7 @@ namespace osu.Game.Screens.Play.PlayerSettings { Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold), } }, }, diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index 7bf3a74f7e..49bcf0b8dc 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -94,8 +94,7 @@ namespace osu.Game.Screens.Play.PlayerSettings Origin = Anchor.CentreLeft, Anchor = Anchor.CentreLeft, Text = Title.ToUpperInvariant(), - TextSize = 17, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17), Margin = new MarginPadding { Left = 10 }, }, button = new IconButton diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index d3db126ae4..f765564560 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -273,8 +273,7 @@ namespace osu.Game.Screens.Play Anchor = Anchor.TopCentre, RelativePositionAxes = Axes.Y, Y = 0.7f, - TextSize = 12, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 12), Origin = Anchor.Centre, Text = @"SKIP", }, diff --git a/osu.Game/Screens/Play/SongProgressInfo.cs b/osu.Game/Screens/Play/SongProgressInfo.cs index 7471eccff9..4d61d9da73 100644 --- a/osu.Game/Screens/Play/SongProgressInfo.cs +++ b/osu.Game/Screens/Play/SongProgressInfo.cs @@ -42,7 +42,7 @@ namespace osu.Game.Screens.Play Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, Colour = colours.BlueLighter, - Font = @"Venera", + Font = OsuFont.GetFont(Typeface.Venera), Margin = new MarginPadding { Left = margin, @@ -53,14 +53,14 @@ namespace osu.Game.Screens.Play Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, Colour = colours.BlueLighter, - Font = @"Venera", + Font = OsuFont.GetFont(Typeface.Venera), }, timeLeft = new OsuSpriteText { Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, Colour = colours.BlueLighter, - Font = @"Venera", + Font = OsuFont.GetFont(Typeface.Venera), Margin = new MarginPadding { Right = margin, diff --git a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs index 43c04997e9..199083ecf6 100644 --- a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs +++ b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs @@ -111,8 +111,7 @@ namespace osu.Game.Screens.Ranking.Pages Origin = Anchor.TopCentre, Colour = colours.PinkDarker, Shadow = false, - Font = @"Exo2.0-Bold", - TextSize = 16, + Font = OsuFont.GetFont(weight: FontWeight.Bold), Text = "total score", Margin = new MarginPadding { Bottom = 15 }, }, @@ -217,14 +216,14 @@ namespace osu.Game.Screens.Ranking.Pages new OsuSpriteText { Text = statistic.Value.ToString().PadLeft(4, '0'), Colour = colours.Gray7, - TextSize = 30, + Font = OsuFont.GetFont(size: 30), Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, new OsuSpriteText { Text = statistic.Key.GetDescription(), Colour = colours.Gray7, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold), Y = 26, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, @@ -307,24 +306,21 @@ namespace osu.Game.Screens.Ranking.Pages Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Shadow = false, - TextSize = 24, - Font = @"Exo2.0-BoldItalic", + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 24, italics: true), }, artist = new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Shadow = false, - TextSize = 20, - Font = @"Exo2.0-BoldItalic", + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 20, italics: true), }, versionMapper = new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Shadow = false, - TextSize = 16, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold), }, } } @@ -369,11 +365,10 @@ namespace osu.Game.Screens.Ranking.Pages }, new OsuSpriteText { - Font = @"Exo2.0-RegularItalic", - Text = user.Username, Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - TextSize = 30, + Text = user.Username, + Font = OsuFont.GetFont(size: 30, italics: true), Padding = new MarginPadding { Bottom = 10 }, } }; @@ -396,7 +391,7 @@ namespace osu.Game.Screens.Ranking.Pages public SlowScoreCounter(uint leading = 0) : base(leading) { DisplayedCountSpriteText.Shadow = false; - DisplayedCountSpriteText.Font = @"Venera-Light"; + DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, Typeface.Venera, weight: FontWeight.Light); UseCommaSeparator = true; } } diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 31863cea9b..427a8f1c42 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -190,45 +190,43 @@ namespace osu.Game.Screens.Ranking }, new OsuSpriteText { + Anchor = Anchor.CentreLeft, + Origin = Anchor.BottomCentre, Text = $"{Score.MaxCombo}x", - TextSize = 40, RelativePositionAxes = Axes.X, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 40), X = 0.1f, Colour = colours.BlueDarker, - Anchor = Anchor.CentreLeft, - Origin = Anchor.BottomCentre, }, new OsuSpriteText { + Anchor = Anchor.CentreLeft, + Origin = Anchor.TopCentre, Text = "max combo", - TextSize = 20, + Font = OsuFont.GetFont(size: 20), RelativePositionAxes = Axes.X, X = 0.1f, Colour = colours.Gray6, - Anchor = Anchor.CentreLeft, - Origin = Anchor.TopCentre, }, new OsuSpriteText { - Text = $"{Score.Accuracy:P2}", - TextSize = 40, - RelativePositionAxes = Axes.X, - Font = @"Exo2.0-Bold", - X = 0.9f, - Colour = colours.BlueDarker, Anchor = Anchor.CentreLeft, Origin = Anchor.BottomCentre, + Text = $"{Score.Accuracy:P2}", + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 40), + RelativePositionAxes = Axes.X, + X = 0.9f, + Colour = colours.BlueDarker, }, new OsuSpriteText { + Anchor = Anchor.CentreLeft, + Origin = Anchor.TopCentre, Text = "accuracy", - TextSize = 20, + Font = OsuFont.GetFont(size: 20), RelativePositionAxes = Axes.X, X = 0.9f, Colour = colours.Gray6, - Anchor = Anchor.CentreLeft, - Origin = Anchor.TopCentre, }, } }, diff --git a/osu.Game/Screens/ScreenWhiteBox.cs b/osu.Game/Screens/ScreenWhiteBox.cs index d250416b29..c8ca21d4ba 100644 --- a/osu.Game/Screens/ScreenWhiteBox.cs +++ b/osu.Game/Screens/ScreenWhiteBox.cs @@ -119,25 +119,25 @@ namespace osu.Game.Screens }, new OsuSpriteText { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, Text = GetType().Name, Colour = getColourFor(GetType()).Lighten(0.8f), - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, - TextSize = 50, + Font = OsuFont.GetFont(size: 50), }, new OsuSpriteText { + Anchor = Anchor.TopCentre, + Origin = Anchor.TopCentre, Text = "is not yet ready for use!", - TextSize = 20, - Anchor = Anchor.TopCentre, - Origin = Anchor.TopCentre, + Font = OsuFont.GetFont(size: 20), }, new OsuSpriteText { - Text = "please check back a bit later.", - TextSize = 14, Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, + Text = "please check back a bit later.", + Font = OsuFont.GetFont(size: 14), }, } }, diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 8877775bba..a0baf64a37 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -16,6 +16,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Screens.Select.Details; using osu.Game.Beatmaps; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; namespace osu.Game.Screens.Select @@ -137,8 +138,7 @@ namespace osu.Game.Screens.Select new OsuSpriteText { Text = "Points of Failure", - Font = @"Exo2.0-Bold", - TextSize = 14, + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14), }, failRetryGraph = new FailRetryGraph { @@ -323,8 +323,7 @@ namespace osu.Game.Screens.Select Child = new OsuSpriteText { Text = title, - Font = @"Exo2.0-Bold", - TextSize = 14, + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 14), }, }, }, @@ -347,7 +346,7 @@ namespace osu.Game.Screens.Select private void setTextAsync(string text) { - LoadComponentAsync(new OsuTextFlowContainer(s => s.TextSize = 14) + LoadComponentAsync(new OsuTextFlowContainer(s => s.Font = OsuFont.GetFont(s.Font, size: 14)) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 2a3fc03cc5..1385b4102e 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -203,9 +203,8 @@ namespace osu.Game.Screens.Select { VersionLabel = new OsuSpriteText { - Font = @"Exo2.0-MediumItalic", Text = beatmapInfo.Version, - TextSize = 24, + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 24, italics: true), }, } }, @@ -240,13 +239,11 @@ namespace osu.Game.Screens.Select { TitleLabel = new OsuSpriteText { - Font = @"Exo2.0-MediumItalic", - TextSize = 28, + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 28, italics: true), }, ArtistLabel = new OsuSpriteText { - Font = @"Exo2.0-MediumItalic", - TextSize = 17, + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 17, italics: true), }, MapperContainer = new FillFlowContainer { @@ -345,16 +342,13 @@ namespace osu.Game.Screens.Select { new OsuSpriteText { - Font = @"Exo2.0-Medium", Text = "mapped by ", - TextSize = 15, + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 15), }, new OsuSpriteText { - Font = @"Exo2.0-Bold", - // ReSharper disable once PossibleNullReferenceException (resharper broken?) Text = metadata.Author.Username, - TextSize = 15, + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 15), } }; } @@ -402,10 +396,9 @@ namespace osu.Game.Screens.Select Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Colour = new Color4(255, 221, 85, 255), - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 17), Margin = new MarginPadding { Left = 30 }, Text = statistic.Content, - TextSize = 17, } }; } diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 5d28bed4a6..386dd9edd6 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -100,25 +100,22 @@ namespace osu.Game.Screens.Select.Carousel { new OsuSpriteText { - Font = @"Exo2.0-Medium", Text = beatmap.Version, - TextSize = 20, + Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 20), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft }, new OsuSpriteText { - Font = @"Exo2.0-Medium", Text = "mapped by", - TextSize = 16, + Font = OsuFont.GetFont(weight: FontWeight.Medium), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft }, new OsuSpriteText { - Font = @"Exo2.0-MediumItalic", Text = $"{(beatmap.Metadata ?? beatmap.BeatmapSet.Metadata).Author.Username}", - TextSize = 16, + Font = OsuFont.GetFont(weight: FontWeight.Medium, italics: true), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft }, diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index e5d12151d8..009545afd9 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -15,6 +15,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Localisation; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; +using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; @@ -63,16 +64,14 @@ namespace osu.Game.Screens.Select.Carousel { new OsuSpriteText { - Font = @"Exo2.0-BoldItalic", Text = new LocalisedString((beatmapSet.Metadata.TitleUnicode, beatmapSet.Metadata.Title)), - TextSize = 22, + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 22, italics: true), Shadow = true, }, new OsuSpriteText { - Font = @"Exo2.0-SemiBoldItalic", Text = new LocalisedString((beatmapSet.Metadata.ArtistUnicode, beatmapSet.Metadata.Artist)), - TextSize = 17, + Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 17, italics: true), Shadow = true, }, new FillFlowContainer diff --git a/osu.Game/Screens/Select/Details/AdvancedStats.cs b/osu.Game/Screens/Select/Details/AdvancedStats.cs index c856f4c85a..2d897148c1 100644 --- a/osu.Game/Screens/Select/Details/AdvancedStats.cs +++ b/osu.Game/Screens/Select/Details/AdvancedStats.cs @@ -120,7 +120,7 @@ namespace osu.Game.Screens.Select.Details AutoSizeAxes = Axes.Y, Child = name = new OsuSpriteText { - TextSize = 13, + Font = OsuFont.GetFont(size: 13) }, }, bar = new Bar @@ -142,7 +142,7 @@ namespace osu.Game.Screens.Select.Details { Anchor = Anchor.Centre, Origin = Anchor.Centre, - TextSize = 13, + Font = OsuFont.GetFont(size: 13) }, }, }; diff --git a/osu.Game/Screens/Select/Details/UserRatings.cs b/osu.Game/Screens/Select/Details/UserRatings.cs index 70ce6c0e87..db796ba5d2 100644 --- a/osu.Game/Screens/Select/Details/UserRatings.cs +++ b/osu.Game/Screens/Select/Details/UserRatings.cs @@ -70,7 +70,7 @@ namespace osu.Game.Screens.Select.Details Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = "User Rating", - TextSize = 13, + Font = OsuFont.GetFont(size: 13) }, ratingsBar = new Bar { @@ -87,14 +87,14 @@ namespace osu.Game.Screens.Select.Details negativeRatings = new OsuSpriteText { Text = "0", - TextSize = 13, + Font = OsuFont.GetFont(size: 13) }, positiveRatings = new OsuSpriteText { Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Text = @"0", - TextSize = 13, + Font = OsuFont.GetFont(size: 13) }, }, }, @@ -103,7 +103,7 @@ namespace osu.Game.Screens.Select.Details Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = "Rating Spread", - TextSize = 13, + Font = OsuFont.GetFont(size: 13), Margin = new MarginPadding { Top = 10, Bottom = 5 }, }, }, diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index cb1f9234d8..6960739987 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -150,14 +150,14 @@ namespace osu.Game.Screens.Select.Options { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold), Text = @"", }, secondLine = new OsuSpriteText { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold), Text = @"", }, }, diff --git a/osu.Game/Screens/Tournament/Drawings.cs b/osu.Game/Screens/Tournament/Drawings.cs index 43b194d8d0..f8445a4a7d 100644 --- a/osu.Game/Screens/Tournament/Drawings.cs +++ b/osu.Game/Screens/Tournament/Drawings.cs @@ -23,6 +23,7 @@ using osuTK.Graphics; using osu.Framework.IO.Stores; using osu.Framework.Graphics.Shapes; using osu.Framework.Screens; +using osu.Game.Graphics; namespace osu.Game.Screens.Tournament { @@ -151,8 +152,7 @@ namespace osu.Game.Screens.Tournament Alpha = 0, - Font = "Exo2.0-Light", - TextSize = 42f + Font = OsuFont.GetFont(weight: FontWeight.Light, size: 42), } } }, @@ -175,8 +175,7 @@ namespace osu.Game.Screens.Tournament Origin = Anchor.TopCentre, Text = "Control Panel", - TextSize = 22f, - Font = "Exo2.0-Bold" + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 22), }, new FillFlowContainer { diff --git a/osu.Game/Screens/Tournament/Group.cs b/osu.Game/Screens/Tournament/Group.cs index c9d477dbcd..4fed10b94d 100644 --- a/osu.Game/Screens/Tournament/Group.cs +++ b/osu.Game/Screens/Tournament/Group.cs @@ -14,6 +14,7 @@ using osuTK; using osuTK.Graphics; using osu.Game.Screens.Tournament.Teams; using osu.Framework.Graphics.Shapes; +using osu.Game.Graphics; namespace osu.Game.Screens.Tournament { @@ -52,8 +53,7 @@ namespace osu.Game.Screens.Tournament Position = new Vector2(0, 7f), Text = $"GROUP {name.ToUpperInvariant()}", - TextSize = 8f, - Font = @"Exo2.0-Bold", + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 8), Colour = new Color4(255, 204, 34, 255), }, teams = new FillFlowContainer @@ -162,8 +162,7 @@ namespace osu.Game.Screens.Tournament Origin = Anchor.TopCentre, Text = team.Acronym.ToUpperInvariant(), - TextSize = 10f, - Font = @"Exo2.0-Bold" + Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 10), } } } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index b1bf0c15a5..5a48451fd5 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -116,8 +116,7 @@ namespace osu.Game.Users new OsuSpriteText { Text = user.Username, - TextSize = 18, - Font = @"Exo2.0-SemiBoldItalic", + Font = OsuFont.GetFont(weight: FontWeight.SemiBold, size: 18, italics: true), }, infoContainer = new FillFlowContainer { @@ -173,7 +172,7 @@ namespace osu.Game.Users { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Font = @"Exo2.0-Semibold", + Font = OsuFont.GetFont(weight: FontWeight.SemiBold), }, }, }, From c01b18f02fb617f3e31004775500080d9243d9c1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 20 Feb 2019 15:18:51 +0900 Subject: [PATCH 115/327] Adjust expected testcase value --- osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs index fc2a153f49..b99dd08ef0 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Catch.Tests { protected override string ResourceAssembly => "osu.Game.Rulesets.Catch"; - [TestCase(3.8701758020428221d, "diffcalc-test")] + [TestCase(4.2038001515546597d, "diffcalc-test")] public void Test(double expected, string name) => base.Test(expected, name); From b1337ed07fc2317ee8c1266e9fe394eb882a0f1e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Feb 2019 16:09:29 +0900 Subject: [PATCH 116/327] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 6b94fa4f98..6d55071070 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -16,7 +16,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index d677ef4e21..19c16541a2 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From dbfa95b9e70fbdeb05c4798e9c09aa5c4ba1b9a6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 20 Feb 2019 16:52:36 +0900 Subject: [PATCH 117/327] Made medium the default font weight --- osu.Game/Graphics/Cursor/OsuTooltipContainer.cs | 3 ++- osu.Game/Graphics/DrawableDate.cs | 2 +- osu.Game/Graphics/OsuFont.cs | 2 +- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 2 +- osu.Game/Graphics/UserInterface/OsuTextBox.cs | 2 +- osu.Game/Graphics/UserInterface/PageTabControl.cs | 2 +- osu.Game/Online/Leaderboards/LeaderboardScore.cs | 2 +- osu.Game/Overlays/BeatmapSet/AuthorInfo.cs | 2 +- osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs | 6 +++--- osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs | 2 +- osu.Game/Overlays/Chat/ChatLine.cs | 2 +- osu.Game/Overlays/Music/PlaylistItem.cs | 2 +- osu.Game/Overlays/MusicController.cs | 2 +- osu.Game/Overlays/Profile/Header/BadgeContainer.cs | 2 +- osu.Game/Overlays/Profile/Header/RankGraph.cs | 8 ++++---- osu.Game/Overlays/Profile/ProfileHeader.cs | 4 ++-- osu.Game/Overlays/Profile/ProfileSection.cs | 3 +-- .../Overlays/Profile/Sections/BeatmapMetadataContainer.cs | 2 +- .../Profile/Sections/Historical/DrawableMostPlayedRow.cs | 2 +- osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs | 4 ++-- osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs | 2 +- .../Profile/Sections/Ranks/DrawablePerformanceScore.cs | 2 +- .../Profile/Sections/Ranks/DrawableProfileScore.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarUserButton.cs | 2 +- .../Screens/Multi/Lounge/Components/ParticipantInfo.cs | 2 +- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 6 +++--- osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs | 2 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 8 ++++---- .../Screens/Select/Carousel/DrawableCarouselBeatmap.cs | 5 ++--- 30 files changed, 44 insertions(+), 45 deletions(-) diff --git a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs index 592eb93ecc..ec4cbb808e 100644 --- a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs @@ -67,7 +67,8 @@ namespace osu.Game.Graphics.Cursor }, text = new OsuSpriteText { - Padding = new MarginPadding(5) + Padding = new MarginPadding(5), + Font = OsuFont.GetFont(weight: FontWeight.Regular) } }; } diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index 74bf790709..fc5abcdcb8 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -30,7 +30,7 @@ namespace osu.Game.Graphics public DrawableDate(DateTimeOffset date) { - Font = OsuFont.GetFont(italics: true); + Font = OsuFont.GetFont(weight: FontWeight.Regular, italics: true); Date = date; } diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index 7f8a5b1a79..c3db33f8d4 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -19,7 +19,7 @@ namespace osu.Game.Graphics return new FontUsage(usage, familyString, size, weightString, italics, fixedWidth); } - public static FontUsage GetFont(Typeface typeface = Typeface.Exo, float size = DEFAULT_FONT_SIZE, FontWeight weight = FontWeight.Regular, bool italics = false, bool fixedWidth = false) + public static FontUsage GetFont(Typeface typeface = Typeface.Exo, float size = DEFAULT_FONT_SIZE, FontWeight weight = FontWeight.Medium, bool italics = false, bool fixedWidth = false) => new FontUsage(getFamilyString(typeface), size, getWeightString(typeface, weight), italics, fixedWidth); private static string getFamilyString(Typeface typeface) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 7fac6bf7bb..a0e956b2e5 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -173,7 +173,7 @@ namespace osu.Game.Graphics.UserInterface new HoverClickSounds() }; - Active.BindValueChanged(val => Text.Font = OsuFont.GetFont(Text.Font, weight: val ? FontWeight.Bold : FontWeight.Regular), true); + Active.BindValueChanged(val => Text.Font = OsuFont.GetFont(Text.Font, weight: val ? FontWeight.Bold : FontWeight.Medium), true); } protected override void OnActivated() => fadeActive(); diff --git a/osu.Game/Graphics/UserInterface/OsuTextBox.cs b/osu.Game/Graphics/UserInterface/OsuTextBox.cs index 0cb94e755b..21cdfbf5af 100644 --- a/osu.Game/Graphics/UserInterface/OsuTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTextBox.cs @@ -24,7 +24,7 @@ namespace osu.Game.Graphics.UserInterface protected override SpriteText CreatePlaceholder() => new OsuSpriteText { - Font = OsuFont.GetFont(weight: FontWeight.Medium, italics: true), + Font = OsuFont.GetFont(italics: true), Colour = new Color4(180, 180, 180, 255), Margin = new MarginPadding { Left = 2 }, }; diff --git a/osu.Game/Graphics/UserInterface/PageTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs index cc21e24165..816d735c16 100644 --- a/osu.Game/Graphics/UserInterface/PageTabControl.cs +++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs @@ -59,7 +59,7 @@ namespace osu.Game.Graphics.UserInterface new HoverClickSounds() }; - Active.BindValueChanged(val => Text.Font = OsuFont.GetFont(Text.Font, weight: val ? FontWeight.Bold : FontWeight.Regular), true); + Active.BindValueChanged(val => Text.Font = OsuFont.GetFont(Text.Font, weight: val ? FontWeight.Bold : FontWeight.Medium), true); } [BackgroundDependencyLoader] diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index 3f346caea3..fb362fbd0c 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -76,7 +76,7 @@ namespace osu.Game.Online.Leaderboards { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = OsuFont.GetFont(size: 22, weight: FontWeight.Medium, italics: true), + Font = OsuFont.GetFont(size: 22, italics: true), Text = RankPosition.ToString(), }, }, diff --git a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs index a47c20c244..1038609693 100644 --- a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs +++ b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs @@ -49,7 +49,7 @@ namespace osu.Game.Overlays.BeatmapSet fields.Children = new Drawable[] { - new Field("mapped by", BeatmapSet.Metadata.Author.Username, OsuFont.GetFont(italics: true)), + new Field("mapped by", BeatmapSet.Metadata.Author.Username, OsuFont.GetFont(weight: FontWeight.Regular, italics: true)), new Field("submitted on", online.Submitted.ToString(@"MMMM d, yyyy"), OsuFont.GetFont(weight: FontWeight.Bold)) { Margin = new MarginPadding { Top = 5 }, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index 3bab6d3f1d..5e686ccb68 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -46,7 +46,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, Text = $"#{index + 1}", - Font = OsuFont.GetFont(italics: true), + Font = OsuFont.GetFont(weight: FontWeight.Regular, italics: true), Margin = new MarginPadding { Left = side_margin } }, new DrawableFlag(score.User.Country) @@ -96,7 +96,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Anchor = Anchor.CentreLeft, Origin = Anchor.CentreRight, Text = $@"{score.Accuracy:P2}", - Font = OsuFont.GetFont(italics: true), + Font = OsuFont.GetFont(weight: FontWeight.Regular, italics: true), RelativePositionAxes = Axes.X, X = 0.85f }, @@ -105,7 +105,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Anchor = Anchor.CentreRight, Origin = Anchor.CentreRight, Text = $"{score.Statistics[HitResult.Great]}/{score.Statistics[HitResult.Good]}/{score.Statistics[HitResult.Meh]}", - Font = OsuFont.GetFont(italics: true), + Font = OsuFont.GetFont(weight: FontWeight.Regular, italics: true), Margin = new MarginPadding { Right = side_margin } }, }; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index c5a77729c7..c64bda9dfd 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -224,7 +224,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Text = header, Font = OsuFont.GetFont(size: 14, weight: FontWeight.Bold) }, - valueText = new OsuSpriteText { Font = OsuFont.GetFont(size: 25, italics: true) } + valueText = new OsuSpriteText { Font = OsuFont.GetFont(size: 25, weight: FontWeight.Regular, italics: true) } }; } diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index db8c284fba..77934d6730 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -159,7 +159,7 @@ namespace osu.Game.Overlays.Chat { if (Message.IsAction) { - t.Font = OsuFont.GetFont(weight: FontWeight.Medium, italics: true); + t.Font = OsuFont.GetFont(italics: true); if (senderHasBackground) t.Colour = OsuColour.FromHex(message.Sender.Colour); diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 470a05ad88..f1bdfb7184 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -108,7 +108,7 @@ namespace osu.Game.Overlays.Music text.Clear(); //space after the title to put a space between the title and artist - titleSprites = text.AddText(titleBind.Value + @" ", sprite => sprite.Font = OsuFont.Default).OfType(); + titleSprites = text.AddText(titleBind.Value + @" ", sprite => sprite.Font = OsuFont.GetFont(weight: FontWeight.Regular)).OfType(); text.AddText(artistBind.Value, sprite => { diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 36dbc20d5a..92c44b1572 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -107,7 +107,7 @@ namespace osu.Game.Overlays Origin = Anchor.BottomCentre, Anchor = Anchor.TopCentre, Position = new Vector2(0, 40), - Font = OsuFont.GetFont(size: 25, weight: FontWeight.Medium, italics: true), + Font = OsuFont.GetFont(size: 25, italics: true), Colour = Color4.White, Text = @"Nothing to play", }, diff --git a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs index 2978d131f5..ff4d7a10dc 100644 --- a/osu.Game/Overlays/Profile/Header/BadgeContainer.cs +++ b/osu.Game/Overlays/Profile/Header/BadgeContainer.cs @@ -56,7 +56,7 @@ namespace osu.Game.Overlays.Profile.Header Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Alpha = 0, - Font = OsuFont.GetFont(size: 12) + Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular) }, new Container { diff --git a/osu.Game/Overlays/Profile/Header/RankGraph.cs b/osu.Game/Overlays/Profile/Header/RankGraph.cs index c8a486e037..3165f1c9cd 100644 --- a/osu.Game/Overlays/Profile/Header/RankGraph.cs +++ b/osu.Game/Overlays/Profile/Header/RankGraph.cs @@ -44,26 +44,26 @@ namespace osu.Game.Overlays.Profile.Header Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = "No recent plays", - Font = OsuFont.GetFont(size: 14, italics: true) + Font = OsuFont.GetFont(size: 14, weight: FontWeight.Regular, italics: true) }, rankText = new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Font = OsuFont.GetFont(size: primary_textsize, italics: true), + Font = OsuFont.GetFont(size: primary_textsize, weight: FontWeight.Regular, italics: true), }, relativeText = new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Font = OsuFont.GetFont(size: secondary_textsize, italics: true), + Font = OsuFont.GetFont(size: secondary_textsize, weight: FontWeight.Regular, italics: true), Y = 25, }, performanceText = new OsuSpriteText { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, - Font = OsuFont.GetFont(size: secondary_textsize, italics: true) + Font = OsuFont.GetFont(size: secondary_textsize, weight: FontWeight.Regular, italics: true) }, graph = new RankChartLineGraph { diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 2cafe5c7f4..cf1ff3aec3 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -118,7 +118,7 @@ namespace osu.Game.Overlays.Profile usernameText = new OsuSpriteText { Text = user.Username, - Font = OsuFont.GetFont(size: 30, italics: true) + Font = OsuFont.GetFont(size: 30, weight: FontWeight.Regular, italics: true) }, new ExternalLinkButton($@"https://osu.ppy.sh/users/{user.Id}") { @@ -174,7 +174,7 @@ namespace osu.Game.Overlays.Profile ParagraphSpacing = 0.8f, LineSpacing = 0.2f }, - infoTextRight = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 14, italics: true)) + infoTextRight = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: 14, weight: FontWeight.Regular, italics: true)) { X = UserProfileOverlay.CONTENT_X_MARGIN + info_width + 20, Y = cover_height + 20, diff --git a/osu.Game/Overlays/Profile/ProfileSection.cs b/osu.Game/Overlays/Profile/ProfileSection.cs index 3d041b90b6..89ea590ddd 100644 --- a/osu.Game/Overlays/Profile/ProfileSection.cs +++ b/osu.Game/Overlays/Profile/ProfileSection.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.Profile new OsuSpriteText { Text = Title, - Font = OsuFont.GetFont(size: 20, italics: true), + Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular, italics: true), Margin = new MarginPadding { Horizontal = UserProfileOverlay.CONTENT_X_MARGIN, @@ -66,7 +66,6 @@ namespace osu.Game.Overlays.Profile Add(new OsuSpriteText { Text = @"coming soon!", - Font = OsuFont.GetFont(weight: FontWeight.Medium), Colour = Color4.Gray, Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs index c0f3acffbf..64c8260524 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs @@ -55,7 +55,7 @@ namespace osu.Game.Overlays.Profile.Sections { Text = new LocalisedString((beatmap.Metadata.ArtistUnicode, beatmap.Metadata.Artist)), Padding = new MarginPadding { Top = 3 }, - Font = OsuFont.GetFont(size: 12, italics: true) + Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular, italics: true) }, }, }; diff --git a/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs b/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs index 5e94b28730..b0609e685e 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/DrawableMostPlayedRow.cs @@ -85,7 +85,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical Anchor = Anchor.BottomRight, Origin = Anchor.BottomRight, Text = @"times played ", - Font = OsuFont.GetFont(size: 12, italics: true) + Font = OsuFont.GetFont(size: 12, weight: FontWeight.Regular, italics: true) }, } }); diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index a46584cf91..5504ccee90 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -107,14 +107,14 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Text = header + ":", - Font = OsuFont.GetFont(size: 20, italics: true) + Font = OsuFont.GetFont(size: 20, weight: FontWeight.Regular, italics: true) }, valueText = new OsuSpriteText { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, Text = "0", - Font = OsuFont.GetFont(size: 40, italics: true), + Font = OsuFont.GetFont(size: 40, weight: FontWeight.Regular, italics: true), UseFullGlyphHeight = false, } } diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs index a85e32da22..98c35e6446 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs @@ -45,7 +45,7 @@ namespace osu.Game.Overlays.Profile.Sections new OsuSpriteText { Text = header, - Font = OsuFont.GetFont(size: 15, italics: true), + Font = OsuFont.GetFont(size: 15, weight: FontWeight.Regular, italics: true), Margin = new MarginPadding { Top = 10, Bottom = 10 }, }, ItemsContainer = new FillFlowContainer diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawablePerformanceScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawablePerformanceScore.cs index 81faeb87b2..843f9b7ef2 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawablePerformanceScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawablePerformanceScore.cs @@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Colour = colour.GrayA, - Font = OsuFont.GetFont(size: 11, italics: true) + Font = OsuFont.GetFont(size: 11, weight: FontWeight.Regular, italics: true) }); } } diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs index d24c6ae84a..f4e08b8db1 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/DrawableProfileScore.cs @@ -46,7 +46,7 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks Anchor = Anchor.TopRight, Origin = Anchor.TopRight, Colour = colour.GrayA, - Font = OsuFont.GetFont(size: 11, italics: true) + Font = OsuFont.GetFont(size: 11, weight: FontWeight.Regular, italics: true) }; RightFlowContainer.Add(text); diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs index b9cc0fd9ce..6620efefdc 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.Toolbar { AutoSizeAxes = Axes.X; - DrawableText.Font = OsuFont.GetFont(weight: FontWeight.Medium, italics: true); + DrawableText.Font = OsuFont.GetFont(italics: true); Add(new OpaqueBackground { Depth = 1 }); diff --git a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs index b327caa06b..1f25568d63 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs @@ -96,7 +96,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components { hostText.AddText("hosted by "); hostText.AddLink(v.Username, null, LinkAction.OpenUserProfile, v.Id.ToString(), "Open profile", - s => s.Font = OsuFont.GetFont(Typeface.Exo, weight: FontWeight.Medium, italics: true)); + s => s.Font = OsuFont.GetFont(Typeface.Exo, weight: FontWeight.Bold, italics: true)); flagContainer.Child = new DrawableFlag(v.Country) { RelativeSizeAxes = Axes.Both }; } }, true); diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index c294a2d71f..2561343c68 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -88,7 +88,7 @@ namespace osu.Game.Screens.Play new OsuSpriteText { Text = Header, - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 30), + Font = OsuFont.GetFont(size: 30), Spacing = new Vector2(5, 0), Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 9a1576bfa2..d859672701 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -330,14 +330,14 @@ namespace osu.Game.Screens.Play new OsuSpriteText { Text = new LocalisedString((metadata.TitleUnicode, metadata.Title)), - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 36, italics: true), + Font = OsuFont.GetFont(size: 36, italics: true), Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, }, new OsuSpriteText { Text = new LocalisedString((metadata.ArtistUnicode, metadata.Artist)), - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 26, italics: true), + Font = OsuFont.GetFont(size: 26, italics: true), Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, }, @@ -365,7 +365,7 @@ namespace osu.Game.Screens.Play new OsuSpriteText { Text = beatmap?.BeatmapInfo?.Version, - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 26, italics: true), + Font = OsuFont.GetFont(size: 26, italics: true), Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, Margin = new MarginPadding diff --git a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs index 199083ecf6..f593f4a47e 100644 --- a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs +++ b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs @@ -368,7 +368,7 @@ namespace osu.Game.Screens.Ranking.Pages Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Text = user.Username, - Font = OsuFont.GetFont(size: 30, italics: true), + Font = OsuFont.GetFont(size: 30, weight: FontWeight.Regular, italics: true), Padding = new MarginPadding { Bottom = 10 }, } }; diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 1385b4102e..238604ad9b 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -204,7 +204,7 @@ namespace osu.Game.Screens.Select VersionLabel = new OsuSpriteText { Text = beatmapInfo.Version, - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 24, italics: true), + Font = OsuFont.GetFont(size: 24, italics: true), }, } }, @@ -239,11 +239,11 @@ namespace osu.Game.Screens.Select { TitleLabel = new OsuSpriteText { - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 28, italics: true), + Font = OsuFont.GetFont(size: 28, italics: true), }, ArtistLabel = new OsuSpriteText { - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 17, italics: true), + Font = OsuFont.GetFont(size: 17, italics: true), }, MapperContainer = new FillFlowContainer { @@ -343,7 +343,7 @@ namespace osu.Game.Screens.Select new OsuSpriteText { Text = "mapped by ", - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 15), + Font = OsuFont.GetFont(size: 15), }, new OsuSpriteText { diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 386dd9edd6..c836f8bec3 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -101,21 +101,20 @@ namespace osu.Game.Screens.Select.Carousel new OsuSpriteText { Text = beatmap.Version, - Font = OsuFont.GetFont(weight: FontWeight.Medium, size: 20), + Font = OsuFont.GetFont(size: 20), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft }, new OsuSpriteText { Text = "mapped by", - Font = OsuFont.GetFont(weight: FontWeight.Medium), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft }, new OsuSpriteText { Text = $"{(beatmap.Metadata ?? beatmap.BeatmapSet.Metadata).Author.Username}", - Font = OsuFont.GetFont(weight: FontWeight.Medium, italics: true), + Font = OsuFont.GetFont(italics: true), Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft }, From 1bd1b6b0997ad3a9851cbb7fbbc4c5c56d2cfeab Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Feb 2019 16:53:57 +0900 Subject: [PATCH 118/327] Move user dim logic into UserDimContainer instead --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 2 +- .../Graphics/Containers/UserDimContainer.cs | 36 +++++++++++++++++++ .../Backgrounds/BackgroundScreenBeatmap.cs | 36 +++++-------------- osu.Game/Screens/Play/Player.cs | 18 +++++----- osu.Game/Screens/Play/PlayerLoader.cs | 3 -- 5 files changed, 53 insertions(+), 42 deletions(-) create mode 100644 osu.Game/Graphics/Containers/UserDimContainer.cs diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 89b9088681..1cc89da3b7 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -144,7 +144,7 @@ namespace osu.Game.Tests.Visual public void UpdateBindables() { - DimEnabled = Background.UpdateDim; + DimEnabled = Background.UpdateUserDim; } public bool AssertDimmed() diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs new file mode 100644 index 0000000000..4b4faae253 --- /dev/null +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -0,0 +1,36 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Allocation; +using osu.Framework.Configuration; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Configuration; +using osuTK.Graphics; + +namespace osu.Game.Graphics.Containers +{ + public class UserDimContainer : Container + { + #region User Settings + + protected Bindable DimLevel; + + #endregion + + public Bindable EnableUserDim = new Bindable(); + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + DimLevel = config.GetBindable(OsuSetting.DimLevel); + EnableUserDim.ValueChanged += _ => updateBackgroundDim(); + DimLevel.ValueChanged += _ => updateBackgroundDim(); + } + + private void updateBackgroundDim() + { + this.FadeColour(EnableUserDim ? OsuColour.Gray(1 - (float)DimLevel) : Color4.White, 800, Easing.OutQuint); + } + } +} diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 312d760410..23fa6b6b6f 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -11,6 +11,9 @@ using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; +using osu.Game.Graphics.Containers; +using osu.Game.Users; +using osuTK; using osuTK.Graphics; namespace osu.Game.Screens.Backgrounds @@ -19,9 +22,10 @@ namespace osu.Game.Screens.Backgrounds { private WorkingBeatmap beatmap; protected Bindable DimLevel; - public Bindable UpdateDim; + protected Bindable BlurLevel; + public Bindable EnableUserDim; - protected Container FadeContainer; + protected UserDimContainer FadeContainer; [BackgroundDependencyLoader] private void load(OsuConfigManager config) @@ -41,7 +45,7 @@ namespace osu.Game.Screens.Backgrounds Schedule(() => { - FadeContainer = new Container { RelativeSizeAxes = Axes.Both }; + FadeContainer = new UserDimContainer { RelativeSizeAxes = Axes.Both }; LoadComponentAsync(new BeatmapBackground(beatmap), b => Schedule(() => { float newDepth = 0; @@ -57,38 +61,14 @@ namespace osu.Game.Screens.Backgrounds Background.BlurSigma = BlurTarget; })); InternalChild = FadeContainer; - updateBackgroundDim(); + EnableUserDim = FadeContainer.EnableUserDim; }); } } - public override void OnEntering(IScreen last) - { - base.OnEntering(last); - DimLevel.ValueChanged += _ => updateBackgroundDim(); - UpdateDim.ValueChanged += _ => updateBackgroundDim(); - updateBackgroundDim(); - } - public override void OnResuming(IScreen last) - { - base.OnResuming(last); - updateBackgroundDim(); - } - - public override bool OnExiting(IScreen last) - { - return base.OnExiting(last); - } - - private void updateBackgroundDim() - { - FadeContainer?.FadeColour(UpdateDim ? OsuColour.Gray(1 - (float)DimLevel) : Color4.White, 800, Easing.OutQuint); - } - public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null) { Beatmap = beatmap; - UpdateDim = new Bindable(); } public override bool Equals(BackgroundScreen other) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2c0172b272..3826271a7e 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -19,7 +19,6 @@ using osu.Framework.Threading; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Configuration; -using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Cursor; using osu.Game.Online.API; @@ -61,7 +60,6 @@ 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; @@ -88,7 +86,7 @@ namespace osu.Game.Screens.Play private FailOverlay failOverlay; private DrawableStoryboard storyboard; - private Container storyboardContainer; + private UserDimContainer storyboardContainer; public bool LoadedBeatmapSuccessfully => RulesetContainer?.Objects.Any() == true; @@ -175,9 +173,9 @@ namespace osu.Game.Screens.Play OnRetry = Restart, OnQuit = performUserRequestedExit, CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded, - Children = new[] + Children = new Container[] { - storyboardContainer = new Container + storyboardContainer = new UserDimContainer { RelativeSizeAxes = Axes.Both, Alpha = 0, @@ -242,6 +240,8 @@ namespace osu.Game.Screens.Play if (ShowStoryboard) initializeStoryboard(false); + storyboardContainer.EnableUserDim.Value = true; + // Bind ScoreProcessor to ourselves ScoreProcessor.AllJudged += onCompletion; ScoreProcessor.Failed += onFail; @@ -346,7 +346,7 @@ namespace osu.Game.Screens.Play .Delay(250) .FadeIn(250); - Background.UpdateDim.Value = true; + Background.EnableUserDim.Value = true; Task.Run(() => { @@ -407,7 +407,7 @@ namespace osu.Game.Screens.Play { float fadeOutDuration = instant ? 0 : 250; this.FadeOut(fadeOutDuration); - Background.UpdateDim.Value = false; + Background.EnableUserDim.Value = false; } protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !pauseContainer.IsPaused; @@ -440,9 +440,7 @@ namespace osu.Game.Screens.Play var beatmap = Beatmap.Value; var storyboardVisible = ShowStoryboard && beatmap.Storyboard.HasDrawable; - storyboardContainer? - .FadeColour(OsuColour.Gray(BackgroundOpacity), BACKGROUND_FADE_DURATION, Easing.OutQuint) - .FadeTo(storyboardVisible && BackgroundOpacity > 0 ? 1 : 0, BACKGROUND_FADE_DURATION, Easing.OutQuint); + storyboardContainer?.FadeTo(storyboardVisible && 1 - (float)DimLevel > 0 ? 1 : 0, BACKGROUND_FADE_DURATION, Easing.OutQuint); if (storyboardVisible && beatmap.Storyboard.ReplacesBackground) Background?.FadeColour(Color4.Black, BACKGROUND_FADE_DURATION, Easing.OutQuint); diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 4844883dfe..c55c05f61c 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -243,9 +243,6 @@ namespace osu.Game.Screens.Play this.FadeOut(150); cancelLoad(); - if (Background != null) - Background.UpdateDim.Value = false; - return base.OnExiting(next); } From 5bf405f9496695f35268be2856112855b450fa57 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Feb 2019 16:56:57 +0900 Subject: [PATCH 119/327] Fix bindable name in tests --- osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 1cc89da3b7..9e981952a9 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -144,7 +144,7 @@ namespace osu.Game.Tests.Visual public void UpdateBindables() { - DimEnabled = Background.UpdateUserDim; + DimEnabled = Background.EnableUserDim; } public bool AssertDimmed() From 3f000dfe2ef656cea11bc53942ebd8cd28231a72 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Feb 2019 16:58:12 +0900 Subject: [PATCH 120/327] Remove unnecessary region --- osu.Game/Graphics/Containers/UserDimContainer.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index 4b4faae253..717078ab99 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -12,12 +12,8 @@ namespace osu.Game.Graphics.Containers { public class UserDimContainer : Container { - #region User Settings - protected Bindable DimLevel; - #endregion - public Bindable EnableUserDim = new Bindable(); [BackgroundDependencyLoader] From d703a9511a9d523cb0c2e80c3417a3253e757b3a Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Feb 2019 17:20:45 +0900 Subject: [PATCH 121/327] Fix background dim previews --- osu.Game/Screens/Play/PlayerLoader.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index c55c05f61c..c8149cefef 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -161,6 +161,8 @@ namespace osu.Game.Screens.Play { // restore our screen defaults InitializeBackgroundElements(); + if (this.IsCurrentScreen()) + Background.EnableUserDim.Value = false; return base.OnHover(e); } @@ -170,6 +172,8 @@ namespace osu.Game.Screens.Play { // show user setting preview UpdateBackgroundElements(); + if (this.IsCurrentScreen()) + Background.EnableUserDim.Value = true; } base.OnHoverLost(e); @@ -243,6 +247,8 @@ namespace osu.Game.Screens.Play this.FadeOut(150); cancelLoad(); + Background.EnableUserDim.Value = false; + return base.OnExiting(next); } From 25e7dcb3755cc9c7d0ce5be6ede5da9c455f1427 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Feb 2019 17:39:35 +0900 Subject: [PATCH 122/327] Remove unused includes --- osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 23fa6b6b6f..1596e26ce5 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -4,17 +4,11 @@ using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Textures; -using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Configuration; -using osu.Game.Graphics; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; -using osu.Game.Users; -using osuTK; -using osuTK.Graphics; namespace osu.Game.Screens.Backgrounds { From 4db5531e4bde96f2fbb3152c0eddb4663c400bb7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 20 Feb 2019 19:32:30 +0900 Subject: [PATCH 123/327] Replace copy-constructor/method with extension method --- .../UI/DrawableManiaJudgement.cs | 3 +- .../Drawables/BeatmapSetOnlineStatusPill.cs | 2 +- osu.Game/Graphics/OsuFont.cs | 29 ++++++++++--------- .../UserInterface/BreadcrumbControl.cs | 2 +- .../Graphics/UserInterface/DialogButton.cs | 2 +- .../Graphics/UserInterface/OsuTabControl.cs | 2 +- .../Graphics/UserInterface/PageTabControl.cs | 2 +- .../UserInterface/PercentageCounter.cs | 2 +- .../Graphics/UserInterface/RollingCounter.cs | 2 +- .../Graphics/UserInterface/ScoreCounter.cs | 2 +- .../Online/Leaderboards/LeaderboardScore.cs | 4 +-- .../Online/Leaderboards/MessagePlaceholder.cs | 2 +- osu.Game/Online/Leaderboards/Placeholder.cs | 3 +- .../AccountCreation/ErrorTextFlowContainer.cs | 3 +- .../Overlays/AccountCreation/ScreenEntry.cs | 2 +- .../Overlays/AccountCreation/ScreenWarning.cs | 4 +-- osu.Game/Overlays/BeatmapSet/AuthorInfo.cs | 2 +- osu.Game/Overlays/BeatmapSet/Info.cs | 2 +- .../BeatmapSet/Scores/ClickableUsername.cs | 2 +- osu.Game/Overlays/Chat/ChatLine.cs | 2 +- .../Chat/Tabs/ChannelSelectorTabItem.cs | 4 +-- osu.Game/Overlays/Dialog/PopupDialog.cs | 4 +-- .../Overlays/MedalSplash/DrawableMedal.cs | 2 +- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 +- .../Notifications/SimpleNotification.cs | 2 +- osu.Game/Overlays/Profile/ProfileHeader.cs | 4 +-- .../Profile/Sections/Kudosu/KudosuInfo.cs | 2 +- .../SearchableList/HeaderTabControl.cs | 3 +- .../Edit/Components/Menus/EditorMenuBar.cs | 4 +-- .../Compose/Components/BeatDivisorControl.cs | 2 +- .../LabelledComponents/LabelledTextBox.cs | 2 +- osu.Game/Screens/Menu/Disclaimer.cs | 8 ++--- .../Screens/Multi/Components/BeatmapTitle.cs | 2 +- .../Multi/Components/BeatmapTypeInfo.cs | 2 +- .../Lounge/Components/ParticipantInfo.cs | 2 +- .../Multi/Match/Components/HostInfo.cs | 2 +- .../Ranking/Pages/RoomLeaderboardPage.cs | 4 +-- osu.Game/Screens/Play/HUD/ComboCounter.cs | 5 ++-- .../Screens/Ranking/Pages/ScoreResultsPage.cs | 2 +- osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- 40 files changed, 66 insertions(+), 68 deletions(-) diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs index b3d6777670..5874bac7f6 100644 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaJudgement.cs @@ -3,7 +3,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Game.Graphics; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects.Drawables; @@ -20,7 +19,7 @@ namespace osu.Game.Rulesets.Mania.UI private void load() { if (JudgementText != null) - JudgementText.Font = OsuFont.GetFont(JudgementText.Font, size: 25); + JudgementText.Font = JudgementText.Font.With(size: 25); } protected override void LoadComplete() diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index bdfcf051d4..72b5f69eee 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -33,7 +33,7 @@ namespace osu.Game.Beatmaps.Drawables public float TextSize { get => statusText.Font.Size; - set => statusText.Font = OsuFont.GetFont(statusText.Font, size: value); + set => statusText.Font = statusText.Font.With(size: value); } public MarginPadding TextPadding diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index c3db33f8d4..54c6ca48a0 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -11,18 +11,10 @@ namespace osu.Game.Graphics public static FontUsage Default => GetFont(); - public static FontUsage GetFont(FontUsage usage, Typeface? typeface = null, float? size = null, FontWeight? weight = null, bool? italics = null, bool? fixedWidth = null) - { - string familyString = typeface != null ? getFamilyString(typeface.Value) : usage.Family; - string weightString = weight != null ? getWeightString(familyString, weight.Value) : usage.Weight; - - return new FontUsage(usage, familyString, size, weightString, italics, fixedWidth); - } - public static FontUsage GetFont(Typeface typeface = Typeface.Exo, float size = DEFAULT_FONT_SIZE, FontWeight weight = FontWeight.Medium, bool italics = false, bool fixedWidth = false) - => new FontUsage(getFamilyString(typeface), size, getWeightString(typeface, weight), italics, fixedWidth); + => new FontUsage(GetFamilyString(typeface), size, GetWeightString(typeface, weight), italics, fixedWidth); - private static string getFamilyString(Typeface typeface) + public static string GetFamilyString(Typeface typeface) { switch (typeface) { @@ -37,10 +29,10 @@ namespace osu.Game.Graphics return null; } - private static string getWeightString(Typeface typeface, FontWeight weight) - => getWeightString(getFamilyString(typeface), weight); + public static string GetWeightString(Typeface typeface, FontWeight weight) + => GetWeightString(GetFamilyString(typeface), weight); - private static string getWeightString(string family, FontWeight weight) + public static string GetWeightString(string family, FontWeight weight) { string weightString = weight.ToString(); @@ -52,6 +44,17 @@ namespace osu.Game.Graphics } } + public static class OsuFontExtensions + { + public static FontUsage With(this FontUsage usage, Typeface? typeface = null, float? size = null, FontWeight? weight = null, bool? italics = null, bool? fixedWidth = null) + { + string familyString = typeface != null ? OsuFont.GetFamilyString(typeface.Value) : usage.Family; + string weightString = weight != null ? OsuFont.GetWeightString(familyString, weight.Value) : usage.Weight; + + return usage.With(familyString, size, weightString, italics, fixedWidth); + } + } + public enum Typeface { Exo, diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index b7a4254642..b25976ea6a 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -82,7 +82,7 @@ namespace osu.Game.Graphics.UserInterface public BreadcrumbTabItem(T value) : base(value) { - Text.Font = OsuFont.GetFont(Text.Font, size: 18); + Text.Font = Text.Font.With(size: 18); Text.Margin = new MarginPadding { Vertical = 8 }; Padding = new MarginPadding { Right = padding + item_chevron_size }; Add(Chevron = new SpriteIcon diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 665c3b9146..ddfbccb0a2 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -199,7 +199,7 @@ namespace osu.Game.Graphics.UserInterface public float TextSize { get => spriteText.Font.Size; - set => spriteText.Font = OsuFont.GetFont(spriteText.Font, size: value); + set => spriteText.Font = spriteText.Font.With(size: value); } public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => backgroundContainer.ReceivePositionalInputAt(screenSpacePos); diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index a0e956b2e5..042b55073f 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -173,7 +173,7 @@ namespace osu.Game.Graphics.UserInterface new HoverClickSounds() }; - Active.BindValueChanged(val => Text.Font = OsuFont.GetFont(Text.Font, weight: val ? FontWeight.Bold : FontWeight.Medium), true); + Active.BindValueChanged(val => Text.Font = Text.Font.With(weight: val ? FontWeight.Bold : FontWeight.Medium), true); } protected override void OnActivated() => fadeActive(); diff --git a/osu.Game/Graphics/UserInterface/PageTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs index 816d735c16..40365bd57c 100644 --- a/osu.Game/Graphics/UserInterface/PageTabControl.cs +++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs @@ -59,7 +59,7 @@ namespace osu.Game.Graphics.UserInterface new HoverClickSounds() }; - Active.BindValueChanged(val => Text.Font = OsuFont.GetFont(Text.Font, weight: val ? FontWeight.Bold : FontWeight.Medium), true); + Active.BindValueChanged(val => Text.Font = Text.Font.With(weight: val ? FontWeight.Bold : FontWeight.Medium), true); } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index 8c2849bd7b..8ea5525ac7 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -22,7 +22,7 @@ namespace osu.Game.Graphics.UserInterface public PercentageCounter() { - DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, fixedWidth: true); + DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(fixedWidth: true); Current.Value = DisplayedCount = 1.0f; } diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index f0730a7dc2..eef7d3b77a 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -65,7 +65,7 @@ namespace osu.Game.Graphics.UserInterface public float TextSize { get => DisplayedCountSpriteText.Font.Size; - set => DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, size: value); + set => DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(size: value); } public Color4 AccentColour diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index 0c1cb570ea..3cc9167d5b 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -28,7 +28,7 @@ namespace osu.Game.Graphics.UserInterface /// How many leading zeroes the counter will have. public ScoreCounter(uint leading = 0) { - DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, fixedWidth: true); + DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(fixedWidth: true); LeadingZeroes = leading; } diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index fb362fbd0c..73c01dfde7 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -294,7 +294,7 @@ namespace osu.Game.Online.Leaderboards { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = OsuFont.GetFont(font, fixedWidth: true), + Font = font.With(fixedWidth: true), Text = text, Colour = glowColour, Shadow = false, @@ -305,7 +305,7 @@ namespace osu.Game.Online.Leaderboards { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = OsuFont.GetFont(font, fixedWidth: true), + Font = font.With(fixedWidth: true), Text = text, Colour = textColour, Shadow = false, diff --git a/osu.Game/Online/Leaderboards/MessagePlaceholder.cs b/osu.Game/Online/Leaderboards/MessagePlaceholder.cs index 86d59d2809..d4256e4a9d 100644 --- a/osu.Game/Online/Leaderboards/MessagePlaceholder.cs +++ b/osu.Game/Online/Leaderboards/MessagePlaceholder.cs @@ -14,7 +14,7 @@ namespace osu.Game.Online.Leaderboards { AddIcon(FontAwesome.fa_exclamation_circle, cp => { - cp.Font = OsuFont.GetFont(cp.Font, size: TEXT_SIZE); + cp.Font = cp.Font.With(size: TEXT_SIZE); cp.Padding = new MarginPadding { Right = 10 }; }); diff --git a/osu.Game/Online/Leaderboards/Placeholder.cs b/osu.Game/Online/Leaderboards/Placeholder.cs index 675e224bee..d38110a9d0 100644 --- a/osu.Game/Online/Leaderboards/Placeholder.cs +++ b/osu.Game/Online/Leaderboards/Placeholder.cs @@ -3,7 +3,6 @@ using System; using osu.Framework.Graphics; -using osu.Game.Graphics; using osu.Game.Graphics.Containers; namespace osu.Game.Online.Leaderboards @@ -13,7 +12,7 @@ namespace osu.Game.Online.Leaderboards protected const float TEXT_SIZE = 22; protected Placeholder() - : base(cp => cp.Font = OsuFont.GetFont(cp.Font, size: TEXT_SIZE)) + : base(cp => cp.Font = cp.Font.With(size: TEXT_SIZE)) { Anchor = Anchor.Centre; Origin = Anchor.Centre; diff --git a/osu.Game/Overlays/AccountCreation/ErrorTextFlowContainer.cs b/osu.Game/Overlays/AccountCreation/ErrorTextFlowContainer.cs index 11c256130f..87ff4dd398 100644 --- a/osu.Game/Overlays/AccountCreation/ErrorTextFlowContainer.cs +++ b/osu.Game/Overlays/AccountCreation/ErrorTextFlowContainer.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using osu.Framework.Graphics; -using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osuTK.Graphics; @@ -14,7 +13,7 @@ namespace osu.Game.Overlays.AccountCreation private readonly List errorDrawables = new List(); public ErrorTextFlowContainer() - : base(cp => cp.Font = OsuFont.GetFont(cp.Font, size: 12)) + : base(cp => cp.Font = cp.Font.With(size: 12)) { } diff --git a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs index 2400403ec8..86c972c303 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs @@ -129,7 +129,7 @@ namespace osu.Game.Overlays.AccountCreation usernameDescription.AddText("This will be your public presence. No profanity, no impersonation. Avoid exposing your own personal details, too!"); emailAddressDescription.AddText("Will be used for notifications, account verification and in the case you forget your password. No spam, ever."); - emailAddressDescription.AddText(" Make sure to get it right!", cp => cp.Font = OsuFont.GetFont(cp.Font, weight: FontWeight.Bold)); + emailAddressDescription.AddText(" Make sure to get it right!", cp => cp.Font = cp.Font.With(weight: FontWeight.Bold)); passwordDescription.AddText("At least "); characterCheckText = passwordDescription.AddText("8 characters long"); diff --git a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs index d1336f0a0e..4e2cc1ea00 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenWarning.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenWarning.cs @@ -89,7 +89,7 @@ namespace osu.Game.Overlays.AccountCreation Font = OsuFont.GetFont(size: 28, weight: FontWeight.Light), Text = "Warning! 注意!", }, - multiAccountExplanationText = new OsuTextFlowContainer(cp => cp.Font = OsuFont.GetFont(cp.Font, size: 12)) + multiAccountExplanationText = new OsuTextFlowContainer(cp => cp.Font = cp.Font.With(size: 12)) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y @@ -105,7 +105,7 @@ namespace osu.Game.Overlays.AccountCreation Text = "I understand. This account isn't for me.", Action = () => this.Push(new ScreenEntry()) }, - furtherAssistance = new LinkFlowContainer(cp => cp.Font = OsuFont.GetFont(cp.Font, size: 12)) + furtherAssistance = new LinkFlowContainer(cp => cp.Font = cp.Font.With(size: 12)) { Margin = new MarginPadding { Top = 20 }, Anchor = Anchor.TopCentre, diff --git a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs index 1038609693..8a75cfea50 100644 --- a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs +++ b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs @@ -122,7 +122,7 @@ namespace osu.Game.Overlays.BeatmapSet new OsuSpriteText { Text = second, - Font = OsuFont.GetFont(secondFont, size: 13) + Font = secondFont.With(size: 13) }, }; } diff --git a/osu.Game/Overlays/BeatmapSet/Info.cs b/osu.Game/Overlays/BeatmapSet/Info.cs index afff1f3270..b6793d2609 100644 --- a/osu.Game/Overlays/BeatmapSet/Info.cs +++ b/osu.Game/Overlays/BeatmapSet/Info.cs @@ -156,7 +156,7 @@ namespace osu.Game.Overlays.BeatmapSet this.FadeIn(transition_duration); textFlow.Clear(); - textFlow.AddText(value, s => s.Font = OsuFont.GetFont(s.Font, size: 14)); + textFlow.AddText(value, s => s.Font = s.Font.With(size: 14)); } } diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs index e88a3f3dfc..7933bfd9b6 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs @@ -32,7 +32,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores public float TextSize { get => text.Font.Size; - set => text.Font = OsuFont.GetFont(text.Font, size: value); + set => text.Font = text.Font.With(size: value); } public ClickableUsername() diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index 77934d6730..a679f33e3a 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -165,7 +165,7 @@ namespace osu.Game.Overlays.Chat t.Colour = OsuColour.FromHex(message.Sender.Colour); } - t.Font = OsuFont.GetFont(t.Font, size: TextSize); + t.Font = t.Font.With(size: TextSize); }) { AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs index 158e191433..6ac6133fd0 100644 --- a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs +++ b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs @@ -20,8 +20,8 @@ namespace osu.Game.Overlays.Chat.Tabs Icon.Alpha = 0; - Text.Font = OsuFont.GetFont(Text.Font, size: 45); - TextBold.Font = OsuFont.GetFont(Text.Font, size: 45); + Text.Font = Text.Font.With(size: 45); + TextBold.Font = Text.Font.With(size: 45); } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index a766e6efb7..781d1a5b7e 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -171,7 +171,7 @@ namespace osu.Game.Overlays.Dialog }, }, }, - header = new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(t.Font, size: 25)) + header = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 25)) { Origin = Anchor.TopCentre, Anchor = Anchor.TopCentre, @@ -180,7 +180,7 @@ namespace osu.Game.Overlays.Dialog Padding = new MarginPadding(15), TextAnchor = Anchor.TopCentre, }, - body = new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(t.Font, size: 18)) + body = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 18)) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index 0ff29ba93e..2dedef8fb2 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -105,7 +105,7 @@ namespace osu.Game.Overlays.MedalSplash { s.Anchor = Anchor.TopCentre; s.Origin = Anchor.TopCentre; - s.Font = OsuFont.GetFont(s.Font, size: 16); + s.Font = s.Font.With(size: 16); }); medalContainer.OnLoadComplete = d => diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index b219610e59..8fdac6d1ad 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -274,7 +274,7 @@ namespace osu.Game.Overlays.Mods }, new OsuTextFlowContainer(text => { - text.Font = OsuFont.GetFont(text.Font, size: 18); + text.Font = text.Font.With(size: 18); text.Shadow = true; }) { diff --git a/osu.Game/Overlays/Notifications/SimpleNotification.cs b/osu.Game/Overlays/Notifications/SimpleNotification.cs index 933e296656..91dab14a62 100644 --- a/osu.Game/Overlays/Notifications/SimpleNotification.cs +++ b/osu.Game/Overlays/Notifications/SimpleNotification.cs @@ -59,7 +59,7 @@ namespace osu.Game.Overlays.Notifications } }); - Content.Add(textDrawable = new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(t.Font, size: 14)) + Content.Add(textDrawable = new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 14)) { Colour = OsuColour.Gray(128), AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index cf1ff3aec3..c488adf4d7 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -165,7 +165,7 @@ namespace osu.Game.Overlays.Profile Y = cover_height, Colour = OsuColour.Gray(34), }, - infoTextLeft = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(t.Font, size: 14)) + infoTextLeft = new LinkFlowContainer(t => t.Font = t.Font.With(size: 14)) { X = UserProfileOverlay.CONTENT_X_MARGIN, Y = cover_height + 20, @@ -349,7 +349,7 @@ namespace osu.Game.Overlays.Profile colourBar.Show(); } - void boldItalic(SpriteText t) => t.Font = OsuFont.GetFont(t.Font, weight: FontWeight.Bold, italics: true); + void boldItalic(SpriteText t) => t.Font = t.Font.With(weight: FontWeight.Bold, italics: true); void lightText(SpriteText t) => t.Alpha = 0.8f; OsuSpriteText createScoreText(string text) => new OsuSpriteText diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 5504ccee90..31f1f1af60 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -119,7 +119,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu } } }, - new OsuTextFlowContainer(t => t.Font = OsuFont.GetFont(t.Font, size: 19)) + new OsuTextFlowContainer(t => t.Font = t.Font.With(size: 19)) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, diff --git a/osu.Game/Overlays/SearchableList/HeaderTabControl.cs b/osu.Game/Overlays/SearchableList/HeaderTabControl.cs index f6334c2637..39348a9ad7 100644 --- a/osu.Game/Overlays/SearchableList/HeaderTabControl.cs +++ b/osu.Game/Overlays/SearchableList/HeaderTabControl.cs @@ -3,7 +3,6 @@ using osuTK.Graphics; using osu.Framework.Graphics.UserInterface; -using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; namespace osu.Game.Overlays.SearchableList @@ -22,7 +21,7 @@ namespace osu.Game.Overlays.SearchableList { public HeaderTabItem(T value) : base(value) { - Text.Font = OsuFont.GetFont(Text.Font, size: 16); + Text.Font = Text.Font.With(size: 16); } } } diff --git a/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs index 753fb5c132..27e1cc791a 100644 --- a/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs +++ b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs @@ -110,8 +110,8 @@ namespace osu.Game.Screens.Edit.Components.Menus { public TextContainer() { - NormalText.Font = OsuFont.GetFont(NormalText.Font, size: 14); - BoldText.Font = OsuFont.GetFont(BoldText.Font, size: 14); + NormalText.Font = NormalText.Font.With(size: 14); + BoldText.Font = BoldText.Font.With(size: 14); NormalText.Margin = BoldText.Margin = new MarginPadding { Horizontal = 10, Vertical = MARGIN_VERTICAL }; } } diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs index 12c33d1f87..55b2d29a87 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs @@ -118,7 +118,7 @@ namespace osu.Game.Screens.Edit.Compose.Components }, new Drawable[] { - new TextFlowContainer(s => s.Font = OsuFont.GetFont(s.Font, size: 14)) + new TextFlowContainer(s => s.Font = s.Font.With(size: 14)) { Padding = new MarginPadding { Horizontal = 15 }, Text = "beat snap divisor", diff --git a/osu.Game/Screens/Edit/Setup/Components/LabelledComponents/LabelledTextBox.cs b/osu.Game/Screens/Edit/Setup/Components/LabelledComponents/LabelledTextBox.cs index 04dfcbefeb..50d524d1f5 100644 --- a/osu.Game/Screens/Edit/Setup/Components/LabelledComponents/LabelledTextBox.cs +++ b/osu.Game/Screens/Edit/Setup/Components/LabelledComponents/LabelledTextBox.cs @@ -39,7 +39,7 @@ namespace osu.Game.Screens.Edit.Setup.Components.LabelledComponents public float LabelTextSize { get => label.Font.Size; - set => label.Font = OsuFont.GetFont(label.Font, size: value); + set => label.Font = label.Font.With(size: value); } public string PlaceholderText diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index c887c18a46..68a6e6525b 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -64,10 +64,10 @@ namespace osu.Game.Screens.Menu } }; - textFlow.AddText("This is an ", t => t.Font = OsuFont.GetFont(t.Font, size: 30, weight: FontWeight.Light)); - textFlow.AddText("early development build", t => t.Font = OsuFont.GetFont(t.Font, size: 30, weight: FontWeight.SemiBold)); + textFlow.AddText("This is an ", t => t.Font = t.Font.With(size: 30, weight: FontWeight.Light)); + textFlow.AddText("early development build", t => t.Font = t.Font.With(size: 30, weight: FontWeight.SemiBold)); - textFlow.AddParagraph("Things may not work as expected", t => t.Font = OsuFont.GetFont(t.Font, size: 20)); + textFlow.AddParagraph("Things may not work as expected", t => t.Font = t.Font.With(size: 20)); textFlow.NewParagraph(); Action format = t => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.Bold); @@ -90,7 +90,7 @@ namespace osu.Game.Screens.Menu supporterDrawables.Add(heart = textFlow.AddIcon(FontAwesome.fa_heart, t => { t.Padding = new MarginPadding { Left = 5 }; - t.Font = OsuFont.GetFont(t.Font, size: 12); + t.Font = t.Font.With(size: 12); t.Colour = colours.Pink; t.Origin = Anchor.Centre; }).First()); diff --git a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs index d25aacd049..6162b17362 100644 --- a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs +++ b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs @@ -58,7 +58,7 @@ namespace osu.Game.Screens.Multi.Components if (beatmap == null) textFlow.AddText("No beatmap selected", s => { - s.Font = OsuFont.GetFont(s.Font, size: TextSize); + s.Font = s.Font.With(size: TextSize); s.Colour = colours.PinkLight; }); else diff --git a/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs b/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs index b0eec396f8..fea2822e1a 100644 --- a/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs +++ b/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs @@ -40,7 +40,7 @@ namespace osu.Game.Screens.Multi.Components Children = new Drawable[] { new BeatmapTitle(), - beatmapAuthor = new LinkFlowContainer(s => s.Font = OsuFont.GetFont(s.Font, size: 14)) + beatmapAuthor = new LinkFlowContainer(s => s.Font = s.Font.With(size: 14)) { Anchor = Anchor.BottomLeft, Origin = Anchor.BottomLeft, diff --git a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs index 1f25568d63..6aa63423d1 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs @@ -96,7 +96,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components { hostText.AddText("hosted by "); hostText.AddLink(v.Username, null, LinkAction.OpenUserProfile, v.Id.ToString(), "Open profile", - s => s.Font = OsuFont.GetFont(Typeface.Exo, weight: FontWeight.Bold, italics: true)); + s => s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold, italics: true)); flagContainer.Child = new DrawableFlag(v.Country) { RelativeSizeAxes = Axes.Both }; } }, true); diff --git a/osu.Game/Screens/Multi/Match/Components/HostInfo.cs b/osu.Game/Screens/Multi/Match/Components/HostInfo.cs index 6896e3edac..d765ffe8a8 100644 --- a/osu.Game/Screens/Multi/Match/Components/HostInfo.cs +++ b/osu.Game/Screens/Multi/Match/Components/HostInfo.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Multi.Match.Components linkContainer.AddText("hosted by"); linkContainer.NewLine(); linkContainer.AddLink(host.Username, null, LinkAction.OpenUserProfile, host.Id.ToString(), "View Profile", - s => s.Font = OsuFont.GetFont(Typeface.Exo, weight: FontWeight.Bold, italics: true)); + s => s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold, italics: true)); } } } diff --git a/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs b/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs index 423b897813..40a549cb94 100644 --- a/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs +++ b/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs @@ -80,7 +80,7 @@ namespace osu.Game.Screens.Multi.Ranking.Pages Action gray = s => s.Colour = colours.GrayC; Action white = s => { - s.Font = OsuFont.GetFont(s.Font, size: s.Font.Size * 1.4f); + s.Font = s.Font.With(size: s.Font.Size * 1.4f); s.Colour = colours.GrayF; }; @@ -91,7 +91,7 @@ namespace osu.Game.Screens.Multi.Ranking.Pages rankText.AddText($"#{index + 1} ", s => { - s.Font = OsuFont.GetFont(s.Font, Typeface.Exo, weight: FontWeight.Bold); + s.Font = s.Font.With(Typeface.Exo, weight: FontWeight.Bold); s.Colour = colours.YellowDark; }); diff --git a/osu.Game/Screens/Play/HUD/ComboCounter.cs b/osu.Game/Screens/Play/HUD/ComboCounter.cs index 0b27d8e69e..13b4b0b2fc 100644 --- a/osu.Game/Screens/Play/HUD/ComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboCounter.cs @@ -5,7 +5,6 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Game.Graphics; using osu.Game.Graphics.Sprites; namespace osu.Game.Screens.Play.HUD @@ -101,8 +100,8 @@ namespace osu.Game.Screens.Play.HUD { textSize = value; - DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, size: TextSize); - PopOutCount.Font = OsuFont.GetFont(PopOutCount.Font, size: TextSize); + DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(size: TextSize); + PopOutCount.Font = PopOutCount.Font.With(size: TextSize); } } diff --git a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs index f593f4a47e..09b5b7ea49 100644 --- a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs +++ b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs @@ -391,7 +391,7 @@ namespace osu.Game.Screens.Ranking.Pages public SlowScoreCounter(uint leading = 0) : base(leading) { DisplayedCountSpriteText.Shadow = false; - DisplayedCountSpriteText.Font = OsuFont.GetFont(DisplayedCountSpriteText.Font, Typeface.Venera, weight: FontWeight.Light); + DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(Typeface.Venera, weight: FontWeight.Light); UseCommaSeparator = true; } } diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index a0baf64a37..c0a004ede3 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -346,7 +346,7 @@ namespace osu.Game.Screens.Select private void setTextAsync(string text) { - LoadComponentAsync(new OsuTextFlowContainer(s => s.Font = OsuFont.GetFont(s.Font, size: 14)) + LoadComponentAsync(new OsuTextFlowContainer(s => s.Font = s.Font.With(size: 14)) { RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, From 9b3f2fdd24e7cac421cc3b274c2d01707a9238e9 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Wed, 20 Feb 2019 19:33:14 +0900 Subject: [PATCH 124/327] Change RelativePositionAxes default on osu! logo to be both --- osu.Game/Screens/Menu/Intro.cs | 1 - osu.Game/Screens/OsuScreen.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 2 -- osu.Game/Screens/Select/SongSelect.cs | 1 - 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 10cfc4a299..b0cfc5a0f8 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -112,7 +112,6 @@ namespace osu.Game.Screens.Menu }, delay_step_two); } - logo.RelativePositionAxes = Axes.Both; logo.Colour = Color4.White; logo.Ripple = false; diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index b8d6fda97d..7a63736469 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -174,7 +174,7 @@ namespace osu.Game.Screens logo.FadeOut(300, Easing.OutQuint); logo.Anchor = Anchor.TopLeft; logo.Origin = Anchor.Centre; - logo.RelativePositionAxes = Axes.None; + logo.RelativePositionAxes = Axes.Both; logo.BeatMatching = true; logo.Triangles = true; logo.Ripple = true; diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index c55c05f61c..61c2b0fc18 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -143,8 +143,6 @@ namespace osu.Game.Screens.Play { base.LogoArriving(logo, resuming); - logo.RelativePositionAxes = Axes.Both; - logo.ScaleTo(new Vector2(0.15f), 300, Easing.In); logo.MoveTo(new Vector2(0.5f), 300, Easing.In); logo.FadeIn(350); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 3be4dd8c0b..214601c3ed 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -444,7 +444,6 @@ namespace osu.Game.Screens.Select { base.LogoArriving(logo, resuming); - logo.RelativePositionAxes = Axes.Both; Vector2 position = new Vector2(0.95f, 0.96f); if (logo.Alpha > 0.8f) From 062196c7da0293d62dfef4591bbe5ec33b9221d1 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 20 Feb 2019 20:52:56 +0900 Subject: [PATCH 125/327] Cleanup --- osu.Game/Overlays/Notifications/ProgressNotification.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index 623b76c12e..efb66a7153 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -115,7 +115,7 @@ namespace osu.Game.Overlays.Notifications RelativeSizeAxes = Axes.Both, }); - Content.Add(textDrawable = new OsuTextFlowContainer(t => t.Font = OsuFont.Default) + Content.Add(textDrawable = new OsuTextFlowContainer { Colour = OsuColour.Gray(128), AutoSizeAxes = Axes.Y, From be9be5dee258f08cd53112e8e01d3429293f5a4f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 20 Feb 2019 21:04:18 +0900 Subject: [PATCH 126/327] Add some xmldocs --- osu.Game/Graphics/OsuFont.cs | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index 54c6ca48a0..82c6f9e572 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -7,13 +7,33 @@ namespace osu.Game.Graphics { public struct OsuFont { + /// + /// The default font size. + /// public const float DEFAULT_FONT_SIZE = 16; + /// + /// The default font. + /// public static FontUsage Default => GetFont(); + /// + /// Retrieves a . + /// + /// The font typeface. + /// The size of the text in local space. For a value of 16, a single line will have a height of 16px. + /// The font weight. + /// Whether the font is italic. + /// Whether all characters should be spaced the same distance apart. + /// The . public static FontUsage GetFont(Typeface typeface = Typeface.Exo, float size = DEFAULT_FONT_SIZE, FontWeight weight = FontWeight.Medium, bool italics = false, bool fixedWidth = false) => new FontUsage(GetFamilyString(typeface), size, GetWeightString(typeface, weight), italics, fixedWidth); + /// + /// Retrieves the string representation of a . + /// + /// The . + /// The string representation. public static string GetFamilyString(Typeface typeface) { switch (typeface) @@ -29,9 +49,21 @@ namespace osu.Game.Graphics return null; } + /// + /// Retrieves the string representation of a . + /// + /// The . + /// The . + /// The string representation of in the specified . public static string GetWeightString(Typeface typeface, FontWeight weight) => GetWeightString(GetFamilyString(typeface), weight); + /// + /// Retrieves the string representation of a . + /// + /// The . + /// The . + /// The string representation of in the specified . public static string GetWeightString(string family, FontWeight weight) { string weightString = weight.ToString(); @@ -46,6 +78,15 @@ namespace osu.Game.Graphics public static class OsuFontExtensions { + /// + /// Creates a new by applying adjustments to this . + /// + /// The font typeface. If null, the value is copied from this . + /// The text size. If null, the value is copied from this . + /// The font weight. If null, the value is copied from this . + /// Whether the font is italic. If null, the value is copied from this . + /// Whether all characters should be spaced apart the same distance. If null, the value is copied from this . + /// The resulting . public static FontUsage With(this FontUsage usage, Typeface? typeface = null, float? size = null, FontWeight? weight = null, bool? italics = null, bool? fixedWidth = null) { string familyString = typeface != null ? OsuFont.GetFamilyString(typeface.Value) : usage.Family; From c96a2ac8536178fcdc397b3ea3afdc69860d52c6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Feb 2019 21:08:52 +0900 Subject: [PATCH 127/327] Fix non-conforming filename --- ...suReplayInputHandler.cs => OsuFramedReplayInputHandler.cs} | 4 ++-- osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) rename osu.Game.Rulesets.Osu/Replays/{OsuReplayInputHandler.cs => OsuFramedReplayInputHandler.cs} (89%) diff --git a/osu.Game.Rulesets.Osu/Replays/OsuReplayInputHandler.cs b/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs similarity index 89% rename from osu.Game.Rulesets.Osu/Replays/OsuReplayInputHandler.cs rename to osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs index 0e9a906d85..d1ac77857d 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuReplayInputHandler.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuFramedReplayInputHandler.cs @@ -11,9 +11,9 @@ using osuTK; namespace osu.Game.Rulesets.Osu.Replays { - public class OsuReplayInputHandler : FramedReplayInputHandler + public class OsuFramedReplayInputHandler : FramedReplayInputHandler { - public OsuReplayInputHandler(Replay replay) + public OsuFramedReplayInputHandler(Replay replay) : base(replay) { } diff --git a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs index 86e5f8467d..935f9c5c0d 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs @@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Osu.UI return null; } - protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new OsuReplayInputHandler(replay); + protected override ReplayInputHandler CreateReplayInputHandler(Replay replay) => new OsuFramedReplayInputHandler(replay); public override double GameplayStartTime { From 7e41fbc29bfd6e70e1f8f38474cac7344bba58ee Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 21 Feb 2019 13:12:37 +0900 Subject: [PATCH 128/327] Remove LegacyDifficultyCalculator --- .../CatchDifficultyCalculatorTest.cs | 2 +- osu.Game.Rulesets.Catch/CatchRuleset.cs | 2 +- .../ManiaDifficultyCalculatorTest.cs | 2 +- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 2 +- .../OsuDifficultyCalculatorTest.cs | 2 +- osu.Game.Rulesets.Osu/OsuRuleset.cs | 2 +- .../TaikoDifficultyCalculatorTest.cs | 2 +- osu.Game.Rulesets.Taiko/TaikoRuleset.cs | 2 +- ...DifficultyAdjustmentModCombinationsTest.cs | 20 +++- osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 2 +- .../Difficulty/DifficultyCalculator.cs | 44 ++++++- .../Difficulty/LegacyDifficultyCalculator.cs | 107 ------------------ osu.Game/Rulesets/Ruleset.cs | 2 +- .../Beatmaps/DifficultyCalculatorTest.cs | 2 +- 14 files changed, 70 insertions(+), 123 deletions(-) delete mode 100644 osu.Game/Rulesets/Difficulty/LegacyDifficultyCalculator.cs diff --git a/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs index b99dd08ef0..01c57a6b9a 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchDifficultyCalculatorTest.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Catch.Tests public void Test(double expected, string name) => base.Test(expected, name); - protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchDifficultyCalculator(new CatchRuleset(), beatmap); + protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchDifficultyCalculator(new CatchRuleset(), beatmap); protected override Ruleset CreateRuleset() => new CatchRuleset(); } diff --git a/osu.Game.Rulesets.Catch/CatchRuleset.cs b/osu.Game.Rulesets.Catch/CatchRuleset.cs index c539a47897..a69070e93e 100644 --- a/osu.Game.Rulesets.Catch/CatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/CatchRuleset.cs @@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Catch public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_fruits_o }; - public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchDifficultyCalculator(this, beatmap); + public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new CatchDifficultyCalculator(this, beatmap); public override int? LegacyID => 2; diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs index 61ee322ce2..2c36e81190 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaDifficultyCalculatorTest.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Mania.Tests public void Test(double expected, string name) => base.Test(expected, name); - protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new ManiaDifficultyCalculator(new ManiaRuleset(), beatmap); + protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new ManiaDifficultyCalculator(new ManiaRuleset(), beatmap); protected override Ruleset CreateRuleset() => new ManiaRuleset(); } diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index d86ee19802..57728dd134 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -156,7 +156,7 @@ namespace osu.Game.Rulesets.Mania public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_mania_o }; - public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new ManiaDifficultyCalculator(this, beatmap); + public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new ManiaDifficultyCalculator(this, beatmap); public override int? LegacyID => 3; diff --git a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs index edf3f35304..e55dc1f902 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuDifficultyCalculatorTest.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Tests public void Test(double expected, string name) => base.Test(expected, name); - protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset(), beatmap); + protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(new OsuRuleset(), beatmap); protected override Ruleset CreateRuleset() => new OsuRuleset(); } diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index e7dbe98919..200f4af3da 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -133,7 +133,7 @@ namespace osu.Game.Rulesets.Osu public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_osu_o }; - public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(this, beatmap); + public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new OsuDifficultyCalculator(this, beatmap); public override PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => new OsuPerformanceCalculator(this, beatmap, score); diff --git a/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs b/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs index a26b184766..e7b6d8615b 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TaikoDifficultyCalculatorTest.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Taiko.Tests public void Test(double expected, string name) => base.Test(expected, name); - protected override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoDifficultyCalculator(new TaikoRuleset(), beatmap); + protected override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoDifficultyCalculator(new TaikoRuleset(), beatmap); protected override Ruleset CreateRuleset() => new TaikoRuleset(); } diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs index b4becae7c2..7851a2f919 100644 --- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs @@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Taiko public override Drawable CreateIcon() => new SpriteIcon { Icon = FontAwesome.fa_osu_taiko_o }; - public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoDifficultyCalculator(this, beatmap); + public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => new TaikoDifficultyCalculator(this, beatmap); public override PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => new TaikoPerformanceCalculator(this, beatmap, score); diff --git a/osu.Game.Tests/NonVisual/DifficultyAdjustmentModCombinationsTest.cs b/osu.Game.Tests/NonVisual/DifficultyAdjustmentModCombinationsTest.cs index cc73cd54a2..760a033aff 100644 --- a/osu.Game.Tests/NonVisual/DifficultyAdjustmentModCombinationsTest.cs +++ b/osu.Game.Tests/NonVisual/DifficultyAdjustmentModCombinationsTest.cs @@ -2,9 +2,12 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty; +using osu.Game.Rulesets.Difficulty.Preprocessing; +using osu.Game.Rulesets.Difficulty.Skills; using osu.Game.Rulesets.Mods; namespace osu.Game.Tests.NonVisual @@ -136,7 +139,7 @@ namespace osu.Game.Tests.NonVisual public override Type[] IncompatibleMods => new[] { typeof(ModA), typeof(ModB) }; } - private class TestLegacyDifficultyCalculator : LegacyDifficultyCalculator + private class TestLegacyDifficultyCalculator : DifficultyCalculator { public TestLegacyDifficultyCalculator(params Mod[] mods) : base(null, null) @@ -146,7 +149,20 @@ namespace osu.Game.Tests.NonVisual protected override Mod[] DifficultyAdjustmentMods { get; } - protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate) => throw new NotImplementedException(); + protected override DifficultyAttributes CreateDifficultyAttributes(IBeatmap beatmap, Mod[] mods, Skill[] skills, double clockRate) + { + throw new NotImplementedException(); + } + + protected override IEnumerable CreateDifficultyHitObjects(IBeatmap beatmap, double clockRate) + { + throw new NotImplementedException(); + } + + protected override Skill[] CreateSkills(IBeatmap beatmap) + { + throw new NotImplementedException(); + } } } } diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index eb9e221ca4..0aa1697bf8 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -54,7 +54,7 @@ namespace osu.Game.Beatmaps public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new DummyBeatmapConverter { Beatmap = beatmap }; - public override LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => null; + public override DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap) => null; public override string Description => "dummy"; diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index 29ec9aae25..a5cb805300 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -4,26 +4,64 @@ using System; using System.Collections.Generic; using System.Linq; +using osu.Framework.Extensions.IEnumerableExtensions; +using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Rulesets.Difficulty.Preprocessing; using osu.Game.Rulesets.Difficulty.Skills; using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Objects; namespace osu.Game.Rulesets.Difficulty { - public abstract class DifficultyCalculator : LegacyDifficultyCalculator + public abstract class DifficultyCalculator { /// /// The length of each strain section. /// protected virtual int SectionLength => 400; + private readonly Ruleset ruleset; + private readonly WorkingBeatmap beatmap; + protected DifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) - : base(ruleset, beatmap) { + this.ruleset = ruleset; + this.beatmap = beatmap; } - protected override DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate) + /// + /// Calculates the difficulty of the beatmap using a specific mod combination. + /// + /// The mods that should be applied to the beatmap. + /// A structure describing the difficulty of the beatmap. + public DifficultyAttributes Calculate(params Mod[] mods) + { + beatmap.Mods.Value = mods; + IBeatmap playableBeatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo); + + var clock = new StopwatchClock(); + mods.OfType().ForEach(m => m.ApplyToClock(clock)); + + return calculate(playableBeatmap, mods, clock.Rate); + } + + /// + /// Calculates the difficulty of the beatmap using all mod combinations applicable to the beatmap. + /// + /// A collection of structures describing the difficulty of the beatmap for each mod combination. + public IEnumerable CalculateAll() + { + foreach (var combination in CreateDifficultyAdjustmentModCombinations()) + { + if (combination is MultiMod multi) + yield return Calculate(multi.Mods); + else + yield return Calculate(combination); + } + } + + private DifficultyAttributes calculate(IBeatmap beatmap, Mod[] mods, double clockRate) { var skills = CreateSkills(beatmap); diff --git a/osu.Game/Rulesets/Difficulty/LegacyDifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/LegacyDifficultyCalculator.cs deleted file mode 100644 index a1324601aa..0000000000 --- a/osu.Game/Rulesets/Difficulty/LegacyDifficultyCalculator.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Collections.Generic; -using System.Linq; -using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Framework.Timing; -using osu.Game.Beatmaps; -using osu.Game.Rulesets.Mods; - -namespace osu.Game.Rulesets.Difficulty -{ - public abstract class LegacyDifficultyCalculator - { - private readonly Ruleset ruleset; - private readonly WorkingBeatmap beatmap; - - protected LegacyDifficultyCalculator(Ruleset ruleset, WorkingBeatmap beatmap) - { - this.ruleset = ruleset; - this.beatmap = beatmap; - } - - /// - /// Calculates the difficulty of the beatmap using a specific mod combination. - /// - /// The mods that should be applied to the beatmap. - /// A structure describing the difficulty of the beatmap. - public DifficultyAttributes Calculate(params Mod[] mods) - { - beatmap.Mods.Value = mods; - IBeatmap playableBeatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo); - - var clock = new StopwatchClock(); - mods.OfType().ForEach(m => m.ApplyToClock(clock)); - - return Calculate(playableBeatmap, mods, clock.Rate); - } - - /// - /// Calculates the difficulty of the beatmap using all mod combinations applicable to the beatmap. - /// - /// A collection of structures describing the difficulty of the beatmap for each mod combination. - public IEnumerable CalculateAll() - { - foreach (var combination in CreateDifficultyAdjustmentModCombinations()) - { - if (combination is MultiMod multi) - yield return Calculate(multi.Mods); - else - yield return Calculate(combination); - } - } - - /// - /// Creates all combinations which adjust the difficulty. - /// - public Mod[] CreateDifficultyAdjustmentModCombinations() - { - return createDifficultyAdjustmentModCombinations(Enumerable.Empty(), DifficultyAdjustmentMods).ToArray(); - - IEnumerable createDifficultyAdjustmentModCombinations(IEnumerable currentSet, Mod[] adjustmentSet, int currentSetCount = 0, int adjustmentSetStart = 0) - { - switch (currentSetCount) - { - case 0: - // Initial-case: Empty current set - yield return new ModNoMod(); - break; - case 1: - yield return currentSet.Single(); - break; - default: - yield return new MultiMod(currentSet.ToArray()); - break; - } - - // Apply mods in the adjustment set recursively. Using the entire adjustment set would result in duplicate multi-mod mod - // combinations in further recursions, so a moving subset is used to eliminate this effect - for (int i = adjustmentSetStart; i < adjustmentSet.Length; i++) - { - var adjustmentMod = adjustmentSet[i]; - if (currentSet.Any(c => c.IncompatibleMods.Any(m => m.IsInstanceOfType(adjustmentMod)))) - continue; - - foreach (var combo in createDifficultyAdjustmentModCombinations(currentSet.Append(adjustmentMod), adjustmentSet, currentSetCount + 1, i + 1)) - yield return combo; - } - } - } - - /// - /// Retrieves all s which adjust the difficulty. - /// - protected virtual Mod[] DifficultyAdjustmentMods => Array.Empty(); - - /// - /// Calculates the difficulty of a using a specific combination. - /// - /// The to compute the difficulty for. - /// The s that should be applied. - /// The rate at which the gameplay clock is run at. - /// A structure containing the difficulty attributes. - protected abstract DifficultyAttributes Calculate(IBeatmap beatmap, Mod[] mods, double clockRate); - } -} diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index 75643a85dc..ffab0abebf 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -71,7 +71,7 @@ namespace osu.Game.Rulesets /// The . public virtual IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => null; - public abstract LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap); + public abstract DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap); public virtual PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => null; diff --git a/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs b/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs index 85ae1958ef..108fa8ff71 100644 --- a/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs +++ b/osu.Game/Tests/Beatmaps/DifficultyCalculatorTest.cs @@ -44,7 +44,7 @@ namespace osu.Game.Tests.Beatmaps return Assembly.LoadFrom(Path.Combine(localPath, $"{ResourceAssembly}.dll")).GetManifestResourceStream($@"{ResourceAssembly}.Resources.{name}"); } - protected abstract LegacyDifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap); + protected abstract DifficultyCalculator CreateDifficultyCalculator(WorkingBeatmap beatmap); protected abstract Ruleset CreateRuleset(); } From ad5e81f0cdb273c8a6ffd2d9d879339bfeb89cc5 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 21 Feb 2019 15:24:26 +0900 Subject: [PATCH 129/327] Add test case for background preview, fix unit tests --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 106 +++++++++++++----- .../Backgrounds/BackgroundScreenBeatmap.cs | 7 +- osu.Game/Screens/Play/Player.cs | 4 + osu.Game/Screens/Play/PlayerLoader.cs | 11 +- .../Play/ScreenWithBeatmapBackground.cs | 3 - 5 files changed, 93 insertions(+), 38 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 9e981952a9..9d7c1de780 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -1,8 +1,11 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Threading; using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Configuration; +using osu.Framework.Graphics; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Graphics; @@ -11,6 +14,7 @@ using osu.Game.Scoring; using osu.Game.Screens; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Play; +using osu.Game.Screens.Play.PlayerSettings; using osu.Game.Tests.Beatmaps; using osu.Game.Users; using osuTK; @@ -19,20 +23,30 @@ using osuTK.Graphics; namespace osu.Game.Tests.Visual { [TestFixture] - public class TestCaseBackgroundScreenBeatmap : ScreenTestCase + public class TestCaseBackgroundScreenBeatmap : ManualInputManagerTestCase { private DummySongSelect songSelect; - protected Player Player; + private DimAccessiblePlayerLoader playerLoader; + private DimAccessiblePlayer player; + + [Cached] + private BackgroundScreenStack backgroundStack; + public TestCaseBackgroundScreenBeatmap() { + ScreenStack screen; + InputManager.Add(backgroundStack = new BackgroundScreenStack {RelativeSizeAxes = Axes.Both}); + InputManager.Add(screen = new ScreenStack { RelativeSizeAxes = Axes.Both }); + AddStep("Load Song Select", () => { LoadComponentAsync(new DummySongSelect(), p => { songSelect = p; - LoadScreen(p); + screen.Push(p); }); }); + AddUntilStep(() => songSelect?.IsLoaded ?? false, "Wait for song select to load"); AddStep("Create beatmap", () => { @@ -53,14 +67,30 @@ namespace osu.Game.Tests.Visual }, }); }); - AddStep("Load Player", () => + + AddStep("Start player loader", () => songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer()))); + AddUntilStep(() => playerLoader?.IsLoaded ?? false, "Wait for Player Loader to load"); + AddStep("Update bindables", () => playerLoader.UpdateBindables()); + AddStep("Trigger background preview", () => { - var p = new DimAccessiblePlayer(); - songSelect.Push(Player = p); + InputManager.MoveMouseTo(playerLoader.ScreenPos); + InputManager.MoveMouseTo(playerLoader.VisualSettingsPos); }); - AddUntilStep(() => Player?.IsLoaded ?? false, "Wait for player to load"); - AddStep("Update bindables", () => ((DimAccessiblePlayer)Player).UpdateBindables()); + AddWaitStep(5, "Wait for dim"); + AddAssert("Screen is dimmed", () => songSelect.AssertDimmed()); + + AddStep("Allow beatmap to load", () => + { + player.Ready = true; + InputManager.MoveMouseTo(playerLoader.ScreenPos); + }); + + // In the case of a user triggering the dim preview the instant player gets loaded, the user dim needs to be applied when the map starts. + AddUntilStep(() => player?.IsLoaded ?? false, "Wait for player to load"); + AddStep("Trigger background preview when loaded", () => InputManager.MoveMouseTo(playerLoader.VisualSettingsPos)); + AddWaitStep(5, "Wait for dim"); + AddAssert("Screen is dimmed", () => songSelect.AssertDimmed()); } /// @@ -69,9 +99,9 @@ namespace osu.Game.Tests.Visual [Test] public void DisableUserDimTest() { - AddStep("Test User Undimming", () => ((DimAccessiblePlayer)Player).DimEnabled.Value = false); + AddStep("Test User Undimming", () => playerLoader.DimEnabled.Value = false); AddWaitStep(5, "Wait for dim"); - AddAssert("Screen is undimmed", () => ((DimAccessiblePlayer)Player).AssertUndimmed()); + AddAssert("Screen is undimmed", () => songSelect.AssertUndimmed()); } /// @@ -80,9 +110,9 @@ namespace osu.Game.Tests.Visual [Test] public void EnableUserDimTest() { - AddStep("Test User Dimming", () => ((DimAccessiblePlayer)Player).DimEnabled.Value = true); + AddStep("Test User Dimming", () => playerLoader.DimEnabled.Value = true); AddWaitStep(5, "Wait for dim"); - AddAssert("Screen is dimmed", () => ((DimAccessiblePlayer)Player).AssertDimmed()); + AddAssert("Screen is dimmed", () => songSelect.AssertDimmed()); } /// @@ -91,9 +121,9 @@ namespace osu.Game.Tests.Visual [Test] public void PauseTest() { - AddStep("Transition to Pause", () => ((DimAccessiblePlayer)Player).Exit()); + AddStep("Transition to Pause", () => player.Exit()); AddWaitStep(5, "Wait for dim"); - AddAssert("Screen is dimmed", () => ((DimAccessiblePlayer)Player).AssertDimmed()); + AddAssert("Screen is dimmed", () => songSelect.AssertDimmed()); } /// @@ -102,9 +132,9 @@ namespace osu.Game.Tests.Visual [Test] public void TransitionTest() { - AddStep("Transition to Results", () => Player.Push(new FadeAccesibleResults(new ScoreInfo { User = new User { Username = "osu!" }}))); + AddStep("Transition to Results", () => player.Push(new FadeAccesibleResults(new ScoreInfo { User = new User { Username = "osu!" }}))); AddWaitStep(5, "Wait for dim"); - AddAssert("Screen is undimmed", () => ((DimAccessiblePlayer)Player).AssertUndimmed()); + AddAssert("Screen is undimmed", () => songSelect.AssertUndimmed()); } /// @@ -115,16 +145,28 @@ namespace osu.Game.Tests.Visual { AddStep("Exit player", () => { - Player.MakeCurrent(); - Player.Exit(); + player.MakeCurrent(); + player.Exit(); }); AddWaitStep(5, "Wait for dim"); - AddAssert("Screen is undimmed", () => ((DimAccessiblePlayer)Player).AssertUndimmed()); + AddAssert("Screen is undimmed", () => songSelect.AssertUndimmed()); } private class DummySongSelect : OsuScreen { protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); + + public bool BackgroundLoaded => Background?.IsLoaded ?? false; + + public bool AssertDimmed() + { + return ((FadeAccessibleBackground)Background).AssertDimmed(); + } + + public bool AssertUndimmed() + { + return ((FadeAccessibleBackground)Background).AssertUndimmed(); + } } private class FadeAccesibleResults : SoloResults @@ -137,25 +179,35 @@ namespace osu.Game.Tests.Visual } private class DimAccessiblePlayer : Player + { + protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); + + public bool Ready; + + [BackgroundDependencyLoader] + private void load() + { + while (!Ready) + Thread.Sleep(1); + } + } + + private class DimAccessiblePlayerLoader : PlayerLoader { public Bindable DimEnabled; - protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); + public VisualSettings VisualSettingsPos => VisualSettings; + public Vector2 ScreenPos => VisualSettings.ScreenSpaceDrawQuad.BottomLeft - new Vector2(20, 20); public void UpdateBindables() { DimEnabled = Background.EnableUserDim; } - public bool AssertDimmed() + public DimAccessiblePlayerLoader(Player player) : base(() => player) { - return ((FadeAccessibleBackground)Background).AssertDimmed(); - } - - public bool AssertUndimmed() - { - return ((FadeAccessibleBackground)Background).AssertUndimmed(); } + protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); } private class FadeAccessibleBackground : BackgroundScreenBeatmap diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 1596e26ce5..2bbaee417e 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -37,9 +37,12 @@ namespace osu.Game.Screens.Backgrounds beatmap = value; + FadeContainer = new UserDimContainer { RelativeSizeAxes = Axes.Both }; + InternalChild = FadeContainer; + EnableUserDim = FadeContainer.EnableUserDim; + Schedule(() => { - FadeContainer = new UserDimContainer { RelativeSizeAxes = Axes.Both }; LoadComponentAsync(new BeatmapBackground(beatmap), b => Schedule(() => { float newDepth = 0; @@ -54,8 +57,6 @@ namespace osu.Game.Screens.Backgrounds FadeContainer.Child = Background = b; Background.BlurSigma = BlurTarget; })); - InternalChild = FadeContainer; - EnableUserDim = FadeContainer.EnableUserDim; }); } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 3826271a7e..3f9f1a83d5 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -346,6 +346,10 @@ namespace osu.Game.Screens.Play .Delay(250) .FadeIn(250); + // We need to update background elements when the user dim gets updated + // The storyboard needs to know whether or not to completely fade at 100% dim + DimLevel.ValueChanged += _ => UpdateBackgroundElements(); + ShowStoryboard.ValueChanged += _ => UpdateBackgroundElements(); Background.EnableUserDim.Value = true; Task.Run(() => diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index c8149cefef..5f3688475d 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -78,7 +78,7 @@ namespace osu.Game.Screens.Play Margin = new MarginPadding(25), Children = new PlayerSettingsGroup[] { - visualSettings = new VisualSettings(), + VisualSettings = new VisualSettings(), new InputSettings() } } @@ -153,7 +153,7 @@ namespace osu.Game.Screens.Play } private ScheduledDelegate pushDebounce; - private VisualSettings visualSettings; + protected VisualSettings VisualSettings; private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && GetContainingInputManager()?.DraggedDrawable == null; @@ -161,14 +161,14 @@ namespace osu.Game.Screens.Play { // restore our screen defaults InitializeBackgroundElements(); - if (this.IsCurrentScreen()) + if (this.IsCurrentScreen() && (Background?.IsLoaded ?? false)) Background.EnableUserDim.Value = false; return base.OnHover(e); } protected override void OnHoverLost(HoverLostEvent e) { - if (GetContainingInputManager()?.HoveredDrawables.Contains(visualSettings) == true) + if (GetContainingInputManager()?.HoveredDrawables.Contains(VisualSettings) == true) { // show user setting preview UpdateBackgroundElements(); @@ -247,7 +247,8 @@ namespace osu.Game.Screens.Play this.FadeOut(150); cancelLoad(); - Background.EnableUserDim.Value = false; + if (Background != null) + Background.EnableUserDim.Value = false; return base.OnExiting(next); } diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index f2a57b2e1d..15016d2bc2 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -37,11 +37,8 @@ namespace osu.Game.Screens.Play public override void OnEntering(IScreen last) { - // We need to update on dim here because player still needs to know if it needs to dim the storyboard base.OnEntering(last); - DimLevel.ValueChanged += _ => UpdateBackgroundElements(); BlurLevel.ValueChanged += _ => UpdateBackgroundElements(); - ShowStoryboard.ValueChanged += _ => UpdateBackgroundElements(); InitializeBackgroundElements(); } From 0677194f4664b3aa6bf7d8647001fbff061b061c Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 21 Feb 2019 18:14:58 +0900 Subject: [PATCH 130/327] Move all storyboard show logic into UserDimContainer --- .../Graphics/Containers/UserDimContainer.cs | 26 +++++++++++++++++-- .../Backgrounds/BackgroundScreenBeatmap.cs | 3 ++- osu.Game/Screens/Play/Player.cs | 13 +++------- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index 717078ab99..c0c2525175 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -13,20 +13,42 @@ namespace osu.Game.Graphics.Containers public class UserDimContainer : Container { protected Bindable DimLevel; - + protected Bindable ShowStoryboard; public Bindable EnableUserDim = new Bindable(); + public Bindable StoryboardReplacesBackground = new Bindable(); + + private readonly bool isStoryboard; + + private const float BACKGROUND_FADE_DURATION = 800; + + public UserDimContainer(bool isStoryboard = false) + { + this.isStoryboard = isStoryboard; + } [BackgroundDependencyLoader] private void load(OsuConfigManager config) { DimLevel = config.GetBindable(OsuSetting.DimLevel); + ShowStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); EnableUserDim.ValueChanged += _ => updateBackgroundDim(); DimLevel.ValueChanged += _ => updateBackgroundDim(); + ShowStoryboard.ValueChanged += _ => updateBackgroundDim(); } private void updateBackgroundDim() { - this.FadeColour(EnableUserDim ? OsuColour.Gray(1 - (float)DimLevel) : Color4.White, 800, Easing.OutQuint); + if (isStoryboard) + { + this.FadeTo(!ShowStoryboard || DimLevel == 1 ? 0 : 1, BACKGROUND_FADE_DURATION, Easing.OutQuint); + } + else + { + // The background needs to be hidden in the case of it being replaced + this.FadeTo(ShowStoryboard && StoryboardReplacesBackground ? 0 : 1, BACKGROUND_FADE_DURATION, Easing.OutQuint); + } + + this.FadeColour(EnableUserDim ? OsuColour.Gray(1 - (float)DimLevel) : Color4.White, BACKGROUND_FADE_DURATION, Easing.OutQuint); } } } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 2bbaee417e..d62cea4511 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -16,8 +16,8 @@ namespace osu.Game.Screens.Backgrounds { private WorkingBeatmap beatmap; protected Bindable DimLevel; - protected Bindable BlurLevel; public Bindable EnableUserDim; + public Bindable StoryboardReplacesBackground = new Bindable(); protected UserDimContainer FadeContainer; @@ -56,6 +56,7 @@ namespace osu.Game.Screens.Backgrounds b.Depth = newDepth; FadeContainer.Child = Background = b; Background.BlurSigma = BlurTarget; + FadeContainer.StoryboardReplacesBackground.BindTo(StoryboardReplacesBackground); })); }); } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 3f9f1a83d5..13c7703af9 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -175,7 +175,7 @@ namespace osu.Game.Screens.Play CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded, Children = new Container[] { - storyboardContainer = new UserDimContainer + storyboardContainer = new UserDimContainer(true) { RelativeSizeAxes = Axes.Both, Alpha = 0, @@ -351,6 +351,8 @@ namespace osu.Game.Screens.Play DimLevel.ValueChanged += _ => UpdateBackgroundElements(); ShowStoryboard.ValueChanged += _ => UpdateBackgroundElements(); Background.EnableUserDim.Value = true; + storyboardContainer.StoryboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable; + storyboardContainer.StoryboardReplacesBackground.BindTo(Background?.StoryboardReplacesBackground); Task.Run(() => { @@ -412,6 +414,7 @@ namespace osu.Game.Screens.Play float fadeOutDuration = instant ? 0 : 250; this.FadeOut(fadeOutDuration); Background.EnableUserDim.Value = false; + storyboardContainer.StoryboardReplacesBackground.Value = false; } protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !pauseContainer.IsPaused; @@ -440,14 +443,6 @@ namespace osu.Game.Screens.Play if (ShowStoryboard && storyboard == null) initializeStoryboard(true); - - var beatmap = Beatmap.Value; - var storyboardVisible = ShowStoryboard && beatmap.Storyboard.HasDrawable; - - storyboardContainer?.FadeTo(storyboardVisible && 1 - (float)DimLevel > 0 ? 1 : 0, BACKGROUND_FADE_DURATION, Easing.OutQuint); - - if (storyboardVisible && beatmap.Storyboard.ReplacesBackground) - Background?.FadeColour(Color4.Black, BACKGROUND_FADE_DURATION, Easing.OutQuint); } protected virtual Results CreateResults(ScoreInfo score) => new SoloResults(score); From bf06674e87b5bb610ee7e5143cb51c7a08795cce Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 21 Feb 2019 18:19:50 +0900 Subject: [PATCH 131/327] Clean up test case --- osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 9d7c1de780..b78c0b811b 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -156,8 +156,6 @@ namespace osu.Game.Tests.Visual { protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); - public bool BackgroundLoaded => Background?.IsLoaded ?? false; - public bool AssertDimmed() { return ((FadeAccessibleBackground)Background).AssertDimmed(); @@ -207,6 +205,7 @@ namespace osu.Game.Tests.Visual public DimAccessiblePlayerLoader(Player player) : base(() => player) { } + protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); } From 97db8abd5913f216089b26d6a5a8be94578febfb Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 21 Feb 2019 18:34:11 +0900 Subject: [PATCH 132/327] Remove unused includes --- osu.Game/Graphics/Containers/UserDimContainer.cs | 8 ++++---- osu.Game/Screens/Play/Player.cs | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index c0c2525175..c1dee94eeb 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -19,7 +19,7 @@ namespace osu.Game.Graphics.Containers private readonly bool isStoryboard; - private const float BACKGROUND_FADE_DURATION = 800; + private const float background_fade_duration = 800; public UserDimContainer(bool isStoryboard = false) { @@ -40,15 +40,15 @@ namespace osu.Game.Graphics.Containers { if (isStoryboard) { - this.FadeTo(!ShowStoryboard || DimLevel == 1 ? 0 : 1, BACKGROUND_FADE_DURATION, Easing.OutQuint); + this.FadeTo(!ShowStoryboard || DimLevel == 1 ? 0 : 1, background_fade_duration, Easing.OutQuint); } else { // The background needs to be hidden in the case of it being replaced - this.FadeTo(ShowStoryboard && StoryboardReplacesBackground ? 0 : 1, BACKGROUND_FADE_DURATION, Easing.OutQuint); + this.FadeTo(ShowStoryboard && StoryboardReplacesBackground ? 0 : 1, background_fade_duration, Easing.OutQuint); } - this.FadeColour(EnableUserDim ? OsuColour.Gray(1 - (float)DimLevel) : Color4.White, BACKGROUND_FADE_DURATION, Easing.OutQuint); + this.FadeColour(EnableUserDim ? OsuColour.Gray(1 - (float)DimLevel) : Color4.White, background_fade_duration, Easing.OutQuint); } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 13c7703af9..c6b6ad8821 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -31,7 +31,6 @@ using osu.Game.Scoring; using osu.Game.Screens.Ranking; using osu.Game.Skinning; using osu.Game.Storyboards.Drawables; -using osuTK.Graphics; namespace osu.Game.Screens.Play { From bca347427fcaebac1b9f8af201579dec394a44d3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 21 Feb 2019 18:56:34 +0900 Subject: [PATCH 133/327] Update with framework bindable changes --- .../Mods/CatchModFlashlight.cs | 5 +-- .../Mods/ManiaModFlashlight.cs | 3 +- .../Objects/Drawables/DrawableHoldNote.cs | 7 ++-- .../Drawables/DrawableManiaHitObject.cs | 4 +-- .../Objects/Drawables/DrawableNote.cs | 7 ++-- .../Objects/Drawables/Pieces/NotePiece.cs | 4 +-- .../Objects/ManiaHitObject.cs | 2 +- osu.Game.Rulesets.Mania/UI/Column.cs | 12 +++---- .../UI/Components/ColumnBackground.cs | 4 +-- .../UI/Components/ColumnHitObjectArea.cs | 4 +-- .../UI/Components/ColumnKeyArea.cs | 6 ++-- .../UI/ManiaRulesetContainer.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaStage.cs | 8 ++--- .../HitCircles/Components/HitCirclePiece.cs | 2 +- .../Sliders/Components/SliderBodyPiece.cs | 2 +- .../Spinners/Components/SpinnerPiece.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs | 2 +- .../Mods/OsuModFlashlight.cs | 5 +-- .../Objects/Drawables/DrawableHitCircle.cs | 2 +- .../Objects/Drawables/DrawableSlider.cs | 2 +- .../Objects/Drawables/DrawableSpinner.cs | 2 +- .../Drawables/Pieces/SnakingSliderBody.cs | 6 ++-- osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs | 6 ++-- .../UI/Cursor/GameplayCursor.cs | 8 ++--- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 2 +- .../Mods/TaikoModFlashlight.cs | 5 +-- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 2 +- osu.Game.Tests/Visual/TestCaseAutoplay.cs | 2 +- .../Visual/TestCaseBeatmapCarousel.cs | 2 +- .../Visual/TestCaseBeatmapInfoWedge.cs | 2 +- .../Visual/TestCaseChannelTabControl.cs | 2 +- osu.Game.Tests/Visual/TestCaseDrawableDate.cs | 2 +- .../Visual/TestCaseGameplayMenuOverlay.cs | 28 +++++++-------- osu.Game.Tests/Visual/TestCaseIdleTracker.cs | 2 +- .../Visual/TestCaseMatchSettingsOverlay.cs | 8 ++--- .../Visual/TestCaseNotificationOverlay.cs | 2 +- .../Visual/TestCasePlaySongSelect.cs | 4 +-- osu.Game.Tests/Visual/TestCaseScoreCounter.cs | 2 +- .../Visual/TestCaseScreenBreadcrumbControl.cs | 2 +- osu.Game.Tests/Visual/TestCaseStoryboard.cs | 9 ++--- osu.Game.Tests/Visual/TestCaseTabControl.cs | 4 +-- osu.Game/Beatmaps/BindableBeatmap.cs | 2 +- .../UpdateableBeatmapBackgroundSprite.cs | 2 +- osu.Game/Beatmaps/WorkingBeatmap.cs | 2 +- .../Configuration/DatabasedConfigManager.cs | 4 +-- osu.Game/Configuration/OsuConfigManager.cs | 8 ++--- .../Containers/OsuFocusedOverlayContainer.cs | 2 +- .../Graphics/Containers/ParallaxContainer.cs | 4 +-- .../Graphics/Containers/ScalingContainer.cs | 12 +++---- osu.Game/Graphics/Cursor/MenuCursor.cs | 4 +-- osu.Game/Graphics/ScreenshotManager.cs | 2 +- .../UserInterface/BreadcrumbControl.cs | 4 +-- .../Graphics/UserInterface/DialogButton.cs | 4 +-- osu.Game/Graphics/UserInterface/Nub.cs | 4 +-- .../UserInterface/OsuAnimatedButton.cs | 2 +- osu.Game/Graphics/UserInterface/OsuButton.cs | 7 ++-- .../Graphics/UserInterface/OsuCheckbox.cs | 4 +-- .../Graphics/UserInterface/OsuSliderBar.cs | 2 +- .../Graphics/UserInterface/OsuTabControl.cs | 8 ++--- .../UserInterface/OsuTabControlCheckbox.cs | 8 ++--- .../Graphics/UserInterface/PageTabControl.cs | 6 ++-- .../UserInterface/PercentageCounter.cs | 2 +- .../Graphics/UserInterface/RollingCounter.cs | 10 +++--- .../Graphics/UserInterface/ScoreCounter.cs | 2 +- .../UserInterface/ScreenBreadcrumbControl.cs | 2 +- .../UserInterface/SimpleComboCounter.cs | 2 +- osu.Game/Online/API/APIAccess.cs | 2 +- osu.Game/Online/Chat/ChannelManager.cs | 10 +++--- osu.Game/Online/Chat/ExternalLinkOpener.cs | 2 +- osu.Game/Online/Chat/StandAloneChatDisplay.cs | 10 +++--- osu.Game/Online/Multiplayer/Room.cs | 20 +++++------ osu.Game/OsuGame.cs | 12 +++---- osu.Game/OsuGameBase.cs | 2 +- .../Overlays/AccountCreation/ScreenEntry.cs | 2 +- osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs | 4 +-- .../BeatmapSet/Buttons/DownloadButton.cs | 14 ++++---- .../BeatmapSet/Buttons/FavouriteButton.cs | 4 +-- .../BeatmapSet/Buttons/PreviewButton.cs | 2 +- osu.Game/Overlays/BeatmapSet/Header.cs | 26 +++++++------- osu.Game/Overlays/BeatmapSetOverlay.cs | 6 ++-- .../Chat/Selection/ChannelListItem.cs | 4 +-- .../Chat/Selection/ChannelSelectionOverlay.cs | 2 +- .../Overlays/Chat/Tabs/ChannelTabControl.cs | 2 +- osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs | 4 +-- osu.Game/Overlays/ChatOverlay.cs | 26 +++++++------- osu.Game/Overlays/Direct/DirectGridPanel.cs | 2 +- osu.Game/Overlays/Direct/DirectPanel.cs | 8 ++--- osu.Game/Overlays/Direct/DownloadButton.cs | 6 ++-- .../Overlays/Direct/DownloadProgressBar.cs | 4 +-- .../Direct/DownloadTrackingComposite.cs | 8 ++--- osu.Game/Overlays/Direct/FilterControl.cs | 8 ++--- osu.Game/Overlays/Direct/PlayButton.cs | 10 +++--- osu.Game/Overlays/DirectOverlay.cs | 24 ++++++------- osu.Game/Overlays/HoldToConfirmOverlay.cs | 2 +- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 12 +++---- osu.Game/Overlays/Music/FilterControl.cs | 3 +- osu.Game/Overlays/Music/PlaylistItem.cs | 2 +- osu.Game/Overlays/MusicController.cs | 8 ++--- osu.Game/Overlays/NotificationOverlay.cs | 2 +- osu.Game/Overlays/Profile/Header/RankGraph.cs | 6 ++-- .../Profile/Sections/Kudosu/KudosuInfo.cs | 6 ++-- .../Profile/Sections/PaginatedContainer.cs | 4 +-- .../SearchableList/DisplayStyleControl.cs | 6 ++-- .../Settings/Sections/Debug/GCSettings.cs | 4 +-- .../Sections/General/LoginSettings.cs | 4 +-- .../Sections/Graphics/LayoutSettings.cs | 14 ++++---- .../Settings/Sections/Input/MouseSettings.cs | 8 ++--- .../Overlays/Settings/Sections/SkinSection.cs | 4 +-- osu.Game/Overlays/Settings/SettingsItem.cs | 2 +- osu.Game/Overlays/SettingsOverlay.cs | 6 ++-- osu.Game/Overlays/SocialOverlay.cs | 16 ++++----- osu.Game/Overlays/Toolbar/Toolbar.cs | 2 +- .../Toolbar/ToolbarNotificationButton.cs | 6 ++-- .../Toolbar/ToolbarRulesetSelector.cs | 4 +-- .../Overlays/Toolbar/ToolbarUserButton.cs | 2 +- osu.Game/Overlays/UserProfileOverlay.cs | 12 +++---- osu.Game/Overlays/Volume/MuteButton.cs | 6 ++-- osu.Game/Overlays/Volume/VolumeMeter.cs | 6 ++-- osu.Game/Overlays/VolumeOverlay.cs | 6 ++-- osu.Game/Rulesets/Mods/ModFlashlight.cs | 2 +- osu.Game/Rulesets/Mods/ModHidden.cs | 2 +- .../Objects/Drawables/DrawableHitObject.cs | 8 ++--- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 20 +++++------ osu.Game/Rulesets/UI/RulesetContainer.cs | 6 ++-- .../UI/Scrolling/ScrollingRulesetContainer.cs | 4 +-- .../Edit/Components/PlaybackControl.cs | 8 ++--- .../RadioButtons/DrawableRadioButton.cs | 12 +++---- .../RadioButtons/RadioButtonCollection.cs | 4 +-- .../Timelines/Summary/Parts/TimelinePart.cs | 4 +-- .../Compose/Components/BeatDivisorControl.cs | 12 +++---- .../Compose/Components/Timeline/Timeline.cs | 8 ++--- osu.Game/Screens/Edit/Editor.cs | 5 +-- osu.Game/Screens/Edit/EditorClock.cs | 4 +-- osu.Game/Screens/Menu/ButtonSystem.cs | 2 +- osu.Game/Screens/Menu/Intro.cs | 8 ++--- osu.Game/Screens/Menu/MainMenu.cs | 3 +- .../Screens/Multi/Components/BeatmapTitle.cs | 2 +- .../Multi/Components/BeatmapTypeInfo.cs | 4 +-- .../Multi/Components/DisableableTabControl.cs | 2 +- .../Screens/Multi/Components/ModeTypeInfo.cs | 4 +-- .../Components/MultiplayerBackgroundSprite.cs | 2 +- .../Multi/Components/ParticipantCount.cs | 2 +- .../Multi/Components/RoomStatusInfo.cs | 2 +- .../Components/StatusColouredContainer.cs | 2 +- osu.Game/Screens/Multi/Header.cs | 4 +-- .../Multi/Lounge/Components/FilterControl.cs | 4 +-- .../Lounge/Components/ParticipantInfo.cs | 12 +++---- .../Multi/Lounge/Components/RoomInspector.cs | 4 +-- .../Multi/Lounge/Components/RoomsContainer.cs | 2 +- .../Screens/Multi/Match/Components/Header.cs | 4 +-- .../Multi/Match/Components/HostInfo.cs | 2 +- .../Screens/Multi/Match/Components/Info.cs | 6 ++-- .../Match/Components/MatchChatDisplay.cs | 4 +-- .../Match/Components/MatchLeaderboard.cs | 4 +-- .../Match/Components/MatchSettingsOverlay.cs | 14 ++++---- .../Multi/Match/Components/MatchTabControl.cs | 6 ++-- .../Multi/Match/Components/Participants.cs | 4 +-- .../Multi/Match/Components/ReadyButton.cs | 4 +-- .../Match/Components/ViewBeatmapButton.cs | 2 +- .../Screens/Multi/Match/MatchSubScreen.cs | 18 +++++----- osu.Game/Screens/Multi/Multiplayer.cs | 2 +- .../Screens/Multi/Ranking/MatchResults.cs | 6 ++-- osu.Game/Screens/Multi/RoomManager.cs | 2 +- osu.Game/Screens/Play/Break/BreakInfoLine.cs | 4 +-- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 4 +-- osu.Game/Screens/Play/HUD/ComboCounter.cs | 16 ++++----- .../Screens/Play/HUD/ComboResultCounter.cs | 2 +- osu.Game/Screens/Play/HUD/HealthDisplay.cs | 2 +- .../Screens/Play/HUD/HoldForMenuButton.cs | 2 +- osu.Game/Screens/Play/HUD/ModDisplay.cs | 4 +-- osu.Game/Screens/Play/HUDOverlay.cs | 12 +++---- osu.Game/Screens/Play/PauseContainer.cs | 6 ++-- osu.Game/Screens/Play/Player.cs | 14 ++++---- .../Play/PlayerSettings/PlaybackSettings.cs | 2 +- .../Play/ScreenWithBeatmapBackground.cs | 2 +- osu.Game/Screens/Play/SkipOverlay.cs | 2 +- osu.Game/Screens/Play/SongProgress.cs | 2 +- osu.Game/Screens/Ranking/Results.cs | 4 +-- osu.Game/Screens/Select/BeatmapCarousel.cs | 34 +++++++++---------- .../Select/BeatmapDetailAreaTabControl.cs | 6 ++-- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 +-- .../Select/Carousel/CarouselBeatmapSet.cs | 2 +- .../Screens/Select/Carousel/CarouselGroup.cs | 8 ++--- .../Carousel/CarouselGroupEagerSelect.cs | 12 +++---- .../Screens/Select/Carousel/CarouselItem.cs | 6 ++-- .../Carousel/DrawableCarouselBeatmap.cs | 2 +- .../Carousel/DrawableCarouselBeatmapSet.cs | 4 +-- osu.Game/Screens/Select/FilterControl.cs | 10 +++--- osu.Game/Screens/Select/SongSelect.cs | 16 ++++----- .../Skinning/LocalSkinOverrideContainer.cs | 8 ++--- osu.Game/Skinning/SkinManager.cs | 6 ++-- osu.Game/Tests/Visual/EditorClockTestCase.cs | 7 ++-- osu.Game/Tests/Visual/MultiplayerTestCase.cs | 2 +- osu.Game/Users/Avatar.cs | 4 +-- osu.Game/Users/UserPanel.cs | 4 +-- 195 files changed, 567 insertions(+), 555 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs index 4f5d7abfd4..e5a7c6aeed 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.UI; @@ -55,9 +56,9 @@ namespace osu.Game.Rulesets.Catch.Mods return default_flashlight_size; } - protected override void OnComboChange(int newCombo) + protected override void OnComboChange(ValueChangedEvent e) { - this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(newCombo)), FLASHLIGHT_FADE_DURATION); + this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(e.NewValue)), FLASHLIGHT_FADE_DURATION); } protected override string FragmentShader => "CircularFlashlight"; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs index baa757008f..85fbf05a8b 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Caching; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mods; @@ -51,7 +52,7 @@ namespace osu.Game.Rulesets.Mania.Mods } } - protected override void OnComboChange(int newCombo) + protected override void OnComboChange(ValueChangedEvent e) { } diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index 8b2da60a9e..1b7c39a391 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Linq; +using osu.Framework.Configuration; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; @@ -75,11 +76,11 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables AddNested(Tail); } - protected override void OnDirectionChanged(ScrollingDirection direction) + protected override void OnDirectionChanged(ValueChangedEvent e) { - base.OnDirectionChanged(direction); + base.OnDirectionChanged(e); - bodyPiece.Anchor = bodyPiece.Origin = direction == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; + bodyPiece.Anchor = bodyPiece.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; } public override Color4 AccentColour diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs index bc34648dd8..acfe126a1e 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs @@ -41,9 +41,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables protected override bool ShouldBeAlive => AlwaysAlive || base.ShouldBeAlive; - protected virtual void OnDirectionChanged(ScrollingDirection direction) + protected virtual void OnDirectionChanged(ValueChangedEvent e) { - Anchor = Origin = direction == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; + Anchor = Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; } } diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs index 7ed8e89f95..b7d4ad46c8 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osuTK.Graphics; using osu.Framework.Graphics; @@ -31,11 +32,11 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables InternalChild = headPiece = new NotePiece(); } - protected override void OnDirectionChanged(ScrollingDirection direction) + protected override void OnDirectionChanged(ValueChangedEvent e) { - base.OnDirectionChanged(direction); + base.OnDirectionChanged(e); - headPiece.Anchor = headPiece.Origin = direction == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; + headPiece.Anchor = headPiece.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; } public override Color4 AccentColour diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs index 65a376a3a8..8e749256b4 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs @@ -49,9 +49,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces private void load(IScrollingInfo scrollingInfo) { direction.BindTo(scrollingInfo.Direction); - direction.BindValueChanged(direction => + direction.BindValueChanged(e => { - colouredBox.Anchor = colouredBox.Origin = direction == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; + colouredBox.Anchor = colouredBox.Origin = direction.Value == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; }, true); } diff --git a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs index 5765817b63..3922c80c63 100644 --- a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Mania.Objects public virtual int Column { - get => ColumnBindable; + get => ColumnBindable.Value; set => ColumnBindable.Value = value; } diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index 3e7884af6c..2db5b1dcf2 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -82,15 +82,15 @@ namespace osu.Game.Rulesets.Mania.UI TopLevelContainer.Add(explosionContainer.CreateProxy()); - Direction.BindValueChanged(d => + Direction.BindValueChanged(e => { hitTargetContainer.Padding = new MarginPadding { - Top = d == ScrollingDirection.Up ? ManiaStage.HIT_TARGET_POSITION : 0, - Bottom = d == ScrollingDirection.Down ? ManiaStage.HIT_TARGET_POSITION : 0, + Top = e.NewValue == ScrollingDirection.Up ? ManiaStage.HIT_TARGET_POSITION : 0, + Bottom = e.NewValue == ScrollingDirection.Down ? ManiaStage.HIT_TARGET_POSITION : 0, }; - keyArea.Anchor = keyArea.Origin= d == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; + keyArea.Anchor = keyArea.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; }, true); } @@ -156,7 +156,7 @@ namespace osu.Game.Rulesets.Mania.UI internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result) { - if (!result.IsHit || !judgedObject.DisplayResult || !DisplayJudgements) + if (!result.IsHit || !judgedObject.DisplayResult || !DisplayJudgements.Value) return; explosionContainer.Add(new HitExplosion(judgedObject) @@ -167,7 +167,7 @@ namespace osu.Game.Rulesets.Mania.UI public bool OnPressed(ManiaAction action) { - if (action != Action) + if (action != Action.Value) return false; var nextObject = diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs index b7f291b5a2..f0fcf37104 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs @@ -48,9 +48,9 @@ namespace osu.Game.Rulesets.Mania.UI.Components }; direction.BindTo(scrollingInfo.Direction); - direction.BindValueChanged(direction => + direction.BindValueChanged(e => { - backgroundOverlay.Anchor = backgroundOverlay.Origin = direction == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; + backgroundOverlay.Anchor = backgroundOverlay.Origin = direction.Value == 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 7f5687e600..6f0c1b743a 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs @@ -49,9 +49,9 @@ namespace osu.Game.Rulesets.Mania.UI.Components private void load(IScrollingInfo scrollingInfo) { direction.BindTo(scrollingInfo.Direction); - direction.BindValueChanged(direction => + direction.BindValueChanged(e => { - Anchor anchor = direction == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; + Anchor anchor = direction.Value == 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 a180ffbd3b..a07611da31 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs @@ -64,11 +64,11 @@ namespace osu.Game.Rulesets.Mania.UI.Components }; direction.BindTo(scrollingInfo.Direction); - direction.BindValueChanged(direction => + direction.BindValueChanged(e => { gradient.Colour = ColourInfo.GradientVertical( - direction == ScrollingDirection.Up ? Color4.Black : Color4.Black.Opacity(0), - direction == ScrollingDirection.Up ? Color4.Black.Opacity(0) : Color4.Black); + direction.Value == ScrollingDirection.Up ? Color4.Black : Color4.Black.Opacity(0), + direction.Value == ScrollingDirection.Up ? Color4.Black.Opacity(0) : Color4.Black); }, true); } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index 892ad584dc..4a0a1ca506 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Mania.UI BarLines.ForEach(Playfield.Add); Config.BindWith(ManiaSetting.ScrollDirection, configDirection); - configDirection.BindValueChanged(v => Direction.Value = (ScrollingDirection)v, true); + configDirection.BindValueChanged(e => Direction.Value = (ScrollingDirection)e.NewValue, true); Config.BindWith(ManiaSetting.ScrollTime, TimeRange); } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs index bce333ff34..885fe29ccc 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs @@ -136,12 +136,12 @@ namespace osu.Game.Rulesets.Mania.UI AddColumn(column); } - Direction.BindValueChanged(d => + Direction.BindValueChanged(e => { barLineContainer.Padding = new MarginPadding { - Top = d == ScrollingDirection.Up ? HIT_TARGET_POSITION : 0, - Bottom = d == ScrollingDirection.Down ? HIT_TARGET_POSITION : 0, + Top = e.NewValue == ScrollingDirection.Up ? HIT_TARGET_POSITION : 0, + Bottom = e.NewValue == ScrollingDirection.Down ? HIT_TARGET_POSITION : 0, }; }, true); } @@ -185,7 +185,7 @@ namespace osu.Game.Rulesets.Mania.UI internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result) { - if (!judgedObject.DisplayResult || !DisplayJudgements) + if (!judgedObject.DisplayResult || !DisplayJudgements.Value) return; judgements.Clear(); diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs index 5958b32f33..42ff029126 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components PositionBindable.BindValueChanged(_ => UpdatePosition(), true); StackHeightBindable.BindValueChanged(_ => UpdatePosition()); - ScaleBindable.BindValueChanged(v => Scale = new Vector2(v), true); + ScaleBindable.BindValueChanged(e => Scale = new Vector2(e.NewValue), true); } protected virtual void UpdatePosition() => Position = hitCircle.StackedPosition; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs index cb9b5211d4..1bc0c2cfb5 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components body.BorderColour = colours.Yellow; PositionBindable.BindValueChanged(_ => updatePosition(), true); - ScaleBindable.BindValueChanged(v => body.PathWidth = v * 64, true); + ScaleBindable.BindValueChanged(e => body.PathWidth = e.NewValue * 64, true); } private void updatePosition() => Position = slider.StackedPosition; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs index 7f91bc49eb..d7c9bcee69 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs @@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components PositionBindable.BindValueChanged(_ => updatePosition(), true); StackHeightBindable.BindValueChanged(_ => updatePosition()); - ScaleBindable.BindValueChanged(v => ring.Scale = new Vector2(v), true); + ScaleBindable.BindValueChanged(e => ring.Scale = new Vector2(e.NewValue), true); } private void updatePosition() => Position = spinner.Position; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs b/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs index 19b627b560..a1b53977fe 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Osu.Mods public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) { - scoreProcessor.Health.ValueChanged += val => { blinds.AnimateClosedness((float)val); }; + scoreProcessor.Health.ValueChanged += e => { blinds.AnimateClosedness((float)e.NewValue); }; } /// diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index ba82465a78..b0367deef7 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Input; using osu.Framework.Input.Events; @@ -41,9 +42,9 @@ namespace osu.Game.Rulesets.Osu.Mods return default_flashlight_size; } - protected override void OnComboChange(int newCombo) + protected override void OnComboChange(ValueChangedEvent e) { - this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(newCombo)), FLASHLIGHT_FADE_DURATION); + this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(e.NewValue)), FLASHLIGHT_FADE_DURATION); } protected override string FragmentShader => "CircularFlashlight"; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 7dd2fa69ce..8d173b6fa6 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -91,7 +91,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); stackHeightBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); - scaleBindable.BindValueChanged(v => scaleContainer.Scale = new Vector2(v), true); + scaleBindable.BindValueChanged(e => scaleContainer.Scale = new Vector2(e.NewValue), true); positionBindable.BindTo(HitObject.PositionBindable); stackHeightBindable.BindTo(HitObject.StackHeightBindable); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index ca9a27976e..31102d0dc8 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -99,7 +99,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables config.BindWith(OsuSetting.SnakingOutSliders, Body.SnakingOut); positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); - scaleBindable.BindValueChanged(v => + scaleBindable.BindValueChanged(e => { Body.PathWidth = HitObject.Scale * 64; Ball.Scale = new Vector2(HitObject.Scale); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index c411b562e4..811349f56e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -130,7 +130,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables circle.Colour = colours.BlueDark; glow.Colour = colours.BlueDark; - positionBindable.BindValueChanged(v => Position = v); + positionBindable.BindValueChanged(e => Position = e.NewValue); positionBindable.BindTo(HitObject.PositionBindable); } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs index 256cd088de..b3b7c9a95a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs @@ -54,18 +54,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces var spanProgress = slider.ProgressAt(completionProgress); double start = 0; - double end = SnakingIn ? MathHelper.Clamp((Time.Current - (slider.StartTime - slider.TimePreempt)) / slider.TimeFadeIn, 0, 1) : 1; + double end = SnakingIn.Value ? MathHelper.Clamp((Time.Current - (slider.StartTime - slider.TimePreempt)) / slider.TimeFadeIn, 0, 1) : 1; if (span >= slider.SpanCount() - 1) { if (Math.Min(span, slider.SpanCount() - 1) % 2 == 1) { start = 0; - end = SnakingOut ? spanProgress : 1; + end = SnakingOut.Value ? spanProgress : 1; } else { - start = SnakingOut ? spanProgress : 0; + start = SnakingOut.Value ? spanProgress : 0; } } diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index a2e518ace4..3e3a6395a9 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Objects public virtual Vector2 Position { - get => PositionBindable; + get => PositionBindable.Value; set => PositionBindable.Value = value; } @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Osu.Objects public int StackHeight { - get => StackHeightBindable; + get => StackHeightBindable.Value; set => StackHeightBindable.Value = value; } @@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Osu.Objects public float Scale { - get => ScaleBindable; + get => ScaleBindable.Value; set => ScaleBindable.Value = value; } diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs index 3167e93923..18518f366f 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 += v => calculateScale(); + this.beatmap.ValueChanged += e => calculateScale(); cursorScale = config.GetBindable(OsuSetting.GameplayCursorSize); - cursorScale.ValueChanged += v => calculateScale(); + cursorScale.ValueChanged += e => calculateScale(); autoCursorScale = config.GetBindable(OsuSetting.AutoCursorSize); - autoCursorScale.ValueChanged += v => calculateScale(); + autoCursorScale.ValueChanged += e => calculateScale(); calculateScale(); } @@ -198,7 +198,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor { float scale = (float)cursorScale.Value; - if (autoCursorScale && beatmap.Value != null) + if (autoCursorScale.Value && beatmap.Value != null) { // if we have a beatmap available, let's get its circle size to figure out an automatic cursor scale modifier. scale *= (float)(1 - 0.7 * (1 + beatmap.Value.BeatmapInfo.BaseDifficulty.CircleSize - BeatmapDifficulty.DEFAULT_DIFFICULTY) / BeatmapDifficulty.DEFAULT_DIFFICULTY); diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index c4097ccb46..08f9e8785d 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -72,7 +72,7 @@ namespace osu.Game.Rulesets.Osu.UI private void onNewResult(DrawableHitObject judgedObject, JudgementResult result) { - if (!judgedObject.DisplayResult || !DisplayJudgements) + if (!judgedObject.DisplayResult || !DisplayJudgements.Value) return; DrawableOsuJudgement explosion = new DrawableOsuJudgement(result, judgedObject) diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs index c7e6771b80..c0e371bcbd 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Caching; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Taiko.Objects; @@ -48,9 +49,9 @@ namespace osu.Game.Rulesets.Taiko.Mods return default_flashlight_size; } - protected override void OnComboChange(int newCombo) + protected override void OnComboChange(ValueChangedEvent e) { - this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(newCombo)), FLASHLIGHT_FADE_DURATION); + this.TransformTo(nameof(FlashlightSize), new Vector2(0, getSizeFor(e.NewValue)), FLASHLIGHT_FADE_DURATION); } protected override string FragmentShader => "CircularFlashlight"; diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index 8dc9a2ca37..cb527adb98 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -225,7 +225,7 @@ namespace osu.Game.Rulesets.Taiko.UI internal void OnNewResult(DrawableHitObject judgedObject, JudgementResult result) { - if (!DisplayJudgements) + if (!DisplayJudgements.Value) return; if (!judgedObject.DisplayResult) diff --git a/osu.Game.Tests/Visual/TestCaseAutoplay.cs b/osu.Game.Tests/Visual/TestCaseAutoplay.cs index 3f3d62377e..61339a6af8 100644 --- a/osu.Game.Tests/Visual/TestCaseAutoplay.cs +++ b/osu.Game.Tests/Visual/TestCaseAutoplay.cs @@ -27,7 +27,7 @@ namespace osu.Game.Tests.Visual protected override void AddCheckSteps(Func player) { base.AddCheckSteps(player); - AddUntilStep(() => ((ScoreAccessiblePlayer)player()).ScoreProcessor.TotalScore > 0, "score above zero"); + AddUntilStep(() => ((ScoreAccessiblePlayer)player()).ScoreProcessor.TotalScore.Value > 0, "score above zero"); AddUntilStep(() => ((ScoreAccessiblePlayer)player()).HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 0), "key counter counted keys"); } diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs b/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs index e61bca9846..99bdb05394 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs @@ -147,7 +147,7 @@ namespace osu.Game.Tests.Visual private bool selectedBeatmapVisible() { - var currentlySelected = carousel.Items.Find(s => s.Item is CarouselBeatmap && s.Item.State == CarouselItemState.Selected); + var currentlySelected = carousel.Items.Find(s => s.Item is CarouselBeatmap && s.Item.State.Value == CarouselItemState.Selected); if (currentlySelected == null) return true; return currentlySelected.Item.Visible; diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs index d3056f0b13..31bb8b64a3 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs @@ -50,7 +50,7 @@ namespace osu.Game.Tests.Visual AddStep("show", () => { infoWedge.State = Visibility.Visible; - infoWedge.Beatmap = Beatmap; + infoWedge.Beatmap = Beatmap.Value; }); // select part is redundant, but wait for load isn't diff --git a/osu.Game.Tests/Visual/TestCaseChannelTabControl.cs b/osu.Game.Tests/Visual/TestCaseChannelTabControl.cs index 6e60eb3306..29442f2b45 100644 --- a/osu.Game.Tests/Visual/TestCaseChannelTabControl.cs +++ b/osu.Game.Tests/Visual/TestCaseChannelTabControl.cs @@ -69,7 +69,7 @@ namespace osu.Game.Tests.Visual }); channelTabControl.OnRequestLeave += channel => channelTabControl.RemoveChannel(channel); - channelTabControl.Current.ValueChanged += channel => currentText.Text = "Currently selected channel: " + channel.ToString(); + channelTabControl.Current.ValueChanged += e => currentText.Text = "Currently selected channel: " + e.NewValue.ToString(); AddStep("Add random private channel", addRandomPrivateChannel); AddAssert("There is only one channels", () => channelTabControl.Items.Count() == 2); diff --git a/osu.Game.Tests/Visual/TestCaseDrawableDate.cs b/osu.Game.Tests/Visual/TestCaseDrawableDate.cs index 839f2a82de..199e8ef145 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 += v => flash.FadeOutFromOne(500); + drawableDate.Current.ValueChanged += e => flash.FadeOutFromOne(500); } } } diff --git a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs index c5abe03dbd..3f36365a05 100644 --- a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs @@ -76,7 +76,7 @@ namespace osu.Game.Tests.Visual AddStep("Hover first button", () => InputManager.MoveMouseTo(failOverlay.Buttons.First())); AddStep("Hide overlay", () => failOverlay.Hide()); - AddAssert("Overlay state is reset", () => !failOverlay.Buttons.Any(b => b.Selected)); + AddAssert("Overlay state is reset", () => !failOverlay.Buttons.Any(b => b.Selected.Value)); } private void press(Key key) @@ -106,7 +106,7 @@ namespace osu.Game.Tests.Visual AddStep("Show overlay", () => pauseOverlay.Show()); AddStep("Up arrow", () => press(Key.Up)); - AddAssert("Last button selected", () => pauseOverlay.Buttons.Last().Selected); + AddAssert("Last button selected", () => pauseOverlay.Buttons.Last().Selected.Value); AddStep("Hide overlay", () => pauseOverlay.Hide()); } @@ -119,7 +119,7 @@ namespace osu.Game.Tests.Visual AddStep("Show overlay", () => pauseOverlay.Show()); AddStep("Down arrow", () => press(Key.Down)); - AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected); + AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected.Value); AddStep("Hide overlay", () => pauseOverlay.Hide()); } @@ -132,11 +132,11 @@ namespace osu.Game.Tests.Visual AddStep("Show overlay", () => failOverlay.Show()); AddStep("Up arrow", () => press(Key.Up)); - AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected); + AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected.Value); AddStep("Up arrow", () => press(Key.Up)); - AddAssert("First button selected", () => failOverlay.Buttons.First().Selected); + AddAssert("First button selected", () => failOverlay.Buttons.First().Selected.Value); AddStep("Up arrow", () => press(Key.Up)); - AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected); + AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected.Value); AddStep("Hide overlay", () => failOverlay.Hide()); } @@ -149,11 +149,11 @@ namespace osu.Game.Tests.Visual AddStep("Show overlay", () => failOverlay.Show()); AddStep("Down arrow", () => press(Key.Down)); - AddAssert("First button selected", () => failOverlay.Buttons.First().Selected); + AddAssert("First button selected", () => failOverlay.Buttons.First().Selected.Value); AddStep("Down arrow", () => press(Key.Down)); - AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected); + AddAssert("Last button selected", () => failOverlay.Buttons.Last().Selected.Value); AddStep("Down arrow", () => press(Key.Down)); - AddAssert("First button selected", () => failOverlay.Buttons.First().Selected); + AddAssert("First button selected", () => failOverlay.Buttons.First().Selected.Value); AddStep("Hide overlay", () => failOverlay.Hide()); } @@ -169,8 +169,8 @@ namespace osu.Game.Tests.Visual AddStep("Down arrow", () => press(Key.Down)); AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton)); - AddAssert("First button not selected", () => !pauseOverlay.Buttons.First().Selected); - AddAssert("Second button selected", () => secondButton.Selected); + AddAssert("First button not selected", () => !pauseOverlay.Buttons.First().Selected.Value); + AddAssert("Second button selected", () => secondButton.Selected.Value); AddStep("Hide overlay", () => pauseOverlay.Hide()); } @@ -190,8 +190,8 @@ namespace osu.Game.Tests.Visual AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton)); AddStep("Up arrow", () => press(Key.Up)); - AddAssert("Second button not selected", () => !secondButton.Selected); - AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected); + AddAssert("Second button not selected", () => !secondButton.Selected.Value); + AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected.Value); AddStep("Hide overlay", () => pauseOverlay.Hide()); } @@ -208,7 +208,7 @@ namespace osu.Game.Tests.Visual AddStep("Hover second button", () => InputManager.MoveMouseTo(secondButton)); AddStep("Unhover second button", () => InputManager.MoveMouseTo(Vector2.Zero)); AddStep("Down arrow", () => press(Key.Down)); - AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected); // Initial state condition + AddAssert("First button selected", () => pauseOverlay.Buttons.First().Selected.Value); // Initial state condition AddStep("Hide overlay", () => pauseOverlay.Hide()); } diff --git a/osu.Game.Tests/Visual/TestCaseIdleTracker.cs b/osu.Game.Tests/Visual/TestCaseIdleTracker.cs index ea669af28c..6a102b67b9 100644 --- a/osu.Game.Tests/Visual/TestCaseIdleTracker.cs +++ b/osu.Game.Tests/Visual/TestCaseIdleTracker.cs @@ -128,7 +128,7 @@ namespace osu.Game.Tests.Visual }, }; - idleTracker.IsIdle.BindValueChanged(idle => box.Colour = idle ? Color4.White : Color4.Black, true); + idleTracker.IsIdle.BindValueChanged(e => box.Colour = e.NewValue ? Color4.White : Color4.Black, true); } } } diff --git a/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs b/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs index 317707a77e..94ccf8aa57 100644 --- a/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs @@ -52,16 +52,16 @@ namespace osu.Game.Tests.Visual Room.Playlist.Clear(); }); - AddAssert("button disabled", () => !settings.ApplyButton.Enabled); + AddAssert("button disabled", () => !settings.ApplyButton.Enabled.Value); AddStep("set name", () => Room.Name.Value = "Room name"); - AddAssert("button disabled", () => !settings.ApplyButton.Enabled); + AddAssert("button disabled", () => !settings.ApplyButton.Enabled.Value); AddStep("set beatmap", () => Room.Playlist.Add(new PlaylistItem { Beatmap = new DummyWorkingBeatmap().BeatmapInfo })); - AddAssert("button enabled", () => settings.ApplyButton.Enabled); + AddAssert("button enabled", () => settings.ApplyButton.Enabled.Value); AddStep("clear name", () => Room.Name.Value = ""); - AddAssert("button disabled", () => !settings.ApplyButton.Enabled); + AddAssert("button disabled", () => !settings.ApplyButton.Enabled.Value); } [Test] diff --git a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs index 109c2ed916..955c3f9a80 100644 --- a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs @@ -47,7 +47,7 @@ namespace osu.Game.Tests.Visual void setState(Visibility state) => AddStep(state.ToString(), () => manager.State = state); void checkProgressingCount(int expected) => AddAssert($"progressing count is {expected}", () => progressingNotifications.Count == expected); - manager.UnreadCount.ValueChanged += count => { displayedCount.Text = $"displayed count: {count}"; }; + manager.UnreadCount.ValueChanged += e => { displayedCount.Text = $"displayed count: {e.NewValue}"; }; setState(Visibility.Visible); AddStep(@"simple #1", sendHelloNotification); diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index 78e90987b1..35f5789502 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -187,8 +187,8 @@ namespace osu.Game.Tests.Visual AddAssert("mods changed before ruleset", () => modChangeIndex < rulesetChangeIndex); AddAssert("empty mods", () => !selectedMods.Value.Any()); - void onModChange(IEnumerable mods) => modChangeIndex = actionIndex++; - void onRulesetChange(RulesetInfo ruleset) => rulesetChangeIndex = actionIndex--; + void onModChange(ValueChangedEvent> e) => modChangeIndex = actionIndex++; + void onRulesetChange(ValueChangedEvent e) => rulesetChangeIndex = actionIndex--; } [Test] diff --git a/osu.Game.Tests/Visual/TestCaseScoreCounter.cs b/osu.Game.Tests/Visual/TestCaseScoreCounter.cs index e4e80e4017..3519ea67a6 100644 --- a/osu.Game.Tests/Visual/TestCaseScoreCounter.cs +++ b/osu.Game.Tests/Visual/TestCaseScoreCounter.cs @@ -74,7 +74,7 @@ namespace osu.Game.Tests.Visual AddStep(@"Hit! :D", delegate { - score.Current.Value += 300 + (ulong)(300.0 * (comboCounter.Current > 0 ? comboCounter.Current - 1 : 0) / 25.0); + score.Current.Value += 300 + (ulong)(300.0 * (comboCounter.Current.Value > 0 ? comboCounter.Current.Value - 1 : 0) / 25.0); comboCounter.Increment(); numerator++; denominator++; diff --git a/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs b/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs index 7202861833..1d89be59f8 100644 --- a/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs +++ b/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs @@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual }, }; - breadcrumbs.Current.ValueChanged += s => titleText.Text = $"Changed to {s.ToString()}"; + breadcrumbs.Current.ValueChanged += e => titleText.Text = $"Changed to {e.NewValue.ToString()}"; breadcrumbs.Current.TriggerChange(); waitForCurrent(); diff --git a/osu.Game.Tests/Visual/TestCaseStoryboard.cs b/osu.Game.Tests/Visual/TestCaseStoryboard.cs index a4ad213116..eca8ac0aa8 100644 --- a/osu.Game.Tests/Visual/TestCaseStoryboard.cs +++ b/osu.Game.Tests/Visual/TestCaseStoryboard.cs @@ -3,6 +3,7 @@ using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -58,15 +59,15 @@ namespace osu.Game.Tests.Visual Beatmap.ValueChanged += beatmapChanged; } - private void beatmapChanged(WorkingBeatmap working) - => loadStoryboard(working); + private void beatmapChanged(ValueChangedEvent e) + => loadStoryboard(e.NewValue); private void restart() { var track = Beatmap.Value.Track; track.Reset(); - loadStoryboard(Beatmap); + loadStoryboard(Beatmap.Value); track.Start(); } @@ -78,7 +79,7 @@ namespace osu.Game.Tests.Visual var decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = true }; storyboardContainer.Clock = decoupledClock; - storyboard = working.Storyboard.CreateDrawable(Beatmap); + storyboard = working.Storyboard.CreateDrawable(Beatmap.Value); storyboard.Passing = false; storyboardContainer.Add(storyboard); diff --git a/osu.Game.Tests/Visual/TestCaseTabControl.cs b/osu.Game.Tests/Visual/TestCaseTabControl.cs index 82f56cb0f8..41b152760a 100644 --- a/osu.Game.Tests/Visual/TestCaseTabControl.cs +++ b/osu.Game.Tests/Visual/TestCaseTabControl.cs @@ -33,9 +33,9 @@ namespace osu.Game.Tests.Visual filter.PinItem(GroupMode.All); filter.PinItem(GroupMode.RecentlyPlayed); - filter.Current.ValueChanged += newFilter => + filter.Current.ValueChanged += e => { - text.Text = "Currently Selected: " + newFilter.ToString(); + text.Text = "Currently Selected: " + e.NewValue.ToString(); }; } } diff --git a/osu.Game/Beatmaps/BindableBeatmap.cs b/osu.Game/Beatmaps/BindableBeatmap.cs index ca03aac685..340b727469 100644 --- a/osu.Game/Beatmaps/BindableBeatmap.cs +++ b/osu.Game/Beatmaps/BindableBeatmap.cs @@ -34,7 +34,7 @@ namespace osu.Game.Beatmaps this.audioManager = audioManager; - ValueChanged += registerAudioTrack; + ValueChanged += e => registerAudioTrack(e.NewValue); // If the track has changed prior to this being called, let's register it if (Value != Default) diff --git a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs index d1d30a7c29..1210cff0a5 100644 --- a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs +++ b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs @@ -20,7 +20,7 @@ namespace osu.Game.Beatmaps.Drawables public UpdateableBeatmapBackgroundSprite() { - Beatmap.BindValueChanged(b => Model = b); + Beatmap.BindValueChanged(e => Model = e.NewValue); } protected override Drawable CreateDrawable(BeatmapInfo model) diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 18ff97e079..70ed761271 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 += mods => applyRateAdjustments(); + Mods.ValueChanged += e => applyRateAdjustments(); beatmap = new RecyclableLazy(() => { diff --git a/osu.Game/Configuration/DatabasedConfigManager.cs b/osu.Game/Configuration/DatabasedConfigManager.cs index e218f31f83..183fb98b89 100644 --- a/osu.Game/Configuration/DatabasedConfigManager.cs +++ b/osu.Game/Configuration/DatabasedConfigManager.cs @@ -60,9 +60,9 @@ namespace osu.Game.Configuration databasedSettings.Add(setting); } - bindable.ValueChanged += v => + bindable.ValueChanged += e => { - setting.Value = v; + setting.Value = e.NewValue; settings.Update(setting); }; } diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 613efe1801..471bf9a44e 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -33,14 +33,14 @@ namespace osu.Game.Configuration Set(OsuSetting.Username, string.Empty); Set(OsuSetting.Token, string.Empty); - Set(OsuSetting.SavePassword, false).ValueChanged += val => + Set(OsuSetting.SavePassword, false).ValueChanged += e => { - if (val) Set(OsuSetting.SaveUsername, true); + if (e.NewValue) Set(OsuSetting.SaveUsername, true); }; - Set(OsuSetting.SaveUsername, true).ValueChanged += val => + Set(OsuSetting.SaveUsername, true).ValueChanged += e => { - if (!val) Set(OsuSetting.SavePassword, false); + if (!e.NewValue) Set(OsuSetting.SavePassword, false); }; Set(OsuSetting.ExternalLinkWarning, true); diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 3c4d94e970..c4a84d089d 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -90,7 +90,7 @@ namespace osu.Game.Graphics.Containers switch (visibility) { case Visibility.Visible: - if (OverlayActivationMode != OverlayActivation.Disabled) + if (OverlayActivationMode.Value != OverlayActivation.Disabled) { if (PlaySamplesOnStateChange) samplePopIn?.Play(); } diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index f7d30dc109..21e200e0f8 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -45,7 +45,7 @@ namespace osu.Game.Graphics.Containers parallaxEnabled = config.GetBindable(OsuSetting.MenuParallax); parallaxEnabled.ValueChanged += delegate { - if (!parallaxEnabled) + if (!parallaxEnabled.Value) { content.MoveTo(Vector2.Zero, firstUpdate ? 0 : 1000, Easing.OutQuint); content.Scale = new Vector2(1 + System.Math.Abs(ParallaxAmount)); @@ -65,7 +65,7 @@ namespace osu.Game.Graphics.Containers { base.Update(); - if (parallaxEnabled) + if (parallaxEnabled.Value) { Vector2 offset = (input.CurrentState.Mouse == null ? Vector2.Zero : ToLocalSpace(input.CurrentState.Mouse.Position) - DrawSize / 2) * ParallaxAmount; diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index a20c17cc8e..c2a79b0840 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -74,10 +74,10 @@ namespace osu.Game.Graphics.Containers } } - private void scaleChanged(float value) + private void scaleChanged(ValueChangedEvent args) { - this.ScaleTo(new Vector2(value), 500, Easing.Out); - this.ResizeTo(new Vector2(1 / value), 500, Easing.Out); + this.ScaleTo(new Vector2(args.NewValue), 500, Easing.Out); + this.ResizeTo(new Vector2(1 / args.NewValue), 500, Easing.Out); } } @@ -108,7 +108,7 @@ namespace osu.Game.Graphics.Containers sizableContainer.FinishTransforms(); } - private bool requiresBackgroundVisible => (scalingMode == ScalingMode.Everything || scalingMode == ScalingMode.ExcludeOverlays) && (sizeX.Value != 1 || sizeY.Value != 1); + private bool requiresBackgroundVisible => (scalingMode.Value == ScalingMode.Everything || scalingMode.Value == ScalingMode.ExcludeOverlays) && (sizeX.Value != 1 || sizeY.Value != 1); private void updateSize() { @@ -137,8 +137,8 @@ namespace osu.Game.Graphics.Containers bool scaling = targetMode == null || scalingMode.Value == targetMode; - var targetSize = scaling ? new Vector2(sizeX, sizeY) : Vector2.One; - var targetPosition = scaling ? new Vector2(posX, posY) * (Vector2.One - targetSize) : Vector2.Zero; + var targetSize = scaling ? new Vector2(sizeX.Value, sizeY.Value) : Vector2.One; + var targetPosition = scaling ? new Vector2(posX.Value, posY.Value) * (Vector2.One - targetSize) : Vector2.Zero; bool requiresMasking = scaling && targetSize != Vector2.One; if (requiresMasking) diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 76c2345cd5..603bc03093 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -80,7 +80,7 @@ namespace osu.Game.Graphics.Cursor activeCursor.AdditiveLayer.FadeInFromZero(800, Easing.OutQuint); } - if (e.Button == MouseButton.Left && cursorRotate) + if (e.Button == MouseButton.Left && cursorRotate.Value) { dragRotationState = DragRotationState.DragStarted; positionMouseDown = e.MousePosition; @@ -156,7 +156,7 @@ namespace osu.Game.Graphics.Cursor }; cursorScale = config.GetBindable(OsuSetting.MenuCursorSize); - cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale * base_scale); + cursorScale.ValueChanged += e => cursorContainer.Scale = new Vector2((float)e.NewValue * base_scale); cursorScale.TriggerChange(); } } diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index ef4209f6f3..cd09cef247 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -127,7 +127,7 @@ namespace osu.Game.Graphics { base.Update(); - if (cursorVisibility == false && Interlocked.CompareExchange(ref screenShotTasks, 0, 0) == 0) + if (cursorVisibility.Value == false && Interlocked.CompareExchange(ref screenShotTasks, 0, 0) == 0) cursorVisibility.Value = true; } diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index b9196adda3..0a827e7650 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -27,12 +27,12 @@ namespace osu.Game.Graphics.UserInterface { Height = 32; TabContainer.Spacing = new Vector2(padding, 0f); - Current.ValueChanged += tab => + Current.ValueChanged += e => { foreach (var t in TabContainer.Children.OfType()) { var tIndex = TabContainer.IndexOf(t); - var tabIndex = TabContainer.IndexOf(TabMap[tab]); + var tabIndex = TabContainer.IndexOf(TabMap[e.NewValue]); t.State = tIndex < tabIndex ? Visibility.Hidden : Visibility.Visible; t.Chevron.FadeTo(tIndex <= tabIndex ? 0f : 1f, 500, Easing.OutQuint); diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 644f66a92d..8eba8845f8 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -242,9 +242,9 @@ namespace osu.Game.Graphics.UserInterface Selected.Value = false; } - private void selectionChanged(bool isSelected) + private void selectionChanged(ValueChangedEvent args) { - if (isSelected) + if (args.NewValue) { spriteText.TransformSpacingTo(hoverSpacing, hover_duration, Easing.OutElastic); colourContainer.ResizeTo(new Vector2(hover_width, 1f), hover_duration, Easing.OutElastic); diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index 0405a09a78..2f8d5fa6d0 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -41,9 +41,9 @@ namespace osu.Game.Graphics.UserInterface }, }; - Current.ValueChanged += newValue => + Current.ValueChanged += e => { - if (newValue) + if (e.NewValue) fill.FadeIn(200, Easing.OutQuint); else fill.FadeTo(0.01f, 200, Easing.OutQuint); //todo: remove once we figure why containers aren't drawing at all times diff --git a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs index 9d9f95662b..26e1c5a8bb 100644 --- a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs @@ -73,7 +73,7 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(OsuColour colours) { - Enabled.BindValueChanged(enabled => this.FadeColour(enabled ? Color4.White : colours.Gray9, 200, Easing.OutQuint), true); + Enabled.BindValueChanged(e => this.FadeColour(e.NewValue ? Color4.White : colours.Gray9, 200, Easing.OutQuint), true); } protected override bool OnHover(HoverEvent e) diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 6ba461ad70..6c17c1938a 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; @@ -46,13 +47,13 @@ namespace osu.Game.Graphics.UserInterface new HoverClickSounds(HoverSampleSet.Loud), }); - Enabled.ValueChanged += enabled_ValueChanged; + Enabled.ValueChanged += enabledChanged; Enabled.TriggerChange(); } - private void enabled_ValueChanged(bool enabled) + private void enabledChanged(ValueChangedEvent e) { - this.FadeColour(enabled ? Color4.White : Color4.Gray, 200, Easing.OutQuint); + this.FadeColour(e.NewValue ? Color4.White : Color4.Gray, 200, Easing.OutQuint); } protected override bool OnHover(HoverEvent e) diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index b71bdcc593..1d46c911e5 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -86,9 +86,9 @@ namespace osu.Game.Graphics.UserInterface { base.LoadComplete(); - Current.ValueChanged += newValue => + Current.ValueChanged += e => { - if (newValue) + if (e.NewValue) sampleChecked?.Play(); else sampleUnchecked?.Play(); diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index c66a20a115..42f5b7f9b5 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -95,7 +95,7 @@ namespace osu.Game.Graphics.UserInterface protected override void LoadComplete() { base.LoadComplete(); - CurrentNumber.BindValueChanged(updateTooltipText, true); + CurrentNumber.BindValueChanged(e => updateTooltipText(e.NewValue), true); } protected override bool OnHover(HoverEvent e) diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 7089b7a79a..a813428e95 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -107,7 +107,7 @@ namespace osu.Game.Graphics.UserInterface set { accentColour = value; - if (!Active) + if (!Active.Value) Text.Colour = value; } } @@ -128,14 +128,14 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnHover(HoverEvent e) { - if (!Active) + if (!Active.Value) fadeActive(); return true; } protected override void OnHoverLost(HoverLostEvent e) { - if (!Active) + if (!Active.Value) fadeInactive(); } @@ -173,7 +173,7 @@ namespace osu.Game.Graphics.UserInterface new HoverClickSounds() }; - Active.BindValueChanged(val => Text.Font = val ? @"Exo2.0-Bold" : @"Exo2.0", true); + Active.BindValueChanged(e => Text.Font = e.NewValue ? "Exo2.0-Bold" : @"Exo2.0", true); } protected override void OnActivated() => fadeActive(); diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs index 0626534307..ae47b8594a 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs @@ -31,7 +31,7 @@ namespace osu.Game.Graphics.UserInterface { accentColour = value; - if (Current) + if (Current.Value) { text.Colour = AccentColour; icon.Colour = AccentColour; @@ -67,7 +67,7 @@ namespace osu.Game.Graphics.UserInterface protected override void OnHoverLost(HoverLostEvent e) { - if (!Current) + if (!Current.Value) fadeOut(); base.OnHoverLost(e); @@ -118,9 +118,9 @@ namespace osu.Game.Graphics.UserInterface } }; - Current.ValueChanged += v => + Current.ValueChanged += e => { - if (v) + if (e.NewValue) { fadeIn(); icon.Icon = FontAwesome.fa_check_circle_o; diff --git a/osu.Game/Graphics/UserInterface/PageTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs index 904951da0e..92f0c99b04 100644 --- a/osu.Game/Graphics/UserInterface/PageTabControl.cs +++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs @@ -59,7 +59,7 @@ namespace osu.Game.Graphics.UserInterface new HoverClickSounds() }; - Active.BindValueChanged(val => Text.Font = val ? @"Exo2.0-Bold" : @"Exo2.0", true); + Active.BindValueChanged(e => Text.Font = e.NewValue ? @"Exo2.0-Bold" : @"Exo2.0", true); } [BackgroundDependencyLoader] @@ -70,14 +70,14 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnHover(HoverEvent e) { - if (!Active) + if (!Active.Value) slideActive(); return true; } protected override void OnHoverLost(HoverLostEvent e) { - if (!Active) + if (!Active.Value) slideInactive(); } diff --git a/osu.Game/Graphics/UserInterface/PercentageCounter.cs b/osu.Game/Graphics/UserInterface/PercentageCounter.cs index 9205525af3..dbb52002fd 100644 --- a/osu.Game/Graphics/UserInterface/PercentageCounter.cs +++ b/osu.Game/Graphics/UserInterface/PercentageCounter.cs @@ -41,7 +41,7 @@ namespace osu.Game.Graphics.UserInterface public override void Increment(double amount) { - Current.Value = Current + amount; + Current.Value = Current.Value + amount; } } } diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 6e261a8fa7..6cccb49c18 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -95,11 +95,11 @@ namespace osu.Game.Graphics.UserInterface TextSize = 40; AutoSizeAxes = Axes.Both; - DisplayedCount = Current; + DisplayedCount = Current.Value; - Current.ValueChanged += newValue => + Current.ValueChanged += e => { - if (IsLoaded) TransformCount(displayedCount, newValue); + if (IsLoaded) TransformCount(displayedCount, e.NewValue); }; } @@ -107,7 +107,7 @@ namespace osu.Game.Graphics.UserInterface { base.LoadComplete(); - DisplayedCountSpriteText.Text = FormatCount(Current); + DisplayedCountSpriteText.Text = FormatCount(Current.Value); } /// @@ -126,7 +126,7 @@ namespace osu.Game.Graphics.UserInterface public virtual void StopRolling() { FinishTransforms(false, nameof(DisplayedCount)); - DisplayedCount = Current; + DisplayedCount = Current.Value; } /// diff --git a/osu.Game/Graphics/UserInterface/ScoreCounter.cs b/osu.Game/Graphics/UserInterface/ScoreCounter.cs index 944993d99c..8daf1e9d25 100644 --- a/osu.Game/Graphics/UserInterface/ScoreCounter.cs +++ b/osu.Game/Graphics/UserInterface/ScoreCounter.cs @@ -52,7 +52,7 @@ namespace osu.Game.Graphics.UserInterface public override void Increment(double amount) { - Current.Value = Current + amount; + Current.Value = Current.Value + amount; } } } diff --git a/osu.Game/Graphics/UserInterface/ScreenBreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/ScreenBreadcrumbControl.cs index 6e01c69df5..cbfe3d3585 100644 --- a/osu.Game/Graphics/UserInterface/ScreenBreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/ScreenBreadcrumbControl.cs @@ -19,7 +19,7 @@ namespace osu.Game.Graphics.UserInterface onPushed(null, stack.CurrentScreen); - Current.ValueChanged += newScreen => newScreen.MakeCurrent(); + Current.ValueChanged += e => e.NewValue.MakeCurrent(); } private void onPushed(IScreen lastScreen, IScreen newScreen) diff --git a/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs index b0657e707e..4717401c75 100644 --- a/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs +++ b/osu.Game/Graphics/UserInterface/SimpleComboCounter.cs @@ -33,7 +33,7 @@ namespace osu.Game.Graphics.UserInterface public override void Increment(int amount) { - Current.Value = Current + amount; + Current.Value = Current.Value + amount; } } } diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 48b9b8a6d5..4642b66ef7 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -64,7 +64,7 @@ namespace osu.Game.Online.API thread.Start(); } - private void onTokenChanged(OAuthToken token) => config.Set(OsuSetting.Token, config.Get(OsuSetting.SavePassword) ? authentication.TokenString : string.Empty); + private void onTokenChanged(ValueChangedEvent e) => config.Set(OsuSetting.Token, config.Get(OsuSetting.SavePassword) ? authentication.TokenString : string.Empty); private readonly List components = new List(); diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index ded7920cc1..29162984f6 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -55,7 +55,7 @@ namespace osu.Game.Online.Chat { CurrentChannel.ValueChanged += currentChannelChanged; - HighPollRate.BindValueChanged(high => TimeBetweenPolls = high ? 1000 : 6000, true); + HighPollRate.BindValueChanged(e => TimeBetweenPolls = e.NewValue ? 1000 : 6000, true); } /// @@ -84,7 +84,7 @@ namespace osu.Game.Online.Chat ?? new Channel(user); } - private void currentChannelChanged(Channel channel) => JoinChannel(channel); + private void currentChannelChanged(ValueChangedEvent e) => JoinChannel(e.NewValue); /// /// Ensure we run post actions in sequence, once at a time. @@ -131,7 +131,7 @@ namespace osu.Game.Online.Chat target.AddLocalEcho(message); // if this is a PM and the first message, we need to do a special request to create the PM channel - if (target.Type == ChannelType.PM && !target.Joined) + if (target.Type == ChannelType.PM && !target.Joined.Value) { var createNewPrivateMessageRequest = new CreateNewPrivateMessageRequest(target.Users.First(), message); @@ -331,7 +331,7 @@ namespace osu.Game.Online.Chat switch (channel.Type) { case ChannelType.Public: - var req = new JoinChannelRequest(channel, api.LocalUser); + var req = new JoinChannelRequest(channel, api.LocalUser.Value); req.Success += () => JoinChannel(channel, true); req.Failure += ex => LeaveChannel(channel); api.Queue(req); @@ -363,7 +363,7 @@ namespace osu.Game.Online.Chat if (channel.Joined.Value) { - api.Queue(new LeaveChannelRequest(channel, api.LocalUser)); + api.Queue(new LeaveChannelRequest(channel, api.LocalUser.Value)); channel.Joined.Value = false; } } diff --git a/osu.Game/Online/Chat/ExternalLinkOpener.cs b/osu.Game/Online/Chat/ExternalLinkOpener.cs index a2c5a3cf8c..aae183b002 100644 --- a/osu.Game/Online/Chat/ExternalLinkOpener.cs +++ b/osu.Game/Online/Chat/ExternalLinkOpener.cs @@ -27,7 +27,7 @@ namespace osu.Game.Online.Chat public void OpenUrlExternally(string url) { - if (externalLinkWarning) + if (externalLinkWarning.Value) dialogOverlay.Push(new ExternalLinkDialog(url, () => host.OpenUrlExternally(url))); else host.OpenUrlExternally(url); diff --git a/osu.Game/Online/Chat/StandAloneChatDisplay.cs b/osu.Game/Online/Chat/StandAloneChatDisplay.cs index a3bcc91e1e..f3a882c686 100644 --- a/osu.Game/Online/Chat/StandAloneChatDisplay.cs +++ b/osu.Game/Online/Chat/StandAloneChatDisplay.cs @@ -90,9 +90,9 @@ namespace osu.Game.Online.Chat return; if (text[0] == '/') - ChannelManager?.PostCommand(text.Substring(1), Channel); + ChannelManager?.PostCommand(text.Substring(1), Channel.Value); else - ChannelManager?.PostMessage(text, target: Channel); + ChannelManager?.PostMessage(text, target: Channel.Value); textbox.Text = string.Empty; } @@ -111,13 +111,13 @@ namespace osu.Game.Online.Chat protected virtual ChatLine CreateMessage(Message message) => new StandAloneMessage(message); - private void channelChanged(Channel channel) + private void channelChanged(ValueChangedEvent e) { drawableChannel?.Expire(); - if (channel == null) return; + if (e.NewValue == null) return; - AddInternal(drawableChannel = new StandAloneDrawableChannel(channel) + AddInternal(drawableChannel = new StandAloneDrawableChannel(e.NewValue) { CreateChatLineAction = CreateMessage, Padding = new MarginPadding { Bottom = postingTextbox ? textbox_height : 0 } diff --git a/osu.Game/Online/Multiplayer/Room.cs b/osu.Game/Online/Multiplayer/Room.cs index 2dcc7369f9..8e1fc894d2 100644 --- a/osu.Game/Online/Multiplayer/Room.cs +++ b/osu.Game/Online/Multiplayer/Room.cs @@ -86,7 +86,7 @@ namespace osu.Game.Online.Multiplayer [JsonProperty("participant_count")] private int? participantCount { - get => ParticipantCount; + get => ParticipantCount.Value; set => ParticipantCount.Value = value ?? 0; } @@ -106,7 +106,7 @@ namespace osu.Game.Online.Multiplayer [JsonProperty("max_attempts", DefaultValueHandling = DefaultValueHandling.Ignore)] private int? maxAttempts { - get => MaxAttempts; + get => MaxAttempts.Value; set => MaxAttempts.Value = value; } @@ -118,19 +118,19 @@ namespace osu.Game.Online.Multiplayer public void CopyFrom(Room other) { - RoomID.Value = other.RoomID; - Name.Value = other.Name; + RoomID.Value = other.RoomID.Value; + Name.Value = other.Name.Value; if (other.Host.Value != null && Host.Value?.Id != other.Host.Value.Id) - Host.Value = other.Host; + Host.Value = other.Host.Value; - Status.Value = other.Status; - Availability.Value = other.Availability; - Type.Value = other.Type; - MaxParticipants.Value = other.MaxParticipants; + Status.Value = other.Status.Value; + Availability.Value = other.Availability.Value; + Type.Value = other.Type.Value; + MaxParticipants.Value = other.MaxParticipants.Value; ParticipantCount.Value = other.ParticipantCount.Value; Participants.Value = other.Participants.Value.ToArray(); - EndDate.Value = other.EndDate; + EndDate.Value = other.EndDate.Value; if (DateTimeOffset.Now >= EndDate.Value) Status.Value = new RoomStatusEnded(); diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 914ecba30d..1b1ca852c8 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -174,17 +174,17 @@ namespace osu.Game // bind config int to database RulesetInfo configRuleset = LocalConfig.GetBindable(OsuSetting.Ruleset); ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First(); - ruleset.ValueChanged += r => configRuleset.Value = r.ID ?? 0; + ruleset.ValueChanged += e => configRuleset.Value = e.NewValue.ID ?? 0; // bind config int to database SkinInfo configSkin = LocalConfig.GetBindable(OsuSetting.Skin); - SkinManager.CurrentSkinInfo.ValueChanged += s => configSkin.Value = s.ID; - configSkin.ValueChanged += id => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == id) ?? SkinInfo.Default; + SkinManager.CurrentSkinInfo.ValueChanged += e => configSkin.Value = e.NewValue.ID; + configSkin.ValueChanged += e => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == e.NewValue) ?? SkinInfo.Default; configSkin.TriggerChange(); LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust); - IsActive.BindValueChanged(updateActiveState, true); + IsActive.BindValueChanged(e => updateActiveState(e.NewValue), true); } private ExternalLinkOpener externalLinkOpener; @@ -515,9 +515,9 @@ namespace osu.Game }; } - OverlayActivationMode.ValueChanged += v => + OverlayActivationMode.ValueChanged += e => { - if (v != OverlayActivation.All) CloseAllOverlays(); + if (e.NewValue != OverlayActivation.All) CloseAllOverlays(); }; void updateScreenOffset() diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index b6fe20b3a8..e5038287d3 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -209,7 +209,7 @@ namespace osu.Game // TODO: This is temporary until we reimplement the local FPS display. // It's just to allow end-users to access the framework FPS display without knowing the shortcut key. fpsDisplayVisible = LocalConfig.GetBindable(OsuSetting.ShowFpsDisplay); - fpsDisplayVisible.ValueChanged += val => { FrameStatisticsMode = val ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; }; + fpsDisplayVisible.ValueChanged += e => { FrameStatisticsMode = e.NewValue ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; }; fpsDisplayVisible.TriggerChange(); } diff --git a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs index 407d2cfbf1..a2f224c04f 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs @@ -135,7 +135,7 @@ namespace osu.Game.Overlays.AccountCreation characterCheckText = passwordDescription.AddText("8 characters long"); passwordDescription.AddText(". Choose something long but also something you will remember, like a line from your favourite song."); - passwordTextBox.Current.ValueChanged += text => { characterCheckText.ForEach(s => s.Colour = text.Length == 0 ? Color4.White : Interpolation.ValueAt(text.Length, Color4.OrangeRed, Color4.YellowGreen, 0, 8, Easing.In)); }; + passwordTextBox.Current.ValueChanged += e => { characterCheckText.ForEach(s => s.Colour = e.NewValue.Length == 0 ? Color4.White : Interpolation.ValueAt(e.NewValue.Length, Color4.OrangeRed, Color4.YellowGreen, 0, 8, Easing.In)); }; } protected override void Update() diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs index c2edaf01ed..379332b064 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs @@ -138,9 +138,9 @@ namespace osu.Game.Overlays.BeatmapSet }, }; - Beatmap.ValueChanged += b => + Beatmap.ValueChanged += e => { - showBeatmap(b); + showBeatmap(e.NewValue); updateDifficultyButtons(); }; } diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs index 4d46d41c0f..018ce611f6 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs @@ -22,7 +22,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons { private readonly bool noVideo; - public string TooltipText => button.Enabled ? "Download this beatmap" : "Login to download"; + public string TooltipText => button.Enabled.Value ? "Download this beatmap" : "Login to download"; private readonly IBindable localUser = new Bindable(); @@ -83,7 +83,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons }, } }, - new DownloadProgressBar(BeatmapSet) + new DownloadProgressBar(BeatmapSet.Value) { Depth = -2, Anchor = Anchor.BottomLeft, @@ -101,16 +101,16 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons return; } - beatmaps.Download(BeatmapSet, noVideo); + beatmaps.Download(BeatmapSet.Value, noVideo); }; localUser.BindTo(api.LocalUser); localUser.BindValueChanged(userChanged, true); button.Enabled.BindValueChanged(enabledChanged, true); - State.BindValueChanged(state => + State.BindValueChanged(e => { - switch (state) + switch (e.NewValue) { case DownloadState.Downloading: textSprites.Children = new Drawable[] @@ -159,8 +159,8 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons }, true); } - private void userChanged(User user) => button.Enabled.Value = !(user is GuestUser); + private void userChanged(ValueChangedEvent e) => button.Enabled.Value = !(e.NewValue is GuestUser); - private void enabledChanged(bool enabled) => this.FadeColour(enabled ? Color4.White : Color4.Gray, 200, Easing.OutQuint); + private void enabledChanged(ValueChangedEvent e) => this.FadeColour(e.NewValue ? Color4.White : Color4.Gray, 200, Easing.OutQuint); } } diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs index b672e7bf07..845707d96c 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs @@ -53,9 +53,9 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons }, }); - Favourited.ValueChanged += value => + Favourited.ValueChanged += e => { - if (value) + if (e.NewValue) { pink.FadeIn(200); icon.Icon = FontAwesome.fa_heart; diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs index 12b4a7e2d7..b9b5ab6aa6 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs @@ -67,7 +67,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons }; Action = () => playButton.Click(); - Playing.ValueChanged += newValue => progress.FadeTo(newValue ? 1 : 0, 100); + Playing.ValueChanged += e => progress.FadeTo(e.NewValue ? 1 : 0, 100); } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index 8721a1ce5a..235ca4635d 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -181,8 +181,8 @@ namespace osu.Game.Overlays.BeatmapSet }, }; - Picker.Beatmap.ValueChanged += b => Details.Beatmap = b; - Picker.Beatmap.ValueChanged += b => externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{b?.Ruleset.ShortName}/{b?.OnlineBeatmapID}"; + Picker.Beatmap.ValueChanged += e => Details.Beatmap = e.NewValue; + Picker.Beatmap.ValueChanged += e => externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{e.NewValue?.Ruleset.ShortName}/{e.NewValue?.OnlineBeatmapID}"; } [BackgroundDependencyLoader] @@ -192,16 +192,16 @@ namespace osu.Game.Overlays.BeatmapSet State.BindValueChanged(_ => updateDownloadButtons()); - BeatmapSet.BindValueChanged(beatmapSet => + BeatmapSet.BindValueChanged(e => { - Picker.BeatmapSet = author.BeatmapSet = Details.BeatmapSet = beatmapSet; + Picker.BeatmapSet = author.BeatmapSet = Details.BeatmapSet = e.NewValue; - title.Text = beatmapSet?.Metadata.Title ?? string.Empty; - artist.Text = beatmapSet?.Metadata.Artist ?? string.Empty; - onlineStatusPill.Status = beatmapSet?.OnlineInfo.Status ?? BeatmapSetOnlineStatus.None; - cover.BeatmapSet = beatmapSet; + title.Text = e.NewValue?.Metadata.Title ?? string.Empty; + artist.Text = e.NewValue?.Metadata.Artist ?? string.Empty; + onlineStatusPill.Status = e.NewValue?.OnlineInfo.Status ?? BeatmapSetOnlineStatus.None; + cover.BeatmapSet = e.NewValue; - if (beatmapSet != null) + if (e.NewValue != null) { downloadButtonsContainer.FadeIn(transition_duration); favouriteButton.FadeIn(transition_duration); @@ -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) + downloadButtonsContainer.Child = new osu.Game.Overlays.Direct.DownloadButton(BeatmapSet.Value) { 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); + downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); break; default: - downloadButtonsContainer.Child = new DownloadButton(BeatmapSet); + downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); if (BeatmapSet.Value.OnlineInfo.HasVideo) - downloadButtonsContainer.Add(new DownloadButton(BeatmapSet, true)); + downloadButtonsContainer.Add(new DownloadButton(BeatmapSet.Value, true)); break; } } diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index 1237b17214..1f2047e5bd 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -101,10 +101,10 @@ namespace osu.Game.Overlays }, }; - header.Picker.Beatmap.ValueChanged += b => + header.Picker.Beatmap.ValueChanged += e => { - info.Beatmap = b; - scores.Beatmap = b; + info.Beatmap = e.NewValue; + scores.Beatmap = e.NewValue; }; } diff --git a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs index 23dedf251f..a0ee24765b 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs @@ -54,7 +54,7 @@ namespace osu.Game.Overlays.Chat.Selection RelativeSizeAxes = Axes.X; AutoSizeAxes = Axes.Y; - Action = () => { (channel.Joined ? OnRequestLeave : OnRequestJoin)?.Invoke(channel); }; + Action = () => { (channel.Joined.Value ? OnRequestLeave : OnRequestJoin)?.Invoke(channel); }; Children = new Drawable[] { @@ -148,7 +148,7 @@ namespace osu.Game.Overlays.Chat.Selection joinedColour = colours.Blue; hoverColour = colours.Yellow; - joinedBind.ValueChanged += updateColour; + joinedBind.ValueChanged += e => updateColour(e.NewValue); joinedBind.BindTo(channel.Joined); joinedBind.TriggerChange(); diff --git a/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs index 00de5fd5fd..d5c67bf29f 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs @@ -125,7 +125,7 @@ namespace osu.Game.Overlays.Chat.Selection }, }; - search.Current.ValueChanged += newValue => sectionsFlow.SearchTerm = newValue; + search.Current.ValueChanged += e => sectionsFlow.SearchTerm = e.NewValue; } public void UpdateAvailableChannels(IEnumerable channels) diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs index ccf4af651b..afd629c494 100644 --- a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs +++ b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs @@ -110,7 +110,7 @@ namespace osu.Game.Overlays.Chat.Tabs if (tab == SelectedTab && totalTabs > 1) // Select the tab after tab-to-be-removed's index, or the tab before if current == last SelectTab(TabContainer[currentIndex == totalTabs ? currentIndex - 1 : currentIndex + 1]); - else if (totalTabs == 1 && !selectorTab.Active) + else if (totalTabs == 1 && !selectorTab.Active.Value) // Open channel selection overlay if all channel tabs will be closed after removing this tab SelectTab(selectorTab); diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs index 7acd56c864..71f4a352cd 100644 --- a/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs +++ b/osu.Game/Overlays/Chat/Tabs/ChannelTabItem.cs @@ -127,7 +127,7 @@ namespace osu.Game.Overlays.Chat.Tabs if (IsRemovable && ShowCloseOnHover) CloseButton.FadeIn(200, Easing.OutQuint); - if (!Active) + if (!Active.Value) box.FadeColour(backgroundHover, TRANSITION_LENGTH, Easing.OutQuint); return true; } @@ -158,7 +158,7 @@ namespace osu.Game.Overlays.Chat.Tabs private void updateState() { - if (Active) + if (Active.Value) FadeActive(); else FadeInactive(); diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 821c942a57..96f18df9fc 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -162,8 +162,8 @@ namespace osu.Game.Overlays }, }; - channelTabControl.Current.ValueChanged += chat => channelManager.CurrentChannel.Value = chat; - channelTabControl.ChannelSelectorActive.ValueChanged += value => channelSelectionOverlay.State = value ? Visibility.Visible : Visibility.Hidden; + channelTabControl.Current.ValueChanged += e => channelManager.CurrentChannel.Value = e.NewValue; + channelTabControl.ChannelSelectorActive.ValueChanged += e => channelSelectionOverlay.State = e.NewValue ? Visibility.Visible : Visibility.Hidden; channelSelectionOverlay.StateChanged += state => { if (state == Visibility.Hidden && channelManager.CurrentChannel.Value == null) @@ -189,9 +189,9 @@ namespace osu.Game.Overlays channelSelectionOverlay.OnRequestLeave = channel => channelManager.LeaveChannel(channel); } - private void currentChannelChanged(Channel channel) + private void currentChannelChanged(ValueChangedEvent e) { - if (channel == null) + if (e.NewValue == null) { textbox.Current.Disabled = true; currentChannelContainer.Clear(false); @@ -199,18 +199,18 @@ namespace osu.Game.Overlays return; } - textbox.Current.Disabled = channel.ReadOnly; + textbox.Current.Disabled = e.NewValue.ReadOnly; - if (channelTabControl.Current.Value != channel) - Scheduler.Add(() => channelTabControl.Current.Value = channel); + if (channelTabControl.Current.Value != e.NewValue) + Scheduler.Add(() => channelTabControl.Current.Value = e.NewValue); - var loaded = loadedChannels.Find(d => d.Channel == channel); + var loaded = loadedChannels.Find(d => d.Channel == e.NewValue); if (loaded == null) { currentChannelContainer.FadeOut(500, Easing.OutQuint); loading.Show(); - loaded = new DrawableChannel(channel); + loaded = new DrawableChannel(e.NewValue); loadedChannels.Add(loaded); LoadComponentAsync(loaded, l => { @@ -328,11 +328,11 @@ namespace osu.Game.Overlays private void load(OsuConfigManager config, OsuColour colours, ChannelManager channelManager) { ChatHeight = config.GetBindable(OsuSetting.ChatDisplayHeight); - ChatHeight.ValueChanged += h => + ChatHeight.ValueChanged += e => { - chatContainer.Height = (float)h; - channelSelectionContainer.Height = 1f - (float)h; - tabBackground.FadeTo(h == 1 ? 1 : 0.8f, 200); + chatContainer.Height = (float)e.NewValue; + channelSelectionContainer.Height = 1f - (float)e.NewValue; + tabBackground.FadeTo(e.NewValue == 1 ? 1 : 0.8f, 200); }; ChatHeight.TriggerChange(); diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 4ee6ff9698..3a08f37a1b 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -239,6 +239,6 @@ namespace osu.Game.Overlays.Direct updateStatusContainer(); } - private void updateStatusContainer() => statusContainer.FadeTo(IsHovered || PreviewPlaying ? 0 : 1, 120, Easing.InOutQuint); + private void updateStatusContainer() => statusContainer.FadeTo(IsHovered || PreviewPlaying.Value ? 0 : 1, 120, Easing.InOutQuint); } } diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index f8f6fd9b53..5fcf996b04 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -88,7 +88,7 @@ namespace osu.Game.Overlays.Direct { base.Update(); - if (PreviewPlaying && Preview != null && Preview.TrackLoaded) + if (PreviewPlaying.Value && Preview != null && Preview.TrackLoaded) { PreviewBar.Width = (float)(Preview.CurrentTime / Preview.Length); } @@ -108,7 +108,7 @@ namespace osu.Game.Overlays.Direct { content.TweenEdgeEffectTo(edgeEffectNormal, hover_transition_time, Easing.OutQuint); content.MoveToY(0, hover_transition_time, Easing.OutQuint); - if (FadePlayButton && !PreviewPlaying) + if (FadePlayButton && !PreviewPlaying.Value) PlayButton.FadeOut(120, Easing.InOutQuint); base.OnHoverLost(e); @@ -127,8 +127,8 @@ namespace osu.Game.Overlays.Direct base.LoadComplete(); this.FadeInFromZero(200, Easing.Out); - PreviewPlaying.ValueChanged += newValue => PlayButton.FadeTo(newValue || IsHovered || !FadePlayButton ? 1 : 0, 120, Easing.InOutQuint); - PreviewPlaying.ValueChanged += newValue => PreviewBar.FadeTo(newValue ? 1 : 0, 120, Easing.InOutQuint); + PreviewPlaying.ValueChanged += e => PlayButton.FadeTo(e.NewValue || IsHovered || !FadePlayButton ? 1 : 0, 120, Easing.InOutQuint); + PreviewPlaying.ValueChanged += e => PreviewBar.FadeTo(e.NewValue ? 1 : 0, 120, Easing.InOutQuint); } protected List GetDifficultyIcons() diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index 201a79f58a..a1d5310631 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -67,7 +67,7 @@ namespace osu.Game.Overlays.Direct { base.LoadComplete(); - State.BindValueChanged(updateState, true); + State.BindValueChanged(e => updateState(e.NewValue), true); FinishTransforms(true); } @@ -85,10 +85,10 @@ namespace osu.Game.Overlays.Direct shakeContainer.Shake(); break; case DownloadState.LocallyAvailable: - game.PresentBeatmap(BeatmapSet); + game.PresentBeatmap(BeatmapSet.Value); break; default: - beatmaps.Download(BeatmapSet, noVideo); + beatmaps.Download(BeatmapSet.Value, noVideo); break; } }; diff --git a/osu.Game/Overlays/Direct/DownloadProgressBar.cs b/osu.Game/Overlays/Direct/DownloadProgressBar.cs index 4ac1aba7f5..9cedc6da6e 100644 --- a/osu.Game/Overlays/Direct/DownloadProgressBar.cs +++ b/osu.Game/Overlays/Direct/DownloadProgressBar.cs @@ -35,9 +35,9 @@ namespace osu.Game.Overlays.Direct progressBar.BackgroundColour = Color4.Black.Opacity(0.7f); progressBar.Current = Progress; - State.BindValueChanged(state => + State.BindValueChanged(e => { - switch (state) + switch (e.NewValue) { case DownloadState.NotDownloaded: progressBar.Current.Value = 0; diff --git a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs index d9eb827834..28fe20aa12 100644 --- a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs +++ b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs @@ -37,14 +37,14 @@ namespace osu.Game.Overlays.Direct { this.beatmaps = beatmaps; - BeatmapSet.BindValueChanged(set => + BeatmapSet.BindValueChanged(e => { - if (set == null) + if (e.NewValue == null) attachDownload(null); - else if (beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == set.OnlineBeatmapSetID).Any()) + else if (beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == e.NewValue.OnlineBeatmapSetID).Any()) State.Value = DownloadState.LocallyAvailable; else - attachDownload(beatmaps.GetExistingDownload(set)); + attachDownload(beatmaps.GetExistingDownload(e.NewValue)); }, true); beatmaps.BeatmapDownloadBegan += download => diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index f1ae435c73..80b5b8f88a 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Direct { DisplayStyleControl.Dropdown.AccentColour = colours.BlueDark; - Ruleset.Value = ruleset ?? rulesets.GetRuleset(0); + Ruleset.Value = ruleset.Value ?? rulesets.GetRuleset(0); foreach (var r in rulesets.AvailableRulesets) modeButtons.Add(new RulesetToggleButton(Ruleset, r)); } @@ -68,9 +68,9 @@ namespace osu.Game.Overlays.Direct private readonly ConstrainedIconContainer iconContainer; - private void Bindable_ValueChanged(RulesetInfo obj) + private void Bindable_ValueChanged(ValueChangedEvent e) { - iconContainer.FadeTo(Ruleset.ID == obj?.ID ? 1f : 0.5f, 100); + iconContainer.FadeTo(Ruleset.ID == e.NewValue?.ID ? 1f : 0.5f, 100); } public override bool HandleNonPositionalInput => !bindable.Disabled && base.HandleNonPositionalInput; @@ -93,7 +93,7 @@ namespace osu.Game.Overlays.Direct Ruleset = ruleset; bindable.ValueChanged += Bindable_ValueChanged; - Bindable_ValueChanged(bindable.Value); + Bindable_ValueChanged(new ValueChangedEvent(bindable.Value, bindable.Value)); Action = () => bindable.Value = Ruleset; } diff --git a/osu.Game/Overlays/Direct/PlayButton.cs b/osu.Game/Overlays/Direct/PlayButton.cs index 5e3ad3344e..7af4e616c8 100644 --- a/osu.Game/Overlays/Direct/PlayButton.cs +++ b/osu.Game/Overlays/Direct/PlayButton.cs @@ -112,12 +112,12 @@ namespace osu.Game.Overlays.Direct base.OnHoverLost(e); } - private void playingStateChanged(bool playing) + private void playingStateChanged(ValueChangedEvent e) { - icon.Icon = playing ? FontAwesome.fa_stop : FontAwesome.fa_play; - icon.FadeColour(playing || IsHovered ? hoverColour : Color4.White, 120, Easing.InOutQuint); + icon.Icon = e.NewValue ? FontAwesome.fa_stop : FontAwesome.fa_play; + icon.FadeColour(e.NewValue || IsHovered ? hoverColour : Color4.White, 120, Easing.InOutQuint); - if (playing) + if (e.NewValue) { if (BeatmapSet == null) { @@ -144,7 +144,7 @@ namespace osu.Game.Overlays.Direct preview.Stopped += () => Playing.Value = false; // user may have changed their mind. - if (Playing) + if (Playing.Value) preview.Start(); }); } diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 7dd59bf0bc..9270339fd1 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -116,9 +116,9 @@ namespace osu.Game.Overlays }, }; - Filter.Search.Current.ValueChanged += text => + Filter.Search.Current.ValueChanged += e => { - if (text != string.Empty) + if (e.NewValue != string.Empty) { Header.Tabs.Current.Value = DirectTab.Search; @@ -133,13 +133,13 @@ namespace osu.Game.Overlays Filter.Tabs.Current.Value = DirectSortCriteria.Ranked; } }; - ((FilterControl)Filter).Ruleset.ValueChanged += ruleset => Scheduler.AddOnce(updateSearch); - Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; - Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += rankStatus => Scheduler.AddOnce(updateSearch); + ((FilterControl)Filter).Ruleset.ValueChanged += e => Scheduler.AddOnce(updateSearch); + Filter.DisplayStyleControl.DisplayStyle.ValueChanged += e => recreatePanels(e.NewValue); + Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += e => Scheduler.AddOnce(updateSearch); - Header.Tabs.Current.ValueChanged += tab => + Header.Tabs.Current.ValueChanged += e => { - if (tab != DirectTab.Search) + if (e.NewValue != DirectTab.Search) { currentQuery.Value = string.Empty; Filter.Tabs.Current.Value = (DirectSortCriteria)Header.Tabs.Current.Value; @@ -147,11 +147,11 @@ namespace osu.Game.Overlays } }; - currentQuery.ValueChanged += v => + currentQuery.ValueChanged += e => { queryChangedDebounce?.Cancel(); - if (string.IsNullOrEmpty(v)) + if (string.IsNullOrEmpty(e.NewValue)) Scheduler.AddOnce(updateSearch); else { @@ -164,9 +164,9 @@ namespace osu.Game.Overlays currentQuery.BindTo(Filter.Search.Current); - Filter.Tabs.Current.ValueChanged += sortCriteria => + Filter.Tabs.Current.ValueChanged += e => { - if (Header.Tabs.Current.Value != DirectTab.Search && sortCriteria != (DirectSortCriteria)Header.Tabs.Current.Value) + if (Header.Tabs.Current.Value != DirectTab.Search && e.NewValue != (DirectSortCriteria)Header.Tabs.Current.Value) Header.Tabs.Current.Value = DirectTab.Search; Scheduler.AddOnce(updateSearch); @@ -274,7 +274,7 @@ namespace osu.Game.Overlays if (api == null) return; - if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery == string.Empty)) + if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery.Value == string.Empty)) return; previewTrackManager.StopAnyPlaying(this); diff --git a/osu.Game/Overlays/HoldToConfirmOverlay.cs b/osu.Game/Overlays/HoldToConfirmOverlay.cs index 2854fdab50..1497658a54 100644 --- a/osu.Game/Overlays/HoldToConfirmOverlay.cs +++ b/osu.Game/Overlays/HoldToConfirmOverlay.cs @@ -33,7 +33,7 @@ namespace osu.Game.Overlays } }; - Progress.ValueChanged += v => overlay.Alpha = (float)v; + Progress.ValueChanged += e => overlay.Alpha = (float)e.NewValue; } } } diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 386dd01ebd..d6cfc844eb 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -74,28 +74,28 @@ namespace osu.Game.Overlays.Mods SelectedMods.UnbindAll(); } - private void rulesetChanged(RulesetInfo newRuleset) + private void rulesetChanged(ValueChangedEvent e) { - if (newRuleset == null) return; + if (e.NewValue == null) return; - var instance = newRuleset.CreateInstance(); + var instance = e.NewValue.CreateInstance(); foreach (ModSection section in ModSectionsContainer.Children) section.Mods = instance.GetModsFor(section.ModType); // attempt to re-select any already selected mods. // this may be the first time we are receiving the ruleset, in which case they will still match. - selectedModsChanged(SelectedMods.Value); + selectedModsChanged(new ValueChangedEvent>(SelectedMods.Value, SelectedMods.Value)); // write the mods back to the SelectedMods bindable in the case a change was not applicable. // this generally isn't required as the previous line will perform deselection; just here for safety. refreshSelectedMods(); } - private void selectedModsChanged(IEnumerable obj) + private void selectedModsChanged(ValueChangedEvent> e) { foreach (ModSection section in ModSectionsContainer.Children) - section.SelectTypes(obj.Select(m => m.GetType()).ToList()); + section.SelectTypes(e.NewValue.Select(m => m.GetType()).ToList()); updateMods(); } diff --git a/osu.Game/Overlays/Music/FilterControl.cs b/osu.Game/Overlays/Music/FilterControl.cs index c2c10d999f..10e57e8e61 100644 --- a/osu.Game/Overlays/Music/FilterControl.cs +++ b/osu.Game/Overlays/Music/FilterControl.cs @@ -8,6 +8,7 @@ using osu.Game.Graphics.UserInterface; using osuTK; using osuTK.Graphics; using System; +using osu.Framework.Configuration; namespace osu.Game.Overlays.Music { @@ -44,7 +45,7 @@ namespace osu.Game.Overlays.Music Search.Current.ValueChanged += current_ValueChanged; } - private void current_ValueChanged(string newValue) => FilterChanged?.Invoke(newValue); + private void current_ValueChanged(ValueChangedEvent e) => FilterChanged?.Invoke(e.NewValue); public Action ExitRequested; diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 7c7b78afc7..2d2592b8ed 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(newText => recreateText(), true); + artistBind.BindValueChanged(e => recreateText(), true); } private void recreateText() diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 5218edd7d5..e1858c7961 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -317,13 +317,13 @@ namespace osu.Game.Overlays private WorkingBeatmap current; private TransformDirection? queuedDirection; - private void beatmapChanged(WorkingBeatmap beatmap) + private void beatmapChanged(ValueChangedEvent e) { TransformDirection direction = TransformDirection.None; if (current != null) { - bool audioEquals = beatmap?.BeatmapInfo?.AudioEquals(current.BeatmapInfo) ?? false; + bool audioEquals = e.NewValue?.BeatmapInfo?.AudioEquals(current.BeatmapInfo) ?? false; if (audioEquals) direction = TransformDirection.None; @@ -336,13 +336,13 @@ namespace osu.Game.Overlays { //figure out the best direction based on order in playlist. var last = beatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count(); - var next = beatmap == null ? -1 : beatmapSets.TakeWhile(b => b.ID != beatmap.BeatmapSetInfo?.ID).Count(); + var next = beatmap == null ? -1 : beatmapSets.TakeWhile(b => b.ID != e.NewValue.BeatmapSetInfo?.ID).Count(); direction = last > next ? TransformDirection.Prev : TransformDirection.Next; } } - current = beatmap; + current = e.NewValue; progressBar.CurrentTime = 0; diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index 1a23e0d8ef..66408c2227 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -80,7 +80,7 @@ namespace osu.Game.Overlays private ScheduledDelegate notificationsEnabler; private void updateProcessingMode() { - bool enabled = OverlayActivationMode == OverlayActivation.All || State == Visibility.Visible; + bool enabled = OverlayActivationMode.Value == OverlayActivation.All || State == Visibility.Visible; notificationsEnabler?.Cancel(); diff --git a/osu.Game/Overlays/Profile/Header/RankGraph.cs b/osu.Game/Overlays/Profile/Header/RankGraph.cs index 09880f044c..5012665be9 100644 --- a/osu.Game/Overlays/Profile/Header/RankGraph.cs +++ b/osu.Game/Overlays/Profile/Header/RankGraph.cs @@ -91,11 +91,11 @@ namespace osu.Game.Overlays.Profile.Header graph.Colour = colours.Yellow; } - private void userChanged(User user) + private void userChanged(ValueChangedEvent e) { placeholder.FadeIn(fade_duration, Easing.Out); - if (user?.Statistics?.Ranks.Global == null) + if (e.NewValue?.Statistics?.Ranks.Global == null) { rankText.Text = string.Empty; performanceText.Text = string.Empty; @@ -105,7 +105,7 @@ namespace osu.Game.Overlays.Profile.Header return; } - int[] userRanks = user.RankHistory?.Data ?? new[] { user.Statistics.Ranks.Global.Value }; + int[] userRanks = e.NewValue.RankHistory?.Data ?? new[] { e.NewValue.Statistics.Ranks.Global.Value }; ranks = userRanks.Select((x, index) => new KeyValuePair(index, x)).Where(x => x.Value != 0).ToArray(); if (ranks.Length > 1) diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 33b74a6d93..ecf848a6ca 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -63,10 +63,10 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu } }; - this.user.ValueChanged += newUser => + this.user.ValueChanged += e => { - total.Count = newUser?.Kudosu.Total ?? 0; - avaliable.Count = newUser?.Kudosu.Available ?? 0; + total.Count = e.NewValue?.Kudosu.Total ?? 0; + avaliable.Count = e.NewValue?.Kudosu.Available ?? 0; }; } diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs index 6439475a7b..af98a6a3a1 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs @@ -93,13 +93,13 @@ namespace osu.Game.Overlays.Profile.Sections User.TriggerChange(); } - private void onUserChanged(User newUser) + private void onUserChanged(ValueChangedEvent e) { VisiblePages = 0; ItemsContainer.Clear(); ShowMoreButton.Hide(); - if (newUser != null) + if (e.NewValue != null) ShowMore(); } diff --git a/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs b/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs index f5ec6c296a..dd4cfdaa5f 100644 --- a/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs +++ b/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs @@ -78,13 +78,13 @@ namespace osu.Game.Overlays.SearchableList }; bindable.ValueChanged += Bindable_ValueChanged; - Bindable_ValueChanged(bindable.Value); + Bindable_ValueChanged(new ValueChangedEvent(bindable.Value, bindable.Value)); Action = () => bindable.Value = this.style; } - private void Bindable_ValueChanged(PanelDisplayStyle style) + private void Bindable_ValueChanged(ValueChangedEvent e) { - icon.FadeTo(style == this.style ? 1.0f : 0.5f, 100); + icon.FadeTo(e.NewValue == style ? 1.0f : 0.5f, 100); } protected override void Dispose(bool isDisposing) diff --git a/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs b/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs index 26c2f57f14..50dd6ce5bf 100644 --- a/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs @@ -34,8 +34,8 @@ namespace osu.Game.Overlays.Settings.Sections.Debug }; configLatencyMode = config.GetBindable(DebugSetting.ActiveGCMode); - configLatencyMode.BindValueChanged(v => latencyMode.Value = (LatencyMode)v, true); - latencyMode.BindValueChanged(v => configLatencyMode.Value = (GCLatencyMode)v); + configLatencyMode.BindValueChanged(e => latencyMode.Value = (LatencyMode)e.NewValue, true); + latencyMode.BindValueChanged(e => configLatencyMode.Value = (GCLatencyMode)e.NewValue); } private enum LatencyMode diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 4fad999577..3591664be1 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -152,9 +152,9 @@ namespace osu.Game.Overlays.Settings.Sections.General panel.Status.BindTo(api.LocalUser.Value.Status); - dropdown.Current.ValueChanged += newValue => + dropdown.Current.ValueChanged += e => { - switch (newValue) + switch (e.NewValue) { case UserAction.Online: api.LocalUser.Value.Status.Value = new UserStatusOnline(); diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 9c5ef32251..d72d9de6a5 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -127,9 +127,9 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics Bindable = sizeFullscreen }; - windowModeDropdown.Bindable.BindValueChanged(windowMode => + windowModeDropdown.Bindable.BindValueChanged(e => { - if (windowMode == WindowMode.Fullscreen) + if (e.NewValue == WindowMode.Fullscreen) { resolutionDropdown.Show(); sizeFullscreen.TriggerChange(); @@ -139,15 +139,15 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }, true); } - scalingMode.BindValueChanged(mode => + scalingMode.BindValueChanged(e => { scalingSettings.ClearTransforms(); - scalingSettings.AutoSizeAxes = mode != ScalingMode.Off ? Axes.Y : Axes.None; + scalingSettings.AutoSizeAxes = e.NewValue != ScalingMode.Off ? Axes.Y : Axes.None; - if (mode == ScalingMode.Off) + if (e.NewValue == ScalingMode.Off) scalingSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint); - scalingSettings.ForEach(s => s.TransferValueOnCommit = mode == ScalingMode.Everything); + scalingSettings.ForEach(s => s.TransferValueOnCommit = e.NewValue == ScalingMode.Everything); }, true); } @@ -158,7 +158,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics /// A bindable which will propagate updates with a delay. private void bindPreviewEvent(Bindable bindable) { - bindable.ValueChanged += v => + bindable.ValueChanged += e => { switch (scalingMode.Value) { diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 05b685a12b..8991332a98 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -55,19 +55,19 @@ namespace osu.Game.Overlays.Settings.Sections.Input }, }; - rawInputToggle.ValueChanged += enabled => + rawInputToggle.ValueChanged += e => { // this is temporary until we support per-handler settings. const string raw_mouse_handler = @"OsuTKRawMouseHandler"; const string standard_mouse_handler = @"OsuTKMouseHandler"; - ignoredInputHandler.Value = enabled ? standard_mouse_handler : raw_mouse_handler; + ignoredInputHandler.Value = e.NewValue ? standard_mouse_handler : raw_mouse_handler; }; ignoredInputHandler = config.GetBindable(FrameworkSetting.IgnoredInputHandlers); - ignoredInputHandler.ValueChanged += handler => + ignoredInputHandler.ValueChanged += e => { - bool raw = !handler.Contains("Raw"); + bool raw = !e.NewValue.Contains("Raw"); rawInputToggle.Value = raw; sensitivity.Bindable.Disabled = !raw; }; diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index 7361d671de..5087f6e92b 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -76,8 +76,8 @@ namespace osu.Game.Overlays.Settings.Sections if (skinDropdown.Items.All(s => s.ID != configBindable.Value)) configBindable.Value = 0; - configBindable.BindValueChanged(v => dropdownBindable.Value = skinDropdown.Items.Single(s => s.ID == v), true); - dropdownBindable.BindValueChanged(v => configBindable.Value = v.ID); + configBindable.BindValueChanged(e => dropdownBindable.Value = skinDropdown.Items.Single(s => s.ID == e.NewValue), true); + dropdownBindable.BindValueChanged(e => configBindable.Value = e.NewValue.ID); } private void itemRemoved(SkinInfo s) => Schedule(() => skinDropdown.Items = skinDropdown.Items.Where(i => i.ID != s.ID).ToArray()); diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index ed66408acd..328f1e9d49 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -119,7 +119,7 @@ namespace osu.Game.Overlays.Settings set { bindable = value; - bindable.ValueChanged += newValue => UpdateState(); + bindable.ValueChanged += e => UpdateState(); bindable.DisabledChanged += disabled => UpdateState(); } } diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 802e97d92a..371a0b77da 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -104,15 +104,15 @@ namespace osu.Game.Overlays { AddInternal(Sidebar = new Sidebar { Width = sidebar_width }); - SectionsContainer.SelectedSection.ValueChanged += section => + SectionsContainer.SelectedSection.ValueChanged += e => { selectedSidebarButton.Selected = false; - selectedSidebarButton = Sidebar.Children.Single(b => b.Section == section); + selectedSidebarButton = Sidebar.Children.Single(b => b.Section == e.NewValue); selectedSidebarButton.Selected = true; }; } - searchTextBox.Current.ValueChanged += newValue => SectionsContainer.SearchContainer.SearchTerm = newValue; + searchTextBox.Current.ValueChanged += e => SectionsContainer.SearchContainer.SearchTerm = e.NewValue; CreateSections()?.ForEach(AddSection); } diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 2f14446564..da243add71 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -55,9 +55,9 @@ namespace osu.Game.Overlays Add(loading = new LoadingAnimation()); - Filter.Search.Current.ValueChanged += text => + Filter.Search.Current.ValueChanged += e => { - if (!string.IsNullOrEmpty(text)) + if (!string.IsNullOrEmpty(e.NewValue)) { // force searching in players until searching for friends is supported Header.Tabs.Current.Value = SocialTab.AllPlayers; @@ -67,18 +67,18 @@ namespace osu.Game.Overlays } }; - Header.Tabs.Current.ValueChanged += tab => Scheduler.AddOnce(updateSearch); + Header.Tabs.Current.ValueChanged += e => Scheduler.AddOnce(updateSearch); - Filter.Tabs.Current.ValueChanged += sortCriteria => Scheduler.AddOnce(updateSearch); + Filter.Tabs.Current.ValueChanged += e => Scheduler.AddOnce(updateSearch); - Filter.DisplayStyleControl.DisplayStyle.ValueChanged += recreatePanels; - Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += sortOrder => Scheduler.AddOnce(updateSearch); + Filter.DisplayStyleControl.DisplayStyle.ValueChanged += e => recreatePanels(e.NewValue); + Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += e => Scheduler.AddOnce(updateSearch); - currentQuery.ValueChanged += query => + currentQuery.ValueChanged += e => { queryChangedDebounce?.Cancel(); - if (string.IsNullOrEmpty(query)) + if (string.IsNullOrEmpty(e.NewValue)) Scheduler.AddOnce(updateSearch); else queryChangedDebounce = Scheduler.AddDelayed(updateSearch, 500); diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index 2dc9b15cc5..efb5706e24 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -85,7 +85,7 @@ namespace osu.Game.Overlays.Toolbar { StateChanged += visibility => { - if (overlayActivationMode == OverlayActivation.Disabled) + if (overlayActivationMode.Value == OverlayActivation.Disabled) State = Visibility.Hidden; }; diff --git a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs index 4b83e08292..4189df647a 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs @@ -45,13 +45,13 @@ namespace osu.Game.Overlays.Toolbar if (notificationOverlay != null) NotificationCount.BindTo(notificationOverlay.UnreadCount); - NotificationCount.ValueChanged += count => + NotificationCount.ValueChanged += e => { - if (count == 0) + if (e.NewValue == 0) countDisplay.FadeOut(200, Easing.OutQuint); else { - countDisplay.Count = count; + countDisplay.Count = e.NewValue; countDisplay.FadeIn(200, Easing.OutQuint); } }; diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 354a7b6b58..6c7e596fe5 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -115,11 +115,11 @@ namespace osu.Game.Overlays.Toolbar Size = new Vector2(modeButtons.DrawSize.X, 1); } - private void rulesetChanged(RulesetInfo ruleset) + private void rulesetChanged(ValueChangedEvent e) { foreach (ToolbarRulesetButton m in modeButtons.Children.Cast()) { - bool isActive = m.Ruleset.ID == ruleset.ID; + bool isActive = m.Ruleset.ID == e.NewValue.ID; m.Active = isActive; if (isActive) activeButton = m; diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs index 28a1d60c40..ba27d8dcad 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs @@ -57,7 +57,7 @@ namespace osu.Game.Overlays.Toolbar break; case APIState.Online: Text = api.LocalUser.Value.Username; - avatar.User = api.LocalUser; + avatar.User = api.LocalUser.Value; break; } } diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index d897c6c299..20c37e50cb 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -126,16 +126,16 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both } }); - sectionsContainer.SelectedSection.ValueChanged += s => + sectionsContainer.SelectedSection.ValueChanged += e => { - if (lastSection != s) + if (lastSection != e.NewValue) { - lastSection = s; + lastSection = e.NewValue; tabs.Current.Value = lastSection; } }; - tabs.Current.ValueChanged += s => + tabs.Current.ValueChanged += e => { if (lastSection == null) { @@ -144,9 +144,9 @@ namespace osu.Game.Overlays tabs.Current.Value = lastSection; return; } - if (lastSection != s) + if (lastSection != e.NewValue) { - lastSection = s; + lastSection = e.NewValue; sectionsContainer.ScrollTo(lastSection); } }; diff --git a/osu.Game/Overlays/Volume/MuteButton.cs b/osu.Game/Overlays/Volume/MuteButton.cs index 2c46ed5517..cb13eb615e 100644 --- a/osu.Game/Overlays/Volume/MuteButton.cs +++ b/osu.Game/Overlays/Volume/MuteButton.cs @@ -69,10 +69,10 @@ namespace osu.Game.Overlays.Volume } }); - Current.ValueChanged += newValue => + Current.ValueChanged += e => { - icon.Icon = newValue ? FontAwesome.fa_volume_off : FontAwesome.fa_volume_up; - icon.Margin = new MarginPadding { Left = newValue ? width / 2 - 15 : width / 2 - 10 }; //Magic numbers to line up both icons because they're different widths + icon.Icon = e.NewValue ? FontAwesome.fa_volume_off : FontAwesome.fa_volume_up; + icon.Margin = new MarginPadding { Left = e.NewValue ? width / 2 - 15 : width / 2 - 10 }; //Magic numbers to line up both icons because they're different widths }; Current.TriggerChange(); } diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index b7d13156de..9c565b15f1 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -175,10 +175,10 @@ namespace osu.Game.Overlays.Volume } } }; - Bindable.ValueChanged += newVolume => + Bindable.ValueChanged += e => { this.TransformTo("DisplayVolume", - newVolume, + e.NewValue, 400, Easing.OutQuint); }; @@ -218,7 +218,7 @@ namespace osu.Game.Overlays.Volume public double Volume { - get => Bindable; + get => Bindable.Value; private set => Bindable.Value = value; } diff --git a/osu.Game/Overlays/VolumeOverlay.cs b/osu.Game/Overlays/VolumeOverlay.cs index 95a1348941..265e024cac 100644 --- a/osu.Game/Overlays/VolumeOverlay.cs +++ b/osu.Game/Overlays/VolumeOverlay.cs @@ -74,9 +74,9 @@ namespace osu.Game.Overlays volumeMeterEffect.Bindable.BindTo(audio.VolumeSample); volumeMeterMusic.Bindable.BindTo(audio.VolumeTrack); - muteButton.Current.ValueChanged += mute => + muteButton.Current.ValueChanged += e => { - if (mute) + if (e.NewValue) audio.AddAdjustment(AdjustableProperty.Volume, muteAdjustment); else audio.RemoveAdjustment(AdjustableProperty.Volume, muteAdjustment); @@ -113,7 +113,7 @@ namespace osu.Game.Overlays return true; case GlobalAction.ToggleMute: Show(); - muteButton.Current.Value = !muteButton.Current; + muteButton.Current.Value = !muteButton.Current.Value; return true; } diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index 74acf80b7b..7178ddcd22 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -104,7 +104,7 @@ namespace osu.Game.Rulesets.Mods } } - protected abstract void OnComboChange(int newCombo); + protected abstract void OnComboChange(ValueChangedEvent e); protected abstract string FragmentShader { get; } diff --git a/osu.Game/Rulesets/Mods/ModHidden.cs b/osu.Game/Rulesets/Mods/ModHidden.cs index 465ead450c..4d49c58de5 100644 --- a/osu.Game/Rulesets/Mods/ModHidden.cs +++ b/osu.Game/Rulesets/Mods/ModHidden.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Mods public virtual void ApplyToDrawableHitObjects(IEnumerable drawables) { - foreach (var d in drawables.Skip(IncreaseFirstObjectVisibility ? 1 : 0)) + foreach (var d in drawables.Skip(IncreaseFirstObjectVisibility.Value ? 1 : 0)) d.ApplyCustomUpdateState += ApplyHiddenState; } diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 06fe22a95e..1e7548e21c 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -124,14 +124,14 @@ namespace osu.Game.Rulesets.Objects.Drawables { base.LoadComplete(); - State.ValueChanged += state => + State.ValueChanged += e => { - UpdateState(state); + UpdateState(e.NewValue); // apply any custom state overrides - ApplyCustomUpdateState?.Invoke(this, state); + ApplyCustomUpdateState?.Invoke(this, e.NewValue); - if (State == ArmedState.Hit) + if (e.NewValue == ArmedState.Hit) PlaySamples(); }; diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 45f2cbd7c8..05770f0db2 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -168,11 +168,11 @@ namespace osu.Game.Rulesets.Scoring /// public virtual void PopulateScore(ScoreInfo score) { - score.TotalScore = (int)Math.Round(TotalScore); - score.Combo = Combo; - score.MaxCombo = HighestCombo; - score.Accuracy = Math.Round(Accuracy, 4); - score.Rank = Rank; + score.TotalScore = (int)Math.Round(TotalScore.Value); + score.Combo = Combo.Value; + score.MaxCombo = HighestCombo.Value; + score.Accuracy = Math.Round(Accuracy.Value, 4); + score.Rank = Rank.Value; score.Date = DateTimeOffset.Now; var hitWindows = CreateHitWindows(); @@ -298,8 +298,8 @@ namespace osu.Game.Rulesets.Scoring /// The to apply. protected virtual void ApplyResult(JudgementResult result) { - result.ComboAtJudgement = Combo; - result.HighestComboAtJudgement = HighestCombo; + result.ComboAtJudgement = Combo.Value; + result.HighestComboAtJudgement = HighestCombo.Value; JudgedHits++; @@ -371,10 +371,10 @@ namespace osu.Game.Rulesets.Scoring { default: case ScoringMode.Standardised: - return max_score * (base_portion * baseScore / maxBaseScore + combo_portion * HighestCombo / maxHighestCombo) + bonusScore; + return max_score * (base_portion * baseScore / maxBaseScore + combo_portion * HighestCombo.Value / maxHighestCombo) + bonusScore; case ScoringMode.Classic: // should emulate osu-stable's scoring as closely as we can (https://osu.ppy.sh/help/wiki/Score/ScoreV1) - return bonusScore + baseScore * (1 + Math.Max(0, HighestCombo - 1) / 25); + return bonusScore + baseScore * (1 + Math.Max(0, HighestCombo.Value - 1) / 25); } } @@ -389,7 +389,7 @@ namespace osu.Game.Rulesets.Scoring if (storeResults) { MaxHits = JudgedHits; - maxHighestCombo = HighestCombo; + maxHighestCombo = HighestCombo.Value; maxBaseScore = baseScore; } diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index 0d020238aa..a67fe37dc1 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -94,12 +94,12 @@ namespace osu.Game.Rulesets.UI Ruleset = ruleset; playfield = new Lazy(CreatePlayfield); - IsPaused.ValueChanged += paused => + IsPaused.ValueChanged += e => { - if (HasReplayLoaded) + if (HasReplayLoaded.Value) return; - KeyBindingInputManager.UseParentInput = !paused; + KeyBindingInputManager.UseParentInput = !e.NewValue; }; Cursor = CreateCursor(); diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs index 26298588a9..4c08b84679 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs @@ -157,10 +157,10 @@ namespace osu.Game.Rulesets.UI.Scrolling switch (action) { case GlobalAction.IncreaseScrollSpeed: - this.TransformBindableTo(TimeRange, TimeRange - time_span_step, 200, Easing.OutQuint); + this.TransformBindableTo(TimeRange, TimeRange.Value - time_span_step, 200, Easing.OutQuint); return true; case GlobalAction.DecreaseScrollSpeed: - this.TransformBindableTo(TimeRange, TimeRange + time_span_step, 200, Easing.OutQuint); + this.TransformBindableTo(TimeRange, TimeRange.Value + time_span_step, 200, Easing.OutQuint); return true; } diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index 5d611d3bca..fa4bcc8eb2 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -61,7 +61,7 @@ namespace osu.Game.Screens.Edit.Components } }; - tabs.Current.ValueChanged += newValue => Beatmap.Value.Track.Tempo.Value = newValue; + tabs.Current.ValueChanged += e => Beatmap.Value.Track.Tempo.Value = e.NewValue; } protected override bool OnKeyDown(KeyDownEvent e) @@ -163,9 +163,9 @@ namespace osu.Game.Screens.Edit.Components private void updateState() { - text.FadeColour(Active || IsHovered ? hoveredColour : normalColour, fade_duration, Easing.OutQuint); - text.FadeTo(Active ? 0 : 1, fade_duration, Easing.OutQuint); - textBold.FadeTo(Active ? 1 : 0, fade_duration, Easing.OutQuint); + text.FadeColour(Active.Value || IsHovered ? hoveredColour : normalColour, fade_duration, Easing.OutQuint); + text.FadeTo(Active.Value ? 0 : 1, fade_duration, Easing.OutQuint); + textBold.FadeTo(Active.Value ? 1 : 0, fade_duration, Easing.OutQuint); } } } diff --git a/osu.Game/Screens/Edit/Components/RadioButtons/DrawableRadioButton.cs b/osu.Game/Screens/Edit/Components/RadioButtons/DrawableRadioButton.cs index 5d46f83ad3..5ed7db6294 100644 --- a/osu.Game/Screens/Edit/Components/RadioButtons/DrawableRadioButton.cs +++ b/osu.Game/Screens/Edit/Components/RadioButtons/DrawableRadioButton.cs @@ -80,10 +80,10 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons { base.LoadComplete(); - button.Selected.ValueChanged += v => + button.Selected.ValueChanged += e => { updateSelectionState(); - if (v) + if (e.NewValue) Selected?.Invoke(button); }; @@ -95,16 +95,16 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons if (!IsLoaded) return; - BackgroundColour = button.Selected ? selectedBackgroundColour : defaultBackgroundColour; - bubble.Colour = button.Selected ? selectedBubbleColour : defaultBubbleColour; + BackgroundColour = button.Selected.Value ? selectedBackgroundColour : defaultBackgroundColour; + bubble.Colour = button.Selected.Value ? selectedBubbleColour : defaultBubbleColour; } protected override bool OnClick(ClickEvent e) { - if (button.Selected) + if (button.Selected.Value) return true; - if (!Enabled) + if (!Enabled.Value) return true; button.Selected.Value = true; diff --git a/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs b/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs index eb433b1c0a..81aba84243 100644 --- a/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs +++ b/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs @@ -44,9 +44,9 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons private RadioButton currentlySelected; private void addButton(RadioButton button) { - button.Selected.ValueChanged += v => + button.Selected.ValueChanged += e => { - if (v) + if (e.NewValue) { currentlySelected?.Deselect(); currentlySelected = button; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs index edf7baf687..c6337844fc 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs @@ -24,10 +24,10 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts { AddInternal(timeline = new Container { RelativeSizeAxes = Axes.Both }); - Beatmap.ValueChanged += b => + Beatmap.ValueChanged += e => { updateRelativeChildSize(); - LoadBeatmap(b); + LoadBeatmap(e.NewValue); }; } diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs index f1bd70d4dd..a8035c915c 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs @@ -158,7 +158,7 @@ namespace osu.Game.Screens.Edit.Compose.Components { base.LoadComplete(); - beatDivisor.ValueChanged += v => updateText(); + beatDivisor.ValueChanged += e => updateText(); updateText(); } @@ -219,9 +219,9 @@ namespace osu.Game.Screens.Edit.Compose.Components AddInternal(marker = new Marker()); - CurrentNumber.ValueChanged += v => + CurrentNumber.ValueChanged += e => { - marker.MoveToX(getMappedPosition(v), 100, Easing.OutQuint); + marker.MoveToX(getMappedPosition(e.NewValue), 100, Easing.OutQuint); marker.Flash(); }; } @@ -238,11 +238,11 @@ namespace osu.Game.Screens.Edit.Compose.Components { case Key.Right: beatDivisor.Next(); - OnUserChange(Current); + OnUserChange(Current.Value); return true; case Key.Left: beatDivisor.Previous(); - OnUserChange(Current); + OnUserChange(Current.Value); return true; default: return false; @@ -279,7 +279,7 @@ namespace osu.Game.Screens.Edit.Compose.Components var xPosition = (ToLocalSpace(screenSpaceMousePosition).X - RangePadding) / UsableWidth; CurrentNumber.Value = availableDivisors.OrderBy(d => Math.Abs(getMappedPosition(d) - xPosition)).First(); - OnUserChange(Current); + OnUserChange(Current.Value); } private float getMappedPosition(float divisor) => (float)Math.Pow((divisor - 1) / (availableDivisors.Last() - 1), 0.90f); diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index b00d0b0b46..a83392a4f3 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -49,13 +49,13 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline // We don't want the centre marker to scroll AddInternal(new CentreMarker()); - WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible ? 1 : 0, 200, Easing.OutQuint); + WaveformVisible.ValueChanged += e => waveform.FadeTo(e.NewValue ? 1 : 0, 200, Easing.OutQuint); Beatmap.BindTo(beatmap); - Beatmap.BindValueChanged(b => + Beatmap.BindValueChanged(e => { - waveform.Waveform = b.Waveform; - track = b.Track; + waveform.Waveform = e.NewValue.Waveform; + track = e.NewValue.Track; }, true); } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index b147679cca..641c8762f1 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Screens.Edit.Components.Timelines.Summary; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Framework.Platform; @@ -222,11 +223,11 @@ namespace osu.Game.Screens.Edit private void exportBeatmap() => host.OpenFileExternally(Beatmap.Value.Save()); - private void onModeChanged(EditorScreenMode mode) + private void onModeChanged(ValueChangedEvent e) { currentScreen?.Exit(); - switch (mode) + switch (e.NewValue) { case EditorScreenMode.Compose: currentScreen = new ComposeScreen(); diff --git a/osu.Game/Screens/Edit/EditorClock.cs b/osu.Game/Screens/Edit/EditorClock.cs index 1660a1b703..8f65366650 100644 --- a/osu.Game/Screens/Edit/EditorClock.cs +++ b/osu.Game/Screens/Edit/EditorClock.cs @@ -46,7 +46,7 @@ namespace osu.Game.Screens.Edit public bool SeekSnapped(double position) { var timingPoint = ControlPointInfo.TimingPointAt(position); - double beatSnapLength = timingPoint.BeatLength / beatDivisor; + double beatSnapLength = timingPoint.BeatLength / beatDivisor.Value; // We will be snapping to beats within the timing point position -= timingPoint.Time; @@ -91,7 +91,7 @@ namespace osu.Game.Screens.Edit timingPoint = ControlPointInfo.TimingPoints[--activeIndex]; } - double seekAmount = timingPoint.BeatLength / beatDivisor * amount; + double seekAmount = timingPoint.BeatLength / beatDivisor.Value * amount; double seekTime = CurrentTime + seekAmount * direction; if (!snapped || ControlPointInfo.TimingPoints.Count == 0) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 4a09bfe142..cd73ee04b0 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -117,7 +117,7 @@ namespace osu.Game.Screens.Menu [BackgroundDependencyLoader(true)] private void load(AudioManager audio, IdleTracker idleTracker) { - isIdle.ValueChanged += updateIdleState; + isIdle.ValueChanged += e => updateIdleState(e.NewValue); if (idleTracker != null) isIdle.BindTo(idleTracker.IsIdle); diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index b0cfc5a0f8..14bc588999 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -52,7 +52,7 @@ namespace osu.Game.Screens.Menu BeatmapSetInfo setInfo = null; - if (!menuMusic) + if (!menuMusic.Value) { var sets = beatmaps.GetAllUsableBeatmapSets(); if (sets.Count > 0) @@ -93,13 +93,13 @@ namespace osu.Game.Screens.Menu { Beatmap.Value = introBeatmap; - if (menuVoice) + if (menuVoice.Value) welcome.Play(); Scheduler.AddDelayed(delegate { // Only start the current track if it is the menu music. A beatmap's track is started when entering the Main Manu. - if (menuMusic) + if (menuMusic.Value) track.Start(); LoadComponentAsync(mainMenu = new MainMenu()); @@ -158,7 +158,7 @@ namespace osu.Game.Screens.Menu double fadeOutTime = EXIT_DELAY; //we also handle the exit transition. - if (menuVoice) + if (menuVoice.Value) seeya.Play(); else fadeOutTime = 500; diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 04bc80ac87..37bd1b58e1 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -5,6 +5,7 @@ using osuTK; using osuTK.Graphics; using osuTK.Input; using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Framework.Screens; @@ -157,7 +158,7 @@ namespace osu.Game.Screens.Menu .OnComplete(l => buttons.SetOsuLogo(null)); } - private void beatmap_ValueChanged(WorkingBeatmap newValue) + private void beatmap_ValueChanged(ValueChangedEvent e) { if (!this.IsCurrentScreen()) return; diff --git a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs index 7a513a7f5f..b09c189369 100644 --- a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs +++ b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.Multi.Components [BackgroundDependencyLoader] private void load() { - CurrentItem.BindValueChanged(v => updateText(), true); + CurrentItem.BindValueChanged(e => updateText(), true); } private float textSize = OsuSpriteText.FONT_SIZE; diff --git a/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs b/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs index 4f432a232c..8e57e09272 100644 --- a/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs +++ b/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs @@ -51,11 +51,11 @@ namespace osu.Game.Screens.Multi.Components } }; - CurrentItem.BindValueChanged(item => + CurrentItem.BindValueChanged(e => { beatmapAuthor.Clear(); - var beatmap = item?.Beatmap; + var beatmap = e.NewValue?.Beatmap; if (beatmap != null) { diff --git a/osu.Game/Screens/Multi/Components/DisableableTabControl.cs b/osu.Game/Screens/Multi/Components/DisableableTabControl.cs index 5bbf4b064f..aa04ad5e56 100644 --- a/osu.Game/Screens/Multi/Components/DisableableTabControl.cs +++ b/osu.Game/Screens/Multi/Components/DisableableTabControl.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Multi.Components protected override bool OnClick(ClickEvent e) { - if (!Enabled) + if (!Enabled.Value) return true; return base.OnClick(e); } diff --git a/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs b/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs index 0d49f75b46..058560381c 100644 --- a/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs +++ b/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs @@ -46,9 +46,9 @@ namespace osu.Game.Screens.Multi.Components }, }; - CurrentItem.BindValueChanged(updateBeatmap, true); + CurrentItem.BindValueChanged(e => updateBeatmap(e.NewValue), true); - Type.BindValueChanged(v => gameTypeContainer.Child = new DrawableGameType(v) { Size = new Vector2(height) }, true); + Type.BindValueChanged(e => gameTypeContainer.Child = new DrawableGameType(e.NewValue) { Size = new Vector2(height) }, true); } private void updateBeatmap(PlaylistItem item) diff --git a/osu.Game/Screens/Multi/Components/MultiplayerBackgroundSprite.cs b/osu.Game/Screens/Multi/Components/MultiplayerBackgroundSprite.cs index 06d5e585ab..257c2ff54e 100644 --- a/osu.Game/Screens/Multi/Components/MultiplayerBackgroundSprite.cs +++ b/osu.Game/Screens/Multi/Components/MultiplayerBackgroundSprite.cs @@ -16,7 +16,7 @@ namespace osu.Game.Screens.Multi.Components InternalChild = sprite = CreateBackgroundSprite(); - CurrentItem.BindValueChanged(i => sprite.Beatmap.Value = i?.Beatmap, true); + CurrentItem.BindValueChanged(e => sprite.Beatmap.Value = e.NewValue?.Beatmap, true); } protected virtual UpdateableBeatmapBackgroundSprite CreateBackgroundSprite() => new UpdateableBeatmapBackgroundSprite { RelativeSizeAxes = Axes.Both }; diff --git a/osu.Game/Screens/Multi/Components/ParticipantCount.cs b/osu.Game/Screens/Multi/Components/ParticipantCount.cs index 27bfc9a3f7..13d81d641c 100644 --- a/osu.Game/Screens/Multi/Components/ParticipantCount.cs +++ b/osu.Game/Screens/Multi/Components/ParticipantCount.cs @@ -52,7 +52,7 @@ namespace osu.Game.Screens.Multi.Components }; MaxParticipants.BindValueChanged(_ => updateMax(), true); - ParticipantCount.BindValueChanged(v => count.Text = v.ToString("#,0"), true); + ParticipantCount.BindValueChanged(e => count.Text = e.NewValue.ToString("#,0"), true); } private void updateMax() diff --git a/osu.Game/Screens/Multi/Components/RoomStatusInfo.cs b/osu.Game/Screens/Multi/Components/RoomStatusInfo.cs index 24a2d70b60..85f2111e60 100644 --- a/osu.Game/Screens/Multi/Components/RoomStatusInfo.cs +++ b/osu.Game/Screens/Multi/Components/RoomStatusInfo.cs @@ -54,7 +54,7 @@ namespace osu.Game.Screens.Multi.Components public EndDatePart() : base(DateTimeOffset.UtcNow) { - EndDate.BindValueChanged(d => Date = d); + EndDate.BindValueChanged(e => Date = e.NewValue); } protected override string Format() diff --git a/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs b/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs index 6d573d0866..3a6c4a883d 100644 --- a/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs +++ b/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.Multi.Components [BackgroundDependencyLoader] private void load(OsuColour colours) { - status.BindValueChanged(s => this.FadeColour(s.GetAppropriateColour(colours), transitionDuration), true); + status.BindValueChanged(e => this.FadeColour(e.NewValue.GetAppropriateColour(colours), transitionDuration), true); } } } diff --git a/osu.Game/Screens/Multi/Header.cs b/osu.Game/Screens/Multi/Header.cs index 687a28b7a6..015892fa74 100644 --- a/osu.Game/Screens/Multi/Header.cs +++ b/osu.Game/Screens/Multi/Header.cs @@ -85,9 +85,9 @@ namespace osu.Game.Screens.Multi }, }; - breadcrumbs.Current.ValueChanged += s => + breadcrumbs.Current.ValueChanged += e => { - if (s is IMultiplayerSubScreen mpScreen) + if (e.NewValue is IMultiplayerSubScreen mpScreen) screenType.Text = mpScreen.ShortTitle.ToLowerInvariant(); }; diff --git a/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs b/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs index 950d475a30..828c9bfecb 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs @@ -45,8 +45,8 @@ namespace osu.Game.Screens.Multi.Lounge.Components filter.Value = new FilterCriteria { SearchString = Search.Current.Value ?? string.Empty, - PrimaryFilter = Tabs.Current, - SecondaryFilter = DisplayStyleControl.Dropdown.Current + PrimaryFilter = Tabs.Current.Value, + SecondaryFilter = DisplayStyleControl.Dropdown.Current.Value }; } } diff --git a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs index 806bc92882..77e6d6b19e 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs @@ -87,22 +87,22 @@ namespace osu.Game.Screens.Multi.Lounge.Components }, }; - Host.BindValueChanged(v => + Host.BindValueChanged(e => { hostText.Clear(); flagContainer.Clear(); - if (v != null) + if (e.NewValue != null) { hostText.AddText("hosted by "); - hostText.AddLink(v.Username, null, LinkAction.OpenUserProfile, v.Id.ToString(), "Open profile", s => s.Font = "Exo2.0-BoldItalic"); - flagContainer.Child = new DrawableFlag(v.Country) { RelativeSizeAxes = Axes.Both }; + hostText.AddLink(e.NewValue.Username, null, LinkAction.OpenUserProfile, e.NewValue.Id.ToString(), "Open profile", s => s.Font = "Exo2.0-BoldItalic"); + flagContainer.Child = new DrawableFlag(e.NewValue.Country) { RelativeSizeAxes = Axes.Both }; } }, true); - ParticipantCount.BindValueChanged(v => summary.Text = $"{v:#,0}{" participant".Pluralize(v == 1)}", true); + ParticipantCount.BindValueChanged(e => summary.Text = $"{e.NewValue:#,0}{" participant".Pluralize(e.NewValue == 1)}", true); - /*Participants.BindValueChanged(v => + /*Participants.BindValueChanged(e => { var ranks = v.Select(u => u.Statistics.Ranks.Global); levelRangeLower.Text = ranks.Min().ToString(); diff --git a/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs b/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs index 3e665ab27e..f37260a33d 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs @@ -192,7 +192,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components } else { - status.Value = Status; + status.Value = Status.Value; participantCount.FadeIn(transition_duration); beatmapTypeInfo.FadeIn(transition_duration); @@ -215,7 +215,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components [BackgroundDependencyLoader] private void load() { - status.BindValueChanged(s => Text = s.Message, true); + status.BindValueChanged(e => Text = e.NewValue.Message, true); } } diff --git a/osu.Game/Screens/Multi/Lounge/Components/RoomsContainer.cs b/osu.Game/Screens/Multi/Lounge/Components/RoomsContainer.cs index baeac900ee..d1c7a9531a 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/RoomsContainer.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/RoomsContainer.cs @@ -109,7 +109,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components private void updateSorting() { foreach (var room in roomFlow) - roomFlow.SetLayoutPosition(room, room.Room.Position); + roomFlow.SetLayoutPosition(room, room.Room.Position.Value); } private void selectRoom(Room room) diff --git a/osu.Game/Screens/Multi/Match/Components/Header.cs b/osu.Game/Screens/Multi/Match/Components/Header.cs index 9a0fdbd4e7..8be0273cab 100644 --- a/osu.Game/Screens/Multi/Match/Components/Header.cs +++ b/osu.Game/Screens/Multi/Match/Components/Header.cs @@ -108,7 +108,7 @@ namespace osu.Game.Screens.Multi.Match.Components }, }; - CurrentItem.BindValueChanged(i => modDisplay.Current.Value = i?.RequiredMods, true); + CurrentItem.BindValueChanged(e => modDisplay.Current.Value = e.NewValue?.RequiredMods, true); beatmapButton.Action = () => RequestBeatmapSelection?.Invoke(); } @@ -126,7 +126,7 @@ namespace osu.Game.Screens.Multi.Match.Components [BackgroundDependencyLoader] private void load() { - roomId.BindValueChanged(v => this.FadeTo(v.HasValue ? 0 : 1), true); + roomId.BindValueChanged(e => this.FadeTo(e.NewValue.HasValue ? 0 : 1), true); } } diff --git a/osu.Game/Screens/Multi/Match/Components/HostInfo.cs b/osu.Game/Screens/Multi/Match/Components/HostInfo.cs index 942e03b306..6b6d50087c 100644 --- a/osu.Game/Screens/Multi/Match/Components/HostInfo.cs +++ b/osu.Game/Screens/Multi/Match/Components/HostInfo.cs @@ -42,7 +42,7 @@ namespace osu.Game.Screens.Multi.Match.Components } }; - Host.BindValueChanged(updateHost); + Host.BindValueChanged(e => updateHost(e.NewValue)); } private void updateHost(User host) diff --git a/osu.Game/Screens/Multi/Match/Components/Info.cs b/osu.Game/Screens/Multi/Match/Components/Info.cs index b27c5b0ab4..eafb772c24 100644 --- a/osu.Game/Screens/Multi/Match/Components/Info.cs +++ b/osu.Game/Screens/Multi/Match/Components/Info.cs @@ -92,10 +92,10 @@ namespace osu.Game.Screens.Multi.Match.Components }, }; - CurrentItem.BindValueChanged(item => + CurrentItem.BindValueChanged(e => { - viewBeatmapButton.Beatmap.Value = item?.Beatmap; - readyButton.Beatmap.Value = item?.Beatmap; + viewBeatmapButton.Beatmap.Value = e.NewValue?.Beatmap; + readyButton.Beatmap.Value = e.NewValue?.Beatmap; }, true); hostInfo.Host.BindTo(Host); diff --git a/osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs b/osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs index 0b61637cd5..bcae036bba 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs @@ -28,13 +28,13 @@ namespace osu.Game.Screens.Multi.Match.Components { base.LoadComplete(); - roomId.BindValueChanged(v => updateChannel(), true); + roomId.BindValueChanged(e => updateChannel(), true); } private void updateChannel() { if (roomId.Value != null) - Channel.Value = channelManager?.JoinChannel(new Channel { Id = channelId, Type = ChannelType.Multiplayer, Name = $"#mp_{roomId.Value}" }); + Channel.Value = channelManager?.JoinChannel(new Channel { Id = channelId.Value, Type = ChannelType.Multiplayer, Name = $"#mp_{roomId.Value}" }); } } } diff --git a/osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs b/osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs index 60604eeb5c..19e8b18b0e 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs @@ -23,9 +23,9 @@ namespace osu.Game.Screens.Multi.Match.Components [BackgroundDependencyLoader] private void load() { - roomId.BindValueChanged(id => + roomId.BindValueChanged(e => { - if (id == null) + if (e.NewValue == null) return; Scores = null; diff --git a/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs b/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs index c3169ebe94..ef0845ae8d 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs @@ -264,12 +264,12 @@ namespace osu.Game.Screens.Multi.Match.Components processingOverlay = new ProcessingOverlay { Alpha = 0 } }; - TypePicker.Current.BindValueChanged(t => typeLabel.Text = t?.Name ?? string.Empty, true); - Name.BindValueChanged(n => NameField.Text = n, true); - Availability.BindValueChanged(a => AvailabilityPicker.Current.Value = a, true); - Type.BindValueChanged(t => TypePicker.Current.Value = t, true); - MaxParticipants.BindValueChanged(m => MaxParticipantsField.Text = m?.ToString(), true); - Duration.BindValueChanged(d => DurationField.Current.Value = d, true); + TypePicker.Current.BindValueChanged(e => typeLabel.Text = e.NewValue?.Name ?? string.Empty, true); + Name.BindValueChanged(e => NameField.Text = e.NewValue, true); + Availability.BindValueChanged(e => AvailabilityPicker.Current.Value = e.NewValue, true); + Type.BindValueChanged(e => TypePicker.Current.Value = e.NewValue, true); + MaxParticipants.BindValueChanged(e => MaxParticipantsField.Text = e.NewValue?.ToString(), true); + Duration.BindValueChanged(e => DurationField.Current.Value = e.NewValue, true); } protected override void Update() @@ -296,7 +296,7 @@ namespace osu.Game.Screens.Multi.Match.Components Duration.Value = DurationField.Current.Value; - manager?.CreateRoom(currentRoom, onSuccess, onError); + manager?.CreateRoom(currentRoom.Value, onSuccess, onError); processingOverlay.Show(); } diff --git a/osu.Game/Screens/Multi/Match/Components/MatchTabControl.cs b/osu.Game/Screens/Multi/Match/Components/MatchTabControl.cs index 7ac1016e72..d071dabf4c 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchTabControl.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchTabControl.cs @@ -26,9 +26,9 @@ namespace osu.Game.Screens.Multi.Match.Components [BackgroundDependencyLoader] private void load() { - roomId.BindValueChanged(v => + roomId.BindValueChanged(e => { - if (v.HasValue) + if (e.NewValue.HasValue) { Items.ForEach(t => t.Enabled.Value = !(t is SettingsMatchPage)); Current.Value = new RoomMatchPage(); @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Multi.Match.Components : base(value) { enabled.BindTo(value.Enabled); - enabled.BindValueChanged(v => Colour = v ? Color4.White : Color4.Gray); + enabled.BindValueChanged(e => Colour = e.NewValue ? Color4.White : Color4.Gray); } protected override bool OnClick(ClickEvent e) diff --git a/osu.Game/Screens/Multi/Match/Components/Participants.cs b/osu.Game/Screens/Multi/Match/Components/Participants.cs index 1565d75c21..ac349cc711 100644 --- a/osu.Game/Screens/Multi/Match/Components/Participants.cs +++ b/osu.Game/Screens/Multi/Match/Components/Participants.cs @@ -50,9 +50,9 @@ namespace osu.Game.Screens.Multi.Match.Components }, }; - Participants.BindValueChanged(v => + Participants.BindValueChanged(e => { - usersFlow.Children = v.Select(u => new UserPanel(u) + usersFlow.Children = e.NewValue.Select(u => new UserPanel(u) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, diff --git a/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs b/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs index 50cf2addeb..837d5ab531 100644 --- a/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs +++ b/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs @@ -40,7 +40,7 @@ namespace osu.Game.Screens.Multi.Match.Components { beatmaps.ItemAdded += beatmapAdded; - Beatmap.BindValueChanged(updateBeatmap, true); + Beatmap.BindValueChanged(e => updateBeatmap(e.NewValue), true); } private void updateBeatmap(BeatmapInfo beatmap) @@ -77,7 +77,7 @@ namespace osu.Game.Screens.Multi.Match.Components return; } - bool hasEnoughTime = DateTimeOffset.UtcNow.AddSeconds(30).AddMilliseconds(gameBeatmap.Value.Track.Length) < endDate; + bool hasEnoughTime = DateTimeOffset.UtcNow.AddSeconds(30).AddMilliseconds(gameBeatmap.Value.Track.Length) < endDate.Value; Enabled.Value = hasBeatmap && hasEnoughTime; } diff --git a/osu.Game/Screens/Multi/Match/Components/ViewBeatmapButton.cs b/osu.Game/Screens/Multi/Match/Components/ViewBeatmapButton.cs index e26a6b7e20..70fe4bce34 100644 --- a/osu.Game/Screens/Multi/Match/Components/ViewBeatmapButton.cs +++ b/osu.Game/Screens/Multi/Match/Components/ViewBeatmapButton.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Multi.Match.Components private void load() { if (osuGame != null) - Beatmap.BindValueChanged(updateAction, true); + Beatmap.BindValueChanged(e => updateAction(e.NewValue), true); } private void updateAction(BeatmapInfo beatmap) diff --git a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs index d97b32e54a..c28363d44b 100644 --- a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs +++ b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Multi.Match public MatchSubScreen(Room room) { - Title = room.RoomID.Value == null ? "New room" : room.Name; + Title = room.RoomID.Value == null ? "New room" : room.Name.Value; } [BackgroundDependencyLoader] @@ -146,10 +146,10 @@ namespace osu.Game.Screens.Multi.Match }, }; - header.Tabs.Current.BindValueChanged(t => + header.Tabs.Current.BindValueChanged(e => { const float fade_duration = 500; - if (t is SettingsMatchPage) + if (e.NewValue is SettingsMatchPage) { settings.Show(); info.FadeOut(fade_duration, Easing.OutQuint); @@ -188,15 +188,15 @@ namespace osu.Game.Screens.Multi.Match /// /// Handles propagation of the current playlist item's content to game-wide mechanisms. /// - private void currentItemChanged(PlaylistItem item) + private void currentItemChanged(ValueChangedEvent e) { // Retrieve the corresponding local beatmap, since we can't directly use the playlist's beatmap info - var localBeatmap = item?.Beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == item.Beatmap.OnlineBeatmapID); + var localBeatmap = e.NewValue?.Beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == e.NewValue.Beatmap.OnlineBeatmapID); Beatmap.Value = beatmapManager.GetWorkingBeatmap(localBeatmap); - CurrentMods.Value = item?.RequiredMods ?? Enumerable.Empty(); - if (item?.Ruleset != null) - Ruleset.Value = item.Ruleset; + CurrentMods.Value = e.NewValue?.RequiredMods ?? Enumerable.Empty(); + if (e.NewValue?.Ruleset != null) + Ruleset.Value = e.NewValue.Ruleset; } /// @@ -228,7 +228,7 @@ namespace osu.Game.Screens.Multi.Match { default: case GameTypeTimeshift _: - multiplayer?.Start(() => new TimeshiftPlayer(CurrentItem) + multiplayer?.Start(() => new TimeshiftPlayer(CurrentItem.Value) { Exited = () => leaderboard.RefreshScores() }); diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index 32eea88fbc..0c7ce86f03 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -135,7 +135,7 @@ namespace osu.Game.Screens.Multi protected override void LoadComplete() { base.LoadComplete(); - isIdle.BindValueChanged(updatePollingRate, true); + isIdle.BindValueChanged(e => updatePollingRate(e.NewValue), true); } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) diff --git a/osu.Game/Screens/Multi/Ranking/MatchResults.cs b/osu.Game/Screens/Multi/Ranking/MatchResults.cs index db52a79ccb..fe68d7e849 100644 --- a/osu.Game/Screens/Multi/Ranking/MatchResults.cs +++ b/osu.Game/Screens/Multi/Ranking/MatchResults.cs @@ -18,9 +18,9 @@ namespace osu.Game.Screens.Multi.Ranking protected override IEnumerable CreateResultPages() => new IResultPageInfo[] { - new ScoreOverviewPageInfo(Score, Beatmap), - new LocalLeaderboardPageInfo(Score, Beatmap), - new RoomLeaderboardPageInfo(Score, Beatmap), + new ScoreOverviewPageInfo(Score, Beatmap.Value), + new LocalLeaderboardPageInfo(Score, Beatmap.Value), + new RoomLeaderboardPageInfo(Score, Beatmap.Value), }; } } diff --git a/osu.Game/Screens/Multi/RoomManager.cs b/osu.Game/Screens/Multi/RoomManager.cs index b1f021618f..4fef0cd5e2 100644 --- a/osu.Game/Screens/Multi/RoomManager.cs +++ b/osu.Game/Screens/Multi/RoomManager.cs @@ -56,7 +56,7 @@ namespace osu.Game.Screens.Multi public void CreateRoom(Room room, Action onSuccess = null, Action onError = null) { - room.Host.Value = api.LocalUser; + room.Host.Value = api.LocalUser.Value; var req = new CreateRoomRequest(room); diff --git a/osu.Game/Screens/Play/Break/BreakInfoLine.cs b/osu.Game/Screens/Play/Break/BreakInfoLine.cs index d2b8b8c26a..312805bbbc 100644 --- a/osu.Game/Screens/Play/Break/BreakInfoLine.cs +++ b/osu.Game/Screens/Play/Break/BreakInfoLine.cs @@ -51,9 +51,9 @@ namespace osu.Game.Screens.Play.Break Current.ValueChanged += currentValueChanged; } - private void currentValueChanged(T newValue) + private void currentValueChanged(ValueChangedEvent e) { - var newText = prefix + Format(newValue); + var newText = prefix + Format(e.NewValue); if (valueText.Text == newText) return; diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index dc0636c44f..7395736035 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -176,7 +176,7 @@ namespace osu.Game.Screens.Play } }; - button.Selected.ValueChanged += s => buttonSelectionChanged(button, s); + button.Selected.ValueChanged += e => buttonSelectionChanged(button, e.NewValue); InternalButtons.Add(button); } @@ -292,7 +292,7 @@ namespace osu.Game.Screens.Play protected override bool OnKeyDown(KeyDownEvent e) { - if (e.Repeat || e.Key != Key.Enter || !Selected) + if (e.Repeat || e.Key != Key.Enter || !Selected.Value) return false; Click(); diff --git a/osu.Game/Screens/Play/HUD/ComboCounter.cs b/osu.Game/Screens/Play/HUD/ComboCounter.cs index b45b1bb8a5..5996894c3b 100644 --- a/osu.Game/Screens/Play/HUD/ComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboCounter.cs @@ -63,14 +63,14 @@ namespace osu.Game.Screens.Play.HUD TextSize = 80; - Current.ValueChanged += newValue => updateCount(newValue == 0); + Current.ValueChanged += e => updateCount(e.NewValue == 0); } protected override void LoadComplete() { base.LoadComplete(); - DisplayedCountSpriteText.Text = FormatCount(Current); + DisplayedCountSpriteText.Text = FormatCount(Current.Value); DisplayedCountSpriteText.Anchor = Anchor; DisplayedCountSpriteText.Origin = Origin; @@ -110,7 +110,7 @@ namespace osu.Game.Screens.Play.HUD /// public void Increment(int amount = 1) { - Current.Value = Current + amount; + Current.Value = Current.Value + amount; } /// @@ -161,7 +161,7 @@ namespace osu.Game.Screens.Play.HUD private void updateCount(bool rolling) { int prev = previousValue; - previousValue = Current; + previousValue = Current.Value; if (!IsLoaded) return; @@ -172,14 +172,14 @@ namespace osu.Game.Screens.Play.HUD IsRolling = false; DisplayedCount = prev; - if (prev + 1 == Current) - OnCountIncrement(prev, Current); + if (prev + 1 == Current.Value) + OnCountIncrement(prev, Current.Value); else - OnCountChange(prev, Current); + OnCountChange(prev, Current.Value); } else { - OnCountRolling(displayedCount, Current); + OnCountRolling(displayedCount, Current.Value); IsRolling = true; } } diff --git a/osu.Game/Screens/Play/HUD/ComboResultCounter.cs b/osu.Game/Screens/Play/HUD/ComboResultCounter.cs index a45a1dbc68..3f6b1e29e6 100644 --- a/osu.Game/Screens/Play/HUD/ComboResultCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboResultCounter.cs @@ -26,7 +26,7 @@ namespace osu.Game.Screens.Play.HUD public override void Increment(long amount) { - Current.Value = Current + amount; + Current.Value = Current.Value + amount; } } } diff --git a/osu.Game/Screens/Play/HUD/HealthDisplay.cs b/osu.Game/Screens/Play/HUD/HealthDisplay.cs index cc3b4e8254..2c010b3beb 100644 --- a/osu.Game/Screens/Play/HUD/HealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/HealthDisplay.cs @@ -16,7 +16,7 @@ namespace osu.Game.Screens.Play.HUD protected HealthDisplay() { - Current.ValueChanged += newValue => SetHealth((float)newValue); + Current.ValueChanged += e => SetHealth((float)e.NewValue); } protected abstract void SetHealth(float value); diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs index a0bcc3460b..5692508b32 100644 --- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs +++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs @@ -163,7 +163,7 @@ namespace osu.Game.Screens.Play.HUD private void bind() { circularProgress.Current.BindTo(Progress); - Progress.ValueChanged += v => icon.Scale = new Vector2(1 + (float)v * 0.2f); + Progress.ValueChanged += e => icon.Scale = new Vector2(1 + (float)e.NewValue * 0.2f); } private bool pendingAnimation; diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index d329902a2d..d3861988ff 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -65,10 +65,10 @@ namespace osu.Game.Screens.Play.HUD } }; - Current.ValueChanged += mods => + Current.ValueChanged += e => { iconsContainer.Clear(); - foreach (Mod mod in mods) + foreach (Mod mod in e.NewValue) { iconsContainer.Add(new ModIcon(mod) { Scale = new Vector2(0.6f) }); } diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 1b1862d587..9715ae40ea 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -92,7 +92,7 @@ namespace osu.Game.Screens.Play Progress.Objects = rulesetContainer.Objects; Progress.AudioClock = offsetClock; - Progress.AllowSeeking = rulesetContainer.HasReplayLoaded; + Progress.AllowSeeking = rulesetContainer.HasReplayLoaded.Value; Progress.OnSeek = pos => adjustableClock.Seek(pos); ModDisplay.Current.BindTo(working.Mods); @@ -104,10 +104,10 @@ namespace osu.Game.Screens.Play private void load(OsuConfigManager config, NotificationOverlay notificationOverlay) { showHud = config.GetBindable(OsuSetting.ShowInterface); - showHud.ValueChanged += hudVisibility => visibilityContainer.FadeTo(hudVisibility ? 1 : 0, duration); + showHud.ValueChanged += e => visibilityContainer.FadeTo(e.NewValue ? 1 : 0, duration); showHud.TriggerChange(); - if (!showHud && !hasShownNotificationOnce) + if (!showHud.Value && !hasShownNotificationOnce) { hasShownNotificationOnce = true; @@ -126,11 +126,11 @@ namespace osu.Game.Screens.Play replayLoaded.TriggerChange(); } - private void replayLoadedValueChanged(bool loaded) + private void replayLoadedValueChanged(ValueChangedEvent e) { - PlayerSettingsOverlay.ReplayLoaded = loaded; + PlayerSettingsOverlay.ReplayLoaded = e.NewValue; - if (loaded) + if (e.NewValue) { PlayerSettingsOverlay.Show(); ModDisplay.FadeIn(200); diff --git a/osu.Game/Screens/Play/PauseContainer.cs b/osu.Game/Screens/Play/PauseContainer.cs index 7889be493e..16557b0b35 100644 --- a/osu.Game/Screens/Play/PauseContainer.cs +++ b/osu.Game/Screens/Play/PauseContainer.cs @@ -78,7 +78,7 @@ namespace osu.Game.Screens.Play { if (!CanPause && !force) return; - if (IsPaused) return; + if (IsPaused.Value) return; // stop the seekable clock (stops the audio eventually) decoupledClock.Stop(); @@ -91,7 +91,7 @@ namespace osu.Game.Screens.Play public void Resume() { - if (!IsPaused) return; + if (!IsPaused.Value) return; IsPaused.Value = false; IsResuming = false; @@ -119,7 +119,7 @@ namespace osu.Game.Screens.Play if (!game.IsActive.Value && CanPause) Pause(); - if (!IsPaused) + if (!IsPaused.Value) framedClock.ProcessFrame(); base.Update(); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2ab207e47a..ab49899cf8 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -159,7 +159,7 @@ namespace osu.Game.Screens.Play // the final usable gameplay clock with user-set offsets applied. var offsetClock = new FramedOffsetClock(platformOffsetClock); - userAudioOffset.ValueChanged += v => offsetClock.Offset = v; + userAudioOffset.ValueChanged += e => offsetClock.Offset = e.NewValue; userAudioOffset.TriggerChange(); ScoreProcessor = RulesetContainer.CreateScoreProcessor(); @@ -173,7 +173,7 @@ namespace osu.Game.Screens.Play Retries = RestartCount, OnRetry = Restart, OnQuit = performUserRequestedExit, - CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded, + CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded.Value, Children = new[] { storyboardContainer = new Container @@ -238,7 +238,7 @@ namespace osu.Game.Screens.Play RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused); - if (ShowStoryboard) + if (ShowStoryboard.Value) initializeStoryboard(false); // Bind ScoreProcessor to ourselves @@ -356,7 +356,7 @@ namespace osu.Game.Screens.Play this.Delay(750).Schedule(() => { - if (!pauseContainer.IsPaused) + if (!pauseContainer.IsPaused.Value) { adjustableClock.Start(); } @@ -405,7 +405,7 @@ namespace osu.Game.Screens.Play Background?.FadeColour(Color4.White, fadeOutDuration, Easing.OutQuint); } - protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !pauseContainer.IsPaused; + protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !pauseContainer.IsPaused.Value; private void initializeStoryboard(bool asyncLoad) { @@ -429,11 +429,11 @@ namespace osu.Game.Screens.Play base.UpdateBackgroundElements(); - if (ShowStoryboard && storyboard == null) + if (ShowStoryboard.Value && storyboard == null) initializeStoryboard(true); var beatmap = Beatmap.Value; - var storyboardVisible = ShowStoryboard && beatmap.Storyboard.HasDrawable; + var storyboardVisible = ShowStoryboard.Value && beatmap.Storyboard.HasDrawable; storyboardContainer? .FadeColour(OsuColour.Gray(BackgroundOpacity), BACKGROUND_FADE_DURATION, Easing.OutQuint) diff --git a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs index f752243c52..fff24eed72 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs @@ -69,7 +69,7 @@ namespace osu.Game.Screens.Play.PlayerSettings var clockRate = AdjustableClock.Rate; // can't trigger this line instantly as the underlying clock may not be ready to accept adjustments yet. - sliderbar.Bindable.ValueChanged += multiplier => AdjustableClock.Rate = clockRate * multiplier; + sliderbar.Bindable.ValueChanged += e => AdjustableClock.Rate = clockRate * e.NewValue; sliderbar.Bindable.BindValueChanged(multiplier => multiplierText.Text = $"{multiplier:0.0}x", true); } diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 7e01a84da2..6b9aa062c5 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -20,7 +20,7 @@ namespace osu.Game.Screens.Play protected const float BACKGROUND_FADE_DURATION = 800; - protected float BackgroundOpacity => 1 - (float)DimLevel; + protected float BackgroundOpacity => 1 - (float)DimLevel.Value; #region User Settings diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index d3db126ae4..cef894084d 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -313,7 +313,7 @@ namespace osu.Game.Screens.Play protected override bool OnClick(ClickEvent e) { - if (!Enabled) + if (!Enabled.Value) return false; sampleConfirm.Play(); diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index ba67882d56..750b10e1ab 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -104,7 +104,7 @@ namespace osu.Game.Screens.Play { State = Visibility.Visible; - replayLoaded.ValueChanged += v => AllowSeeking = v; + replayLoaded.ValueChanged += e => AllowSeeking = e.NewValue; replayLoaded.TriggerChange(); } diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index a70d6bd87f..cd1b4ded8d 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -268,12 +268,12 @@ namespace osu.Game.Screens.Ranking modeChangeButtons.AddItem(t); modeChangeButtons.Current.Value = modeChangeButtons.Items.FirstOrDefault(); - modeChangeButtons.Current.BindValueChanged(m => + modeChangeButtons.Current.BindValueChanged(e => { currentPage?.FadeOut(); currentPage?.Expire(); - currentPage = m?.CreatePage(); + currentPage = e.NewValue?.CreatePage(); if (currentPage != null) circleInner.Add(currentPage); diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 1670bf4de8..4d17363702 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -37,7 +37,7 @@ namespace osu.Game.Screens.Select /// public BeatmapInfo SelectedBeatmap => selectedBeatmap?.Beatmap; - private CarouselBeatmap selectedBeatmap => selectedBeatmapSet?.Beatmaps.FirstOrDefault(s => s.State == CarouselItemState.Selected); + private CarouselBeatmap selectedBeatmap => selectedBeatmapSet?.Beatmaps.FirstOrDefault(s => s.State.Value == CarouselItemState.Selected); /// /// The currently selected beatmap set. @@ -130,7 +130,7 @@ namespace osu.Game.Screens.Select config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm); config.BindWith(OsuSetting.SongSelectRightMouseScroll, RightClickScrollingEnabled); - RightClickScrollingEnabled.ValueChanged += v => RightMouseScrollbar = v; + RightClickScrollingEnabled.ValueChanged += e => RightMouseScrollbar = e.NewValue; RightClickScrollingEnabled.TriggerChange(); } @@ -196,7 +196,7 @@ namespace osu.Game.Screens.Select foreach (CarouselBeatmapSet set in beatmapSets) { - if (!bypassFilters && set.Filtered) + if (!bypassFilters && set.Filtered.Value) continue; var item = set.Beatmaps.FirstOrDefault(p => p.Beatmap.Equals(beatmap)); @@ -205,9 +205,9 @@ namespace osu.Game.Screens.Select // The beatmap that needs to be selected doesn't exist in this set continue; - if (!bypassFilters && item.Filtered) + if (!bypassFilters && item.Filtered.Value) // The beatmap exists in this set but is filtered, so look for the first unfiltered map in the set - item = set.Beatmaps.FirstOrDefault(b => !b.Filtered); + item = set.Beatmaps.FirstOrDefault(b => !b.Filtered.Value); if (item != null) { @@ -226,7 +226,7 @@ namespace osu.Game.Screens.Select /// Whether to skip individual difficulties and only increment over full groups. public void SelectNext(int direction = 1, bool skipDifficulties = true) { - var visibleItems = Items.Where(s => !s.Item.Filtered).ToList(); + var visibleItems = Items.Where(s => !s.Item.Filtered.Value).ToList(); if (!visibleItems.Any()) return; @@ -248,7 +248,7 @@ namespace osu.Game.Screens.Select { var item = visibleItems[currentIndex].Item; - if (item.Filtered || item.State == CarouselItemState.Selected) continue; + if (item.Filtered.Value || item.State.Value == CarouselItemState.Selected) continue; switch (item) { @@ -260,7 +260,7 @@ namespace osu.Game.Screens.Select if (skipDifficulties) select(set); else - select(direction > 0 ? set.Beatmaps.First(b => !b.Filtered) : set.Beatmaps.Last(b => !b.Filtered)); + select(direction > 0 ? set.Beatmaps.First(b => !b.Filtered.Value) : set.Beatmaps.Last(b => !b.Filtered.Value)); return; } } @@ -272,7 +272,7 @@ namespace osu.Game.Screens.Select /// True if a selection could be made, else False. public bool SelectNextRandom() { - var visibleSets = beatmapSets.Where(s => !s.Filtered).ToList(); + var visibleSets = beatmapSets.Where(s => !s.Filtered.Value).ToList(); if (!visibleSets.Any()) return false; @@ -288,7 +288,7 @@ namespace osu.Game.Screens.Select CarouselBeatmapSet set; - if (RandomAlgorithm == RandomSelectAlgorithm.RandomPermutation) + if (RandomAlgorithm.Value == RandomSelectAlgorithm.RandomPermutation) { var notYetVisitedSets = visibleSets.Except(previouslyVisitedRandomSets).ToList(); if (!notYetVisitedSets.Any()) @@ -303,7 +303,7 @@ namespace osu.Game.Screens.Select else set = visibleSets.ElementAt(RNG.Next(visibleSets.Count)); - var visibleBeatmaps = set.Beatmaps.Where(s => !s.Filtered).ToList(); + var visibleBeatmaps = set.Beatmaps.Where(s => !s.Filtered.Value).ToList(); select(visibleBeatmaps[RNG.Next(visibleBeatmaps.Count)]); return true; } @@ -314,9 +314,9 @@ namespace osu.Game.Screens.Select { var beatmap = randomSelectedBeatmaps.Pop(); - if (!beatmap.Filtered) + if (!beatmap.Filtered.Value) { - if (RandomAlgorithm == RandomSelectAlgorithm.RandomPermutation) + if (RandomAlgorithm.Value == RandomSelectAlgorithm.RandomPermutation) previouslyVisitedRandomSets.Remove(selectedBeatmapSet); select(beatmap); break; @@ -509,9 +509,9 @@ namespace osu.Game.Screens.Select foreach (var c in set.Beatmaps) { - c.State.ValueChanged += v => + c.State.ValueChanged += e => { - if (v == CarouselItemState.Selected) + if (e.NewValue == CarouselItemState.Selected) { selectedBeatmapSet = set; SelectionChanged?.Invoke(c.Beatmap); @@ -549,7 +549,7 @@ namespace osu.Game.Screens.Select case DrawableCarouselBeatmapSet set: lastSet = set; - set.MoveToX(set.Item.State == CarouselItemState.Selected ? -100 : 0, 500, Easing.OutExpo); + set.MoveToX(set.Item.State.Value == CarouselItemState.Selected ? -100 : 0, 500, Easing.OutExpo); set.MoveToY(currentY, 750, Easing.OutExpo); break; case DrawableCarouselBeatmap beatmap: @@ -559,7 +559,7 @@ namespace osu.Game.Screens.Select void performMove(float y, float? startY = null) { if (startY != null) beatmap.MoveTo(new Vector2(0, startY.Value)); - beatmap.MoveToX(beatmap.Item.State == CarouselItemState.Selected ? -50 : 0, 500, Easing.OutExpo); + beatmap.MoveToX(beatmap.Item.State.Value == CarouselItemState.Selected ? -50 : 0, 500, Easing.OutExpo); beatmap.MoveToY(y, 750, Easing.OutExpo); } diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index 002633e8b9..f6085b7389 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -27,7 +27,7 @@ namespace osu.Game.Screens.Select private void invokeOnFilter() { - OnFilter?.Invoke(tabs.Current, modsCheckbox.Current); + OnFilter?.Invoke(tabs.Current.Value, modsCheckbox.Current.Value); } [BackgroundDependencyLoader] @@ -69,8 +69,8 @@ namespace osu.Game.Screens.Select }, }; - tabs.Current.ValueChanged += item => invokeOnFilter(); - modsCheckbox.Current.ValueChanged += item => invokeOnFilter(); + tabs.Current.ValueChanged += e => invokeOnFilter(); + modsCheckbox.Current.ValueChanged += e => invokeOnFilter(); } } diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 2a3fc03cc5..9e2f20006c 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -266,8 +266,8 @@ namespace osu.Game.Screens.Select } }; - titleBinding.BindValueChanged(value => setMetadata(metadata.Source)); - artistBinding.BindValueChanged(value => setMetadata(metadata.Source), true); + titleBinding.BindValueChanged(e => setMetadata(metadata.Source)); + artistBinding.BindValueChanged(e => setMetadata(metadata.Source), true); // no difficulty means it can't have a status to show if (beatmapInfo.Version == null) diff --git a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs index 206bbeb88e..8e7ea8f964 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselBeatmapSet.cs @@ -50,7 +50,7 @@ namespace osu.Game.Screens.Select.Carousel public override void Filter(FilterCriteria criteria) { base.Filter(criteria); - Filtered.Value = InternalChildren.All(i => i.Filtered); + Filtered.Value = InternalChildren.All(i => i.Filtered.Value); } public override string ToString() => BeatmapSet.ToString(); diff --git a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs index dfbbd2d907..e584872a2f 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs @@ -49,7 +49,7 @@ namespace osu.Game.Screens.Select.Carousel public virtual void AddChild(CarouselItem i) { - i.State.ValueChanged += v => ChildItemStateChanged(i, v); + i.State.ValueChanged += e => ChildItemStateChanged(i, e.NewValue); i.ChildID = ++currentChildID; InternalChildren.Add(i); } @@ -58,9 +58,9 @@ namespace osu.Game.Screens.Select.Carousel { if (items != null) InternalChildren = items; - State.ValueChanged += v => + State.ValueChanged += e => { - switch (v) + switch (e.NewValue) { case CarouselItemState.Collapsed: case CarouselItemState.NotSelected: @@ -69,7 +69,7 @@ namespace osu.Game.Screens.Select.Carousel case CarouselItemState.Selected: InternalChildren.ForEach(c => { - if (c.State == CarouselItemState.Collapsed) c.State.Value = CarouselItemState.NotSelected; + if (c.State.Value == CarouselItemState.Collapsed) c.State.Value = CarouselItemState.NotSelected; }); break; } diff --git a/osu.Game/Screens/Select/Carousel/CarouselGroupEagerSelect.cs b/osu.Game/Screens/Select/Carousel/CarouselGroupEagerSelect.cs index e32e5fe366..b4007573ae 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselGroupEagerSelect.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselGroupEagerSelect.cs @@ -13,9 +13,9 @@ namespace osu.Game.Screens.Select.Carousel { public CarouselGroupEagerSelect() { - State.ValueChanged += v => + State.ValueChanged += e => { - if (v == CarouselItemState.Selected) + if (e.NewValue == CarouselItemState.Selected) attemptSelection(); }; } @@ -81,10 +81,10 @@ namespace osu.Game.Screens.Select.Carousel if (filteringChildren) return; // we only perform eager selection if we are a currently selected group. - if (State != CarouselItemState.Selected) return; + if (State.Value != CarouselItemState.Selected) return; // we only perform eager selection if none of our children are in a selected state already. - if (Children.Any(i => i.State == CarouselItemState.Selected)) return; + if (Children.Any(i => i.State.Value == CarouselItemState.Selected)) return; PerformSelection(); } @@ -92,8 +92,8 @@ namespace osu.Game.Screens.Select.Carousel protected virtual void PerformSelection() { CarouselItem nextToSelect = - Children.Skip(lastSelectedIndex).FirstOrDefault(i => !i.Filtered) ?? - Children.Reverse().Skip(InternalChildren.Count - lastSelectedIndex).FirstOrDefault(i => !i.Filtered); + Children.Skip(lastSelectedIndex).FirstOrDefault(i => !i.Filtered.Value) ?? + Children.Reverse().Skip(InternalChildren.Count - lastSelectedIndex).FirstOrDefault(i => !i.Filtered.Value); if (nextToSelect != null) nextToSelect.State.Value = CarouselItemState.Selected; diff --git a/osu.Game/Screens/Select/Carousel/CarouselItem.cs b/osu.Game/Screens/Select/Carousel/CarouselItem.cs index c7da9d73d0..add7f2636e 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselItem.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselItem.cs @@ -16,7 +16,7 @@ namespace osu.Game.Screens.Select.Carousel /// /// This item is not in a hidden state. /// - public bool Visible => State.Value != CarouselItemState.Collapsed && !Filtered; + public bool Visible => State.Value != CarouselItemState.Collapsed && !Filtered.Value; public virtual List Drawables { @@ -37,9 +37,9 @@ namespace osu.Game.Screens.Select.Carousel { DrawableRepresentation = new Lazy(CreateDrawableRepresentation); - Filtered.ValueChanged += v => + Filtered.ValueChanged += e => { - if (v && State == CarouselItemState.Selected) + if (e.NewValue && State.Value == CarouselItemState.Selected) State.Value = CarouselItemState.NotSelected; }; } diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 5d28bed4a6..8189915d7f 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -157,7 +157,7 @@ namespace osu.Game.Screens.Select.Carousel protected override bool OnClick(ClickEvent e) { - if (Item.State == CarouselItemState.Selected) + if (Item.State.Value == CarouselItemState.Selected) startRequested?.Invoke(beatmap); return base.OnClick(e); diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index e5d12151d8..43797192eb 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -109,7 +109,7 @@ namespace osu.Game.Screens.Select.Carousel { List items = new List(); - if (Item.State == CarouselItemState.NotSelected) + if (Item.State.Value == CarouselItemState.NotSelected) items.Add(new OsuMenuItem("Expand", MenuItemType.Highlighted, () => Item.State.Value = CarouselItemState.Selected)); if (beatmapSet.OnlineBeatmapSetID != null) @@ -189,7 +189,7 @@ namespace osu.Game.Screens.Select.Carousel : base(item.Beatmap) { filtered.BindTo(item.Filtered); - filtered.ValueChanged += v => Schedule(() => this.FadeTo(v ? 0.1f : 1, 100)); + filtered.ValueChanged += e => Schedule(() => this.FadeTo(e.NewValue ? 0.1f : 1, 100)); filtered.TriggerChange(); } } diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 42f6606218..a538d2d209 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -63,7 +63,7 @@ namespace osu.Game.Screens.Select Group = group, Sort = sort, SearchText = searchTextBox.Text, - AllowConvertedBeatmaps = showConverted, + AllowConvertedBeatmaps = showConverted.Value, Ruleset = ruleset.Value }; @@ -146,12 +146,12 @@ namespace osu.Game.Screens.Select } }; - searchTextBox.Current.ValueChanged += t => FilterChanged?.Invoke(CreateCriteria()); + searchTextBox.Current.ValueChanged += e => FilterChanged?.Invoke(CreateCriteria()); groupTabs.PinItem(GroupMode.All); groupTabs.PinItem(GroupMode.RecentlyPlayed); - groupTabs.Current.ValueChanged += val => Group = val; - sortTabs.Current.ValueChanged += val => Sort = val; + groupTabs.Current.ValueChanged += e => Group = e.NewValue; + sortTabs.Current.ValueChanged += e => Sort = e.NewValue; } public void Deactivate() @@ -178,7 +178,7 @@ namespace osu.Game.Screens.Select sortTabs.AccentColour = colours.GreenLight; showConverted = config.GetBindable(OsuSetting.ShowConvertedBeatmaps); - showConverted.ValueChanged += val => updateCriteria(); + showConverted.ValueChanged += e => updateCriteria(); ruleset.BindTo(parentRuleset); ruleset.BindValueChanged(_ => updateCriteria(), true); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 214601c3ed..01adb459a8 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -326,16 +326,16 @@ namespace osu.Game.Screens.Select private ScheduledDelegate selectionChangedDebounce; - private void workingBeatmapChanged(WorkingBeatmap beatmap) + private void workingBeatmapChanged(ValueChangedEvent e) { - if (beatmap is DummyWorkingBeatmap) return; + if (e.NewValue is DummyWorkingBeatmap) return; - if (this.IsCurrentScreen() && !Carousel.SelectBeatmap(beatmap?.BeatmapInfo, false)) + if (this.IsCurrentScreen() && !Carousel.SelectBeatmap(e.NewValue?.BeatmapInfo, false)) // If selecting new beatmap without bypassing filters failed, there's possibly a ruleset mismatch - if (beatmap?.BeatmapInfo?.Ruleset != null && beatmap.BeatmapInfo.Ruleset != decoupledRuleset.Value) + if (e.NewValue?.BeatmapInfo?.Ruleset != null && e.NewValue.BeatmapInfo.Ruleset != decoupledRuleset.Value) { - Ruleset.Value = beatmap.BeatmapInfo.Ruleset; - Carousel.SelectBeatmap(beatmap.BeatmapInfo); + Ruleset.Value = e.NewValue.BeatmapInfo.Ruleset; + Carousel.SelectBeatmap(e.NewValue.BeatmapInfo); } } @@ -598,9 +598,9 @@ namespace osu.Game.Screens.Select { // manual binding to parent ruleset to allow for delayed load in the incoming direction. rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value; - Ruleset.ValueChanged += updateSelectedRuleset; + Ruleset.ValueChanged += e => updateSelectedRuleset(e.NewValue); - decoupledRuleset.ValueChanged += r => Ruleset.Value = r; + decoupledRuleset.ValueChanged += e => Ruleset.Value = e.NewValue; decoupledRuleset.DisabledChanged += r => Ruleset.Disabled = r; Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true); diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index d51c11c5f4..bf901660bb 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -33,7 +33,7 @@ namespace osu.Game.Skinning public Drawable GetDrawableComponent(string componentName) { Drawable sourceDrawable; - if (beatmapSkins && (sourceDrawable = source.GetDrawableComponent(componentName)) != null) + if (beatmapSkins.Value && (sourceDrawable = source.GetDrawableComponent(componentName)) != null) return sourceDrawable; return fallbackSource?.GetDrawableComponent(componentName); } @@ -41,7 +41,7 @@ namespace osu.Game.Skinning public Texture GetTexture(string componentName) { Texture sourceTexture; - if (beatmapSkins && (sourceTexture = source.GetTexture(componentName)) != null) + if (beatmapSkins.Value && (sourceTexture = source.GetTexture(componentName)) != null) return sourceTexture; return fallbackSource.GetTexture(componentName); } @@ -49,7 +49,7 @@ namespace osu.Game.Skinning public SampleChannel GetSample(string sampleName) { SampleChannel sourceChannel; - if (beatmapHitsounds && (sourceChannel = source.GetSample(sampleName)) != null) + if (beatmapHitsounds.Value && (sourceChannel = source.GetSample(sampleName)) != null) return sourceChannel; return fallbackSource?.GetSample(sampleName); } @@ -58,7 +58,7 @@ namespace osu.Game.Skinning { TValue val; if ((source as Skin)?.Configuration is TConfiguration conf) - if (beatmapSkins && (val = query.Invoke(conf)) != null) + if (beatmapSkins.Value && (val = query.Invoke(conf)) != null) return val; return fallbackSource == null ? default : fallbackSource.GetValue(query); diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index f8831bd26f..f2576a7aee 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -42,10 +42,10 @@ namespace osu.Game.Skinning CurrentSkinInfo.Value = SkinInfo.Default; }; - CurrentSkinInfo.ValueChanged += info => CurrentSkin.Value = getSkin(info); - CurrentSkin.ValueChanged += skin => + CurrentSkinInfo.ValueChanged += e => CurrentSkin.Value = getSkin(e.NewValue); + CurrentSkin.ValueChanged += e => { - if (skin.SkinInfo != CurrentSkinInfo.Value) + if (e.NewValue.SkinInfo != CurrentSkinInfo.Value) throw new InvalidOperationException($"Setting {nameof(CurrentSkin)}'s value directly is not supported. Use {nameof(CurrentSkinInfo)} instead."); SourceChanged?.Invoke(); diff --git a/osu.Game/Tests/Visual/EditorClockTestCase.cs b/osu.Game/Tests/Visual/EditorClockTestCase.cs index 3ce91ed052..b438ff2428 100644 --- a/osu.Game/Tests/Visual/EditorClockTestCase.cs +++ b/osu.Game/Tests/Visual/EditorClockTestCase.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Configuration; using osu.Framework.Input.Events; using osu.Framework.Timing; using osu.Game.Beatmaps; @@ -41,10 +42,10 @@ namespace osu.Game.Tests.Visual Beatmap.BindValueChanged(beatmapChanged, true); } - private void beatmapChanged(WorkingBeatmap working) + private void beatmapChanged(ValueChangedEvent e) { - Clock.ControlPointInfo = working.Beatmap.ControlPointInfo; - Clock.ChangeSource((IAdjustableClock)working.Track ?? new StopwatchClock()); + Clock.ControlPointInfo = e.NewValue.Beatmap.ControlPointInfo; + Clock.ChangeSource((IAdjustableClock)e.NewValue.Track ?? new StopwatchClock()); Clock.ProcessFrame(); } diff --git a/osu.Game/Tests/Visual/MultiplayerTestCase.cs b/osu.Game/Tests/Visual/MultiplayerTestCase.cs index 578ef6632c..7d580ef65e 100644 --- a/osu.Game/Tests/Visual/MultiplayerTestCase.cs +++ b/osu.Game/Tests/Visual/MultiplayerTestCase.cs @@ -14,7 +14,7 @@ namespace osu.Game.Tests.Visual protected Room Room { - get => currentRoom; + get => currentRoom.Value; set => currentRoom.Value = value; } diff --git a/osu.Game/Users/Avatar.cs b/osu.Game/Users/Avatar.cs index fca1510182..00e7314940 100644 --- a/osu.Game/Users/Avatar.cs +++ b/osu.Game/Users/Avatar.cs @@ -65,7 +65,7 @@ namespace osu.Game.Users private void openProfile() { - if (!OpenOnClick) + if (!OpenOnClick.Value) return; if (user != null) @@ -78,7 +78,7 @@ namespace osu.Game.Users protected override bool OnClick(ClickEvent e) { - if (!Enabled) + if (!Enabled.Value) return false; return base.OnClick(e); } diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index b1bf0c15a5..c789097874 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -191,8 +191,8 @@ namespace osu.Game.Users }); } - Status.ValueChanged += displayStatus; - Status.ValueChanged += status => statusBg.FadeColour(status?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint); + Status.ValueChanged += e => displayStatus(e.NewValue); + Status.ValueChanged += e => statusBg.FadeColour(e.NewValue?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint); base.Action = ViewProfile = () => { From d8c55bc729efbe64ef4d43792e6facce27d57fde Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 21 Feb 2019 19:04:31 +0900 Subject: [PATCH 134/327] Adjust namespaces --- osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs | 2 +- osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs | 2 +- osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs | 2 +- .../Edit/Blueprints/HoldNoteSelectionBlueprint.cs | 2 +- osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs | 2 +- osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs | 2 +- .../Objects/Drawables/DrawableManiaHitObject.cs | 2 +- osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs | 2 +- osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs | 2 +- osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs | 2 +- osu.Game.Rulesets.Mania/UI/Column.cs | 2 +- osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs | 2 +- osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs | 2 +- osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs | 2 +- osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs | 2 +- osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs | 2 +- .../Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs | 2 +- osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs | 2 +- .../Objects/Drawables/Pieces/SnakingSliderBody.cs | 2 +- osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs | 2 +- osu.Game.Rulesets.Osu/Objects/Slider.cs | 2 +- osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs | 2 +- osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs | 2 +- osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs | 2 +- osu.Game.Tests/Visual/TestCaseChatLink.cs | 2 +- osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs | 2 +- osu.Game.Tests/Visual/TestCaseLoungeRoomsContainer.cs | 2 +- osu.Game.Tests/Visual/TestCaseMatchHostInfo.cs | 2 +- osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs | 2 +- osu.Game.Tests/Visual/TestCaseMods.cs | 2 +- osu.Game.Tests/Visual/TestCasePlaySongSelect.cs | 2 +- osu.Game.Tests/Visual/TestCaseStoryboard.cs | 2 +- .../Visual/TestCaseUpdateableBeatmapBackgroundSprite.cs | 2 +- osu.Game/Audio/PreviewTrackManager.cs | 1 + osu.Game/Beatmaps/BindableBeatmap.cs | 4 ++-- .../Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs | 2 +- osu.Game/Beatmaps/WorkingBeatmap.cs | 4 ++-- osu.Game/Configuration/DatabasedConfigManager.cs | 1 + osu.Game/Graphics/Containers/BeatSyncedContainer.cs | 2 +- osu.Game/Graphics/Containers/HoldToConfirmContainer.cs | 2 +- osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs | 2 +- osu.Game/Graphics/Containers/ParallaxContainer.cs | 2 +- osu.Game/Graphics/Containers/ScalingContainer.cs | 2 +- osu.Game/Graphics/Containers/SectionsContainer.cs | 2 +- osu.Game/Graphics/Cursor/MenuCursor.cs | 2 +- osu.Game/Graphics/ScreenshotManager.cs | 2 +- osu.Game/Graphics/UserInterface/DialogButton.cs | 2 +- osu.Game/Graphics/UserInterface/Nub.cs | 2 +- osu.Game/Graphics/UserInterface/OsuButton.cs | 2 +- osu.Game/Graphics/UserInterface/OsuCheckbox.cs | 2 +- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 2 +- osu.Game/Graphics/UserInterface/RollingCounter.cs | 2 +- osu.Game/Input/IdleTracker.cs | 2 +- osu.Game/Online/API/APIAccess.cs | 2 +- osu.Game/Online/API/DummyAPIAccess.cs | 2 +- osu.Game/Online/API/IAPIProvider.cs | 2 +- osu.Game/Online/API/OAuth.cs | 2 +- osu.Game/Online/Chat/Channel.cs | 2 +- osu.Game/Online/Chat/ChannelManager.cs | 2 +- osu.Game/Online/Chat/ExternalLinkOpener.cs | 2 +- osu.Game/Online/Chat/StandAloneChatDisplay.cs | 2 +- osu.Game/Online/Multiplayer/Room.cs | 2 +- osu.Game/OsuGame.cs | 1 + osu.Game/OsuGameBase.cs | 2 +- osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs | 2 +- osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs | 2 +- osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs | 2 +- osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs | 2 +- osu.Game/Overlays/Chat/Selection/ChannelListItem.cs | 2 +- osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 2 +- osu.Game/Overlays/Direct/DirectPanel.cs | 2 +- osu.Game/Overlays/Direct/DownloadTrackingComposite.cs | 2 +- osu.Game/Overlays/Direct/FilterControl.cs | 2 +- osu.Game/Overlays/Direct/PlayButton.cs | 2 +- osu.Game/Overlays/DirectOverlay.cs | 2 +- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 +- osu.Game/Overlays/Music/FilterControl.cs | 2 +- osu.Game/Overlays/Music/PlaylistList.cs | 2 +- osu.Game/Overlays/Music/PlaylistOverlay.cs | 2 +- osu.Game/Overlays/MusicController.cs | 2 +- osu.Game/Overlays/NotificationOverlay.cs | 2 +- osu.Game/Overlays/Profile/Header/RankGraph.cs | 2 +- osu.Game/Overlays/Profile/ProfileSection.cs | 2 +- .../Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs | 2 +- .../Historical/PaginatedMostPlayedBeatmapContainer.cs | 2 +- osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs | 2 +- osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs | 2 +- .../Profile/Sections/Ranks/PaginatedScoreContainer.cs | 2 +- .../Sections/Recent/PaginatedRecentActivityContainer.cs | 2 +- osu.Game/Overlays/SearchableList/DisplayStyleControl.cs | 2 +- osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs | 1 + .../Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 1 + osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs | 1 + osu.Game/Overlays/Settings/Sections/SkinSection.cs | 2 +- osu.Game/Overlays/Settings/SettingsItem.cs | 2 +- osu.Game/Overlays/SocialOverlay.cs | 2 +- osu.Game/Overlays/Toolbar/Toolbar.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs | 2 +- osu.Game/Overlays/Volume/MuteButton.cs | 2 +- osu.Game/Overlays/Volume/VolumeMeter.cs | 2 +- osu.Game/Overlays/VolumeOverlay.cs | 2 +- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 2 +- osu.Game/Rulesets/Edit/PlacementBlueprint.cs | 2 +- osu.Game/Rulesets/Mods/ModFlashlight.cs | 2 +- osu.Game/Rulesets/Mods/ModHidden.cs | 2 +- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 2 +- osu.Game/Rulesets/Objects/Drawables/IScrollingHitObject.cs | 2 +- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 2 +- osu.Game/Rulesets/UI/Playfield.cs | 2 +- osu.Game/Rulesets/UI/RulesetContainer.cs | 2 +- osu.Game/Rulesets/UI/RulesetInputManager.cs | 2 +- osu.Game/Rulesets/UI/Scrolling/IScrollingInfo.cs | 2 +- osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs | 2 +- osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs | 2 +- osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs | 2 +- osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs | 2 +- osu.Game/Screens/Edit/BindableBeatDivisor.cs | 2 +- osu.Game/Screens/Edit/Components/BottomBarContainer.cs | 2 +- osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs | 2 +- osu.Game/Screens/Edit/Components/RadioButtons/RadioButton.cs | 2 +- .../Edit/Components/Timelines/Summary/Parts/TimelinePart.cs | 2 +- .../Screens/Edit/Compose/Components/BeatDivisorControl.cs | 2 +- osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs | 2 +- .../Edit/Compose/Components/Timeline/TimelineButton.cs | 2 +- osu.Game/Screens/Edit/Editor.cs | 2 +- osu.Game/Screens/Edit/EditorScreen.cs | 2 +- osu.Game/Screens/IOsuScreen.cs | 2 +- osu.Game/Screens/Menu/ButtonSystem.cs | 2 +- osu.Game/Screens/Menu/Intro.cs | 2 +- osu.Game/Screens/Menu/LogoVisualisation.cs | 2 +- osu.Game/Screens/Menu/MainMenu.cs | 2 +- osu.Game/Screens/Menu/MenuSideFlashes.cs | 2 +- osu.Game/Screens/Multi/Components/DisableableTabControl.cs | 2 +- osu.Game/Screens/Multi/Components/RoomStatusInfo.cs | 2 +- osu.Game/Screens/Multi/Components/StatusColouredContainer.cs | 2 +- osu.Game/Screens/Multi/IRoomManager.cs | 2 +- osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs | 2 +- osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs | 2 +- osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs | 2 +- osu.Game/Screens/Multi/Lounge/Components/RoomsContainer.cs | 2 +- osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs | 2 +- osu.Game/Screens/Multi/Match/Components/Header.cs | 2 +- osu.Game/Screens/Multi/Match/Components/HostInfo.cs | 2 +- osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs | 2 +- osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs | 2 +- osu.Game/Screens/Multi/Match/Components/MatchPage.cs | 2 +- .../Screens/Multi/Match/Components/MatchSettingsOverlay.cs | 2 +- osu.Game/Screens/Multi/Match/Components/MatchTabControl.cs | 2 +- osu.Game/Screens/Multi/Match/Components/ReadyButton.cs | 2 +- osu.Game/Screens/Multi/Match/Components/ViewBeatmapButton.cs | 2 +- osu.Game/Screens/Multi/Match/MatchSubScreen.cs | 2 +- osu.Game/Screens/Multi/Multiplayer.cs | 2 +- osu.Game/Screens/Multi/MultiplayerComposite.cs | 2 +- osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs | 2 +- osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs | 2 +- osu.Game/Screens/Multi/RoomManager.cs | 2 +- osu.Game/Screens/OsuScreen.cs | 2 +- osu.Game/Screens/OsuScreenDependencies.cs | 2 +- osu.Game/Screens/Play/Break/BreakInfoLine.cs | 2 +- osu.Game/Screens/Play/HUD/ComboCounter.cs | 2 +- osu.Game/Screens/Play/HUD/HealthDisplay.cs | 2 +- osu.Game/Screens/Play/HUD/ModDisplay.cs | 2 +- osu.Game/Screens/Play/HUDOverlay.cs | 2 +- osu.Game/Screens/Play/KeyCounterCollection.cs | 2 +- osu.Game/Screens/Play/PauseContainer.cs | 2 +- osu.Game/Screens/Play/Player.cs | 2 +- osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs | 2 +- osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs | 2 +- osu.Game/Screens/Play/SongProgress.cs | 2 +- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 +- osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs | 2 +- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 2 +- osu.Game/Screens/Select/Carousel/CarouselItem.cs | 2 +- .../Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 2 +- osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 2 +- osu.Game/Skinning/LocalSkinOverrideContainer.cs | 2 +- osu.Game/Skinning/SkinManager.cs | 2 +- osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs | 2 +- osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs | 2 +- osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs | 2 +- osu.Game/Tests/Visual/EditorClockTestCase.cs | 2 +- osu.Game/Tests/Visual/MultiplayerTestCase.cs | 2 +- osu.Game/Tests/Visual/OsuTestCase.cs | 2 +- osu.Game/Tests/Visual/ScrollingTestContainer.cs | 2 +- osu.Game/Users/Avatar.cs | 2 +- osu.Game/Users/UpdateableAvatar.cs | 2 +- osu.Game/Users/User.cs | 2 +- osu.Game/Users/UserPanel.cs | 2 +- 198 files changed, 200 insertions(+), 194 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs index e5a7c6aeed..82cda7df47 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.UI; diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs index 32f455bb73..78e7768788 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs @@ -3,7 +3,7 @@ using NUnit.Framework; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Rulesets.Mania.Configuration; using osu.Game.Rulesets.Mania.UI; using osu.Game.Tests.Visual; diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs index 2f4b51e372..9136ca6cc4 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseNotes.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using NUnit.Framework; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs index 9bf14b0672..d64c5dbc6a 100644 --- a/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Mania/Edit/Blueprints/HoldNoteSelectionBlueprint.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Primitives; using osu.Game.Graphics; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs index 85fbf05a8b..6893e1e73b 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModFlashlight.cs @@ -2,8 +2,8 @@ // See the LICENCE file in the repository root for full licence text. using System; +using osu.Framework.Bindables; using osu.Framework.Caching; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mods; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index 1b7c39a391..777c0ae566 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Linq; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Game.Rulesets.Mania.Objects.Drawables.Pieces; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs index acfe126a1e..a78524011f 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableManiaHitObject.cs @@ -3,7 +3,7 @@ using JetBrains.Annotations; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI.Scrolling; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs index b7d4ad46c8..c80681ea23 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osuTK.Graphics; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs index 8e749256b4..e8b6d6e9fa 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osuTK.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs index 3922c80c63..70720a926b 100644 --- a/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs +++ b/osu.Game.Rulesets.Mania/Objects/ManiaHitObject.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Rulesets.Mania.Objects.Types; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index 2db5b1dcf2..de24795d11 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Input.Bindings; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Mania.UI.Components; diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs index f0fcf37104..4d30066355 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs index 6f0c1b743a..2d198c413c 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs index a07611da31..e6a73f557e 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index 4a0a1ca506..4f0181566a 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Input; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs index 44e61f30b0..315a5a2b9d 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitObjectPiece.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Osu.Objects; using osuTK; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs index dfc8bf4664..8fd1d6d6f9 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/SliderPiece.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs index d2fec859b8..9d164ebe0b 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderCirclePiece.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components; using osu.Game.Rulesets.Osu.Objects; diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs index b0367deef7..2c40d18f1b 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModFlashlight.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input; using osu.Framework.Input.Events; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 8d173b6fa6..e2550b036c 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -3,7 +3,7 @@ using System; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Rulesets.Objects.Drawables; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 31102d0dc8..0a7562efd6 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -8,7 +8,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osu.Game.Configuration; using osu.Game.Rulesets.Objects; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs index e24efc6ffb..66b6f0f9ac 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderHead.cs @@ -3,7 +3,7 @@ using System; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; using osuTK; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs index 53f6aa5b76..23c5494cf5 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTail.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 811349f56e..26ba9e7f2b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -11,7 +11,7 @@ using osuTK.Graphics; using osu.Game.Graphics; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Screens.Ranking; using osu.Game.Rulesets.Scoring; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs index b3b7c9a95a..73b184bffe 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SnakingSliderBody.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Rulesets.Objects.Types; using osuTK; diff --git a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs index 3e3a6395a9..364c182dd4 100644 --- a/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs +++ b/osu.Game.Rulesets.Osu/Objects/OsuHitObject.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Beatmaps; using osu.Game.Rulesets.Objects; using osuTK; diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index d47fed354a..c200b43d91 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -7,8 +7,8 @@ using osu.Game.Rulesets.Objects.Types; using System.Collections.Generic; using osu.Game.Rulesets.Objects; using System.Linq; +using osu.Framework.Bindables; using osu.Framework.Caching; -using osu.Framework.Configuration; using osu.Game.Audio; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs index 29b00b8d5d..43a2ae0fbb 100644 --- a/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/SliderTailCircle.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Osu.Judgements; diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs index 18518f366f..12b6ae8212 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs index c0e371bcbd..b99ec57166 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs @@ -1,8 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Bindables; using osu.Framework.Caching; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Taiko.Objects; diff --git a/osu.Game.Tests/Visual/TestCaseChatLink.cs b/osu.Game.Tests/Visual/TestCaseChatLink.cs index f119e6dc24..a91131cac8 100644 --- a/osu.Game.Tests/Visual/TestCaseChatLink.cs +++ b/osu.Game.Tests/Visual/TestCaseChatLink.cs @@ -13,10 +13,10 @@ using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; +using osu.Framework.Bindables; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Overlays; -using osu.Framework.Configuration; namespace osu.Game.Tests.Visual { diff --git a/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs b/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs index a2f40f1903..9ae9b55546 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs +++ b/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osuTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game.Tests/Visual/TestCaseLoungeRoomsContainer.cs b/osu.Game.Tests/Visual/TestCaseLoungeRoomsContainer.cs index c87b91003b..13bc5e24d9 100644 --- a/osu.Game.Tests/Visual/TestCaseLoungeRoomsContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseLoungeRoomsContainer.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Online.Multiplayer; diff --git a/osu.Game.Tests/Visual/TestCaseMatchHostInfo.cs b/osu.Game.Tests/Visual/TestCaseMatchHostInfo.cs index fabeb0aaa4..45092c5b93 100644 --- a/osu.Game.Tests/Visual/TestCaseMatchHostInfo.cs +++ b/osu.Game.Tests/Visual/TestCaseMatchHostInfo.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Screens.Multi.Match.Components; using osu.Game.Users; diff --git a/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs b/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs index 94ccf8aa57..a320fc88fa 100644 --- a/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; diff --git a/osu.Game.Tests/Visual/TestCaseMods.cs b/osu.Game.Tests/Visual/TestCaseMods.cs index e0c0b419af..99bc10d8cc 100644 --- a/osu.Game.Tests/Visual/TestCaseMods.cs +++ b/osu.Game.Tests/Visual/TestCaseMods.cs @@ -13,7 +13,7 @@ using osu.Game.Rulesets.Osu.Mods; using System.Linq; using System.Collections.Generic; using NUnit.Framework; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.Sprites; using osu.Game.Overlays.Mods.Sections; diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs index 35f5789502..5fa818472c 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs @@ -8,7 +8,7 @@ using System.Linq; using System.Text; using NUnit.Framework; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.MathUtils; using osu.Framework.Platform; diff --git a/osu.Game.Tests/Visual/TestCaseStoryboard.cs b/osu.Game.Tests/Visual/TestCaseStoryboard.cs index eca8ac0aa8..fc62b8fe0c 100644 --- a/osu.Game.Tests/Visual/TestCaseStoryboard.cs +++ b/osu.Game.Tests/Visual/TestCaseStoryboard.cs @@ -3,7 +3,7 @@ using NUnit.Framework; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game.Tests/Visual/TestCaseUpdateableBeatmapBackgroundSprite.cs b/osu.Game.Tests/Visual/TestCaseUpdateableBeatmapBackgroundSprite.cs index 14f178a293..3ee617e092 100644 --- a/osu.Game.Tests/Visual/TestCaseUpdateableBeatmapBackgroundSprite.cs +++ b/osu.Game.Tests/Visual/TestCaseUpdateableBeatmapBackgroundSprite.cs @@ -3,7 +3,7 @@ using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Beatmaps.Drawables; diff --git a/osu.Game/Audio/PreviewTrackManager.cs b/osu.Game/Audio/PreviewTrackManager.cs index 6de7d0e4f7..99c0d70ac9 100644 --- a/osu.Game/Audio/PreviewTrackManager.cs +++ b/osu.Game/Audio/PreviewTrackManager.cs @@ -4,6 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Track; +using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.IO.Stores; diff --git a/osu.Game/Beatmaps/BindableBeatmap.cs b/osu.Game/Beatmaps/BindableBeatmap.cs index 340b727469..d69bf3c973 100644 --- a/osu.Game/Beatmaps/BindableBeatmap.cs +++ b/osu.Game/Beatmaps/BindableBeatmap.cs @@ -6,12 +6,12 @@ using System.Diagnostics; using JetBrains.Annotations; using osu.Framework.Audio; using osu.Framework.Audio.Track; -using osu.Framework.Configuration; +using osu.Framework.Bindables; namespace osu.Game.Beatmaps { /// - /// A for the beatmap. + /// A for the beatmap. /// This should be used sparingly in-favour of . /// public abstract class BindableBeatmap : NonNullableBindable diff --git a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs index 1210cff0a5..267c54370f 100644 --- a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs +++ b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Beatmaps/WorkingBeatmap.cs b/osu.Game/Beatmaps/WorkingBeatmap.cs index 70ed761271..45642b0adb 100644 --- a/osu.Game/Beatmaps/WorkingBeatmap.cs +++ b/osu.Game/Beatmaps/WorkingBeatmap.cs @@ -2,16 +2,16 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Audio.Track; -using osu.Framework.Configuration; using osu.Framework.Graphics.Textures; using osu.Game.Rulesets.Mods; using System; using System.Collections.Generic; -using System.Linq; using osu.Game.Storyboards; using osu.Framework.IO.File; using System.IO; +using System.Linq; using System.Threading; +using osu.Framework.Bindables; using osu.Game.IO.Serialization; using osu.Game.Rulesets; using osu.Game.Rulesets.Objects; diff --git a/osu.Game/Configuration/DatabasedConfigManager.cs b/osu.Game/Configuration/DatabasedConfigManager.cs index 183fb98b89..4f304ec3c3 100644 --- a/osu.Game/Configuration/DatabasedConfigManager.cs +++ b/osu.Game/Configuration/DatabasedConfigManager.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Collections.Generic; +using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Game.Rulesets; diff --git a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs index b929217ae4..621eeea2b7 100644 --- a/osu.Game/Graphics/Containers/BeatSyncedContainer.cs +++ b/osu.Game/Graphics/Containers/BeatSyncedContainer.cs @@ -3,7 +3,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio.Track; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; diff --git a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs index d23568e6be..a5b5b7af42 100644 --- a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs +++ b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index c4a84d089d..bf48631569 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -4,9 +4,9 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; +using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osuTK; -using osu.Framework.Configuration; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Audio; diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index 21e200e0f8..f65a0a469a 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -6,8 +6,8 @@ using osu.Framework.Graphics; using osu.Framework.Input; using osuTK; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Game.Configuration; -using osu.Framework.Configuration; using osu.Framework.MathUtils; namespace osu.Game.Graphics.Containers diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index c2a79b0840..51f068d920 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Configuration; diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index 00014385c7..b8ea4e299c 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -3,7 +3,7 @@ using System; using System.Linq; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 603bc03093..15227ecd6d 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -3,7 +3,6 @@ using osuTK; using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; @@ -11,6 +10,7 @@ using osu.Framework.Graphics.Sprites; using osu.Game.Configuration; using System; using JetBrains.Annotations; +using osu.Framework.Bindables; using osu.Framework.Graphics.Textures; using osu.Framework.Input.Events; using osuTK.Input; diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index cd09cef247..a2ac71de93 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -8,7 +8,7 @@ using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osu.Framework.Input; using osu.Framework.Input.Bindings; diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 8eba8845f8..cd51580de2 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Bindables; using osuTK; using osuTK.Graphics; using osu.Framework.Graphics; @@ -12,7 +13,6 @@ using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Sprites; using osu.Framework.Extensions.Color4Extensions; using osu.Game.Graphics.Containers; -using osu.Framework.Configuration; using osu.Framework.Input.Events; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index 2f8d5fa6d0..733cdd7417 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -5,7 +5,7 @@ using System; using osuTK; using osuTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs index 6c17c1938a..7007a6622d 100644 --- a/osu.Game/Graphics/UserInterface/OsuButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuButton.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 1d46c911e5..5e71eb2407 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -4,7 +4,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index a813428e95..f679ea848b 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -6,7 +6,7 @@ using System.Linq; using osuTK; using osuTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 6cccb49c18..b286047ba6 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -1,13 +1,13 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; using osu.Game.Graphics.Sprites; using System; using System.Collections.Generic; +using osu.Framework.Bindables; using osuTK.Graphics; namespace osu.Game.Graphics.UserInterface diff --git a/osu.Game/Input/IdleTracker.cs b/osu.Game/Input/IdleTracker.cs index ab010a9532..91e2456ef7 100644 --- a/osu.Game/Input/IdleTracker.cs +++ b/osu.Game/Input/IdleTracker.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input; using osu.Framework.Input.Bindings; diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 4642b66ef7..9e84fd6009 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -8,7 +8,7 @@ using System.Net; using System.Net.Http; using System.Threading; using Newtonsoft.Json.Linq; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Logging; using osu.Game.Configuration; diff --git a/osu.Game/Online/API/DummyAPIAccess.cs b/osu.Game/Online/API/DummyAPIAccess.cs index 600192cb85..096ab5d8c8 100644 --- a/osu.Game/Online/API/DummyAPIAccess.cs +++ b/osu.Game/Online/API/DummyAPIAccess.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Users; namespace osu.Game.Online.API diff --git a/osu.Game/Online/API/IAPIProvider.cs b/osu.Game/Online/API/IAPIProvider.cs index ca60506da9..e4533ecb3d 100644 --- a/osu.Game/Online/API/IAPIProvider.cs +++ b/osu.Game/Online/API/IAPIProvider.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Users; namespace osu.Game.Online.API diff --git a/osu.Game/Online/API/OAuth.cs b/osu.Game/Online/API/OAuth.cs index ffe63e68ea..baf494ebf9 100644 --- a/osu.Game/Online/API/OAuth.cs +++ b/osu.Game/Online/API/OAuth.cs @@ -3,7 +3,7 @@ using System.Diagnostics; using System.Net.Http; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.IO.Network; namespace osu.Game.Online.API diff --git a/osu.Game/Online/Chat/Channel.cs b/osu.Game/Online/Chat/Channel.cs index c60c1e44ee..9ec39c5cb1 100644 --- a/osu.Game/Online/Chat/Channel.cs +++ b/osu.Game/Online/Chat/Channel.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; using Newtonsoft.Json; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Lists; using osu.Game.Users; diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 29162984f6..6c52f4d2f5 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Logging; using osu.Game.Online.API; using osu.Game.Online.API.Requests; diff --git a/osu.Game/Online/Chat/ExternalLinkOpener.cs b/osu.Game/Online/Chat/ExternalLinkOpener.cs index aae183b002..495f1ac0b0 100644 --- a/osu.Game/Online/Chat/ExternalLinkOpener.cs +++ b/osu.Game/Online/Chat/ExternalLinkOpener.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Platform; using osu.Game.Configuration; diff --git a/osu.Game/Online/Chat/StandAloneChatDisplay.cs b/osu.Game/Online/Chat/StandAloneChatDisplay.cs index f3a882c686..3dbd174760 100644 --- a/osu.Game/Online/Chat/StandAloneChatDisplay.cs +++ b/osu.Game/Online/Chat/StandAloneChatDisplay.cs @@ -3,7 +3,7 @@ using System; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Online/Multiplayer/Room.cs b/osu.Game/Online/Multiplayer/Room.cs index 8e1fc894d2..77236ce3c8 100644 --- a/osu.Game/Online/Multiplayer/Room.cs +++ b/osu.Game/Online/Multiplayer/Room.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using Newtonsoft.Json; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Online.Multiplayer.GameTypes; using osu.Game.Online.Multiplayer.RoomStatuses; using osu.Game.Users; diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 1b1ca852c8..3c1d1d12f4 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -19,6 +19,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using osu.Framework.Audio; +using osu.Framework.Bindables; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Input; using osu.Framework.Input.Bindings; diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index e5038287d3..0bc03d97db 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -8,7 +8,7 @@ using System.Linq; using System.Reflection; using osu.Framework.Allocation; using osu.Framework.Audio; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.IO.Stores; diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs index 379332b064..69c06bd605 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs @@ -5,7 +5,7 @@ using System; using System.Linq; using osu.Framework; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs index 018ce611f6..3f32e022c3 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs index 845707d96c..5411e3f7be 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs index b9b5ab6aa6..884b32a417 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs index a0ee24765b..9fd978e9ea 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using osuTK; using osuTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs index afd629c494..7a43ca4b8c 100644 --- a/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs +++ b/osu.Game/Overlays/Chat/Tabs/ChannelTabControl.cs @@ -7,9 +7,9 @@ using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osu.Game.Online.Chat; using osuTK; -using osu.Framework.Configuration; using System; using System.Linq; +using osu.Framework.Bindables; namespace osu.Game.Overlays.Chat.Tabs { diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 96f18df9fc..9df1c915c8 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -6,7 +6,7 @@ using System.Linq; using osuTK; using osuTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 5fcf996b04..8fff2c51e7 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs index 28fe20aa12..882df0b30f 100644 --- a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs +++ b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs @@ -4,7 +4,7 @@ using System; using Microsoft.EntityFrameworkCore.Internal; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Online.API.Requests; diff --git a/osu.Game/Overlays/Direct/FilterControl.cs b/osu.Game/Overlays/Direct/FilterControl.cs index 80b5b8f88a..d7e0760fc6 100644 --- a/osu.Game/Overlays/Direct/FilterControl.cs +++ b/osu.Game/Overlays/Direct/FilterControl.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/Direct/PlayButton.cs b/osu.Game/Overlays/Direct/PlayButton.cs index 7af4e616c8..e001c2d3ea 100644 --- a/osu.Game/Overlays/Direct/PlayButton.cs +++ b/osu.Game/Overlays/Direct/PlayButton.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index 9270339fd1..fe41cadcd0 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -5,7 +5,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Threading; diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index d6cfc844eb..0bd8887113 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -4,7 +4,6 @@ using osuTK; using osuTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -17,6 +16,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Audio; using osu.Framework.Audio.Sample; +using osu.Framework.Bindables; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; using osu.Game.Rulesets; diff --git a/osu.Game/Overlays/Music/FilterControl.cs b/osu.Game/Overlays/Music/FilterControl.cs index 10e57e8e61..6bceade271 100644 --- a/osu.Game/Overlays/Music/FilterControl.cs +++ b/osu.Game/Overlays/Music/FilterControl.cs @@ -8,7 +8,7 @@ using osu.Game.Graphics.UserInterface; using osuTK; using osuTK.Graphics; using System; -using osu.Framework.Configuration; +using osu.Framework.Bindables; namespace osu.Game.Overlays.Music { diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index b388bb1632..b02ad242aa 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs index 5b1b7f4da9..8cbea63fe3 100644 --- a/osu.Game/Overlays/Music/PlaylistOverlay.cs +++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs @@ -4,7 +4,7 @@ using System; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index e1858c7961..072c12e6f4 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index 66408c2227..55b1f04528 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -11,7 +11,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; using System; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Threading; namespace osu.Game.Overlays diff --git a/osu.Game/Overlays/Profile/Header/RankGraph.cs b/osu.Game/Overlays/Profile/Header/RankGraph.cs index 5012665be9..ce852192a2 100644 --- a/osu.Game/Overlays/Profile/Header/RankGraph.cs +++ b/osu.Game/Overlays/Profile/Header/RankGraph.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Overlays/Profile/ProfileSection.cs b/osu.Game/Overlays/Profile/ProfileSection.cs index f5f628f07b..f835cfdf28 100644 --- a/osu.Game/Overlays/Profile/ProfileSection.cs +++ b/osu.Game/Overlays/Profile/ProfileSection.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Bindables; using osuTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -9,7 +10,6 @@ using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Users; using osuTK.Graphics; -using osu.Framework.Configuration; namespace osu.Game.Overlays.Profile { diff --git a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs index 8bceafb8f3..0fc1398f5d 100644 --- a/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Beatmaps/PaginatedBeatmapContainer.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Linq; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Online.API.Requests; using osu.Game.Overlays.Direct; diff --git a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs index 5ec252b109..4757f676c8 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System.Linq; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Online.API.Requests; diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index ecf848a6ca..09c2d32832 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -1,9 +1,9 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Bindables; using osuTK; using osuTK.Graphics; -using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs index af98a6a3a1..56076260b6 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs @@ -3,7 +3,7 @@ using osuTK; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs index a2676350a2..95a18ccfa9 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Online.API.Requests; @@ -9,6 +8,7 @@ using osu.Game.Users; using System; using System.Collections.Generic; using System.Linq; +using osu.Framework.Bindables; namespace osu.Game.Overlays.Profile.Sections.Ranks { diff --git a/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs b/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs index b7de719305..4b4acb8fbc 100644 --- a/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Recent/PaginatedRecentActivityContainer.cs @@ -1,11 +1,11 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Online.API.Requests; using osu.Game.Users; using System.Linq; +using osu.Framework.Bindables; using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Profile.Sections.Recent diff --git a/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs b/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs index dd4cfdaa5f..f55e5f8c59 100644 --- a/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs +++ b/osu.Game/Overlays/SearchableList/DisplayStyleControl.cs @@ -1,8 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework.Bindables; using osuTK; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs b/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs index 50dd6ce5bf..bb56dbccd8 100644 --- a/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs @@ -4,6 +4,7 @@ using System; using System.Runtime; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index d72d9de6a5..6a4e7020ea 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 8991332a98..8a8d51b6b6 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Input; diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index 5087f6e92b..8db80eaab1 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -3,7 +3,7 @@ using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Configuration; using osu.Game.Graphics; diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index 328f1e9d49..71f2ef3c1d 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -3,8 +3,8 @@ using System.Collections.Generic; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osuTK.Graphics; -using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index da243add71..e96a7638cb 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osuTK; using osuTK.Graphics; using osu.Framework.Graphics; @@ -15,7 +16,6 @@ using osu.Game.Online.API.Requests; using osu.Game.Overlays.SearchableList; using osu.Game.Overlays.Social; using osu.Game.Users; -using osu.Framework.Configuration; using osu.Framework.Threading; namespace osu.Game.Overlays diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index efb5706e24..61b2014af8 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -10,7 +10,7 @@ using osu.Game.Graphics; using osuTK; using osu.Framework.Graphics.Shapes; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Input.Events; namespace osu.Game.Overlays.Toolbar diff --git a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs index 4189df647a..fa06e134d2 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs index 6c7e596fe5..d01eab4dab 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetSelector.cs @@ -3,13 +3,13 @@ using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Caching; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osuTK; using osuTK.Input; using osuTK.Graphics; -using osu.Framework.Configuration; using osu.Framework.Graphics.Shapes; using osu.Framework.Input.Events; using osu.Game.Rulesets; diff --git a/osu.Game/Overlays/Volume/MuteButton.cs b/osu.Game/Overlays/Volume/MuteButton.cs index cb13eb615e..d84d852427 100644 --- a/osu.Game/Overlays/Volume/MuteButton.cs +++ b/osu.Game/Overlays/Volume/MuteButton.cs @@ -3,7 +3,7 @@ using System; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index 9c565b15f1..b4e86363ad 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -4,7 +4,7 @@ using System; using System.Globalization; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Overlays/VolumeOverlay.cs b/osu.Game/Overlays/VolumeOverlay.cs index 265e024cac..ffb56829a3 100644 --- a/osu.Game/Overlays/VolumeOverlay.cs +++ b/osu.Game/Overlays/VolumeOverlay.cs @@ -3,7 +3,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 635e32d489..e557edf49f 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; diff --git a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs index 3ab62160cd..434ce4a721 100644 --- a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs +++ b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs @@ -4,7 +4,7 @@ using System; using osu.Framework; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index 7178ddcd22..2a416b2705 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.OpenGL.Vertices; using osu.Framework.Graphics.Primitives; diff --git a/osu.Game/Rulesets/Mods/ModHidden.cs b/osu.Game/Rulesets/Mods/ModHidden.cs index 4d49c58de5..2989ec2304 100644 --- a/osu.Game/Rulesets/Mods/ModHidden.cs +++ b/osu.Game/Rulesets/Mods/ModHidden.cs @@ -1,12 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Rulesets.Objects.Drawables; using System.Collections.Generic; using System.Linq; +using osu.Framework.Bindables; namespace osu.Game.Rulesets.Mods { diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 1e7548e21c..f231033935 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.TypeExtensions; using osu.Framework.Graphics.Primitives; using osu.Game.Audio; diff --git a/osu.Game/Rulesets/Objects/Drawables/IScrollingHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/IScrollingHitObject.cs index c3f0279013..48fcfabc2f 100644 --- a/osu.Game/Rulesets/Objects/Drawables/IScrollingHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/IScrollingHitObject.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; namespace osu.Game.Rulesets.Objects.Drawables diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 05770f0db2..1e7a324acf 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Extensions.TypeExtensions; using osu.Game.Beatmaps; diff --git a/osu.Game/Rulesets/UI/Playfield.cs b/osu.Game/Rulesets/UI/Playfield.cs index 572f41b7e6..3b8a7353c6 100644 --- a/osu.Game/Rulesets/UI/Playfield.cs +++ b/osu.Game/Rulesets/UI/Playfield.cs @@ -7,8 +7,8 @@ using System.Linq; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Framework.Configuration; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mods; diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index a67fe37dc1..99f10a3710 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -13,7 +13,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics.Cursor; using osu.Framework.Input; using osu.Game.Configuration; diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index 274a9475db..96775ab9c1 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -3,7 +3,7 @@ using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; diff --git a/osu.Game/Rulesets/UI/Scrolling/IScrollingInfo.cs b/osu.Game/Rulesets/UI/Scrolling/IScrollingInfo.cs index 49cdfea4d4..cd85932599 100644 --- a/osu.Game/Rulesets/UI/Scrolling/IScrollingInfo.cs +++ b/osu.Game/Rulesets/UI/Scrolling/IScrollingInfo.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.UI.Scrolling.Algorithms; diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs index e29bfbc452..ed3534fb36 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingHitObjectContainer.cs @@ -2,8 +2,8 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Caching; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Types; diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs index c08bb26dbc..bf2203e176 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingPlayfield.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Rulesets.Objects.Drawables; namespace osu.Game.Rulesets.UI.Scrolling diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs index 4c08b84679..7a60e0b021 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input.Bindings; using osu.Framework.Lists; diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 072da7c66e..0306f69755 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.MathUtils; using osu.Framework.Threading; diff --git a/osu.Game/Screens/Edit/BindableBeatDivisor.cs b/osu.Game/Screens/Edit/BindableBeatDivisor.cs index 59fe45b9ec..bea4d9a7a4 100644 --- a/osu.Game/Screens/Edit/BindableBeatDivisor.cs +++ b/osu.Game/Screens/Edit/BindableBeatDivisor.cs @@ -3,7 +3,7 @@ using System; using System.Linq; -using osu.Framework.Configuration; +using osu.Framework.Bindables; namespace osu.Game.Screens.Edit { diff --git a/osu.Game/Screens/Edit/Components/BottomBarContainer.cs b/osu.Game/Screens/Edit/Components/BottomBarContainer.cs index 726f6d2025..cb5078a479 100644 --- a/osu.Game/Screens/Edit/Components/BottomBarContainer.cs +++ b/osu.Game/Screens/Edit/Components/BottomBarContainer.cs @@ -3,7 +3,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio.Track; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs index 527900acf2..cf2d03565a 100644 --- a/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs +++ b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Screens/Edit/Components/RadioButtons/RadioButton.cs b/osu.Game/Screens/Edit/Components/RadioButtons/RadioButton.cs index d35bb55449..3692c0437b 100644 --- a/osu.Game/Screens/Edit/Components/RadioButtons/RadioButton.cs +++ b/osu.Game/Screens/Edit/Components/RadioButtons/RadioButton.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; -using osu.Framework.Configuration; +using osu.Framework.Bindables; namespace osu.Game.Screens.Edit.Components.RadioButtons { diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs index c6337844fc..ebe3b1a07e 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs @@ -3,8 +3,8 @@ using System; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osuTK; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs index a8035c915c..59947d63e6 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs @@ -4,7 +4,7 @@ using System; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index a83392a4f3..c6ed5749fd 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -3,7 +3,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio.Track; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Audio; diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs index 1244e834c1..806a55c931 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 641c8762f1..c922e4ef4a 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -11,7 +11,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Screens.Edit.Components.Timelines.Summary; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; using osu.Framework.Platform; diff --git a/osu.Game/Screens/Edit/EditorScreen.cs b/osu.Game/Screens/Edit/EditorScreen.cs index bfe0423c8a..045e5a1226 100644 --- a/osu.Game/Screens/Edit/EditorScreen.cs +++ b/osu.Game/Screens/Edit/EditorScreen.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; diff --git a/osu.Game/Screens/IOsuScreen.cs b/osu.Game/Screens/IOsuScreen.cs index 9e28de5593..e665f401d9 100644 --- a/osu.Game/Screens/IOsuScreen.cs +++ b/osu.Game/Screens/IOsuScreen.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Overlays; diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index cd73ee04b0..0b3b16ffca 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -8,7 +8,7 @@ using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Bindings; diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 14bc588999..2392d650a0 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -5,7 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Audio.Track; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.MathUtils; diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index 2534c57b1e..a45c80669c 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -3,7 +3,6 @@ using osuTK; using osuTK.Graphics; -using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Batches; using osu.Framework.Graphics.Colour; @@ -15,6 +14,7 @@ using osu.Game.Beatmaps; using osu.Game.Graphics; using System; using osu.Framework.Allocation; +using osu.Framework.Bindables; namespace osu.Game.Screens.Menu { diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 37bd1b58e1..d6e3d378e0 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -5,7 +5,7 @@ using osuTK; using osuTK.Graphics; using osuTK.Input; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input.Events; using osu.Framework.Screens; diff --git a/osu.Game/Screens/Menu/MenuSideFlashes.cs b/osu.Game/Screens/Menu/MenuSideFlashes.cs index 7288cc8db5..ce0a38ba8d 100644 --- a/osu.Game/Screens/Menu/MenuSideFlashes.cs +++ b/osu.Game/Screens/Menu/MenuSideFlashes.cs @@ -4,7 +4,6 @@ using osuTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Audio.Track; -using osu.Framework.Configuration; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; @@ -14,6 +13,7 @@ using osu.Game.Beatmaps.ControlPoints; using osu.Game.Graphics; using osu.Game.Graphics.Containers; using System; +using osu.Framework.Bindables; namespace osu.Game.Screens.Menu { diff --git a/osu.Game/Screens/Multi/Components/DisableableTabControl.cs b/osu.Game/Screens/Multi/Components/DisableableTabControl.cs index aa04ad5e56..5bd002f8dc 100644 --- a/osu.Game/Screens/Multi/Components/DisableableTabControl.cs +++ b/osu.Game/Screens/Multi/Components/DisableableTabControl.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; diff --git a/osu.Game/Screens/Multi/Components/RoomStatusInfo.cs b/osu.Game/Screens/Multi/Components/RoomStatusInfo.cs index 85f2111e60..e5e8fa7351 100644 --- a/osu.Game/Screens/Multi/Components/RoomStatusInfo.cs +++ b/osu.Game/Screens/Multi/Components/RoomStatusInfo.cs @@ -3,7 +3,7 @@ using System; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs b/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs index 3a6c4a883d..b58bc0daac 100644 --- a/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs +++ b/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Multi/IRoomManager.cs b/osu.Game/Screens/Multi/IRoomManager.cs index 980879d79a..f6c979851e 100644 --- a/osu.Game/Screens/Multi/IRoomManager.cs +++ b/osu.Game/Screens/Multi/IRoomManager.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Online.Multiplayer; namespace osu.Game.Screens.Multi diff --git a/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs index afe2b70524..e37f7862ae 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using osu.Framework; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs b/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs index 828c9bfecb..87c4539756 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs @@ -3,7 +3,7 @@ using System.ComponentModel; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Graphics; using osu.Game.Overlays.SearchableList; using osuTK.Graphics; diff --git a/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs b/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs index f37260a33d..bffa2e080d 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs @@ -3,7 +3,7 @@ using System; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; diff --git a/osu.Game/Screens/Multi/Lounge/Components/RoomsContainer.cs b/osu.Game/Screens/Multi/Lounge/Components/RoomsContainer.cs index d1c7a9531a..99a6de0064 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/RoomsContainer.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/RoomsContainer.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs b/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs index 71205dc199..dd1e060125 100644 --- a/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs +++ b/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; diff --git a/osu.Game/Screens/Multi/Match/Components/Header.cs b/osu.Game/Screens/Multi/Match/Components/Header.cs index 8be0273cab..7b82d27ad1 100644 --- a/osu.Game/Screens/Multi/Match/Components/Header.cs +++ b/osu.Game/Screens/Multi/Match/Components/Header.cs @@ -3,7 +3,7 @@ using System; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; diff --git a/osu.Game/Screens/Multi/Match/Components/HostInfo.cs b/osu.Game/Screens/Multi/Match/Components/HostInfo.cs index 6b6d50087c..c0750419b9 100644 --- a/osu.Game/Screens/Multi/Match/Components/HostInfo.cs +++ b/osu.Game/Screens/Multi/Match/Components/HostInfo.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs b/osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs index bcae036bba..147b80049f 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchChatDisplay.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Online.Chat; using osu.Game.Online.Multiplayer; diff --git a/osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs b/osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs index 19e8b18b0e..263987dc2f 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.API.Requests.Responses; diff --git a/osu.Game/Screens/Multi/Match/Components/MatchPage.cs b/osu.Game/Screens/Multi/Match/Components/MatchPage.cs index 15749864b6..fc98db157b 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchPage.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchPage.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; namespace osu.Game.Screens.Multi.Match.Components { diff --git a/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs b/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs index ef0845ae8d..9795f16e35 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs @@ -4,7 +4,7 @@ using System; using Humanizer; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Multi/Match/Components/MatchTabControl.cs b/osu.Game/Screens/Multi/Match/Components/MatchTabControl.cs index d071dabf4c..e7d3a88da2 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchTabControl.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchTabControl.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics.UserInterface; using osu.Framework.Input.Events; diff --git a/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs b/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs index 837d5ab531..cf71f36c38 100644 --- a/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs +++ b/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs @@ -4,7 +4,7 @@ using System; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Online.Multiplayer; diff --git a/osu.Game/Screens/Multi/Match/Components/ViewBeatmapButton.cs b/osu.Game/Screens/Multi/Match/Components/ViewBeatmapButton.cs index 70fe4bce34..6b41bff144 100644 --- a/osu.Game/Screens/Multi/Match/Components/ViewBeatmapButton.cs +++ b/osu.Game/Screens/Multi/Match/Components/ViewBeatmapButton.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps; using osuTK; diff --git a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs index c28363d44b..3fc2e347e7 100644 --- a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs +++ b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Screens; diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index 0c7ce86f03..74b67b9972 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -3,7 +3,7 @@ using System; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Screens/Multi/MultiplayerComposite.cs b/osu.Game/Screens/Multi/MultiplayerComposite.cs index 245a6ac358..da6bba7865 100644 --- a/osu.Game/Screens/Multi/MultiplayerComposite.cs +++ b/osu.Game/Screens/Multi/MultiplayerComposite.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osu.Game.Online.Multiplayer; using osu.Game.Users; diff --git a/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs b/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs index 71f6687cc6..d127bdc0ea 100644 --- a/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs +++ b/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs @@ -5,7 +5,7 @@ using System; using System.Diagnostics; using System.Threading; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Logging; using osu.Framework.Screens; using osu.Game.Online.API; diff --git a/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs b/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs index 1b4c99d972..fe7a40d51d 100644 --- a/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs +++ b/osu.Game/Screens/Multi/Ranking/Pages/RoomLeaderboardPage.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using Microsoft.EntityFrameworkCore.Internal; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; diff --git a/osu.Game/Screens/Multi/RoomManager.cs b/osu.Game/Screens/Multi/RoomManager.cs index 4fef0cd5e2..c15a8471a1 100644 --- a/osu.Game/Screens/Multi/RoomManager.cs +++ b/osu.Game/Screens/Multi/RoomManager.cs @@ -5,7 +5,7 @@ using System; using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Logging; using osu.Game.Beatmaps; using osu.Game.Online; diff --git a/osu.Game/Screens/OsuScreen.cs b/osu.Game/Screens/OsuScreen.cs index 7a63736469..5034385969 100644 --- a/osu.Game/Screens/OsuScreen.cs +++ b/osu.Game/Screens/OsuScreen.cs @@ -5,7 +5,7 @@ using Microsoft.EntityFrameworkCore.Internal; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Input.Bindings; using osu.Framework.Screens; diff --git a/osu.Game/Screens/OsuScreenDependencies.cs b/osu.Game/Screens/OsuScreenDependencies.cs index b51ce0d33f..84e5de76de 100644 --- a/osu.Game/Screens/OsuScreenDependencies.cs +++ b/osu.Game/Screens/OsuScreenDependencies.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Beatmaps; using osu.Game.Rulesets; diff --git a/osu.Game/Screens/Play/Break/BreakInfoLine.cs b/osu.Game/Screens/Play/Break/BreakInfoLine.cs index 312805bbbc..220b2de64d 100644 --- a/osu.Game/Screens/Play/Break/BreakInfoLine.cs +++ b/osu.Game/Screens/Play/Break/BreakInfoLine.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics; diff --git a/osu.Game/Screens/Play/HUD/ComboCounter.cs b/osu.Game/Screens/Play/HUD/ComboCounter.cs index 5996894c3b..8ab1d898d4 100644 --- a/osu.Game/Screens/Play/HUD/ComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboCounter.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; diff --git a/osu.Game/Screens/Play/HUD/HealthDisplay.cs b/osu.Game/Screens/Play/HUD/HealthDisplay.cs index 2c010b3beb..77a9e5d082 100644 --- a/osu.Game/Screens/Play/HUD/HealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/HealthDisplay.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; namespace osu.Game.Screens.Play.HUD diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index d3861988ff..619b817577 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -4,7 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 9715ae40ea..e9ae1d5829 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index f033a20226..71e8da06ba 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -4,7 +4,7 @@ using System; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Events; diff --git a/osu.Game/Screens/Play/PauseContainer.cs b/osu.Game/Screens/Play/PauseContainer.cs index 16557b0b35..0222cefdd3 100644 --- a/osu.Game/Screens/Play/PauseContainer.cs +++ b/osu.Game/Screens/Play/PauseContainer.cs @@ -4,7 +4,7 @@ using System; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Timing; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index ab49899cf8..0a741d699d 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -8,7 +8,7 @@ using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; diff --git a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs index fff24eed72..faffa0cd97 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Timing; diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 6b9aa062c5..c28a01155c 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Screens; using osu.Game.Configuration; diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 750b10e1ab..616e785d7d 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -9,7 +9,7 @@ using System.Collections.Generic; using osu.Game.Graphics; using osu.Framework.Allocation; using System.Linq; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Timing; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 4d17363702..b34035fb35 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -13,9 +13,9 @@ using osu.Framework.MathUtils; using System.Diagnostics; using System.Threading.Tasks; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Caching; using osu.Framework.Threading; -using osu.Framework.Configuration; using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Input.Events; using osu.Game.Beatmaps; diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index f6085b7389..3400befbb9 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -4,7 +4,7 @@ using System; using osuTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 9e2f20006c..c265cedfb7 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -8,7 +8,7 @@ using JetBrains.Annotations; using osuTK; using osuTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; diff --git a/osu.Game/Screens/Select/Carousel/CarouselItem.cs b/osu.Game/Screens/Select/Carousel/CarouselItem.cs index add7f2636e..461eb26603 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselItem.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselItem.cs @@ -3,7 +3,7 @@ using System; using System.Collections.Generic; -using osu.Framework.Configuration; +using osu.Framework.Bindables; namespace osu.Game.Screens.Select.Carousel { diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 43797192eb..f27cfc43f4 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index a538d2d209..547da9c1d8 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -5,7 +5,7 @@ using System; using osuTK; using osuTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.UserInterface; diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index 9750827553..4f1fd0188e 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -5,7 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Beatmaps; using osu.Game.Online.API; using osu.Game.Online.API.Requests; diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 01adb459a8..f0c1e04450 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -10,7 +10,7 @@ using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; using osu.Framework.Audio.Track; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Logging; diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index bf901660bb..36e95f4038 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -4,7 +4,7 @@ using System; using osu.Framework.Allocation; using osu.Framework.Audio.Sample; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Textures; diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index f2576a7aee..403e0423b0 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -8,7 +8,7 @@ using System.Linq.Expressions; using Microsoft.EntityFrameworkCore; using osu.Framework.Audio; using osu.Framework.Audio.Sample; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Textures; using osu.Framework.Platform; diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs index 94bb4f2525..02691da9a9 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs @@ -3,7 +3,7 @@ using osuTK; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Animations; using osu.Framework.Graphics.Textures; diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs index 1591823bc1..9fa481b8b6 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardSample.cs @@ -4,7 +4,7 @@ using System.IO; using osu.Framework.Allocation; using osu.Framework.Audio.Sample; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Beatmaps; diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs index 05cde37eb7..604260a38c 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardSprite.cs @@ -3,7 +3,7 @@ using osuTK; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Textures; diff --git a/osu.Game/Tests/Visual/EditorClockTestCase.cs b/osu.Game/Tests/Visual/EditorClockTestCase.cs index b438ff2428..7f36a0e142 100644 --- a/osu.Game/Tests/Visual/EditorClockTestCase.cs +++ b/osu.Game/Tests/Visual/EditorClockTestCase.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Input.Events; using osu.Framework.Timing; using osu.Game.Beatmaps; diff --git a/osu.Game/Tests/Visual/MultiplayerTestCase.cs b/osu.Game/Tests/Visual/MultiplayerTestCase.cs index 7d580ef65e..bb866cf750 100644 --- a/osu.Game/Tests/Visual/MultiplayerTestCase.cs +++ b/osu.Game/Tests/Visual/MultiplayerTestCase.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Game.Online.Multiplayer; namespace osu.Game.Tests.Visual diff --git a/osu.Game/Tests/Visual/OsuTestCase.cs b/osu.Game/Tests/Visual/OsuTestCase.cs index 6bff4c0291..2fbf6f7e46 100644 --- a/osu.Game/Tests/Visual/OsuTestCase.cs +++ b/osu.Game/Tests/Visual/OsuTestCase.cs @@ -5,7 +5,7 @@ using System; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Audio; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Platform; using osu.Framework.Testing; using osu.Game.Beatmaps; diff --git a/osu.Game/Tests/Visual/ScrollingTestContainer.cs b/osu.Game/Tests/Visual/ScrollingTestContainer.cs index 43cfb61d1b..19d1e18939 100644 --- a/osu.Game/Tests/Visual/ScrollingTestContainer.cs +++ b/osu.Game/Tests/Visual/ScrollingTestContainer.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; using osu.Framework.Lists; using osu.Game.Configuration; diff --git a/osu.Game/Users/Avatar.cs b/osu.Game/Users/Avatar.cs index 00e7314940..fb586d6f58 100644 --- a/osu.Game/Users/Avatar.cs +++ b/osu.Game/Users/Avatar.cs @@ -3,7 +3,7 @@ using System; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; diff --git a/osu.Game/Users/UpdateableAvatar.cs b/osu.Game/Users/UpdateableAvatar.cs index 31e3de1f27..4039e45e3d 100644 --- a/osu.Game/Users/UpdateableAvatar.cs +++ b/osu.Game/Users/UpdateableAvatar.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index acffd5073b..745ebb75fc 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -3,7 +3,7 @@ using System; using Newtonsoft.Json; -using osu.Framework.Configuration; +using osu.Framework.Bindables; namespace osu.Game.Users { diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index c789097874..9cade85608 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -5,7 +5,7 @@ using System; using osuTK; using osuTK.Graphics; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; From d99eaa3fce404b7df5e0c30314c5f38269c218a8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 21 Feb 2019 19:25:08 +0900 Subject: [PATCH 135/327] Simplify expression --- osu.Game.Tests/Visual/TestCaseChatLink.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseChatLink.cs b/osu.Game.Tests/Visual/TestCaseChatLink.cs index 6c99684c2e..fc5d43058a 100644 --- a/osu.Game.Tests/Visual/TestCaseChatLink.cs +++ b/osu.Game.Tests/Visual/TestCaseChatLink.cs @@ -96,7 +96,7 @@ namespace osu.Game.Tests.Visual return true; } - bool isItalic() => newLine.ContentFlow.Where(d => d is OsuSpriteText).Cast().All(sprite => sprite.Font.FontName == "Exo2.0-MediumItalic"); + bool isItalic() => newLine.ContentFlow.Where(d => d is OsuSpriteText).Cast().All(sprite => sprite.Font.Italics); bool isShowingLinks() { From 8853f7ad767f05bdda56464033428ea9d3936c67 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 21 Feb 2019 19:26:02 +0900 Subject: [PATCH 136/327] Explicitly set exo typeface in a few places --- osu.Game/Graphics/OsuFont.cs | 2 +- osu.Game/Graphics/UserInterface/OsuTabControl.cs | 2 +- osu.Game/Graphics/UserInterface/PageTabControl.cs | 2 +- osu.Game/Overlays/AccountCreation/ScreenEntry.cs | 2 +- osu.Game/Overlays/Profile/ProfileHeader.cs | 2 +- osu.Game/Screens/Menu/Disclaimer.cs | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index 82c6f9e572..b84236187c 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -69,7 +69,7 @@ namespace osu.Game.Graphics string weightString = weight.ToString(); // Only exo has an explicit "regular" weight, other fonts do not - if (family != "Exo2.0" && weight == FontWeight.Regular) + if (family != GetFamilyString(Typeface.Exo) && weight == FontWeight.Regular) weightString = string.Empty; return weightString; diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 042b55073f..cfd164111a 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -173,7 +173,7 @@ namespace osu.Game.Graphics.UserInterface new HoverClickSounds() }; - Active.BindValueChanged(val => Text.Font = Text.Font.With(weight: val ? FontWeight.Bold : FontWeight.Medium), true); + Active.BindValueChanged(val => Text.Font = Text.Font.With(Typeface.Exo, weight: val ? FontWeight.Bold : FontWeight.Medium), true); } protected override void OnActivated() => fadeActive(); diff --git a/osu.Game/Graphics/UserInterface/PageTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs index 40365bd57c..7bb0b64070 100644 --- a/osu.Game/Graphics/UserInterface/PageTabControl.cs +++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs @@ -59,7 +59,7 @@ namespace osu.Game.Graphics.UserInterface new HoverClickSounds() }; - Active.BindValueChanged(val => Text.Font = Text.Font.With(weight: val ? FontWeight.Bold : FontWeight.Medium), true); + Active.BindValueChanged(val => Text.Font = Text.Font.With(Typeface.Exo, weight: val ? FontWeight.Bold : FontWeight.Medium), true); } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs index 86c972c303..07fd5be009 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs @@ -129,7 +129,7 @@ namespace osu.Game.Overlays.AccountCreation usernameDescription.AddText("This will be your public presence. No profanity, no impersonation. Avoid exposing your own personal details, too!"); emailAddressDescription.AddText("Will be used for notifications, account verification and in the case you forget your password. No spam, ever."); - emailAddressDescription.AddText(" Make sure to get it right!", cp => cp.Font = cp.Font.With(weight: FontWeight.Bold)); + emailAddressDescription.AddText(" Make sure to get it right!", cp => cp.Font = cp.Font.With(Typeface.Exo, weight: FontWeight.Bold)); passwordDescription.AddText("At least "); characterCheckText = passwordDescription.AddText("8 characters long"); diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index c488adf4d7..56e34cf296 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -349,7 +349,7 @@ namespace osu.Game.Overlays.Profile colourBar.Show(); } - void boldItalic(SpriteText t) => t.Font = t.Font.With(weight: FontWeight.Bold, italics: true); + void boldItalic(SpriteText t) => t.Font = t.Font.With(Typeface.Exo, weight: FontWeight.Bold, italics: true); void lightText(SpriteText t) => t.Alpha = 0.8f; OsuSpriteText createScoreText(string text) => new OsuSpriteText diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 68a6e6525b..14124d283f 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -64,8 +64,8 @@ namespace osu.Game.Screens.Menu } }; - textFlow.AddText("This is an ", t => t.Font = t.Font.With(size: 30, weight: FontWeight.Light)); - textFlow.AddText("early development build", t => t.Font = t.Font.With(size: 30, weight: FontWeight.SemiBold)); + textFlow.AddText("This is an ", t => t.Font = t.Font.With(Typeface.Exo, 30, FontWeight.Light)); + textFlow.AddText("early development build", t => t.Font = t.Font.With(Typeface.Exo, 30, FontWeight.SemiBold)); textFlow.AddParagraph("Things may not work as expected", t => t.Font = t.Font.With(size: 20)); textFlow.NewParagraph(); From 8f53af1c71f1cd1a0f457c3d071fd50438438ea5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Feb 2019 11:32:14 +0900 Subject: [PATCH 137/327] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 6d55071070..5e670c7391 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -16,7 +16,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 19c16541a2..600cd271aa 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From 94bc552282a950ec7f9ec79de72149e3c2c59d22 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Feb 2019 11:41:28 +0900 Subject: [PATCH 138/327] Fix backgrounds not fading out when replaced by storyboard, add test for this --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 56 +++++++++++++++++-- .../Graphics/Containers/UserDimContainer.cs | 1 + 2 files changed, 52 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index b78c0b811b..6f6d43acc8 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -8,6 +8,7 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Screens; using osu.Game.Beatmaps; +using osu.Game.Configuration; using osu.Game.Graphics; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Scoring; @@ -40,6 +41,8 @@ namespace osu.Game.Tests.Visual AddStep("Load Song Select", () => { + songSelect?.Exit(); + LoadComponentAsync(new DummySongSelect(), p => { songSelect = p; @@ -86,11 +89,29 @@ namespace osu.Game.Tests.Visual InputManager.MoveMouseTo(playerLoader.ScreenPos); }); - // In the case of a user triggering the dim preview the instant player gets loaded, the user dim needs to be applied when the map starts. + // In the case of a user triggering the dim preview the instant player gets loaded, then moving the cursor off of the visual settings: + // The OnHover of PlayerLoader will trigger, which could potentially trigger an undim unless checked for in PlayerLoader. + // We need to check that in this scenario, the dim is still properly applied after entering player. AddUntilStep(() => player?.IsLoaded ?? false, "Wait for player to load"); - AddStep("Trigger background preview when loaded", () => InputManager.MoveMouseTo(playerLoader.VisualSettingsPos)); + AddStep("Trigger background preview when loaded", () => + { + InputManager.MoveMouseTo(playerLoader.VisualSettingsPos); + InputManager.MoveMouseTo(playerLoader.ScreenPos); + }); AddWaitStep(5, "Wait for dim"); AddAssert("Screen is dimmed", () => songSelect.AssertDimmed()); + + // Make sure the background is fully invisible (not dimmed) when the background should be disabled by the storyboard. + AddStep("Enable storyboard", () => + { + player.ReplacesBackground.Value = true; + player.StoryboardEnabled.Value = true; + }); + AddWaitStep(5, "Wait for dim"); + AddAssert("Background is invisible", () => songSelect.AssertInvisible()); + AddStep("Disable storyboard", () => player.ReplacesBackground.Value = false); + AddWaitStep(5, "Wait for dim"); + AddAssert("Background is visible", () => songSelect.AssertVisible()); } /// @@ -165,6 +186,16 @@ namespace osu.Game.Tests.Visual { return ((FadeAccessibleBackground)Background).AssertUndimmed(); } + + public bool AssertInvisible() + { + return ((FadeAccessibleBackground)Background).AssertInvisible(); + } + + public bool AssertVisible() + { + return ((FadeAccessibleBackground)Background).AssertVisible(); + } } private class FadeAccesibleResults : SoloResults @@ -182,20 +213,25 @@ namespace osu.Game.Tests.Visual public bool Ready; + public Bindable StoryboardEnabled; + public readonly Bindable ReplacesBackground = new Bindable(); + [BackgroundDependencyLoader] - private void load() + private void load(OsuConfigManager config) { while (!Ready) Thread.Sleep(1); + StoryboardEnabled = config.GetBindable(OsuSetting.ShowStoryboard); + ReplacesBackground.BindTo(Background.StoryboardReplacesBackground); } } private class DimAccessiblePlayerLoader : PlayerLoader { - public Bindable DimEnabled; + public Bindable DimEnabled = new Bindable(); public VisualSettings VisualSettingsPos => VisualSettings; - public Vector2 ScreenPos => VisualSettings.ScreenSpaceDrawQuad.BottomLeft - new Vector2(20, 20); + public BackgroundScreen ScreenPos => Background; public void UpdateBindables() { @@ -220,6 +256,16 @@ namespace osu.Game.Tests.Visual { return FadeContainer.Colour == Color4.White; } + + public bool AssertInvisible() + { + return FadeContainer.Alpha == 0; + } + + public bool AssertVisible() + { + return FadeContainer.Alpha == 1; + } } } } diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index c1dee94eeb..d44df875d3 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -34,6 +34,7 @@ namespace osu.Game.Graphics.Containers EnableUserDim.ValueChanged += _ => updateBackgroundDim(); DimLevel.ValueChanged += _ => updateBackgroundDim(); ShowStoryboard.ValueChanged += _ => updateBackgroundDim(); + StoryboardReplacesBackground.ValueChanged += _ => updateBackgroundDim(); } private void updateBackgroundDim() From f919f2252fb1314a99ddb8813b687a457644f448 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Feb 2019 21:22:16 +0900 Subject: [PATCH 139/327] Add ToString for Judgements to ease debugging --- osu.Game/Rulesets/Judgements/Judgement.cs | 2 ++ osu.Game/Rulesets/Judgements/JudgementResult.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/osu.Game/Rulesets/Judgements/Judgement.cs b/osu.Game/Rulesets/Judgements/Judgement.cs index 7b5e70383c..e14eedd3dc 100644 --- a/osu.Game/Rulesets/Judgements/Judgement.cs +++ b/osu.Game/Rulesets/Judgements/Judgement.cs @@ -58,5 +58,7 @@ namespace osu.Game.Rulesets.Judgements /// The to find the numeric health increase for. /// The numeric health increase of . public double HealthIncreaseFor(JudgementResult result) => HealthIncreaseFor(result.Type); + + public override string ToString() => $"AffectsCombo:{AffectsCombo} MaxResult:{MaxResult} MaxScore:{MaxNumericResult}"; } } diff --git a/osu.Game/Rulesets/Judgements/JudgementResult.cs b/osu.Game/Rulesets/Judgements/JudgementResult.cs index b1950f330e..d4ef5750b1 100644 --- a/osu.Game/Rulesets/Judgements/JudgementResult.cs +++ b/osu.Game/Rulesets/Judgements/JudgementResult.cs @@ -55,5 +55,7 @@ namespace osu.Game.Rulesets.Judgements { Judgement = judgement; } + + public override string ToString() => $"{Type} (Score:{Judgement.NumericResultFor(this)} HP:{Judgement.HealthIncreaseFor(this)} {Judgement})"; } } From a62f1509627952a84a0c15bbbdb381bd587dc401 Mon Sep 17 00:00:00 2001 From: Ignacio Conde Date: Fri, 22 Feb 2019 02:28:38 -0300 Subject: [PATCH 140/327] Fixed Issue #4159 --- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 57728dd134..ba87fe6ed9 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -330,12 +330,12 @@ namespace osu.Game.Rulesets.Mania for (int i = LeftKeys.Length - columns / 2; i < LeftKeys.Length; i++) bindings.Add(new KeyBinding(LeftKeys[i], currentNormalAction++)); - for (int i = 0; i < columns / 2; i++) - bindings.Add(new KeyBinding(RightKeys[i], currentNormalAction++)); - if (columns % 2 == 1) bindings.Add(new KeyBinding(SpecialKey, SpecialAction)); + for (int i = 0; i < columns / 2; i++) + bindings.Add(new KeyBinding(RightKeys[i], currentNormalAction++)); + nextNormalAction = currentNormalAction; return bindings; } From 65cdac60c3aa926dc0f0c91cd2459a548db1a7ec Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Feb 2019 14:43:05 +0900 Subject: [PATCH 141/327] Add tests to make sure the background is always the same through screen transitions --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 35 ++++++++++++++++++- .../Play/ScreenWithBeatmapBackground.cs | 2 +- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 6f6d43acc8..a09843318c 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using System.Collections.Generic; using System.Threading; using NUnit.Framework; using osu.Framework.Allocation; @@ -26,6 +28,13 @@ namespace osu.Game.Tests.Visual [TestFixture] public class TestCaseBackgroundScreenBeatmap : ManualInputManagerTestCase { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(ScreenWithBeatmapBackground), + typeof(PlayerLoader), + typeof(Player) + }; + private DummySongSelect songSelect; private DimAccessiblePlayerLoader playerLoader; private DimAccessiblePlayer player; @@ -36,11 +45,13 @@ namespace osu.Game.Tests.Visual public TestCaseBackgroundScreenBeatmap() { ScreenStack screen; + InputManager.Add(backgroundStack = new BackgroundScreenStack {RelativeSizeAxes = Axes.Both}); InputManager.Add(screen = new ScreenStack { RelativeSizeAxes = Axes.Both }); AddStep("Load Song Select", () => { + songSelect?.MakeCurrent(); songSelect?.Exit(); LoadComponentAsync(new DummySongSelect(), p => @@ -73,6 +84,8 @@ namespace osu.Game.Tests.Visual AddStep("Start player loader", () => songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer()))); AddUntilStep(() => playerLoader?.IsLoaded ?? false, "Wait for Player Loader to load"); + AddAssert("Background retained from song select", () => songSelect.AssertBackgroundCurrent()); + AddStep("Update bindables", () => playerLoader.UpdateBindables()); AddStep("Trigger background preview", () => { @@ -93,6 +106,7 @@ namespace osu.Game.Tests.Visual // The OnHover of PlayerLoader will trigger, which could potentially trigger an undim unless checked for in PlayerLoader. // We need to check that in this scenario, the dim is still properly applied after entering player. AddUntilStep(() => player?.IsLoaded ?? false, "Wait for player to load"); + AddAssert("Background retained from song select", () => songSelect.AssertBackgroundCurrent()); AddStep("Trigger background preview when loaded", () => { InputManager.MoveMouseTo(playerLoader.VisualSettingsPos); @@ -142,7 +156,11 @@ namespace osu.Game.Tests.Visual [Test] public void PauseTest() { - AddStep("Transition to Pause", () => player.Exit()); + AddStep("Transition to Pause", () => + { + if (!player.IsPaused) + player.Exit(); + }); AddWaitStep(5, "Wait for dim"); AddAssert("Screen is dimmed", () => songSelect.AssertDimmed()); } @@ -156,6 +174,7 @@ namespace osu.Game.Tests.Visual AddStep("Transition to Results", () => player.Push(new FadeAccesibleResults(new ScoreInfo { User = new User { Username = "osu!" }}))); AddWaitStep(5, "Wait for dim"); AddAssert("Screen is undimmed", () => songSelect.AssertUndimmed()); + AddAssert("Background retained from song select", () => songSelect.AssertBackgroundCurrent()); } /// @@ -196,6 +215,15 @@ namespace osu.Game.Tests.Visual { return ((FadeAccessibleBackground)Background).AssertVisible(); } + + /// + /// Make sure every time a screen gets pushed, the background doesn't get replaced + /// + /// Whether or not the original background is still the current background + public bool AssertBackgroundCurrent() + { + return ((FadeAccessibleBackground)Background).IsCurrentScreen(); + } } private class FadeAccesibleResults : SoloResults @@ -216,6 +244,8 @@ namespace osu.Game.Tests.Visual public Bindable StoryboardEnabled; public readonly Bindable ReplacesBackground = new Bindable(); + public bool IsPaused => RulesetContainer.IsPaused; + [BackgroundDependencyLoader] private void load(OsuConfigManager config) { @@ -233,6 +263,9 @@ namespace osu.Game.Tests.Visual public VisualSettings VisualSettingsPos => VisualSettings; public BackgroundScreen ScreenPos => Background; + [Resolved] + private BackgroundScreenStack stack { get; set; } + public void UpdateBindables() { DimEnabled = Background.EnableUserDim; diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 15016d2bc2..93223b6607 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -15,7 +15,7 @@ namespace osu.Game.Screens.Play { protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value); - protected new BackgroundScreenBeatmap Background => base.Background as BackgroundScreenBeatmap; + protected new BackgroundScreenBeatmap Background => (BackgroundScreenBeatmap)base.Background; protected const float BACKGROUND_FADE_DURATION = 800; From 918a60ebbf6d644af3ab63a95466bdd5bb6b6d1a Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Feb 2019 16:56:03 +0900 Subject: [PATCH 142/327] Create a new player every time a test is performed. --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 47 ++++++++++++------- .../Backgrounds/BackgroundScreenBeatmap.cs | 8 ++-- 2 files changed, 34 insertions(+), 21 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index a09843318c..5829ba38b5 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -42,6 +42,21 @@ namespace osu.Game.Tests.Visual [Cached] private BackgroundScreenStack backgroundStack; + private void performSetup() + { + AddUntilStep(() => + { + if (!songSelect.IsCurrentScreen()) + { + songSelect.MakeCurrent(); + return false; + } + return true; + }, "Wait for song select is current"); + AddStep("Load new player to song select", () => songSelect.Push(player = new DimAccessiblePlayer { Ready = true })); + AddUntilStep(() => player?.IsLoaded ?? false, "Wait for player to load"); + } + public TestCaseBackgroundScreenBeatmap() { ScreenStack screen; @@ -58,6 +73,7 @@ namespace osu.Game.Tests.Visual { songSelect = p; screen.Push(p); + songSelect.UpdateBindables(); }); }); @@ -85,8 +101,6 @@ namespace osu.Game.Tests.Visual AddStep("Start player loader", () => songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer()))); AddUntilStep(() => playerLoader?.IsLoaded ?? false, "Wait for Player Loader to load"); AddAssert("Background retained from song select", () => songSelect.AssertBackgroundCurrent()); - - AddStep("Update bindables", () => playerLoader.UpdateBindables()); AddStep("Trigger background preview", () => { InputManager.MoveMouseTo(playerLoader.ScreenPos); @@ -134,7 +148,8 @@ namespace osu.Game.Tests.Visual [Test] public void DisableUserDimTest() { - AddStep("Test User Undimming", () => playerLoader.DimEnabled.Value = false); + performSetup(); + AddStep("Test User Undimming", () => songSelect.DimEnabled.Value = false); AddWaitStep(5, "Wait for dim"); AddAssert("Screen is undimmed", () => songSelect.AssertUndimmed()); } @@ -145,7 +160,8 @@ namespace osu.Game.Tests.Visual [Test] public void EnableUserDimTest() { - AddStep("Test User Dimming", () => playerLoader.DimEnabled.Value = true); + performSetup(); + AddStep("Test User Dimming", () => songSelect.DimEnabled.Value = true); AddWaitStep(5, "Wait for dim"); AddAssert("Screen is dimmed", () => songSelect.AssertDimmed()); } @@ -156,6 +172,7 @@ namespace osu.Game.Tests.Visual [Test] public void PauseTest() { + performSetup(); AddStep("Transition to Pause", () => { if (!player.IsPaused) @@ -171,6 +188,7 @@ namespace osu.Game.Tests.Visual [Test] public void TransitionTest() { + performSetup(); AddStep("Transition to Results", () => player.Push(new FadeAccesibleResults(new ScoreInfo { User = new User { Username = "osu!" }}))); AddWaitStep(5, "Wait for dim"); AddAssert("Screen is undimmed", () => songSelect.AssertUndimmed()); @@ -183,11 +201,8 @@ namespace osu.Game.Tests.Visual [Test] public void TransitionOutTest() { - AddStep("Exit player", () => - { - player.MakeCurrent(); - player.Exit(); - }); + performSetup(); + AddStep("Exit player", () => songSelect.MakeCurrent()); AddWaitStep(5, "Wait for dim"); AddAssert("Screen is undimmed", () => songSelect.AssertUndimmed()); } @@ -195,6 +210,12 @@ namespace osu.Game.Tests.Visual private class DummySongSelect : OsuScreen { protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); + public readonly Bindable DimEnabled = new Bindable(); + + public void UpdateBindables() + { + DimEnabled.BindTo(((FadeAccessibleBackground)Background).EnableUserDim); + } public bool AssertDimmed() { @@ -258,19 +279,11 @@ namespace osu.Game.Tests.Visual private class DimAccessiblePlayerLoader : PlayerLoader { - public Bindable DimEnabled = new Bindable(); - public VisualSettings VisualSettingsPos => VisualSettings; public BackgroundScreen ScreenPos => Background; [Resolved] private BackgroundScreenStack stack { get; set; } - - public void UpdateBindables() - { - DimEnabled = Background.EnableUserDim; - } - public DimAccessiblePlayerLoader(Player player) : base(() => player) { } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index d62cea4511..c793197f19 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -15,8 +15,8 @@ namespace osu.Game.Screens.Backgrounds public class BackgroundScreenBeatmap : BlurrableBackgroundScreen { private WorkingBeatmap beatmap; - protected Bindable DimLevel; - public Bindable EnableUserDim; + protected Bindable DimLevel = new Bindable(); + public Bindable EnableUserDim = new Bindable(); public Bindable StoryboardReplacesBackground = new Bindable(); protected UserDimContainer FadeContainer; @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Backgrounds [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - DimLevel = config.GetBindable(OsuSetting.DimLevel); + config.BindWith(OsuSetting.DimLevel, DimLevel); } public virtual WorkingBeatmap Beatmap @@ -39,7 +39,7 @@ namespace osu.Game.Screens.Backgrounds FadeContainer = new UserDimContainer { RelativeSizeAxes = Axes.Both }; InternalChild = FadeContainer; - EnableUserDim = FadeContainer.EnableUserDim; + EnableUserDim.BindTo(FadeContainer.EnableUserDim); Schedule(() => { From d4bdae4b042ecd6798a39eb30560d486caea3fa0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 22 Feb 2019 16:59:52 +0900 Subject: [PATCH 143/327] Disable TestInstantPolling --- osu.Game.Tests/Visual/TestCasePollingComponent.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePollingComponent.cs b/osu.Game.Tests/Visual/TestCasePollingComponent.cs index 68c44c7758..63f4f88948 100644 --- a/osu.Game.Tests/Visual/TestCasePollingComponent.cs +++ b/osu.Game.Tests/Visual/TestCasePollingComponent.cs @@ -56,6 +56,7 @@ namespace osu.Game.Tests.Visual }); [Test] + [Ignore("polling is threaded, and it's very hard to hook into it correctly")] public void TestInstantPolling() { createPoller(true); @@ -106,8 +107,11 @@ namespace osu.Game.Tests.Visual private void checkCount(int checkValue) { - Logger.Log($"value is {count}"); - AddAssert($"count is {checkValue}", () => count == checkValue); + AddAssert($"count is {checkValue}", () => + { + Logger.Log($"value is {count}"); + return count == checkValue; + }); } private void createPoller(bool instant) => AddStep("create poller", () => From 263972a048590262c5708d29b382d385823459bf Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Feb 2019 17:00:00 +0900 Subject: [PATCH 144/327] Remove DimLevel bindable from ScreenWithBeatmapBackground --- osu.Game/Screens/Play/Player.cs | 3 --- osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs | 2 -- 2 files changed, 5 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index c6b6ad8821..3f132c421e 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -345,9 +345,6 @@ namespace osu.Game.Screens.Play .Delay(250) .FadeIn(250); - // We need to update background elements when the user dim gets updated - // The storyboard needs to know whether or not to completely fade at 100% dim - DimLevel.ValueChanged += _ => UpdateBackgroundElements(); ShowStoryboard.ValueChanged += _ => UpdateBackgroundElements(); Background.EnableUserDim.Value = true; storyboardContainer.StoryboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable; diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 93223b6607..405218ae2d 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -21,7 +21,6 @@ namespace osu.Game.Screens.Play #region User Settings - protected Bindable DimLevel; protected Bindable BlurLevel; protected Bindable ShowStoryboard; @@ -30,7 +29,6 @@ namespace osu.Game.Screens.Play [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - DimLevel = config.GetBindable(OsuSetting.DimLevel); BlurLevel = config.GetBindable(OsuSetting.BlurLevel); ShowStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); } From 452caabd40f00c2867e16e7014c5fb1ed4b69766 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Feb 2019 17:06:49 +0900 Subject: [PATCH 145/327] 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() From 6bf831b96f2f558dc24ef3484d8486ff5a22d80a Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Feb 2019 17:15:05 +0900 Subject: [PATCH 146/327] Fix TransitiouOutTest getting stuck on pause --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 5829ba38b5..9871209760 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -202,7 +202,15 @@ namespace osu.Game.Tests.Visual public void TransitionOutTest() { performSetup(); - AddStep("Exit player", () => songSelect.MakeCurrent()); + AddUntilStep(() => + { + if (!songSelect.IsCurrentScreen()) + { + songSelect.MakeCurrent(); + return false; + } + return true; + }, "Wait for song select is current"); AddWaitStep(5, "Wait for dim"); AddAssert("Screen is undimmed", () => songSelect.AssertUndimmed()); } From 3fe4b8fd1ce0bf2e0a4b92f416f9339b495d18c1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Feb 2019 17:51:39 +0900 Subject: [PATCH 147/327] Update variable names Also cleans up some weird code --- osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs | 2 +- .../Visual/TestCaseChannelTabControl.cs | 2 +- .../Visual/TestCaseNotificationOverlay.cs | 2 +- .../Visual/TestCaseScreenBreadcrumbControl.cs | 2 +- osu.Game.Tests/Visual/TestCaseTabControl.cs | 4 ++-- osu.Game/Beatmaps/BindableBeatmap.cs | 2 +- .../Configuration/DatabasedConfigManager.cs | 4 ++-- osu.Game/Configuration/OsuConfigManager.cs | 8 +++---- osu.Game/Graphics/Cursor/MenuCursor.cs | 2 +- .../UserInterface/BreadcrumbControl.cs | 4 ++-- osu.Game/Graphics/UserInterface/Nub.cs | 4 ++-- .../Graphics/UserInterface/OsuCheckbox.cs | 4 ++-- .../UserInterface/OsuTabControlCheckbox.cs | 4 ++-- .../Graphics/UserInterface/RollingCounter.cs | 4 ++-- .../UserInterface/ScreenBreadcrumbControl.cs | 2 +- osu.Game/OsuGame.cs | 10 ++++----- osu.Game/OsuGameBase.cs | 2 +- .../Overlays/AccountCreation/ScreenEntry.cs | 2 +- osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs | 4 ++-- .../BeatmapSet/Buttons/FavouriteButton.cs | 4 ++-- .../BeatmapSet/Buttons/PreviewButton.cs | 2 +- osu.Game/Overlays/BeatmapSet/Header.cs | 13 ++++++----- osu.Game/Overlays/BeatmapSetOverlay.cs | 6 ++--- .../Chat/Selection/ChannelListItem.cs | 2 +- .../Chat/Selection/ChannelSelectionOverlay.cs | 2 +- osu.Game/Overlays/ChatOverlay.cs | 12 +++++----- osu.Game/Overlays/Direct/DirectPanel.cs | 7 ++++-- osu.Game/Overlays/DirectOverlay.cs | 22 +++++++++---------- osu.Game/Overlays/HoldToConfirmOverlay.cs | 2 +- .../Profile/Sections/Kudosu/KudosuInfo.cs | 6 ++--- .../Sections/General/LoginSettings.cs | 4 ++-- .../Sections/Graphics/LayoutSettings.cs | 2 +- .../Settings/Sections/Input/MouseSettings.cs | 8 +++---- osu.Game/Overlays/SettingsOverlay.cs | 6 ++--- osu.Game/Overlays/SocialOverlay.cs | 12 +++++----- .../Toolbar/ToolbarNotificationButton.cs | 6 ++--- osu.Game/Overlays/UserProfileOverlay.cs | 12 +++++----- osu.Game/Overlays/Volume/MuteButton.cs | 6 ++--- osu.Game/Overlays/Volume/VolumeMeter.cs | 4 ++-- osu.Game/Overlays/VolumeOverlay.cs | 4 ++-- .../Objects/Drawables/DrawableHitObject.cs | 8 +++---- osu.Game/Rulesets/UI/RulesetContainer.cs | 4 ++-- .../Edit/Components/PlaybackControl.cs | 2 +- .../RadioButtons/DrawableRadioButton.cs | 4 ++-- .../RadioButtons/RadioButtonCollection.cs | 4 ++-- .../Timelines/Summary/Parts/TimelinePart.cs | 4 ++-- .../Compose/Components/BeatDivisorControl.cs | 10 +++------ .../Compose/Components/Timeline/Timeline.cs | 2 +- osu.Game/Screens/Menu/ButtonSystem.cs | 2 +- osu.Game/Screens/Multi/Header.cs | 6 ++--- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 3 ++- osu.Game/Screens/Play/HUD/ComboCounter.cs | 2 +- osu.Game/Screens/Play/HUD/HealthDisplay.cs | 2 +- .../Screens/Play/HUD/HoldForMenuButton.cs | 2 +- osu.Game/Screens/Play/HUD/ModDisplay.cs | 4 ++-- osu.Game/Screens/Play/HUDOverlay.cs | 2 +- osu.Game/Screens/Play/Player.cs | 2 +- .../Play/PlayerSettings/PlaybackSettings.cs | 8 +++---- osu.Game/Screens/Play/SongProgress.cs | 2 +- osu.Game/Screens/Select/BeatmapCarousel.cs | 6 ++--- .../Select/BeatmapDetailAreaTabControl.cs | 4 ++-- .../Screens/Select/Carousel/CarouselGroup.cs | 6 ++--- .../Carousel/CarouselGroupEagerSelect.cs | 4 ++-- .../Screens/Select/Carousel/CarouselItem.cs | 4 ++-- .../Carousel/DrawableCarouselBeatmapSet.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 8 +++---- osu.Game/Screens/Select/SongSelect.cs | 4 ++-- osu.Game/Skinning/SkinManager.cs | 6 ++--- osu.Game/Users/UserPanel.cs | 4 ++-- 69 files changed, 166 insertions(+), 165 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs b/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs index a1b53977fe..a203e23687 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs @@ -39,7 +39,7 @@ namespace osu.Game.Rulesets.Osu.Mods public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) { - scoreProcessor.Health.ValueChanged += e => { blinds.AnimateClosedness((float)e.NewValue); }; + scoreProcessor.Health.ValueChanged += health => { blinds.AnimateClosedness((float)health.NewValue); }; } /// diff --git a/osu.Game.Tests/Visual/TestCaseChannelTabControl.cs b/osu.Game.Tests/Visual/TestCaseChannelTabControl.cs index 29442f2b45..749303b1bb 100644 --- a/osu.Game.Tests/Visual/TestCaseChannelTabControl.cs +++ b/osu.Game.Tests/Visual/TestCaseChannelTabControl.cs @@ -69,7 +69,7 @@ namespace osu.Game.Tests.Visual }); channelTabControl.OnRequestLeave += channel => channelTabControl.RemoveChannel(channel); - channelTabControl.Current.ValueChanged += e => currentText.Text = "Currently selected channel: " + e.NewValue.ToString(); + channelTabControl.Current.ValueChanged += channel => currentText.Text = "Currently selected channel: " + channel.NewValue.ToString(); AddStep("Add random private channel", addRandomPrivateChannel); AddAssert("There is only one channels", () => channelTabControl.Items.Count() == 2); diff --git a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs index 955c3f9a80..d6a3361cf2 100644 --- a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs @@ -47,7 +47,7 @@ namespace osu.Game.Tests.Visual void setState(Visibility state) => AddStep(state.ToString(), () => manager.State = state); void checkProgressingCount(int expected) => AddAssert($"progressing count is {expected}", () => progressingNotifications.Count == expected); - manager.UnreadCount.ValueChanged += e => { displayedCount.Text = $"displayed count: {e.NewValue}"; }; + manager.UnreadCount.ValueChanged += count => { displayedCount.Text = $"displayed count: {count.NewValue}"; }; setState(Visibility.Visible); AddStep(@"simple #1", sendHelloNotification); diff --git a/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs b/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs index 1d89be59f8..531c01158b 100644 --- a/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs +++ b/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs @@ -48,7 +48,7 @@ namespace osu.Game.Tests.Visual }, }; - breadcrumbs.Current.ValueChanged += e => titleText.Text = $"Changed to {e.NewValue.ToString()}"; + breadcrumbs.Current.ValueChanged += screen => titleText.Text = $"Changed to {screen.NewValue.ToString()}"; breadcrumbs.Current.TriggerChange(); waitForCurrent(); diff --git a/osu.Game.Tests/Visual/TestCaseTabControl.cs b/osu.Game.Tests/Visual/TestCaseTabControl.cs index 41b152760a..ebf8f3bb30 100644 --- a/osu.Game.Tests/Visual/TestCaseTabControl.cs +++ b/osu.Game.Tests/Visual/TestCaseTabControl.cs @@ -33,9 +33,9 @@ namespace osu.Game.Tests.Visual filter.PinItem(GroupMode.All); filter.PinItem(GroupMode.RecentlyPlayed); - filter.Current.ValueChanged += e => + filter.Current.ValueChanged += grouping => { - text.Text = "Currently Selected: " + e.NewValue.ToString(); + text.Text = "Currently Selected: " + grouping.NewValue.ToString(); }; } } diff --git a/osu.Game/Beatmaps/BindableBeatmap.cs b/osu.Game/Beatmaps/BindableBeatmap.cs index d69bf3c973..657dc06297 100644 --- a/osu.Game/Beatmaps/BindableBeatmap.cs +++ b/osu.Game/Beatmaps/BindableBeatmap.cs @@ -34,7 +34,7 @@ namespace osu.Game.Beatmaps this.audioManager = audioManager; - ValueChanged += e => registerAudioTrack(e.NewValue); + ValueChanged += b => registerAudioTrack(b.NewValue); // If the track has changed prior to this being called, let's register it if (Value != Default) diff --git a/osu.Game/Configuration/DatabasedConfigManager.cs b/osu.Game/Configuration/DatabasedConfigManager.cs index 4f304ec3c3..f547a7d3e1 100644 --- a/osu.Game/Configuration/DatabasedConfigManager.cs +++ b/osu.Game/Configuration/DatabasedConfigManager.cs @@ -61,9 +61,9 @@ namespace osu.Game.Configuration databasedSettings.Add(setting); } - bindable.ValueChanged += e => + bindable.ValueChanged += b => { - setting.Value = e.NewValue; + setting.Value = b.NewValue; settings.Update(setting); }; } diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 471bf9a44e..1260a524b4 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -33,14 +33,14 @@ namespace osu.Game.Configuration Set(OsuSetting.Username, string.Empty); Set(OsuSetting.Token, string.Empty); - Set(OsuSetting.SavePassword, false).ValueChanged += e => + Set(OsuSetting.SavePassword, false).ValueChanged += enabled => { - if (e.NewValue) Set(OsuSetting.SaveUsername, true); + if (enabled.NewValue) Set(OsuSetting.SaveUsername, true); }; - Set(OsuSetting.SaveUsername, true).ValueChanged += e => + Set(OsuSetting.SaveUsername, true).ValueChanged += enabled => { - if (!e.NewValue) Set(OsuSetting.SavePassword, false); + if (!enabled.NewValue) Set(OsuSetting.SavePassword, false); }; Set(OsuSetting.ExternalLinkWarning, true); diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 15227ecd6d..6e6f5f351e 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -156,7 +156,7 @@ namespace osu.Game.Graphics.Cursor }; cursorScale = config.GetBindable(OsuSetting.MenuCursorSize); - cursorScale.ValueChanged += e => cursorContainer.Scale = new Vector2((float)e.NewValue * base_scale); + cursorScale.ValueChanged += scale => cursorContainer.Scale = new Vector2((float)scale.NewValue * base_scale); cursorScale.TriggerChange(); } } diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index 0a827e7650..64e904476d 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -27,12 +27,12 @@ namespace osu.Game.Graphics.UserInterface { Height = 32; TabContainer.Spacing = new Vector2(padding, 0f); - Current.ValueChanged += e => + Current.ValueChanged += index => { foreach (var t in TabContainer.Children.OfType()) { var tIndex = TabContainer.IndexOf(t); - var tabIndex = TabContainer.IndexOf(TabMap[e.NewValue]); + var tabIndex = TabContainer.IndexOf(TabMap[index.NewValue]); t.State = tIndex < tabIndex ? Visibility.Hidden : Visibility.Visible; t.Chevron.FadeTo(tIndex <= tabIndex ? 0f : 1f, 500, Easing.OutQuint); diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index 733cdd7417..470297a83c 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -41,9 +41,9 @@ namespace osu.Game.Graphics.UserInterface }, }; - Current.ValueChanged += e => + Current.ValueChanged += filled => { - if (e.NewValue) + if (filled.NewValue) fill.FadeIn(200, Easing.OutQuint); else fill.FadeTo(0.01f, 200, Easing.OutQuint); //todo: remove once we figure why containers aren't drawing at all times diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 5e71eb2407..9f5fc503ad 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -86,9 +86,9 @@ namespace osu.Game.Graphics.UserInterface { base.LoadComplete(); - Current.ValueChanged += e => + Current.ValueChanged += enabled => { - if (e.NewValue) + if (enabled.NewValue) sampleChecked?.Play(); else sampleUnchecked?.Play(); diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs index ae47b8594a..2bb3533149 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs @@ -118,9 +118,9 @@ namespace osu.Game.Graphics.UserInterface } }; - Current.ValueChanged += e => + Current.ValueChanged += selected => { - if (e.NewValue) + if (selected.NewValue) { fadeIn(); icon.Icon = FontAwesome.fa_check_circle_o; diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index b286047ba6..fa6b4b4e2f 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -97,9 +97,9 @@ namespace osu.Game.Graphics.UserInterface DisplayedCount = Current.Value; - Current.ValueChanged += e => + Current.ValueChanged += val => { - if (IsLoaded) TransformCount(displayedCount, e.NewValue); + if (IsLoaded) TransformCount(displayedCount, val.NewValue); }; } diff --git a/osu.Game/Graphics/UserInterface/ScreenBreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/ScreenBreadcrumbControl.cs index cbfe3d3585..f564a4b5a8 100644 --- a/osu.Game/Graphics/UserInterface/ScreenBreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/ScreenBreadcrumbControl.cs @@ -19,7 +19,7 @@ namespace osu.Game.Graphics.UserInterface onPushed(null, stack.CurrentScreen); - Current.ValueChanged += e => e.NewValue.MakeCurrent(); + Current.ValueChanged += current => current.NewValue.MakeCurrent(); } private void onPushed(IScreen lastScreen, IScreen newScreen) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 3c1d1d12f4..883cac4f7a 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -175,12 +175,12 @@ namespace osu.Game // bind config int to database RulesetInfo configRuleset = LocalConfig.GetBindable(OsuSetting.Ruleset); ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First(); - ruleset.ValueChanged += e => configRuleset.Value = e.NewValue.ID ?? 0; + ruleset.ValueChanged += r => configRuleset.Value = r.NewValue.ID ?? 0; // bind config int to database SkinInfo configSkin = LocalConfig.GetBindable(OsuSetting.Skin); - SkinManager.CurrentSkinInfo.ValueChanged += e => configSkin.Value = e.NewValue.ID; - configSkin.ValueChanged += e => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == e.NewValue) ?? SkinInfo.Default; + SkinManager.CurrentSkinInfo.ValueChanged += skin => configSkin.Value = skin.NewValue.ID; + configSkin.ValueChanged += skinId => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == skinId.NewValue) ?? SkinInfo.Default; configSkin.TriggerChange(); LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust); @@ -516,9 +516,9 @@ namespace osu.Game }; } - OverlayActivationMode.ValueChanged += e => + OverlayActivationMode.ValueChanged += mode => { - if (e.NewValue != OverlayActivation.All) CloseAllOverlays(); + if (mode.NewValue != OverlayActivation.All) CloseAllOverlays(); }; void updateScreenOffset() diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 0bc03d97db..487ef10ffb 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -209,7 +209,7 @@ namespace osu.Game // TODO: This is temporary until we reimplement the local FPS display. // It's just to allow end-users to access the framework FPS display without knowing the shortcut key. fpsDisplayVisible = LocalConfig.GetBindable(OsuSetting.ShowFpsDisplay); - fpsDisplayVisible.ValueChanged += e => { FrameStatisticsMode = e.NewValue ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; }; + fpsDisplayVisible.ValueChanged += visible => { FrameStatisticsMode = visible.NewValue ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; }; fpsDisplayVisible.TriggerChange(); } diff --git a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs index a2f224c04f..b9639d4bf8 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs @@ -135,7 +135,7 @@ namespace osu.Game.Overlays.AccountCreation characterCheckText = passwordDescription.AddText("8 characters long"); passwordDescription.AddText(". Choose something long but also something you will remember, like a line from your favourite song."); - passwordTextBox.Current.ValueChanged += e => { characterCheckText.ForEach(s => s.Colour = e.NewValue.Length == 0 ? Color4.White : Interpolation.ValueAt(e.NewValue.Length, Color4.OrangeRed, Color4.YellowGreen, 0, 8, Easing.In)); }; + passwordTextBox.Current.ValueChanged += password => { characterCheckText.ForEach(s => s.Colour = password.NewValue.Length == 0 ? Color4.White : Interpolation.ValueAt(password.NewValue.Length, Color4.OrangeRed, Color4.YellowGreen, 0, 8, Easing.In)); }; } protected override void Update() diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs index 69c06bd605..ce758564c1 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs @@ -138,9 +138,9 @@ namespace osu.Game.Overlays.BeatmapSet }, }; - Beatmap.ValueChanged += e => + Beatmap.ValueChanged += b => { - showBeatmap(e.NewValue); + showBeatmap(b.NewValue); updateDifficultyButtons(); }; } diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs index 5411e3f7be..7824a78a14 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs @@ -53,9 +53,9 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons }, }); - Favourited.ValueChanged += e => + Favourited.ValueChanged += favourited => { - if (e.NewValue) + if (favourited.NewValue) { pink.FadeIn(200); icon.Icon = FontAwesome.fa_heart; diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs index 884b32a417..269342525b 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs @@ -67,7 +67,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons }; Action = () => playButton.Click(); - Playing.ValueChanged += e => progress.FadeTo(e.NewValue ? 1 : 0, 100); + Playing.ValueChanged += playing => progress.FadeTo(playing.NewValue ? 1 : 0, 100); } [BackgroundDependencyLoader] diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index 38a0454a4c..d2218c3a01 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -181,8 +181,8 @@ namespace osu.Game.Overlays.BeatmapSet }, }; - Picker.Beatmap.ValueChanged += e => Details.Beatmap = e.NewValue; - Picker.Beatmap.ValueChanged += e => externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{e.NewValue?.Ruleset.ShortName}/{e.NewValue?.OnlineBeatmapID}"; + Picker.Beatmap.ValueChanged += b => Details.Beatmap = b.NewValue; + Picker.Beatmap.ValueChanged += b => externalLink.Link = $@"https://osu.ppy.sh/beatmapsets/{BeatmapSet.Value?.OnlineBeatmapSetID}#{b.NewValue?.Ruleset.ShortName}/{b.NewValue?.OnlineBeatmapID}"; } [BackgroundDependencyLoader] @@ -219,11 +219,12 @@ namespace osu.Game.Overlays.BeatmapSet private void updateDownloadButtons() { if (BeatmapSet.Value == null) return; + switch (State.Value) { case DownloadState.LocallyAvailable: // temporary for UX until new design is implemented. - downloadButtonsContainer.Child = new osu.Game.Overlays.Direct.DownloadButton(e.NewValue) + downloadButtonsContainer.Child = new osu.Game.Overlays.Direct.DownloadButton(BeatmapSet.Value) { Width = 50, RelativeSizeAxes = Axes.Y @@ -232,12 +233,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(e.NewValue); + downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); break; default: - downloadButtonsContainer.Child = new DownloadButton(e.NewValue); + downloadButtonsContainer.Child = new DownloadButton(BeatmapSet.Value); if (BeatmapSet.Value.OnlineInfo.HasVideo) - downloadButtonsContainer.Add(new DownloadButton(e.NewValue, true)); + downloadButtonsContainer.Add(new DownloadButton(BeatmapSet.Value, true)); break; } } diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index 1f2047e5bd..ff8603c749 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -101,10 +101,10 @@ namespace osu.Game.Overlays }, }; - header.Picker.Beatmap.ValueChanged += e => + header.Picker.Beatmap.ValueChanged += b => { - info.Beatmap = e.NewValue; - scores.Beatmap = e.NewValue; + info.Beatmap = b.NewValue; + scores.Beatmap = b.NewValue; }; } diff --git a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs index 9fd978e9ea..74689dddab 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs @@ -148,7 +148,7 @@ namespace osu.Game.Overlays.Chat.Selection joinedColour = colours.Blue; hoverColour = colours.Yellow; - joinedBind.ValueChanged += e => updateColour(e.NewValue); + joinedBind.ValueChanged += joined => updateColour(joined.NewValue); joinedBind.BindTo(channel.Joined); joinedBind.TriggerChange(); diff --git a/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs index d5c67bf29f..550ba8d173 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs @@ -125,7 +125,7 @@ namespace osu.Game.Overlays.Chat.Selection }, }; - search.Current.ValueChanged += e => sectionsFlow.SearchTerm = e.NewValue; + search.Current.ValueChanged += term => sectionsFlow.SearchTerm = term.NewValue; } public void UpdateAvailableChannels(IEnumerable channels) diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 9df1c915c8..5428279325 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -162,8 +162,8 @@ namespace osu.Game.Overlays }, }; - channelTabControl.Current.ValueChanged += e => channelManager.CurrentChannel.Value = e.NewValue; - channelTabControl.ChannelSelectorActive.ValueChanged += e => channelSelectionOverlay.State = e.NewValue ? Visibility.Visible : Visibility.Hidden; + channelTabControl.Current.ValueChanged += current => channelManager.CurrentChannel.Value = current.NewValue; + channelTabControl.ChannelSelectorActive.ValueChanged += active => channelSelectionOverlay.State = active.NewValue ? Visibility.Visible : Visibility.Hidden; channelSelectionOverlay.StateChanged += state => { if (state == Visibility.Hidden && channelManager.CurrentChannel.Value == null) @@ -328,11 +328,11 @@ namespace osu.Game.Overlays private void load(OsuConfigManager config, OsuColour colours, ChannelManager channelManager) { ChatHeight = config.GetBindable(OsuSetting.ChatDisplayHeight); - ChatHeight.ValueChanged += e => + ChatHeight.ValueChanged += height => { - chatContainer.Height = (float)e.NewValue; - channelSelectionContainer.Height = 1f - (float)e.NewValue; - tabBackground.FadeTo(e.NewValue == 1 ? 1 : 0.8f, 200); + chatContainer.Height = (float)height.NewValue; + channelSelectionContainer.Height = 1f - (float)height.NewValue; + tabBackground.FadeTo(height.NewValue == 1 ? 1 : 0.8f, 200); }; ChatHeight.TriggerChange(); diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 8fff2c51e7..e544a1384e 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -127,8 +127,11 @@ namespace osu.Game.Overlays.Direct base.LoadComplete(); this.FadeInFromZero(200, Easing.Out); - PreviewPlaying.ValueChanged += e => PlayButton.FadeTo(e.NewValue || IsHovered || !FadePlayButton ? 1 : 0, 120, Easing.InOutQuint); - PreviewPlaying.ValueChanged += e => PreviewBar.FadeTo(e.NewValue ? 1 : 0, 120, Easing.InOutQuint); + PreviewPlaying.ValueChanged += playing => + { + PlayButton.FadeTo(playing.NewValue || IsHovered || !FadePlayButton ? 1 : 0, 120, Easing.InOutQuint); + PreviewBar.FadeTo(playing.NewValue ? 1 : 0, 120, Easing.InOutQuint); + }; } protected List GetDifficultyIcons() diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index fe41cadcd0..3be363f521 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -116,9 +116,9 @@ namespace osu.Game.Overlays }, }; - Filter.Search.Current.ValueChanged += e => + Filter.Search.Current.ValueChanged += text => { - if (e.NewValue != string.Empty) + if (text.NewValue != string.Empty) { Header.Tabs.Current.Value = DirectTab.Search; @@ -133,13 +133,13 @@ namespace osu.Game.Overlays Filter.Tabs.Current.Value = DirectSortCriteria.Ranked; } }; - ((FilterControl)Filter).Ruleset.ValueChanged += e => Scheduler.AddOnce(updateSearch); - Filter.DisplayStyleControl.DisplayStyle.ValueChanged += e => recreatePanels(e.NewValue); - Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += e => Scheduler.AddOnce(updateSearch); + ((FilterControl)Filter).Ruleset.ValueChanged += _ => Scheduler.AddOnce(updateSearch); + Filter.DisplayStyleControl.DisplayStyle.ValueChanged += style => recreatePanels(style.NewValue); + Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch); - Header.Tabs.Current.ValueChanged += e => + Header.Tabs.Current.ValueChanged += tab => { - if (e.NewValue != DirectTab.Search) + if (tab.NewValue != DirectTab.Search) { currentQuery.Value = string.Empty; Filter.Tabs.Current.Value = (DirectSortCriteria)Header.Tabs.Current.Value; @@ -147,11 +147,11 @@ namespace osu.Game.Overlays } }; - currentQuery.ValueChanged += e => + currentQuery.ValueChanged += text => { queryChangedDebounce?.Cancel(); - if (string.IsNullOrEmpty(e.NewValue)) + if (string.IsNullOrEmpty(text.NewValue)) Scheduler.AddOnce(updateSearch); else { @@ -164,9 +164,9 @@ namespace osu.Game.Overlays currentQuery.BindTo(Filter.Search.Current); - Filter.Tabs.Current.ValueChanged += e => + Filter.Tabs.Current.ValueChanged += tab => { - if (Header.Tabs.Current.Value != DirectTab.Search && e.NewValue != (DirectSortCriteria)Header.Tabs.Current.Value) + if (Header.Tabs.Current.Value != DirectTab.Search && tab.NewValue != (DirectSortCriteria)Header.Tabs.Current.Value) Header.Tabs.Current.Value = DirectTab.Search; Scheduler.AddOnce(updateSearch); diff --git a/osu.Game/Overlays/HoldToConfirmOverlay.cs b/osu.Game/Overlays/HoldToConfirmOverlay.cs index 1497658a54..154aff605a 100644 --- a/osu.Game/Overlays/HoldToConfirmOverlay.cs +++ b/osu.Game/Overlays/HoldToConfirmOverlay.cs @@ -33,7 +33,7 @@ namespace osu.Game.Overlays } }; - Progress.ValueChanged += e => overlay.Alpha = (float)e.NewValue; + Progress.ValueChanged += p => overlay.Alpha = (float)p.NewValue; } } } diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 09c2d32832..156e901c01 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -63,10 +63,10 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu } }; - this.user.ValueChanged += e => + this.user.ValueChanged += u => { - total.Count = e.NewValue?.Kudosu.Total ?? 0; - avaliable.Count = e.NewValue?.Kudosu.Available ?? 0; + total.Count = u.NewValue?.Kudosu.Total ?? 0; + avaliable.Count = u.NewValue?.Kudosu.Available ?? 0; }; } diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 3591664be1..78d1c0f862 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -152,9 +152,9 @@ namespace osu.Game.Overlays.Settings.Sections.General panel.Status.BindTo(api.LocalUser.Value.Status); - dropdown.Current.ValueChanged += e => + dropdown.Current.ValueChanged += action => { - switch (e.NewValue) + switch (action.NewValue) { case UserAction.Online: api.LocalUser.Value.Status.Value = new UserStatusOnline(); diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 6a4e7020ea..a4902a108a 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -159,7 +159,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics /// A bindable which will propagate updates with a delay. private void bindPreviewEvent(Bindable bindable) { - bindable.ValueChanged += e => + bindable.ValueChanged += _ => { switch (scalingMode.Value) { diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 8a8d51b6b6..4f2f3dfd1a 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -56,19 +56,19 @@ namespace osu.Game.Overlays.Settings.Sections.Input }, }; - rawInputToggle.ValueChanged += e => + rawInputToggle.ValueChanged += enabled => { // this is temporary until we support per-handler settings. const string raw_mouse_handler = @"OsuTKRawMouseHandler"; const string standard_mouse_handler = @"OsuTKMouseHandler"; - ignoredInputHandler.Value = e.NewValue ? standard_mouse_handler : raw_mouse_handler; + ignoredInputHandler.Value = enabled.NewValue ? standard_mouse_handler : raw_mouse_handler; }; ignoredInputHandler = config.GetBindable(FrameworkSetting.IgnoredInputHandlers); - ignoredInputHandler.ValueChanged += e => + ignoredInputHandler.ValueChanged += handler => { - bool raw = !e.NewValue.Contains("Raw"); + bool raw = !handler.NewValue.Contains("Raw"); rawInputToggle.Value = raw; sensitivity.Bindable.Disabled = !raw; }; diff --git a/osu.Game/Overlays/SettingsOverlay.cs b/osu.Game/Overlays/SettingsOverlay.cs index 371a0b77da..174d3a3de1 100644 --- a/osu.Game/Overlays/SettingsOverlay.cs +++ b/osu.Game/Overlays/SettingsOverlay.cs @@ -104,15 +104,15 @@ namespace osu.Game.Overlays { AddInternal(Sidebar = new Sidebar { Width = sidebar_width }); - SectionsContainer.SelectedSection.ValueChanged += e => + SectionsContainer.SelectedSection.ValueChanged += section => { selectedSidebarButton.Selected = false; - selectedSidebarButton = Sidebar.Children.Single(b => b.Section == e.NewValue); + selectedSidebarButton = Sidebar.Children.Single(b => b.Section == section.NewValue); selectedSidebarButton.Selected = true; }; } - searchTextBox.Current.ValueChanged += e => SectionsContainer.SearchContainer.SearchTerm = e.NewValue; + searchTextBox.Current.ValueChanged += term => SectionsContainer.SearchContainer.SearchTerm = term.NewValue; CreateSections()?.ForEach(AddSection); } diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 48b18f26cc..9ee255819a 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -55,9 +55,9 @@ namespace osu.Game.Overlays Add(loading = new LoadingAnimation()); - Filter.Search.Current.ValueChanged += e => + Filter.Search.Current.ValueChanged += text => { - if (!string.IsNullOrEmpty(e.NewValue)) + if (!string.IsNullOrEmpty(text.NewValue)) { // force searching in players until searching for friends is supported Header.Tabs.Current.Value = SocialTab.AllPlayers; @@ -71,14 +71,14 @@ namespace osu.Game.Overlays Filter.Tabs.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch); - Filter.DisplayStyleControl.DisplayStyle.ValueChanged += e => recreatePanels(e.NewValue); - Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += e => Scheduler.AddOnce(updateSearch); + Filter.DisplayStyleControl.DisplayStyle.ValueChanged += style => recreatePanels(style.NewValue); + Filter.DisplayStyleControl.Dropdown.Current.ValueChanged += _ => Scheduler.AddOnce(updateSearch); - currentQuery.ValueChanged += e => + currentQuery.ValueChanged += query => { queryChangedDebounce?.Cancel(); - if (string.IsNullOrEmpty(e.NewValue)) + if (string.IsNullOrEmpty(query.NewValue)) Scheduler.AddOnce(updateSearch); else queryChangedDebounce = Scheduler.AddDelayed(updateSearch, 500); diff --git a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs index fa06e134d2..c661d74ae0 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs @@ -45,13 +45,13 @@ namespace osu.Game.Overlays.Toolbar if (notificationOverlay != null) NotificationCount.BindTo(notificationOverlay.UnreadCount); - NotificationCount.ValueChanged += e => + NotificationCount.ValueChanged += count => { - if (e.NewValue == 0) + if (count.NewValue == 0) countDisplay.FadeOut(200, Easing.OutQuint); else { - countDisplay.Count = e.NewValue; + countDisplay.Count = count.NewValue; countDisplay.FadeIn(200, Easing.OutQuint); } }; diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 20c37e50cb..80ed6128b8 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -126,16 +126,16 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.Both } }); - sectionsContainer.SelectedSection.ValueChanged += e => + sectionsContainer.SelectedSection.ValueChanged += section => { - if (lastSection != e.NewValue) + if (lastSection != section.NewValue) { - lastSection = e.NewValue; + lastSection = section.NewValue; tabs.Current.Value = lastSection; } }; - tabs.Current.ValueChanged += e => + tabs.Current.ValueChanged += section => { if (lastSection == null) { @@ -144,9 +144,9 @@ namespace osu.Game.Overlays tabs.Current.Value = lastSection; return; } - if (lastSection != e.NewValue) + if (lastSection != section.NewValue) { - lastSection = e.NewValue; + lastSection = section.NewValue; sectionsContainer.ScrollTo(lastSection); } }; diff --git a/osu.Game/Overlays/Volume/MuteButton.cs b/osu.Game/Overlays/Volume/MuteButton.cs index d84d852427..6061ead2da 100644 --- a/osu.Game/Overlays/Volume/MuteButton.cs +++ b/osu.Game/Overlays/Volume/MuteButton.cs @@ -69,10 +69,10 @@ namespace osu.Game.Overlays.Volume } }); - Current.ValueChanged += e => + Current.ValueChanged += muted => { - icon.Icon = e.NewValue ? FontAwesome.fa_volume_off : FontAwesome.fa_volume_up; - icon.Margin = new MarginPadding { Left = e.NewValue ? width / 2 - 15 : width / 2 - 10 }; //Magic numbers to line up both icons because they're different widths + icon.Icon = muted.NewValue ? FontAwesome.fa_volume_off : FontAwesome.fa_volume_up; + icon.Margin = new MarginPadding { Left = muted.NewValue ? width / 2 - 15 : width / 2 - 10 }; //Magic numbers to line up both icons because they're different widths }; Current.TriggerChange(); } diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index b4e86363ad..79d630a261 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -175,10 +175,10 @@ namespace osu.Game.Overlays.Volume } } }; - Bindable.ValueChanged += e => + Bindable.ValueChanged += volume => { this.TransformTo("DisplayVolume", - e.NewValue, + volume.NewValue, 400, Easing.OutQuint); }; diff --git a/osu.Game/Overlays/VolumeOverlay.cs b/osu.Game/Overlays/VolumeOverlay.cs index ffb56829a3..e2e480ef53 100644 --- a/osu.Game/Overlays/VolumeOverlay.cs +++ b/osu.Game/Overlays/VolumeOverlay.cs @@ -74,9 +74,9 @@ namespace osu.Game.Overlays volumeMeterEffect.Bindable.BindTo(audio.VolumeSample); volumeMeterMusic.Bindable.BindTo(audio.VolumeTrack); - muteButton.Current.ValueChanged += e => + muteButton.Current.ValueChanged += muted => { - if (e.NewValue) + if (muted.NewValue) audio.AddAdjustment(AdjustableProperty.Volume, muteAdjustment); else audio.RemoveAdjustment(AdjustableProperty.Volume, muteAdjustment); diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index f231033935..fa45f7b60b 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -124,14 +124,14 @@ namespace osu.Game.Rulesets.Objects.Drawables { base.LoadComplete(); - State.ValueChanged += e => + State.ValueChanged += armed => { - UpdateState(e.NewValue); + UpdateState(armed.NewValue); // apply any custom state overrides - ApplyCustomUpdateState?.Invoke(this, e.NewValue); + ApplyCustomUpdateState?.Invoke(this, armed.NewValue); - if (e.NewValue == ArmedState.Hit) + if (armed.NewValue == ArmedState.Hit) PlaySamples(); }; diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index 99f10a3710..1c29cf4e2b 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -94,12 +94,12 @@ namespace osu.Game.Rulesets.UI Ruleset = ruleset; playfield = new Lazy(CreatePlayfield); - IsPaused.ValueChanged += e => + IsPaused.ValueChanged += paused => { if (HasReplayLoaded.Value) return; - KeyBindingInputManager.UseParentInput = !e.NewValue; + KeyBindingInputManager.UseParentInput = !paused.NewValue; }; Cursor = CreateCursor(); diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index fa4bcc8eb2..d2a5972cb5 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -61,7 +61,7 @@ namespace osu.Game.Screens.Edit.Components } }; - tabs.Current.ValueChanged += e => Beatmap.Value.Track.Tempo.Value = e.NewValue; + tabs.Current.ValueChanged += tempo => Beatmap.Value.Track.Tempo.Value = tempo.NewValue; } protected override bool OnKeyDown(KeyDownEvent e) diff --git a/osu.Game/Screens/Edit/Components/RadioButtons/DrawableRadioButton.cs b/osu.Game/Screens/Edit/Components/RadioButtons/DrawableRadioButton.cs index 5ed7db6294..1ad69afe91 100644 --- a/osu.Game/Screens/Edit/Components/RadioButtons/DrawableRadioButton.cs +++ b/osu.Game/Screens/Edit/Components/RadioButtons/DrawableRadioButton.cs @@ -80,10 +80,10 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons { base.LoadComplete(); - button.Selected.ValueChanged += e => + button.Selected.ValueChanged += selected => { updateSelectionState(); - if (e.NewValue) + if (selected.NewValue) Selected?.Invoke(button); }; diff --git a/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs b/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs index 81aba84243..c6ecdde7f6 100644 --- a/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs +++ b/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs @@ -44,9 +44,9 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons private RadioButton currentlySelected; private void addButton(RadioButton button) { - button.Selected.ValueChanged += e => + button.Selected.ValueChanged += selected => { - if (e.NewValue) + if (selected.NewValue) { currentlySelected?.Deselect(); currentlySelected = button; diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs index ebe3b1a07e..26d9614631 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/TimelinePart.cs @@ -24,10 +24,10 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts { AddInternal(timeline = new Container { RelativeSizeAxes = Axes.Both }); - Beatmap.ValueChanged += e => + Beatmap.ValueChanged += b => { updateRelativeChildSize(); - LoadBeatmap(e.NewValue); + LoadBeatmap(b.NewValue); }; } diff --git a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs index 59947d63e6..c584f10ecd 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BeatDivisorControl.cs @@ -157,12 +157,8 @@ namespace osu.Game.Screens.Edit.Compose.Components protected override void LoadComplete() { base.LoadComplete(); - - beatDivisor.ValueChanged += e => updateText(); - updateText(); + beatDivisor.BindValueChanged(val => Text = $"1/{val.NewValue}", true); } - - private void updateText() => Text = $"1/{beatDivisor.Value}"; } private class DivisorButton : IconButton @@ -219,9 +215,9 @@ namespace osu.Game.Screens.Edit.Compose.Components AddInternal(marker = new Marker()); - CurrentNumber.ValueChanged += e => + CurrentNumber.ValueChanged += div => { - marker.MoveToX(getMappedPosition(e.NewValue), 100, Easing.OutQuint); + marker.MoveToX(getMappedPosition(div.NewValue), 100, Easing.OutQuint); marker.Flash(); }; } diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index c6ed5749fd..a84784fc29 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -49,7 +49,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline // We don't want the centre marker to scroll AddInternal(new CentreMarker()); - WaveformVisible.ValueChanged += e => waveform.FadeTo(e.NewValue ? 1 : 0, 200, Easing.OutQuint); + WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint); Beatmap.BindTo(beatmap); Beatmap.BindValueChanged(e => diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 0b3b16ffca..2669bb9342 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -117,7 +117,7 @@ namespace osu.Game.Screens.Menu [BackgroundDependencyLoader(true)] private void load(AudioManager audio, IdleTracker idleTracker) { - isIdle.ValueChanged += e => updateIdleState(e.NewValue); + isIdle.ValueChanged += idle => updateIdleState(idle.NewValue); if (idleTracker != null) isIdle.BindTo(idleTracker.IsIdle); diff --git a/osu.Game/Screens/Multi/Header.cs b/osu.Game/Screens/Multi/Header.cs index 015892fa74..7467277b37 100644 --- a/osu.Game/Screens/Multi/Header.cs +++ b/osu.Game/Screens/Multi/Header.cs @@ -85,10 +85,10 @@ namespace osu.Game.Screens.Multi }, }; - breadcrumbs.Current.ValueChanged += e => + breadcrumbs.Current.ValueChanged += scren => { - if (e.NewValue is IMultiplayerSubScreen mpScreen) - screenType.Text = mpScreen.ShortTitle.ToLowerInvariant(); + if (scren.NewValue is IMultiplayerSubScreen multiScreen) + screenType.Text = multiScreen.ShortTitle.ToLowerInvariant(); }; breadcrumbs.Current.TriggerChange(); diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index 7395736035..10eaba1c71 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -176,7 +176,7 @@ namespace osu.Game.Screens.Play } }; - button.Selected.ValueChanged += e => buttonSelectionChanged(button, e.NewValue); + button.Selected.ValueChanged += selected => buttonSelectionChanged(button, selected.NewValue); InternalButtons.Add(button); } @@ -191,6 +191,7 @@ namespace osu.Game.Screens.Play if (_selectionIndex == value) return; + // Deselect the previously-selected button if (_selectionIndex != -1) InternalButtons[_selectionIndex].Selected.Value = false; diff --git a/osu.Game/Screens/Play/HUD/ComboCounter.cs b/osu.Game/Screens/Play/HUD/ComboCounter.cs index 8ab1d898d4..92669355ef 100644 --- a/osu.Game/Screens/Play/HUD/ComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboCounter.cs @@ -63,7 +63,7 @@ namespace osu.Game.Screens.Play.HUD TextSize = 80; - Current.ValueChanged += e => updateCount(e.NewValue == 0); + Current.ValueChanged += combo => updateCount(combo.NewValue == 0); } protected override void LoadComplete() diff --git a/osu.Game/Screens/Play/HUD/HealthDisplay.cs b/osu.Game/Screens/Play/HUD/HealthDisplay.cs index 77a9e5d082..acd8656fb2 100644 --- a/osu.Game/Screens/Play/HUD/HealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/HealthDisplay.cs @@ -16,7 +16,7 @@ namespace osu.Game.Screens.Play.HUD protected HealthDisplay() { - Current.ValueChanged += e => SetHealth((float)e.NewValue); + Current.ValueChanged += health => SetHealth((float)health.NewValue); } protected abstract void SetHealth(float value); diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs index 5692508b32..f3fadde4e8 100644 --- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs +++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs @@ -163,7 +163,7 @@ namespace osu.Game.Screens.Play.HUD private void bind() { circularProgress.Current.BindTo(Progress); - Progress.ValueChanged += e => icon.Scale = new Vector2(1 + (float)e.NewValue * 0.2f); + Progress.ValueChanged += progress => icon.Scale = new Vector2(1 + (float)progress.NewValue * 0.2f); } private bool pendingAnimation; diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 619b817577..600ef996ed 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -65,10 +65,10 @@ namespace osu.Game.Screens.Play.HUD } }; - Current.ValueChanged += e => + Current.ValueChanged += mods => { iconsContainer.Clear(); - foreach (Mod mod in e.NewValue) + foreach (Mod mod in mods.NewValue) { iconsContainer.Add(new ModIcon(mod) { Scale = new Vector2(0.6f) }); } diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index e9ae1d5829..b5f04c3474 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -104,7 +104,7 @@ namespace osu.Game.Screens.Play private void load(OsuConfigManager config, NotificationOverlay notificationOverlay) { showHud = config.GetBindable(OsuSetting.ShowInterface); - showHud.ValueChanged += e => visibilityContainer.FadeTo(e.NewValue ? 1 : 0, duration); + showHud.ValueChanged += visible => visibilityContainer.FadeTo(visible.NewValue ? 1 : 0, duration); showHud.TriggerChange(); if (!showHud.Value && !hasShownNotificationOnce) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 0a741d699d..9198d1a646 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -159,7 +159,7 @@ namespace osu.Game.Screens.Play // the final usable gameplay clock with user-set offsets applied. var offsetClock = new FramedOffsetClock(platformOffsetClock); - userAudioOffset.ValueChanged += e => offsetClock.Offset = e.NewValue; + userAudioOffset.ValueChanged += offset => offsetClock.Offset = offset.NewValue; userAudioOffset.TriggerChange(); ScoreProcessor = RulesetContainer.CreateScoreProcessor(); diff --git a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs index faffa0cd97..bd54b7fba3 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs @@ -17,7 +17,7 @@ namespace osu.Game.Screens.Play.PlayerSettings public IAdjustableClock AdjustableClock { set; get; } - private readonly PlayerSliderBar sliderbar; + private readonly PlayerSliderBar rateSlider; private readonly OsuSpriteText multiplierText; @@ -46,7 +46,7 @@ namespace osu.Game.Screens.Play.PlayerSettings } }, }, - sliderbar = new PlayerSliderBar + rateSlider = new PlayerSliderBar { Bindable = new BindableDouble(1) { @@ -69,9 +69,9 @@ namespace osu.Game.Screens.Play.PlayerSettings var clockRate = AdjustableClock.Rate; // can't trigger this line instantly as the underlying clock may not be ready to accept adjustments yet. - sliderbar.Bindable.ValueChanged += e => AdjustableClock.Rate = clockRate * e.NewValue; + rateSlider.Bindable.ValueChanged += multiplier => AdjustableClock.Rate = clockRate * multiplier.NewValue; - sliderbar.Bindable.BindValueChanged(multiplier => multiplierText.Text = $"{multiplier:0.0}x", true); + rateSlider.Bindable.BindValueChanged(multiplier => multiplierText.Text = $"{multiplier:0.0}x", true); } } } diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 616e785d7d..443df27b42 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -104,7 +104,7 @@ namespace osu.Game.Screens.Play { State = Visibility.Visible; - replayLoaded.ValueChanged += e => AllowSeeking = e.NewValue; + replayLoaded.ValueChanged += loaded => AllowSeeking = loaded.NewValue; replayLoaded.TriggerChange(); } diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index b34035fb35..4490818a23 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -130,7 +130,7 @@ namespace osu.Game.Screens.Select config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm); config.BindWith(OsuSetting.SongSelectRightMouseScroll, RightClickScrollingEnabled); - RightClickScrollingEnabled.ValueChanged += e => RightMouseScrollbar = e.NewValue; + RightClickScrollingEnabled.ValueChanged += enabled => RightMouseScrollbar = enabled.NewValue; RightClickScrollingEnabled.TriggerChange(); } @@ -509,9 +509,9 @@ namespace osu.Game.Screens.Select foreach (var c in set.Beatmaps) { - c.State.ValueChanged += e => + c.State.ValueChanged += state => { - if (e.NewValue == CarouselItemState.Selected) + if (state.NewValue == CarouselItemState.Selected) { selectedBeatmapSet = set; SelectionChanged?.Invoke(c.Beatmap); diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index 3400befbb9..f66cd2b29a 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -69,8 +69,8 @@ namespace osu.Game.Screens.Select }, }; - tabs.Current.ValueChanged += e => invokeOnFilter(); - modsCheckbox.Current.ValueChanged += e => invokeOnFilter(); + tabs.Current.ValueChanged += _ => invokeOnFilter(); + modsCheckbox.Current.ValueChanged += _ => invokeOnFilter(); } } diff --git a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs index e584872a2f..edb9d79ddb 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs @@ -49,7 +49,7 @@ namespace osu.Game.Screens.Select.Carousel public virtual void AddChild(CarouselItem i) { - i.State.ValueChanged += e => ChildItemStateChanged(i, e.NewValue); + i.State.ValueChanged += state => ChildItemStateChanged(i, state.NewValue); i.ChildID = ++currentChildID; InternalChildren.Add(i); } @@ -58,9 +58,9 @@ namespace osu.Game.Screens.Select.Carousel { if (items != null) InternalChildren = items; - State.ValueChanged += e => + State.ValueChanged += state => { - switch (e.NewValue) + switch (state.NewValue) { case CarouselItemState.Collapsed: case CarouselItemState.NotSelected: diff --git a/osu.Game/Screens/Select/Carousel/CarouselGroupEagerSelect.cs b/osu.Game/Screens/Select/Carousel/CarouselGroupEagerSelect.cs index b4007573ae..67e8282b76 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselGroupEagerSelect.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselGroupEagerSelect.cs @@ -13,9 +13,9 @@ namespace osu.Game.Screens.Select.Carousel { public CarouselGroupEagerSelect() { - State.ValueChanged += e => + State.ValueChanged += state => { - if (e.NewValue == CarouselItemState.Selected) + if (state.NewValue == CarouselItemState.Selected) attemptSelection(); }; } diff --git a/osu.Game/Screens/Select/Carousel/CarouselItem.cs b/osu.Game/Screens/Select/Carousel/CarouselItem.cs index 461eb26603..a0f5969b3c 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselItem.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselItem.cs @@ -37,9 +37,9 @@ namespace osu.Game.Screens.Select.Carousel { DrawableRepresentation = new Lazy(CreateDrawableRepresentation); - Filtered.ValueChanged += e => + Filtered.ValueChanged += filtered => { - if (e.NewValue && State.Value == CarouselItemState.Selected) + if (filtered.NewValue && State.Value == CarouselItemState.Selected) State.Value = CarouselItemState.NotSelected; }; } diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index f27cfc43f4..fcc9745afb 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -189,7 +189,7 @@ namespace osu.Game.Screens.Select.Carousel : base(item.Beatmap) { filtered.BindTo(item.Filtered); - filtered.ValueChanged += e => Schedule(() => this.FadeTo(e.NewValue ? 0.1f : 1, 100)); + filtered.ValueChanged += isFiltered => Schedule(() => this.FadeTo(isFiltered.NewValue ? 0.1f : 1, 100)); filtered.TriggerChange(); } } diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 547da9c1d8..72a15e37e1 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -146,12 +146,12 @@ namespace osu.Game.Screens.Select } }; - searchTextBox.Current.ValueChanged += e => FilterChanged?.Invoke(CreateCriteria()); + searchTextBox.Current.ValueChanged += _ => FilterChanged?.Invoke(CreateCriteria()); groupTabs.PinItem(GroupMode.All); groupTabs.PinItem(GroupMode.RecentlyPlayed); - groupTabs.Current.ValueChanged += e => Group = e.NewValue; - sortTabs.Current.ValueChanged += e => Sort = e.NewValue; + groupTabs.Current.ValueChanged += group => Group = group.NewValue; + sortTabs.Current.ValueChanged += sort => Sort = sort.NewValue; } public void Deactivate() @@ -178,7 +178,7 @@ namespace osu.Game.Screens.Select sortTabs.AccentColour = colours.GreenLight; showConverted = config.GetBindable(OsuSetting.ShowConvertedBeatmaps); - showConverted.ValueChanged += e => updateCriteria(); + showConverted.ValueChanged += _ => updateCriteria(); ruleset.BindTo(parentRuleset); ruleset.BindValueChanged(_ => updateCriteria(), true); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index f0c1e04450..60fcbc9271 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -598,9 +598,9 @@ namespace osu.Game.Screens.Select { // manual binding to parent ruleset to allow for delayed load in the incoming direction. rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value; - Ruleset.ValueChanged += e => updateSelectedRuleset(e.NewValue); + Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue); - decoupledRuleset.ValueChanged += e => Ruleset.Value = e.NewValue; + decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue; decoupledRuleset.DisabledChanged += r => Ruleset.Disabled = r; Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true); diff --git a/osu.Game/Skinning/SkinManager.cs b/osu.Game/Skinning/SkinManager.cs index 403e0423b0..f6bbbc8355 100644 --- a/osu.Game/Skinning/SkinManager.cs +++ b/osu.Game/Skinning/SkinManager.cs @@ -42,10 +42,10 @@ namespace osu.Game.Skinning CurrentSkinInfo.Value = SkinInfo.Default; }; - CurrentSkinInfo.ValueChanged += e => CurrentSkin.Value = getSkin(e.NewValue); - CurrentSkin.ValueChanged += e => + CurrentSkinInfo.ValueChanged += skin => CurrentSkin.Value = getSkin(skin.NewValue); + CurrentSkin.ValueChanged += skin => { - if (e.NewValue.SkinInfo != CurrentSkinInfo.Value) + if (skin.NewValue.SkinInfo != CurrentSkinInfo.Value) throw new InvalidOperationException($"Setting {nameof(CurrentSkin)}'s value directly is not supported. Use {nameof(CurrentSkinInfo)} instead."); SourceChanged?.Invoke(); diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 9cade85608..a156b6cbae 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -191,8 +191,8 @@ namespace osu.Game.Users }); } - Status.ValueChanged += e => displayStatus(e.NewValue); - Status.ValueChanged += e => statusBg.FadeColour(e.NewValue?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint); + Status.ValueChanged += status => displayStatus(status.NewValue); + Status.ValueChanged += status => statusBg.FadeColour(status.NewValue?.GetAppropriateColour(colours) ?? colours.Gray5, 500, Easing.OutQuint); base.Action = ViewProfile = () => { From 0431582959253916234200b5a6993cdbeea5dadf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Feb 2019 17:57:49 +0900 Subject: [PATCH 148/327] Remove excess new line --- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index 10eaba1c71..1f544fd6b9 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -191,7 +191,6 @@ namespace osu.Game.Screens.Play if (_selectionIndex == value) return; - // Deselect the previously-selected button if (_selectionIndex != -1) InternalButtons[_selectionIndex].Selected.Value = false; From a4162a69fb89e7713c65692bb968aadadd1f2620 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Feb 2019 18:01:50 +0900 Subject: [PATCH 149/327] Remove leftover usage of dimlevel in BackgroundScreenBeatmap --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 10 +++++++++- .../Screens/Backgrounds/BackgroundScreenBeatmap.cs | 8 -------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 9871209760..bbffb910d5 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -301,9 +301,17 @@ namespace osu.Game.Tests.Visual private class FadeAccessibleBackground : BackgroundScreenBeatmap { + private Bindable dimLevel; + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + dimLevel = config.GetBindable(OsuSetting.DimLevel); + } + public bool AssertDimmed() { - return FadeContainer.Colour == OsuColour.Gray(1 - (float)DimLevel); + return FadeContainer.Colour == OsuColour.Gray(1 - dimLevel); } public bool AssertUndimmed() diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index c793197f19..8aa3ef620c 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -6,7 +6,6 @@ using osu.Framework.Configuration; using osu.Framework.Graphics; using osu.Framework.Graphics.Textures; using osu.Game.Beatmaps; -using osu.Game.Configuration; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; @@ -15,18 +14,11 @@ namespace osu.Game.Screens.Backgrounds public class BackgroundScreenBeatmap : BlurrableBackgroundScreen { private WorkingBeatmap beatmap; - protected Bindable DimLevel = new Bindable(); public Bindable EnableUserDim = new Bindable(); public Bindable StoryboardReplacesBackground = new Bindable(); protected UserDimContainer FadeContainer; - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - config.BindWith(OsuSetting.DimLevel, DimLevel); - } - public virtual WorkingBeatmap Beatmap { get { return beatmap; } From d61dfe888e8d2533ba063d8666e4b9805e5cbec0 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 22 Feb 2019 19:42:09 +0900 Subject: [PATCH 150/327] Fix venera fonts not being correctly specified --- osu.Desktop/Overlays/VersionManager.cs | 2 +- osu.Desktop/Program.cs | 2 +- .../Objects/Drawables/Pieces/NumberPiece.cs | 2 +- .../Objects/Drawables/Pieces/SpinnerSpmCounter.cs | 4 ++-- osu.Game/Graphics/OsuFont.cs | 2 ++ osu.Game/Graphics/UserInterface/RollingCounter.cs | 2 +- osu.Game/Online/Leaderboards/LeaderboardScore.cs | 2 +- osu.Game/OsuGame.cs | 2 +- osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs | 2 +- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 2 +- osu.Game/Overlays/Volume/VolumeMeter.cs | 2 +- osu.Game/Rulesets/Judgements/DrawableJudgement.cs | 2 +- osu.Game/Screens/Play/Break/RemainingTimeCounter.cs | 2 +- osu.Game/Screens/Play/HUD/ModDisplay.cs | 2 +- osu.Game/Screens/Play/KeyCounter.cs | 2 +- osu.Game/Screens/Play/SongProgressInfo.cs | 6 +++--- 16 files changed, 20 insertions(+), 18 deletions(-) diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index b1677f6117..b8a0e337b6 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -74,7 +74,7 @@ namespace osu.Desktop.Overlays { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, - Font = OsuFont.GetFont(Typeface.Venera, 12), + Font = OsuFont.Numeric.With(size: 12), Colour = colours.Yellow, Text = @"Development Build" }, diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index ff9972ac48..d1ee799462 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -26,7 +26,7 @@ namespace osu.Desktop { host.ExceptionThrown += handleException; - if (!host.IsPrimaryInstance) + if (false) { var importer = new ArchiveImportIPCChannel(host); // Restore the cwd so relative paths given at the command line work correctly diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs index 4a71d0c61b..813cd51593 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs @@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces }, s => s.GetTexture("Play/osu/hitcircle") == null), number = new SkinnableSpriteText("Play/osu/number-text", _ => new OsuSpriteText { - Font = OsuFont.GetFont(Typeface.Venera, 40), + Font = OsuFont.Numeric.With(size: 40), UseFullGlyphHeight = false, }, restrictSize: false) { diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs index bc9396dd0c..19f85bf4c3 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs @@ -24,14 +24,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = @"0", - Font = OsuFont.GetFont(Typeface.Venera, 24), + Font = OsuFont.Numeric.With(size: 24) }, new OsuSpriteText { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, Text = @"SPINS PER MINUTE", - Font = OsuFont.GetFont(Typeface.Venera, 12), + Font = OsuFont.Numeric.With(size: 12), Y = 30 } }; diff --git a/osu.Game/Graphics/OsuFont.cs b/osu.Game/Graphics/OsuFont.cs index b84236187c..dc660fd159 100644 --- a/osu.Game/Graphics/OsuFont.cs +++ b/osu.Game/Graphics/OsuFont.cs @@ -17,6 +17,8 @@ namespace osu.Game.Graphics /// public static FontUsage Default => GetFont(); + public static FontUsage Numeric => GetFont(Typeface.Venera, weight: FontWeight.Regular); + /// /// Retrieves a . /// diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index f77c9ec083..52cd69a76e 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -81,7 +81,7 @@ namespace osu.Game.Graphics.UserInterface { Children = new Drawable[] { - DisplayedCountSpriteText = new OsuSpriteText { Font = OsuFont.GetFont(Typeface.Venera) } + DisplayedCountSpriteText = new OsuSpriteText { Font = OsuFont.Numeric } }; TextSize = 40; diff --git a/osu.Game/Online/Leaderboards/LeaderboardScore.cs b/osu.Game/Online/Leaderboards/LeaderboardScore.cs index 73c01dfde7..34981bf849 100644 --- a/osu.Game/Online/Leaderboards/LeaderboardScore.cs +++ b/osu.Game/Online/Leaderboards/LeaderboardScore.cs @@ -185,7 +185,7 @@ namespace osu.Game.Online.Leaderboards Spacing = new Vector2(5f, 0f), Children = new Drawable[] { - scoreLabel = new GlowingSpriteText(score.TotalScore.ToString(@"N0"), OsuFont.GetFont(Typeface.Venera, 23), Color4.White, OsuColour.FromHex(@"83ccfa")), + scoreLabel = new GlowingSpriteText(score.TotalScore.ToString(@"N0"), OsuFont.Numeric.With(size: 23), Color4.White, OsuColour.FromHex(@"83ccfa")), RankContainer = new Container { Size = new Vector2(40f, 20f), diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 883cac4f7a..1322d1b73c 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -150,7 +150,7 @@ namespace osu.Game ScoreManager.ItemAdded += (score, _, silent) => Schedule(() => LoadScore(score, silent)); - if (!Host.IsPrimaryInstance) + if (false) { Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error); Environment.Exit(0); diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs index 5e686ccb68..c6c8315aeb 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableScore.cs @@ -87,7 +87,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores Anchor = Anchor.CentreLeft, Origin = Anchor.CentreRight, Text = $@"{score.TotalScore:N0}", - Font = OsuFont.GetFont(Typeface.Venera, fixedWidth: true), + Font = OsuFont.Numeric.With(fixedWidth: true), RelativePositionAxes = Axes.X, X = 0.75f, }, diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index 6bdaff19ee..8a8ad0d964 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -349,7 +349,7 @@ namespace osu.Game.Overlays.KeyBinding }, Text = new OsuSpriteText { - Font = OsuFont.GetFont(Typeface.Venera, 10), + Font = OsuFont.Numeric.With(size: 10), Margin = new MarginPadding(5), Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Overlays/Volume/VolumeMeter.cs b/osu.Game/Overlays/Volume/VolumeMeter.cs index 7814d9dd9d..da696e0fdd 100644 --- a/osu.Game/Overlays/Volume/VolumeMeter.cs +++ b/osu.Game/Overlays/Volume/VolumeMeter.cs @@ -140,7 +140,7 @@ namespace osu.Game.Overlays.Volume { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = OsuFont.GetFont(Typeface.Venera, 0.16f * circleSize) + Font = OsuFont.Numeric.With(size: 0.16f * circleSize) }).WithEffect(new GlowEffect { Colour = Color4.Transparent, diff --git a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs index a53a0698a1..0d6e11c649 100644 --- a/osu.Game/Rulesets/Judgements/DrawableJudgement.cs +++ b/osu.Game/Rulesets/Judgements/DrawableJudgement.cs @@ -58,7 +58,7 @@ namespace osu.Game.Rulesets.Judgements Child = new SkinnableDrawable($"Play/{Result.Type}", _ => JudgementText = new OsuSpriteText { Text = Result.Type.GetDescription().ToUpperInvariant(), - Font = OsuFont.GetFont(Typeface.Venera, 12), + Font = OsuFont.Numeric.With(size: 12), Colour = judgementColour(Result.Type), Scale = new Vector2(0.85f, 1), }, restrictSize: false) diff --git a/osu.Game/Screens/Play/Break/RemainingTimeCounter.cs b/osu.Game/Screens/Play/Break/RemainingTimeCounter.cs index 6fa3e51be8..2f5e43aebf 100644 --- a/osu.Game/Screens/Play/Break/RemainingTimeCounter.cs +++ b/osu.Game/Screens/Play/Break/RemainingTimeCounter.cs @@ -20,7 +20,7 @@ namespace osu.Game.Screens.Play.Break { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Font = OsuFont.GetFont(Typeface.Venera, 33), + Font = OsuFont.Numeric.With(size: 33), }; } diff --git a/osu.Game/Screens/Play/HUD/ModDisplay.cs b/osu.Game/Screens/Play/HUD/ModDisplay.cs index 0d8851f6ec..2c1293833f 100644 --- a/osu.Game/Screens/Play/HUD/ModDisplay.cs +++ b/osu.Game/Screens/Play/HUD/ModDisplay.cs @@ -61,7 +61,7 @@ namespace osu.Game.Screens.Play.HUD Anchor = Anchor.BottomCentre, Origin = Anchor.TopCentre, Text = @"/ UNRANKED /", - Font = OsuFont.GetFont(Typeface.Venera, 12), + Font = OsuFont.Numeric.With(size: 12) } }; diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index b795e03c81..406cd3810e 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -97,7 +97,7 @@ namespace osu.Game.Screens.Play new OsuSpriteText { Text = Name, - Font = OsuFont.GetFont(Typeface.Venera, 12), + Font = OsuFont.Numeric.With(size: 12), Anchor = Anchor.Centre, Origin = Anchor.Centre, RelativePositionAxes = Axes.Both, diff --git a/osu.Game/Screens/Play/SongProgressInfo.cs b/osu.Game/Screens/Play/SongProgressInfo.cs index 4d61d9da73..d24e484001 100644 --- a/osu.Game/Screens/Play/SongProgressInfo.cs +++ b/osu.Game/Screens/Play/SongProgressInfo.cs @@ -42,7 +42,7 @@ namespace osu.Game.Screens.Play Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, Colour = colours.BlueLighter, - Font = OsuFont.GetFont(Typeface.Venera), + Font = OsuFont.Numeric, Margin = new MarginPadding { Left = margin, @@ -53,14 +53,14 @@ namespace osu.Game.Screens.Play Origin = Anchor.BottomCentre, Anchor = Anchor.BottomCentre, Colour = colours.BlueLighter, - Font = OsuFont.GetFont(Typeface.Venera), + Font = OsuFont.Numeric, }, timeLeft = new OsuSpriteText { Origin = Anchor.BottomRight, Anchor = Anchor.BottomRight, Colour = colours.BlueLighter, - Font = OsuFont.GetFont(Typeface.Venera), + Font = OsuFont.Numeric, Margin = new MarginPadding { Right = margin, From a0dae820ee51ef383b9cfd9a2a25afbcaf0db7f4 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 22 Feb 2019 19:49:37 +0900 Subject: [PATCH 151/327] Woops --- osu.Desktop/Program.cs | 2 +- osu.Game/OsuGame.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index d1ee799462..ff9972ac48 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -26,7 +26,7 @@ namespace osu.Desktop { host.ExceptionThrown += handleException; - if (false) + if (!host.IsPrimaryInstance) { var importer = new ArchiveImportIPCChannel(host); // Restore the cwd so relative paths given at the command line work correctly diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 1322d1b73c..883cac4f7a 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -150,7 +150,7 @@ namespace osu.Game ScoreManager.ItemAdded += (score, _, silent) => Schedule(() => LoadScore(score, silent)); - if (false) + if (!Host.IsPrimaryInstance) { Logger.Log(@"osu! does not support multiple running instances.", LoggingTarget.Runtime, LogLevel.Error); Environment.Exit(0); From 367bc53a06bd852f27cbe5ef8838123e56842396 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Feb 2019 20:13:38 +0900 Subject: [PATCH 152/327] Revert some more instances of 'e' variable names --- .../Objects/Drawables/Pieces/NotePiece.cs | 4 ++-- osu.Game.Rulesets.Mania/UI/Column.cs | 8 ++++---- .../UI/Components/ColumnBackground.cs | 4 ++-- .../UI/Components/ColumnHitObjectArea.cs | 4 ++-- .../UI/Components/ColumnKeyArea.cs | 6 +++--- .../UI/ManiaRulesetContainer.cs | 2 +- osu.Game.Rulesets.Mania/UI/ManiaStage.cs | 6 +++--- .../HitCircles/Components/HitCirclePiece.cs | 2 +- .../Sliders/Components/SliderBodyPiece.cs | 2 +- .../Blueprints/Spinners/Components/SpinnerPiece.cs | 2 +- .../Objects/Drawables/DrawableHitCircle.cs | 2 +- .../Objects/Drawables/DrawableSlider.cs | 6 +++--- .../Objects/Drawables/DrawableSpinner.cs | 2 +- osu.Game.Tests/Visual/TestCaseIdleTracker.cs | 2 +- .../Drawables/UpdateableBeatmapBackgroundSprite.cs | 2 +- .../Graphics/UserInterface/OsuAnimatedButton.cs | 2 +- osu.Game/Graphics/UserInterface/OsuSliderBar.cs | 2 +- osu.Game/Online/Chat/ChannelManager.cs | 2 +- osu.Game/OsuGame.cs | 2 +- .../Overlays/BeatmapSet/Buttons/DownloadButton.cs | 4 ++-- osu.Game/Overlays/BeatmapSet/Header.cs | 14 +++++++------- osu.Game/Overlays/Direct/DownloadButton.cs | 2 +- osu.Game/Overlays/Direct/DownloadProgressBar.cs | 4 ++-- .../Overlays/Direct/DownloadTrackingComposite.cs | 8 ++++---- .../Overlays/Settings/Sections/Debug/GCSettings.cs | 4 ++-- .../Settings/Sections/Graphics/LayoutSettings.cs | 12 ++++++------ osu.Game/Overlays/Settings/Sections/SkinSection.cs | 4 ++-- .../Edit/Compose/Components/Timeline/Timeline.cs | 6 +++--- osu.Game/Screens/Multi/Components/BeatmapTitle.cs | 2 +- .../Screens/Multi/Components/BeatmapTypeInfo.cs | 4 ++-- osu.Game/Screens/Multi/Components/ModeTypeInfo.cs | 4 ++-- .../Components/MultiplayerBackgroundSprite.cs | 2 +- .../Screens/Multi/Components/ParticipantCount.cs | 2 +- .../Screens/Multi/Components/RoomStatusInfo.cs | 2 +- .../Multi/Components/StatusColouredContainer.cs | 2 +- .../Multi/Lounge/Components/ParticipantInfo.cs | 2 +- .../Multi/Lounge/Components/RoomInspector.cs | 2 +- osu.Game/Screens/Multi/Match/Components/Header.cs | 4 ++-- .../Screens/Multi/Match/Components/HostInfo.cs | 2 +- osu.Game/Screens/Multi/Match/Components/Info.cs | 6 +++--- .../Multi/Match/Components/MatchLeaderboard.cs | 4 ++-- .../Multi/Match/Components/MatchSettingsOverlay.cs | 12 ++++++------ .../Multi/Match/Components/MatchTabControl.cs | 6 +++--- .../Screens/Multi/Match/Components/Participants.cs | 4 ++-- .../Screens/Multi/Match/Components/ReadyButton.cs | 2 +- .../Multi/Match/Components/ViewBeatmapButton.cs | 2 +- osu.Game/Screens/Multi/Match/MatchSubScreen.cs | 4 ++-- osu.Game/Screens/Multi/Multiplayer.cs | 2 +- osu.Game/Screens/Ranking/Results.cs | 4 ++-- osu.Game/Screens/Select/BeatmapInfoWedge.cs | 4 ++-- 50 files changed, 99 insertions(+), 99 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs index 4f76f83b8f..c5db6d7bd9 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs @@ -49,9 +49,9 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces private void load(IScrollingInfo scrollingInfo) { direction.BindTo(scrollingInfo.Direction); - direction.BindValueChanged(e => + direction.BindValueChanged(dir => { - colouredBox.Anchor = colouredBox.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; + colouredBox.Anchor = colouredBox.Origin = dir.NewValue == ScrollingDirection.Up ? Anchor.TopCentre : Anchor.BottomCentre; }, true); } diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index de24795d11..856ae8af33 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -82,15 +82,15 @@ namespace osu.Game.Rulesets.Mania.UI TopLevelContainer.Add(explosionContainer.CreateProxy()); - Direction.BindValueChanged(e => + Direction.BindValueChanged(dir => { hitTargetContainer.Padding = new MarginPadding { - Top = e.NewValue == ScrollingDirection.Up ? ManiaStage.HIT_TARGET_POSITION : 0, - Bottom = e.NewValue == ScrollingDirection.Down ? ManiaStage.HIT_TARGET_POSITION : 0, + Top = dir.NewValue == ScrollingDirection.Up ? ManiaStage.HIT_TARGET_POSITION : 0, + Bottom = dir.NewValue == ScrollingDirection.Down ? ManiaStage.HIT_TARGET_POSITION : 0, }; - keyArea.Anchor = keyArea.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; + keyArea.Anchor = keyArea.Origin = dir.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; }, true); } diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs index e19ba13c51..b43580e0f3 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs @@ -48,9 +48,9 @@ namespace osu.Game.Rulesets.Mania.UI.Components }; direction.BindTo(scrollingInfo.Direction); - direction.BindValueChanged(e => + direction.BindValueChanged(dir => { - backgroundOverlay.Anchor = backgroundOverlay.Origin = e.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; + backgroundOverlay.Anchor = backgroundOverlay.Origin = dir.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 7a4780e8cc..cd47bb1183 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs @@ -49,9 +49,9 @@ namespace osu.Game.Rulesets.Mania.UI.Components private void load(IScrollingInfo scrollingInfo) { direction.BindTo(scrollingInfo.Direction); - direction.BindValueChanged(e => + direction.BindValueChanged(dir => { - Anchor anchor = e.NewValue == ScrollingDirection.Up ? Anchor.TopLeft : Anchor.BottomLeft; + Anchor anchor = dir.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 3124e62479..b7d8945808 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs @@ -64,11 +64,11 @@ namespace osu.Game.Rulesets.Mania.UI.Components }; direction.BindTo(scrollingInfo.Direction); - direction.BindValueChanged(e => + direction.BindValueChanged(dir => { gradient.Colour = ColourInfo.GradientVertical( - e.NewValue == ScrollingDirection.Up ? Color4.Black : Color4.Black.Opacity(0), - e.NewValue == ScrollingDirection.Up ? Color4.Black.Opacity(0) : Color4.Black); + dir.NewValue == ScrollingDirection.Up ? Color4.Black : Color4.Black.Opacity(0), + dir.NewValue == ScrollingDirection.Up ? Color4.Black.Opacity(0) : Color4.Black); }, true); } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index 4f0181566a..b451e28088 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Mania.UI BarLines.ForEach(Playfield.Add); Config.BindWith(ManiaSetting.ScrollDirection, configDirection); - configDirection.BindValueChanged(e => Direction.Value = (ScrollingDirection)e.NewValue, true); + configDirection.BindValueChanged(direction => Direction.Value = (ScrollingDirection)direction.NewValue, true); Config.BindWith(ManiaSetting.ScrollTime, TimeRange); } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs index 885fe29ccc..a28de7ea58 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaStage.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaStage.cs @@ -136,12 +136,12 @@ namespace osu.Game.Rulesets.Mania.UI AddColumn(column); } - Direction.BindValueChanged(e => + Direction.BindValueChanged(dir => { barLineContainer.Padding = new MarginPadding { - Top = e.NewValue == ScrollingDirection.Up ? HIT_TARGET_POSITION : 0, - Bottom = e.NewValue == ScrollingDirection.Down ? HIT_TARGET_POSITION : 0, + Top = dir.NewValue == ScrollingDirection.Up ? HIT_TARGET_POSITION : 0, + Bottom = dir.NewValue == ScrollingDirection.Down ? HIT_TARGET_POSITION : 0, }; }, true); } diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs index 42ff029126..7f6a60c400 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/HitCircles/Components/HitCirclePiece.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.HitCircles.Components PositionBindable.BindValueChanged(_ => UpdatePosition(), true); StackHeightBindable.BindValueChanged(_ => UpdatePosition()); - ScaleBindable.BindValueChanged(e => Scale = new Vector2(e.NewValue), true); + ScaleBindable.BindValueChanged(scale => Scale = new Vector2(scale.NewValue), true); } protected virtual void UpdatePosition() => Position = hitCircle.StackedPosition; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs index 1bc0c2cfb5..179fa1bc72 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Sliders/Components/SliderBodyPiece.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components body.BorderColour = colours.Yellow; PositionBindable.BindValueChanged(_ => updatePosition(), true); - ScaleBindable.BindValueChanged(e => body.PathWidth = e.NewValue * 64, true); + ScaleBindable.BindValueChanged(scale => body.PathWidth = scale.NewValue * 64, true); } private void updatePosition() => Position = slider.StackedPosition; diff --git a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs index d7c9bcee69..ae94848c81 100644 --- a/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs +++ b/osu.Game.Rulesets.Osu/Edit/Blueprints/Spinners/Components/SpinnerPiece.cs @@ -55,7 +55,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Blueprints.Spinners.Components PositionBindable.BindValueChanged(_ => updatePosition(), true); StackHeightBindable.BindValueChanged(_ => updatePosition()); - ScaleBindable.BindValueChanged(e => ring.Scale = new Vector2(e.NewValue), true); + ScaleBindable.BindValueChanged(scale => ring.Scale = new Vector2(scale.NewValue), true); } private void updatePosition() => Position = spinner.Position; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index e2550b036c..18c28deb9d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -91,7 +91,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables { positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); stackHeightBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); - scaleBindable.BindValueChanged(e => scaleContainer.Scale = new Vector2(e.NewValue), true); + scaleBindable.BindValueChanged(scale => scaleContainer.Scale = new Vector2(scale.NewValue), true); positionBindable.BindTo(HitObject.PositionBindable); stackHeightBindable.BindTo(HitObject.StackHeightBindable); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 0a7562efd6..89521736c7 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -99,10 +99,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables config.BindWith(OsuSetting.SnakingOutSliders, Body.SnakingOut); positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); - scaleBindable.BindValueChanged(e => + scaleBindable.BindValueChanged(scale => { - Body.PathWidth = HitObject.Scale * 64; - Ball.Scale = new Vector2(HitObject.Scale); + Body.PathWidth = scale.NewValue * 64; + Ball.Scale = new Vector2(scale.NewValue); }); positionBindable.BindTo(HitObject.PositionBindable); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 26ba9e7f2b..936023d39d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -130,7 +130,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables circle.Colour = colours.BlueDark; glow.Colour = colours.BlueDark; - positionBindable.BindValueChanged(e => Position = e.NewValue); + positionBindable.BindValueChanged(pos => Position = pos.NewValue); positionBindable.BindTo(HitObject.PositionBindable); } diff --git a/osu.Game.Tests/Visual/TestCaseIdleTracker.cs b/osu.Game.Tests/Visual/TestCaseIdleTracker.cs index 6a102b67b9..8e8c4e38ae 100644 --- a/osu.Game.Tests/Visual/TestCaseIdleTracker.cs +++ b/osu.Game.Tests/Visual/TestCaseIdleTracker.cs @@ -128,7 +128,7 @@ namespace osu.Game.Tests.Visual }, }; - idleTracker.IsIdle.BindValueChanged(e => box.Colour = e.NewValue ? Color4.White : Color4.Black, true); + idleTracker.IsIdle.BindValueChanged(idle => box.Colour = idle.NewValue ? Color4.White : Color4.Black, true); } } } diff --git a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs index 267c54370f..4d07fd234b 100644 --- a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs +++ b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs @@ -20,7 +20,7 @@ namespace osu.Game.Beatmaps.Drawables public UpdateableBeatmapBackgroundSprite() { - Beatmap.BindValueChanged(e => Model = e.NewValue); + Beatmap.BindValueChanged(b => Model = b.NewValue); } protected override Drawable CreateDrawable(BeatmapInfo model) diff --git a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs index 26e1c5a8bb..d64068f74c 100644 --- a/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs +++ b/osu.Game/Graphics/UserInterface/OsuAnimatedButton.cs @@ -73,7 +73,7 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(OsuColour colours) { - Enabled.BindValueChanged(e => this.FadeColour(e.NewValue ? Color4.White : colours.Gray9, 200, Easing.OutQuint), true); + Enabled.BindValueChanged(enabled => this.FadeColour(enabled.NewValue ? Color4.White : colours.Gray9, 200, Easing.OutQuint), true); } protected override bool OnHover(HoverEvent e) diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 42f5b7f9b5..3fd0ead760 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -95,7 +95,7 @@ namespace osu.Game.Graphics.UserInterface protected override void LoadComplete() { base.LoadComplete(); - CurrentNumber.BindValueChanged(e => updateTooltipText(e.NewValue), true); + CurrentNumber.BindValueChanged(current => updateTooltipText(current.NewValue), true); } protected override bool OnHover(HoverEvent e) diff --git a/osu.Game/Online/Chat/ChannelManager.cs b/osu.Game/Online/Chat/ChannelManager.cs index 6c52f4d2f5..8c6422afe3 100644 --- a/osu.Game/Online/Chat/ChannelManager.cs +++ b/osu.Game/Online/Chat/ChannelManager.cs @@ -55,7 +55,7 @@ namespace osu.Game.Online.Chat { CurrentChannel.ValueChanged += currentChannelChanged; - HighPollRate.BindValueChanged(e => TimeBetweenPolls = e.NewValue ? 1000 : 6000, true); + HighPollRate.BindValueChanged(enabled => TimeBetweenPolls = enabled.NewValue ? 1000 : 6000, true); } /// diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 883cac4f7a..9f6adc373c 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -185,7 +185,7 @@ namespace osu.Game LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust); - IsActive.BindValueChanged(e => updateActiveState(e.NewValue), true); + IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true); } private ExternalLinkOpener externalLinkOpener; diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs index 7f4c9545dc..edd886f0f2 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/DownloadButton.cs @@ -108,9 +108,9 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons localUser.BindValueChanged(userChanged, true); button.Enabled.BindValueChanged(enabledChanged, true); - State.BindValueChanged(e => + State.BindValueChanged(state => { - switch (e.NewValue) + switch (state.NewValue) { case DownloadState.Downloading: textSprites.Children = new Drawable[] diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index 9ff5b5a2e6..95cf9e9d04 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.cs @@ -187,16 +187,16 @@ namespace osu.Game.Overlays.BeatmapSet State.BindValueChanged(_ => updateDownloadButtons()); - BeatmapSet.BindValueChanged(e => + BeatmapSet.BindValueChanged(setInfo => { - Picker.BeatmapSet = author.BeatmapSet = Details.BeatmapSet = e.NewValue; + Picker.BeatmapSet = author.BeatmapSet = Details.BeatmapSet = setInfo.NewValue; - title.Text = e.NewValue?.Metadata.Title ?? string.Empty; - artist.Text = e.NewValue?.Metadata.Artist ?? string.Empty; - onlineStatusPill.Status = e.NewValue?.OnlineInfo.Status ?? BeatmapSetOnlineStatus.None; - cover.BeatmapSet = e.NewValue; + title.Text = setInfo.NewValue?.Metadata.Title ?? string.Empty; + artist.Text = setInfo.NewValue?.Metadata.Artist ?? string.Empty; + onlineStatusPill.Status = setInfo.NewValue?.OnlineInfo.Status ?? BeatmapSetOnlineStatus.None; + cover.BeatmapSet = setInfo.NewValue; - if (e.NewValue != null) + if (setInfo.NewValue != null) { downloadButtonsContainer.FadeIn(transition_duration); favouriteButton.FadeIn(transition_duration); diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index a1d5310631..f15413d522 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -67,7 +67,7 @@ namespace osu.Game.Overlays.Direct { base.LoadComplete(); - State.BindValueChanged(e => updateState(e.NewValue), true); + State.BindValueChanged(state => updateState(state.NewValue), true); FinishTransforms(true); } diff --git a/osu.Game/Overlays/Direct/DownloadProgressBar.cs b/osu.Game/Overlays/Direct/DownloadProgressBar.cs index 9cedc6da6e..9c2b1e5b63 100644 --- a/osu.Game/Overlays/Direct/DownloadProgressBar.cs +++ b/osu.Game/Overlays/Direct/DownloadProgressBar.cs @@ -35,9 +35,9 @@ namespace osu.Game.Overlays.Direct progressBar.BackgroundColour = Color4.Black.Opacity(0.7f); progressBar.Current = Progress; - State.BindValueChanged(e => + State.BindValueChanged(state => { - switch (e.NewValue) + switch (state.NewValue) { case DownloadState.NotDownloaded: progressBar.Current.Value = 0; diff --git a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs index 882df0b30f..58be491daf 100644 --- a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs +++ b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs @@ -37,14 +37,14 @@ namespace osu.Game.Overlays.Direct { this.beatmaps = beatmaps; - BeatmapSet.BindValueChanged(e => + BeatmapSet.BindValueChanged(setInfo => { - if (e.NewValue == null) + if (setInfo.NewValue == null) attachDownload(null); - else if (beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == e.NewValue.OnlineBeatmapSetID).Any()) + else if (beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == setInfo.NewValue.OnlineBeatmapSetID).Any()) State.Value = DownloadState.LocallyAvailable; else - attachDownload(beatmaps.GetExistingDownload(e.NewValue)); + attachDownload(beatmaps.GetExistingDownload(setInfo.NewValue)); }, true); beatmaps.BeatmapDownloadBegan += download => diff --git a/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs b/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs index bb56dbccd8..8ed196fd01 100644 --- a/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Debug/GCSettings.cs @@ -35,8 +35,8 @@ namespace osu.Game.Overlays.Settings.Sections.Debug }; configLatencyMode = config.GetBindable(DebugSetting.ActiveGCMode); - configLatencyMode.BindValueChanged(e => latencyMode.Value = (LatencyMode)e.NewValue, true); - latencyMode.BindValueChanged(e => configLatencyMode.Value = (GCLatencyMode)e.NewValue); + configLatencyMode.BindValueChanged(mode => latencyMode.Value = (LatencyMode)mode.NewValue, true); + latencyMode.BindValueChanged(mode => configLatencyMode.Value = (GCLatencyMode)mode.NewValue); } private enum LatencyMode diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index a4902a108a..628cdb944a 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -128,9 +128,9 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics Bindable = sizeFullscreen }; - windowModeDropdown.Bindable.BindValueChanged(e => + windowModeDropdown.Bindable.BindValueChanged(mode => { - if (e.NewValue == WindowMode.Fullscreen) + if (mode.NewValue == WindowMode.Fullscreen) { resolutionDropdown.Show(); sizeFullscreen.TriggerChange(); @@ -140,15 +140,15 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics }, true); } - scalingMode.BindValueChanged(e => + scalingMode.BindValueChanged(mode => { scalingSettings.ClearTransforms(); - scalingSettings.AutoSizeAxes = e.NewValue != ScalingMode.Off ? Axes.Y : Axes.None; + scalingSettings.AutoSizeAxes = mode.NewValue != ScalingMode.Off ? Axes.Y : Axes.None; - if (e.NewValue == ScalingMode.Off) + if (mode.NewValue == ScalingMode.Off) scalingSettings.ResizeHeightTo(0, transition_duration, Easing.OutQuint); - scalingSettings.ForEach(s => s.TransferValueOnCommit = e.NewValue == ScalingMode.Everything); + scalingSettings.ForEach(s => s.TransferValueOnCommit = mode.NewValue == ScalingMode.Everything); }, true); } diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index 8db80eaab1..d1f47b6016 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -76,8 +76,8 @@ namespace osu.Game.Overlays.Settings.Sections if (skinDropdown.Items.All(s => s.ID != configBindable.Value)) configBindable.Value = 0; - configBindable.BindValueChanged(e => dropdownBindable.Value = skinDropdown.Items.Single(s => s.ID == e.NewValue), true); - dropdownBindable.BindValueChanged(e => configBindable.Value = e.NewValue.ID); + configBindable.BindValueChanged(id => dropdownBindable.Value = skinDropdown.Items.Single(s => s.ID == id.NewValue), true); + dropdownBindable.BindValueChanged(skin => configBindable.Value = skin.NewValue.ID); } private void itemRemoved(SkinInfo s) => Schedule(() => skinDropdown.Items = skinDropdown.Items.Where(i => i.ID != s.ID).ToArray()); diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs index a84784fc29..748c9e2ba3 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/Timeline.cs @@ -52,10 +52,10 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline WaveformVisible.ValueChanged += visible => waveform.FadeTo(visible.NewValue ? 1 : 0, 200, Easing.OutQuint); Beatmap.BindTo(beatmap); - Beatmap.BindValueChanged(e => + Beatmap.BindValueChanged(b => { - waveform.Waveform = e.NewValue.Waveform; - track = e.NewValue.Track; + waveform.Waveform = b.NewValue.Waveform; + track = b.NewValue.Track; }, true); } diff --git a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs index a16c74353d..101ff8bf94 100644 --- a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs +++ b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.Multi.Components [BackgroundDependencyLoader] private void load() { - CurrentItem.BindValueChanged(e => updateText(), true); + CurrentItem.BindValueChanged(_ => updateText(), true); } private float textSize = OsuFont.DEFAULT_FONT_SIZE; diff --git a/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs b/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs index 6f216e8a8d..23771451bd 100644 --- a/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs +++ b/osu.Game/Screens/Multi/Components/BeatmapTypeInfo.cs @@ -51,11 +51,11 @@ namespace osu.Game.Screens.Multi.Components } }; - CurrentItem.BindValueChanged(e => + CurrentItem.BindValueChanged(item => { beatmapAuthor.Clear(); - var beatmap = e.NewValue?.Beatmap; + var beatmap = item.NewValue?.Beatmap; if (beatmap != null) { diff --git a/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs b/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs index 058560381c..8ab23a620b 100644 --- a/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs +++ b/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs @@ -46,9 +46,9 @@ namespace osu.Game.Screens.Multi.Components }, }; - CurrentItem.BindValueChanged(e => updateBeatmap(e.NewValue), true); + CurrentItem.BindValueChanged(item => updateBeatmap(item.NewValue), true); - Type.BindValueChanged(e => gameTypeContainer.Child = new DrawableGameType(e.NewValue) { Size = new Vector2(height) }, true); + Type.BindValueChanged(type => gameTypeContainer.Child = new DrawableGameType(type.NewValue) { Size = new Vector2(height) }, true); } private void updateBeatmap(PlaylistItem item) diff --git a/osu.Game/Screens/Multi/Components/MultiplayerBackgroundSprite.cs b/osu.Game/Screens/Multi/Components/MultiplayerBackgroundSprite.cs index 257c2ff54e..512f79942d 100644 --- a/osu.Game/Screens/Multi/Components/MultiplayerBackgroundSprite.cs +++ b/osu.Game/Screens/Multi/Components/MultiplayerBackgroundSprite.cs @@ -16,7 +16,7 @@ namespace osu.Game.Screens.Multi.Components InternalChild = sprite = CreateBackgroundSprite(); - CurrentItem.BindValueChanged(e => sprite.Beatmap.Value = e.NewValue?.Beatmap, true); + CurrentItem.BindValueChanged(item => sprite.Beatmap.Value = item.NewValue?.Beatmap, true); } protected virtual UpdateableBeatmapBackgroundSprite CreateBackgroundSprite() => new UpdateableBeatmapBackgroundSprite { RelativeSizeAxes = Axes.Both }; diff --git a/osu.Game/Screens/Multi/Components/ParticipantCount.cs b/osu.Game/Screens/Multi/Components/ParticipantCount.cs index 86334051dc..498eeb09b3 100644 --- a/osu.Game/Screens/Multi/Components/ParticipantCount.cs +++ b/osu.Game/Screens/Multi/Components/ParticipantCount.cs @@ -50,7 +50,7 @@ namespace osu.Game.Screens.Multi.Components }; MaxParticipants.BindValueChanged(_ => updateMax(), true); - ParticipantCount.BindValueChanged(e => count.Text = e.NewValue.ToString("#,0"), true); + ParticipantCount.BindValueChanged(c => count.Text = c.NewValue.ToString("#,0"), true); } private void updateMax() diff --git a/osu.Game/Screens/Multi/Components/RoomStatusInfo.cs b/osu.Game/Screens/Multi/Components/RoomStatusInfo.cs index 596d6f6cfc..d799f846c2 100644 --- a/osu.Game/Screens/Multi/Components/RoomStatusInfo.cs +++ b/osu.Game/Screens/Multi/Components/RoomStatusInfo.cs @@ -53,7 +53,7 @@ namespace osu.Game.Screens.Multi.Components public EndDatePart() : base(DateTimeOffset.UtcNow) { - EndDate.BindValueChanged(e => Date = e.NewValue); + EndDate.BindValueChanged(date => Date = date.NewValue); } protected override string Format() diff --git a/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs b/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs index b58bc0daac..97af6674bf 100644 --- a/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs +++ b/osu.Game/Screens/Multi/Components/StatusColouredContainer.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.Multi.Components [BackgroundDependencyLoader] private void load(OsuColour colours) { - status.BindValueChanged(e => this.FadeColour(e.NewValue.GetAppropriateColour(colours), transitionDuration), true); + status.BindValueChanged(s => this.FadeColour(s.NewValue.GetAppropriateColour(colours), transitionDuration), true); } } } diff --git a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs index de1ae4448f..ca5e5f72c4 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs @@ -101,7 +101,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components } }, true); - ParticipantCount.BindValueChanged(e => summary.Text = $"{e.NewValue:#,0}{" participant".Pluralize(e.NewValue == 1)}", true); + ParticipantCount.BindValueChanged(count => summary.Text = $"{count.NewValue:#,0}{" participant".Pluralize(count.NewValue == 1)}", true); /*Participants.BindValueChanged(e => { diff --git a/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs b/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs index 62850a04af..fd9c8d7b35 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/RoomInspector.cs @@ -214,7 +214,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components [BackgroundDependencyLoader] private void load() { - status.BindValueChanged(e => Text = e.NewValue.Message, true); + status.BindValueChanged(s => Text = s.NewValue.Message, true); } } diff --git a/osu.Game/Screens/Multi/Match/Components/Header.cs b/osu.Game/Screens/Multi/Match/Components/Header.cs index 7b82d27ad1..6a6a1f274c 100644 --- a/osu.Game/Screens/Multi/Match/Components/Header.cs +++ b/osu.Game/Screens/Multi/Match/Components/Header.cs @@ -108,7 +108,7 @@ namespace osu.Game.Screens.Multi.Match.Components }, }; - CurrentItem.BindValueChanged(e => modDisplay.Current.Value = e.NewValue?.RequiredMods, true); + CurrentItem.BindValueChanged(item => modDisplay.Current.Value = item.NewValue?.RequiredMods, true); beatmapButton.Action = () => RequestBeatmapSelection?.Invoke(); } @@ -126,7 +126,7 @@ namespace osu.Game.Screens.Multi.Match.Components [BackgroundDependencyLoader] private void load() { - roomId.BindValueChanged(e => this.FadeTo(e.NewValue.HasValue ? 0 : 1), true); + roomId.BindValueChanged(id => this.FadeTo(id.NewValue.HasValue ? 0 : 1), true); } } diff --git a/osu.Game/Screens/Multi/Match/Components/HostInfo.cs b/osu.Game/Screens/Multi/Match/Components/HostInfo.cs index 37e1c3ca0f..02c8929f44 100644 --- a/osu.Game/Screens/Multi/Match/Components/HostInfo.cs +++ b/osu.Game/Screens/Multi/Match/Components/HostInfo.cs @@ -43,7 +43,7 @@ namespace osu.Game.Screens.Multi.Match.Components } }; - Host.BindValueChanged(e => updateHost(e.NewValue)); + Host.BindValueChanged(host => updateHost(host.NewValue)); } private void updateHost(User host) diff --git a/osu.Game/Screens/Multi/Match/Components/Info.cs b/osu.Game/Screens/Multi/Match/Components/Info.cs index d7dc279731..a944d965bd 100644 --- a/osu.Game/Screens/Multi/Match/Components/Info.cs +++ b/osu.Game/Screens/Multi/Match/Components/Info.cs @@ -92,10 +92,10 @@ namespace osu.Game.Screens.Multi.Match.Components }, }; - CurrentItem.BindValueChanged(e => + CurrentItem.BindValueChanged(item => { - viewBeatmapButton.Beatmap.Value = e.NewValue?.Beatmap; - readyButton.Beatmap.Value = e.NewValue?.Beatmap; + viewBeatmapButton.Beatmap.Value = item.NewValue?.Beatmap; + readyButton.Beatmap.Value = item.NewValue?.Beatmap; }, true); hostInfo.Host.BindTo(Host); diff --git a/osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs b/osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs index 263987dc2f..fff713f026 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchLeaderboard.cs @@ -23,9 +23,9 @@ namespace osu.Game.Screens.Multi.Match.Components [BackgroundDependencyLoader] private void load() { - roomId.BindValueChanged(e => + roomId.BindValueChanged(id => { - if (e.NewValue == null) + if (id.NewValue == null) return; Scores = null; diff --git a/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs b/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs index e32a26b510..b310e62d7c 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs @@ -264,12 +264,12 @@ namespace osu.Game.Screens.Multi.Match.Components processingOverlay = new ProcessingOverlay { Alpha = 0 } }; - TypePicker.Current.BindValueChanged(e => typeLabel.Text = e.NewValue?.Name ?? string.Empty, true); - Name.BindValueChanged(e => NameField.Text = e.NewValue, true); - Availability.BindValueChanged(e => AvailabilityPicker.Current.Value = e.NewValue, true); - Type.BindValueChanged(e => TypePicker.Current.Value = e.NewValue, true); - MaxParticipants.BindValueChanged(e => MaxParticipantsField.Text = e.NewValue?.ToString(), true); - Duration.BindValueChanged(e => DurationField.Current.Value = e.NewValue, true); + TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue?.Name ?? string.Empty, true); + Name.BindValueChanged(name => NameField.Text = name.NewValue, true); + Availability.BindValueChanged(availability => AvailabilityPicker.Current.Value = availability.NewValue, true); + Type.BindValueChanged(type => TypePicker.Current.Value = type.NewValue, true); + MaxParticipants.BindValueChanged(count => MaxParticipantsField.Text = count.NewValue?.ToString(), true); + Duration.BindValueChanged(duration => DurationField.Current.Value = duration.NewValue, true); } protected override void Update() diff --git a/osu.Game/Screens/Multi/Match/Components/MatchTabControl.cs b/osu.Game/Screens/Multi/Match/Components/MatchTabControl.cs index e7d3a88da2..9e04bb6f60 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchTabControl.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchTabControl.cs @@ -26,9 +26,9 @@ namespace osu.Game.Screens.Multi.Match.Components [BackgroundDependencyLoader] private void load() { - roomId.BindValueChanged(e => + roomId.BindValueChanged(id => { - if (e.NewValue.HasValue) + if (id.NewValue.HasValue) { Items.ForEach(t => t.Enabled.Value = !(t is SettingsMatchPage)); Current.Value = new RoomMatchPage(); @@ -51,7 +51,7 @@ namespace osu.Game.Screens.Multi.Match.Components : base(value) { enabled.BindTo(value.Enabled); - enabled.BindValueChanged(e => Colour = e.NewValue ? Color4.White : Color4.Gray); + enabled.BindValueChanged(enabled => Colour = enabled.NewValue ? Color4.White : Color4.Gray, true); } protected override bool OnClick(ClickEvent e) diff --git a/osu.Game/Screens/Multi/Match/Components/Participants.cs b/osu.Game/Screens/Multi/Match/Components/Participants.cs index ac349cc711..2d6099c65d 100644 --- a/osu.Game/Screens/Multi/Match/Components/Participants.cs +++ b/osu.Game/Screens/Multi/Match/Components/Participants.cs @@ -50,9 +50,9 @@ namespace osu.Game.Screens.Multi.Match.Components }, }; - Participants.BindValueChanged(e => + Participants.BindValueChanged(participants => { - usersFlow.Children = e.NewValue.Select(u => new UserPanel(u) + usersFlow.Children = participants.NewValue.Select(u => new UserPanel(u) { Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, diff --git a/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs b/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs index cf71f36c38..3e4694e232 100644 --- a/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs +++ b/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs @@ -40,7 +40,7 @@ namespace osu.Game.Screens.Multi.Match.Components { beatmaps.ItemAdded += beatmapAdded; - Beatmap.BindValueChanged(e => updateBeatmap(e.NewValue), true); + Beatmap.BindValueChanged(b => updateBeatmap(b.NewValue), true); } private void updateBeatmap(BeatmapInfo beatmap) diff --git a/osu.Game/Screens/Multi/Match/Components/ViewBeatmapButton.cs b/osu.Game/Screens/Multi/Match/Components/ViewBeatmapButton.cs index 6b41bff144..8d1ff21124 100644 --- a/osu.Game/Screens/Multi/Match/Components/ViewBeatmapButton.cs +++ b/osu.Game/Screens/Multi/Match/Components/ViewBeatmapButton.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Multi.Match.Components private void load() { if (osuGame != null) - Beatmap.BindValueChanged(e => updateAction(e.NewValue), true); + Beatmap.BindValueChanged(beatmap => updateAction(beatmap.NewValue), true); } private void updateAction(BeatmapInfo beatmap) diff --git a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs index 3fc2e347e7..c3f7cea43e 100644 --- a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs +++ b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs @@ -146,10 +146,10 @@ namespace osu.Game.Screens.Multi.Match }, }; - header.Tabs.Current.BindValueChanged(e => + header.Tabs.Current.BindValueChanged(tab => { const float fade_duration = 500; - if (e.NewValue is SettingsMatchPage) + if (tab.NewValue is SettingsMatchPage) { settings.Show(); info.FadeOut(fade_duration, Easing.OutQuint); diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index 74b67b9972..dd01ae4160 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -135,7 +135,7 @@ namespace osu.Game.Screens.Multi protected override void LoadComplete() { base.LoadComplete(); - isIdle.BindValueChanged(e => updatePollingRate(e.NewValue), true); + isIdle.BindValueChanged(idle => updatePollingRate(idle.NewValue), true); } protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 46e0921b0a..47ac472b9e 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -266,12 +266,12 @@ namespace osu.Game.Screens.Ranking modeChangeButtons.AddItem(t); modeChangeButtons.Current.Value = modeChangeButtons.Items.FirstOrDefault(); - modeChangeButtons.Current.BindValueChanged(e => + modeChangeButtons.Current.BindValueChanged(page => { currentPage?.FadeOut(); currentPage?.Expire(); - currentPage = e.NewValue?.CreatePage(); + currentPage = page.NewValue?.CreatePage(); if (currentPage != null) circleInner.Add(currentPage); diff --git a/osu.Game/Screens/Select/BeatmapInfoWedge.cs b/osu.Game/Screens/Select/BeatmapInfoWedge.cs index 6fb0de2645..32e7215e69 100644 --- a/osu.Game/Screens/Select/BeatmapInfoWedge.cs +++ b/osu.Game/Screens/Select/BeatmapInfoWedge.cs @@ -263,8 +263,8 @@ namespace osu.Game.Screens.Select } }; - titleBinding.BindValueChanged(e => setMetadata(metadata.Source)); - artistBinding.BindValueChanged(e => setMetadata(metadata.Source), true); + titleBinding.BindValueChanged(_ => setMetadata(metadata.Source)); + artistBinding.BindValueChanged(_ => setMetadata(metadata.Source), true); // no difficulty means it can't have a status to show if (beatmapInfo.Version == null) From 76de39a3444c3c59c376fb95f40a365e34396445 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Feb 2019 20:34:51 +0900 Subject: [PATCH 153/327] Put user dim logic in yet another container inside UserDimContainer --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 61 ++++++++++++------- .../Graphics/Containers/UserDimContainer.cs | 10 ++- .../Backgrounds/BackgroundScreenBeatmap.cs | 3 +- 3 files changed, 47 insertions(+), 27 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index bbffb910d5..881ece1dc4 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -12,6 +12,7 @@ using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Scoring; using osu.Game.Screens; @@ -32,18 +33,38 @@ namespace osu.Game.Tests.Visual { typeof(ScreenWithBeatmapBackground), typeof(PlayerLoader), - typeof(Player) + typeof(Player), + typeof(UserDimContainer) }; private DummySongSelect songSelect; private DimAccessiblePlayerLoader playerLoader; private DimAccessiblePlayer player; + private readonly ScreenStack screen; [Cached] private BackgroundScreenStack backgroundStack; + private void createSongSelect() + { + AddStep("Create song select if required", () => + { + if (songSelect == null) + { + LoadComponentAsync(new DummySongSelect(), p => + { + songSelect = p; + screen.Push(p); + songSelect.UpdateBindables(); + }); + } + }); + AddUntilStep(() => songSelect?.IsLoaded ?? false, "Wait for song select to load"); + } + private void performSetup() { + createSongSelect(); AddUntilStep(() => { if (!songSelect.IsCurrentScreen()) @@ -53,31 +74,17 @@ namespace osu.Game.Tests.Visual } return true; }, "Wait for song select is current"); + AddStep("Load new player to song select", () => songSelect.Push(player = new DimAccessiblePlayer { Ready = true })); AddUntilStep(() => player?.IsLoaded ?? false, "Wait for player to load"); } public TestCaseBackgroundScreenBeatmap() { - ScreenStack screen; - InputManager.Add(backgroundStack = new BackgroundScreenStack {RelativeSizeAxes = Axes.Both}); InputManager.Add(screen = new ScreenStack { RelativeSizeAxes = Axes.Both }); - AddStep("Load Song Select", () => - { - songSelect?.MakeCurrent(); - songSelect?.Exit(); - - LoadComponentAsync(new DummySongSelect(), p => - { - songSelect = p; - screen.Push(p); - songSelect.UpdateBindables(); - }); - }); - - AddUntilStep(() => songSelect?.IsLoaded ?? false, "Wait for song select to load"); + createSongSelect(); AddStep("Create beatmap", () => { Beatmap.Value = new TestWorkingBeatmap(new Beatmap @@ -301,32 +308,40 @@ namespace osu.Game.Tests.Visual private class FadeAccessibleBackground : BackgroundScreenBeatmap { - private Bindable dimLevel; + private readonly Bindable dimLevel = new Bindable(); + + protected override UserDimContainer CreateFadeContainer() => new TestUserDimContainer { RelativeSizeAxes = Axes.Both }; [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - dimLevel = config.GetBindable(OsuSetting.DimLevel); + config.BindWith(OsuSetting.DimLevel, dimLevel); } public bool AssertDimmed() { - return FadeContainer.Colour == OsuColour.Gray(1 - dimLevel); + return ((TestUserDimContainer)FadeContainer).CurrentColour == OsuColour.Gray(1 - (float)dimLevel); } public bool AssertUndimmed() { - return FadeContainer.Colour == Color4.White; + return ((TestUserDimContainer)FadeContainer).CurrentColour == Color4.White; } public bool AssertInvisible() { - return FadeContainer.Alpha == 0; + return ((TestUserDimContainer)FadeContainer).CurrentAlpha == 0; } public bool AssertVisible() { - return FadeContainer.Alpha == 1; + return ((TestUserDimContainer)FadeContainer).CurrentAlpha == 1; + } + + private class TestUserDimContainer : UserDimContainer + { + public Color4 CurrentColour => DimContainer.Colour; + public float CurrentAlpha => DimContainer.Alpha; } } } diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index d44df875d3..5d2dc8c9a0 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -16,6 +16,8 @@ namespace osu.Game.Graphics.Containers protected Bindable ShowStoryboard; public Bindable EnableUserDim = new Bindable(); public Bindable StoryboardReplacesBackground = new Bindable(); + protected Container DimContainer; + protected override Container Content => DimContainer; private readonly bool isStoryboard; @@ -23,7 +25,9 @@ namespace osu.Game.Graphics.Containers public UserDimContainer(bool isStoryboard = false) { + DimContainer = new Container { RelativeSizeAxes = Axes.Both }; this.isStoryboard = isStoryboard; + AddInternal(DimContainer); } [BackgroundDependencyLoader] @@ -41,15 +45,15 @@ namespace osu.Game.Graphics.Containers { if (isStoryboard) { - this.FadeTo(!ShowStoryboard || DimLevel == 1 ? 0 : 1, background_fade_duration, Easing.OutQuint); + DimContainer.FadeTo(!ShowStoryboard || DimLevel == 1 ? 0 : 1, background_fade_duration, Easing.OutQuint); } else { // The background needs to be hidden in the case of it being replaced - this.FadeTo(ShowStoryboard && StoryboardReplacesBackground ? 0 : 1, background_fade_duration, Easing.OutQuint); + DimContainer.FadeTo(ShowStoryboard && StoryboardReplacesBackground ? 0 : 1, background_fade_duration, Easing.OutQuint); } - this.FadeColour(EnableUserDim ? OsuColour.Gray(1 - (float)DimLevel) : Color4.White, background_fade_duration, Easing.OutQuint); + DimContainer.FadeColour(EnableUserDim ? OsuColour.Gray(1 - (float)DimLevel) : Color4.White, background_fade_duration, Easing.OutQuint); } } } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 8aa3ef620c..9716e0fb48 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -18,6 +18,7 @@ namespace osu.Game.Screens.Backgrounds public Bindable StoryboardReplacesBackground = new Bindable(); protected UserDimContainer FadeContainer; + protected virtual UserDimContainer CreateFadeContainer() => new UserDimContainer { RelativeSizeAxes = Axes.Both }; public virtual WorkingBeatmap Beatmap { @@ -29,7 +30,7 @@ namespace osu.Game.Screens.Backgrounds beatmap = value; - FadeContainer = new UserDimContainer { RelativeSizeAxes = Axes.Both }; + FadeContainer = CreateFadeContainer(); InternalChild = FadeContainer; EnableUserDim.BindTo(FadeContainer.EnableUserDim); From bb01948283838ce780e781d95f93601f1a27c218 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Feb 2019 20:44:02 +0900 Subject: [PATCH 154/327] Use .Value with new bindable changes --- osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs | 6 +++--- osu.Game/Graphics/Containers/UserDimContainer.cs | 8 ++++---- osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 881ece1dc4..78615c982e 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using System.Threading; using NUnit.Framework; using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Screens; using osu.Game.Beatmaps; @@ -280,7 +280,7 @@ namespace osu.Game.Tests.Visual public Bindable StoryboardEnabled; public readonly Bindable ReplacesBackground = new Bindable(); - public bool IsPaused => RulesetContainer.IsPaused; + public bool IsPaused => RulesetContainer.IsPaused.Value; [BackgroundDependencyLoader] private void load(OsuConfigManager config) @@ -320,7 +320,7 @@ namespace osu.Game.Tests.Visual public bool AssertDimmed() { - return ((TestUserDimContainer)FadeContainer).CurrentColour == OsuColour.Gray(1 - (float)dimLevel); + return ((TestUserDimContainer)FadeContainer).CurrentColour == OsuColour.Gray(1 - (float)dimLevel.Value); } public bool AssertUndimmed() diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index 5d2dc8c9a0..43e85a7492 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Configuration; @@ -45,15 +45,15 @@ namespace osu.Game.Graphics.Containers { if (isStoryboard) { - DimContainer.FadeTo(!ShowStoryboard || DimLevel == 1 ? 0 : 1, background_fade_duration, Easing.OutQuint); + DimContainer.FadeTo(!ShowStoryboard.Value || DimLevel.Value == 1 ? 0 : 1, background_fade_duration, Easing.OutQuint); } else { // The background needs to be hidden in the case of it being replaced - DimContainer.FadeTo(ShowStoryboard && StoryboardReplacesBackground ? 0 : 1, background_fade_duration, Easing.OutQuint); + DimContainer.FadeTo(ShowStoryboard.Value && StoryboardReplacesBackground.Value ? 0 : 1, background_fade_duration, Easing.OutQuint); } - DimContainer.FadeColour(EnableUserDim ? OsuColour.Gray(1 - (float)DimLevel) : Color4.White, background_fade_duration, Easing.OutQuint); + DimContainer.FadeColour(EnableUserDim.Value ? OsuColour.Gray(1 - (float)DimLevel.Value) : Color4.White, background_fade_duration, Easing.OutQuint); } } } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 9716e0fb48..6533276568 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Configuration; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Textures; using osu.Game.Beatmaps; From 7566fcf536df736934fbe258abd433106a660af7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 21 Jan 2019 10:57:14 +0900 Subject: [PATCH 155/327] Slider press fix --- .../Objects/Drawables/DrawableHitCircle.cs | 4 +++ .../Objects/Drawables/DrawableSlider.cs | 1 + .../Objects/Drawables/Pieces/CirclePiece.cs | 10 +++++- .../Objects/Drawables/Pieces/SliderBall.cs | 31 +++++++++++++++---- 4 files changed, 39 insertions(+), 7 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index 18c28deb9d..e909216508 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -28,6 +28,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private readonly IBindable stackHeightBindable = new Bindable(); private readonly IBindable scaleBindable = new Bindable(); + public OsuAction? HitAction => circle.HitAction; + private readonly Container explodeContainer; private readonly Container scaleContainer; @@ -150,6 +152,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables Expire(true); + circle.HitAction = null; + // override lifetime end as FadeIn may have been changed externally, causing out expiration to be too early. LifetimeEnd = HitObject.StartTime + HitObject.HitWindows.HalfWindowFor(HitResult.Miss); break; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 89521736c7..b55ec10d1d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -53,6 +53,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables repeatPoints = new Container { RelativeSizeAxes = Axes.Both }, Ball = new SliderBall(s, this) { + GetInitialHitAction = () => HeadCircle.HitAction, BypassAutoSizeAxes = Axes.Both, Scale = new Vector2(s.Scale), AlwaysPresent = true, diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs index b7e2748ca9..786cac7198 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/CirclePiece.cs @@ -17,6 +17,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces public Func Hit; + public OsuAction? HitAction; + public CirclePiece() { Size = new Vector2((float)OsuHitObject.OBJECT_RADIUS * 2); @@ -35,7 +37,13 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { case OsuAction.LeftButton: case OsuAction.RightButton: - return IsHovered && (Hit?.Invoke() ?? false); + if (IsHovered && (Hit?.Invoke() ?? false)) + { + HitAction = action; + return true; + } + + break; } return false; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index db9fee242a..93c655797a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -19,6 +20,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces private Color4 accentColour = Color4.Black; + public Func GetInitialHitAction; + /// /// The colour that is used for the slider ball. /// @@ -145,19 +148,35 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces } } - private bool canCurrentlyTrack => Time.Current >= slider.StartTime && Time.Current < slider.EndTime; + private bool canCurrentlyTrack => Time.Current >= slider.StartTime && Time.Current < slider.EndTime && lastScreenSpaceMousePosition.HasValue && base.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value); + + /// + /// The point in time up to which we need to include the key which was used to press the head circle in tracking conditions. + /// + private double? initialHitConditionDismissed; protected override void Update() { base.Update(); - if (Time.Current < slider.EndTime) + var initialHitAction = GetInitialHitAction(); + + if (initialHitAction == null) + initialHitConditionDismissed = null; + + if (canCurrentlyTrack) { + var pressed = drawableSlider?.OsuActionInputManager?.PressedActions; + + if (initialHitConditionDismissed == null && !pressed.Contains(initialHitAction == OsuAction.RightButton ? OsuAction.LeftButton : OsuAction.RightButton)) + initialHitConditionDismissed = Time.Current; + // Make sure to use the base version of ReceivePositionalInputAt so that we correctly check the position. - Tracking = canCurrentlyTrack - && lastScreenSpaceMousePosition.HasValue - && ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) - && (drawableSlider?.OsuActionInputManager?.PressedActions.Any(x => x == OsuAction.LeftButton || x == OsuAction.RightButton) ?? false); + Tracking = drawableSlider?.OsuActionInputManager?.PressedActions.Any(x => !initialHitConditionDismissed.HasValue || initialHitConditionDismissed.Value < Time.Current ? x == OsuAction.LeftButton || x == OsuAction.RightButton : x == initialHitAction) ?? false; + } + else + { + Tracking = false; } } From 94d3814ae342290ac1af5da1c95dbc1a405ae0e2 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 21 Jan 2019 14:40:28 +0900 Subject: [PATCH 156/327] Add tests for slider input behavior --- .../TestCaseSliderInput.cs | 406 ++++++++++++++++++ 1 file changed, 406 insertions(+) create mode 100644 osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs new file mode 100644 index 0000000000..ebfc11a961 --- /dev/null +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -0,0 +1,406 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Beatmaps; +using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Replays; +using osu.Game.Rulesets.Judgements; +using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets.Osu.Objects.Drawables; +using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; +using osu.Game.Rulesets.Osu.Replays; +using osu.Game.Rulesets.Replays; +using osu.Game.Rulesets.Scoring; +using osu.Game.Scoring; +using osu.Game.Screens.Play; +using osu.Game.Tests.Beatmaps; +using osu.Game.Tests.Visual; +using osuTK; + +namespace osu.Game.Rulesets.Osu.Tests +{ + public class TestCaseSliderInput : OsuTestCase + { + public override IReadOnlyList RequiredTypes => new[] + { + typeof(Slider), + typeof(SliderBall), + typeof(SliderBody), + typeof(SliderTick), + typeof(DrawableSlider), + typeof(DrawableSliderTick), + typeof(DrawableRepeatPoint), + typeof(DrawableOsuHitObject) + }; + + [SetUp] + public void Setup() + { + Schedule(() => { allJudgedFired = false; }); + judgementResults = new List(); + } + + private readonly Container content; + protected override Container Content => content; + + private List judgementResults; + private bool allJudgedFired; + + public TestCaseSliderInput() + { + base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); + } + + /// + /// Pressing a key before a slider, pressing the other key on the slider head, then releasing the latter pressed key + /// should result in tracking to end. + /// At 250ms intervals: + /// Frame 1 (prior to slider): Left Click + /// Frame 2 (within slider hit window): Left & Right Click + /// Frame 3 (while tracking): Left Click + /// A passing test case will have the cursor lose tracking on frame 3. + /// + [Test] + public void TestLeftBeforeSliderThenRight() + { + AddStep("Invalid key transfer test", () => + { + var frames = new List + { + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 250}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = 1500}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 2500}, + }; + + performStaticInputTest(frames); + }); + + AddUntilStep(() => allJudgedFired, "Wait for test 1"); + AddAssert("Tracking lost", assertMehJudge); + } + + /// + /// Hitting a slider head, pressing a new key after the initial hit, then letting go of the original key used to hit + /// the slider should reslt in continued tracking. + /// At 250ms intervals: + /// Frame 1: Left Click + /// Frame 2: Left & Right Click + /// Frame 3: Right Click + /// A passing test case will have the cursor continue to track after frame 3. + /// + [Test] + public void TestLeftBeforeSliderThenRightThenLettingGoOfLeft() + { + AddStep("Left to both to right test", () => + { + var frames = new List + { + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 1500}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = 2500}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = 3500}, + }; + + performStaticInputTest(frames); + }); + + AddUntilStep(() => allJudgedFired, "Wait for test 2"); + AddAssert("Tracking retained", assertGreatJudge); + } + + /// + /// Hitting a slider head, pressing a new key after the initial hit, then letting go of the new key should result + /// in continue tracking, + /// At 250ms intervals: + /// Frame 1: Left Click + /// Frame 2: Left & Right Click + /// Frame 3: Left Click + /// A passing test case will have the cursor continue to track after frame 3. + /// + [Test] + public void TestTrackingRetentionLeftRightLeft() + { + AddStep("Tracking retention test", () => + { + var frames = new List + { + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 250}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = 1500}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = 2500}, + }; + + performStaticInputTest(frames); + }); + + AddUntilStep(() => allJudgedFired, "Wait for test 3"); + AddAssert("Tracking retained", assertGreatJudge); + } + + /// + /// Pressing a key before a slider, pressing the other key on the slider head, then releasing the former pressed key + /// should result in continued tracking. + /// At 250ms intervals: + /// Frame 1 (prior to slider): Left Click + /// Frame 2 (on slider head): Left & Right Click + /// Frame 3 (tracking slider body): Right Click + /// A passing test case will have the cursor continue to track after frame 3. + /// + [Test] + public void TestTrackingLeftBeforeSliderToRight() + { + AddStep("Tracking retention test", () => + { + var frames = new List + { + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 250}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = 1500}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = 2500}, + }; + + performStaticInputTest(frames); + }); + + AddUntilStep(() => allJudgedFired, "Wait for test 4"); + AddAssert("Tracking retained", assertGreatJudge); + } + + /// + /// Pressing a key before a slider and holding the slider throughout the body should result in tracking, but a miss on the slider head. + /// Only one frame is required: + /// Frame 1: Left Click + /// In a successful test case: + /// The head of the slider should be judged as a miss. + /// The slider end should be judged as a meh. + /// + [Test] + public void TestTrackingPreclicked() + { + AddStep("Tracking retention test", () => + { + var frames = new List + { + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 250}, + }; + + performStaticInputTest(frames); + }); + + AddUntilStep(() => allJudgedFired, "Wait for test 5"); + AddAssert("Tracking retained, sliderhead miss", assertHeadMissTailMeh); + } + + /// + /// Hitting a slider head, leaving the slider, then coming back into the slider with the same button to track it should re-start tracking. + /// Only one frame is required: + /// Frame 1: Left Click + /// In a successful test case: + /// The last tick of the slider should be judged as a great. + /// + [Test] + public void TestTrackingReturnMidSlider() + { + AddStep("Mid-sldier tracking re-acquisition", () => + { + var frames = new List + { + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 1500}, + new OsuReplayFrame { Position = new Vector2(150, 150), Actions = { OsuAction.LeftButton }, Time = 2000}, + new OsuReplayFrame { Position = new Vector2(200, 200), Actions = { OsuAction.LeftButton }, Time = 2500}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 3000}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 3500}, + }; + + performStaticInputTest(frames); + }); + + AddUntilStep(() => allJudgedFired, "Wait for test 6"); + AddAssert("Tracking re-acquired", assertMidSliderJudgements); + } + + /// + /// Pressing a key before a slider, hitting a slider head, leaving the slider, then coming back into the slider to track it should NOT start retracking + /// This is current stable behavior. + /// + [Test] + public void TestTrackingReturnMidSliderKeyDownBefore() + { + AddStep("Key held down before slider, mid-slider tracking re-acquisition", () => + { + var frames = new List + { + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 250}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = 1500}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 2000}, + new OsuReplayFrame { Position = new Vector2(200, 200), Actions = { OsuAction.LeftButton }, Time = 2500}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 3000}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 3500}, + }; + + performStaticInputTest(frames); + }); + + AddUntilStep(() => allJudgedFired, "Wait for test 7"); + AddAssert("Tracking lost", assertMidSliderJudgementFail); + } + + /// + /// Halfway into a slider outside of the slider, then starting to hover the slider afterwards should result in tracking + /// + [Test] + public void TestTrackingMidSlider() + { + AddStep("Mid-slider new tracking acquisition", () => + { + var frames = new List + { + new OsuReplayFrame { Position = new Vector2(150, 150), Actions = { OsuAction.LeftButton }, Time = 2000}, + new OsuReplayFrame { Position = new Vector2(200, 200), Actions = { OsuAction.LeftButton }, Time = 2500}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 3000}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 3500}, + }; + + performStaticInputTest(frames); + }); + + AddUntilStep(() => allJudgedFired, "Wait for test 8"); + AddAssert("Tracking acquired", assertMidSliderJudgements); + } + + /// + /// Pressing a key before a slider, clicking another key after the slider, holding both of them and + /// leaving tracking, then releasing both keys, then pressing the originally pressed key should start tracking + /// + [Test] + public void TestTrackingPressBeforeSliderClickingOtherKeyLeavingSliderReleaseThenTrackOriginal() + { + AddStep("Mid-slider new tracking acquisition", () => + { + var frames = new List + { + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 250}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = 1500}, + new OsuReplayFrame { Position = new Vector2(100, 100), Time = 1750}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 3500}, + }; + + performStaticInputTest(frames); + }); + + AddUntilStep(() => allJudgedFired, "Wait for test 9"); + AddAssert("Tracking acquired", assertMidSliderJudgements); + } + + /// + /// Pressing a key before a slider, clicking another key after the slider, holding both of them and + /// leaving tracking, then releasing both keys, then pressing the originally pressed key should start tracking + /// + [Test] + public void TestClickingBeforeLeavingSliderReleasingClickingAgainThenTracking() + { + AddStep("Mid-slider new tracking acquisition", () => + { + var frames = new List + { + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 1500}, + new OsuReplayFrame { Position = new Vector2(100, 100), Actions = { OsuAction.LeftButton }, Time = 2500}, + new OsuReplayFrame { Position = new Vector2(100, 100), Time = 2750}, + new OsuReplayFrame { Position = new Vector2(100, 100), Actions = { OsuAction.LeftButton }, Time = 3000}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 3500}, + }; + + performStaticInputTest(frames); + }); + + AddUntilStep(() => allJudgedFired, "Wait for test 10"); + AddAssert("Tracking acquired", assertMidSliderJudgements); + } + + private bool assertMehJudge() + { + return judgementResults.Last().Type == HitResult.Meh; + } + + private bool assertGreatJudge() + { + return judgementResults.Last().Type == HitResult.Great; + } + + private bool assertHeadMissTailMeh() + { + return judgementResults.Last().Type == HitResult.Meh && judgementResults.First().Type == HitResult.Miss; + } + + private bool assertMidSliderJudgements() + { + return judgementResults[judgementResults.Count - 2].Type == HitResult.Great; + } + + private bool assertMidSliderJudgementFail() + { + return judgementResults[judgementResults.Count - 2].Type == HitResult.Miss; + } + + private void performStaticInputTest(List frames) + { + var slider = new Slider + { + StartTime = 1500, + Position = new Vector2(0, 0), + Path = new SliderPath(PathType.PerfectCurve, new[] + { + Vector2.Zero, + new Vector2(25, 0), + }, 25), + }; + + // Empty frame to be added as a workaround for first frame behavior. + // If an input exists on the first frame, the input would apply to the entire intro lead-in + // Likely requires some discussion regarding how first frame inputs should be handled. + frames.Insert(0, new OsuReplayFrame { Position = slider.Position, Time = 0, Actions = new List() }); + + Beatmap.Value = new TestWorkingBeatmap(new Beatmap + { + HitObjects = { slider }, + ControlPointInfo = + { + DifficultyPoints = { new DifficultyControlPoint { SpeedMultiplier = 0.1f } } + }, + BeatmapInfo = + { + BaseDifficulty = new BeatmapDifficulty { SliderTickRate = 3 }, + Ruleset = new OsuRuleset().RulesetInfo + }, + }); + + var player = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } }) + { + AllowPause = false, + AllowLeadIn = false, + AllowResults = false + }; + + Child = player; + + player.ScoreProcessor.NewJudgement += result => judgementResults.Add(result); + + player.ScoreProcessor.AllJudged += () => { allJudgedFired = true; }; + } + + private class ScoreAccessibleReplayPlayer : ReplayPlayer + { + public new ScoreProcessor ScoreProcessor => base.ScoreProcessor; + + public ScoreAccessibleReplayPlayer(Score score) + : base(score) + { + } + } + } +} From 1c75ee4e824515c66213478bf68548feb96c4a9c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 21 Jan 2019 14:47:27 +0900 Subject: [PATCH 157/327] Add fixes --- osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 93c655797a..20a713c2d1 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -168,11 +168,11 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { var pressed = drawableSlider?.OsuActionInputManager?.PressedActions; - if (initialHitConditionDismissed == null && !pressed.Contains(initialHitAction == OsuAction.RightButton ? OsuAction.LeftButton : OsuAction.RightButton)) + if (initialHitAction != null && !pressed.Contains(initialHitAction == OsuAction.RightButton ? OsuAction.LeftButton : OsuAction.RightButton)) initialHitConditionDismissed = Time.Current; // Make sure to use the base version of ReceivePositionalInputAt so that we correctly check the position. - Tracking = drawableSlider?.OsuActionInputManager?.PressedActions.Any(x => !initialHitConditionDismissed.HasValue || initialHitConditionDismissed.Value < Time.Current ? x == OsuAction.LeftButton || x == OsuAction.RightButton : x == initialHitAction) ?? false; + Tracking = drawableSlider?.OsuActionInputManager?.PressedActions.Any(x => !initialHitAction.HasValue || (initialHitConditionDismissed.HasValue && initialHitConditionDismissed.Value < Time.Current) ? x == OsuAction.LeftButton || x == OsuAction.RightButton : x == initialHitAction) ?? false; } else { From 8e52e2330e2f278efb468a0c90d2de1b97be7674 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 21 Jan 2019 15:46:49 +0900 Subject: [PATCH 158/327] Add extensive commenting --- .../Objects/Drawables/Pieces/SliderBall.cs | 54 +++++++++++++++---- 1 file changed, 45 insertions(+), 9 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 20a713c2d1..bff225eae7 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -151,28 +151,50 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces private bool canCurrentlyTrack => Time.Current >= slider.StartTime && Time.Current < slider.EndTime && lastScreenSpaceMousePosition.HasValue && base.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value); /// - /// The point in time up to which we need to include the key which was used to press the head circle in tracking conditions. + /// If the cursor moves out of the ball's radius we still need to be able to receive positional updates to stop tracking. /// - private double? initialHitConditionDismissed; + public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; + + /// + /// The point in time after which we can accept any key for tracking. Before this time, we may need to restrict tracking to the key used to hit the head circle. + /// This is a requirement to stop the case where a player holds down one key (from before the slider) and taps the second key while maintaining full scoring (tracking) of sliders. + /// + /// Visually, if time is increasing from left to right: + /// + /// Z Z+X Z + /// o========o + /// + /// Without this logic, tracking would continue through the entire slider even though no key hold is directly attributing to it. + /// + /// + private double? timeToAcceptAnyKeyAfter; protected override void Update() { base.Update(); - var initialHitAction = GetInitialHitAction(); + // from the point at which the head circle is hit, this will be non-null. + // it may be null if the head circle was missed. + var headCircleHitAction = GetInitialHitAction(); - if (initialHitAction == null) - initialHitConditionDismissed = null; + if (headCircleHitAction == null) + timeToAcceptAnyKeyAfter = null; if (canCurrentlyTrack) { var pressed = drawableSlider?.OsuActionInputManager?.PressedActions; - if (initialHitAction != null && !pressed.Contains(initialHitAction == OsuAction.RightButton ? OsuAction.LeftButton : OsuAction.RightButton)) - initialHitConditionDismissed = Time.Current; + // if the head circle was hit with a specific key, tracking should only occur while that key is pressed. + if (headCircleHitAction != null && timeToAcceptAnyKeyAfter == null) + { + var otherKey = headCircleHitAction == OsuAction.RightButton ? OsuAction.LeftButton : OsuAction.RightButton; - // Make sure to use the base version of ReceivePositionalInputAt so that we correctly check the position. - Tracking = drawableSlider?.OsuActionInputManager?.PressedActions.Any(x => !initialHitAction.HasValue || (initialHitConditionDismissed.HasValue && initialHitConditionDismissed.Value < Time.Current) ? x == OsuAction.LeftButton || x == OsuAction.RightButton : x == initialHitAction) ?? false; + // we can return to accepting all keys if the initial head circle key is the *only* key pressed, or all keys have been released. + if (!pressed.Contains(otherKey)) + timeToAcceptAnyKeyAfter = Time.Current; + } + + Tracking = drawableSlider?.OsuActionInputManager?.PressedActions.Any(isValidTrackingAction) ?? false; } else { @@ -180,6 +202,20 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces } } + /// + /// Check whether a given user input is a valid tracking action. + /// + private bool isValidTrackingAction(OsuAction action) + { + bool headCircleHit = GetInitialHitAction().HasValue; + + // if the head circle was hit, we may not yet be allowed to accept any key, so we must use the initial hit action. + if (headCircleHit && (!timeToAcceptAnyKeyAfter.HasValue || Time.Current <= timeToAcceptAnyKeyAfter.Value)) + return action == GetInitialHitAction(); + + return action == OsuAction.LeftButton || action == OsuAction.RightButton; + } + public void UpdateProgress(double completionProgress) { Position = slider.CurvePositionAt(completionProgress); From 44501d7d4bf969adff2d398a58facf64880b1338 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 21 Jan 2019 16:25:22 +0900 Subject: [PATCH 159/327] Update test documentation --- .../TestCaseSliderInput.cs | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index ebfc11a961..747ed24a69 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -62,7 +62,6 @@ namespace osu.Game.Rulesets.Osu.Tests /// /// Pressing a key before a slider, pressing the other key on the slider head, then releasing the latter pressed key /// should result in tracking to end. - /// At 250ms intervals: /// Frame 1 (prior to slider): Left Click /// Frame 2 (within slider hit window): Left & Right Click /// Frame 3 (while tracking): Left Click @@ -90,7 +89,6 @@ namespace osu.Game.Rulesets.Osu.Tests /// /// Hitting a slider head, pressing a new key after the initial hit, then letting go of the original key used to hit /// the slider should reslt in continued tracking. - /// At 250ms intervals: /// Frame 1: Left Click /// Frame 2: Left & Right Click /// Frame 3: Right Click @@ -118,7 +116,6 @@ namespace osu.Game.Rulesets.Osu.Tests /// /// Hitting a slider head, pressing a new key after the initial hit, then letting go of the new key should result /// in continue tracking, - /// At 250ms intervals: /// Frame 1: Left Click /// Frame 2: Left & Right Click /// Frame 3: Left Click @@ -146,7 +143,6 @@ namespace osu.Game.Rulesets.Osu.Tests /// /// Pressing a key before a slider, pressing the other key on the slider head, then releasing the former pressed key /// should result in continued tracking. - /// At 250ms intervals: /// Frame 1 (prior to slider): Left Click /// Frame 2 (on slider head): Left & Right Click /// Frame 3 (tracking slider body): Right Click @@ -225,8 +221,10 @@ namespace osu.Game.Rulesets.Osu.Tests } /// - /// Pressing a key before a slider, hitting a slider head, leaving the slider, then coming back into the slider to track it should NOT start retracking - /// This is current stable behavior. + /// Pressing a key before a slider, hitting a slider head, leaving the slider, then coming back into the slider to track it should NOT start retracking + /// This is current stable behavior. + /// In a successful test case: + /// The last tick of the slider should be judged as a miss. /// [Test] public void TestTrackingReturnMidSliderKeyDownBefore() @@ -251,7 +249,9 @@ namespace osu.Game.Rulesets.Osu.Tests } /// - /// Halfway into a slider outside of the slider, then starting to hover the slider afterwards should result in tracking + /// Halfway into a slider outside of the slider, then starting to hover the slider afterwards should result in tracking + /// In a successful test case: + /// The last tick of the slider should be judged as a great. /// [Test] public void TestTrackingMidSlider() @@ -274,8 +274,10 @@ namespace osu.Game.Rulesets.Osu.Tests } /// - /// Pressing a key before a slider, clicking another key after the slider, holding both of them and - /// leaving tracking, then releasing both keys, then pressing the originally pressed key should start tracking + /// Pressing a key before a slider, clicking another key after the slider, holding both of them and + /// leaving tracking, then releasing both keys, then pressing the originally pressed key should start tracking + /// In a successful test case: + /// The last tick of the slider should be judged as a great. /// [Test] public void TestTrackingPressBeforeSliderClickingOtherKeyLeavingSliderReleaseThenTrackOriginal() @@ -298,8 +300,10 @@ namespace osu.Game.Rulesets.Osu.Tests } /// - /// Pressing a key before a slider, clicking another key after the slider, holding both of them and - /// leaving tracking, then releasing both keys, then pressing the originally pressed key should start tracking + /// Pressing a key before a slider, clicking another key after the slider, holding both of them and + /// leaving tracking, then releasing both keys, then pressing the originally pressed key should start tracking + /// In a successful test case: + /// The last tick of the slider should be judged as a great. /// [Test] public void TestClickingBeforeLeavingSliderReleasingClickingAgainThenTracking() From 3a57ff40cd03d2dfa72539ccdbad94d5f7e073f1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 21 Jan 2019 16:26:44 +0900 Subject: [PATCH 160/327] Add comment about other cases, rewind handling --- .../Objects/Drawables/Pieces/SliderBall.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index bff225eae7..2efc0678c7 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -157,15 +157,18 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces /// /// The point in time after which we can accept any key for tracking. Before this time, we may need to restrict tracking to the key used to hit the head circle. - /// This is a requirement to stop the case where a player holds down one key (from before the slider) and taps the second key while maintaining full scoring (tracking) of sliders. /// - /// Visually, if time is increasing from left to right: + /// This is a requirement to stop the case where a player holds down one key (from before the slider) and taps the second key while maintaining full scoring (tracking) of sliders. + /// Visually, this special case can be seen below (time increasing from left to right): /// /// Z Z+X Z /// o========o /// - /// Without this logic, tracking would continue through the entire slider even though no key hold is directly attributing to it. + /// Without this logic, tracking would continue through the entire slider even though no key hold action is directly attributing to it. /// + /// In all other cases, no special handling is required (either key being pressed is allowable as valid tracking). + /// + /// The reason for storing this as a time value (rather than a bool) is to correct handle rewind scenarios. /// private double? timeToAcceptAnyKeyAfter; From dfa34776a53895a6ca284389a5798f420a9e17e3 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 21 Jan 2019 16:27:44 +0900 Subject: [PATCH 161/327] Change ampersands in xmldoc --- osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index 747ed24a69..c0fd63f548 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -63,7 +63,7 @@ namespace osu.Game.Rulesets.Osu.Tests /// Pressing a key before a slider, pressing the other key on the slider head, then releasing the latter pressed key /// should result in tracking to end. /// Frame 1 (prior to slider): Left Click - /// Frame 2 (within slider hit window): Left & Right Click + /// Frame 2 (within slider hit window): Left & Right Click /// Frame 3 (while tracking): Left Click /// A passing test case will have the cursor lose tracking on frame 3. /// @@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Osu.Tests /// Hitting a slider head, pressing a new key after the initial hit, then letting go of the original key used to hit /// the slider should reslt in continued tracking. /// Frame 1: Left Click - /// Frame 2: Left & Right Click + /// Frame 2: Left & Right Click /// Frame 3: Right Click /// A passing test case will have the cursor continue to track after frame 3. /// @@ -117,7 +117,7 @@ namespace osu.Game.Rulesets.Osu.Tests /// Hitting a slider head, pressing a new key after the initial hit, then letting go of the new key should result /// in continue tracking, /// Frame 1: Left Click - /// Frame 2: Left & Right Click + /// Frame 2: Left & Right Click /// Frame 3: Left Click /// A passing test case will have the cursor continue to track after frame 3. /// @@ -144,7 +144,7 @@ namespace osu.Game.Rulesets.Osu.Tests /// Pressing a key before a slider, pressing the other key on the slider head, then releasing the former pressed key /// should result in continued tracking. /// Frame 1 (prior to slider): Left Click - /// Frame 2 (on slider head): Left & Right Click + /// Frame 2 (on slider head): Left & Right Click /// Frame 3 (tracking slider body): Right Click /// A passing test case will have the cursor continue to track after frame 3. /// From 5fdd7f9bff37298266aac572aa874f63ce494e76 Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Mon, 21 Jan 2019 16:43:23 +0900 Subject: [PATCH 162/327] Fix typo in comment Co-Authored-By: peppy --- osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 2efc0678c7..a8ee4c42fd 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -168,7 +168,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces /// /// In all other cases, no special handling is required (either key being pressed is allowable as valid tracking). /// - /// The reason for storing this as a time value (rather than a bool) is to correct handle rewind scenarios. + /// The reason for storing this as a time value (rather than a bool) is to correctly handle rewind scenarios. /// private double? timeToAcceptAnyKeyAfter; From cacefd5c6536831aaf0c382f9215b7c036231065 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 22 Jan 2019 00:54:22 +0900 Subject: [PATCH 163/327] Reword slider test xmldocs. --- .../TestCaseSliderInput.cs | 119 ++++++++++-------- 1 file changed, 67 insertions(+), 52 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index c0fd63f548..c3df821e1c 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -60,12 +60,12 @@ namespace osu.Game.Rulesets.Osu.Tests } /// - /// Pressing a key before a slider, pressing the other key on the slider head, then releasing the latter pressed key - /// should result in tracking to end. - /// Frame 1 (prior to slider): Left Click - /// Frame 2 (within slider hit window): Left & Right Click - /// Frame 3 (while tracking): Left Click - /// A passing test case will have the cursor lose tracking on frame 3. + /// Scenario: + /// - Press a key before a slider starts + /// - Press the other key on the slider head timed correctly while holding the original key + /// - Release the latter pressed key + /// Expected Result: + /// A passing test case will have the cursor lose tracking on frame 3. /// [Test] public void TestLeftBeforeSliderThenRight() @@ -87,12 +87,12 @@ namespace osu.Game.Rulesets.Osu.Tests } /// - /// Hitting a slider head, pressing a new key after the initial hit, then letting go of the original key used to hit - /// the slider should reslt in continued tracking. - /// Frame 1: Left Click - /// Frame 2: Left & Right Click - /// Frame 3: Right Click - /// A passing test case will have the cursor continue to track after frame 3. + /// Scenario: + /// - Press a key on the slider head timed correctly + /// - Press the other key in the middle of the slider while holding the original key + /// - Release the original key used to hit the slider + /// Expected Result: + /// A passing test case will have the cursor continue tracking on frame 3. /// [Test] public void TestLeftBeforeSliderThenRightThenLettingGoOfLeft() @@ -114,12 +114,12 @@ namespace osu.Game.Rulesets.Osu.Tests } /// - /// Hitting a slider head, pressing a new key after the initial hit, then letting go of the new key should result - /// in continue tracking, - /// Frame 1: Left Click - /// Frame 2: Left & Right Click - /// Frame 3: Left Click - /// A passing test case will have the cursor continue to track after frame 3. + /// Scenario: + /// - Press a key on the slider head timed correctly + /// - Press the other key in the middle of the slider while holding the original key + /// - Release the new key that was pressed second + /// Expected Result: + /// A passing test case will have the cursor continue tracking on frame 3. /// [Test] public void TestTrackingRetentionLeftRightLeft() @@ -141,12 +141,12 @@ namespace osu.Game.Rulesets.Osu.Tests } /// - /// Pressing a key before a slider, pressing the other key on the slider head, then releasing the former pressed key - /// should result in continued tracking. - /// Frame 1 (prior to slider): Left Click - /// Frame 2 (on slider head): Left & Right Click - /// Frame 3 (tracking slider body): Right Click - /// A passing test case will have the cursor continue to track after frame 3. + /// Scenario: + /// - Press a key before a slider starts + /// - Press the other key on the slider head timed correctly while holding the original key + /// - Release the key that was held down before the slider started. + /// Expected Result: + /// A passing test case will have the cursor continue tracking on frame 3 /// [Test] public void TestTrackingLeftBeforeSliderToRight() @@ -168,12 +168,11 @@ namespace osu.Game.Rulesets.Osu.Tests } /// - /// Pressing a key before a slider and holding the slider throughout the body should result in tracking, but a miss on the slider head. - /// Only one frame is required: - /// Frame 1: Left Click - /// In a successful test case: - /// The head of the slider should be judged as a miss. - /// The slider end should be judged as a meh. + /// Scenario: + /// - Press a key before a slider starts + /// - Hold the key down throughout the slider without pressing any other buttons. + /// Expected Result: + /// A passing test case will have the cursor track the slider, but miss the slider head. /// [Test] public void TestTrackingPreclicked() @@ -193,11 +192,13 @@ namespace osu.Game.Rulesets.Osu.Tests } /// - /// Hitting a slider head, leaving the slider, then coming back into the slider with the same button to track it should re-start tracking. - /// Only one frame is required: - /// Frame 1: Left Click - /// In a successful test case: - /// The last tick of the slider should be judged as a great. + /// Scenario: + /// - Press a key before a slider starts + /// - Hold the key down after the slider starts + /// - Move the cursor away from the slider body + /// - Move the cursor back onto the body + /// Expected Result: + /// A passing test case will have the cursor track the slider, miss the head, miss the ticks where its outside of the body, and resume tracking when the cursor returns. /// [Test] public void TestTrackingReturnMidSlider() @@ -221,10 +222,14 @@ namespace osu.Game.Rulesets.Osu.Tests } /// - /// Pressing a key before a slider, hitting a slider head, leaving the slider, then coming back into the slider to track it should NOT start retracking - /// This is current stable behavior. - /// In a successful test case: - /// The last tick of the slider should be judged as a miss. + /// Scenario: + /// - Press a key before a slider starts + /// - Press the other key on the slider head timed correctly while holding the original key + /// - Release the key used to hit the slider head + /// - While holding the first key, move the cursor away from the slider body + /// - Still holding the first key, move the cursor back to the slider body + /// Expected Result: + /// A passing test case will have the slider not track despite having the cursor return to the slider body. /// [Test] public void TestTrackingReturnMidSliderKeyDownBefore() @@ -249,9 +254,12 @@ namespace osu.Game.Rulesets.Osu.Tests } /// - /// Halfway into a slider outside of the slider, then starting to hover the slider afterwards should result in tracking - /// In a successful test case: - /// The last tick of the slider should be judged as a great. + /// Scenario: + /// - Wait for the slider to reach a mid-point + /// - Press a key away from the slider body + /// - While holding down the key, move into the slider body + /// Expected Result: + /// A passing test case will have the slider track the cursor after the cursor enters the slider body. /// [Test] public void TestTrackingMidSlider() @@ -274,13 +282,16 @@ namespace osu.Game.Rulesets.Osu.Tests } /// - /// Pressing a key before a slider, clicking another key after the slider, holding both of them and - /// leaving tracking, then releasing both keys, then pressing the originally pressed key should start tracking - /// In a successful test case: - /// The last tick of the slider should be judged as a great. + /// Scenario: + /// - Press a key before the slider starts + /// - Press another key on the slider head while holding the original key + /// - Move out of the slider body while releasing the two pressed keys + /// - Move back into the slider body while pressing any key. + /// Expected Result: + /// A passing test case will have the slider track the cursor after the cursor enters the slider body. /// [Test] - public void TestTrackingPressBeforeSliderClickingOtherKeyLeavingSliderReleaseThenTrackOriginal() + public void TestTrackingReleasedKeys() { AddStep("Mid-slider new tracking acquisition", () => { @@ -300,13 +311,17 @@ namespace osu.Game.Rulesets.Osu.Tests } /// - /// Pressing a key before a slider, clicking another key after the slider, holding both of them and - /// leaving tracking, then releasing both keys, then pressing the originally pressed key should start tracking - /// In a successful test case: - /// The last tick of the slider should be judged as a great. + /// Scenario: + /// - Press a key on the slider head + /// - While holding the key, move outside of the slider body with the cursor + /// - Release the key while outside of the slider body + /// - Press the key again while outside of the slider body + /// - Move back into the slider body while holding the pressed key + /// Expected Result: + /// A passing test case will have the slider track the cursor after the cursor enters the slider body. /// [Test] - public void TestClickingBeforeLeavingSliderReleasingClickingAgainThenTracking() + public void TestTrackingReleasedValidKey() { AddStep("Mid-slider new tracking acquisition", () => { From a2613e6279437f0d40a09c24cba8bd39d1d641d5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 22 Jan 2019 10:47:11 +0900 Subject: [PATCH 164/327] Formatting and constants --- .../TestCaseSliderInput.cs | 114 +++++++++--------- 1 file changed, 60 insertions(+), 54 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index c3df821e1c..a591d260a6 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -59,13 +59,20 @@ namespace osu.Game.Rulesets.Osu.Tests base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); } + private const double time_before_slider = 250; + private const double time_slider_start = 1500; + private const double time_during_slide_1 = 2500; + private const double time_during_slide_2 = 3000; + private const double time_during_slide_3 = 3500; + private const double time_during_slide_4 = 4000; + /// /// Scenario: /// - Press a key before a slider starts /// - Press the other key on the slider head timed correctly while holding the original key /// - Release the latter pressed key /// Expected Result: - /// A passing test case will have the cursor lose tracking on frame 3. + /// A passing test case will have the cursor lose tracking on replay frame 3. /// [Test] public void TestLeftBeforeSliderThenRight() @@ -74,12 +81,12 @@ namespace osu.Game.Rulesets.Osu.Tests { var frames = new List { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 250}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = 1500}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 2500}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, }; - performStaticInputTest(frames); + performTest(frames); }); AddUntilStep(() => allJudgedFired, "Wait for test 1"); @@ -92,7 +99,7 @@ namespace osu.Game.Rulesets.Osu.Tests /// - Press the other key in the middle of the slider while holding the original key /// - Release the original key used to hit the slider /// Expected Result: - /// A passing test case will have the cursor continue tracking on frame 3. + /// A passing test case will have the cursor continue tracking on replay frame 3. /// [Test] public void TestLeftBeforeSliderThenRightThenLettingGoOfLeft() @@ -101,12 +108,12 @@ namespace osu.Game.Rulesets.Osu.Tests { var frames = new List { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 1500}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = 2500}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = 3500}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_during_slide_1 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = time_during_slide_2 }, }; - performStaticInputTest(frames); + performTest(frames); }); AddUntilStep(() => allJudgedFired, "Wait for test 2"); @@ -119,7 +126,7 @@ namespace osu.Game.Rulesets.Osu.Tests /// - Press the other key in the middle of the slider while holding the original key /// - Release the new key that was pressed second /// Expected Result: - /// A passing test case will have the cursor continue tracking on frame 3. + /// A passing test case will have the cursor continue tracking on replay frame 3. /// [Test] public void TestTrackingRetentionLeftRightLeft() @@ -128,12 +135,12 @@ namespace osu.Game.Rulesets.Osu.Tests { var frames = new List { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 250}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = 1500}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = 2500}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = time_during_slide_1 }, }; - performStaticInputTest(frames); + performTest(frames); }); AddUntilStep(() => allJudgedFired, "Wait for test 3"); @@ -146,7 +153,7 @@ namespace osu.Game.Rulesets.Osu.Tests /// - Press the other key on the slider head timed correctly while holding the original key /// - Release the key that was held down before the slider started. /// Expected Result: - /// A passing test case will have the cursor continue tracking on frame 3 + /// A passing test case will have the cursor continue tracking on replay frame 3 /// [Test] public void TestTrackingLeftBeforeSliderToRight() @@ -155,12 +162,12 @@ namespace osu.Game.Rulesets.Osu.Tests { var frames = new List { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 250}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = 1500}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = 2500}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = time_during_slide_1 }, }; - performStaticInputTest(frames); + performTest(frames); }); AddUntilStep(() => allJudgedFired, "Wait for test 4"); @@ -181,10 +188,10 @@ namespace osu.Game.Rulesets.Osu.Tests { var frames = new List { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 250}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, }; - performStaticInputTest(frames); + performTest(frames); }); AddUntilStep(() => allJudgedFired, "Wait for test 5"); @@ -207,14 +214,14 @@ namespace osu.Game.Rulesets.Osu.Tests { var frames = new List { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 1500}, - new OsuReplayFrame { Position = new Vector2(150, 150), Actions = { OsuAction.LeftButton }, Time = 2000}, - new OsuReplayFrame { Position = new Vector2(200, 200), Actions = { OsuAction.LeftButton }, Time = 2500}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 3000}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 3500}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(150, 150), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, + new OsuReplayFrame { Position = new Vector2(200, 200), Actions = { OsuAction.LeftButton }, Time = time_during_slide_2 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_3 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_4 }, }; - performStaticInputTest(frames); + performTest(frames); }); AddUntilStep(() => allJudgedFired, "Wait for test 6"); @@ -238,15 +245,15 @@ namespace osu.Game.Rulesets.Osu.Tests { var frames = new List { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 250}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = 1500}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 2000}, - new OsuReplayFrame { Position = new Vector2(200, 200), Actions = { OsuAction.LeftButton }, Time = 2500}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 3000}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 3500}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, + new OsuReplayFrame { Position = new Vector2(200, 200), Actions = { OsuAction.LeftButton }, Time = time_during_slide_2 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_3 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_4 }, }; - performStaticInputTest(frames); + performTest(frames); }); AddUntilStep(() => allJudgedFired, "Wait for test 7"); @@ -268,13 +275,13 @@ namespace osu.Game.Rulesets.Osu.Tests { var frames = new List { - new OsuReplayFrame { Position = new Vector2(150, 150), Actions = { OsuAction.LeftButton }, Time = 2000}, - new OsuReplayFrame { Position = new Vector2(200, 200), Actions = { OsuAction.LeftButton }, Time = 2500}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 3000}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 3500}, + new OsuReplayFrame { Position = new Vector2(150, 150), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, + new OsuReplayFrame { Position = new Vector2(200, 200), Actions = { OsuAction.LeftButton }, Time = time_during_slide_2 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_3 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_4 }, }; - performStaticInputTest(frames); + performTest(frames); }); AddUntilStep(() => allJudgedFired, "Wait for test 8"); @@ -297,13 +304,13 @@ namespace osu.Game.Rulesets.Osu.Tests { var frames = new List { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 250}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = 1500}, - new OsuReplayFrame { Position = new Vector2(100, 100), Time = 1750}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 3500}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(100, 100), Time = time_during_slide_1 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_2 }, }; - performStaticInputTest(frames); + performTest(frames); }); AddUntilStep(() => allJudgedFired, "Wait for test 9"); @@ -327,14 +334,14 @@ namespace osu.Game.Rulesets.Osu.Tests { var frames = new List { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 1500}, - new OsuReplayFrame { Position = new Vector2(100, 100), Actions = { OsuAction.LeftButton }, Time = 2500}, - new OsuReplayFrame { Position = new Vector2(100, 100), Time = 2750}, - new OsuReplayFrame { Position = new Vector2(100, 100), Actions = { OsuAction.LeftButton }, Time = 3000}, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = 3500}, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(100, 100), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, + new OsuReplayFrame { Position = new Vector2(100, 100), Time = time_during_slide_2 }, + new OsuReplayFrame { Position = new Vector2(100, 100), Actions = { OsuAction.LeftButton }, Time = time_during_slide_3 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_4 }, }; - performStaticInputTest(frames); + performTest(frames); }); AddUntilStep(() => allJudgedFired, "Wait for test 10"); @@ -366,11 +373,11 @@ namespace osu.Game.Rulesets.Osu.Tests return judgementResults[judgementResults.Count - 2].Type == HitResult.Miss; } - private void performStaticInputTest(List frames) + private void performTest(List frames) { var slider = new Slider { - StartTime = 1500, + StartTime = time_slider_start, Position = new Vector2(0, 0), Path = new SliderPath(PathType.PerfectCurve, new[] { @@ -408,7 +415,6 @@ namespace osu.Game.Rulesets.Osu.Tests Child = player; player.ScoreProcessor.NewJudgement += result => judgementResults.Add(result); - player.ScoreProcessor.AllJudged += () => { allJudgedFired = true; }; } From 927b0375fd068a8b64966a94e9a94c7cfd4ecf81 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 22 Jan 2019 10:49:25 +0900 Subject: [PATCH 165/327] Use schedule for *all* setup --- osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index a591d260a6..0048d08d1e 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -42,11 +42,10 @@ namespace osu.Game.Rulesets.Osu.Tests }; [SetUp] - public void Setup() + public void Setup() => Schedule(() => { - Schedule(() => { allJudgedFired = false; }); + allJudgedFired = false; judgementResults = new List(); - } private readonly Container content; protected override Container Content => content; From f79ce6a7f194b7a11b6fa4fbb89b03914b09d897 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 22 Jan 2019 10:49:54 +0900 Subject: [PATCH 166/327] Remove unnecessary content override --- .../TestCaseSliderInput.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index 0048d08d1e..67b1f634cb 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -5,8 +5,6 @@ using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Replays; @@ -46,18 +44,11 @@ namespace osu.Game.Rulesets.Osu.Tests { allJudgedFired = false; judgementResults = new List(); - - private readonly Container content; - protected override Container Content => content; + }); private List judgementResults; private bool allJudgedFired; - public TestCaseSliderInput() - { - base.Content.Add(content = new OsuInputManager(new RulesetInfo { ID = 0 })); - } - private const double time_before_slider = 250; private const double time_slider_start = 1500; private const double time_during_slide_1 = 2500; @@ -411,7 +402,10 @@ namespace osu.Game.Rulesets.Osu.Tests AllowResults = false }; - Child = player; + Child = new OsuInputManager(new RulesetInfo { ID = 0 }) + { + Child = player + }; player.ScoreProcessor.NewJudgement += result => judgementResults.Add(result); player.ScoreProcessor.AllJudged += () => { allJudgedFired = true; }; From 147a9c244038c649168d417c3ff6235ef7edbd9b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 22 Jan 2019 10:56:04 +0900 Subject: [PATCH 167/327] Fix dynamic compilation failing --- osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index 67b1f634cb..5232fbfa7f 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -30,13 +30,18 @@ namespace osu.Game.Rulesets.Osu.Tests public override IReadOnlyList RequiredTypes => new[] { typeof(Slider), + typeof(SliderCircle), typeof(SliderBall), typeof(SliderBody), typeof(SliderTick), + typeof(SliderTailCircle), typeof(DrawableSlider), + typeof(SnakingSliderBody), typeof(DrawableSliderTick), typeof(DrawableRepeatPoint), - typeof(DrawableOsuHitObject) + typeof(DrawableOsuHitObject), + typeof(DrawableSliderHead), + typeof(DrawableSliderTail) }; [SetUp] From 8e09c66cbb6fd21758079c9948e431e0f12c058b Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 24 Jan 2019 14:42:09 +0900 Subject: [PATCH 168/327] Split out testcase player for use in slider input tests --- .../TestCaseSliderInput.cs | 2 +- osu.Game/Tests/Visual/TestCasePlayer.cs | 10 +--------- osu.Game/Tests/Visual/TestCasePlayerBase.cs | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 osu.Game/Tests/Visual/TestCasePlayerBase.cs diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index 5232fbfa7f..cc97947dc3 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -25,7 +25,7 @@ using osuTK; namespace osu.Game.Rulesets.Osu.Tests { - public class TestCaseSliderInput : OsuTestCase + public class TestCaseSliderInput : TestCasePlayerBase { public override IReadOnlyList RequiredTypes => new[] { diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs index 60b630513a..34f0bfab8c 100644 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ b/osu.Game/Tests/Visual/TestCasePlayer.cs @@ -16,7 +16,7 @@ using osuTK.Graphics; namespace osu.Game.Tests.Visual { - public abstract class TestCasePlayer : ScreenTestCase + public abstract class TestCasePlayer : TestCasePlayerBase { private readonly Ruleset ruleset; @@ -121,14 +121,6 @@ namespace osu.Game.Tests.Visual return player; } - protected override void Update() - { - base.Update(); - - // note that this will override any mod rate application - Beatmap.Value.Track.Rate = Clock.Rate; - } - protected virtual Player CreatePlayer(Ruleset ruleset) => new Player { AllowPause = false, diff --git a/osu.Game/Tests/Visual/TestCasePlayerBase.cs b/osu.Game/Tests/Visual/TestCasePlayerBase.cs new file mode 100644 index 0000000000..cf5f733d20 --- /dev/null +++ b/osu.Game/Tests/Visual/TestCasePlayerBase.cs @@ -0,0 +1,16 @@ +// Copyright (c) 2007-2019 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +namespace osu.Game.Tests.Visual +{ + public class TestCasePlayerBase : ScreenTestCase + { + protected override void Update() + { + base.Update(); + + // note that this will override any mod rate application + Beatmap.Value.Track.Rate = Clock.Rate; + } + } +} From 1fdb8ca37acc5c5567244279154b81efc6ec785d Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 24 Jan 2019 14:46:36 +0900 Subject: [PATCH 169/327] Fix auto-generated lisence header --- osu.Game/Tests/Visual/TestCasePlayerBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Tests/Visual/TestCasePlayerBase.cs b/osu.Game/Tests/Visual/TestCasePlayerBase.cs index cf5f733d20..99489b2933 100644 --- a/osu.Game/Tests/Visual/TestCasePlayerBase.cs +++ b/osu.Game/Tests/Visual/TestCasePlayerBase.cs @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2019 ppy Pty Ltd . +// Copyright (c) 2007-2018 ppy Pty Ltd . // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE namespace osu.Game.Tests.Visual From 8b7cc2eaa28993ce8da17de284e3a25cc7b7ebac Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 24 Jan 2019 15:01:45 +0900 Subject: [PATCH 170/327] Re-order tests --- .../TestCaseSliderInput.cs | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index cc97947dc3..a7fc705b30 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -61,33 +61,6 @@ namespace osu.Game.Rulesets.Osu.Tests private const double time_during_slide_3 = 3500; private const double time_during_slide_4 = 4000; - /// - /// Scenario: - /// - Press a key before a slider starts - /// - Press the other key on the slider head timed correctly while holding the original key - /// - Release the latter pressed key - /// Expected Result: - /// A passing test case will have the cursor lose tracking on replay frame 3. - /// - [Test] - public void TestLeftBeforeSliderThenRight() - { - AddStep("Invalid key transfer test", () => - { - var frames = new List - { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, - }; - - performTest(frames); - }); - - AddUntilStep(() => allJudgedFired, "Wait for test 1"); - AddAssert("Tracking lost", assertMehJudge); - } - /// /// Scenario: /// - Press a key on the slider head timed correctly @@ -111,10 +84,37 @@ namespace osu.Game.Rulesets.Osu.Tests performTest(frames); }); - AddUntilStep(() => allJudgedFired, "Wait for test 2"); + AddUntilStep(() => allJudgedFired, "Wait for test 1"); AddAssert("Tracking retained", assertGreatJudge); } + /// + /// Scenario: + /// - Press a key before a slider starts + /// - Press the other key on the slider head timed correctly while holding the original key + /// - Release the latter pressed key + /// Expected Result: + /// A passing test case will have the cursor lose tracking on replay frame 3. + /// + [Test] + public void TestLeftBeforeSliderThenRight() + { + AddStep("Invalid key transfer test", () => + { + var frames = new List + { + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, + }; + + performTest(frames); + }); + + AddUntilStep(() => allJudgedFired, "Wait for test 2"); + AddAssert("Tracking lost", assertMehJudge); + } + /// /// Scenario: /// - Press a key on the slider head timed correctly From 837b4f4f6cd50222a367216f931173ef2b12f2ca Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 24 Jan 2019 15:52:20 +0900 Subject: [PATCH 171/327] Fix input tests not using async loads --- .../TestCaseSliderInput.cs | 64 +++++++++---------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index a7fc705b30..9ce1599fb4 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -61,33 +61,6 @@ namespace osu.Game.Rulesets.Osu.Tests private const double time_during_slide_3 = 3500; private const double time_during_slide_4 = 4000; - /// - /// Scenario: - /// - Press a key on the slider head timed correctly - /// - Press the other key in the middle of the slider while holding the original key - /// - Release the original key used to hit the slider - /// Expected Result: - /// A passing test case will have the cursor continue tracking on replay frame 3. - /// - [Test] - public void TestLeftBeforeSliderThenRightThenLettingGoOfLeft() - { - AddStep("Left to both to right test", () => - { - var frames = new List - { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_during_slide_1 }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = time_during_slide_2 }, - }; - - performTest(frames); - }); - - AddUntilStep(() => allJudgedFired, "Wait for test 1"); - AddAssert("Tracking retained", assertGreatJudge); - } - /// /// Scenario: /// - Press a key before a slider starts @@ -115,6 +88,33 @@ namespace osu.Game.Rulesets.Osu.Tests AddAssert("Tracking lost", assertMehJudge); } + /// + /// Scenario: + /// - Press a key on the slider head timed correctly + /// - Press the other key in the middle of the slider while holding the original key + /// - Release the original key used to hit the slider + /// Expected Result: + /// A passing test case will have the cursor continue tracking on replay frame 3. + /// + [Test] + public void TestLeftBeforeSliderThenRightThenLettingGoOfLeft() + { + AddStep("Left to both to right test", () => + { + var frames = new List + { + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_during_slide_1 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = time_during_slide_2 }, + }; + + performTest(frames); + }); + + AddUntilStep(() => allJudgedFired, "Wait for test 1"); + AddAssert("Tracking retained", assertGreatJudge); + } + /// /// Scenario: /// - Press a key on the slider head timed correctly @@ -407,13 +407,13 @@ namespace osu.Game.Rulesets.Osu.Tests AllowResults = false }; - Child = new OsuInputManager(new RulesetInfo { ID = 0 }) + LoadComponentAsync(player, p => { - Child = player - }; + Child = p; - player.ScoreProcessor.NewJudgement += result => judgementResults.Add(result); - player.ScoreProcessor.AllJudged += () => { allJudgedFired = true; }; + p.ScoreProcessor.NewJudgement += result => judgementResults.Add(result); + p.ScoreProcessor.AllJudged += () => { allJudgedFired = true; }; + }); } private class ScoreAccessibleReplayPlayer : ReplayPlayer From d413d1ef1b4022d2d5fda1f6ce52ecce0b6294b9 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 24 Jan 2019 16:07:40 +0900 Subject: [PATCH 172/327] re-order tests again --- .../TestCaseSliderInput.cs | 55 +++++++++---------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index 9ce1599fb4..6e5afe4774 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -61,33 +61,6 @@ namespace osu.Game.Rulesets.Osu.Tests private const double time_during_slide_3 = 3500; private const double time_during_slide_4 = 4000; - /// - /// Scenario: - /// - Press a key before a slider starts - /// - Press the other key on the slider head timed correctly while holding the original key - /// - Release the latter pressed key - /// Expected Result: - /// A passing test case will have the cursor lose tracking on replay frame 3. - /// - [Test] - public void TestLeftBeforeSliderThenRight() - { - AddStep("Invalid key transfer test", () => - { - var frames = new List - { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, - }; - - performTest(frames); - }); - - AddUntilStep(() => allJudgedFired, "Wait for test 2"); - AddAssert("Tracking lost", assertMehJudge); - } - /// /// Scenario: /// - Press a key on the slider head timed correctly @@ -115,6 +88,33 @@ namespace osu.Game.Rulesets.Osu.Tests AddAssert("Tracking retained", assertGreatJudge); } + /// + /// Scenario: + /// - Press a key before a slider starts + /// - Press the other key on the slider head timed correctly while holding the original key + /// - Release the latter pressed key + /// Expected Result: + /// A passing test case will have the cursor lose tracking on replay frame 3. + /// + [Test] + public void TestLeftBeforeSliderThenRight() + { + AddStep("Invalid key transfer test", () => + { + var frames = new List + { + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, + }; + + performTest(frames); + }); + + AddUntilStep(() => allJudgedFired, "Wait for test 2"); + AddAssert("Tracking lost", assertMehJudge); + } + /// /// Scenario: /// - Press a key on the slider head timed correctly @@ -410,7 +410,6 @@ namespace osu.Game.Rulesets.Osu.Tests LoadComponentAsync(player, p => { Child = p; - p.ScoreProcessor.NewJudgement += result => judgementResults.Add(result); p.ScoreProcessor.AllJudged += () => { allJudgedFired = true; }; }); From 1f93fde2460cd9a53c402dfb1a836e735bafeb1a Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 24 Jan 2019 16:56:42 +0900 Subject: [PATCH 173/327] Check for beatmap load state before performing test --- .../TestCaseSliderInput.cs | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index 6e5afe4774..48b563f45f 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -49,6 +49,7 @@ namespace osu.Game.Rulesets.Osu.Tests { allJudgedFired = false; judgementResults = new List(); + loadBeatmap(); }); private List judgementResults; @@ -72,6 +73,7 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestLeftBeforeSliderThenRightThenLettingGoOfLeft() { + AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Left to both to right test", () => { var frames = new List @@ -99,6 +101,7 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestLeftBeforeSliderThenRight() { + AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Invalid key transfer test", () => { var frames = new List @@ -126,6 +129,7 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingRetentionLeftRightLeft() { + AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Tracking retention test", () => { var frames = new List @@ -153,6 +157,7 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingLeftBeforeSliderToRight() { + AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Tracking retention test", () => { var frames = new List @@ -179,6 +184,7 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingPreclicked() { + AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Tracking retention test", () => { var frames = new List @@ -205,6 +211,7 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingReturnMidSlider() { + AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Mid-sldier tracking re-acquisition", () => { var frames = new List @@ -236,6 +243,7 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingReturnMidSliderKeyDownBefore() { + AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Key held down before slider, mid-slider tracking re-acquisition", () => { var frames = new List @@ -266,6 +274,7 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingMidSlider() { + AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Mid-slider new tracking acquisition", () => { var frames = new List @@ -295,6 +304,7 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingReleasedKeys() { + AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Mid-slider new tracking acquisition", () => { var frames = new List @@ -325,6 +335,7 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingReleasedValidKey() { + AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Mid-slider new tracking acquisition", () => { var frames = new List @@ -368,7 +379,7 @@ namespace osu.Game.Rulesets.Osu.Tests return judgementResults[judgementResults.Count - 2].Type == HitResult.Miss; } - private void performTest(List frames) + private void loadBeatmap() { var slider = new Slider { @@ -381,11 +392,6 @@ namespace osu.Game.Rulesets.Osu.Tests }, 25), }; - // Empty frame to be added as a workaround for first frame behavior. - // If an input exists on the first frame, the input would apply to the entire intro lead-in - // Likely requires some discussion regarding how first frame inputs should be handled. - frames.Insert(0, new OsuReplayFrame { Position = slider.Position, Time = 0, Actions = new List() }); - Beatmap.Value = new TestWorkingBeatmap(new Beatmap { HitObjects = { slider }, @@ -399,6 +405,14 @@ namespace osu.Game.Rulesets.Osu.Tests Ruleset = new OsuRuleset().RulesetInfo }, }); + } + + private void performTest(List frames) + { + // Empty frame to be added as a workaround for first frame behavior. + // If an input exists on the first frame, the input would apply to the entire intro lead-in + // Likely requires some discussion regarding how first frame inputs should be handled. + frames.Insert(0, new OsuReplayFrame { Position = new Vector2(0, 0), Time = 0, Actions = new List() }); var player = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } }) { From 4353002fde5ea34498b685d2b8f03cfdc24ef8a7 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 24 Jan 2019 18:24:13 +0900 Subject: [PATCH 174/327] Fix dynamic compilation, use slidertick judgements --- .../TestCaseSliderInput.cs | 87 +++++++++---------- 1 file changed, 42 insertions(+), 45 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index 48b563f45f..f1f7b076fd 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -29,19 +29,13 @@ namespace osu.Game.Rulesets.Osu.Tests { public override IReadOnlyList RequiredTypes => new[] { - typeof(Slider), - typeof(SliderCircle), typeof(SliderBall), - typeof(SliderBody), - typeof(SliderTick), - typeof(SliderTailCircle), typeof(DrawableSlider), - typeof(SnakingSliderBody), typeof(DrawableSliderTick), typeof(DrawableRepeatPoint), typeof(DrawableOsuHitObject), typeof(DrawableSliderHead), - typeof(DrawableSliderTail) + typeof(DrawableSliderTail), }; [SetUp] @@ -49,9 +43,14 @@ namespace osu.Game.Rulesets.Osu.Tests { allJudgedFired = false; judgementResults = new List(); - loadBeatmap(); }); + public TestCaseSliderInput() + { + loadBeatmap(); + } + + private List judgementResults; private bool allJudgedFired; @@ -62,34 +61,6 @@ namespace osu.Game.Rulesets.Osu.Tests private const double time_during_slide_3 = 3500; private const double time_during_slide_4 = 4000; - /// - /// Scenario: - /// - Press a key on the slider head timed correctly - /// - Press the other key in the middle of the slider while holding the original key - /// - Release the original key used to hit the slider - /// Expected Result: - /// A passing test case will have the cursor continue tracking on replay frame 3. - /// - [Test] - public void TestLeftBeforeSliderThenRightThenLettingGoOfLeft() - { - AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); - AddStep("Left to both to right test", () => - { - var frames = new List - { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_during_slide_1 }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = time_during_slide_2 }, - }; - - performTest(frames); - }); - - AddUntilStep(() => allJudgedFired, "Wait for test 1"); - AddAssert("Tracking retained", assertGreatJudge); - } - /// /// Scenario: /// - Press a key before a slider starts @@ -114,8 +85,36 @@ namespace osu.Game.Rulesets.Osu.Tests performTest(frames); }); + AddUntilStep(() => allJudgedFired, "Wait for test 1"); + AddAssert("Tracking lost", assertMidSliderJudgementFail); + } + + /// + /// Scenario: + /// - Press a key on the slider head timed correctly + /// - Press the other key in the middle of the slider while holding the original key + /// - Release the original key used to hit the slider + /// Expected Result: + /// A passing test case will have the cursor continue tracking on replay frame 3. + /// + [Test] + public void TestLeftBeforeSliderThenRightThenLettingGoOfLeft() + { + AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); + AddStep("Left to both to right test", () => + { + var frames = new List + { + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_during_slide_1 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = time_during_slide_2 }, + }; + + performTest(frames); + }); + AddUntilStep(() => allJudgedFired, "Wait for test 2"); - AddAssert("Tracking lost", assertMehJudge); + AddAssert("Tracking retained", assertGreatJudge); } /// @@ -196,7 +195,7 @@ namespace osu.Game.Rulesets.Osu.Tests }); AddUntilStep(() => allJudgedFired, "Wait for test 5"); - AddAssert("Tracking retained, sliderhead miss", assertHeadMissTailMeh); + AddAssert("Tracking retained, sliderhead miss", assertHeadMissTailTracked); } /// @@ -292,6 +291,7 @@ namespace osu.Game.Rulesets.Osu.Tests AddAssert("Tracking acquired", assertMidSliderJudgements); } + /// /// Scenario: /// - Press a key before the slider starts @@ -354,19 +354,14 @@ namespace osu.Game.Rulesets.Osu.Tests AddAssert("Tracking acquired", assertMidSliderJudgements); } - private bool assertMehJudge() - { - return judgementResults.Last().Type == HitResult.Meh; - } - private bool assertGreatJudge() { return judgementResults.Last().Type == HitResult.Great; } - private bool assertHeadMissTailMeh() + private bool assertHeadMissTailTracked() { - return judgementResults.Last().Type == HitResult.Meh && judgementResults.First().Type == HitResult.Miss; + return judgementResults[judgementResults.Count - 2].Type == HitResult.Great && judgementResults.First().Type == HitResult.Miss; } private bool assertMidSliderJudgements() @@ -379,6 +374,7 @@ namespace osu.Game.Rulesets.Osu.Tests return judgementResults[judgementResults.Count - 2].Type == HitResult.Miss; } + private void loadBeatmap() { var slider = new Slider @@ -392,6 +388,7 @@ namespace osu.Game.Rulesets.Osu.Tests }, 25), }; + Beatmap.Value = new TestWorkingBeatmap(new Beatmap { HitObjects = { slider }, From ebcc041ac835096dc8a51ba4405a1597bf03ad36 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 24 Jan 2019 18:27:16 +0900 Subject: [PATCH 175/327] Nuke whitespace --- osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index f1f7b076fd..c1bb1c4cb8 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -49,11 +49,9 @@ namespace osu.Game.Rulesets.Osu.Tests { loadBeatmap(); } - - private List judgementResults; private bool allJudgedFired; - + private const double time_before_slider = 250; private const double time_slider_start = 1500; private const double time_during_slide_1 = 2500; @@ -374,7 +372,6 @@ namespace osu.Game.Rulesets.Osu.Tests return judgementResults[judgementResults.Count - 2].Type == HitResult.Miss; } - private void loadBeatmap() { var slider = new Slider @@ -388,7 +385,6 @@ namespace osu.Game.Rulesets.Osu.Tests }, 25), }; - Beatmap.Value = new TestWorkingBeatmap(new Beatmap { HitObjects = { slider }, From 01c4671fc8d9eb84709db464480821b5e314f578 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 24 Jan 2019 18:45:43 +0900 Subject: [PATCH 176/327] phantom whitespace --- osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index c1bb1c4cb8..c1309fb6c6 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -49,9 +49,7 @@ namespace osu.Game.Rulesets.Osu.Tests { loadBeatmap(); } - private List judgementResults; - private bool allJudgedFired; - + private const double time_before_slider = 250; private const double time_slider_start = 1500; private const double time_during_slide_1 = 2500; @@ -59,6 +57,9 @@ namespace osu.Game.Rulesets.Osu.Tests private const double time_during_slide_3 = 3500; private const double time_during_slide_4 = 4000; + private List judgementResults; + private bool allJudgedFired; + /// /// Scenario: /// - Press a key before a slider starts From da922c603da63e742e4841bf9c6d43e4347d55c6 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 24 Jan 2019 18:51:48 +0900 Subject: [PATCH 177/327] Nuke whitespace again --- osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index c1309fb6c6..db10a1b069 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -59,7 +59,6 @@ namespace osu.Game.Rulesets.Osu.Tests private List judgementResults; private bool allJudgedFired; - /// /// Scenario: /// - Press a key before a slider starts From f5aaf13363f7797ae190c43c128168c8a5f3c113 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 24 Jan 2019 20:07:22 +0900 Subject: [PATCH 178/327] Move all beatmap initialization logic into constructor --- .../TestCaseSliderInput.cs | 53 +++++++++---------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index db10a1b069..073f327f9f 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -47,7 +47,30 @@ namespace osu.Game.Rulesets.Osu.Tests public TestCaseSliderInput() { - loadBeatmap(); + var slider = new Slider + { + StartTime = time_slider_start, + Position = new Vector2(0, 0), + Path = new SliderPath(PathType.PerfectCurve, new[] + { + Vector2.Zero, + new Vector2(25, 0), + }, 25), + }; + + Beatmap.Value = new TestWorkingBeatmap(new Beatmap + { + HitObjects = { slider }, + ControlPointInfo = + { + DifficultyPoints = { new DifficultyControlPoint { SpeedMultiplier = 0.1f } } + }, + BeatmapInfo = + { + BaseDifficulty = new BeatmapDifficulty { SliderTickRate = 3 }, + Ruleset = new OsuRuleset().RulesetInfo + }, + }); } private const double time_before_slider = 250; @@ -372,34 +395,6 @@ namespace osu.Game.Rulesets.Osu.Tests return judgementResults[judgementResults.Count - 2].Type == HitResult.Miss; } - private void loadBeatmap() - { - var slider = new Slider - { - StartTime = time_slider_start, - Position = new Vector2(0, 0), - Path = new SliderPath(PathType.PerfectCurve, new[] - { - Vector2.Zero, - new Vector2(25, 0), - }, 25), - }; - - Beatmap.Value = new TestWorkingBeatmap(new Beatmap - { - HitObjects = { slider }, - ControlPointInfo = - { - DifficultyPoints = { new DifficultyControlPoint { SpeedMultiplier = 0.1f } } - }, - BeatmapInfo = - { - BaseDifficulty = new BeatmapDifficulty { SliderTickRate = 3 }, - Ruleset = new OsuRuleset().RulesetInfo - }, - }); - } - private void performTest(List frames) { // Empty frame to be added as a workaround for first frame behavior. From d80424b1d61f2eb536da5415cc2e1acf3a41203a Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 24 Jan 2019 20:11:28 +0900 Subject: [PATCH 179/327] Remove load checks and place one in the constructor --- osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index 073f327f9f..43d4648e96 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -71,6 +71,8 @@ namespace osu.Game.Rulesets.Osu.Tests Ruleset = new OsuRuleset().RulesetInfo }, }); + + AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); } private const double time_before_slider = 250; @@ -93,7 +95,6 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestLeftBeforeSliderThenRight() { - AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Invalid key transfer test", () => { var frames = new List @@ -121,7 +122,6 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestLeftBeforeSliderThenRightThenLettingGoOfLeft() { - AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Left to both to right test", () => { var frames = new List @@ -149,7 +149,6 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingRetentionLeftRightLeft() { - AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Tracking retention test", () => { var frames = new List @@ -177,7 +176,6 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingLeftBeforeSliderToRight() { - AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Tracking retention test", () => { var frames = new List @@ -204,7 +202,6 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingPreclicked() { - AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Tracking retention test", () => { var frames = new List @@ -231,7 +228,6 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingReturnMidSlider() { - AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Mid-sldier tracking re-acquisition", () => { var frames = new List @@ -263,7 +259,6 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingReturnMidSliderKeyDownBefore() { - AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Key held down before slider, mid-slider tracking re-acquisition", () => { var frames = new List @@ -294,7 +289,6 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingMidSlider() { - AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Mid-slider new tracking acquisition", () => { var frames = new List @@ -325,7 +319,6 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingReleasedKeys() { - AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Mid-slider new tracking acquisition", () => { var frames = new List @@ -356,7 +349,6 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingReleasedValidKey() { - AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); AddStep("Mid-slider new tracking acquisition", () => { var frames = new List From d59ba8cfe9865267b9dc351dfc5d91ba7fadea34 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 25 Jan 2019 00:07:33 +0900 Subject: [PATCH 180/327] Rename base player test class to RateAdjustedBeatmap, refactor input tests --- .../TestCaseSliderInput.cs | 46 +++++++++---------- osu.Game/Tests/Visual/TestCasePlayer.cs | 2 +- ...Base.cs => TestCaseRateAdjustedBeatmap.cs} | 2 +- 3 files changed, 25 insertions(+), 25 deletions(-) rename osu.Game/Tests/Visual/{TestCasePlayerBase.cs => TestCaseRateAdjustedBeatmap.cs} (86%) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index 43d4648e96..aa83e324ca 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -25,7 +25,7 @@ using osuTK; namespace osu.Game.Rulesets.Osu.Tests { - public class TestCaseSliderInput : TestCasePlayerBase + public class TestCaseSliderInput : TestCaseRateAdjustedBeatmap { public override IReadOnlyList RequiredTypes => new[] { @@ -47,20 +47,18 @@ namespace osu.Game.Rulesets.Osu.Tests public TestCaseSliderInput() { - var slider = new Slider - { - StartTime = time_slider_start, - Position = new Vector2(0, 0), - Path = new SliderPath(PathType.PerfectCurve, new[] - { - Vector2.Zero, - new Vector2(25, 0), - }, 25), - }; - Beatmap.Value = new TestWorkingBeatmap(new Beatmap { - HitObjects = { slider }, + HitObjects = { new Slider + { + StartTime = time_slider_start, + Position = new Vector2(0, 0), + Path = new SliderPath(PathType.PerfectCurve, new[] + { + Vector2.Zero, + new Vector2(25, 0), + }, 25), + }}, ControlPointInfo = { DifficultyPoints = { new DifficultyControlPoint { SpeedMultiplier = 0.1f } } @@ -107,7 +105,7 @@ namespace osu.Game.Rulesets.Osu.Tests performTest(frames); }); - AddUntilStep(() => allJudgedFired, "Wait for test 1"); + waitForJudged(); AddAssert("Tracking lost", assertMidSliderJudgementFail); } @@ -134,7 +132,7 @@ namespace osu.Game.Rulesets.Osu.Tests performTest(frames); }); - AddUntilStep(() => allJudgedFired, "Wait for test 2"); + waitForJudged(); AddAssert("Tracking retained", assertGreatJudge); } @@ -161,7 +159,7 @@ namespace osu.Game.Rulesets.Osu.Tests performTest(frames); }); - AddUntilStep(() => allJudgedFired, "Wait for test 3"); + waitForJudged(); AddAssert("Tracking retained", assertGreatJudge); } @@ -188,7 +186,7 @@ namespace osu.Game.Rulesets.Osu.Tests performTest(frames); }); - AddUntilStep(() => allJudgedFired, "Wait for test 4"); + waitForJudged(); AddAssert("Tracking retained", assertGreatJudge); } @@ -212,7 +210,7 @@ namespace osu.Game.Rulesets.Osu.Tests performTest(frames); }); - AddUntilStep(() => allJudgedFired, "Wait for test 5"); + waitForJudged(); AddAssert("Tracking retained, sliderhead miss", assertHeadMissTailTracked); } @@ -242,7 +240,7 @@ namespace osu.Game.Rulesets.Osu.Tests performTest(frames); }); - AddUntilStep(() => allJudgedFired, "Wait for test 6"); + waitForJudged(); AddAssert("Tracking re-acquired", assertMidSliderJudgements); } @@ -274,7 +272,7 @@ namespace osu.Game.Rulesets.Osu.Tests performTest(frames); }); - AddUntilStep(() => allJudgedFired, "Wait for test 7"); + waitForJudged(); AddAssert("Tracking lost", assertMidSliderJudgementFail); } @@ -302,7 +300,7 @@ namespace osu.Game.Rulesets.Osu.Tests performTest(frames); }); - AddUntilStep(() => allJudgedFired, "Wait for test 8"); + waitForJudged(); AddAssert("Tracking acquired", assertMidSliderJudgements); } @@ -332,7 +330,7 @@ namespace osu.Game.Rulesets.Osu.Tests performTest(frames); }); - AddUntilStep(() => allJudgedFired, "Wait for test 9"); + waitForJudged(); AddAssert("Tracking acquired", assertMidSliderJudgements); } @@ -363,10 +361,12 @@ namespace osu.Game.Rulesets.Osu.Tests performTest(frames); }); - AddUntilStep(() => allJudgedFired, "Wait for test 10"); + waitForJudged(); AddAssert("Tracking acquired", assertMidSliderJudgements); } + private void waitForJudged() => AddUntilStep(() => allJudgedFired, "Wait for all judged"); + private bool assertGreatJudge() { return judgementResults.Last().Type == HitResult.Great; diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs index 34f0bfab8c..196f501c6f 100644 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ b/osu.Game/Tests/Visual/TestCasePlayer.cs @@ -16,7 +16,7 @@ using osuTK.Graphics; namespace osu.Game.Tests.Visual { - public abstract class TestCasePlayer : TestCasePlayerBase + public abstract class TestCasePlayer : TestCaseRateAdjustedBeatmap { private readonly Ruleset ruleset; diff --git a/osu.Game/Tests/Visual/TestCasePlayerBase.cs b/osu.Game/Tests/Visual/TestCaseRateAdjustedBeatmap.cs similarity index 86% rename from osu.Game/Tests/Visual/TestCasePlayerBase.cs rename to osu.Game/Tests/Visual/TestCaseRateAdjustedBeatmap.cs index 99489b2933..affb5f6778 100644 --- a/osu.Game/Tests/Visual/TestCasePlayerBase.cs +++ b/osu.Game/Tests/Visual/TestCaseRateAdjustedBeatmap.cs @@ -3,7 +3,7 @@ namespace osu.Game.Tests.Visual { - public class TestCasePlayerBase : ScreenTestCase + public class TestCaseRateAdjustedBeatmap : ScreenTestCase { protected override void Update() { From 3495aa645f44b67d4a5b7b95d49b957e050bdb6a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 Jan 2019 11:11:04 +0900 Subject: [PATCH 181/327] Update headers --- osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs | 4 ++-- osu.Game/Tests/Visual/TestCaseRateAdjustedBeatmap.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index aa83e324ca..bd81c65caf 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using System; using System.Collections.Generic; diff --git a/osu.Game/Tests/Visual/TestCaseRateAdjustedBeatmap.cs b/osu.Game/Tests/Visual/TestCaseRateAdjustedBeatmap.cs index affb5f6778..a7fd2885bd 100644 --- a/osu.Game/Tests/Visual/TestCaseRateAdjustedBeatmap.cs +++ b/osu.Game/Tests/Visual/TestCaseRateAdjustedBeatmap.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. namespace osu.Game.Tests.Visual { From 490fb86f9eca5f43625e816172049c87ced4aa96 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 Jan 2019 11:11:40 +0900 Subject: [PATCH 182/327] Make base class abstract and add documentation --- osu.Game/Tests/Visual/TestCaseRateAdjustedBeatmap.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Tests/Visual/TestCaseRateAdjustedBeatmap.cs b/osu.Game/Tests/Visual/TestCaseRateAdjustedBeatmap.cs index a7fd2885bd..4a9dfe2dfa 100644 --- a/osu.Game/Tests/Visual/TestCaseRateAdjustedBeatmap.cs +++ b/osu.Game/Tests/Visual/TestCaseRateAdjustedBeatmap.cs @@ -3,7 +3,10 @@ namespace osu.Game.Tests.Visual { - public class TestCaseRateAdjustedBeatmap : ScreenTestCase + /// + /// Test case which adjusts the beatmap's rate to match any speed adjustments in visual tests. + /// + public abstract class TestCaseRateAdjustedBeatmap : ScreenTestCase { protected override void Update() { From 2a544f66eae6e44ecc58aea4a8fe80aca94592e7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 Jan 2019 11:13:37 +0900 Subject: [PATCH 183/327] Formatting, ordering and simplification --- .../TestCaseSliderInput.cs | 56 ++++++++++--------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index bd81c65caf..a69c7ed66f 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -38,27 +38,33 @@ namespace osu.Game.Rulesets.Osu.Tests typeof(DrawableSliderTail), }; - [SetUp] - public void Setup() => Schedule(() => - { - allJudgedFired = false; - judgementResults = new List(); - }); + private const double time_before_slider = 250; + private const double time_slider_start = 1500; + private const double time_during_slide_1 = 2500; + private const double time_during_slide_2 = 3000; + private const double time_during_slide_3 = 3500; + private const double time_during_slide_4 = 4000; + + private List judgementResults; + private bool allJudgedFired; public TestCaseSliderInput() { Beatmap.Value = new TestWorkingBeatmap(new Beatmap { - HitObjects = { new Slider + HitObjects = { - StartTime = time_slider_start, - Position = new Vector2(0, 0), - Path = new SliderPath(PathType.PerfectCurve, new[] + new Slider { - Vector2.Zero, - new Vector2(25, 0), - }, 25), - }}, + StartTime = time_slider_start, + Position = new Vector2(0, 0), + Path = new SliderPath(PathType.PerfectCurve, new[] + { + Vector2.Zero, + new Vector2(25, 0), + }, 25), + } + }, ControlPointInfo = { DifficultyPoints = { new DifficultyControlPoint { SpeedMultiplier = 0.1f } } @@ -73,15 +79,13 @@ namespace osu.Game.Rulesets.Osu.Tests AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); } - private const double time_before_slider = 250; - private const double time_slider_start = 1500; - private const double time_during_slide_1 = 2500; - private const double time_during_slide_2 = 3000; - private const double time_during_slide_3 = 3500; - private const double time_during_slide_4 = 4000; + [SetUp] + public void Setup() => Schedule(() => + { + allJudgedFired = false; + judgementResults = new List(); + }); - private List judgementResults; - private bool allJudgedFired; /// /// Scenario: /// - Press a key before a slider starts @@ -392,16 +396,14 @@ namespace osu.Game.Rulesets.Osu.Tests // Empty frame to be added as a workaround for first frame behavior. // If an input exists on the first frame, the input would apply to the entire intro lead-in // Likely requires some discussion regarding how first frame inputs should be handled. - frames.Insert(0, new OsuReplayFrame { Position = new Vector2(0, 0), Time = 0, Actions = new List() }); + frames.Insert(0, new OsuReplayFrame()); - var player = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } }) + LoadComponentAsync(new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } }) { AllowPause = false, AllowLeadIn = false, AllowResults = false - }; - - LoadComponentAsync(player, p => + }, p => { Child = p; p.ScoreProcessor.NewJudgement += result => judgementResults.Add(result); From e9a22a5c5ddad80d74d9e5c755d2b2e7c268bafc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 25 Jan 2019 11:15:31 +0900 Subject: [PATCH 184/327] Not sure what a bm is --- osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index a69c7ed66f..79fd732013 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -76,7 +76,7 @@ namespace osu.Game.Rulesets.Osu.Tests }, }); - AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait for bm load"); + AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait until beatmap is loaded"); } [SetUp] From 2bd75fd8aebb07236bf19c21a90de3d78eb4e76f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Feb 2019 10:39:39 +0900 Subject: [PATCH 185/327] Fix some huge oversights --- .../TestCaseSliderInput.cs | 205 ++++++------------ 1 file changed, 66 insertions(+), 139 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index 79fd732013..71c667f114 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -75,17 +75,8 @@ namespace osu.Game.Rulesets.Osu.Tests Ruleset = new OsuRuleset().RulesetInfo }, }); - - AddUntilStep(() => Beatmap.Value.BeatmapLoaded, "Wait until beatmap is loaded"); } - [SetUp] - public void Setup() => Schedule(() => - { - allJudgedFired = false; - judgementResults = new List(); - }); - /// /// Scenario: /// - Press a key before a slider starts @@ -95,21 +86,15 @@ namespace osu.Game.Rulesets.Osu.Tests /// A passing test case will have the cursor lose tracking on replay frame 3. /// [Test] - public void TestLeftBeforeSliderThenRight() + public void TestInvalidKeyTransfer() { - AddStep("Invalid key transfer test", () => + performTest(new List { - var frames = new List - { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, - }; - - performTest(frames); + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, }); - waitForJudged(); AddAssert("Tracking lost", assertMidSliderJudgementFail); } @@ -124,19 +109,13 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestLeftBeforeSliderThenRightThenLettingGoOfLeft() { - AddStep("Left to both to right test", () => + performTest(new List { - var frames = new List - { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_during_slide_1 }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = time_during_slide_2 }, - }; - - performTest(frames); + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_during_slide_1 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = time_during_slide_2 }, }); - waitForJudged(); AddAssert("Tracking retained", assertGreatJudge); } @@ -151,19 +130,13 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingRetentionLeftRightLeft() { - AddStep("Tracking retention test", () => + performTest(new List { - var frames = new List - { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = time_during_slide_1 }, - }; - - performTest(frames); + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = time_during_slide_1 }, }); - waitForJudged(); AddAssert("Tracking retained", assertGreatJudge); } @@ -178,19 +151,13 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingLeftBeforeSliderToRight() { - AddStep("Tracking retention test", () => + performTest(new List { - var frames = new List - { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = time_during_slide_1 }, - }; - - performTest(frames); + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = time_during_slide_1 }, }); - waitForJudged(); AddAssert("Tracking retained", assertGreatJudge); } @@ -204,17 +171,11 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingPreclicked() { - AddStep("Tracking retention test", () => + performTest(new List { - var frames = new List - { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, - }; - - performTest(frames); + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, }); - waitForJudged(); AddAssert("Tracking retained, sliderhead miss", assertHeadMissTailTracked); } @@ -230,21 +191,15 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingReturnMidSlider() { - AddStep("Mid-sldier tracking re-acquisition", () => + performTest(new List { - var frames = new List - { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start }, - new OsuReplayFrame { Position = new Vector2(150, 150), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, - new OsuReplayFrame { Position = new Vector2(200, 200), Actions = { OsuAction.LeftButton }, Time = time_during_slide_2 }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_3 }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_4 }, - }; - - performTest(frames); + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(150, 150), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, + new OsuReplayFrame { Position = new Vector2(200, 200), Actions = { OsuAction.LeftButton }, Time = time_during_slide_2 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_3 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_4 }, }); - waitForJudged(); AddAssert("Tracking re-acquired", assertMidSliderJudgements); } @@ -261,22 +216,16 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingReturnMidSliderKeyDownBefore() { - AddStep("Key held down before slider, mid-slider tracking re-acquisition", () => + performTest(new List { - var frames = new List - { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, - new OsuReplayFrame { Position = new Vector2(200, 200), Actions = { OsuAction.LeftButton }, Time = time_during_slide_2 }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_3 }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_4 }, - }; - - performTest(frames); + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, + new OsuReplayFrame { Position = new Vector2(200, 200), Actions = { OsuAction.LeftButton }, Time = time_during_slide_2 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_3 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_4 }, }); - waitForJudged(); AddAssert("Tracking lost", assertMidSliderJudgementFail); } @@ -291,20 +240,14 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingMidSlider() { - AddStep("Mid-slider new tracking acquisition", () => + performTest(new List { - var frames = new List - { - new OsuReplayFrame { Position = new Vector2(150, 150), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, - new OsuReplayFrame { Position = new Vector2(200, 200), Actions = { OsuAction.LeftButton }, Time = time_during_slide_2 }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_3 }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_4 }, - }; - - performTest(frames); + new OsuReplayFrame { Position = new Vector2(150, 150), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, + new OsuReplayFrame { Position = new Vector2(200, 200), Actions = { OsuAction.LeftButton }, Time = time_during_slide_2 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_3 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_4 }, }); - waitForJudged(); AddAssert("Tracking acquired", assertMidSliderJudgements); } @@ -319,22 +262,16 @@ namespace osu.Game.Rulesets.Osu.Tests /// A passing test case will have the slider track the cursor after the cursor enters the slider body. /// [Test] - public void TestTrackingReleasedKeys() + public void TestMidSliderTrackingAcquired() { - AddStep("Mid-slider new tracking acquisition", () => + performTest(new List { - var frames = new List - { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, - new OsuReplayFrame { Position = new Vector2(100, 100), Time = time_during_slide_1 }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_2 }, - }; - - performTest(frames); + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(100, 100), Time = time_during_slide_1 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_2 }, }); - waitForJudged(); AddAssert("Tracking acquired", assertMidSliderJudgements); } @@ -351,45 +288,25 @@ namespace osu.Game.Rulesets.Osu.Tests [Test] public void TestTrackingReleasedValidKey() { - AddStep("Mid-slider new tracking acquisition", () => + performTest(new List { - var frames = new List - { - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start }, - new OsuReplayFrame { Position = new Vector2(100, 100), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, - new OsuReplayFrame { Position = new Vector2(100, 100), Time = time_during_slide_2 }, - new OsuReplayFrame { Position = new Vector2(100, 100), Actions = { OsuAction.LeftButton }, Time = time_during_slide_3 }, - new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_4 }, - }; - - performTest(frames); + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(100, 100), Actions = { OsuAction.LeftButton }, Time = time_during_slide_1 }, + new OsuReplayFrame { Position = new Vector2(100, 100), Time = time_during_slide_2 }, + new OsuReplayFrame { Position = new Vector2(100, 100), Actions = { OsuAction.LeftButton }, Time = time_during_slide_3 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_during_slide_4 }, }); - waitForJudged(); AddAssert("Tracking acquired", assertMidSliderJudgements); } - private void waitForJudged() => AddUntilStep(() => allJudgedFired, "Wait for all judged"); + private bool assertGreatJudge() => judgementResults.Last().Type == HitResult.Great; - private bool assertGreatJudge() - { - return judgementResults.Last().Type == HitResult.Great; - } + private bool assertHeadMissTailTracked() => judgementResults[judgementResults.Count - 2].Type == HitResult.Great && judgementResults.First().Type == HitResult.Miss; - private bool assertHeadMissTailTracked() - { - return judgementResults[judgementResults.Count - 2].Type == HitResult.Great && judgementResults.First().Type == HitResult.Miss; - } + private bool assertMidSliderJudgements() => judgementResults[judgementResults.Count - 2].Type == HitResult.Great; - private bool assertMidSliderJudgements() - { - return judgementResults[judgementResults.Count - 2].Type == HitResult.Great; - } - - private bool assertMidSliderJudgementFail() - { - return judgementResults[judgementResults.Count - 2].Type == HitResult.Miss; - } + private bool assertMidSliderJudgementFail() => judgementResults[judgementResults.Count - 2].Type == HitResult.Miss; private void performTest(List frames) { @@ -398,17 +315,27 @@ namespace osu.Game.Rulesets.Osu.Tests // Likely requires some discussion regarding how first frame inputs should be handled. frames.Insert(0, new OsuReplayFrame()); - LoadComponentAsync(new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } }) + var p = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } }) { AllowPause = false, AllowLeadIn = false, AllowResults = false - }, p => + }; + + p.OnLoadComplete += _ => { - Child = p; p.ScoreProcessor.NewJudgement += result => judgementResults.Add(result); p.ScoreProcessor.AllJudged += () => { allJudgedFired = true; }; + }; + + AddStep("load player", () => LoadScreen(p)); + AddUntilStep(() => p.IsLoaded, "Wait until player is loaded"); + AddStep("reset counts", () => + { + allJudgedFired = false; + judgementResults = new List(); }); + AddUntilStep(() => allJudgedFired, "Wait for all judged"); } private class ScoreAccessibleReplayPlayer : ReplayPlayer From 6b81315009f0de4de47add098efa982cf7b8e4f7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Feb 2019 12:06:49 +0900 Subject: [PATCH 186/327] Avoid test frame being the precise time of slider end --- osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index 71c667f114..8217fe7750 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -43,7 +43,7 @@ namespace osu.Game.Rulesets.Osu.Tests private const double time_during_slide_1 = 2500; private const double time_during_slide_2 = 3000; private const double time_during_slide_3 = 3500; - private const double time_during_slide_4 = 4000; + private const double time_during_slide_4 = 3800; private List judgementResults; private bool allJudgedFired; From 39b203375f9b59a957309d4c7c6ad29a05d52a6e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Feb 2019 13:58:05 +0900 Subject: [PATCH 187/327] Ensure variable isolation over multiple test runs --- .../TestCaseSliderInput.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index 8217fe7750..39dc914406 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -308,6 +308,8 @@ namespace osu.Game.Rulesets.Osu.Tests private bool assertMidSliderJudgementFail() => judgementResults[judgementResults.Count - 2].Type == HitResult.Miss; + private ScoreAccessibleReplayPlayer currentPlayer; + private void performTest(List frames) { // Empty frame to be added as a workaround for first frame behavior. @@ -324,17 +326,23 @@ namespace osu.Game.Rulesets.Osu.Tests p.OnLoadComplete += _ => { - p.ScoreProcessor.NewJudgement += result => judgementResults.Add(result); - p.ScoreProcessor.AllJudged += () => { allJudgedFired = true; }; + p.ScoreProcessor.NewJudgement += result => + { + if (currentPlayer == p) judgementResults.Add(result); + }; + p.ScoreProcessor.AllJudged += () => + { + if (currentPlayer == p) allJudgedFired = true; + }; }; - AddStep("load player", () => LoadScreen(p)); - AddUntilStep(() => p.IsLoaded, "Wait until player is loaded"); - AddStep("reset counts", () => + AddStep("load player", () => { + LoadScreen(currentPlayer = p); allJudgedFired = false; judgementResults = new List(); }); + AddUntilStep(() => p.IsLoaded, "Wait until player is loaded"); AddUntilStep(() => allJudgedFired, "Wait for all judged"); } From 5f792fbacc945f6a5e6e0c7e71aca3896bd1f8e8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Feb 2019 14:28:53 +0900 Subject: [PATCH 188/327] Fix tests not running more than once --- .../TestCaseSliderInput.cs | 40 +++++++++---------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index 39dc914406..1e469b7d12 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -317,32 +317,32 @@ namespace osu.Game.Rulesets.Osu.Tests // Likely requires some discussion regarding how first frame inputs should be handled. frames.Insert(0, new OsuReplayFrame()); - var p = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } }) - { - AllowPause = false, - AllowLeadIn = false, - AllowResults = false - }; - - p.OnLoadComplete += _ => - { - p.ScoreProcessor.NewJudgement += result => - { - if (currentPlayer == p) judgementResults.Add(result); - }; - p.ScoreProcessor.AllJudged += () => - { - if (currentPlayer == p) allJudgedFired = true; - }; - }; - AddStep("load player", () => { + var p = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } }) + { + AllowPause = false, + AllowLeadIn = false, + AllowResults = false + }; + + p.OnLoadComplete += _ => + { + p.ScoreProcessor.NewJudgement += result => + { + if (currentPlayer == p) judgementResults.Add(result); + }; + p.ScoreProcessor.AllJudged += () => + { + if (currentPlayer == p) allJudgedFired = true; + }; + }; + LoadScreen(currentPlayer = p); allJudgedFired = false; judgementResults = new List(); }); - AddUntilStep(() => p.IsLoaded, "Wait until player is loaded"); + AddUntilStep(() => currentPlayer.IsLoaded, "Wait until player is loaded"); AddUntilStep(() => allJudgedFired, "Wait for all judged"); } From c8778014415eb26f94a4e0720f487364727af79d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Feb 2019 11:30:30 +0900 Subject: [PATCH 189/327] Use game clock as reference --- osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index 1e469b7d12..0f0bc4b134 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -48,8 +48,9 @@ namespace osu.Game.Rulesets.Osu.Tests private List judgementResults; private bool allJudgedFired; - public TestCaseSliderInput() + protected override void LoadComplete() { + base.LoadComplete(); Beatmap.Value = new TestWorkingBeatmap(new Beatmap { HitObjects = @@ -74,7 +75,7 @@ namespace osu.Game.Rulesets.Osu.Tests BaseDifficulty = new BeatmapDifficulty { SliderTickRate = 3 }, Ruleset = new OsuRuleset().RulesetInfo }, - }); + }, Clock); } /// From 0c218eb0d5559093e706dcd446412ecf294775df Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Feb 2019 21:24:02 +0900 Subject: [PATCH 190/327] Apply new RulesetInputManager logic Run UpdateSubTree twice to ensure correctness --- osu.Game/Rulesets/UI/RulesetInputManager.cs | 37 ++++++++++++--------- 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index 96775ab9c1..3e201e2c0d 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -121,6 +121,8 @@ namespace osu.Game.Rulesets.UI private const int max_catch_up_updates_per_frame = 50; + private const double sixty_frame_time = 1000.0 / 60; + public override bool UpdateSubTree() { requireMoreUpdateLoops = true; @@ -130,25 +132,28 @@ namespace osu.Game.Rulesets.UI while (validState && requireMoreUpdateLoops && loops++ < max_catch_up_updates_per_frame) { - if (!base.UpdateSubTree()) - return false; + updateClock(); - UpdateSubTreeMasking(this, ScreenSpaceDrawQuad.AABBFloat); - - if (isAttached) + //if (Clock.ElapsedFrameTime > sixty_frame_time) { - // When handling replay input, we need to consider the possibility of fast-forwarding, which may cause the clock to be updated - // to a point very far into the future, then playing a frame at that time. In such a case, lifetime MUST be updated before - // input is handled. This is why base.Update is not called from the derived Update when handling replay input, and is instead - // called manually at the correct time here. - base.Update(); + base.UpdateSubTree(); + UpdateSubTreeMasking(this, ScreenSpaceDrawQuad.AABBFloat); } + + // When handling replay input, we need to consider the possibility of fast-forwarding, which may cause the clock to be updated + // to a point very far into the future, then playing a frame at that time. In such a case, lifetime MUST be updated before + // input is handled. This is why base.Update is not called from the derived Update when handling replay input, and is instead + // called manually at the correct time here. + base.Update(); + + base.UpdateSubTree(); + UpdateSubTreeMasking(this, ScreenSpaceDrawQuad.AABBFloat); } return true; } - protected override void Update() + private void updateClock() { if (parentClock == null) return; @@ -178,12 +183,11 @@ namespace osu.Game.Rulesets.UI // The manual clock time has changed in the above code. The framed clock now needs to be updated // to ensure that the its time is valid for our children before input is processed Clock.ProcessFrame(); + } - if (!isAttached) - { - // For non-replay input handling, this provides equivalent input ordering as if Update was not overridden - base.Update(); - } + protected override void Update() + { + // block update from base.UpdateSubTree() } #endregion @@ -211,6 +215,7 @@ namespace osu.Game.Rulesets.UI return false; break; } + return base.Handle(e); } From acc160042bbfe697fadbd6da5cfb659753750f18 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Feb 2019 21:27:41 +0900 Subject: [PATCH 191/327] Move beatmap construction to step --- .../TestCaseSliderInput.cs | 76 +++++++++++-------- 1 file changed, 45 insertions(+), 31 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index 0f0bc4b134..4b1714bc57 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; +using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Replays; @@ -17,6 +18,7 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using osu.Game.Rulesets.Osu.Replays; using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Scoring; +using osu.Game.Rulesets.UI; using osu.Game.Scoring; using osu.Game.Screens.Play; using osu.Game.Tests.Beatmaps; @@ -48,36 +50,6 @@ namespace osu.Game.Rulesets.Osu.Tests private List judgementResults; private bool allJudgedFired; - protected override void LoadComplete() - { - base.LoadComplete(); - Beatmap.Value = new TestWorkingBeatmap(new Beatmap - { - HitObjects = - { - new Slider - { - StartTime = time_slider_start, - Position = new Vector2(0, 0), - Path = new SliderPath(PathType.PerfectCurve, new[] - { - Vector2.Zero, - new Vector2(25, 0), - }, 25), - } - }, - ControlPointInfo = - { - DifficultyPoints = { new DifficultyControlPoint { SpeedMultiplier = 0.1f } } - }, - BeatmapInfo = - { - BaseDifficulty = new BeatmapDifficulty { SliderTickRate = 3 }, - Ruleset = new OsuRuleset().RulesetInfo - }, - }, Clock); - } - /// /// Scenario: /// - Press a key before a slider starts @@ -276,6 +248,20 @@ namespace osu.Game.Rulesets.Osu.Tests AddAssert("Tracking acquired", assertMidSliderJudgements); } + [Test] + public void TestMidSliderTrackingAcquiredWithMouseDownOutsideSlider() + { + performTest(new List + { + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton }, Time = time_before_slider }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.LeftButton, OsuAction.RightButton }, Time = time_slider_start }, + new OsuReplayFrame { Position = new Vector2(100, 100), Actions = { OsuAction.RightButton }, Time = time_during_slide_1 }, + new OsuReplayFrame { Position = new Vector2(0, 0), Actions = { OsuAction.RightButton }, Time = time_during_slide_2 }, + }); + + AddAssert("Tracking acquired", assertMidSliderJudgements); + } + /// /// Scenario: /// - Press a key on the slider head @@ -320,6 +306,32 @@ namespace osu.Game.Rulesets.Osu.Tests AddStep("load player", () => { + Beatmap.Value = new TestWorkingBeatmap(new Beatmap + { + HitObjects = + { + new Slider + { + StartTime = time_slider_start, + Position = new Vector2(0, 0), + Path = new SliderPath(PathType.PerfectCurve, new[] + { + Vector2.Zero, + new Vector2(25, 0), + }, 25), + } + }, + ControlPointInfo = + { + DifficultyPoints = { new DifficultyControlPoint { SpeedMultiplier = 0.1f } } + }, + BeatmapInfo = + { + BaseDifficulty = new BeatmapDifficulty { SliderTickRate = 3 }, + Ruleset = new OsuRuleset().RulesetInfo + }, + }, Clock); + var p = new ScoreAccessibleReplayPlayer(new Score { Replay = new Replay { Frames = frames } }) { AllowPause = false, @@ -343,7 +355,9 @@ namespace osu.Game.Rulesets.Osu.Tests allJudgedFired = false; judgementResults = new List(); }); - AddUntilStep(() => currentPlayer.IsLoaded, "Wait until player is loaded"); + + AddUntilStep(() => Beatmap.Value.Track.CurrentTime == 0, "Beatmap at 0"); + AddUntilStep(() => currentPlayer.IsCurrentScreen(), "Wait until player is loaded"); AddUntilStep(() => allJudgedFired, "Wait for all judged"); } From 7f5780c615155e2788457bba349d78cdfc47ea53 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Feb 2019 21:30:47 +0900 Subject: [PATCH 192/327] Simplify SliderBall and fix incorrect key up handling Was not processing timeToAcceptAnyKeyAfter when cursor was outside valid tracking area, but should have been. --- .../Objects/Drawables/Pieces/SliderBall.cs | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index a8ee4c42fd..609236311b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -125,6 +125,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces return base.OnMouseMove(e); } + public bool OnReleased(OsuAction action) => false; + public override void ClearTransformsAfter(double time, bool propagateChildren = false, string targetMember = null) { // Consider the case of rewinding - children's transforms are handled internally, so propagating down @@ -148,8 +150,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces } } - private bool canCurrentlyTrack => Time.Current >= slider.StartTime && Time.Current < slider.EndTime && lastScreenSpaceMousePosition.HasValue && base.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value); - /// /// If the cursor moves out of the ball's radius we still need to be able to receive positional updates to stop tracking. /// @@ -183,26 +183,25 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces if (headCircleHitAction == null) timeToAcceptAnyKeyAfter = null; - if (canCurrentlyTrack) + var actions = drawableSlider?.OsuActionInputManager?.PressedActions; + + // if the head circle was hit with a specific key, tracking should only occur while that key is pressed. + if (headCircleHitAction != null && timeToAcceptAnyKeyAfter == null) { - var pressed = drawableSlider?.OsuActionInputManager?.PressedActions; + var otherKey = headCircleHitAction == OsuAction.RightButton ? OsuAction.LeftButton : OsuAction.RightButton; - // if the head circle was hit with a specific key, tracking should only occur while that key is pressed. - if (headCircleHitAction != null && timeToAcceptAnyKeyAfter == null) - { - var otherKey = headCircleHitAction == OsuAction.RightButton ? OsuAction.LeftButton : OsuAction.RightButton; - - // we can return to accepting all keys if the initial head circle key is the *only* key pressed, or all keys have been released. - if (!pressed.Contains(otherKey)) - timeToAcceptAnyKeyAfter = Time.Current; - } - - Tracking = drawableSlider?.OsuActionInputManager?.PressedActions.Any(isValidTrackingAction) ?? false; - } - else - { - Tracking = false; + // we can return to accepting all keys if the initial head circle key is the *only* key pressed, or all keys have been released. + if (actions?.Contains(otherKey) != true) + timeToAcceptAnyKeyAfter = Time.Current; } + + Tracking = + // in valid time range + Time.Current >= slider.StartTime && Time.Current < slider.EndTime && + // in valid position range + lastScreenSpaceMousePosition.HasValue && base.ReceivePositionalInputAt(lastScreenSpaceMousePosition.Value) && + // valid action + (actions?.Any(isValidTrackingAction) ?? false); } /// From 97d324ab116de2448c219d43d0b8999fa9f16b4d Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Feb 2019 21:42:15 +0900 Subject: [PATCH 193/327] Remove unnecessary using --- osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index 4b1714bc57..f0dfd3b6e9 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -18,7 +18,6 @@ using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; using osu.Game.Rulesets.Osu.Replays; using osu.Game.Rulesets.Replays; using osu.Game.Rulesets.Scoring; -using osu.Game.Rulesets.UI; using osu.Game.Scoring; using osu.Game.Screens.Play; using osu.Game.Tests.Beatmaps; From 6d3c0e31919df45454700e40879555b2b65b87bd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Feb 2019 20:57:08 +0900 Subject: [PATCH 194/327] Holy sheet --- osu.Game/Rulesets/UI/RulesetInputManager.cs | 54 ++++++++++++++------- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index 3e201e2c0d..a7afcbe0e0 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -160,29 +161,46 @@ namespace osu.Game.Rulesets.UI clock.Rate = parentClock.Rate; clock.IsRunning = parentClock.IsRunning; - if (!isAttached) - { - clock.CurrentTime = parentClock.CurrentTime; - } - else - { - double? newTime = replayInputHandler.SetFrameFromTime(parentClock.CurrentTime); + var newProposedTime = parentClock.CurrentTime; - if (newTime == null) + try + { + if (Math.Abs(clock.CurrentTime - newProposedTime) > sixty_frame_time * 1.2f) { - // we shouldn't execute for this time value. probably waiting on more replay data. - validState = false; - return; + newProposedTime = clock.Rate > 0 + ? Math.Min(newProposedTime, clock.CurrentTime + sixty_frame_time) + : Math.Max(newProposedTime, clock.CurrentTime - sixty_frame_time); } - clock.CurrentTime = newTime.Value; + if (!isAttached) + { + clock.CurrentTime = newProposedTime; + } + else + { + double? newTime = replayInputHandler.SetFrameFromTime(newProposedTime); + + if (newTime == null) + { + // we shouldn't execute for this time value. probably waiting on more replay data. + validState = false; + + requireMoreUpdateLoops = true; + clock.CurrentTime = newProposedTime; + return; + } + + clock.CurrentTime = newTime.Value; + } + + requireMoreUpdateLoops = clock.CurrentTime != parentClock.CurrentTime; + } + finally + { + // The manual clock time has changed in the above code. The framed clock now needs to be updated + // to ensure that the its time is valid for our children before input is processed + Clock.ProcessFrame(); } - - requireMoreUpdateLoops = clock.CurrentTime != parentClock.CurrentTime; - - // The manual clock time has changed in the above code. The framed clock now needs to be updated - // to ensure that the its time is valid for our children before input is processed - Clock.ProcessFrame(); } protected override void Update() From f8d18285a8314633dabfdeaf543cfb41caa793e7 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Sat, 23 Feb 2019 14:59:54 +0900 Subject: [PATCH 195/327] Fix backgrounds not properly being faded in song select --- osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 6533276568..b804a86282 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -30,10 +30,6 @@ namespace osu.Game.Screens.Backgrounds beatmap = value; - FadeContainer = CreateFadeContainer(); - InternalChild = FadeContainer; - EnableUserDim.BindTo(FadeContainer.EnableUserDim); - Schedule(() => { LoadComponentAsync(new BeatmapBackground(beatmap), b => Schedule(() => @@ -47,7 +43,7 @@ namespace osu.Game.Screens.Backgrounds Background.Expire(); } b.Depth = newDepth; - FadeContainer.Child = Background = b; + FadeContainer.Add(Background = b); Background.BlurSigma = BlurTarget; FadeContainer.StoryboardReplacesBackground.BindTo(StoryboardReplacesBackground); })); @@ -57,6 +53,9 @@ namespace osu.Game.Screens.Backgrounds public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null) { + FadeContainer = CreateFadeContainer(); + InternalChild = FadeContainer; + EnableUserDim.BindTo(FadeContainer.EnableUserDim); Beatmap = beatmap; } From f56f1fc4f7ebe161bd42b748ac27ba0c53f2adf9 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Sat, 23 Feb 2019 15:06:04 +0900 Subject: [PATCH 196/327] Clean up left over test code --- osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 78615c982e..a1d302d93a 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -297,8 +297,6 @@ namespace osu.Game.Tests.Visual public VisualSettings VisualSettingsPos => VisualSettings; public BackgroundScreen ScreenPos => Background; - [Resolved] - private BackgroundScreenStack stack { get; set; } public DimAccessiblePlayerLoader(Player player) : base(() => player) { } From 90cae0a69c0f0b595b6e8d500abe00bf2c11ad13 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 23 Feb 2019 15:48:34 +0900 Subject: [PATCH 197/327] Simplify RulesetInputManager further --- osu.Game/Rulesets/UI/RulesetInputManager.cs | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index a7afcbe0e0..0065f195fc 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -135,20 +135,11 @@ namespace osu.Game.Rulesets.UI { updateClock(); - //if (Clock.ElapsedFrameTime > sixty_frame_time) + if (validState) { base.UpdateSubTree(); UpdateSubTreeMasking(this, ScreenSpaceDrawQuad.AABBFloat); } - - // When handling replay input, we need to consider the possibility of fast-forwarding, which may cause the clock to be updated - // to a point very far into the future, then playing a frame at that time. In such a case, lifetime MUST be updated before - // input is handled. This is why base.Update is not called from the derived Update when handling replay input, and is instead - // called manually at the correct time here. - base.Update(); - - base.UpdateSubTree(); - UpdateSubTreeMasking(this, ScreenSpaceDrawQuad.AABBFloat); } return true; @@ -203,11 +194,6 @@ namespace osu.Game.Rulesets.UI } } - protected override void Update() - { - // block update from base.UpdateSubTree() - } - #endregion #region Setting application (disables etc.) From 809ab86ed048d79b14695f3074e2d71fc4251328 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Sat, 23 Feb 2019 17:04:02 +0900 Subject: [PATCH 198/327] Fix user ID not being added to database Needed for avatar retrieval --- ...20190223075005_AddUserIDColumn.Designer.cs | 487 ++++++++++++++++++ .../20190223075005_AddUserIDColumn.cs | 23 + .../Migrations/OsuDbContextModelSnapshot.cs | 5 +- osu.Game/Scoring/ScoreInfo.cs | 10 +- 4 files changed, 523 insertions(+), 2 deletions(-) create mode 100644 osu.Game/Migrations/20190223075005_AddUserIDColumn.Designer.cs create mode 100644 osu.Game/Migrations/20190223075005_AddUserIDColumn.cs diff --git a/osu.Game/Migrations/20190223075005_AddUserIDColumn.Designer.cs b/osu.Game/Migrations/20190223075005_AddUserIDColumn.Designer.cs new file mode 100644 index 0000000000..e576b57bef --- /dev/null +++ b/osu.Game/Migrations/20190223075005_AddUserIDColumn.Designer.cs @@ -0,0 +1,487 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using osu.Game.Database; + +namespace osu.Game.Migrations +{ + [DbContext(typeof(OsuDbContext))] + [Migration("20190223075005_AddUserIDColumn")] + partial class AddUserIDColumn + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.2.1-servicing-10028"); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("ApproachRate"); + + b.Property("CircleSize"); + + b.Property("DrainRate"); + + b.Property("OverallDifficulty"); + + b.Property("SliderMultiplier"); + + b.Property("SliderTickRate"); + + b.HasKey("ID"); + + b.ToTable("BeatmapDifficulty"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("AudioLeadIn"); + + b.Property("BaseDifficultyID"); + + b.Property("BeatDivisor"); + + b.Property("BeatmapSetInfoID"); + + b.Property("Countdown"); + + b.Property("DistanceSpacing"); + + b.Property("GridSize"); + + b.Property("Hash"); + + b.Property("Hidden"); + + b.Property("LetterboxInBreaks"); + + b.Property("MD5Hash"); + + b.Property("MetadataID"); + + b.Property("OnlineBeatmapID"); + + b.Property("Path"); + + b.Property("RulesetID"); + + b.Property("SpecialStyle"); + + b.Property("StackLeniency"); + + b.Property("StarDifficulty"); + + b.Property("Status"); + + b.Property("StoredBookmarks"); + + b.Property("TimelineZoom"); + + b.Property("Version"); + + b.Property("WidescreenStoryboard"); + + b.HasKey("ID"); + + b.HasIndex("BaseDifficultyID"); + + b.HasIndex("BeatmapSetInfoID"); + + b.HasIndex("Hash"); + + b.HasIndex("MD5Hash"); + + b.HasIndex("MetadataID"); + + b.HasIndex("OnlineBeatmapID") + .IsUnique(); + + b.HasIndex("RulesetID"); + + b.ToTable("BeatmapInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Artist"); + + b.Property("ArtistUnicode"); + + b.Property("AudioFile"); + + b.Property("AuthorString") + .HasColumnName("Author"); + + b.Property("BackgroundFile"); + + b.Property("PreviewTime"); + + b.Property("Source"); + + b.Property("Tags"); + + b.Property("Title"); + + b.Property("TitleUnicode"); + + b.HasKey("ID"); + + b.ToTable("BeatmapMetadata"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("BeatmapSetInfoID"); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.HasKey("ID"); + + b.HasIndex("BeatmapSetInfoID"); + + b.HasIndex("FileInfoID"); + + b.ToTable("BeatmapSetFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("DeletePending"); + + b.Property("Hash"); + + b.Property("MetadataID"); + + b.Property("OnlineBeatmapSetID"); + + b.Property("Protected"); + + b.Property("Status"); + + b.HasKey("ID"); + + b.HasIndex("DeletePending"); + + b.HasIndex("Hash") + .IsUnique(); + + b.HasIndex("MetadataID"); + + b.HasIndex("OnlineBeatmapSetID") + .IsUnique(); + + b.ToTable("BeatmapSetInfo"); + }); + + modelBuilder.Entity("osu.Game.Configuration.DatabasedSetting", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("IntKey") + .HasColumnName("Key"); + + b.Property("RulesetID"); + + b.Property("StringValue") + .HasColumnName("Value"); + + b.Property("Variant"); + + b.HasKey("ID"); + + b.HasIndex("RulesetID", "Variant"); + + b.ToTable("Settings"); + }); + + modelBuilder.Entity("osu.Game.IO.FileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Hash"); + + b.Property("ReferenceCount"); + + b.HasKey("ID"); + + b.HasIndex("Hash") + .IsUnique(); + + b.HasIndex("ReferenceCount"); + + b.ToTable("FileInfo"); + }); + + modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("IntAction") + .HasColumnName("Action"); + + b.Property("KeysString") + .HasColumnName("Keys"); + + b.Property("RulesetID"); + + b.Property("Variant"); + + b.HasKey("ID"); + + b.HasIndex("IntAction"); + + b.HasIndex("RulesetID", "Variant"); + + b.ToTable("KeyBinding"); + }); + + modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Available"); + + b.Property("InstantiationInfo"); + + b.Property("Name"); + + b.Property("ShortName"); + + b.HasKey("ID"); + + b.HasIndex("Available"); + + b.HasIndex("ShortName") + .IsUnique(); + + b.ToTable("RulesetInfo"); + }); + + modelBuilder.Entity("osu.Game.Scoring.ScoreFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.Property("ScoreInfoID"); + + b.HasKey("ID"); + + b.HasIndex("FileInfoID"); + + b.HasIndex("ScoreInfoID"); + + b.ToTable("ScoreFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Scoring.ScoreInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Accuracy") + .HasColumnType("DECIMAL(1,4)"); + + b.Property("BeatmapInfoID"); + + b.Property("Combo"); + + b.Property("Date"); + + b.Property("DeletePending"); + + b.Property("Hash"); + + b.Property("MaxCombo"); + + b.Property("ModsJson") + .HasColumnName("Mods"); + + b.Property("OnlineScoreID"); + + b.Property("PP"); + + b.Property("Rank"); + + b.Property("RulesetID"); + + b.Property("StatisticsJson") + .HasColumnName("Statistics"); + + b.Property("TotalScore"); + + b.Property("UserID") + .HasColumnName("UserID"); + + b.Property("UserString") + .HasColumnName("User"); + + b.HasKey("ID"); + + b.HasIndex("BeatmapInfoID"); + + b.HasIndex("OnlineScoreID") + .IsUnique(); + + b.HasIndex("RulesetID"); + + b.ToTable("ScoreInfo"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.Property("SkinInfoID"); + + b.HasKey("ID"); + + b.HasIndex("FileInfoID"); + + b.HasIndex("SkinInfoID"); + + b.ToTable("SkinFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Creator"); + + b.Property("DeletePending"); + + b.Property("Hash"); + + b.Property("Name"); + + b.HasKey("ID"); + + b.HasIndex("DeletePending"); + + b.HasIndex("Hash") + .IsUnique(); + + b.ToTable("SkinInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "BaseDifficulty") + .WithMany() + .HasForeignKey("BaseDifficultyID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet") + .WithMany("Beatmaps") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany("Beatmaps") + .HasForeignKey("MetadataID"); + + b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") + .WithMany() + .HasForeignKey("RulesetID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") + .WithMany("Files") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany("BeatmapSets") + .HasForeignKey("MetadataID"); + }); + + modelBuilder.Entity("osu.Game.Scoring.ScoreFileInfo", b => + { + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Scoring.ScoreInfo") + .WithMany("Files") + .HasForeignKey("ScoreInfoID"); + }); + + modelBuilder.Entity("osu.Game.Scoring.ScoreInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapInfo", "Beatmap") + .WithMany("Scores") + .HasForeignKey("BeatmapInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") + .WithMany() + .HasForeignKey("RulesetID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => + { + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Skinning.SkinInfo") + .WithMany("Files") + .HasForeignKey("SkinInfoID") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/osu.Game/Migrations/20190223075005_AddUserIDColumn.cs b/osu.Game/Migrations/20190223075005_AddUserIDColumn.cs new file mode 100644 index 0000000000..0736fe5f96 --- /dev/null +++ b/osu.Game/Migrations/20190223075005_AddUserIDColumn.cs @@ -0,0 +1,23 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace osu.Game.Migrations +{ + public partial class AddUserIDColumn : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "UserID", + table: "ScoreInfo", + nullable: false, + defaultValue: 0L); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "UserID", + table: "ScoreInfo"); + } + } +} diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs index 2dafedc3ac..d0b9dc9796 100644 --- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs +++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs @@ -14,7 +14,7 @@ namespace osu.Game.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.0-rtm-35687"); + .HasAnnotation("ProductVersion", "2.2.1-servicing-10028"); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => { @@ -338,6 +338,9 @@ namespace osu.Game.Migrations b.Property("TotalScore"); + b.Property("UserID") + .HasColumnName("UserID"); + b.Property("UserString") .HasColumnName("User"); diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs index c88fd77eb2..ba21eba556 100644 --- a/osu.Game/Scoring/ScoreInfo.cs +++ b/osu.Game/Scoring/ScoreInfo.cs @@ -109,7 +109,15 @@ namespace osu.Game.Scoring public string UserString { get => User?.Username; - set => User = new User { Username = value }; + set => User = new User { Username = value, Id = UserID}; + } + + [JsonIgnore] + [Column("UserID")] + public long UserID + { + get => User?.Id ?? 1; + set => User = new User {Username = UserString, Id = value}; } [JsonIgnore] From 69b9de5acde6b45a75d0633cd4947121437afe86 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 23 Feb 2019 21:13:53 +0900 Subject: [PATCH 199/327] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 5e670c7391..f464dafd3f 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -16,7 +16,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 600cd271aa..bf38335e0c 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From 4e06d5c7cd00799a05cf8a002846a4b3976b5d72 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Feb 2019 00:33:11 +0900 Subject: [PATCH 200/327] Avoid fatal exceptions being thrown on download failure Closes #4313. --- osu.Game/Beatmaps/BeatmapManager.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 21739f16c2..2b559d5912 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -206,7 +206,17 @@ namespace osu.Game.Beatmaps PostNotification?.Invoke(downloadNotification); // don't run in the main api queue as this is a long-running task. - Task.Factory.StartNew(() => request.Perform(api), TaskCreationOptions.LongRunning); + Task.Factory.StartNew(() => + { + try + { + request.Perform(api); + } + catch (Exception e) + { + // no need to handle here as exceptions will filter down to request.Failure above. + } + }, TaskCreationOptions.LongRunning); BeatmapDownloadBegan?.Invoke(request); return true; } From 2281a0235d32d5c158b6a78f4368f806aa597027 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Feb 2019 15:27:06 +0900 Subject: [PATCH 201/327] Fix regression causing playback rate to display incorrectly --- osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs index 0071b06490..ebbed299f7 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlaybackSettings.cs @@ -72,7 +72,7 @@ namespace osu.Game.Screens.Play.PlayerSettings // can't trigger this line instantly as the underlying clock may not be ready to accept adjustments yet. rateSlider.Bindable.ValueChanged += multiplier => AdjustableClock.Rate = clockRate * multiplier.NewValue; - rateSlider.Bindable.BindValueChanged(multiplier => multiplierText.Text = $"{multiplier:0.0}x", true); + rateSlider.Bindable.BindValueChanged(multiplier => multiplierText.Text = $"{multiplier.NewValue:0.0}x", true); } } } From f4acd6e48f916749c0df9d8e9a0033fb523cdc68 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Sun, 24 Feb 2019 18:10:59 +0900 Subject: [PATCH 202/327] Move PlayerLoader tests out of constructor, Improve Documentation --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 101 +++++++++--------- osu.Game/Screens/Play/Player.cs | 3 - 2 files changed, 53 insertions(+), 51 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index a1d302d93a..47215a0551 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -45,6 +45,14 @@ namespace osu.Game.Tests.Visual [Cached] private BackgroundScreenStack backgroundStack; + private void performSetup() + { + createSongSelect(); + + AddStep("Load new player to song select", () => songSelect.Push(player = new DimAccessiblePlayer { Ready = true })); + AddUntilStep(() => player?.IsLoaded ?? false, "Wait for player to load"); + } + private void createSongSelect() { AddStep("Create song select if required", () => @@ -60,11 +68,6 @@ namespace osu.Game.Tests.Visual } }); AddUntilStep(() => songSelect?.IsLoaded ?? false, "Wait for song select to load"); - } - - private void performSetup() - { - createSongSelect(); AddUntilStep(() => { if (!songSelect.IsCurrentScreen()) @@ -74,9 +77,6 @@ namespace osu.Game.Tests.Visual } return true; }, "Wait for song select is current"); - - AddStep("Load new player to song select", () => songSelect.Push(player = new DimAccessiblePlayer { Ready = true })); - AddUntilStep(() => player?.IsLoaded ?? false, "Wait for player to load"); } public TestCaseBackgroundScreenBeatmap() @@ -84,7 +84,6 @@ namespace osu.Game.Tests.Visual InputManager.Add(backgroundStack = new BackgroundScreenStack {RelativeSizeAxes = Axes.Both}); InputManager.Add(screen = new ScreenStack { RelativeSizeAxes = Axes.Both }); - createSongSelect(); AddStep("Create beatmap", () => { Beatmap.Value = new TestWorkingBeatmap(new Beatmap @@ -104,7 +103,15 @@ namespace osu.Game.Tests.Visual }, }); }); + } + /// + /// Check if PlayerLoader properly triggers background dim previews when a user hovers over the visual settings panel. + /// + [Test] + public void PlayerLoaderSettingsHoverTest() + { + createSongSelect(); AddStep("Start player loader", () => songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer()))); AddUntilStep(() => playerLoader?.IsLoaded ?? false, "Wait for Player Loader to load"); AddAssert("Background retained from song select", () => songSelect.AssertBackgroundCurrent()); @@ -116,16 +123,24 @@ namespace osu.Game.Tests.Visual AddWaitStep(5, "Wait for dim"); AddAssert("Screen is dimmed", () => songSelect.AssertDimmed()); + } + /// + /// In the case of a user triggering the dim preview the instant player gets loaded, then moving the cursor off of the visual settings: + /// The OnHover of PlayerLoader will trigger, which could potentially trigger an undim unless checked for in PlayerLoader. + /// We need to check that in this scenario, the dim is still properly applied after entering player. + /// + [Test] + public void PlayerLoaderTransitionTest() + { + createSongSelect(); + AddStep("Start player loader", () => songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer()))); + AddUntilStep(() => playerLoader?.IsLoaded ?? false, "Wait for Player Loader to load"); AddStep("Allow beatmap to load", () => { player.Ready = true; InputManager.MoveMouseTo(playerLoader.ScreenPos); }); - - // In the case of a user triggering the dim preview the instant player gets loaded, then moving the cursor off of the visual settings: - // The OnHover of PlayerLoader will trigger, which could potentially trigger an undim unless checked for in PlayerLoader. - // We need to check that in this scenario, the dim is still properly applied after entering player. AddUntilStep(() => player?.IsLoaded ?? false, "Wait for player to load"); AddAssert("Background retained from song select", () => songSelect.AssertBackgroundCurrent()); AddStep("Trigger background preview when loaded", () => @@ -135,8 +150,15 @@ namespace osu.Game.Tests.Visual }); AddWaitStep(5, "Wait for dim"); AddAssert("Screen is dimmed", () => songSelect.AssertDimmed()); + } - // Make sure the background is fully invisible (not dimmed) when the background should be disabled by the storyboard. + /// + /// Make sure the background is fully invisible (Alpha == 0) when the background should be disabled by the storyboard. + /// + [Test] + public void StoryboardBackgroundVisibilityTest() + { + performSetup(); AddStep("Enable storyboard", () => { player.ReplacesBackground.Value = true; @@ -182,7 +204,7 @@ namespace osu.Game.Tests.Visual performSetup(); AddStep("Transition to Pause", () => { - if (!player.IsPaused) + if (!player.IsPaused.Value) player.Exit(); }); AddWaitStep(5, "Wait for dim"); @@ -226,6 +248,13 @@ namespace osu.Game.Tests.Visual { protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); public readonly Bindable DimEnabled = new Bindable(); + private readonly Bindable dimLevel = new Bindable(); + + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + config.BindWith(OsuSetting.DimLevel, dimLevel); + } public void UpdateBindables() { @@ -234,22 +263,22 @@ namespace osu.Game.Tests.Visual public bool AssertDimmed() { - return ((FadeAccessibleBackground)Background).AssertDimmed(); + return ((FadeAccessibleBackground)Background).CurrentColour == OsuColour.Gray(1 - (float)dimLevel.Value); } public bool AssertUndimmed() { - return ((FadeAccessibleBackground)Background).AssertUndimmed(); + return ((FadeAccessibleBackground)Background).CurrentColour == Color4.White; } public bool AssertInvisible() { - return ((FadeAccessibleBackground)Background).AssertInvisible(); + return ((FadeAccessibleBackground)Background).CurrentAlpha == 0; } public bool AssertVisible() { - return ((FadeAccessibleBackground)Background).AssertVisible(); + return ((FadeAccessibleBackground)Background).CurrentAlpha == 1; } /// @@ -275,12 +304,12 @@ namespace osu.Game.Tests.Visual { protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); + // Whether or not the player should be allowed to load. public bool Ready; public Bindable StoryboardEnabled; public readonly Bindable ReplacesBackground = new Bindable(); - - public bool IsPaused => RulesetContainer.IsPaused.Value; + public readonly Bindable IsPaused = new Bindable(); [BackgroundDependencyLoader] private void load(OsuConfigManager config) @@ -289,6 +318,7 @@ namespace osu.Game.Tests.Visual Thread.Sleep(1); StoryboardEnabled = config.GetBindable(OsuSetting.ShowStoryboard); ReplacesBackground.BindTo(Background.StoryboardReplacesBackground); + RulesetContainer.IsPaused.BindTo(IsPaused); } } @@ -306,35 +336,10 @@ namespace osu.Game.Tests.Visual private class FadeAccessibleBackground : BackgroundScreenBeatmap { - private readonly Bindable dimLevel = new Bindable(); - protected override UserDimContainer CreateFadeContainer() => new TestUserDimContainer { RelativeSizeAxes = Axes.Both }; - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - config.BindWith(OsuSetting.DimLevel, dimLevel); - } - - public bool AssertDimmed() - { - return ((TestUserDimContainer)FadeContainer).CurrentColour == OsuColour.Gray(1 - (float)dimLevel.Value); - } - - public bool AssertUndimmed() - { - return ((TestUserDimContainer)FadeContainer).CurrentColour == Color4.White; - } - - public bool AssertInvisible() - { - return ((TestUserDimContainer)FadeContainer).CurrentAlpha == 0; - } - - public bool AssertVisible() - { - return ((TestUserDimContainer)FadeContainer).CurrentAlpha == 1; - } + public Color4 CurrentColour => ((TestUserDimContainer)FadeContainer).CurrentColour; + public float CurrentAlpha => ((TestUserDimContainer)FadeContainer).CurrentAlpha; private class TestUserDimContainer : UserDimContainer { diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index c683ebef3d..38808c479a 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -397,10 +397,7 @@ namespace osu.Game.Screens.Play } if (LoadedBeatmapSuccessfully) - { pauseContainer?.Pause(); - return true; - } return true; } From 24f5bc7a75fde89fa04cc63a35edf57ea4f856ca Mon Sep 17 00:00:00 2001 From: David Zhao Date: Sun, 24 Feb 2019 20:03:24 +0900 Subject: [PATCH 203/327] Add documentation and move storyboard init logic --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 2 +- .../Graphics/Containers/UserDimContainer.cs | 32 +++++++++++++++++-- .../Backgrounds/BackgroundScreenBeatmap.cs | 6 ++++ osu.Game/Screens/Play/Player.cs | 10 +++--- 4 files changed, 43 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 47215a0551..8e0957a38c 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -284,7 +284,7 @@ namespace osu.Game.Tests.Visual /// /// Make sure every time a screen gets pushed, the background doesn't get replaced /// - /// Whether or not the original background is still the current background + /// Whether or not the original background (The one created in DummySongSelect) is still the current background public bool AssertBackgroundCurrent() { return ((FadeAccessibleBackground)Background).IsCurrentScreen(); diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index 43e85a7492..5aa0cad148 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -10,19 +10,41 @@ using osuTK.Graphics; namespace osu.Game.Graphics.Containers { + /// + /// A container that applies user-configured dim levels to its contents. + /// This container specifies behavior that applies to both Storyboards and Backgrounds. + /// public class UserDimContainer : Container { protected Bindable DimLevel; + protected Bindable ShowStoryboard; - public Bindable EnableUserDim = new Bindable(); + + /// + /// Whether or not user-configured dim levels should be applied to the container. + /// + public readonly Bindable EnableUserDim = new Bindable(); + + /// + /// Whether or not the storyboard loaded should completely hide the background behind it. + /// public Bindable StoryboardReplacesBackground = new Bindable(); + protected Container DimContainer; + protected override Container Content => DimContainer; private readonly bool isStoryboard; private const float background_fade_duration = 800; + /// + /// + /// + /// Whether or not this instance of UserDimContainer contains a storyboard. + /// While both backgrounds and storyboards allow user dim levels to be applied, storyboards can be toggled via + /// and can cause backgrounds to become hidden via . + /// public UserDimContainer(bool isStoryboard = false) { DimContainer = new Container { RelativeSizeAxes = Axes.Both }; @@ -41,6 +63,12 @@ namespace osu.Game.Graphics.Containers StoryboardReplacesBackground.ValueChanged += _ => updateBackgroundDim(); } + protected override void LoadComplete() + { + base.LoadComplete(); + updateBackgroundDim(); + } + private void updateBackgroundDim() { if (isStoryboard) @@ -49,7 +77,7 @@ namespace osu.Game.Graphics.Containers } else { - // The background needs to be hidden in the case of it being replaced + // The background needs to be hidden in the case of it being replaced by the storyboard DimContainer.FadeTo(ShowStoryboard.Value && StoryboardReplacesBackground.Value ? 0 : 1, background_fade_duration, Easing.OutQuint); } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index b804a86282..382c3f57ba 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -14,10 +14,16 @@ namespace osu.Game.Screens.Backgrounds public class BackgroundScreenBeatmap : BlurrableBackgroundScreen { private WorkingBeatmap beatmap; + + /// + /// Whether or not user dim settings should be applied to this Background. + /// public Bindable EnableUserDim = new Bindable(); + public Bindable StoryboardReplacesBackground = new Bindable(); protected UserDimContainer FadeContainer; + protected virtual UserDimContainer CreateFadeContainer() => new UserDimContainer { RelativeSizeAxes = Axes.Both }; public virtual WorkingBeatmap Beatmap diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 38808c479a..e51845271c 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -345,7 +345,12 @@ namespace osu.Game.Screens.Play .Delay(250) .FadeIn(250); - ShowStoryboard.ValueChanged += _ => UpdateBackgroundElements(); + ShowStoryboard.ValueChanged += _ => + { + if (ShowStoryboard.Value && storyboard == null) + initializeStoryboard(true); + }; + Background.EnableUserDim.Value = true; storyboardContainer.StoryboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable; storyboardContainer.StoryboardReplacesBackground.BindTo(Background?.StoryboardReplacesBackground); @@ -433,9 +438,6 @@ namespace osu.Game.Screens.Play if (!this.IsCurrentScreen()) return; base.UpdateBackgroundElements(); - - if (ShowStoryboard.Value && storyboard == null) - initializeStoryboard(true); } protected virtual Results CreateResults(ScoreInfo score) => new SoloResults(score); From 287870f1e14246f787648eabf3508afac14124e8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Feb 2019 23:35:18 +0900 Subject: [PATCH 204/327] Remove limitation stopping search updates when no query present in direct Closes #4310. --- osu.Game/Overlays/DirectOverlay.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index ef1daf7e99..d3881b6ef8 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -273,9 +273,6 @@ namespace osu.Game.Overlays if (api == null) return; - if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery.Value == string.Empty)) - return; - previewTrackManager.StopAnyPlaying(this); getSetsRequest = new SearchBeatmapSetsRequest(currentQuery.Value ?? string.Empty, From add8b8e9c456bf2684284dc13a4cbd55a5316dcc Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Mon, 25 Feb 2019 09:56:00 +0900 Subject: [PATCH 205/327] Only add Exit button if the GameHost supports it --- osu.Game/Screens/Menu/ButtonSystem.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 2669bb9342..76185e328b 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -13,6 +13,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input.Bindings; using osu.Framework.Logging; +using osu.Framework.Platform; using osu.Framework.Threading; using osu.Game.Graphics; using osu.Game.Input; @@ -99,10 +100,6 @@ namespace osu.Game.Screens.Menu buttonsTopLevel.Add(new Button(@"play", @"button-play-select", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), () => State = ButtonSystemState.Play, WEDGE_WIDTH, Key.P)); buttonsTopLevel.Add(new Button(@"osu!editor", @"button-generic-select", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E)); buttonsTopLevel.Add(new Button(@"osu!direct", @"button-direct-select", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D)); - buttonsTopLevel.Add(new Button(@"exit", string.Empty, FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), () => OnExit?.Invoke(), 0, Key.Q)); - - buttonArea.AddRange(buttonsPlay); - buttonArea.AddRange(buttonsTopLevel); } [Resolved(CanBeNull = true)] @@ -115,8 +112,14 @@ namespace osu.Game.Screens.Menu private NotificationOverlay notifications { get; set; } [BackgroundDependencyLoader(true)] - private void load(AudioManager audio, IdleTracker idleTracker) + private void load(AudioManager audio, IdleTracker idleTracker, GameHost host) { + if (host.CanExit) + buttonsTopLevel.Add(new Button(@"exit", string.Empty, FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), () => OnExit?.Invoke(), 0, Key.Q)); + + buttonArea.AddRange(buttonsPlay); + buttonArea.AddRange(buttonsTopLevel); + isIdle.ValueChanged += idle => updateIdleState(idle.NewValue); if (idleTracker != null) isIdle.BindTo(idleTracker.IsIdle); From 61be4f26951c051aaafce7fee171c8da0476705e Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Mon, 25 Feb 2019 10:42:36 +0900 Subject: [PATCH 206/327] Conditionally add ExitConfirmOverlay and disable back action --- osu.Game/Screens/Menu/MainMenu.cs | 53 +++++++++++++++++-------------- 1 file changed, 30 insertions(+), 23 deletions(-) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index d6e3d378e0..315be92141 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -19,6 +19,7 @@ using osu.Game.Screens.Edit; using osu.Game.Screens.Multi; using osu.Game.Screens.Select; using osu.Game.Screens.Tournament; +using osu.Framework.Platform; namespace osu.Game.Screens.Menu { @@ -28,7 +29,7 @@ namespace osu.Game.Screens.Menu public override bool HideOverlaysOnEnter => buttons.State == ButtonSystemState.Initial; - protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial; + protected override bool AllowBackButton => buttons.State != ButtonSystemState.Initial && host.CanExit; public override bool AllowExternalScreenChange => true; @@ -36,33 +37,23 @@ namespace osu.Game.Screens.Menu private readonly MenuSideFlashes sideFlashes; + [Resolved] + private GameHost host { get; set; } + protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault(); public MainMenu() { - InternalChildren = new Drawable[] + sideFlashes = new MenuSideFlashes(); + + buttons = new ButtonSystem { - new ExitConfirmOverlay - { - Action = this.Exit, - }, - new ParallaxContainer - { - ParallaxAmount = 0.01f, - Children = new Drawable[] - { - buttons = new ButtonSystem - { - OnChart = delegate { this.Push(new ChartListing()); }, - OnDirect = delegate {this.Push(new OnlineListing()); }, - OnEdit = delegate {this.Push(new Editor()); }, - OnSolo = onSolo, - OnMulti = delegate {this.Push(new Multiplayer()); }, - OnExit = this.Exit, - } - } - }, - sideFlashes = new MenuSideFlashes(), + OnChart = delegate { this.Push(new ChartListing()); }, + OnDirect = delegate { this.Push(new OnlineListing()); }, + OnEdit = delegate { this.Push(new Editor()); }, + OnSolo = onSolo, + OnMulti = delegate { this.Push(new Multiplayer()); }, + OnExit = this.Exit, }; buttons.StateChanged += state => @@ -83,6 +74,22 @@ namespace osu.Game.Screens.Menu [BackgroundDependencyLoader(true)] private void load(OsuGame game = null) { + if (host.CanExit) + { + AddInternal(new ExitConfirmOverlay + { + Action = this.Exit, + }); + } + + AddInternal(new ParallaxContainer + { + ParallaxAmount = 0.01f, + Child = buttons, + }); + + AddInternal(sideFlashes); + if (game != null) { buttons.OnSettings = game.ToggleSettings; From af4606f3d20309e07a7d4412062b5fcb8618ec09 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 25 Feb 2019 12:35:01 +0900 Subject: [PATCH 207/327] Create new test for StoryboardReplacesBackground --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 25 +++++++++++++++++++ osu.Game/Screens/Play/Player.cs | 3 +-- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 8e0957a38c..7edacc7586 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -171,6 +171,31 @@ namespace osu.Game.Tests.Visual AddAssert("Background is visible", () => songSelect.AssertVisible()); } + /// + /// When exiting player, the screen that it suspends/exits to needs to have a fully visible (Alpha == 1) background. + /// + [Test] + public void StoryboardTransitionTest() + { + performSetup(); + AddStep("Enable storyboard", () => + { + player.ReplacesBackground.Value = true; + player.StoryboardEnabled.Value = true; + }); + AddUntilStep(() => + { + if (!songSelect.IsCurrentScreen()) + { + songSelect.MakeCurrent(); + return false; + } + return true; + }, "Wait for song select is current"); + AddWaitStep(5, "Wait for dim"); + AddAssert("Background is visible", () => songSelect.AssertVisible()); + } + /// /// Check if the fade container is properly being reset when screen dim is disabled. /// diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index e51845271c..be4c3fd3f6 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -178,6 +178,7 @@ namespace osu.Game.Screens.Play { RelativeSizeAxes = Axes.Both, Alpha = 0, + EnableUserDim = { Value = true } }, new ScalingContainer(ScalingMode.Gameplay) { @@ -239,8 +240,6 @@ namespace osu.Game.Screens.Play if (ShowStoryboard.Value) initializeStoryboard(false); - storyboardContainer.EnableUserDim.Value = true; - // Bind ScoreProcessor to ourselves ScoreProcessor.AllJudged += onCompletion; ScoreProcessor.Failed += onFail; From ccc86b66faa5c913447b16c5e1830deb11c038d7 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 25 Feb 2019 13:15:37 +0900 Subject: [PATCH 208/327] Use local private bindable in Player.cs --- osu.Game/Screens/Play/Player.cs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index be4c3fd3f6..43a2fe3f40 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -54,6 +54,7 @@ namespace osu.Game.Screens.Play private Bindable mouseWheelDisabled; private Bindable userAudioOffset; + private Bindable storyboardReplacesBackground; public int RestartCount; @@ -344,15 +345,17 @@ namespace osu.Game.Screens.Play .Delay(250) .FadeIn(250); - ShowStoryboard.ValueChanged += _ => + ShowStoryboard.ValueChanged += s => { - if (ShowStoryboard.Value && storyboard == null) + if (s.NewValue && storyboard == null) initializeStoryboard(true); }; Background.EnableUserDim.Value = true; - storyboardContainer.StoryboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable; - storyboardContainer.StoryboardReplacesBackground.BindTo(Background?.StoryboardReplacesBackground); + + storyboardReplacesBackground.BindTo(Background?.StoryboardReplacesBackground); + storyboardReplacesBackground.BindTo(storyboardContainer.StoryboardReplacesBackground); + storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable; Task.Run(() => { @@ -411,7 +414,7 @@ namespace osu.Game.Screens.Play float fadeOutDuration = instant ? 0 : 250; this.FadeOut(fadeOutDuration); Background.EnableUserDim.Value = false; - storyboardContainer.StoryboardReplacesBackground.Value = false; + storyboardReplacesBackground.Value = false; } protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !pauseContainer.IsPaused.Value; From 16fa30f71e5ed7a2395898b321c48676794656c0 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 25 Feb 2019 13:27:44 +0900 Subject: [PATCH 209/327] Fix bindable --- osu.Game/Screens/Play/Player.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 43a2fe3f40..fe12fce09b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -54,7 +54,8 @@ namespace osu.Game.Screens.Play private Bindable mouseWheelDisabled; private Bindable userAudioOffset; - private Bindable storyboardReplacesBackground; + + private readonly Bindable storyboardReplacesBackground = new Bindable(); public int RestartCount; From 8da671fa6c3da5ce6ab208d17237d4df72412e58 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 25 Feb 2019 13:58:19 +0900 Subject: [PATCH 210/327] Check if a user exists before creating new user --- osu.Game/Scoring/ScoreInfo.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs index ba21eba556..0627ce91ef 100644 --- a/osu.Game/Scoring/ScoreInfo.cs +++ b/osu.Game/Scoring/ScoreInfo.cs @@ -109,15 +109,27 @@ namespace osu.Game.Scoring public string UserString { get => User?.Username; - set => User = new User { Username = value, Id = UserID}; + set + { + if (User == null) + User = new User { Username = value, Id = UserID }; + else + User.Username = value; + } } [JsonIgnore] [Column("UserID")] public long UserID { - get => User?.Id ?? 1; - set => User = new User {Username = UserString, Id = value}; + get => User.Id; + set + { + if (User == null) + User = new User { Username = UserString, Id = value }; + else + User.Id = value; + } } [JsonIgnore] From 447564372614bc0905d3f435c4629b1903fbb63a Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 25 Feb 2019 14:40:44 +0900 Subject: [PATCH 211/327] Revert database migration --- ...20190223075005_AddUserIDColumn.Designer.cs | 487 ------------------ .../20190223075005_AddUserIDColumn.cs | 23 - .../Migrations/OsuDbContextModelSnapshot.cs | 5 +- osu.Game/Scoring/ScoreInfo.cs | 12 +- osu.Game/Users/User.cs | 2 +- 5 files changed, 11 insertions(+), 518 deletions(-) delete mode 100644 osu.Game/Migrations/20190223075005_AddUserIDColumn.Designer.cs delete mode 100644 osu.Game/Migrations/20190223075005_AddUserIDColumn.cs diff --git a/osu.Game/Migrations/20190223075005_AddUserIDColumn.Designer.cs b/osu.Game/Migrations/20190223075005_AddUserIDColumn.Designer.cs deleted file mode 100644 index e576b57bef..0000000000 --- a/osu.Game/Migrations/20190223075005_AddUserIDColumn.Designer.cs +++ /dev/null @@ -1,487 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using osu.Game.Database; - -namespace osu.Game.Migrations -{ - [DbContext(typeof(OsuDbContext))] - [Migration("20190223075005_AddUserIDColumn")] - partial class AddUserIDColumn - { - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "2.2.1-servicing-10028"); - - modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => - { - b.Property("ID") - .ValueGeneratedOnAdd(); - - b.Property("ApproachRate"); - - b.Property("CircleSize"); - - b.Property("DrainRate"); - - b.Property("OverallDifficulty"); - - b.Property("SliderMultiplier"); - - b.Property("SliderTickRate"); - - b.HasKey("ID"); - - b.ToTable("BeatmapDifficulty"); - }); - - modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => - { - b.Property("ID") - .ValueGeneratedOnAdd(); - - b.Property("AudioLeadIn"); - - b.Property("BaseDifficultyID"); - - b.Property("BeatDivisor"); - - b.Property("BeatmapSetInfoID"); - - b.Property("Countdown"); - - b.Property("DistanceSpacing"); - - b.Property("GridSize"); - - b.Property("Hash"); - - b.Property("Hidden"); - - b.Property("LetterboxInBreaks"); - - b.Property("MD5Hash"); - - b.Property("MetadataID"); - - b.Property("OnlineBeatmapID"); - - b.Property("Path"); - - b.Property("RulesetID"); - - b.Property("SpecialStyle"); - - b.Property("StackLeniency"); - - b.Property("StarDifficulty"); - - b.Property("Status"); - - b.Property("StoredBookmarks"); - - b.Property("TimelineZoom"); - - b.Property("Version"); - - b.Property("WidescreenStoryboard"); - - b.HasKey("ID"); - - b.HasIndex("BaseDifficultyID"); - - b.HasIndex("BeatmapSetInfoID"); - - b.HasIndex("Hash"); - - b.HasIndex("MD5Hash"); - - b.HasIndex("MetadataID"); - - b.HasIndex("OnlineBeatmapID") - .IsUnique(); - - b.HasIndex("RulesetID"); - - b.ToTable("BeatmapInfo"); - }); - - modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b => - { - b.Property("ID") - .ValueGeneratedOnAdd(); - - b.Property("Artist"); - - b.Property("ArtistUnicode"); - - b.Property("AudioFile"); - - b.Property("AuthorString") - .HasColumnName("Author"); - - b.Property("BackgroundFile"); - - b.Property("PreviewTime"); - - b.Property("Source"); - - b.Property("Tags"); - - b.Property("Title"); - - b.Property("TitleUnicode"); - - b.HasKey("ID"); - - b.ToTable("BeatmapMetadata"); - }); - - modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => - { - b.Property("ID") - .ValueGeneratedOnAdd(); - - b.Property("BeatmapSetInfoID"); - - b.Property("FileInfoID"); - - b.Property("Filename") - .IsRequired(); - - b.HasKey("ID"); - - b.HasIndex("BeatmapSetInfoID"); - - b.HasIndex("FileInfoID"); - - b.ToTable("BeatmapSetFileInfo"); - }); - - modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => - { - b.Property("ID") - .ValueGeneratedOnAdd(); - - b.Property("DeletePending"); - - b.Property("Hash"); - - b.Property("MetadataID"); - - b.Property("OnlineBeatmapSetID"); - - b.Property("Protected"); - - b.Property("Status"); - - b.HasKey("ID"); - - b.HasIndex("DeletePending"); - - b.HasIndex("Hash") - .IsUnique(); - - b.HasIndex("MetadataID"); - - b.HasIndex("OnlineBeatmapSetID") - .IsUnique(); - - b.ToTable("BeatmapSetInfo"); - }); - - modelBuilder.Entity("osu.Game.Configuration.DatabasedSetting", b => - { - b.Property("ID") - .ValueGeneratedOnAdd(); - - b.Property("IntKey") - .HasColumnName("Key"); - - b.Property("RulesetID"); - - b.Property("StringValue") - .HasColumnName("Value"); - - b.Property("Variant"); - - b.HasKey("ID"); - - b.HasIndex("RulesetID", "Variant"); - - b.ToTable("Settings"); - }); - - modelBuilder.Entity("osu.Game.IO.FileInfo", b => - { - b.Property("ID") - .ValueGeneratedOnAdd(); - - b.Property("Hash"); - - b.Property("ReferenceCount"); - - b.HasKey("ID"); - - b.HasIndex("Hash") - .IsUnique(); - - b.HasIndex("ReferenceCount"); - - b.ToTable("FileInfo"); - }); - - modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b => - { - b.Property("ID") - .ValueGeneratedOnAdd(); - - b.Property("IntAction") - .HasColumnName("Action"); - - b.Property("KeysString") - .HasColumnName("Keys"); - - b.Property("RulesetID"); - - b.Property("Variant"); - - b.HasKey("ID"); - - b.HasIndex("IntAction"); - - b.HasIndex("RulesetID", "Variant"); - - b.ToTable("KeyBinding"); - }); - - modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b => - { - b.Property("ID") - .ValueGeneratedOnAdd(); - - b.Property("Available"); - - b.Property("InstantiationInfo"); - - b.Property("Name"); - - b.Property("ShortName"); - - b.HasKey("ID"); - - b.HasIndex("Available"); - - b.HasIndex("ShortName") - .IsUnique(); - - b.ToTable("RulesetInfo"); - }); - - modelBuilder.Entity("osu.Game.Scoring.ScoreFileInfo", b => - { - b.Property("ID") - .ValueGeneratedOnAdd(); - - b.Property("FileInfoID"); - - b.Property("Filename") - .IsRequired(); - - b.Property("ScoreInfoID"); - - b.HasKey("ID"); - - b.HasIndex("FileInfoID"); - - b.HasIndex("ScoreInfoID"); - - b.ToTable("ScoreFileInfo"); - }); - - modelBuilder.Entity("osu.Game.Scoring.ScoreInfo", b => - { - b.Property("ID") - .ValueGeneratedOnAdd(); - - b.Property("Accuracy") - .HasColumnType("DECIMAL(1,4)"); - - b.Property("BeatmapInfoID"); - - b.Property("Combo"); - - b.Property("Date"); - - b.Property("DeletePending"); - - b.Property("Hash"); - - b.Property("MaxCombo"); - - b.Property("ModsJson") - .HasColumnName("Mods"); - - b.Property("OnlineScoreID"); - - b.Property("PP"); - - b.Property("Rank"); - - b.Property("RulesetID"); - - b.Property("StatisticsJson") - .HasColumnName("Statistics"); - - b.Property("TotalScore"); - - b.Property("UserID") - .HasColumnName("UserID"); - - b.Property("UserString") - .HasColumnName("User"); - - b.HasKey("ID"); - - b.HasIndex("BeatmapInfoID"); - - b.HasIndex("OnlineScoreID") - .IsUnique(); - - b.HasIndex("RulesetID"); - - b.ToTable("ScoreInfo"); - }); - - modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => - { - b.Property("ID") - .ValueGeneratedOnAdd(); - - b.Property("FileInfoID"); - - b.Property("Filename") - .IsRequired(); - - b.Property("SkinInfoID"); - - b.HasKey("ID"); - - b.HasIndex("FileInfoID"); - - b.HasIndex("SkinInfoID"); - - b.ToTable("SkinFileInfo"); - }); - - modelBuilder.Entity("osu.Game.Skinning.SkinInfo", b => - { - b.Property("ID") - .ValueGeneratedOnAdd(); - - b.Property("Creator"); - - b.Property("DeletePending"); - - b.Property("Hash"); - - b.Property("Name"); - - b.HasKey("ID"); - - b.HasIndex("DeletePending"); - - b.HasIndex("Hash") - .IsUnique(); - - b.ToTable("SkinInfo"); - }); - - modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => - { - b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "BaseDifficulty") - .WithMany() - .HasForeignKey("BaseDifficultyID") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet") - .WithMany("Beatmaps") - .HasForeignKey("BeatmapSetInfoID") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") - .WithMany("Beatmaps") - .HasForeignKey("MetadataID"); - - b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") - .WithMany() - .HasForeignKey("RulesetID") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => - { - b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") - .WithMany("Files") - .HasForeignKey("BeatmapSetInfoID") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("osu.Game.IO.FileInfo", "FileInfo") - .WithMany() - .HasForeignKey("FileInfoID") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => - { - b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") - .WithMany("BeatmapSets") - .HasForeignKey("MetadataID"); - }); - - modelBuilder.Entity("osu.Game.Scoring.ScoreFileInfo", b => - { - b.HasOne("osu.Game.IO.FileInfo", "FileInfo") - .WithMany() - .HasForeignKey("FileInfoID") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("osu.Game.Scoring.ScoreInfo") - .WithMany("Files") - .HasForeignKey("ScoreInfoID"); - }); - - modelBuilder.Entity("osu.Game.Scoring.ScoreInfo", b => - { - b.HasOne("osu.Game.Beatmaps.BeatmapInfo", "Beatmap") - .WithMany("Scores") - .HasForeignKey("BeatmapInfoID") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") - .WithMany() - .HasForeignKey("RulesetID") - .OnDelete(DeleteBehavior.Cascade); - }); - - modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => - { - b.HasOne("osu.Game.IO.FileInfo", "FileInfo") - .WithMany() - .HasForeignKey("FileInfoID") - .OnDelete(DeleteBehavior.Cascade); - - b.HasOne("osu.Game.Skinning.SkinInfo") - .WithMany("Files") - .HasForeignKey("SkinInfoID") - .OnDelete(DeleteBehavior.Cascade); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/osu.Game/Migrations/20190223075005_AddUserIDColumn.cs b/osu.Game/Migrations/20190223075005_AddUserIDColumn.cs deleted file mode 100644 index 0736fe5f96..0000000000 --- a/osu.Game/Migrations/20190223075005_AddUserIDColumn.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -namespace osu.Game.Migrations -{ - public partial class AddUserIDColumn : Migration - { - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "UserID", - table: "ScoreInfo", - nullable: false, - defaultValue: 0L); - } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "UserID", - table: "ScoreInfo"); - } - } -} diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs index d0b9dc9796..2dafedc3ac 100644 --- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs +++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs @@ -14,7 +14,7 @@ namespace osu.Game.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.1-servicing-10028"); + .HasAnnotation("ProductVersion", "2.2.0-rtm-35687"); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => { @@ -338,9 +338,6 @@ namespace osu.Game.Migrations b.Property("TotalScore"); - b.Property("UserID") - .HasColumnName("UserID"); - b.Property("UserString") .HasColumnName("User"); diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs index 0627ce91ef..281aadce32 100644 --- a/osu.Game/Scoring/ScoreInfo.cs +++ b/osu.Game/Scoring/ScoreInfo.cs @@ -114,21 +114,27 @@ namespace osu.Game.Scoring if (User == null) User = new User { Username = value, Id = UserID }; else + { User.Username = value; + User.Id = UserID; + } } } [JsonIgnore] [Column("UserID")] - public long UserID + public long? UserID { - get => User.Id; + get => User?.Id ?? 1; set { if (User == null) - User = new User { Username = UserString, Id = value }; + User = new User { Username = UserString, Id = value}; else + { User.Id = value; + User.Username = UserString; + } } } diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index acffd5073b..ff1bc3f1a5 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -10,7 +10,7 @@ namespace osu.Game.Users public class User { [JsonProperty(@"id")] - public long Id = 1; + public long? Id = 1; [JsonProperty(@"join_date")] public DateTimeOffset JoinDate; From 22a68d7bea78bd1debd3a3c750fb55e73b8fc541 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 25 Feb 2019 15:25:22 +0900 Subject: [PATCH 212/327] Perform new migration --- ...20190225062029_AddUserIDColumn.Designer.cs | 487 ++++++++++++++++++ .../20190225062029_AddUserIDColumn.cs | 22 + .../Migrations/OsuDbContextModelSnapshot.cs | 5 +- osu.Game/Scoring/ScoreInfo.cs | 20 +- osu.Game/Users/User.cs | 2 +- 5 files changed, 522 insertions(+), 14 deletions(-) create mode 100644 osu.Game/Migrations/20190225062029_AddUserIDColumn.Designer.cs create mode 100644 osu.Game/Migrations/20190225062029_AddUserIDColumn.cs diff --git a/osu.Game/Migrations/20190225062029_AddUserIDColumn.Designer.cs b/osu.Game/Migrations/20190225062029_AddUserIDColumn.Designer.cs new file mode 100644 index 0000000000..8e1e3a59f3 --- /dev/null +++ b/osu.Game/Migrations/20190225062029_AddUserIDColumn.Designer.cs @@ -0,0 +1,487 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using osu.Game.Database; + +namespace osu.Game.Migrations +{ + [DbContext(typeof(OsuDbContext))] + [Migration("20190225062029_AddUserIDColumn")] + partial class AddUserIDColumn + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "2.2.1-servicing-10028"); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("ApproachRate"); + + b.Property("CircleSize"); + + b.Property("DrainRate"); + + b.Property("OverallDifficulty"); + + b.Property("SliderMultiplier"); + + b.Property("SliderTickRate"); + + b.HasKey("ID"); + + b.ToTable("BeatmapDifficulty"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("AudioLeadIn"); + + b.Property("BaseDifficultyID"); + + b.Property("BeatDivisor"); + + b.Property("BeatmapSetInfoID"); + + b.Property("Countdown"); + + b.Property("DistanceSpacing"); + + b.Property("GridSize"); + + b.Property("Hash"); + + b.Property("Hidden"); + + b.Property("LetterboxInBreaks"); + + b.Property("MD5Hash"); + + b.Property("MetadataID"); + + b.Property("OnlineBeatmapID"); + + b.Property("Path"); + + b.Property("RulesetID"); + + b.Property("SpecialStyle"); + + b.Property("StackLeniency"); + + b.Property("StarDifficulty"); + + b.Property("Status"); + + b.Property("StoredBookmarks"); + + b.Property("TimelineZoom"); + + b.Property("Version"); + + b.Property("WidescreenStoryboard"); + + b.HasKey("ID"); + + b.HasIndex("BaseDifficultyID"); + + b.HasIndex("BeatmapSetInfoID"); + + b.HasIndex("Hash"); + + b.HasIndex("MD5Hash"); + + b.HasIndex("MetadataID"); + + b.HasIndex("OnlineBeatmapID") + .IsUnique(); + + b.HasIndex("RulesetID"); + + b.ToTable("BeatmapInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapMetadata", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Artist"); + + b.Property("ArtistUnicode"); + + b.Property("AudioFile"); + + b.Property("AuthorString") + .HasColumnName("Author"); + + b.Property("BackgroundFile"); + + b.Property("PreviewTime"); + + b.Property("Source"); + + b.Property("Tags"); + + b.Property("Title"); + + b.Property("TitleUnicode"); + + b.HasKey("ID"); + + b.ToTable("BeatmapMetadata"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("BeatmapSetInfoID"); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.HasKey("ID"); + + b.HasIndex("BeatmapSetInfoID"); + + b.HasIndex("FileInfoID"); + + b.ToTable("BeatmapSetFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("DeletePending"); + + b.Property("Hash"); + + b.Property("MetadataID"); + + b.Property("OnlineBeatmapSetID"); + + b.Property("Protected"); + + b.Property("Status"); + + b.HasKey("ID"); + + b.HasIndex("DeletePending"); + + b.HasIndex("Hash") + .IsUnique(); + + b.HasIndex("MetadataID"); + + b.HasIndex("OnlineBeatmapSetID") + .IsUnique(); + + b.ToTable("BeatmapSetInfo"); + }); + + modelBuilder.Entity("osu.Game.Configuration.DatabasedSetting", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("IntKey") + .HasColumnName("Key"); + + b.Property("RulesetID"); + + b.Property("StringValue") + .HasColumnName("Value"); + + b.Property("Variant"); + + b.HasKey("ID"); + + b.HasIndex("RulesetID", "Variant"); + + b.ToTable("Settings"); + }); + + modelBuilder.Entity("osu.Game.IO.FileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Hash"); + + b.Property("ReferenceCount"); + + b.HasKey("ID"); + + b.HasIndex("Hash") + .IsUnique(); + + b.HasIndex("ReferenceCount"); + + b.ToTable("FileInfo"); + }); + + modelBuilder.Entity("osu.Game.Input.Bindings.DatabasedKeyBinding", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("IntAction") + .HasColumnName("Action"); + + b.Property("KeysString") + .HasColumnName("Keys"); + + b.Property("RulesetID"); + + b.Property("Variant"); + + b.HasKey("ID"); + + b.HasIndex("IntAction"); + + b.HasIndex("RulesetID", "Variant"); + + b.ToTable("KeyBinding"); + }); + + modelBuilder.Entity("osu.Game.Rulesets.RulesetInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Available"); + + b.Property("InstantiationInfo"); + + b.Property("Name"); + + b.Property("ShortName"); + + b.HasKey("ID"); + + b.HasIndex("Available"); + + b.HasIndex("ShortName") + .IsUnique(); + + b.ToTable("RulesetInfo"); + }); + + modelBuilder.Entity("osu.Game.Scoring.ScoreFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.Property("ScoreInfoID"); + + b.HasKey("ID"); + + b.HasIndex("FileInfoID"); + + b.HasIndex("ScoreInfoID"); + + b.ToTable("ScoreFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Scoring.ScoreInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Accuracy") + .HasColumnType("DECIMAL(1,4)"); + + b.Property("BeatmapInfoID"); + + b.Property("Combo"); + + b.Property("Date"); + + b.Property("DeletePending"); + + b.Property("Hash"); + + b.Property("MaxCombo"); + + b.Property("ModsJson") + .HasColumnName("Mods"); + + b.Property("OnlineScoreID"); + + b.Property("PP"); + + b.Property("Rank"); + + b.Property("RulesetID"); + + b.Property("StatisticsJson") + .HasColumnName("Statistics"); + + b.Property("TotalScore"); + + b.Property("UserID") + .HasColumnName("UserID"); + + b.Property("UserString") + .HasColumnName("User"); + + b.HasKey("ID"); + + b.HasIndex("BeatmapInfoID"); + + b.HasIndex("OnlineScoreID") + .IsUnique(); + + b.HasIndex("RulesetID"); + + b.ToTable("ScoreInfo"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("FileInfoID"); + + b.Property("Filename") + .IsRequired(); + + b.Property("SkinInfoID"); + + b.HasKey("ID"); + + b.HasIndex("FileInfoID"); + + b.HasIndex("SkinInfoID"); + + b.ToTable("SkinFileInfo"); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinInfo", b => + { + b.Property("ID") + .ValueGeneratedOnAdd(); + + b.Property("Creator"); + + b.Property("DeletePending"); + + b.Property("Hash"); + + b.Property("Name"); + + b.HasKey("ID"); + + b.HasIndex("DeletePending"); + + b.HasIndex("Hash") + .IsUnique(); + + b.ToTable("SkinInfo"); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapDifficulty", "BaseDifficulty") + .WithMany() + .HasForeignKey("BaseDifficultyID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo", "BeatmapSet") + .WithMany("Beatmaps") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany("Beatmaps") + .HasForeignKey("MetadataID"); + + b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") + .WithMany() + .HasForeignKey("RulesetID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetFileInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapSetInfo") + .WithMany("Files") + .HasForeignKey("BeatmapSetInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Beatmaps.BeatmapSetInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapMetadata", "Metadata") + .WithMany("BeatmapSets") + .HasForeignKey("MetadataID"); + }); + + modelBuilder.Entity("osu.Game.Scoring.ScoreFileInfo", b => + { + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Scoring.ScoreInfo") + .WithMany("Files") + .HasForeignKey("ScoreInfoID"); + }); + + modelBuilder.Entity("osu.Game.Scoring.ScoreInfo", b => + { + b.HasOne("osu.Game.Beatmaps.BeatmapInfo", "Beatmap") + .WithMany("Scores") + .HasForeignKey("BeatmapInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Rulesets.RulesetInfo", "Ruleset") + .WithMany() + .HasForeignKey("RulesetID") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("osu.Game.Skinning.SkinFileInfo", b => + { + b.HasOne("osu.Game.IO.FileInfo", "FileInfo") + .WithMany() + .HasForeignKey("FileInfoID") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("osu.Game.Skinning.SkinInfo") + .WithMany("Files") + .HasForeignKey("SkinInfoID") + .OnDelete(DeleteBehavior.Cascade); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/osu.Game/Migrations/20190225062029_AddUserIDColumn.cs b/osu.Game/Migrations/20190225062029_AddUserIDColumn.cs new file mode 100644 index 0000000000..0720e0eac7 --- /dev/null +++ b/osu.Game/Migrations/20190225062029_AddUserIDColumn.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace osu.Game.Migrations +{ + public partial class AddUserIDColumn : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "UserID", + table: "ScoreInfo", + nullable: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "UserID", + table: "ScoreInfo"); + } + } +} diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs index 2dafedc3ac..4d2924f4d6 100644 --- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs +++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs @@ -14,7 +14,7 @@ namespace osu.Game.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.0-rtm-35687"); + .HasAnnotation("ProductVersion", "2.2.1-servicing-10028"); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => { @@ -338,6 +338,9 @@ namespace osu.Game.Migrations b.Property("TotalScore"); + b.Property("UserID") + .HasColumnName("UserID"); + b.Property("UserString") .HasColumnName("User"); diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs index 281aadce32..710f239156 100644 --- a/osu.Game/Scoring/ScoreInfo.cs +++ b/osu.Game/Scoring/ScoreInfo.cs @@ -112,12 +112,10 @@ namespace osu.Game.Scoring set { if (User == null) - User = new User { Username = value, Id = UserID }; - else - { - User.Username = value; - User.Id = UserID; - } + User = new User(); + + User.Username = value; + User.Id = UserID ?? 1; } } @@ -129,12 +127,10 @@ namespace osu.Game.Scoring set { if (User == null) - User = new User { Username = UserString, Id = value}; - else - { - User.Id = value; - User.Username = UserString; - } + User = new User(); + + User.Id = value ?? 1; + User.Username = UserString; } } diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index ff1bc3f1a5..acffd5073b 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -10,7 +10,7 @@ namespace osu.Game.Users public class User { [JsonProperty(@"id")] - public long? Id = 1; + public long Id = 1; [JsonProperty(@"join_date")] public DateTimeOffset JoinDate; From d06f38b3f3c9fb1a949dcc502e1b186776d0d2be Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 25 Feb 2019 15:57:07 +0900 Subject: [PATCH 213/327] Cleanup --- osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs | 1 - osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs | 2 -- 2 files changed, 3 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index f0dfd3b6e9..e1d6f67263 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -223,7 +223,6 @@ namespace osu.Game.Rulesets.Osu.Tests AddAssert("Tracking acquired", assertMidSliderJudgements); } - /// /// Scenario: /// - Press a key before the slider starts diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index 609236311b..afa7f22140 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -125,8 +125,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces return base.OnMouseMove(e); } - public bool OnReleased(OsuAction action) => false; - public override void ClearTransformsAfter(double time, bool propagateChildren = false, string targetMember = null) { // Consider the case of rewinding - children's transforms are handled internally, so propagating down From 7fde21b51af4229b12ecff5c5e06b2e310a6c699 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Mon, 25 Feb 2019 16:09:09 +0900 Subject: [PATCH 214/327] Rename testcase --- osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs | 2 +- ...aseRateAdjustedBeatmap.cs => RateAdjustedBeatmapTestCase.cs} | 2 +- osu.Game/Tests/Visual/TestCasePlayer.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) rename osu.Game/Tests/Visual/{TestCaseRateAdjustedBeatmap.cs => RateAdjustedBeatmapTestCase.cs} (89%) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs index e1d6f67263..57effe01f1 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderInput.cs @@ -26,7 +26,7 @@ using osuTK; namespace osu.Game.Rulesets.Osu.Tests { - public class TestCaseSliderInput : TestCaseRateAdjustedBeatmap + public class TestCaseSliderInput : RateAdjustedBeatmapTestCase { public override IReadOnlyList RequiredTypes => new[] { diff --git a/osu.Game/Tests/Visual/TestCaseRateAdjustedBeatmap.cs b/osu.Game/Tests/Visual/RateAdjustedBeatmapTestCase.cs similarity index 89% rename from osu.Game/Tests/Visual/TestCaseRateAdjustedBeatmap.cs rename to osu.Game/Tests/Visual/RateAdjustedBeatmapTestCase.cs index 4a9dfe2dfa..14b4af1e7d 100644 --- a/osu.Game/Tests/Visual/TestCaseRateAdjustedBeatmap.cs +++ b/osu.Game/Tests/Visual/RateAdjustedBeatmapTestCase.cs @@ -6,7 +6,7 @@ namespace osu.Game.Tests.Visual /// /// Test case which adjusts the beatmap's rate to match any speed adjustments in visual tests. /// - public abstract class TestCaseRateAdjustedBeatmap : ScreenTestCase + public abstract class RateAdjustedBeatmapTestCase : ScreenTestCase { protected override void Update() { diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs index 196f501c6f..5ff798c40d 100644 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ b/osu.Game/Tests/Visual/TestCasePlayer.cs @@ -16,7 +16,7 @@ using osuTK.Graphics; namespace osu.Game.Tests.Visual { - public abstract class TestCasePlayer : TestCaseRateAdjustedBeatmap + public abstract class TestCasePlayer : RateAdjustedBeatmapTestCase { private readonly Ruleset ruleset; From ad1bce35856d29a74b3a382457e91df5552ee694 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 25 Feb 2019 18:40:19 +0900 Subject: [PATCH 215/327] Fix song select backround not being exited in time --- osu.Game/Screens/Select/SongSelect.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 3be4dd8c0b..fd58b1db5b 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -285,7 +285,7 @@ namespace osu.Game.Screens.Select public void Edit(BeatmapInfo beatmap = null) { - Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce); + Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce); this.Push(new Editor()); } @@ -510,14 +510,17 @@ namespace osu.Game.Screens.Select public override bool OnExiting(IScreen next) { + if (base.OnExiting(next)) + return true; + + Logger.Log("Exiting song select!"); + if (ModSelect.State == Visibility.Visible) { ModSelect.Hide(); return true; } - FinaliseSelection(performStartAction: false); - beatmapInfoWedge.State = Visibility.Hidden; this.FadeOut(100); @@ -530,7 +533,7 @@ namespace osu.Game.Screens.Select SelectedMods.UnbindAll(); Beatmap.Value.Mods.Value = new Mod[] { }; - return base.OnExiting(next); + return false; } protected override void Dispose(bool isDisposing) From 59ad470eed8eff14a47e75d314cc7fd1d60f701e Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 25 Feb 2019 18:41:13 +0900 Subject: [PATCH 216/327] Clean up test code --- osu.Game/Screens/Select/SongSelect.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index fd58b1db5b..68ca89a012 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -513,8 +513,6 @@ namespace osu.Game.Screens.Select if (base.OnExiting(next)) return true; - Logger.Log("Exiting song select!"); - if (ModSelect.State == Visibility.Visible) { ModSelect.Hide(); From a4e119786f270593b3d47e953d7464fa3e2bb650 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Feb 2019 19:19:28 +0900 Subject: [PATCH 217/327] Fix some weird formatting --- osu.Game/Screens/Menu/MainMenu.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index d6e3d378e0..6e1afb6b68 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -54,10 +54,10 @@ namespace osu.Game.Screens.Menu buttons = new ButtonSystem { OnChart = delegate { this.Push(new ChartListing()); }, - OnDirect = delegate {this.Push(new OnlineListing()); }, - OnEdit = delegate {this.Push(new Editor()); }, + OnDirect = delegate { this.Push(new OnlineListing()); }, + OnEdit = delegate { this.Push(new Editor()); }, OnSolo = onSolo, - OnMulti = delegate {this.Push(new Multiplayer()); }, + OnMulti = delegate { this.Push(new Multiplayer()); }, OnExit = this.Exit, } } @@ -100,7 +100,7 @@ namespace osu.Game.Screens.Menu public void LoadToSolo() => Schedule(onSolo); - private void onSolo() =>this.Push(consumeSongSelect()); + private void onSolo() => this.Push(consumeSongSelect()); private Screen consumeSongSelect() { @@ -184,7 +184,7 @@ namespace osu.Game.Screens.Menu { base.OnResuming(last); - ((BackgroundScreenDefault)Background).Next(); + (Background as BackgroundScreenDefault)?.Next(); //we may have consumed our preloaded instance, so let's make another. preloadSongSelect(); @@ -201,7 +201,7 @@ namespace osu.Game.Screens.Menu { if (!e.Repeat && e.ControlPressed && e.ShiftPressed && e.Key == Key.D) { - this.Push(new Drawings()); + this.Push(new Drawings()); return true; } From ed10024b22ce82bb928db4b265518ee91769b973 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Feb 2019 19:29:09 +0900 Subject: [PATCH 218/327] Fix some formatting / variable naming --- osu.Game/Overlays/MusicController.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index c1dd06c36a..7c62ecf27e 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -312,13 +312,13 @@ namespace osu.Game.Overlays private WorkingBeatmap current; private TransformDirection? queuedDirection; - private void beatmapChanged(ValueChangedEvent e) + private void beatmapChanged(ValueChangedEvent beatmap) { TransformDirection direction = TransformDirection.None; if (current != null) { - bool audioEquals = e.NewValue?.BeatmapInfo?.AudioEquals(current.BeatmapInfo) ?? false; + bool audioEquals = beatmap.NewValue?.BeatmapInfo?.AudioEquals(current.BeatmapInfo) ?? false; if (audioEquals) direction = TransformDirection.None; @@ -331,7 +331,7 @@ namespace osu.Game.Overlays { //figure out the best direction based on order in playlist. var last = beatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count(); - var next = beatmap == null ? -1 : beatmapSets.TakeWhile(b => b.ID != e.NewValue.BeatmapSetInfo?.ID).Count(); + var next = this.beatmap == null ? -1 : beatmapSets.TakeWhile(b => b.ID != beatmap.NewValue.BeatmapSetInfo?.ID).Count(); direction = last > next ? TransformDirection.Prev : TransformDirection.Next; } @@ -339,7 +339,8 @@ namespace osu.Game.Overlays current.Track.Completed -= currentTrackCompleted; } - current = e.NewValue; + current = beatmap.NewValue; + if (current != null) current.Track.Completed += currentTrackCompleted; From 2fbb0b4e6f69b4d05365dd26725e7a1665b32753 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Feb 2019 19:34:03 +0900 Subject: [PATCH 219/327] Don't use `this` --- osu.Game/Overlays/MusicController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 7c62ecf27e..6a71e91de9 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -331,7 +331,7 @@ namespace osu.Game.Overlays { //figure out the best direction based on order in playlist. var last = beatmapSets.TakeWhile(b => b.ID != current.BeatmapSetInfo?.ID).Count(); - var next = this.beatmap == null ? -1 : beatmapSets.TakeWhile(b => b.ID != beatmap.NewValue.BeatmapSetInfo?.ID).Count(); + var next = beatmap.NewValue == null ? -1 : beatmapSets.TakeWhile(b => b.ID != beatmap.NewValue.BeatmapSetInfo?.ID).Count(); direction = last > next ? TransformDirection.Prev : TransformDirection.Next; } From 2bd5bb3f69eb62fcba48f26274dd966fdd14d093 Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Mon, 25 Feb 2019 21:41:41 +0900 Subject: [PATCH 220/327] Move all MainMenu button creation into load --- osu.Game/Screens/Menu/ButtonSystem.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 76185e328b..42d67ceffc 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -91,15 +91,6 @@ namespace osu.Game.Screens.Menu }); buttonArea.Flow.CentreTarget = iconFacade; - - buttonsPlay.Add(new Button(@"solo", @"button-solo-select", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P)); - buttonsPlay.Add(new Button(@"multi", @"button-generic-select", FontAwesome.fa_users, new Color4(94, 63, 186, 255), onMulti, 0, Key.M)); - buttonsPlay.Add(new Button(@"chart", @"button-generic-select", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke())); - buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play); - - buttonsTopLevel.Add(new Button(@"play", @"button-play-select", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), () => State = ButtonSystemState.Play, WEDGE_WIDTH, Key.P)); - buttonsTopLevel.Add(new Button(@"osu!editor", @"button-generic-select", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E)); - buttonsTopLevel.Add(new Button(@"osu!direct", @"button-direct-select", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D)); } [Resolved(CanBeNull = true)] @@ -114,6 +105,15 @@ namespace osu.Game.Screens.Menu [BackgroundDependencyLoader(true)] private void load(AudioManager audio, IdleTracker idleTracker, GameHost host) { + buttonsPlay.Add(new Button(@"solo", @"button-solo-select", FontAwesome.fa_user, new Color4(102, 68, 204, 255), () => OnSolo?.Invoke(), WEDGE_WIDTH, Key.P)); + buttonsPlay.Add(new Button(@"multi", @"button-generic-select", FontAwesome.fa_users, new Color4(94, 63, 186, 255), onMulti, 0, Key.M)); + buttonsPlay.Add(new Button(@"chart", @"button-generic-select", FontAwesome.fa_osu_charts, new Color4(80, 53, 160, 255), () => OnChart?.Invoke())); + buttonsPlay.ForEach(b => b.VisibleState = ButtonSystemState.Play); + + buttonsTopLevel.Add(new Button(@"play", @"button-play-select", FontAwesome.fa_osu_logo, new Color4(102, 68, 204, 255), () => State = ButtonSystemState.Play, WEDGE_WIDTH, Key.P)); + buttonsTopLevel.Add(new Button(@"osu!editor", @"button-generic-select", FontAwesome.fa_osu_edit_o, new Color4(238, 170, 0, 255), () => OnEdit?.Invoke(), 0, Key.E)); + buttonsTopLevel.Add(new Button(@"osu!direct", @"button-direct-select", FontAwesome.fa_osu_chevron_down_o, new Color4(165, 204, 0, 255), () => OnDirect?.Invoke(), 0, Key.D)); + if (host.CanExit) buttonsTopLevel.Add(new Button(@"exit", string.Empty, FontAwesome.fa_osu_cross_o, new Color4(238, 51, 153, 255), () => OnExit?.Invoke(), 0, Key.Q)); From d750023c5201ce1fc787fd62112e8ae7746e0a2a Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 25 Feb 2019 22:05:49 +0900 Subject: [PATCH 221/327] Fix TestCasePlayerLoader not having a background stack --- osu.Game.Tests/Visual/TestCasePlayerLoader.cs | 12 ++++++++++-- osu.Game/Screens/Play/Player.cs | 4 ++-- osu.Game/Screens/Play/PlayerLoader.cs | 8 ++++---- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePlayerLoader.cs b/osu.Game.Tests/Visual/TestCasePlayerLoader.cs index 16cb94c65e..3e3f9eb9f3 100644 --- a/osu.Game.Tests/Visual/TestCasePlayerLoader.cs +++ b/osu.Game.Tests/Visual/TestCasePlayerLoader.cs @@ -6,6 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Screens; using osu.Game.Beatmaps; +using osu.Game.Screens; using osu.Game.Screens.Play; namespace osu.Game.Tests.Visual @@ -15,13 +16,20 @@ namespace osu.Game.Tests.Visual private PlayerLoader loader; private ScreenStack stack; + [Cached] + private BackgroundScreenStack backgroundStack; + + public TestCasePlayerLoader() + { + InputManager.Add(backgroundStack = new BackgroundScreenStack {RelativeSizeAxes = Axes.Both}); + InputManager.Add(stack = new ScreenStack { RelativeSizeAxes = Axes.Both }); + } + [BackgroundDependencyLoader] private void load(OsuGameBase game) { Beatmap.Value = new DummyWorkingBeatmap(game); - InputManager.Add(stack = new ScreenStack { RelativeSizeAxes = Axes.Both }); - AddStep("load dummy beatmap", () => stack.Push(loader = new PlayerLoader(() => new Player { AllowPause = false, diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index fe12fce09b..8caa09cc7b 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -354,8 +354,8 @@ namespace osu.Game.Screens.Play Background.EnableUserDim.Value = true; - storyboardReplacesBackground.BindTo(Background?.StoryboardReplacesBackground); - storyboardReplacesBackground.BindTo(storyboardContainer.StoryboardReplacesBackground); + storyboardReplacesBackground.BindTo(Background.StoryboardReplacesBackground); + storyboardContainer.StoryboardReplacesBackground.BindTo(Background.StoryboardReplacesBackground); storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable; Task.Run(() => diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 6b066fbe91..e358188fe9 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -159,7 +159,7 @@ namespace osu.Game.Screens.Play { // restore our screen defaults InitializeBackgroundElements(); - if (this.IsCurrentScreen() && (Background?.IsLoaded ?? false)) + if (this.IsCurrentScreen()) Background.EnableUserDim.Value = false; return base.OnHover(e); } @@ -168,7 +168,8 @@ namespace osu.Game.Screens.Play { if (GetContainingInputManager()?.HoveredDrawables.Contains(VisualSettings) == true) { - // show user setting preview + // Update background elements is only being called here because blur logic still exists in Player. + // Will need to be removed when resolving https://github.com/ppy/osu/issues/4322 UpdateBackgroundElements(); if (this.IsCurrentScreen()) Background.EnableUserDim.Value = true; @@ -245,8 +246,7 @@ namespace osu.Game.Screens.Play this.FadeOut(150); cancelLoad(); - if (Background != null) - Background.EnableUserDim.Value = false; + Background.EnableUserDim.Value = false; return base.OnExiting(next); } From a7585dea216a233f2b4e8feaf4101c9bf2d7b866 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 25 Feb 2019 22:17:51 +0900 Subject: [PATCH 222/327] Make screen stack readonly --- osu.Game.Tests/Visual/TestCasePlayerLoader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCasePlayerLoader.cs b/osu.Game.Tests/Visual/TestCasePlayerLoader.cs index 3e3f9eb9f3..156393670d 100644 --- a/osu.Game.Tests/Visual/TestCasePlayerLoader.cs +++ b/osu.Game.Tests/Visual/TestCasePlayerLoader.cs @@ -14,7 +14,7 @@ namespace osu.Game.Tests.Visual public class TestCasePlayerLoader : ManualInputManagerTestCase { private PlayerLoader loader; - private ScreenStack stack; + private readonly ScreenStack stack; [Cached] private BackgroundScreenStack backgroundStack; From 14e427fed76a284cce4a9bbc6a93e5053c192e93 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Feb 2019 09:54:28 +0900 Subject: [PATCH 223/327] Rename some methods (they weren't Asserting) --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 51 +++++++------------ 1 file changed, 18 insertions(+), 33 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 7edacc7586..8002255b54 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -114,7 +114,7 @@ namespace osu.Game.Tests.Visual createSongSelect(); AddStep("Start player loader", () => songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer()))); AddUntilStep(() => playerLoader?.IsLoaded ?? false, "Wait for Player Loader to load"); - AddAssert("Background retained from song select", () => songSelect.AssertBackgroundCurrent()); + AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent()); AddStep("Trigger background preview", () => { InputManager.MoveMouseTo(playerLoader.ScreenPos); @@ -122,7 +122,7 @@ namespace osu.Game.Tests.Visual }); AddWaitStep(5, "Wait for dim"); - AddAssert("Screen is dimmed", () => songSelect.AssertDimmed()); + AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); } /// @@ -142,14 +142,14 @@ namespace osu.Game.Tests.Visual InputManager.MoveMouseTo(playerLoader.ScreenPos); }); AddUntilStep(() => player?.IsLoaded ?? false, "Wait for player to load"); - AddAssert("Background retained from song select", () => songSelect.AssertBackgroundCurrent()); + AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent()); AddStep("Trigger background preview when loaded", () => { InputManager.MoveMouseTo(playerLoader.VisualSettingsPos); InputManager.MoveMouseTo(playerLoader.ScreenPos); }); AddWaitStep(5, "Wait for dim"); - AddAssert("Screen is dimmed", () => songSelect.AssertDimmed()); + AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); } /// @@ -165,10 +165,10 @@ namespace osu.Game.Tests.Visual player.StoryboardEnabled.Value = true; }); AddWaitStep(5, "Wait for dim"); - AddAssert("Background is invisible", () => songSelect.AssertInvisible()); + AddAssert("Background is invisible", () => songSelect.IsBackgroundInvisible()); AddStep("Disable storyboard", () => player.ReplacesBackground.Value = false); AddWaitStep(5, "Wait for dim"); - AddAssert("Background is visible", () => songSelect.AssertVisible()); + AddAssert("Background is visible", () => songSelect.IsBackgroundVisible()); } /// @@ -193,7 +193,7 @@ namespace osu.Game.Tests.Visual return true; }, "Wait for song select is current"); AddWaitStep(5, "Wait for dim"); - AddAssert("Background is visible", () => songSelect.AssertVisible()); + AddAssert("Background is visible", () => songSelect.IsBackgroundVisible()); } /// @@ -205,7 +205,7 @@ namespace osu.Game.Tests.Visual performSetup(); AddStep("Test User Undimming", () => songSelect.DimEnabled.Value = false); AddWaitStep(5, "Wait for dim"); - AddAssert("Screen is undimmed", () => songSelect.AssertUndimmed()); + AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); } /// @@ -217,7 +217,7 @@ namespace osu.Game.Tests.Visual performSetup(); AddStep("Test User Dimming", () => songSelect.DimEnabled.Value = true); AddWaitStep(5, "Wait for dim"); - AddAssert("Screen is dimmed", () => songSelect.AssertDimmed()); + AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); } /// @@ -233,7 +233,7 @@ namespace osu.Game.Tests.Visual player.Exit(); }); AddWaitStep(5, "Wait for dim"); - AddAssert("Screen is dimmed", () => songSelect.AssertDimmed()); + AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); } /// @@ -245,8 +245,8 @@ namespace osu.Game.Tests.Visual performSetup(); AddStep("Transition to Results", () => player.Push(new FadeAccesibleResults(new ScoreInfo { User = new User { Username = "osu!" }}))); AddWaitStep(5, "Wait for dim"); - AddAssert("Screen is undimmed", () => songSelect.AssertUndimmed()); - AddAssert("Background retained from song select", () => songSelect.AssertBackgroundCurrent()); + AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); + AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent()); } /// @@ -266,7 +266,7 @@ namespace osu.Game.Tests.Visual return true; }, "Wait for song select is current"); AddWaitStep(5, "Wait for dim"); - AddAssert("Screen is undimmed", () => songSelect.AssertUndimmed()); + AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); } private class DummySongSelect : OsuScreen @@ -286,34 +286,19 @@ namespace osu.Game.Tests.Visual DimEnabled.BindTo(((FadeAccessibleBackground)Background).EnableUserDim); } - public bool AssertDimmed() - { - return ((FadeAccessibleBackground)Background).CurrentColour == OsuColour.Gray(1 - (float)dimLevel.Value); - } + public bool IsBackgroundDimmed() => ((FadeAccessibleBackground)Background).CurrentColour == OsuColour.Gray(1 - (float)dimLevel.Value); - public bool AssertUndimmed() - { - return ((FadeAccessibleBackground)Background).CurrentColour == Color4.White; - } + public bool IsBackgroundUndimmed() => ((FadeAccessibleBackground)Background).CurrentColour == Color4.White; - public bool AssertInvisible() - { - return ((FadeAccessibleBackground)Background).CurrentAlpha == 0; - } + public bool IsBackgroundInvisible() => ((FadeAccessibleBackground)Background).CurrentAlpha == 0; - public bool AssertVisible() - { - return ((FadeAccessibleBackground)Background).CurrentAlpha == 1; - } + public bool IsBackgroundVisible() => ((FadeAccessibleBackground)Background).CurrentAlpha == 1; /// /// Make sure every time a screen gets pushed, the background doesn't get replaced /// /// Whether or not the original background (The one created in DummySongSelect) is still the current background - public bool AssertBackgroundCurrent() - { - return ((FadeAccessibleBackground)Background).IsCurrentScreen(); - } + public bool IsBackgroundCurrent() => ((FadeAccessibleBackground)Background).IsCurrentScreen(); } private class FadeAccesibleResults : SoloResults From e91c07209ffc948c0934defd23b79afffffcefcd Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Tue, 26 Feb 2019 09:54:42 +0900 Subject: [PATCH 224/327] Move MainMenu initialisation from ctor to load --- osu.Game/Screens/Menu/MainMenu.cs | 57 ++++++++++++++----------------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/osu.Game/Screens/Menu/MainMenu.cs b/osu.Game/Screens/Menu/MainMenu.cs index 5aa85b6e71..234fb808c3 100644 --- a/osu.Game/Screens/Menu/MainMenu.cs +++ b/osu.Game/Screens/Menu/MainMenu.cs @@ -25,7 +25,7 @@ namespace osu.Game.Screens.Menu { public class MainMenu : OsuScreen { - private readonly ButtonSystem buttons; + private ButtonSystem buttons; public override bool HideOverlaysOnEnter => buttons.State == ButtonSystemState.Initial; @@ -35,26 +35,39 @@ namespace osu.Game.Screens.Menu private Screen songSelect; - private readonly MenuSideFlashes sideFlashes; + private MenuSideFlashes sideFlashes; [Resolved] private GameHost host { get; set; } protected override BackgroundScreen CreateBackground() => new BackgroundScreenDefault(); - public MainMenu() + [BackgroundDependencyLoader(true)] + private void load(OsuGame game = null) { - sideFlashes = new MenuSideFlashes(); + if (host.CanExit) + AddInternal(new ExitConfirmOverlay { Action = this.Exit }); - buttons = new ButtonSystem + AddRangeInternal(new Drawable[] { - OnChart = delegate { this.Push(new ChartListing()); }, - OnDirect = delegate { this.Push(new OnlineListing()); }, - OnEdit = delegate { this.Push(new Editor()); }, - OnSolo = onSolo, - OnMulti = delegate { this.Push(new Multiplayer()); }, - OnExit = this.Exit, - }; + new ParallaxContainer + { + ParallaxAmount = 0.01f, + Children = new Drawable[] + { + buttons = new ButtonSystem + { + OnChart = delegate { this.Push(new ChartListing()); }, + OnDirect = delegate { this.Push(new OnlineListing()); }, + OnEdit = delegate { this.Push(new Editor()); }, + OnSolo = onSolo, + OnMulti = delegate { this.Push(new Multiplayer()); }, + OnExit = this.Exit, + } + } + }, + sideFlashes = new MenuSideFlashes(), + }); buttons.StateChanged += state => { @@ -69,26 +82,6 @@ namespace osu.Game.Screens.Menu break; } }; - } - - [BackgroundDependencyLoader(true)] - private void load(OsuGame game = null) - { - if (host.CanExit) - { - AddInternal(new ExitConfirmOverlay - { - Action = this.Exit, - }); - } - - AddInternal(new ParallaxContainer - { - ParallaxAmount = 0.01f, - Child = buttons, - }); - - AddInternal(sideFlashes); if (game != null) { From c58d305fc67540ddd44faefb0d80b327dba871db Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Feb 2019 09:56:22 +0900 Subject: [PATCH 225/327] private goes after public --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 81 ++++++++++--------- 1 file changed, 43 insertions(+), 38 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 8002255b54..046e8048b1 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -45,43 +45,9 @@ namespace osu.Game.Tests.Visual [Cached] private BackgroundScreenStack backgroundStack; - private void performSetup() - { - createSongSelect(); - - AddStep("Load new player to song select", () => songSelect.Push(player = new DimAccessiblePlayer { Ready = true })); - AddUntilStep(() => player?.IsLoaded ?? false, "Wait for player to load"); - } - - private void createSongSelect() - { - AddStep("Create song select if required", () => - { - if (songSelect == null) - { - LoadComponentAsync(new DummySongSelect(), p => - { - songSelect = p; - screen.Push(p); - songSelect.UpdateBindables(); - }); - } - }); - AddUntilStep(() => songSelect?.IsLoaded ?? false, "Wait for song select to load"); - AddUntilStep(() => - { - if (!songSelect.IsCurrentScreen()) - { - songSelect.MakeCurrent(); - return false; - } - return true; - }, "Wait for song select is current"); - } - public TestCaseBackgroundScreenBeatmap() { - InputManager.Add(backgroundStack = new BackgroundScreenStack {RelativeSizeAxes = Axes.Both}); + InputManager.Add(backgroundStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both }); InputManager.Add(screen = new ScreenStack { RelativeSizeAxes = Axes.Both }); AddStep("Create beatmap", () => @@ -190,6 +156,7 @@ namespace osu.Game.Tests.Visual songSelect.MakeCurrent(); return false; } + return true; }, "Wait for song select is current"); AddWaitStep(5, "Wait for dim"); @@ -243,7 +210,7 @@ namespace osu.Game.Tests.Visual public void TransitionTest() { performSetup(); - AddStep("Transition to Results", () => player.Push(new FadeAccesibleResults(new ScoreInfo { User = new User { Username = "osu!" }}))); + AddStep("Transition to Results", () => player.Push(new FadeAccesibleResults(new ScoreInfo { User = new User { Username = "osu!" } }))); AddWaitStep(5, "Wait for dim"); AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent()); @@ -263,12 +230,48 @@ namespace osu.Game.Tests.Visual songSelect.MakeCurrent(); return false; } + return true; }, "Wait for song select is current"); AddWaitStep(5, "Wait for dim"); AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); } + private void performSetup() + { + createSongSelect(); + + AddStep("Load new player to song select", () => songSelect.Push(player = new DimAccessiblePlayer { Ready = true })); + AddUntilStep(() => player?.IsLoaded ?? false, "Wait for player to load"); + } + + private void createSongSelect() + { + AddStep("Create song select if required", () => + { + if (songSelect == null) + { + LoadComponentAsync(new DummySongSelect(), p => + { + songSelect = p; + screen.Push(p); + songSelect.UpdateBindables(); + }); + } + }); + AddUntilStep(() => songSelect?.IsLoaded ?? false, "Wait for song select to load"); + AddUntilStep(() => + { + if (!songSelect.IsCurrentScreen()) + { + songSelect.MakeCurrent(); + return false; + } + + return true; + }, "Wait for song select is current"); + } + private class DummySongSelect : OsuScreen { protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); @@ -303,7 +306,8 @@ namespace osu.Game.Tests.Visual private class FadeAccesibleResults : SoloResults { - public FadeAccesibleResults(ScoreInfo score) : base(score) + public FadeAccesibleResults(ScoreInfo score) + : base(score) { } @@ -337,7 +341,8 @@ namespace osu.Game.Tests.Visual public VisualSettings VisualSettingsPos => VisualSettings; public BackgroundScreen ScreenPos => Background; - public DimAccessiblePlayerLoader(Player player) : base(() => player) + public DimAccessiblePlayerLoader(Player player) + : base(() => player) { } From 217f692798e54e6c07a314430e6b8a6954b987c0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Feb 2019 10:11:36 +0900 Subject: [PATCH 226/327] Extract wait logic into separate method Also reduces the required wait time. --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 046e8048b1..2fe6498a09 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -87,7 +87,7 @@ namespace osu.Game.Tests.Visual InputManager.MoveMouseTo(playerLoader.VisualSettingsPos); }); - AddWaitStep(5, "Wait for dim"); + waitForDim(); AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); } @@ -114,7 +114,7 @@ namespace osu.Game.Tests.Visual InputManager.MoveMouseTo(playerLoader.VisualSettingsPos); InputManager.MoveMouseTo(playerLoader.ScreenPos); }); - AddWaitStep(5, "Wait for dim"); + waitForDim(); AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); } @@ -130,10 +130,10 @@ namespace osu.Game.Tests.Visual player.ReplacesBackground.Value = true; player.StoryboardEnabled.Value = true; }); - AddWaitStep(5, "Wait for dim"); + waitForDim(); AddAssert("Background is invisible", () => songSelect.IsBackgroundInvisible()); AddStep("Disable storyboard", () => player.ReplacesBackground.Value = false); - AddWaitStep(5, "Wait for dim"); + waitForDim(); AddAssert("Background is visible", () => songSelect.IsBackgroundVisible()); } @@ -159,7 +159,7 @@ namespace osu.Game.Tests.Visual return true; }, "Wait for song select is current"); - AddWaitStep(5, "Wait for dim"); + waitForDim(); AddAssert("Background is visible", () => songSelect.IsBackgroundVisible()); } @@ -171,7 +171,7 @@ namespace osu.Game.Tests.Visual { performSetup(); AddStep("Test User Undimming", () => songSelect.DimEnabled.Value = false); - AddWaitStep(5, "Wait for dim"); + waitForDim(); AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); } @@ -183,7 +183,7 @@ namespace osu.Game.Tests.Visual { performSetup(); AddStep("Test User Dimming", () => songSelect.DimEnabled.Value = true); - AddWaitStep(5, "Wait for dim"); + waitForDim(); AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); } @@ -199,7 +199,7 @@ namespace osu.Game.Tests.Visual if (!player.IsPaused.Value) player.Exit(); }); - AddWaitStep(5, "Wait for dim"); + waitForDim(); AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); } @@ -211,7 +211,7 @@ namespace osu.Game.Tests.Visual { performSetup(); AddStep("Transition to Results", () => player.Push(new FadeAccesibleResults(new ScoreInfo { User = new User { Username = "osu!" } }))); - AddWaitStep(5, "Wait for dim"); + waitForDim(); AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent()); } @@ -233,10 +233,12 @@ namespace osu.Game.Tests.Visual return true; }, "Wait for song select is current"); - AddWaitStep(5, "Wait for dim"); + waitForDim(); AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); } + private void waitForDim() => AddWaitStep(3, "Wait for dim"); + private void performSetup() { createSongSelect(); From 3549369822540125889043728fc3d24209631be7 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Feb 2019 10:27:54 +0900 Subject: [PATCH 227/327] Restore previous wait time For whatever reason, this is required? --- osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 2fe6498a09..d05faec52c 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -237,7 +237,7 @@ namespace osu.Game.Tests.Visual AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); } - private void waitForDim() => AddWaitStep(3, "Wait for dim"); + private void waitForDim() => AddWaitStep(5, "Wait for dim"); private void performSetup() { From 8a943a6e6511bb0418030d72b30891a75d2a2e83 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 26 Feb 2019 13:10:07 +0900 Subject: [PATCH 228/327] Fix scores being stored as ints --- osu.Game/Migrations/OsuDbContextModelSnapshot.cs | 4 ++-- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 2 +- osu.Game/Scoring/ScoreInfo.cs | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs index 2dafedc3ac..4505444d58 100644 --- a/osu.Game/Migrations/OsuDbContextModelSnapshot.cs +++ b/osu.Game/Migrations/OsuDbContextModelSnapshot.cs @@ -14,7 +14,7 @@ namespace osu.Game.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "2.2.0-rtm-35687"); + .HasAnnotation("ProductVersion", "2.2.1-servicing-10028"); modelBuilder.Entity("osu.Game.Beatmaps.BeatmapDifficulty", b => { @@ -336,7 +336,7 @@ namespace osu.Game.Migrations b.Property("StatisticsJson") .HasColumnName("Statistics"); - b.Property("TotalScore"); + b.Property("TotalScore"); b.Property("UserString") .HasColumnName("User"); diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 1e7a324acf..5c8ef41b9a 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -168,7 +168,7 @@ namespace osu.Game.Rulesets.Scoring /// public virtual void PopulateScore(ScoreInfo score) { - score.TotalScore = (int)Math.Round(TotalScore.Value); + score.TotalScore = (long)Math.Round(TotalScore.Value); score.Combo = Combo.Value; score.MaxCombo = HighestCombo.Value; score.Accuracy = Math.Round(Accuracy.Value, 4); diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs index c88fd77eb2..a71ef9d64d 100644 --- a/osu.Game/Scoring/ScoreInfo.cs +++ b/osu.Game/Scoring/ScoreInfo.cs @@ -25,7 +25,7 @@ namespace osu.Game.Scoring public ScoreRank Rank { get; set; } [JsonProperty("total_score")] - public int TotalScore { get; set; } + public long TotalScore { get; set; } [JsonProperty("accuracy")] [Column(TypeName="DECIMAL(1,4)")] From c1432b2ed58fb1a73de9549b6c42391e56930595 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Feb 2019 15:48:34 +0900 Subject: [PATCH 229/327] Add back newline --- osu.Game/Screens/Select/BeatmapDetails.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 697fed599f..5b80d51a6c 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -346,6 +346,7 @@ namespace osu.Game.Screens.Select textContainer.FadeOut(transition_duration); return; } + setTextAsync(value); } } From 2d6d9dd723c3cbf1fa9e35eded14d122dacabd8b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Feb 2019 16:09:45 +0900 Subject: [PATCH 230/327] Add better easing --- osu.Game/Screens/Select/BeatmapDetails.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 5b80d51a6c..c754f1e43a 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osuTK; @@ -116,6 +116,7 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.X, AutoSizeAxes = Axes.Y, LayoutDuration = transition_duration, + LayoutEasing = Easing.OutQuad, Spacing = new Vector2(spacing * 2), Margin = new MarginPadding { Top = spacing * 2 }, Children = new[] From d9872dda12d488d4faf8cde1f8ac76209e232c5a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Feb 2019 16:10:06 +0900 Subject: [PATCH 231/327] Use fade instead of negative margin --- osu.Game/Screens/Select/BeatmapDetails.cs | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index c754f1e43a..9f9263927e 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using osuTK; @@ -185,8 +185,6 @@ namespace osu.Game.Screens.Select source.Text = Beatmap.Metadata.Source; tags.Text = Beatmap.Metadata.Tags; - tags.Margin = new MarginPadding { Top = string.IsNullOrEmpty(Beatmap.Metadata.Source) ? -2 * spacing : 0 }; - var requestedBeatmap = Beatmap; if (requestedBeatmap.Metrics == null) { @@ -333,21 +331,18 @@ namespace osu.Game.Screens.Select }; } - public MarginPadding Margin - { - set => textContainer.Margin = value; - } - public string Text { set { if (string.IsNullOrEmpty(value)) { - textContainer.FadeOut(transition_duration); + this.FadeOut(transition_duration); return; } + this.FadeIn(transition_duration); + setTextAsync(value); } } From 5b88c2ea0f834cdcfc501efc0e2ce1b2f4c9b32f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Feb 2019 16:12:40 +0900 Subject: [PATCH 232/327] Add visual test --- .../Visual/TestCaseBeatmapDetails.cs | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapDetails.cs b/osu.Game.Tests/Visual/TestCaseBeatmapDetails.cs index bc4f89ac26..84af6453f5 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapDetails.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapDetails.cs @@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual Padding = new MarginPadding(150), }); - AddStep("beatmap all metrics", () => details.Beatmap = new BeatmapInfo + AddStep("all metrics", () => details.Beatmap = new BeatmapInfo { Version = "All Metrics", Metadata = new BeatmapMetadata @@ -45,7 +45,30 @@ namespace osu.Game.Tests.Visual }, }); - AddStep("beatmap ratings", () => details.Beatmap = new BeatmapInfo + AddStep("all except source", () => details.Beatmap = new BeatmapInfo + { + Version = "All Metrics", + Metadata = new BeatmapMetadata + { + Tags = "this beatmap has all the metrics", + }, + BaseDifficulty = new BeatmapDifficulty + { + CircleSize = 7, + DrainRate = 1, + OverallDifficulty = 5.7f, + ApproachRate = 3.5f, + }, + StarDifficulty = 5.3f, + Metrics = new BeatmapMetrics + { + Ratings = Enumerable.Range(0, 11), + Fails = Enumerable.Range(1, 100).Select(i => i % 12 - 6), + Retries = Enumerable.Range(-2, 100).Select(i => i % 12 - 6), + }, + }); + + AddStep("ratings", () => details.Beatmap = new BeatmapInfo { Version = "Only Ratings", Metadata = new BeatmapMetadata @@ -67,7 +90,7 @@ namespace osu.Game.Tests.Visual }, }); - AddStep("beatmap fails retries", () => details.Beatmap = new BeatmapInfo + AddStep("fails retries", () => details.Beatmap = new BeatmapInfo { Version = "Only Retries and Fails", Metadata = new BeatmapMetadata @@ -90,7 +113,7 @@ namespace osu.Game.Tests.Visual }, }); - AddStep("beatmap no metrics", () => details.Beatmap = new BeatmapInfo + AddStep("no metrics", () => details.Beatmap = new BeatmapInfo { Version = "No Metrics", Metadata = new BeatmapMetadata From 60ecb99dfb9326759cdac72564d523c7f478454d Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 26 Feb 2019 17:31:21 +0900 Subject: [PATCH 233/327] Have test cases create a new screen stack each time --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 127 +++++++++--------- 1 file changed, 63 insertions(+), 64 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index d05faec52c..105bf28374 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -3,11 +3,14 @@ using System; using System.Collections.Generic; +using System.Globalization; using System.Threading; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Logging; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Configuration; @@ -34,42 +37,15 @@ namespace osu.Game.Tests.Visual typeof(ScreenWithBeatmapBackground), typeof(PlayerLoader), typeof(Player), - typeof(UserDimContainer) + typeof(UserDimContainer), + typeof(OsuScreen) }; private DummySongSelect songSelect; private DimAccessiblePlayerLoader playerLoader; private DimAccessiblePlayer player; - private readonly ScreenStack screen; - [Cached] - private BackgroundScreenStack backgroundStack; - - public TestCaseBackgroundScreenBeatmap() - { - InputManager.Add(backgroundStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both }); - InputManager.Add(screen = new ScreenStack { RelativeSizeAxes = Axes.Both }); - - AddStep("Create beatmap", () => - { - Beatmap.Value = new TestWorkingBeatmap(new Beatmap - { - HitObjects = - { - new HitCircle - { - StartTime = 3000, - Position = new Vector2(0, 0), - }, - new HitCircle - { - StartTime = 15000, - Position = new Vector2(0, 0), - } - }, - }); - }); - } + private ScreenStackCacheContainer screenStackContainer; /// /// Check if PlayerLoader properly triggers background dim previews when a user hovers over the visual settings panel. @@ -100,7 +76,7 @@ namespace osu.Game.Tests.Visual public void PlayerLoaderTransitionTest() { createSongSelect(); - AddStep("Start player loader", () => songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer()))); + AddStep("Start player loader", () => { songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer())); }); AddUntilStep(() => playerLoader?.IsLoaded ?? false, "Wait for Player Loader to load"); AddStep("Allow beatmap to load", () => { @@ -151,13 +127,9 @@ namespace osu.Game.Tests.Visual }); AddUntilStep(() => { - if (!songSelect.IsCurrentScreen()) - { - songSelect.MakeCurrent(); - return false; - } - - return true; + if (songSelect.IsCurrentScreen()) return true; + songSelect.MakeCurrent(); + return false; }, "Wait for song select is current"); waitForDim(); AddAssert("Background is visible", () => songSelect.IsBackgroundVisible()); @@ -243,40 +215,57 @@ namespace osu.Game.Tests.Visual { createSongSelect(); - AddStep("Load new player to song select", () => songSelect.Push(player = new DimAccessiblePlayer { Ready = true })); + AddStep("Load new player to song select", () => songSelect.Push(player = new DimAccessiblePlayer + { + Ready = true, + AllowLeadIn = false, + AllowResults = false, + })); AddUntilStep(() => player?.IsLoaded ?? false, "Wait for player to load"); } private void createSongSelect() { - AddStep("Create song select if required", () => + AddStep("Create new screen stack", () => { - if (songSelect == null) - { - LoadComponentAsync(new DummySongSelect(), p => - { - songSelect = p; - screen.Push(p); - songSelect.UpdateBindables(); - }); - } + screenStackContainer = new ScreenStackCacheContainer { RelativeSizeAxes = Axes.Both }; + Child = screenStackContainer; }); - AddUntilStep(() => songSelect?.IsLoaded ?? false, "Wait for song select to load"); - AddUntilStep(() => + AddStep("Create song select", () => { - if (!songSelect.IsCurrentScreen()) + songSelect = new DummySongSelect(); + screenStackContainer.ScreenStack.Push(songSelect); + }); + AddStep("Create beatmap", () => + { + Beatmap.Value = new TestWorkingBeatmap(new Beatmap { - songSelect.MakeCurrent(); - return false; - } - - return true; - }, "Wait for song select is current"); + HitObjects = + { + new HitCircle + { + StartTime = 3000, + Position = new Vector2(0, 0), + }, + new HitCircle + { + StartTime = 15000, + Position = new Vector2(0, 0), + } + }, + }); + }); } private class DummySongSelect : OsuScreen { - protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); + protected override BackgroundScreen CreateBackground() + { + FadeAccessibleBackground background = new FadeAccessibleBackground(); + DimEnabled.BindTo(background.EnableUserDim); + return background; + } + public readonly Bindable DimEnabled = new Bindable(); private readonly Bindable dimLevel = new Bindable(); @@ -284,11 +273,7 @@ namespace osu.Game.Tests.Visual private void load(OsuConfigManager config) { config.BindWith(OsuSetting.DimLevel, dimLevel); - } - - public void UpdateBindables() - { - DimEnabled.BindTo(((FadeAccessibleBackground)Background).EnableUserDim); + Logger.Log(dimLevel.Value.ToString(CultureInfo.InvariantCulture)); } public bool IsBackgroundDimmed() => ((FadeAccessibleBackground)Background).CurrentColour == OsuColour.Gray(1 - (float)dimLevel.Value); @@ -338,6 +323,20 @@ namespace osu.Game.Tests.Visual } } + private class ScreenStackCacheContainer : Container + { + [Cached] + private BackgroundScreenStack backgroundScreenStack; + + public readonly ScreenStack ScreenStack; + + public ScreenStackCacheContainer() + { + Add(backgroundScreenStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both }); + Add(ScreenStack = new ScreenStack { RelativeSizeAxes = Axes.Both }); + } + } + private class DimAccessiblePlayerLoader : PlayerLoader { public VisualSettings VisualSettingsPos => VisualSettings; From d23f399375af4d7b1a8c1f4c54181d9d56aeb949 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 26 Feb 2019 17:43:42 +0900 Subject: [PATCH 234/327] Add back song select wait --- osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 105bf28374..7e1d1c54d5 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -236,6 +236,7 @@ namespace osu.Game.Tests.Visual songSelect = new DummySongSelect(); screenStackContainer.ScreenStack.Push(songSelect); }); + AddUntilStep(() => songSelect?.IsLoaded ?? false, "Wait for song select to load"); AddStep("Create beatmap", () => { Beatmap.Value = new TestWorkingBeatmap(new Beatmap From 59fca568c9befbad42938fa1ee6448b657362a7a Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 26 Feb 2019 17:56:42 +0900 Subject: [PATCH 235/327] Remove null checks for synchronous loads --- osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 7e1d1c54d5..4c81cdc030 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -221,7 +221,7 @@ namespace osu.Game.Tests.Visual AllowLeadIn = false, AllowResults = false, })); - AddUntilStep(() => player?.IsLoaded ?? false, "Wait for player to load"); + AddUntilStep(() => player.IsLoaded, "Wait for player to load"); } private void createSongSelect() @@ -236,7 +236,7 @@ namespace osu.Game.Tests.Visual songSelect = new DummySongSelect(); screenStackContainer.ScreenStack.Push(songSelect); }); - AddUntilStep(() => songSelect?.IsLoaded ?? false, "Wait for song select to load"); + AddUntilStep(() => songSelect.IsLoaded, "Wait for song select to load"); AddStep("Create beatmap", () => { Beatmap.Value = new TestWorkingBeatmap(new Beatmap From bf6815b2a7496042bf63538349eaf048594c1a25 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Feb 2019 18:02:24 +0900 Subject: [PATCH 236/327] Fix OsuGame test case not working --- osu.Game.Tests/Visual/TestCaseOsuGame.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseOsuGame.cs b/osu.Game.Tests/Visual/TestCaseOsuGame.cs index c527bce683..9e649b92e4 100644 --- a/osu.Game.Tests/Visual/TestCaseOsuGame.cs +++ b/osu.Game.Tests/Visual/TestCaseOsuGame.cs @@ -4,10 +4,10 @@ using System; using System.Collections.Generic; using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; -using osu.Framework.Screens; -using osu.Game.Screens; +using osu.Framework.Platform; using osu.Game.Screens.Menu; using osuTK.Graphics; @@ -21,8 +21,12 @@ namespace osu.Game.Tests.Visual typeof(OsuLogo), }; - public TestCaseOsuGame() + [BackgroundDependencyLoader] + private void load(GameHost host) { + OsuGame game = new OsuGame(); + game.SetHost(host); + Children = new Drawable[] { new Box @@ -30,10 +34,7 @@ namespace osu.Game.Tests.Visual RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, - new ScreenStack(new Loader()) - { - RelativeSizeAxes = Axes.Both, - } + game }; } } From 2784df3b68fb63ad219c1848f2cbf827a1524f14 Mon Sep 17 00:00:00 2001 From: jorolf Date: Tue, 26 Feb 2019 15:36:07 +0100 Subject: [PATCH 237/327] Disable auto detected rules --- osu.sln.DotSettings | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 5efd16c357..ad0d8a55a2 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -223,6 +223,7 @@ QAT BNG UI + False HINT <?xml version="1.0" encoding="utf-16"?> <Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> From 26b74ad46a06a29ba6354ffc7d2a6c0bc300cff3 Mon Sep 17 00:00:00 2001 From: jorolf Date: Tue, 26 Feb 2019 16:24:23 +0100 Subject: [PATCH 238/327] Add flag to osu.iOS.sln.DotSettings --- osu.iOS.sln.DotSettings | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.iOS.sln.DotSettings b/osu.iOS.sln.DotSettings index 3f5bd9d34d..3b2b851d45 100644 --- a/osu.iOS.sln.DotSettings +++ b/osu.iOS.sln.DotSettings @@ -221,6 +221,7 @@ QAT BNG UI + False HINT <?xml version="1.0" encoding="utf-16"?> <Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> From 5b4319a80f3d35d3be052231acc95b257725b7e0 Mon Sep 17 00:00:00 2001 From: Joehu Date: Tue, 26 Feb 2019 21:01:28 -0800 Subject: [PATCH 239/327] Fix home button being cancelled by mod select again --- osu.Game/Screens/Select/SongSelect.cs | 6 ------ 1 file changed, 6 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 5ecbaf8d1f..de0ead3b7a 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -512,12 +512,6 @@ namespace osu.Game.Screens.Select if (base.OnExiting(next)) return true; - if (ModSelect.State == Visibility.Visible) - { - ModSelect.Hide(); - return true; - } - beatmapInfoWedge.State = Visibility.Hidden; this.FadeOut(100); From ebec944bb84f6e24033205ad77561a8d310a353d Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 27 Feb 2019 14:15:45 +0900 Subject: [PATCH 240/327] Use actual song select for test case with beatmap import --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 100 +++++++++++------- 1 file changed, 59 insertions(+), 41 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 4c81cdc030..6d7e2ea19c 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -3,28 +3,30 @@ using System; using System.Collections.Generic; -using System.Globalization; +using System.Linq; using System.Threading; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Logging; +using osu.Framework.Platform; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Configuration; +using osu.Game.Database; using osu.Game.Graphics; using osu.Game.Graphics.Containers; -using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Osu.Mods; using osu.Game.Scoring; using osu.Game.Screens; using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Play; using osu.Game.Screens.Play.PlayerSettings; -using osu.Game.Tests.Beatmaps; +using osu.Game.Screens.Select; +using osu.Game.Tests.Resources; using osu.Game.Users; -using osuTK; using osuTK.Graphics; namespace osu.Game.Tests.Visual @@ -44,9 +46,36 @@ namespace osu.Game.Tests.Visual private DummySongSelect songSelect; private DimAccessiblePlayerLoader playerLoader; private DimAccessiblePlayer player; + private DatabaseContextFactory factory; + private BeatmapManager manager; + private RulesetStore rulesets; private ScreenStackCacheContainer screenStackContainer; + [BackgroundDependencyLoader] + private void load(GameHost host) + { + factory = new DatabaseContextFactory(LocalStorage); + factory.ResetDatabase(); + + using (var usage = factory.Get()) + usage.Migrate(); + + factory.ResetDatabase(); + + using (var usage = factory.Get()) + usage.Migrate(); + + Dependencies.Cache(rulesets = new RulesetStore(factory)); + Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, null, host, Beatmap.Default)); + + Beatmap.SetDefault(); + } + + [SetUp] + public virtual void SetUp() => + Schedule(() => { manager?.Delete(manager.GetAllUsableBeatmapSets()); }); + /// /// Check if PlayerLoader properly triggers background dim previews when a user hovers over the visual settings panel. /// @@ -215,54 +244,37 @@ namespace osu.Game.Tests.Visual { createSongSelect(); - AddStep("Load new player to song select", () => songSelect.Push(player = new DimAccessiblePlayer + AddStep("Start player loader", () => { songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer { - Ready = true, AllowLeadIn = false, AllowResults = false, - })); + Ready = true, + })); }); + AddUntilStep(() => playerLoader.IsLoaded, "Wait for Player Loader to load"); + AddStep("Move mouse to center of screen", () => InputManager.MoveMouseTo(playerLoader.ScreenPos)); AddUntilStep(() => player.IsLoaded, "Wait for player to load"); } private void createSongSelect() { - AddStep("Create new screen stack", () => - { - screenStackContainer = new ScreenStackCacheContainer { RelativeSizeAxes = Axes.Both }; - Child = screenStackContainer; - }); - AddStep("Create song select", () => - { - songSelect = new DummySongSelect(); - screenStackContainer.ScreenStack.Push(songSelect); - }); + AddStep("Create new screen stack", () => Child = screenStackContainer = new ScreenStackCacheContainer { RelativeSizeAxes = Axes.Both }); + AddUntilStep(() => screenStackContainer.IsLoaded,"Wait for screen stack creation"); + AddStep("create new song select", () => screenStackContainer.ScreenStack.Push(songSelect = new DummySongSelect())); AddUntilStep(() => songSelect.IsLoaded, "Wait for song select to load"); - AddStep("Create beatmap", () => + AddStep("Add map", () => { - Beatmap.Value = new TestWorkingBeatmap(new Beatmap - { - HitObjects = - { - new HitCircle - { - StartTime = 3000, - Position = new Vector2(0, 0), - }, - new HitCircle - { - StartTime = 15000, - Position = new Vector2(0, 0), - } - }, - }); + var temp = TestResources.GetTestBeatmapForImport(); + manager.Import(temp); + Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { new OsuModNoFail() }); }); + AddUntilStep(() => songSelect.Carousel.SelectedBeatmap != null, "has selection"); } - private class DummySongSelect : OsuScreen + private class DummySongSelect : PlaySongSelect { protected override BackgroundScreen CreateBackground() { - FadeAccessibleBackground background = new FadeAccessibleBackground(); + FadeAccessibleBackground background = new FadeAccessibleBackground(Beatmap.Value); DimEnabled.BindTo(background.EnableUserDim); return background; } @@ -270,11 +282,12 @@ namespace osu.Game.Tests.Visual public readonly Bindable DimEnabled = new Bindable(); private readonly Bindable dimLevel = new Bindable(); + public new BeatmapCarousel Carousel => base.Carousel; + [BackgroundDependencyLoader] private void load(OsuConfigManager config) { config.BindWith(OsuSetting.DimLevel, dimLevel); - Logger.Log(dimLevel.Value.ToString(CultureInfo.InvariantCulture)); } public bool IsBackgroundDimmed() => ((FadeAccessibleBackground)Background).CurrentColour == OsuColour.Gray(1 - (float)dimLevel.Value); @@ -299,12 +312,12 @@ namespace osu.Game.Tests.Visual { } - protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); + protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value); } private class DimAccessiblePlayer : Player { - protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); + protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value); // Whether or not the player should be allowed to load. public bool Ready; @@ -348,7 +361,7 @@ namespace osu.Game.Tests.Visual { } - protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(); + protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value); } private class FadeAccessibleBackground : BackgroundScreenBeatmap @@ -358,6 +371,11 @@ namespace osu.Game.Tests.Visual public Color4 CurrentColour => ((TestUserDimContainer)FadeContainer).CurrentColour; public float CurrentAlpha => ((TestUserDimContainer)FadeContainer).CurrentAlpha; + public FadeAccessibleBackground(WorkingBeatmap beatmap) + : base(beatmap) + { + } + private class TestUserDimContainer : UserDimContainer { public Color4 CurrentColour => DimContainer.Colour; From 7c2ffb18269cfbb1d03724c9936935d09b1791a0 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Fri, 22 Feb 2019 11:26:06 +0000 Subject: [PATCH 241/327] Fix MatchSongSelect not handling beatmapset deletions --- .../Screens/Multi/Match/Components/ReadyButton.cs | 10 ++++++++++ osu.Game/Screens/Select/MatchSongSelect.cs | 15 ++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs b/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs index 3e4694e232..b299e70962 100644 --- a/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs +++ b/osu.Game/Screens/Multi/Match/Components/ReadyButton.cs @@ -39,6 +39,7 @@ namespace osu.Game.Screens.Multi.Match.Components private void load() { beatmaps.ItemAdded += beatmapAdded; + beatmaps.ItemRemoved += beatmapRemoved; Beatmap.BindValueChanged(b => updateBeatmap(b.NewValue), true); } @@ -62,6 +63,15 @@ namespace osu.Game.Screens.Multi.Match.Components Schedule(() => hasBeatmap = true); } + private void beatmapRemoved(BeatmapSetInfo model) + { + if (Beatmap.Value == null) + return; + + if (model.OnlineBeatmapSetID == Beatmap.Value.BeatmapSet.OnlineBeatmapSetID) + Schedule(() => hasBeatmap = false); + } + protected override void Update() { base.Update(); diff --git a/osu.Game/Screens/Select/MatchSongSelect.cs b/osu.Game/Screens/Select/MatchSongSelect.cs index cfeaa1785e..f54add6a36 100644 --- a/osu.Game/Screens/Select/MatchSongSelect.cs +++ b/osu.Game/Screens/Select/MatchSongSelect.cs @@ -3,8 +3,11 @@ using System; using Humanizer; +using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Screens; +using osu.Game.Beatmaps; using osu.Game.Online.Multiplayer; using osu.Game.Screens.Multi; @@ -17,6 +20,12 @@ namespace osu.Game.Screens.Select public string ShortTitle => "song selection"; public override string Title => ShortTitle.Humanize(); + [Resolved(typeof(Room))] + protected Bindable CurrentItem { get; private set; } + + [Resolved] + private BeatmapManager beatmaps { get; set; } + public MatchSongSelect() { Padding = new MarginPadding { Horizontal = HORIZONTAL_OVERFLOW_PADDING }; @@ -43,10 +52,14 @@ namespace osu.Game.Screens.Select public override bool OnExiting(IScreen next) { + if (base.OnExiting(next)) + return true; + + Beatmap.Value = beatmaps.GetWorkingBeatmap(CurrentItem.Value?.Beatmap); Beatmap.Disabled = true; Ruleset.Disabled = true; - return base.OnExiting(next); + return false; } public override void OnEntering(IScreen last) From 32bf940aa533618275d75d7e4fb43273bb9265db Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Feb 2019 15:43:20 +0900 Subject: [PATCH 242/327] Adjust comment for readability --- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 08cb35722a..387479c137 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -62,7 +62,8 @@ namespace osu.Game.Rulesets.Osu.UI if (c != null) { var original = c.ProxiedLayer; - // lifetime is set on LoadComplete so wait until it. + + // Hitobjects only have lifetimes set on LoadComplete, so approach circles should not be added until that point original.OnLoadComplete += addApproachCircleProxy; } From a3f71d69a904ac57c451ee32cec3efcd775c5397 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Wed, 27 Feb 2019 16:16:13 +0900 Subject: [PATCH 243/327] Ensure ruleset and mods are set correctly when leaving MatchSongSelect --- osu.Game/Screens/Select/MatchSongSelect.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Screens/Select/MatchSongSelect.cs b/osu.Game/Screens/Select/MatchSongSelect.cs index f54add6a36..bdff35e345 100644 --- a/osu.Game/Screens/Select/MatchSongSelect.cs +++ b/osu.Game/Screens/Select/MatchSongSelect.cs @@ -56,6 +56,10 @@ namespace osu.Game.Screens.Select return true; Beatmap.Value = beatmaps.GetWorkingBeatmap(CurrentItem.Value?.Beatmap); + Ruleset.Value = CurrentItem.Value?.Ruleset; + CurrentItem.Value?.RequiredMods.Clear(); + CurrentItem.Value?.RequiredMods.AddRange(SelectedMods.Value); + Beatmap.Disabled = true; Ruleset.Disabled = true; From c59d84fd21c0b6d33986709435f453786306d46e Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Wed, 27 Feb 2019 16:17:04 +0900 Subject: [PATCH 244/327] Add sanity check to prevent TimeshiftPlayer from starting with incorrect beatmap/ruleset/mods --- .../Screens/Multi/Play/TimeshiftPlayer.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs b/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs index d127bdc0ea..7d35276442 100644 --- a/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs +++ b/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using System.Diagnostics; using System.Threading; using osu.Framework.Allocation; @@ -11,6 +12,8 @@ using osu.Framework.Screens; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Online.Multiplayer; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; using osu.Game.Scoring; using osu.Game.Screens.Multi.Ranking; using osu.Game.Screens.Play; @@ -30,6 +33,12 @@ namespace osu.Game.Screens.Multi.Play [Resolved] private APIAccess api { get; set; } + [Resolved] + private IBindable ruleset { get; set; } + + [Resolved] + protected Bindable> CurrentMods { get; private set; } + public TimeshiftPlayer(PlaylistItem playlistItem) { this.playlistItem = playlistItem; @@ -44,6 +53,16 @@ namespace osu.Game.Screens.Multi.Play bool failed = false; + // Sanity checks to ensure that TimeshiftPlayer matches the settings for the current PlaylistItem + if (Beatmap.Value.BeatmapInfo.OnlineBeatmapID != playlistItem.Beatmap.OnlineBeatmapID) + throw new InvalidOperationException("Current Beatmap does not match PlaylistItem's Beatmap"); + + if (ruleset.Value.ID != playlistItem.Ruleset.ID) + throw new InvalidOperationException("Current Ruleset does not match PlaylistItem's Ruleset"); + + if (!CurrentMods.Value.Equals(playlistItem.RequiredMods)) + throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods"); + var req = new CreateRoomScoreRequest(roomId.Value ?? 0, playlistItem.ID); req.Success += r => token = r.ID; req.Failure += e => From f66fefb818faac6c5a008cc75b37235f0310cc13 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Feb 2019 16:30:10 +0900 Subject: [PATCH 245/327] Adjust comment + accessibility --- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index 290eb1c7a9..e1e76f109d 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -221,9 +221,9 @@ namespace osu.Game.Rulesets.Objects.Drawables } /// - /// Should be called at least once after lifetime of this hit object is end. + /// Will called at least once after the of this has been passed. /// - public void OnLifetimeEnd() + internal void OnLifetimeEnd() { foreach (var nested in NestedHitObjects) nested.OnLifetimeEnd(); From c13a5184f33e6e7ebf8e1381d4229ec7bc72685f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Feb 2019 16:35:11 +0900 Subject: [PATCH 246/327] Add more explanation --- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index 387479c137..dcf3a9dd9a 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -63,7 +63,8 @@ namespace osu.Game.Rulesets.Osu.UI { var original = c.ProxiedLayer; - // Hitobjects only have lifetimes set on LoadComplete, so approach circles should not be added until that point + // Hitobjects only have lifetimes set on LoadComplete. For nested hitobjects (e.g. SliderHeads), this only happens when the parenting slider becomes visible. + // This delegation is required to make sure that the approach circles for those not-yet-loaded objects aren't added prematurely. original.OnLoadComplete += addApproachCircleProxy; } From 30815ace62cc0580f9868999c6cf5a3597110638 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Feb 2019 16:52:34 +0900 Subject: [PATCH 247/327] Fix crossthread operations due to Track.Completed --- osu.Game/Audio/PreviewTrack.cs | 2 +- osu.Game/Overlays/MusicController.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Audio/PreviewTrack.cs b/osu.Game/Audio/PreviewTrack.cs index 5de2f2551d..fad4731f18 100644 --- a/osu.Game/Audio/PreviewTrack.cs +++ b/osu.Game/Audio/PreviewTrack.cs @@ -28,7 +28,7 @@ namespace osu.Game.Audio private void load() { track = GetTrack(); - track.Completed += Stop; + track.Completed += () => Schedule(Stop); } /// diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 6a71e91de9..7fbb7ec41e 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -351,11 +351,11 @@ namespace osu.Game.Overlays queuedDirection = null; } - private void currentTrackCompleted() + private void currentTrackCompleted() => Schedule(() => { if (!beatmap.Disabled && beatmapSets.Any()) next(); - } + }); private ScheduledDelegate pendingBeatmapSwitch; From 14ffd9efe834d7fca72b871daa5012fa5ad5b3ef Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 27 Feb 2019 17:02:04 +0900 Subject: [PATCH 248/327] Add fake storyboard to visually assess storyboard dim --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 52 ++++++++++++++----- osu.Game/Screens/Play/Player.cs | 14 ++--- 2 files changed, 46 insertions(+), 20 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 6d7e2ea19c..fa38598e4b 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -10,6 +10,8 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; using osu.Framework.Platform; using osu.Framework.Screens; using osu.Game.Beatmaps; @@ -27,6 +29,7 @@ using osu.Game.Screens.Play.PlayerSettings; using osu.Game.Screens.Select; using osu.Game.Tests.Resources; using osu.Game.Users; +using osuTK; using osuTK.Graphics; namespace osu.Game.Tests.Visual @@ -68,13 +71,21 @@ namespace osu.Game.Tests.Visual Dependencies.Cache(rulesets = new RulesetStore(factory)); Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, null, host, Beatmap.Default)); + Dependencies.Cache(new OsuConfigManager(LocalStorage)); Beatmap.SetDefault(); } [SetUp] - public virtual void SetUp() => - Schedule(() => { manager?.Delete(manager.GetAllUsableBeatmapSets()); }); + public virtual void SetUp() + { + Schedule(() => + { + manager.Delete(manager.GetAllUsableBeatmapSets()); + var temp = TestResources.GetTestBeatmapForImport(); + manager.Import(temp); + }); + } /// /// Check if PlayerLoader properly triggers background dim previews when a user hovers over the visual settings panel. @@ -134,9 +145,18 @@ namespace osu.Game.Tests.Visual { player.ReplacesBackground.Value = true; player.StoryboardEnabled.Value = true; + player.CurrentStoryboardContainer.Add(new SpriteText + { + Size = new Vector2(250, 50), + Alpha = 1, + Colour = Color4.White, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = "THIS IS A STORYBOARD", + }); }); waitForDim(); - AddAssert("Background is invisible", () => songSelect.IsBackgroundInvisible()); + AddAssert("Background is invisible, storyboard is visible", () => songSelect.IsBackgroundInvisible() && player.CurrentStoryboardContainer.Alpha == 1); AddStep("Disable storyboard", () => player.ReplacesBackground.Value = false); waitForDim(); AddAssert("Background is visible", () => songSelect.IsBackgroundVisible()); @@ -153,6 +173,11 @@ namespace osu.Game.Tests.Visual { player.ReplacesBackground.Value = true; player.StoryboardEnabled.Value = true; + player.CurrentStoryboardContainer.Add(new Box + { + Alpha = 1, + Colour = Color4.Tomato + }); }); AddUntilStep(() => { @@ -194,7 +219,7 @@ namespace osu.Game.Tests.Visual [Test] public void PauseTest() { - performSetup(); + performSetup(true); AddStep("Transition to Pause", () => { if (!player.IsPaused.Value) @@ -240,7 +265,7 @@ namespace osu.Game.Tests.Visual private void waitForDim() => AddWaitStep(5, "Wait for dim"); - private void performSetup() + private void performSetup(bool allowPause = false) { createSongSelect(); @@ -248,6 +273,7 @@ namespace osu.Game.Tests.Visual { AllowLeadIn = false, AllowResults = false, + AllowPause = allowPause, Ready = true, })); }); AddUntilStep(() => playerLoader.IsLoaded, "Wait for Player Loader to load"); @@ -259,15 +285,14 @@ namespace osu.Game.Tests.Visual { AddStep("Create new screen stack", () => Child = screenStackContainer = new ScreenStackCacheContainer { RelativeSizeAxes = Axes.Both }); AddUntilStep(() => screenStackContainer.IsLoaded,"Wait for screen stack creation"); - AddStep("create new song select", () => screenStackContainer.ScreenStack.Push(songSelect = new DummySongSelect())); + AddStep("Create new song select", () => screenStackContainer.ScreenStack.Push(songSelect = new DummySongSelect())); AddUntilStep(() => songSelect.IsLoaded, "Wait for song select to load"); - AddStep("Add map", () => + AddStep("Set user settings", () => { - var temp = TestResources.GetTestBeatmapForImport(); - manager.Import(temp); Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { new OsuModNoFail() }); + songSelect.DimLevel.Value = 0.7f; }); - AddUntilStep(() => songSelect.Carousel.SelectedBeatmap != null, "has selection"); + AddUntilStep(() => songSelect.Carousel.SelectedBeatmap != null, "Song select has selection"); } private class DummySongSelect : PlaySongSelect @@ -280,17 +305,17 @@ namespace osu.Game.Tests.Visual } public readonly Bindable DimEnabled = new Bindable(); - private readonly Bindable dimLevel = new Bindable(); + public readonly Bindable DimLevel = new Bindable(); public new BeatmapCarousel Carousel => base.Carousel; [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - config.BindWith(OsuSetting.DimLevel, dimLevel); + config.BindWith(OsuSetting.DimLevel, DimLevel); } - public bool IsBackgroundDimmed() => ((FadeAccessibleBackground)Background).CurrentColour == OsuColour.Gray(1 - (float)dimLevel.Value); + public bool IsBackgroundDimmed() => ((FadeAccessibleBackground)Background).CurrentColour == OsuColour.Gray(1 - (float)DimLevel.Value); public bool IsBackgroundUndimmed() => ((FadeAccessibleBackground)Background).CurrentColour == Color4.White; @@ -319,6 +344,7 @@ namespace osu.Game.Tests.Visual { protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value); + public UserDimContainer CurrentStoryboardContainer => StoryboardContainer; // Whether or not the player should be allowed to load. public bool Ready; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 8caa09cc7b..62b06b5dd1 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -87,7 +87,7 @@ namespace osu.Game.Screens.Play private FailOverlay failOverlay; private DrawableStoryboard storyboard; - private UserDimContainer storyboardContainer; + protected UserDimContainer StoryboardContainer; public bool LoadedBeatmapSuccessfully => RulesetContainer?.Objects.Any() == true; @@ -176,10 +176,10 @@ namespace osu.Game.Screens.Play CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded.Value, Children = new Container[] { - storyboardContainer = new UserDimContainer(true) + StoryboardContainer = new UserDimContainer(true) { RelativeSizeAxes = Axes.Both, - Alpha = 0, + Alpha = 1, EnableUserDim = { Value = true } }, new ScalingContainer(ScalingMode.Gameplay) @@ -355,7 +355,7 @@ namespace osu.Game.Screens.Play Background.EnableUserDim.Value = true; storyboardReplacesBackground.BindTo(Background.StoryboardReplacesBackground); - storyboardContainer.StoryboardReplacesBackground.BindTo(Background.StoryboardReplacesBackground); + StoryboardContainer.StoryboardReplacesBackground.BindTo(Background.StoryboardReplacesBackground); storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable; Task.Run(() => @@ -422,7 +422,7 @@ namespace osu.Game.Screens.Play private void initializeStoryboard(bool asyncLoad) { - if (storyboardContainer == null) + if (StoryboardContainer == null) return; var beatmap = Beatmap.Value; @@ -431,9 +431,9 @@ namespace osu.Game.Screens.Play storyboard.Masking = true; if (asyncLoad) - LoadComponentAsync(storyboard, storyboardContainer.Add); + LoadComponentAsync(storyboard, StoryboardContainer.Add); else - storyboardContainer.Add(storyboard); + StoryboardContainer.Add(storyboard); } protected override void UpdateBackgroundElements() From 1006c539be2dff48cef6fb506bb6fbff1669c3b3 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Feb 2019 17:03:09 +0900 Subject: [PATCH 249/327] Fix looping not being checked --- osu.Game/Overlays/MusicController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/MusicController.cs b/osu.Game/Overlays/MusicController.cs index 7fbb7ec41e..6ac597451d 100644 --- a/osu.Game/Overlays/MusicController.cs +++ b/osu.Game/Overlays/MusicController.cs @@ -353,7 +353,7 @@ namespace osu.Game.Overlays private void currentTrackCompleted() => Schedule(() => { - if (!beatmap.Disabled && beatmapSets.Any()) + if (!current.Track.Looping && !beatmap.Disabled && beatmapSets.Any()) next(); }); From 882fff16312ff6bcb73b30c3d687a970bc5cd79c Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 27 Feb 2019 17:56:44 +0900 Subject: [PATCH 250/327] Assert storyboard visibilty at both steps of toggle --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 69 +++++++++++-------- osu.Game/Screens/Play/Player.cs | 14 ++-- 2 files changed, 48 insertions(+), 35 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index fa38598e4b..44d2bce0e6 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -141,25 +141,16 @@ namespace osu.Game.Tests.Visual public void StoryboardBackgroundVisibilityTest() { performSetup(); - AddStep("Enable storyboard", () => + createFakeStoryboard(); + waitForDim(); + AddAssert("Background is invisible, storyboard is visible", () => songSelect.IsBackgroundInvisible() && player.IsStoryboardVisible()); + AddStep("Disable storyboard", () => { - player.ReplacesBackground.Value = true; - player.StoryboardEnabled.Value = true; - player.CurrentStoryboardContainer.Add(new SpriteText - { - Size = new Vector2(250, 50), - Alpha = 1, - Colour = Color4.White, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Text = "THIS IS A STORYBOARD", - }); + player.ReplacesBackground.Value = false; + player.StoryboardEnabled.Value = false; }); waitForDim(); - AddAssert("Background is invisible, storyboard is visible", () => songSelect.IsBackgroundInvisible() && player.CurrentStoryboardContainer.Alpha == 1); - AddStep("Disable storyboard", () => player.ReplacesBackground.Value = false); - waitForDim(); - AddAssert("Background is visible", () => songSelect.IsBackgroundVisible()); + AddAssert("Background is visible, storyboard is invisible", () => songSelect.IsBackgroundVisible() && player.IsStoryboardInvisible()); } /// @@ -169,16 +160,7 @@ namespace osu.Game.Tests.Visual public void StoryboardTransitionTest() { performSetup(); - AddStep("Enable storyboard", () => - { - player.ReplacesBackground.Value = true; - player.StoryboardEnabled.Value = true; - player.CurrentStoryboardContainer.Add(new Box - { - Alpha = 1, - Colour = Color4.Tomato - }); - }); + createFakeStoryboard(); AddUntilStep(() => { if (songSelect.IsCurrentScreen()) return true; @@ -265,6 +247,17 @@ namespace osu.Game.Tests.Visual private void waitForDim() => AddWaitStep(5, "Wait for dim"); + private void createFakeStoryboard() => AddStep("Enable storyboard", () => + { + player.ReplacesBackground.Value = true; + player.StoryboardEnabled.Value = true; + player.CurrentStoryboardContainer.Add(new Box + { + Alpha = 1, + Colour = Color4.Tomato + }); + }); + private void performSetup(bool allowPause = false) { createSongSelect(); @@ -344,6 +337,16 @@ namespace osu.Game.Tests.Visual { protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value); + protected override UserDimContainer CreateStoryboardContainer() + { + return new TestUserDimContainer(true) + { + RelativeSizeAxes = Axes.Both, + Alpha = 1, + EnableUserDim = { Value = true } + }; + } + public UserDimContainer CurrentStoryboardContainer => StoryboardContainer; // Whether or not the player should be allowed to load. public bool Ready; @@ -352,6 +355,10 @@ namespace osu.Game.Tests.Visual public readonly Bindable ReplacesBackground = new Bindable(); public readonly Bindable IsPaused = new Bindable(); + public bool IsStoryboardVisible() => ((TestUserDimContainer)CurrentStoryboardContainer).CurrentAlpha == 1; + + public bool IsStoryboardInvisible() => ((TestUserDimContainer)CurrentStoryboardContainer).CurrentAlpha <= 1; + [BackgroundDependencyLoader] private void load(OsuConfigManager config) { @@ -401,12 +408,16 @@ namespace osu.Game.Tests.Visual : base(beatmap) { } + } - private class TestUserDimContainer : UserDimContainer + private class TestUserDimContainer : UserDimContainer + { + public TestUserDimContainer(bool isStoryboard = false) + : base(isStoryboard) { - public Color4 CurrentColour => DimContainer.Colour; - public float CurrentAlpha => DimContainer.Alpha; } + public Color4 CurrentColour => DimContainer.Colour; + public float CurrentAlpha => DimContainer.Alpha; } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 62b06b5dd1..fc57ba089d 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -89,6 +89,13 @@ namespace osu.Game.Screens.Play private DrawableStoryboard storyboard; protected UserDimContainer StoryboardContainer; + protected virtual UserDimContainer CreateStoryboardContainer() => new UserDimContainer(true) + { + RelativeSizeAxes = Axes.Both, + Alpha = 1, + EnableUserDim = { Value = true } + }; + public bool LoadedBeatmapSuccessfully => RulesetContainer?.Objects.Any() == true; [BackgroundDependencyLoader] @@ -176,12 +183,7 @@ namespace osu.Game.Screens.Play CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded.Value, Children = new Container[] { - StoryboardContainer = new UserDimContainer(true) - { - RelativeSizeAxes = Axes.Both, - Alpha = 1, - EnableUserDim = { Value = true } - }, + StoryboardContainer = CreateStoryboardContainer(), new ScalingContainer(ScalingMode.Gameplay) { Child = new LocalSkinOverrideContainer(working.Skin) From 246240e93635faeb0bd172eb31699d7033500ba4 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 27 Feb 2019 18:04:33 +0900 Subject: [PATCH 251/327] Remove unused includes --- osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 44d2bce0e6..47ea1a0213 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -11,7 +11,6 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Framework.Graphics.Sprites; using osu.Framework.Platform; using osu.Framework.Screens; using osu.Game.Beatmaps; @@ -29,7 +28,6 @@ using osu.Game.Screens.Play.PlayerSettings; using osu.Game.Screens.Select; using osu.Game.Tests.Resources; using osu.Game.Users; -using osuTK; using osuTK.Graphics; namespace osu.Game.Tests.Visual From a8bc87f5d8c8181ce91c8d93c88a4a5ea6db618e Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Feb 2019 18:52:39 +0900 Subject: [PATCH 252/327] Add basic skin tests Should be expanded in the future. Bare minimum for now to test fail case. --- .../Visual/TestCaseSkinReloadable.cs | 151 ++++++++++++++++++ 1 file changed, 151 insertions(+) create mode 100644 osu.Game.Tests/Visual/TestCaseSkinReloadable.cs diff --git a/osu.Game.Tests/Visual/TestCaseSkinReloadable.cs b/osu.Game.Tests/Visual/TestCaseSkinReloadable.cs new file mode 100644 index 0000000000..aac9d2b812 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseSkinReloadable.cs @@ -0,0 +1,151 @@ +using System; +using NUnit.Framework; +using osu.Framework.Audio.Sample; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osu.Framework.Graphics.Textures; +using osu.Game.Graphics; +using osu.Game.Skinning; +using osuTK.Graphics; + +namespace osu.Game.Tests.Visual +{ + public class TestCaseSkinReloadable : OsuTestCase + { + + [Test] + public void TestInitialLoad() + { + var secondarySource = new SecondarySource(); + SkinConsumer consumer = null; + + AddStep("setup layout", () => + { + Child = new SkinSourceContainer + { + RelativeSizeAxes = Axes.Both, + Child = new LocalSkinOverrideContainer(secondarySource) + { + RelativeSizeAxes = Axes.Both, + Child = consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation"), source => true) + } + }; + }); + + AddAssert("consumer using override source", () => consumer.Drawable is SecondarySourceBox); + AddAssert("skinchanged only called once", () => consumer.SkinChangedCount == 1); + } + + [Test] + public void TestOverride() + { + var secondarySource = new SecondarySource(); + + SkinConsumer consumer = null; + Container target = null; + + AddStep("setup layout", () => + { + Child = new SkinSourceContainer + { + RelativeSizeAxes = Axes.Both, + Child = target = new LocalSkinOverrideContainer(secondarySource) + { + RelativeSizeAxes = Axes.Both, + } + }; + }); + + AddStep("add permissive", () => target.Add(consumer = new SkinConsumer("test", name => new NamedBox("Default Implementation"), source => true))); + AddAssert("consumer using override source", () => consumer.Drawable is SecondarySourceBox); + AddAssert("skinchanged only called once", () => consumer.SkinChangedCount == 1); + } + + private class NamedBox : Container + { + public NamedBox(string name) + { + Children = new Drawable[] + { + new Box + { + Colour = Color4.Black, + RelativeSizeAxes = Axes.Both, + }, + new SpriteText + { + Font = OsuFont.Default.With(size: 40), + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = name + } + }; + } + } + + private class SkinConsumer : SkinnableDrawable + { + public new Drawable Drawable => base.Drawable; + public int SkinChangedCount { get; private set; } + + public SkinConsumer(string name, Func defaultImplementation, Func allowFallback = null, bool restrictSize = true) + : base(name, defaultImplementation, allowFallback, restrictSize) + { + } + + protected override void SkinChanged(ISkinSource skin, bool allowFallback) + { + base.SkinChanged(skin, allowFallback); + SkinChangedCount++; + } + } + + private class BaseSourceBox : NamedBox + { + public BaseSourceBox() + : base("Base Source") + { + } + } + + private class SecondarySourceBox : NamedBox + { + public SecondarySourceBox() + : base("Secondary Source") + { + } + } + + private class SecondarySource : ISkinSource + { + public event Action SourceChanged; + + public void TriggerSourceChanged() => SourceChanged?.Invoke(); + + public Drawable GetDrawableComponent(string componentName) => new SecondarySourceBox(); + + public Texture GetTexture(string componentName) => throw new NotImplementedException(); + + public SampleChannel GetSample(string sampleName) => throw new NotImplementedException(); + + public TValue GetValue(Func query) where TConfiguration : SkinConfiguration => throw new NotImplementedException(); + } + + private class SkinSourceContainer : Container, ISkinSource + { + public event Action SourceChanged; + + public void TriggerSourceChanged() => SourceChanged?.Invoke(); + + public Drawable GetDrawableComponent(string componentName) => new BaseSourceBox(); + + public Texture GetTexture(string componentName) => throw new NotImplementedException(); + + public SampleChannel GetSample(string sampleName) => throw new NotImplementedException(); + + public TValue GetValue(Func query) where TConfiguration : SkinConfiguration => throw new NotImplementedException(); + } + } +} From 9473b53226abb8021335fec61d7f786c4da56957 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Feb 2019 14:30:04 +0900 Subject: [PATCH 253/327] Avoid redundant (synchronous) skin change --- .../Skinning/LocalSkinOverrideContainer.cs | 27 +++++++------------ 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index 36e95f4038..349a4ea9d8 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -71,27 +71,20 @@ namespace osu.Game.Skinning var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); fallbackSource = dependencies.Get(); - dependencies.CacheAs(this); - - return dependencies; - } - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - config.BindWith(OsuSetting.BeatmapSkins, beatmapSkins); - config.BindWith(OsuSetting.BeatmapHitsounds, beatmapHitsounds); - } - - protected override void LoadComplete() - { - base.LoadComplete(); - if (fallbackSource != null) fallbackSource.SourceChanged += onSourceChanged; + dependencies.CacheAs(this); + + var config = dependencies.Get(); + + config.BindWith(OsuSetting.BeatmapSkins, beatmapSkins); + config.BindWith(OsuSetting.BeatmapHitsounds, beatmapHitsounds); + beatmapSkins.BindValueChanged(_ => onSourceChanged()); - beatmapHitsounds.BindValueChanged(_ => onSourceChanged(), true); + beatmapHitsounds.BindValueChanged(_ => onSourceChanged()); + + return dependencies; } protected override void Dispose(bool isDisposing) From b555f793d9be5b51680f2b1b98e894bfbf625003 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Feb 2019 18:57:27 +0900 Subject: [PATCH 254/327] Fix whitespace --- osu.Game.Tests/Visual/TestCaseSkinReloadable.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseSkinReloadable.cs b/osu.Game.Tests/Visual/TestCaseSkinReloadable.cs index aac9d2b812..05e1c58768 100644 --- a/osu.Game.Tests/Visual/TestCaseSkinReloadable.cs +++ b/osu.Game.Tests/Visual/TestCaseSkinReloadable.cs @@ -14,7 +14,6 @@ namespace osu.Game.Tests.Visual { public class TestCaseSkinReloadable : OsuTestCase { - [Test] public void TestInitialLoad() { From 8c4a59e57ea48c8b9a0b1845bde8f3ce11d2e4da Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Feb 2019 16:42:09 +0900 Subject: [PATCH 255/327] Fix SquareGraph more --- osu.Game/Screens/Play/SquareGraph.cs | 29 +++++++++++++--------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index ad52c31108..aa6a657ed3 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -12,6 +12,8 @@ using osu.Framework.Graphics.Containers; using osuTK; using osuTK.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Framework.MathUtils; +using osu.Framework.Allocation; namespace osu.Game.Screens.Play { @@ -66,20 +68,16 @@ namespace osu.Game.Screens.Play private Cached layout = new Cached(); - public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) - { - if ((invalidation & Invalidation.DrawSize) > 0) - layout.Invalidate(); - return base.Invalidate(invalidation, source, shallPropagate); - } + private float lastDrawWidth; protected override void Update() { base.Update(); - if (!layout.IsValid) + if (values != null && (!layout.IsValid || !Precision.AlmostEquals(lastDrawWidth, DrawWidth, 5))) { recreateGraph(); + lastDrawWidth = DrawWidth; layout.Validate(); } } @@ -203,21 +201,20 @@ namespace osu.Game.Screens.Play } } - public Column() + public Column(float height) { Width = WIDTH; + Height = height; } - protected override void LoadComplete() + [BackgroundDependencyLoader] + private void load() { - for (int r = 0; r < cubeCount; r++) + drawableRows.AddRange(Enumerable.Range(0, (int)cubeCount).Select(r => new Box { - drawableRows.Add(new Box - { - Size = new Vector2(cube_size), - Position = new Vector2(0, r * WIDTH + padding), - }); - } + Size = new Vector2(cube_size), + Position = new Vector2(0, r * WIDTH + padding), + })); Children = drawableRows; From 6f5d4ce2e25a40c354b8cfe4b4e487c1c0b7d377 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Feb 2019 17:01:44 +0900 Subject: [PATCH 256/327] Debounce SquareGraph some more --- osu.Game/Screens/Play/SquareGraph.cs | 109 ++++++++++++++++----------- 1 file changed, 67 insertions(+), 42 deletions(-) diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index aa6a657ed3..69f9bff550 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using osu.Framework; using osu.Framework.Caching; using osu.Framework.Extensions.Color4Extensions; @@ -12,18 +13,19 @@ using osu.Framework.Graphics.Containers; using osuTK; using osuTK.Graphics; using osu.Framework.Graphics.Shapes; -using osu.Framework.MathUtils; using osu.Framework.Allocation; +using osu.Framework.Threading; namespace osu.Game.Screens.Play { - public class SquareGraph : BufferedContainer + public class SquareGraph : Container { - private Column[] columns = { }; + private BufferedContainer columns; - public int ColumnCount => columns.Length; + public int ColumnCount => columns?.Children.Count ?? 0; private int progress; + public int Progress { get { return progress; } @@ -38,6 +40,7 @@ namespace osu.Game.Screens.Play private float[] calculatedValues = { }; // values but adjusted to fit the amount of columns private int[] values; + public int[] Values { get { return values; } @@ -50,6 +53,7 @@ namespace osu.Game.Screens.Play } private Color4 fillColour; + public Color4 FillColour { get { return fillColour; } @@ -61,35 +65,83 @@ namespace osu.Game.Screens.Play } } - public SquareGraph() + public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true) { - CacheDrawnFrameBuffer = true; + if ((invalidation & Invalidation.DrawSize) > 0) + layout.Invalidate(); + return base.Invalidate(invalidation, source, shallPropagate); } private Cached layout = new Cached(); - private float lastDrawWidth; - protected override void Update() { base.Update(); - if (values != null && (!layout.IsValid || !Precision.AlmostEquals(lastDrawWidth, DrawWidth, 5))) + if (values != null && !layout.IsValid) { - recreateGraph(); - lastDrawWidth = DrawWidth; + schedulerRecreateGraph(); layout.Validate(); } } + private ScheduledDelegate scheduledCreate; + + /// + /// Recreates the entire graph. + /// + private void schedulerRecreateGraph() + { + columns?.FadeOut(500, Easing.OutQuint).Expire(); + + scheduledCreate?.Cancel(); + scheduledCreate = Scheduler.AddDelayed(recreateGraph, 500); + } + + private CancellationTokenSource cts; + + private void recreateGraph() + { + var newColumns = new BufferedContainer + { + CacheDrawnFrameBuffer = true, + RelativeSizeAxes = Axes.Both, + }; + + for (float x = 0; x < DrawWidth; x += Column.WIDTH) + { + newColumns.Add(new Column(DrawHeight) + { + LitColour = fillColour, + Anchor = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, + Position = new Vector2(x, 0), + State = ColumnState.Dimmed, + }); + } + + cts?.Cancel(); + cts = new CancellationTokenSource(); + + LoadComponentAsync(newColumns, c => + { + Child = columns = c; + columns.FadeInFromZero(500, Easing.OutQuint); + + recalculateValues(); + redrawFilled(); + redrawProgress(); + }, cts.Token); + } + /// /// Redraws all the columns to match their lit/dimmed state. /// private void redrawProgress() { - for (int i = 0; i < columns.Length; i++) + for (int i = 0; i < ColumnCount; i++) columns[i].State = i <= progress ? ColumnState.Lit : ColumnState.Dimmed; - ForceRedraw(); + columns?.ForceRedraw(); } /// @@ -99,7 +151,7 @@ namespace osu.Game.Screens.Play { for (int i = 0; i < ColumnCount; i++) columns[i].Filled = calculatedValues.ElementAtOrDefault(i); - ForceRedraw(); + columns?.ForceRedraw(); } /// @@ -128,34 +180,6 @@ namespace osu.Game.Screens.Play calculatedValues = newValues.ToArray(); } - /// - /// Recreates the entire graph. - /// - private void recreateGraph() - { - var newColumns = new List(); - - for (float x = 0; x < DrawWidth; x += Column.WIDTH) - { - newColumns.Add(new Column - { - LitColour = fillColour, - Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, - Height = DrawHeight, - Position = new Vector2(x, 0), - State = ColumnState.Dimmed, - }); - } - - columns = newColumns.ToArray(); - Children = columns; - - recalculateValues(); - redrawFilled(); - redrawProgress(); - } - public class Column : Container, IStateful { protected readonly Color4 EmptyColour = Color4.White.Opacity(20); @@ -172,6 +196,7 @@ namespace osu.Game.Screens.Play private readonly List drawableRows = new List(); private float filled; + public float Filled { get { return filled; } From 43a1df6e5c61a46f322d8f3404c9ad614c68560b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Feb 2019 17:30:20 +0900 Subject: [PATCH 257/327] Inline cancellation token source creation --- osu.Game/Screens/Play/SquareGraph.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index 69f9bff550..4ba390c165 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -121,7 +121,6 @@ namespace osu.Game.Screens.Play } cts?.Cancel(); - cts = new CancellationTokenSource(); LoadComponentAsync(newColumns, c => { @@ -131,7 +130,7 @@ namespace osu.Game.Screens.Play recalculateValues(); redrawFilled(); redrawProgress(); - }, cts.Token); + }, (cts = new CancellationTokenSource()).Token); } /// From f942515fcdd4aa319ce94a0d5f63be9a6a0727b3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Feb 2019 18:59:45 +0900 Subject: [PATCH 258/327] Add licence header --- osu.Game.Tests/Visual/TestCaseSkinReloadable.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game.Tests/Visual/TestCaseSkinReloadable.cs b/osu.Game.Tests/Visual/TestCaseSkinReloadable.cs index 05e1c58768..94f01e9d32 100644 --- a/osu.Game.Tests/Visual/TestCaseSkinReloadable.cs +++ b/osu.Game.Tests/Visual/TestCaseSkinReloadable.cs @@ -1,3 +1,6 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + using System; using NUnit.Framework; using osu.Framework.Audio.Sample; From 3af7d4939c58ab4703f2385aa1d55cb84a8d3647 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Feb 2019 19:11:09 +0900 Subject: [PATCH 259/327] Add debounce testing --- osu.Game.Tests/Visual/TestCaseSongProgress.cs | 32 ++++++++++++++++--- osu.Game/Screens/Play/SquareGraph.cs | 21 +++++------- 2 files changed, 36 insertions(+), 17 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseSongProgress.cs b/osu.Game.Tests/Visual/TestCaseSongProgress.cs index 9ce33f21d6..9a0050eaa8 100644 --- a/osu.Game.Tests/Visual/TestCaseSongProgress.cs +++ b/osu.Game.Tests/Visual/TestCaseSongProgress.cs @@ -15,7 +15,7 @@ namespace osu.Game.Tests.Visual public class TestCaseSongProgress : OsuTestCase { private readonly SongProgress progress; - private readonly SongProgressGraph graph; + private readonly TestSongProgressGraph graph; private readonly StopwatchClock clock; @@ -31,7 +31,7 @@ namespace osu.Game.Tests.Visual Origin = Anchor.BottomLeft, }); - Add(graph = new SongProgressGraph + Add(graph = new TestSongProgressGraph { RelativeSizeAxes = Axes.X, Height = 200, @@ -39,13 +39,24 @@ namespace osu.Game.Tests.Visual Origin = Anchor.TopLeft, }); + AddWaitStep(5); + AddAssert("ensure not created", () => graph.CreationCount == 0); + + AddStep("display values", displayNewValues); + AddWaitStep(5); + AddUntilStep(() => graph.CreationCount == 1, "wait for creation count"); + AddStep("Toggle Bar", () => progress.AllowSeeking = !progress.AllowSeeking); AddWaitStep(5); + AddUntilStep(() => graph.CreationCount == 1, "wait for creation count"); + AddStep("Toggle Bar", () => progress.AllowSeeking = !progress.AllowSeeking); - AddWaitStep(2); + AddWaitStep(5); + AddUntilStep(() => graph.CreationCount == 1, "wait for creation count"); AddRepeatStep("New Values", displayNewValues, 5); - displayNewValues(); + AddWaitStep(5); + AddAssert("ensure debounced", () => graph.CreationCount == 2); } private void displayNewValues() @@ -60,5 +71,18 @@ namespace osu.Game.Tests.Visual progress.AudioClock = clock; progress.OnSeek = pos => clock.Seek(pos); } + + + private class TestSongProgressGraph : SongProgressGraph + { + public int CreationCount { get; private set; } + + protected override void RecreateGraph() + { + base.RecreateGraph(); + CreationCount++; + } + + } } } diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index 4ba390c165..15102edc42 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -73,6 +73,7 @@ namespace osu.Game.Screens.Play } private Cached layout = new Cached(); + private ScheduledDelegate scheduledCreate; protected override void Update() { @@ -80,27 +81,21 @@ namespace osu.Game.Screens.Play if (values != null && !layout.IsValid) { - schedulerRecreateGraph(); + columns?.FadeOut(500, Easing.OutQuint).Expire(); + + scheduledCreate?.Cancel(); + scheduledCreate = Scheduler.AddDelayed(RecreateGraph, 500); + layout.Validate(); } } - private ScheduledDelegate scheduledCreate; + private CancellationTokenSource cts; /// /// Recreates the entire graph. /// - private void schedulerRecreateGraph() - { - columns?.FadeOut(500, Easing.OutQuint).Expire(); - - scheduledCreate?.Cancel(); - scheduledCreate = Scheduler.AddDelayed(recreateGraph, 500); - } - - private CancellationTokenSource cts; - - private void recreateGraph() + protected virtual void RecreateGraph() { var newColumns = new BufferedContainer { From 9f8d03e1b69a42fdbfe6fe235c8cc44aba471ad3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Feb 2019 21:03:35 +0900 Subject: [PATCH 260/327] Remove excess newlines --- osu.Game.Tests/Visual/TestCaseSongProgress.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseSongProgress.cs b/osu.Game.Tests/Visual/TestCaseSongProgress.cs index 9a0050eaa8..9845df7461 100644 --- a/osu.Game.Tests/Visual/TestCaseSongProgress.cs +++ b/osu.Game.Tests/Visual/TestCaseSongProgress.cs @@ -72,7 +72,6 @@ namespace osu.Game.Tests.Visual progress.OnSeek = pos => clock.Seek(pos); } - private class TestSongProgressGraph : SongProgressGraph { public int CreationCount { get; private set; } @@ -82,7 +81,6 @@ namespace osu.Game.Tests.Visual base.RecreateGraph(); CreationCount++; } - } } } From 7fa4262207443aa6bcf45ff5b2323eb498d9d77e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 27 Feb 2019 21:04:14 +0900 Subject: [PATCH 261/327] Clear delegate list rather than relying on unbinds --- osu.Game/Skinning/LocalSkinOverrideContainer.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index 36e95f4038..cd332ed629 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -96,6 +96,9 @@ namespace osu.Game.Skinning protected override void Dispose(bool isDisposing) { + // Must be done before base.Dispose() + SourceChanged = null; + base.Dispose(isDisposing); if (fallbackSource != null) From c8793911a8ceda955ce20e2805f79b709d750fb0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Feb 2019 21:07:17 +0900 Subject: [PATCH 262/327] Enable more stringent inspectcode style inspections --- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 1 + .../Connections/FollowPointRenderer.cs | 6 +++ .../Objects/Drawables/Pieces/SliderBall.cs | 1 + .../Visual/TestCaseBeatmapScoresContainer.cs | 3 +- osu.Game/Audio/PreviewTrack.cs | 2 + osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 1 + osu.Game/Rulesets/UI/RulesetInputManager.cs | 2 + osu.Game/Scoring/ScoreInfo.cs | 2 +- osu.Game/Screens/Play/SongProgress.cs | 13 +++--- osu.Game/Screens/Play/SquareGraph.cs | 11 ++++- .../Screens/Ranking/Pages/ScoreResultsPage.cs | 12 +++-- osu.Game/Screens/Select/BeatmapDetails.cs | 2 + osu.Game/Screens/Select/SongSelect.cs | 7 +-- .../Skinning/LocalSkinOverrideContainer.cs | 3 ++ osu.sln.DotSettings | 44 +++++++++++++++++++ 15 files changed, 93 insertions(+), 17 deletions(-) diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index ba87fe6ed9..525bacee65 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -349,6 +349,7 @@ namespace osu.Game.Rulesets.Mania /// Number of columns in this stage lies at (item - Single). /// Single = 0, + /// /// Columns are grouped into two stages. /// Overall number of columns lies at (item - Dual), further computation is required for diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs index ec8573cb94..da957626a0 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs @@ -12,6 +12,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections public class FollowPointRenderer : ConnectionRenderer { private int pointDistance = 32; + /// /// Determines how much space there is between points. /// @@ -21,12 +22,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections set { if (pointDistance == value) return; + pointDistance = value; update(); } } private int preEmpt = 800; + /// /// Follow points to the next hitobject start appearing for this many milliseconds before an hitobject's end time. /// @@ -36,12 +39,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections set { if (preEmpt == value) return; + preEmpt = value; update(); } } private IEnumerable hitObjects; + public override IEnumerable HitObjects { get { return hitObjects; } @@ -107,6 +112,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections fp.Expire(true); } } + prevHitObject = currHitObject; } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index afa7f22140..3fb9aa8963 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -141,6 +141,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { if (value == tracking) return; + tracking = value; FollowCircle.ScaleTo(tracking ? 2f : 1, 300, Easing.OutQuint); diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs b/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs index 321a38d087..6ad11ae6c4 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs @@ -160,7 +160,8 @@ namespace osu.Game.Tests.Visual Accuracy = 0.6543, }, }; - foreach(var s in scores) + + foreach (var s in scores) { s.Statistics.Add(HitResult.Great, RNG.Next(2000)); s.Statistics.Add(HitResult.Good, RNG.Next(2000)); diff --git a/osu.Game/Audio/PreviewTrack.cs b/osu.Game/Audio/PreviewTrack.cs index fad4731f18..3b21bdefc4 100644 --- a/osu.Game/Audio/PreviewTrack.cs +++ b/osu.Game/Audio/PreviewTrack.cs @@ -63,6 +63,7 @@ namespace osu.Game.Audio if (hasStarted) return; + hasStarted = true; track.Restart(); @@ -81,6 +82,7 @@ namespace osu.Game.Audio if (!hasStarted) return; + hasStarted = false; track.Stop(); diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 5c8ef41b9a..63e1c93dd5 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -113,6 +113,7 @@ namespace osu.Game.Rulesets.Scoring return ScoreRank.B; if (acc > 0.7) return ScoreRank.C; + return ScoreRank.D; } diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index 0065f195fc..fc61d41ab4 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -213,10 +213,12 @@ namespace osu.Game.Rulesets.UI case MouseDownEvent mouseDown when mouseDown.Button == MouseButton.Left || mouseDown.Button == MouseButton.Right: if (mouseDisabled.Value) return false; + break; case MouseUpEvent mouseUp: if (!CurrentState.Mouse.IsPressed(mouseUp.Button)) return false; + break; } diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs index a71ef9d64d..96d0bdffdb 100644 --- a/osu.Game/Scoring/ScoreInfo.cs +++ b/osu.Game/Scoring/ScoreInfo.cs @@ -28,7 +28,7 @@ namespace osu.Game.Scoring public long TotalScore { get; set; } [JsonProperty("accuracy")] - [Column(TypeName="DECIMAL(1,4)")] + [Column(TypeName = "DECIMAL(1,4)")] public double Accuracy { get; set; } [JsonProperty(@"pp")] diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 443df27b42..ec1340e580 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -35,7 +35,11 @@ namespace osu.Game.Screens.Play public override bool HandlePositionalInput => AllowSeeking; private IClock audioClock; - public IClock AudioClock { set { audioClock = info.AudioClock = value; } } + + public IClock AudioClock + { + set { audioClock = info.AudioClock = value; } + } private double lastHitTime => ((objects.Last() as IHasEndTime)?.EndTime ?? objects.Last().StartTime) + 1; @@ -94,7 +98,7 @@ namespace osu.Game.Screens.Play { Alpha = 0, Anchor = Anchor.BottomLeft, - Origin = Anchor.BottomLeft, + Origin = Anchor.BottomLeft, OnSeek = position => OnSeek?.Invoke(position), }, }; @@ -117,10 +121,7 @@ namespace osu.Game.Screens.Play public bool AllowSeeking { - get - { - return allowSeeking; - } + get { return allowSeeking; } set { diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index ad52c31108..d3610b219a 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -22,12 +22,14 @@ namespace osu.Game.Screens.Play public int ColumnCount => columns.Length; private int progress; + public int Progress { get { return progress; } set { if (value == progress) return; + progress = value; redrawProgress(); } @@ -36,24 +38,28 @@ namespace osu.Game.Screens.Play private float[] calculatedValues = { }; // values but adjusted to fit the amount of columns private int[] values; + public int[] Values { get { return values; } set { if (value == values) return; + values = value; layout.Invalidate(); } } private Color4 fillColour; + public Color4 FillColour { get { return fillColour; } set { if (value == fillColour) return; + fillColour = value; redrawFilled(); } @@ -174,14 +180,15 @@ namespace osu.Game.Screens.Play private readonly List drawableRows = new List(); private float filled; + public float Filled { get { return filled; } set { if (value == filled) return; - filled = value; + filled = value; fillActive(); } } @@ -194,8 +201,8 @@ namespace osu.Game.Screens.Play set { if (value == state) return; - state = value; + state = value; if (IsLoaded) fillActive(); diff --git a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs index 09b5b7ea49..043bf55d2b 100644 --- a/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs +++ b/osu.Game/Screens/Ranking/Pages/ScoreResultsPage.cs @@ -213,14 +213,16 @@ namespace osu.Game.Screens.Ranking.Pages { Children = new Drawable[] { - new OsuSpriteText { + new OsuSpriteText + { Text = statistic.Value.ToString().PadLeft(4, '0'), Colour = colours.Gray7, Font = OsuFont.GetFont(size: 30), Anchor = Anchor.TopCentre, Origin = Anchor.TopCentre, }, - new OsuSpriteText { + new OsuSpriteText + { Text = statistic.Key.GetDescription(), Colour = colours.Gray7, Font = OsuFont.GetFont(weight: FontWeight.Bold), @@ -334,7 +336,8 @@ namespace osu.Game.Screens.Ranking.Pages versionMapper.Colour = colours.Gray8; var creator = beatmap.Metadata.Author?.Username; - if (!string.IsNullOrEmpty(creator)) { + if (!string.IsNullOrEmpty(creator)) + { versionMapper.Text = $"mapped by {creator}"; if (!string.IsNullOrEmpty(beatmap.Version)) @@ -388,7 +391,8 @@ namespace osu.Game.Screens.Ranking.Pages protected override Easing RollingEasing => Easing.OutPow10; - public SlowScoreCounter(uint leading = 0) : base(leading) + public SlowScoreCounter(uint leading = 0) + : base(leading) { DisplayedCountSpriteText.Shadow = false; DisplayedCountSpriteText.Font = DisplayedCountSpriteText.Font.With(Typeface.Venera, weight: FontWeight.Light); diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 9f9263927e..e3ac74a69f 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -41,12 +41,14 @@ namespace osu.Game.Screens.Select private ScheduledDelegate pendingBeatmapSwitch; private BeatmapInfo beatmap; + public BeatmapInfo Beatmap { get { return beatmap; } set { if (value == beatmap) return; + beatmap = value; pendingBeatmapSwitch?.Cancel(); diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 5ecbaf8d1f..e98ccd5afe 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -209,7 +209,7 @@ namespace osu.Game.Screens.Select }); } - BeatmapDetails.Leaderboard.ScoreSelected += s =>this.Push(new SoloResults(s)); + BeatmapDetails.Leaderboard.ScoreSelected += s => this.Push(new SoloResults(s)); } [BackgroundDependencyLoader(true)] @@ -285,8 +285,8 @@ namespace osu.Game.Screens.Select public void Edit(BeatmapInfo beatmap = null) { - Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce); - this.Push(new Editor()); + Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmap ?? beatmapNoDebounce); + this.Push(new Editor()); } /// @@ -623,6 +623,7 @@ namespace osu.Game.Screens.Select private void delete(BeatmapSetInfo beatmap) { if (beatmap == null || beatmap.ID <= 0) return; + dialogOverlay?.Push(new BeatmapDeleteDialog(beatmap)); } diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index 349a4ea9d8..16a3405e43 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -35,6 +35,7 @@ namespace osu.Game.Skinning Drawable sourceDrawable; if (beatmapSkins.Value && (sourceDrawable = source.GetDrawableComponent(componentName)) != null) return sourceDrawable; + return fallbackSource?.GetDrawableComponent(componentName); } @@ -43,6 +44,7 @@ namespace osu.Game.Skinning Texture sourceTexture; if (beatmapSkins.Value && (sourceTexture = source.GetTexture(componentName)) != null) return sourceTexture; + return fallbackSource.GetTexture(componentName); } @@ -51,6 +53,7 @@ namespace osu.Game.Skinning SampleChannel sourceChannel; if (beatmapHitsounds.Value && (sourceChannel = source.GetSample(sampleName)) != null) return sourceChannel; + return fallbackSource?.GetSample(sampleName); } diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index ad0d8a55a2..a0317d0b37 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -7,6 +7,7 @@ ExplicitlyExcluded SOLUTION HINT + WARNING WARNING True @@ -16,6 +17,32 @@ HINT HINT HINT + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING WARNING WARNING WARNING @@ -48,6 +75,7 @@ HINT HINT ERROR + WARNING HINT HINT HINT @@ -62,9 +90,17 @@ WARNING WARNING WARNING + WARNING + WARNING + WARNING + WARNING WARNING + WARNING + WARNING + WARNING WARNING HINT + WARNING HINT HINT HINT @@ -75,6 +111,7 @@ WARNING WARNING WARNING + WARNING HINT DO_NOT_SHOW DO_NOT_SHOW @@ -84,6 +121,8 @@ WARNING WARNING WARNING + WARNING + WARNING ERROR WARNING WARNING @@ -137,10 +176,14 @@ WARNING WARNING WARNING + WARNING HINT DO_NOT_SHOW DO_NOT_SHOW DO_NOT_SHOW + WARNING + WARNING + WARNING WARNING WARNING HINT @@ -166,6 +209,7 @@ HINT HINT WARNING + WARNING <?xml version="1.0" encoding="utf-16"?><Profile name="Code Cleanup (peppy)"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSUseVar><BehavourStyle>CAN_CHANGE_TO_EXPLICIT</BehavourStyle><LocalVariableStyle>ALWAYS_EXPLICIT</LocalVariableStyle><ForeachVariableStyle>ALWAYS_EXPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSReformatCode>True</CSReformatCode><CSUpdateFileHeader>True</CSUpdateFileHeader><CSCodeStyleAttributes ArrangeTypeAccessModifier="False" ArrangeTypeMemberAccessModifier="False" SortModifiers="True" RemoveRedundantParentheses="True" AddMissingParentheses="False" ArrangeBraces="False" ArrangeAttributes="False" ArrangeArgumentsStyle="False" /><XAMLCollapseEmptyTags>False</XAMLCollapseEmptyTags><CSFixBuiltinTypeReferences>True</CSFixBuiltinTypeReferences><CSArrangeQualifiers>True</CSArrangeQualifiers></Profile> Code Cleanup (peppy) True From 42442edf5a2fa3d5a3881adb609ff5c08314011a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Feb 2019 22:41:46 +0900 Subject: [PATCH 263/327] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f464dafd3f..82c23fc491 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -16,7 +16,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index bf38335e0c..f95f42d933 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From 0faf83f7d129edfe6d90d0602b1e96afccdd6b20 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 27 Feb 2019 23:30:13 +0900 Subject: [PATCH 264/327] Fix nullref in tests --- osu.Game/Overlays/Direct/DownloadTrackingComposite.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs index 58be491daf..e37156b39d 100644 --- a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs +++ b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs @@ -63,8 +63,11 @@ namespace osu.Game.Overlays.Direct { base.Dispose(isDisposing); - beatmaps.BeatmapDownloadBegan -= attachDownload; - beatmaps.ItemAdded -= setAdded; + if (beatmaps != null) + { + beatmaps.BeatmapDownloadBegan -= attachDownload; + beatmaps.ItemAdded -= setAdded; + } State.UnbindAll(); From 43b02212cef02528437b950deb9eb0bb41cece9c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Feb 2019 12:24:56 +0900 Subject: [PATCH 265/327] Add disposal check in single file load path --- osu.Game/OsuGame.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 9f6adc373c..59b7120d95 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -626,6 +626,10 @@ namespace osu.Game try { Logger.Log($"Loading {d}...", level: LogLevel.Debug); + + if (IsDisposed) + return; + await LoadComponentAsync(d, add); Logger.Log($"Loaded {d}!", level: LogLevel.Debug); } From ce17e37c74ca49a11c043dba0c5dc93f3b93ec13 Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Thu, 28 Feb 2019 13:09:38 +0900 Subject: [PATCH 266/327] Conditionally add some UI elements only on desktop Prevents crashes from trying to access features that are not applicable to mobile. --- osu.Game/Database/ArchiveModelManager.cs | 3 ++ .../Sections/General/UpdateSettings.cs | 20 +++++---- .../Sections/Maintenance/GeneralSettings.cs | 42 ++++++++++++------- osu.Game/Screens/Edit/Editor.cs | 17 +++++--- 4 files changed, 51 insertions(+), 31 deletions(-) diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 6bf9e2ff37..16dfbe762d 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -8,6 +8,7 @@ using System.Linq; using System.Threading.Tasks; using JetBrains.Annotations; using Microsoft.EntityFrameworkCore; +using osu.Framework; using osu.Framework.Extensions; using osu.Framework.IO.File; using osu.Framework.Logging; @@ -53,6 +54,8 @@ namespace osu.Game.Database public virtual string[] HandledExtensions => new[] { ".zip" }; + public virtual bool SupportsImportFromStable => RuntimeInfo.IsDesktop; + protected readonly FileStore Files; protected readonly IDatabaseContextFactory ContextFactory; diff --git a/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs b/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs index 4d889856f6..230e6983f6 100644 --- a/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using osu.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Platform; @@ -15,19 +16,20 @@ namespace osu.Game.Overlays.Settings.Sections.General [BackgroundDependencyLoader] private void load(Storage storage, OsuConfigManager config) { - Children = new Drawable[] + Add(new SettingsEnumDropdown { - new SettingsEnumDropdown - { - LabelText = "Release stream", - Bindable = config.GetBindable(OsuSetting.ReleaseStream), - }, - new SettingsButton + LabelText = "Release stream", + Bindable = config.GetBindable(OsuSetting.ReleaseStream), + }); + + if (RuntimeInfo.IsDesktop) + { + Add(new SettingsButton { Text = "Open osu! folder", Action = storage.OpenInNativeExplorer, - } - }; + }); + } } } } diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs index d512652938..67d60fa9e7 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; using osu.Game.Skinning; @@ -25,9 +26,9 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance [BackgroundDependencyLoader] private void load(BeatmapManager beatmaps, SkinManager skins, DialogOverlay dialogOverlay) { - Children = new Drawable[] + if (beatmaps.SupportsImportFromStable) { - importBeatmapsButton = new SettingsButton + Add(importBeatmapsButton = new SettingsButton { Text = "Import beatmaps from stable", Action = () => @@ -35,20 +36,25 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance importBeatmapsButton.Enabled.Value = false; beatmaps.ImportFromStableAsync().ContinueWith(t => Schedule(() => importBeatmapsButton.Enabled.Value = true)); } - }, - deleteBeatmapsButton = new DangerousSettingsButton + }); + } + + Add(deleteBeatmapsButton = new DangerousSettingsButton + { + Text = "Delete ALL beatmaps", + Action = () => { - Text = "Delete ALL beatmaps", - Action = () => + dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() => { - dialogOverlay?.Push(new DeleteAllBeatmapsDialog(() => - { - deleteBeatmapsButton.Enabled.Value = false; - Task.Run(() => beatmaps.Delete(beatmaps.GetAllUsableBeatmapSets())).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true)); - })); - } - }, - importSkinsButton = new SettingsButton + deleteBeatmapsButton.Enabled.Value = false; + Task.Run(() => beatmaps.Delete(beatmaps.GetAllUsableBeatmapSets())).ContinueWith(t => Schedule(() => deleteBeatmapsButton.Enabled.Value = true)); + })); + } + }); + + if (skins.SupportsImportFromStable) + { + Add(importSkinsButton = new SettingsButton { Text = "Import skins from stable", Action = () => @@ -56,7 +62,11 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance importSkinsButton.Enabled.Value = false; skins.ImportFromStableAsync().ContinueWith(t => Schedule(() => importSkinsButton.Enabled.Value = true)); } - }, + }); + } + + AddRange(new Drawable[] + { deleteSkinsButton = new DangerousSettingsButton { Text = "Delete ALL skins", @@ -91,7 +101,7 @@ namespace osu.Game.Overlays.Settings.Sections.Maintenance Task.Run(() => beatmaps.Undelete(beatmaps.QueryBeatmapSets(b => b.DeletePending).ToList())).ContinueWith(t => Schedule(() => undeleteButton.Enabled.Value = true)); } }, - }; + }); } } } diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index c922e4ef4a..21ea51bcd3 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -22,6 +22,8 @@ using osu.Game.Screens.Edit.Components.Menus; using osu.Game.Screens.Edit.Compose; using osu.Game.Screens.Edit.Design; using osuTK.Input; +using System.Collections.Generic; +using osu.Framework; namespace osu.Game.Screens.Edit { @@ -67,6 +69,14 @@ namespace osu.Game.Screens.Edit SummaryTimeline timeline; PlaybackControl playback; + var fileMenuItems = new List(); + if (RuntimeInfo.IsDesktop) + { + fileMenuItems.Add(new EditorMenuItem("Export", MenuItemType.Standard, exportBeatmap)); + fileMenuItems.Add(new EditorMenuItemSpacer()); + } + fileMenuItems.Add(new EditorMenuItem("Exit", MenuItemType.Standard, this.Exit)); + InternalChildren = new[] { new Container @@ -94,12 +104,7 @@ namespace osu.Game.Screens.Edit { new MenuItem("File") { - Items = new[] - { - new EditorMenuItem("Export", MenuItemType.Standard, exportBeatmap), - new EditorMenuItemSpacer(), - new EditorMenuItem("Exit", MenuItemType.Standard, this.Exit) - } + Items = fileMenuItems } } } From 26d53d06a9baf9767b1727bac600679b40dc9e9b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Feb 2019 13:31:40 +0900 Subject: [PATCH 267/327] Fix remaining issues --- .../CatchBeatmapConversionTest.cs | 3 ++ .../TestCaseCatchPlayer.cs | 3 +- .../Beatmaps/CatchBeatmapProcessor.cs | 2 + osu.Game.Rulesets.Catch/CatchInputManager.cs | 2 + .../Difficulty/CatchDifficultyCalculator.cs | 3 ++ .../MathUtils/FastRandom.cs | 4 +- .../Objects/Drawable/Pieces/Pulp.cs | 1 + .../ManiaBeatmapConversionTest.cs | 40 +++++++------- .../Beatmaps/ManiaBeatmapConverter.cs | 3 ++ .../Legacy/DistanceObjectPatternGenerator.cs | 5 ++ .../Legacy/HitObjectPatternGenerator.cs | 13 +++-- .../Patterns/Legacy/PatternGenerator.cs | 1 + .../Beatmaps/Patterns/Legacy/PatternType.cs | 12 +++++ .../Difficulty/ManiaPerformanceCalculator.cs | 4 +- osu.Game.Rulesets.Mania/ManiaInputManager.cs | 18 +++++++ .../MathUtils/FastRandom.cs | 4 +- .../Objects/Drawables/Pieces/BodyPiece.cs | 1 + .../Objects/Drawables/Pieces/GlowPiece.cs | 2 + .../Objects/Drawables/Pieces/NotePiece.cs | 2 + osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 1 + .../Objects/ManiaHitWindows.cs | 2 +- osu.Game.Rulesets.Mania/UI/Column.cs | 4 ++ .../UI/Components/ColumnBackground.cs | 1 + .../UI/Components/ColumnHitObjectArea.cs | 1 + .../UI/Components/ColumnKeyArea.cs | 1 + .../OsuBeatmapConversionTest.cs | 2 + .../TestCaseGameplayCursor.cs | 2 +- .../TestCaseHitCircle.cs | 3 +- osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs | 1 + .../TestCaseSpinner.cs | 5 +- .../Difficulty/OsuPerformanceCalculator.cs | 12 +++-- .../Preprocessing/OsuDifficultyHitObject.cs | 1 + .../Judgements/ComboResult.cs | 2 + osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs | 4 +- .../Objects/Drawables/DrawableSliderTick.cs | 3 +- .../Objects/Drawables/DrawableSpinner.cs | 3 +- .../Objects/Drawables/Pieces/SliderBody.cs | 4 ++ .../Objects/Drawables/Pieces/SpinnerDisc.cs | 4 ++ .../Drawables/Pieces/SpinnerSpmCounter.cs | 1 + osu.Game.Rulesets.Osu/Objects/Slider.cs | 1 + osu.Game.Rulesets.Osu/OsuInputManager.cs | 1 + osu.Game.Rulesets.Osu/OsuRuleset.cs | 3 +- .../Replays/OsuAutoGenerator.cs | 2 +- .../Replays/OsuAutoGeneratorBase.cs | 2 + .../UI/Cursor/CursorTrail.cs | 3 ++ .../UI/Cursor/GameplayCursor.cs | 1 + .../Objects/Drawables/DrawableSwell.cs | 1 + .../Drawables/DrawableTaikoHitObject.cs | 2 + .../Objects/Drawables/Pieces/TaikoPiece.cs | 7 ++- .../Objects/Drawables/Pieces/TickPiece.cs | 1 + osu.Game.Rulesets.Taiko/Objects/Swell.cs | 5 +- osu.Game.Rulesets.Taiko/TaikoInputManager.cs | 3 ++ .../Visual/TestCaseBeatSyncedContainer.cs | 1 + .../Visual/TestCaseBeatmapCarousel.cs | 12 +++-- osu.Game.Tests/Visual/TestCaseChatLink.cs | 2 +- osu.Game.Tests/Visual/TestCaseContextMenu.cs | 8 +-- .../Visual/TestCaseEditorSeekSnapping.cs | 2 +- .../Visual/TestCaseGameplayMenuOverlay.cs | 1 + osu.Game.Tests/Visual/TestCaseLeaderboard.cs | 3 +- .../Visual/TestCasePlaybackControl.cs | 2 +- .../Visual/TestCaseScreenBreadcrumbControl.cs | 2 +- osu.Game.Tests/Visual/TestCaseStoryboard.cs | 5 +- osu.Game/Audio/SampleInfo.cs | 2 + osu.Game/Beatmaps/BeatmapConverter.cs | 1 + osu.Game/Beatmaps/BeatmapDifficulty.cs | 1 + osu.Game/Beatmaps/BeatmapMetadata.cs | 19 +++---- osu.Game/Beatmaps/BeatmapStore.cs | 2 + .../Drawables/BeatmapBackgroundSprite.cs | 4 +- .../Drawables/BeatmapSetOnlineStatusPill.cs | 1 + .../Drawables/DifficultyColouredContainer.cs | 1 + .../UpdateableBeatmapBackgroundSprite.cs | 3 +- .../Drawables/UpdateableBeatmapSetCover.cs | 4 ++ osu.Game/Beatmaps/Formats/LegacyDecoder.cs | 2 + .../Configuration/RandomSelectAlgorithm.cs | 3 +- osu.Game/Configuration/RankingType.cs | 2 + osu.Game/Configuration/ScalingMode.cs | 1 + osu.Game/Configuration/ScreenshotFormat.cs | 1 + .../ScrollVisualisationMethod.cs | 2 + osu.Game/Database/ArchiveModelManager.cs | 1 + osu.Game/Database/DatabaseWriteUsage.cs | 1 + .../Database/MutableDatabaseBackedStore.cs | 2 + osu.Game/Graphics/Backgrounds/Triangles.cs | 7 +-- .../Containers/OsuFocusedOverlayContainer.cs | 1 + .../Containers/OsuTextFlowContainer.cs | 3 +- .../Graphics/Containers/SectionsContainer.cs | 2 + osu.Game/Graphics/Cursor/MenuCursor.cs | 2 + .../Graphics/Cursor/MenuCursorContainer.cs | 1 + .../Graphics/Cursor/OsuTooltipContainer.cs | 3 +- osu.Game/Graphics/DrawableDate.cs | 1 + osu.Game/Graphics/SpriteIcon.cs | 7 ++- osu.Game/Graphics/UserInterface/Bar.cs | 31 +++-------- osu.Game/Graphics/UserInterface/BarGraph.cs | 2 + .../UserInterface/BreadcrumbControl.cs | 4 +- .../Graphics/UserInterface/DialogButton.cs | 18 +++---- .../UserInterface/ExternalLinkButton.cs | 2 +- .../UserInterface/HoverClickSounds.cs | 3 +- .../Graphics/UserInterface/HoverSounds.cs | 2 + osu.Game/Graphics/UserInterface/LineGraph.cs | 1 + osu.Game/Graphics/UserInterface/Nub.cs | 9 ++-- .../Graphics/UserInterface/OsuDropdown.cs | 9 ++++ .../Graphics/UserInterface/OsuSliderBar.cs | 6 +-- .../Graphics/UserInterface/OsuTabControl.cs | 10 ++-- .../UserInterface/OsuTabControlCheckbox.cs | 1 + .../Graphics/UserInterface/PageTabControl.cs | 3 +- .../Graphics/UserInterface/RollingCounter.cs | 1 + .../Graphics/UserInterface/StarCounter.cs | 1 + .../Graphics/UserInterface/TwoLayerButton.cs | 20 +++---- osu.Game/IO/FileStore.cs | 3 +- osu.Game/IO/Legacy/SerializationReader.cs | 11 +++- osu.Game/IO/Legacy/SerializationWriter.cs | 3 +- .../Input/Bindings/GlobalActionContainer.cs | 10 ++++ osu.Game/Online/API/APIAccess.cs | 1 + osu.Game/Online/API/APIRequest.cs | 3 ++ osu.Game/Online/API/OAuthToken.cs | 11 ++-- osu.Game/Online/Chat/ErrorMessage.cs | 3 +- osu.Game/Online/Chat/InfoMessage.cs | 3 +- osu.Game/Online/Chat/LocalEchoMessage.cs | 3 +- osu.Game/Online/Chat/MessageFormatter.cs | 38 +++++++------- osu.Game/Online/Chat/StandAloneChatDisplay.cs | 5 +- osu.Game/OsuGame.cs | 2 + osu.Game/Overlays/BeatmapSet/AuthorInfo.cs | 1 + osu.Game/Overlays/BeatmapSet/BasicStats.cs | 2 + osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs | 5 ++ osu.Game/Overlays/BeatmapSet/Details.cs | 1 + osu.Game/Overlays/BeatmapSet/Info.cs | 2 + .../BeatmapSet/Scores/ClickableUsername.cs | 2 + .../BeatmapSet/Scores/DrawableTopScore.cs | 3 ++ osu.Game/Overlays/BeatmapSet/SuccessRate.cs | 2 + .../Chat/Selection/ChannelListItem.cs | 6 +-- .../Overlays/Chat/Selection/ChannelSection.cs | 6 +-- .../Chat/Tabs/ChannelSelectorTabItem.cs | 3 +- osu.Game/Overlays/Dialog/PopupDialog.cs | 1 + osu.Game/Overlays/Direct/DirectGridPanel.cs | 3 +- osu.Game/Overlays/Direct/Header.cs | 3 ++ osu.Game/Overlays/Direct/PlayButton.cs | 1 + osu.Game/Overlays/DirectOverlay.cs | 1 + .../KeyBinding/GlobalKeyBindingsSection.cs | 3 +- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 1 + osu.Game/Overlays/MedalOverlay.cs | 28 +++++----- .../Overlays/MedalSplash/DrawableMedal.cs | 1 + osu.Game/Overlays/Mods/ModButton.cs | 1 + osu.Game/Overlays/Mods/ModSection.cs | 1 + osu.Game/Overlays/Mods/ModSelectOverlay.cs | 1 + osu.Game/Overlays/Music/PlaylistItem.cs | 2 + osu.Game/Overlays/Music/PlaylistList.cs | 1 + osu.Game/Overlays/NotificationOverlay.cs | 1 + .../Overlays/Notifications/Notification.cs | 1 + .../Notifications/ProgressNotification.cs | 6 +-- .../Notifications/SimpleNotification.cs | 7 ++- osu.Game/Overlays/Profile/Header/RankGraph.cs | 1 + .../Overlays/Profile/Header/SupporterIcon.cs | 52 +++++++++---------- .../Sections/BeatmapMetadataContainer.cs | 2 +- .../PaginatedMostPlayedBeatmapContainer.cs | 2 +- .../Profile/Sections/PaginatedContainer.cs | 2 +- .../SearchableList/HeaderTabControl.cs | 3 +- .../Sections/General/LoginSettings.cs | 1 + .../Sections/Graphics/LayoutSettings.cs | 4 +- .../Overlays/Settings/SettingsSubsection.cs | 6 +-- osu.Game/Overlays/Settings/SidebarButton.cs | 7 ++- osu.Game/Overlays/Social/Header.cs | 1 + osu.Game/Overlays/Social/SocialGridPanel.cs | 3 +- osu.Game/Overlays/Social/SocialListPanel.cs | 3 +- osu.Game/Overlays/Social/SocialPanel.cs | 3 +- osu.Game/Overlays/SocialOverlay.cs | 5 +- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 18 ++----- .../Overlays/Toolbar/ToolbarRulesetButton.cs | 1 + osu.Game/Overlays/Toolbar/ToolbarUserArea.cs | 3 +- osu.Game/Overlays/UserProfileOverlay.cs | 4 +- .../Difficulty/DifficultyCalculator.cs | 3 ++ osu.Game/Rulesets/Edit/HitObjectComposer.cs | 4 +- osu.Game/Rulesets/Edit/PlacementBlueprint.cs | 1 + osu.Game/Rulesets/Mods/ModFlashlight.cs | 2 + osu.Game/Rulesets/Mods/ModHidden.cs | 4 +- osu.Game/Rulesets/Objects/HitWindows.cs | 2 +- .../Objects/Legacy/ConvertHitObjectType.cs | 2 +- osu.Game/Rulesets/Objects/SliderPath.cs | 2 + .../Replays/FramedReplayInputHandler.cs | 1 + .../UI/Scrolling/ScrollingDirection.cs | 3 ++ osu.Game/Scoring/Legacy/LegacyScoreParser.cs | 3 ++ osu.Game/Scoring/ScoreRank.cs | 8 +++ .../Backgrounds/BackgroundScreenDefault.cs | 3 +- osu.Game/Screens/Charts/ChartListing.cs | 5 +- .../Edit/Components/Menus/EditorMenuBar.cs | 2 + .../Edit/Components/PlaybackControl.cs | 3 +- .../RadioButtons/RadioButtonCollection.cs | 3 ++ .../Summary/Parts/ControlPointPart.cs | 12 ++--- .../Timelines/Summary/Parts/MarkerPart.cs | 1 + .../Compose/Components/BlueprintContainer.cs | 2 + .../Timeline/ZoomableScrollContainer.cs | 3 ++ osu.Game/Screens/Edit/EditorScreenMode.cs | 3 ++ osu.Game/Screens/Menu/Disclaimer.cs | 2 +- osu.Game/Screens/Menu/IntroSequence.cs | 2 +- osu.Game/Screens/Menu/LogoVisualisation.cs | 3 ++ .../Screens/Multi/Components/BeatmapTitle.cs | 1 + .../Multi/Components/DisableableTabControl.cs | 1 + .../Multi/Lounge/Components/DrawableRoom.cs | 3 ++ .../Multi/Lounge/Components/FilterControl.cs | 1 + .../Multi/Match/Components/MatchTabControl.cs | 1 + .../Components/RoomAvailabilityPicker.cs | 3 +- osu.Game/Screens/Play/Break/BreakInfoLine.cs | 3 +- osu.Game/Screens/Play/HUD/ComboCounter.cs | 3 ++ .../Screens/Play/HUD/PlayerSettingsOverlay.cs | 1 + .../Screens/Play/HUD/StandardHealthDisplay.cs | 2 + osu.Game/Screens/Play/KeyCounter.cs | 2 + osu.Game/Screens/Play/KeyCounterAction.cs | 3 +- osu.Game/Screens/Play/KeyCounterCollection.cs | 5 ++ osu.Game/Screens/Play/KeyCounterKeyboard.cs | 4 +- osu.Game/Screens/Play/KeyCounterMouse.cs | 3 +- osu.Game/Screens/Play/PauseContainer.cs | 5 +- osu.Game/Screens/Play/Player.cs | 3 +- .../PlayerSettings/PlayerSettingsGroup.cs | 1 + osu.Game/Screens/Play/SongProgressInfo.cs | 11 +++- osu.Game/Screens/ScreenWhiteBox.cs | 5 +- osu.Game/Screens/Select/BeatmapCarousel.cs | 2 + osu.Game/Screens/Select/BeatmapDetailArea.cs | 6 +-- .../Screens/Select/Carousel/CarouselGroup.cs | 1 + .../Carousel/DrawableCarouselBeatmap.cs | 3 +- .../Carousel/DrawableCarouselBeatmapSet.cs | 10 ++-- .../Screens/Select/Details/AdvancedStats.cs | 3 ++ .../Screens/Select/Details/FailRetryGraph.cs | 2 + .../Screens/Select/Details/UserRatings.cs | 1 + osu.Game/Screens/Select/Filter/GroupMode.cs | 14 +++++ osu.Game/Screens/Select/Filter/SortMode.cs | 7 +++ osu.Game/Screens/Select/FooterButton.cs | 2 + osu.Game/Screens/Select/PlaySongSelect.cs | 2 +- .../Tournament/ScrollingTeamContainer.cs | 2 + osu.Game/Skinning/LegacySkin.cs | 3 +- osu.Game/Skinning/Skin.cs | 1 + osu.Game/Skinning/SkinnableSpriteText.cs | 1 + osu.Game/Storyboards/CommandTimeline.cs | 1 + .../Drawables/DrawableStoryboard.cs | 3 ++ .../Drawables/DrawableStoryboardAnimation.cs | 1 + osu.Game/Storyboards/Storyboard.cs | 1 + osu.Game/Storyboards/StoryboardSprite.cs | 2 + .../Tests/Beatmaps/BeatmapConversionTest.cs | 7 ++- osu.Game/Tests/Beatmaps/TestBeatmap.cs | 3 +- .../Tests/Visual/ScrollingTestContainer.cs | 10 +++- osu.Game/Users/Avatar.cs | 1 + osu.Game/Users/Country.cs | 1 + osu.Game/Users/UserStatistics.cs | 5 +- osu.Game/Users/UserStatus.cs | 2 +- 241 files changed, 673 insertions(+), 330 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs index d40a108c5e..7f85d4ccce 100644 --- a/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Catch.Tests/CatchBeatmapConversionTest.cs @@ -34,13 +34,16 @@ namespace osu.Game.Rulesets.Catch.Tests case JuiceStream stream: foreach (var nested in stream.NestedHitObjects) yield return new ConvertValue((CatchHitObject)nested); + break; case BananaShower shower: foreach (var nested in shower.NestedHitObjects) yield return new ConvertValue((CatchHitObject)nested); + break; default: yield return new ConvertValue((CatchHitObject)hitObject); + break; } } diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseCatchPlayer.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseCatchPlayer.cs index 030c52afea..8f9dd73b80 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestCaseCatchPlayer.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestCaseCatchPlayer.cs @@ -8,7 +8,8 @@ namespace osu.Game.Rulesets.Catch.Tests [TestFixture] public class TestCaseCatchPlayer : Game.Tests.Visual.TestCasePlayer { - public TestCaseCatchPlayer() : base(new CatchRuleset()) + public TestCaseCatchPlayer() + : base(new CatchRuleset()) { } } diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs index 2932afa9fe..5f1e0b97da 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs @@ -56,6 +56,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps rng.Next(); // osu!stable retrieved a random banana rotation rng.Next(); // osu!stable retrieved a random banana colour } + break; case JuiceStream juiceStream: foreach (var nested in juiceStream.NestedHitObjects) @@ -67,6 +68,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps rng.Next(); // osu!stable retrieved a random droplet rotation hitObject.X = MathHelper.Clamp(hitObject.X, 0, 1); } + break; } } diff --git a/osu.Game.Rulesets.Catch/CatchInputManager.cs b/osu.Game.Rulesets.Catch/CatchInputManager.cs index 285b90b0ce..021d7a7efe 100644 --- a/osu.Game.Rulesets.Catch/CatchInputManager.cs +++ b/osu.Game.Rulesets.Catch/CatchInputManager.cs @@ -19,8 +19,10 @@ namespace osu.Game.Rulesets.Catch { [Description("Move left")] MoveLeft, + [Description("Move right")] MoveRight, + [Description("Engage dash")] Dash, } diff --git a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs index 2d3d94ea3d..8cfda5d532 100644 --- a/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs +++ b/osu.Game.Rulesets.Catch/Difficulty/CatchDifficultyCalculator.cs @@ -68,14 +68,17 @@ namespace osu.Game.Rulesets.Catch.Difficulty // We want to only consider fruits that contribute to the combo. Droplets are addressed as accuracy and spinners are not relevant for "skill" calculations. case Fruit fruit: yield return new CatchDifficultyHitObject(fruit, lastObject, clockRate, halfCatchWidth); + lastObject = hitObject; break; case JuiceStream _: foreach (var nested in hitObject.NestedHitObjects.OfType().Where(o => !(o is TinyDroplet))) { yield return new CatchDifficultyHitObject(nested, lastObject, clockRate, halfCatchWidth); + lastObject = nested; } + break; } } diff --git a/osu.Game.Rulesets.Catch/MathUtils/FastRandom.cs b/osu.Game.Rulesets.Catch/MathUtils/FastRandom.cs index 2bd2c9766f..b3605b013b 100644 --- a/osu.Game.Rulesets.Catch/MathUtils/FastRandom.cs +++ b/osu.Game.Rulesets.Catch/MathUtils/FastRandom.cs @@ -33,11 +33,11 @@ namespace osu.Game.Rulesets.Catch.MathUtils /// The random value. public uint NextUInt() { - uint t = _x ^ _x << 11; + uint t = _x ^ (_x << 11); _x = _y; _y = _z; _z = _w; - return _w = _w ^ _w >> 19 ^ t ^ t >> 8; + return _w = _w ^ (_w >> 19) ^ t ^ (t >> 8); } /// diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/Pieces/Pulp.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/Pieces/Pulp.cs index d5adbee8aa..a15ebc1c79 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/Pieces/Pulp.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/Pieces/Pulp.cs @@ -23,6 +23,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable.Pieces } private Color4 accentColour; + public Color4 AccentColour { get { return accentColour; } diff --git a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs index 7a2b4e7b39..6b95975059 100644 --- a/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Mania.Tests/ManiaBeatmapConversionTest.cs @@ -40,29 +40,29 @@ namespace osu.Game.Rulesets.Mania.Tests protected override Ruleset CreateRuleset() => new ManiaRuleset(); } - public class ManiaConvertMapping : ConvertMapping, IEquatable - { - public uint RandomW; - public uint RandomX; - public uint RandomY; - public uint RandomZ; + public class ManiaConvertMapping : ConvertMapping, IEquatable + { + public uint RandomW; + public uint RandomX; + public uint RandomY; + public uint RandomZ; - public ManiaConvertMapping() - { - } + public ManiaConvertMapping() + { + } - public ManiaConvertMapping(IBeatmapConverter converter) - { - var maniaConverter = (ManiaBeatmapConverter)converter; - RandomW = maniaConverter.Random.W; - RandomX = maniaConverter.Random.X; - RandomY = maniaConverter.Random.Y; - RandomZ = maniaConverter.Random.Z; - } + public ManiaConvertMapping(IBeatmapConverter converter) + { + var maniaConverter = (ManiaBeatmapConverter)converter; + RandomW = maniaConverter.Random.W; + RandomX = maniaConverter.Random.X; + RandomY = maniaConverter.Random.Y; + RandomZ = maniaConverter.Random.Z; + } - public bool Equals(ManiaConvertMapping other) => other != null && RandomW == other.RandomW && RandomX == other.RandomX && RandomY == other.RandomY && RandomZ == other.RandomZ; - public override bool Equals(ConvertMapping other) => base.Equals(other) && Equals(other as ManiaConvertMapping); - } + public bool Equals(ManiaConvertMapping other) => other != null && RandomW == other.RandomW && RandomX == other.RandomX && RandomY == other.RandomY && RandomZ == other.RandomZ; + public override bool Equals(ConvertMapping other) => base.Equals(other) && Equals(other as ManiaConvertMapping); + } public struct ConvertValue : IEquatable { diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 380ce533bb..a522f72bd7 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -78,6 +78,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps if (maniaOriginal != null) { yield return maniaOriginal; + yield break; } @@ -92,6 +93,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps private readonly List prevNoteTimes = new List(max_notes_for_density); private double density = int.MaxValue; + private void computeDensity(double newNoteTime) { if (prevNoteTimes.Count == max_notes_for_density) @@ -104,6 +106,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps private double lastTime; private Vector2 lastPosition; private PatternType lastStair = PatternType.Stair; + private void recordNote(double time, Vector2 position) { lastTime = time; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs index 3eff2d62f3..ed52bdd23f 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/DistanceObjectPatternGenerator.cs @@ -65,6 +65,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy if (originalPattern.HitObjects.Count() == 1) { yield return originalPattern; + yield break; } @@ -135,6 +136,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { if (convertType.HasFlag(PatternType.LowProbability)) return generateNRandomNotes(HitObject.StartTime, 0.78, 0.3, 0); + return generateNRandomNotes(HitObject.StartTime, 0.85, 0.36, 0.03); } @@ -142,6 +144,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { if (convertType.HasFlag(PatternType.LowProbability)) return generateNRandomNotes(HitObject.StartTime, 0.43, 0.08, 0); + return generateNRandomNotes(HitObject.StartTime, 0.56, 0.18, 0); } @@ -149,11 +152,13 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { if (convertType.HasFlag(PatternType.LowProbability)) return generateNRandomNotes(HitObject.StartTime, 0.3, 0, 0); + return generateNRandomNotes(HitObject.StartTime, 0.37, 0.08, 0); } if (convertType.HasFlag(PatternType.LowProbability)) return generateNRandomNotes(HitObject.StartTime, 0.17, 0, 0); + return generateNRandomNotes(HitObject.StartTime, 0.27, 0, 0); } diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs index 7004ea4969..34f5f5c415 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/HitObjectPatternGenerator.cs @@ -116,10 +116,10 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy } if (convertType.HasFlag(PatternType.Cycle) && PreviousPattern.HitObjects.Count() == 1 - // If we convert to 7K + 1, let's not overload the special key - && (TotalColumns != 8 || lastColumn != 0) - // Make sure the last column was not the centre column - && (TotalColumns % 2 == 0 || lastColumn != TotalColumns / 2)) + // If we convert to 7K + 1, let's not overload the special key + && (TotalColumns != 8 || lastColumn != 0) + // Make sure the last column was not the centre column + && (TotalColumns % 2 == 0 || lastColumn != TotalColumns / 2)) { // Generate a new pattern by cycling backwards (similar to Reverse but for only one hit object) int column = RandomStart + TotalColumns - lastColumn - 1; @@ -172,6 +172,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy return pattern = generateRandomPatternWithMirrored(0.12, 0.38, 0.12); if (ConversionDifficulty > 4) return pattern = generateRandomPatternWithMirrored(0.12, 0.17, 0); + return pattern = generateRandomPatternWithMirrored(0.12, 0, 0); } @@ -179,6 +180,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { if (convertType.HasFlag(PatternType.LowProbability)) return pattern = generateRandomPattern(0.78, 0.42, 0, 0); + return pattern = generateRandomPattern(1, 0.62, 0, 0); } @@ -186,6 +188,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { if (convertType.HasFlag(PatternType.LowProbability)) return pattern = generateRandomPattern(0.35, 0.08, 0, 0); + return pattern = generateRandomPattern(0.52, 0.15, 0, 0); } @@ -193,6 +196,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy { if (convertType.HasFlag(PatternType.LowProbability)) return pattern = generateRandomPattern(0.18, 0, 0, 0); + return pattern = generateRandomPattern(0.45, 0, 0, 0); } @@ -250,6 +254,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy } else last = GetRandomColumn(); + return last; } } diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs index cf5dc4fe66..b702291c5d 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternGenerator.cs @@ -87,6 +87,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy return 4; if (val >= 1 - p3) return 3; + return val >= 1 - p2 ? 2 : 1; } diff --git a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternType.cs b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternType.cs index a6fa234960..a3cd455886 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternType.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/Patterns/Legacy/PatternType.cs @@ -12,51 +12,63 @@ namespace osu.Game.Rulesets.Mania.Beatmaps.Patterns.Legacy internal enum PatternType { None = 0, + /// /// Keep the same as last row. /// ForceStack = 1 << 0, + /// /// Keep different from last row. /// ForceNotStack = 1 << 1, + /// /// Keep as single note at its original position. /// KeepSingle = 1 << 2, + /// /// Use a lower random value. /// LowProbability = 1 << 3, + /// /// Reserved. /// Alternate = 1 << 4, + /// /// Ignore the repeat count. /// ForceSigSlider = 1 << 5, + /// /// Convert slider to circle. /// ForceNotSlider = 1 << 6, + /// /// Notes gathered together. /// Gathered = 1 << 7, Mirror = 1 << 8, + /// /// Change 0 -> 6. /// Reverse = 1 << 9, + /// /// 1 -> 5 -> 1 -> 5 like reverse. /// Cycle = 1 << 10, + /// /// Next note will be at column + 1. /// Stair = 1 << 11, + /// /// Next note will be at column - 1. /// diff --git a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs index 2f4870f647..b99bddee96 100644 --- a/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Mania/Difficulty/ManiaPerformanceCalculator.cs @@ -114,8 +114,8 @@ namespace osu.Game.Rulesets.Mania.Difficulty // Lots of arbitrary values from testing. // Considering to use derivation from perfect accuracy in a probabilistic manner - assume normal distribution double accuracyValue = Math.Max(0.0, 0.2 - (Attributes.GreatHitWindow - 34) * 0.006667) - * strainValue - * Math.Pow(Math.Max(0.0, scaledScore - 960000) / 40000, 1.1); + * strainValue + * Math.Pow(Math.Max(0.0, scaledScore - 960000) / 40000, 1.1); // Bonus for many hitcircles - it's harder to keep good accuracy up for longer // accuracyValue *= Math.Min(1.15, Math.Pow(totalHits / 1500.0, 0.3)); diff --git a/osu.Game.Rulesets.Mania/ManiaInputManager.cs b/osu.Game.Rulesets.Mania/ManiaInputManager.cs index 864084b407..292990fd7e 100644 --- a/osu.Game.Rulesets.Mania/ManiaInputManager.cs +++ b/osu.Game.Rulesets.Mania/ManiaInputManager.cs @@ -19,6 +19,7 @@ namespace osu.Game.Rulesets.Mania { [Description("Special 1")] Special1 = 1, + [Description("Special 2")] Special2, @@ -26,38 +27,55 @@ namespace osu.Game.Rulesets.Mania // above at a later time, without breaking replays/configs. [Description("Key 1")] Key1 = 10, + [Description("Key 2")] Key2, + [Description("Key 3")] Key3, + [Description("Key 4")] Key4, + [Description("Key 5")] Key5, + [Description("Key 6")] Key6, + [Description("Key 7")] Key7, + [Description("Key 8")] Key8, + [Description("Key 9")] Key9, + [Description("Key 10")] Key10, + [Description("Key 11")] Key11, + [Description("Key 12")] Key12, + [Description("Key 13")] Key13, + [Description("Key 14")] Key14, + [Description("Key 15")] Key15, + [Description("Key 16")] Key16, + [Description("Key 17")] Key17, + [Description("Key 18")] Key18, } diff --git a/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs b/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs index a88512e12f..a9cd7f2476 100644 --- a/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs +++ b/osu.Game.Rulesets.Mania/MathUtils/FastRandom.cs @@ -37,11 +37,11 @@ namespace osu.Game.Rulesets.Mania.MathUtils /// The random value. public uint NextUInt() { - uint t = X ^ X << 11; + uint t = X ^ (X << 11); X = Y; Y = Z; Z = W; - return W = W ^ W >> 19 ^ t ^ t >> 8; + return W = W ^ (W >> 19) ^ t ^ (t >> 8); } /// diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs index 3decd46888..6c1cd08539 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs @@ -82,6 +82,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces { if (accentColour == value) return; + accentColour = value; updateAccentColour(); diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs index 4a54ac0aac..d3a5fe1e01 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs @@ -35,6 +35,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces } private Color4 accentColour; + public Color4 AccentColour { get { return accentColour; } @@ -42,6 +43,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces { if (accentColour == value) return; + accentColour = value; updateGlow(); diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs index c5db6d7bd9..aee589f6db 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs @@ -56,6 +56,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces } private Color4 accentColour; + public Color4 AccentColour { get { return accentColour; } @@ -63,6 +64,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces { if (accentColour == value) return; + accentColour = value; colouredBox.Colour = AccentColour.Lighten(0.9f); diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index 8bb22fb586..591f940403 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -17,6 +17,7 @@ namespace osu.Game.Rulesets.Mania.Objects public double EndTime => StartTime + Duration; private double duration; + public double Duration { get { return duration; } diff --git a/osu.Game.Rulesets.Mania/Objects/ManiaHitWindows.cs b/osu.Game.Rulesets.Mania/Objects/ManiaHitWindows.cs index 9ebe638c30..5f2ceab48b 100644 --- a/osu.Game.Rulesets.Mania/Objects/ManiaHitWindows.cs +++ b/osu.Game.Rulesets.Mania/Objects/ManiaHitWindows.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Mania.Objects private static readonly IReadOnlyDictionary base_ranges = new Dictionary { { HitResult.Perfect, (44.8, 38.8, 27.8) }, - { HitResult.Great, (128, 98, 68 ) }, + { HitResult.Great, (128, 98, 68) }, { HitResult.Good, (194, 164, 134) }, { HitResult.Ok, (254, 224, 194) }, { HitResult.Meh, (302, 272, 242) }, diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index 856ae8af33..f17ebe5e90 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -97,6 +97,7 @@ namespace osu.Game.Rulesets.Mania.UI public override Axes RelativeSizeAxes => Axes.Y; private bool isSpecial; + public bool IsSpecial { get { return isSpecial; } @@ -104,6 +105,7 @@ namespace osu.Game.Rulesets.Mania.UI { if (isSpecial == value) return; + isSpecial = value; Width = isSpecial ? special_column_width : column_width; @@ -111,6 +113,7 @@ namespace osu.Game.Rulesets.Mania.UI } private Color4 accentColour; + public Color4 AccentColour { get { return accentColour; } @@ -118,6 +121,7 @@ namespace osu.Game.Rulesets.Mania.UI { if (accentColour == value) return; + accentColour = value; background.AccentColour = value; diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs index b43580e0f3..b4e29ae9f9 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnBackground.cs @@ -70,6 +70,7 @@ namespace osu.Game.Rulesets.Mania.UI.Components { if (accentColour == value) return; + accentColour = value; updateColours(); diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs index cd47bb1183..89e8cd9b5a 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnHitObjectArea.cs @@ -73,6 +73,7 @@ namespace osu.Game.Rulesets.Mania.UI.Components { if (accentColour == value) return; + accentColour = value; updateColours(); diff --git a/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs b/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs index b7d8945808..03b55cbead 100644 --- a/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs +++ b/osu.Game.Rulesets.Mania/UI/Components/ColumnKeyArea.cs @@ -87,6 +87,7 @@ namespace osu.Game.Rulesets.Mania.UI.Components { if (accentColour == value) return; + accentColour = value; updateColours(); diff --git a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs index 0ebcad3637..f7d1ff4db1 100644 --- a/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs +++ b/osu.Game.Rulesets.Osu.Tests/OsuBeatmapConversionTest.cs @@ -33,9 +33,11 @@ namespace osu.Game.Rulesets.Osu.Tests case Slider slider: foreach (var nested in slider.NestedHitObjects) yield return createConvertValue(nested); + break; default: yield return createConvertValue(hitObject); + break; } diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs index 6ebfe4fad1..3d553c334f 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseGameplayCursor.cs @@ -18,7 +18,7 @@ namespace osu.Game.Rulesets.Osu.Tests { private GameplayCursor cursor; - public override IReadOnlyList RequiredTypes => new [] { typeof(CursorTrail) }; + public override IReadOnlyList RequiredTypes => new[] { typeof(CursorTrail) }; public CursorContainer Cursor => cursor; diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs index 5484f15581..e1e854e8dc 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircle.cs @@ -89,7 +89,8 @@ namespace osu.Game.Rulesets.Osu.Tests { private readonly bool auto; - public TestDrawableHitCircle(HitCircle h, bool auto) : base(h) + public TestDrawableHitCircle(HitCircle h, bool auto) + : base(h) { this.auto = auto; } diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs index 1aabf9a904..35e8f3e17e 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs @@ -301,6 +301,7 @@ namespace osu.Game.Rulesets.Osu.Tests } private float judgementOffsetDirection = 1; + private void onNewResult(DrawableHitObject judgedObject, JudgementResult result) { var osuObject = judgedObject as DrawableOsuHitObject; diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinner.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinner.cs index df903efe3d..e8b534bba9 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSpinner.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSpinner.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.Tests public class TestCaseSpinner : OsuTestCase { public override IReadOnlyList RequiredTypes => new[] -{ + { typeof(SpinnerDisc), typeof(DrawableSpinner), typeof(DrawableOsuHitObject) @@ -67,7 +67,8 @@ namespace osu.Game.Rulesets.Osu.Tests { private bool auto; - public TestDrawableSpinner(Spinner s, bool auto) : base(s) + public TestDrawableSpinner(Spinner s, bool auto) + : base(s) { this.auto = auto; } diff --git a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs index 13a21c5c55..0dce5208dd 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/OsuPerformanceCalculator.cs @@ -97,7 +97,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty // Longer maps are worth more double lengthBonus = 0.95f + 0.4f * Math.Min(1.0f, totalHits / 2000.0f) + - (totalHits > 2000 ? Math.Log10(totalHits / 2000.0f) * 0.5f : 0.0f); + (totalHits > 2000 ? Math.Log10(totalHits / 2000.0f) * 0.5f : 0.0f); aimValue *= lengthBonus; @@ -113,7 +113,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty approachRateFactor += 0.3f * (Attributes.ApproachRate - 10.33f); else if (Attributes.ApproachRate < 8.0f) { - approachRateFactor += 0.01f * (8.0f - Attributes.ApproachRate); + approachRateFactor += 0.01f * (8.0f - Attributes.ApproachRate); } aimValue *= approachRateFactor; @@ -126,8 +126,10 @@ namespace osu.Game.Rulesets.Osu.Difficulty { // Apply object-based bonus for flashlight. aimValue *= 1.0f + 0.35f * Math.Min(1.0f, totalHits / 200.0f) + - (totalHits > 200 ? 0.3f * Math.Min(1.0f, (totalHits - 200) / 300.0f) + - (totalHits > 500 ? (totalHits - 500) / 1200.0f : 0.0f) : 0.0f); + (totalHits > 200 + ? 0.3f * Math.Min(1.0f, (totalHits - 200) / 300.0f) + + (totalHits > 500 ? (totalHits - 500) / 1200.0f : 0.0f) + : 0.0f); } // Scale the aim value with accuracy _slightly_ @@ -144,7 +146,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty // Longer maps are worth more speedValue *= 0.95f + 0.4f * Math.Min(1.0f, totalHits / 2000.0f) + - (totalHits > 2000 ? Math.Log10(totalHits / 2000.0f) * 0.5f : 0.0f); + (totalHits > 2000 ? Math.Log10(totalHits / 2000.0f) * 0.5f : 0.0f); // Penalize misses exponentially. This mainly fixes tag4 maps and the likes until a per-hitobject solution is available speedValue *= Math.Pow(0.97f, countMiss); diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 930c711783..119d957cc6 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -92,6 +92,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing { if (slider.LazyEndPosition != null) return; + slider.LazyEndPosition = slider.StackedPosition; float approxFollowCircleRadius = (float)(slider.Radius * 3); diff --git a/osu.Game.Rulesets.Osu/Judgements/ComboResult.cs b/osu.Game.Rulesets.Osu/Judgements/ComboResult.cs index d7c76fccbe..ad292b0439 100644 --- a/osu.Game.Rulesets.Osu/Judgements/ComboResult.cs +++ b/osu.Game.Rulesets.Osu/Judgements/ComboResult.cs @@ -9,8 +9,10 @@ namespace osu.Game.Rulesets.Osu.Judgements { [Description(@"")] None, + [Description(@"Good")] Good, + [Description(@"Amazing")] Perfect } diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs index 959bf1dc77..9a769ec39c 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModTransform.cs @@ -28,7 +28,7 @@ namespace osu.Game.Rulesets.Osu.Mods { foreach (var drawable in drawables) { - var hitObject = (OsuHitObject) drawable.HitObject; + var hitObject = (OsuHitObject)drawable.HitObject; float appearDistance = (float)(hitObject.TimePreempt - hitObject.TimeFadeIn) / 2; @@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Osu.Mods .MoveTo(originalPosition, moveDuration, Easing.InOutSine); } - theta += (float) hitObject.TimeFadeIn / 1000; + theta += (float)hitObject.TimeFadeIn / 1000; } } } diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs index 1105e8525b..b5ce36f889 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSliderTick.cs @@ -20,7 +20,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public override bool DisplayResult => false; - public DrawableSliderTick(SliderTick sliderTick) : base(sliderTick) + public DrawableSliderTick(SliderTick sliderTick) + : base(sliderTick) { Size = new Vector2(16) * sliderTick.Scale; Origin = Anchor.Centre; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs index 936023d39d..789af4f49b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSpinner.cs @@ -42,7 +42,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private Color4 normalColour; private Color4 completeColour; - public DrawableSpinner(Spinner s) : base(s) + public DrawableSpinner(Spinner s) + : base(s) { Origin = Anchor.Centre; Position = s.Position; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs index 6d2dc220da..b088f1914b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBody.cs @@ -40,6 +40,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { if (path.AccentColour == value) return; + path.AccentColour = value; container.ForceRedraw(); @@ -56,6 +57,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { if (path.BorderColour == value) return; + path.BorderColour = value; container.ForceRedraw(); @@ -105,6 +107,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { if (borderColour == value) return; + borderColour = value; InvalidateTexture(); @@ -120,6 +123,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces { if (accentColour == value) return; + accentColour = value; InvalidateTexture(); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 4206852b6c..76e1aaf73c 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -43,12 +43,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; private bool tracking; + public bool Tracking { get { return tracking; } set { if (value == tracking) return; + tracking = value; background.FadeTo(tracking ? tracking_alpha : idle_alpha, 100); @@ -56,12 +58,14 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces } private bool complete; + public bool Complete { get { return complete; } set { if (value == complete) return; + complete = value; updateCompleteTick(); diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs index 19f85bf4c3..9f36e8d62a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs @@ -45,6 +45,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces private set { if (value == spm) return; + spm = value; spmText.Text = Math.Truncate(value).ToString(@"#0"); } diff --git a/osu.Game.Rulesets.Osu/Objects/Slider.cs b/osu.Game.Rulesets.Osu/Objects/Slider.cs index c200b43d91..345f599b9d 100644 --- a/osu.Game.Rulesets.Osu/Objects/Slider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Slider.cs @@ -262,6 +262,7 @@ namespace osu.Game.Rulesets.Osu.Objects { if (nodeIndex < NodeSamples.Count) return NodeSamples[nodeIndex]; + return Samples; } diff --git a/osu.Game.Rulesets.Osu/OsuInputManager.cs b/osu.Game.Rulesets.Osu/OsuInputManager.cs index 2dd34d7d40..b9e083d35b 100644 --- a/osu.Game.Rulesets.Osu/OsuInputManager.cs +++ b/osu.Game.Rulesets.Osu/OsuInputManager.cs @@ -38,6 +38,7 @@ namespace osu.Game.Rulesets.Osu protected override bool Handle(UIEvent e) { if (!AllowUserPresses) return false; + return base.Handle(e); } } diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 200f4af3da..5ae7344996 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -121,7 +121,8 @@ namespace osu.Game.Rulesets.Osu new OsuModAutopilot(), }; case ModType.Fun: - return new Mod[] { + return new Mod[] + { new OsuModTransform(), new OsuModWiggle(), new OsuModGrow() diff --git a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs index b024ff4b05..b0fb85d7ed 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuAutoGenerator.cs @@ -209,7 +209,7 @@ namespace osu.Game.Rulesets.Osu.Replays // Only "snap" to hitcircles if they are far enough apart. As the time between hitcircles gets shorter the snapping threshold goes up. if (timeDifference > 0 && // Sanity checks ((lastPosition - targetPos).Length > h.Radius * (1.5 + 100.0 / timeDifference) || // Either the distance is big enough - timeDifference >= 266)) // ... or the beats are slow enough to tap anyway. + timeDifference >= 266)) // ... or the beats are slow enough to tap anyway. { // Perform eased movement for (double time = lastFrame.Time + FrameDelay; time < h.StartTime; time += FrameDelay) diff --git a/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs b/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs index 8bcdb5ee41..9a60f0cafc 100644 --- a/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs +++ b/osu.Game.Rulesets.Osu/Replays/OsuAutoGeneratorBase.cs @@ -20,6 +20,7 @@ namespace osu.Game.Rulesets.Osu.Replays /// Constants (for spinners). /// protected static readonly Vector2 SPINNER_CENTRE = OsuPlayfield.BASE_SIZE / 2; + protected const float SPIN_RADIUS = 50; /// @@ -46,6 +47,7 @@ namespace osu.Game.Rulesets.Osu.Replays #endregion #region Utilities + protected double ApplyModsToTime(double v) => v; protected double ApplyModsToRate(double v) => v; diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs index 03030121d3..0f8a0ce1ae 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/CursorTrail.cs @@ -255,10 +255,13 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor { [VertexMember(2, VertexAttribPointerType.Float)] public Vector2 Position; + [VertexMember(4, VertexAttribPointerType.Float)] public Color4 Colour; + [VertexMember(2, VertexAttribPointerType.Float)] public Vector2 TexturePosition; + [VertexMember(1, VertexAttribPointerType.Float)] public float Time; diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs index 325a0172b9..ef126cdf7d 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs @@ -213,6 +213,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor public void Expand() { if (!cursorExpand) return; + expandTarget.ScaleTo(released_scale).ScaleTo(pressed_scale, 100, Easing.OutQuad); } diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs index d6a598fbec..9211eccc40 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableSwell.cs @@ -229,6 +229,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables // Ensure alternating centre and rim hits if (lastWasCentre == isCentre) return false; + lastWasCentre = isCentre; UpdateResult(true); diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs index 38bf877040..5f755c7cc3 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/DrawableTaikoHitObject.cs @@ -49,6 +49,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected void ProxyContent() { if (isProxied) return; + isProxied = true; nonProxiedContent.Remove(Content); @@ -62,6 +63,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables protected void UnproxyContent() { if (!isProxied) return; + isProxied = false; proxiedContent.Remove(Content); diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs index dd6a1a5021..ec8b398124 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs @@ -11,6 +11,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces public class TaikoPiece : BeatSyncedContainer, IHasAccentColour { private Color4 accentColour; + /// /// The colour of the inner circle and outer glows. /// @@ -21,16 +22,14 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces } private bool kiaiMode; + /// /// Whether Kiai mode effects are enabled for this circle piece. /// public virtual bool KiaiMode { get { return kiaiMode; } - set - { - kiaiMode = value; - } + set { kiaiMode = value; } } public TaikoPiece() diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs index d625047d29..fc2be0c665 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs @@ -23,6 +23,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces private const float tick_size = 0.35f; private bool filled; + public bool Filled { get { return filled; } diff --git a/osu.Game.Rulesets.Taiko/Objects/Swell.cs b/osu.Game.Rulesets.Taiko/Objects/Swell.cs index 9d511daae4..befa728570 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Swell.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Swell.cs @@ -19,7 +19,10 @@ namespace osu.Game.Rulesets.Taiko.Objects /// public int RequiredHits = 10; - public override bool IsStrong { set => throw new NotSupportedException($"{nameof(Swell)} cannot be a strong hitobject."); } + public override bool IsStrong + { + set => throw new NotSupportedException($"{nameof(Swell)} cannot be a strong hitobject."); + } protected override void CreateNestedHitObjects() { diff --git a/osu.Game.Rulesets.Taiko/TaikoInputManager.cs b/osu.Game.Rulesets.Taiko/TaikoInputManager.cs index 2aae0b23b7..058bec5111 100644 --- a/osu.Game.Rulesets.Taiko/TaikoInputManager.cs +++ b/osu.Game.Rulesets.Taiko/TaikoInputManager.cs @@ -19,10 +19,13 @@ namespace osu.Game.Rulesets.Taiko { [Description("Left (rim)")] LeftRim, + [Description("Left (centre)")] LeftCentre, + [Description("Right (centre)")] RightCentre, + [Description("Right (rim)")] RightRim } diff --git a/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs b/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs index 127ee9e482..0722d2d97a 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs @@ -141,6 +141,7 @@ namespace osu.Game.Tests.Visual } private SortedList timingPoints => Beatmap.Value.Beatmap.ControlPointInfo.TimingPoints; + private TimingControlPoint getNextTimingPoint(TimingControlPoint current) { if (timingPoints[timingPoints.Count - 1] == current) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs b/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs index 99bdb05394..bab9fdd51c 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs @@ -150,6 +150,7 @@ namespace osu.Game.Tests.Visual var currentlySelected = carousel.Items.Find(s => s.Item is CarouselBeatmap && s.Item.State.Value == CarouselItemState.Selected); if (currentlySelected == null) return true; + return currentlySelected.Item.Visible; } @@ -162,11 +163,11 @@ namespace osu.Game.Tests.Visual private void checkNonmatchingFilter() { AddStep("Toggle non-matching filter", () => - { - carousel.Filter(new FilterCriteria { SearchText = "Dingo" }, false); - carousel.Filter(new FilterCriteria(), false); - eagerSelectedIDs.Add(carousel.SelectedBeatmapSet.ID); - } + { + carousel.Filter(new FilterCriteria { SearchText = "Dingo" }, false); + carousel.Filter(new FilterCriteria(), false); + eagerSelectedIDs.Add(carousel.SelectedBeatmapSet.ID); + } ); } @@ -522,6 +523,7 @@ namespace osu.Game.Tests.Visual } }); } + return toReturn; } diff --git a/osu.Game.Tests/Visual/TestCaseChatLink.cs b/osu.Game.Tests/Visual/TestCaseChatLink.cs index dc537348c9..b2ec2c9b47 100644 --- a/osu.Game.Tests/Visual/TestCaseChatLink.cs +++ b/osu.Game.Tests/Visual/TestCaseChatLink.cs @@ -56,7 +56,7 @@ namespace osu.Game.Tests.Visual var chatManager = new ChannelManager(); BindableList availableChannels = (BindableList)chatManager.AvailableChannels; - availableChannels.Add(new Channel { Name = "#english"}); + availableChannels.Add(new Channel { Name = "#english" }); availableChannels.Add(new Channel { Name = "#japanese" }); Dependencies.Cache(chatManager); diff --git a/osu.Game.Tests/Visual/TestCaseContextMenu.cs b/osu.Game.Tests/Visual/TestCaseContextMenu.cs index f969ec69e2..5cbe97e21d 100644 --- a/osu.Game.Tests/Visual/TestCaseContextMenu.cs +++ b/osu.Game.Tests/Visual/TestCaseContextMenu.cs @@ -61,10 +61,10 @@ namespace osu.Game.Tests.Visual // Move box along a square trajectory container.Loop(c => c - .MoveTo(new Vector2(0, 100), duration).Then() - .MoveTo(new Vector2(100, 100), duration).Then() - .MoveTo(new Vector2(100, 0), duration).Then() - .MoveTo(Vector2.Zero, duration) + .MoveTo(new Vector2(0, 100), duration).Then() + .MoveTo(new Vector2(100, 100), duration).Then() + .MoveTo(new Vector2(100, 0), duration).Then() + .MoveTo(Vector2.Zero, duration) ); } diff --git a/osu.Game.Tests/Visual/TestCaseEditorSeekSnapping.cs b/osu.Game.Tests/Visual/TestCaseEditorSeekSnapping.cs index 244f3b9d3d..0ec87e6f52 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorSeekSnapping.cs +++ b/osu.Game.Tests/Visual/TestCaseEditorSeekSnapping.cs @@ -33,7 +33,7 @@ namespace osu.Game.Tests.Visual { TimingPoints = { - new TimingControlPoint { Time = 0, BeatLength = 200}, + new TimingControlPoint { Time = 0, BeatLength = 200 }, new TimingControlPoint { Time = 100, BeatLength = 400 }, new TimingControlPoint { Time = 175, BeatLength = 800 }, new TimingControlPoint { Time = 350, BeatLength = 200 }, diff --git a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs index 3f36365a05..a21573236a 100644 --- a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs @@ -265,6 +265,7 @@ namespace osu.Game.Tests.Visual pauseOverlay.OnRetry = lastAction; lastAction = null; } + return triggered; }); AddAssert("Overlay is closed", () => pauseOverlay.State == Visibility.Hidden); diff --git a/osu.Game.Tests/Visual/TestCaseLeaderboard.cs b/osu.Game.Tests/Visual/TestCaseLeaderboard.cs index 822809b96e..eb1a2c0249 100644 --- a/osu.Game.Tests/Visual/TestCaseLeaderboard.cs +++ b/osu.Game.Tests/Visual/TestCaseLeaderboard.cs @@ -20,7 +20,8 @@ namespace osu.Game.Tests.Visual [Description("PlaySongSelect leaderboard")] public class TestCaseLeaderboard : OsuTestCase { - public override IReadOnlyList RequiredTypes => new[] { + public override IReadOnlyList RequiredTypes => new[] + { typeof(Placeholder), typeof(MessagePlaceholder), typeof(RetrievalFailurePlaceholder), diff --git a/osu.Game.Tests/Visual/TestCasePlaybackControl.cs b/osu.Game.Tests/Visual/TestCasePlaybackControl.cs index 60fd2fa79b..abcff24c67 100644 --- a/osu.Game.Tests/Visual/TestCasePlaybackControl.cs +++ b/osu.Game.Tests/Visual/TestCasePlaybackControl.cs @@ -26,7 +26,7 @@ namespace osu.Game.Tests.Visual { Anchor = Anchor.Centre, Origin = Anchor.Centre, - Size = new Vector2(200,100) + Size = new Vector2(200, 100) }; Beatmap.Value = new TestWorkingBeatmap(new Beatmap(), Clock); diff --git a/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs b/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs index 531c01158b..204f4a493d 100644 --- a/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs +++ b/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs @@ -84,7 +84,7 @@ namespace osu.Game.Tests.Visual public TestScreen PushNext() { TestScreen screen = CreateNextScreen(); - this.Push(screen); + this.Push(screen); return screen; } diff --git a/osu.Game.Tests/Visual/TestCaseStoryboard.cs b/osu.Game.Tests/Visual/TestCaseStoryboard.cs index fc62b8fe0c..c4b41e40f4 100644 --- a/osu.Game.Tests/Visual/TestCaseStoryboard.cs +++ b/osu.Game.Tests/Visual/TestCaseStoryboard.cs @@ -50,7 +50,10 @@ namespace osu.Game.Tests.Visual }); AddStep("Restart", restart); - AddToggleStep("Passing", passing => { if (storyboard != null) storyboard.Passing = passing; }); + AddToggleStep("Passing", passing => + { + if (storyboard != null) storyboard.Passing = passing; + }); } [BackgroundDependencyLoader] diff --git a/osu.Game/Audio/SampleInfo.cs b/osu.Game/Audio/SampleInfo.cs index 736caf69e8..5bc6dce60b 100644 --- a/osu.Game/Audio/SampleInfo.cs +++ b/osu.Game/Audio/SampleInfo.cs @@ -50,12 +50,14 @@ namespace osu.Game.Audio { if (!string.IsNullOrEmpty(Suffix)) yield return $"{Namespace}/{Bank}-{Name}{Suffix}"; + yield return $"{Namespace}/{Bank}-{Name}"; } // check non-namespace as a fallback even when we have a namespace if (!string.IsNullOrEmpty(Suffix)) yield return $"{Bank}-{Name}{Suffix}"; + yield return $"{Bank}-{Name}"; } } diff --git a/osu.Game/Beatmaps/BeatmapConverter.cs b/osu.Game/Beatmaps/BeatmapConverter.cs index d6041ad38d..b6fa6674f6 100644 --- a/osu.Game/Beatmaps/BeatmapConverter.cs +++ b/osu.Game/Beatmaps/BeatmapConverter.cs @@ -16,6 +16,7 @@ namespace osu.Game.Beatmaps where T : HitObject { private event Action> ObjectConverted; + event Action> IBeatmapConverter.ObjectConverted { add => ObjectConverted += value; diff --git a/osu.Game/Beatmaps/BeatmapDifficulty.cs b/osu.Game/Beatmaps/BeatmapDifficulty.cs index 21b943e111..8727431e0e 100644 --- a/osu.Game/Beatmaps/BeatmapDifficulty.cs +++ b/osu.Game/Beatmaps/BeatmapDifficulty.cs @@ -48,6 +48,7 @@ namespace osu.Game.Beatmaps return mid + (max - mid) * (difficulty - 5) / 5; if (difficulty < 5) return mid - (mid - min) * (5 - difficulty) / 5; + return mid; } diff --git a/osu.Game/Beatmaps/BeatmapMetadata.cs b/osu.Game/Beatmaps/BeatmapMetadata.cs index bac8ad5ed7..0d196fba40 100644 --- a/osu.Game/Beatmaps/BeatmapMetadata.cs +++ b/osu.Game/Beatmaps/BeatmapMetadata.cs @@ -48,6 +48,7 @@ namespace osu.Game.Beatmaps [JsonProperty(@"tags")] public string Tags { get; set; } + public int PreviewTime { get; set; } public string AudioFile { get; set; } public string BackgroundFile { get; set; } @@ -72,15 +73,15 @@ namespace osu.Game.Beatmaps return false; return Title == other.Title - && TitleUnicode == other.TitleUnicode - && Artist == other.Artist - && ArtistUnicode == other.ArtistUnicode - && AuthorString == other.AuthorString - && Source == other.Source - && Tags == other.Tags - && PreviewTime == other.PreviewTime - && AudioFile == other.AudioFile - && BackgroundFile == other.BackgroundFile; + && TitleUnicode == other.TitleUnicode + && Artist == other.Artist + && ArtistUnicode == other.ArtistUnicode + && AuthorString == other.AuthorString + && Source == other.Source + && Tags == other.Tags + && PreviewTime == other.PreviewTime + && AudioFile == other.AudioFile + && BackgroundFile == other.BackgroundFile; } } } diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs index ad7648e7fd..6786a780b6 100644 --- a/osu.Game/Beatmaps/BeatmapStore.cs +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -34,6 +34,7 @@ namespace osu.Game.Beatmaps Refresh(ref beatmap, Beatmaps); if (beatmap.Hidden) return false; + beatmap.Hidden = true; } @@ -53,6 +54,7 @@ namespace osu.Game.Beatmaps Refresh(ref beatmap, Beatmaps); if (!beatmap.Hidden) return false; + beatmap.Hidden = false; } diff --git a/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs index c8c735b439..0c59eec1ef 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapBackgroundSprite.cs @@ -13,8 +13,8 @@ namespace osu.Game.Beatmaps.Drawables public BeatmapBackgroundSprite(WorkingBeatmap working) { - if (working == null) - throw new ArgumentNullException(nameof(working)); + if (working == null) + throw new ArgumentNullException(nameof(working)); this.working = working; } diff --git a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs index 72b5f69eee..351e5df17a 100644 --- a/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs +++ b/osu.Game/Beatmaps/Drawables/BeatmapSetOnlineStatusPill.cs @@ -23,6 +23,7 @@ namespace osu.Game.Beatmaps.Drawables { if (status == value) return; + status = value; Alpha = value == BeatmapSetOnlineStatus.None ? 0 : 1; diff --git a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs index b025b5985c..ec52517197 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs @@ -53,6 +53,7 @@ namespace osu.Game.Beatmaps.Drawables if (rating < 3.75) return DifficultyRating.Hard; if (rating < 5.25) return DifficultyRating.Insane; if (rating < 6.75) return DifficultyRating.Expert; + return DifficultyRating.ExpertPlus; } diff --git a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs index 4d07fd234b..6fa7d47683 100644 --- a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs +++ b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapBackgroundSprite.cs @@ -25,7 +25,8 @@ namespace osu.Game.Beatmaps.Drawables protected override Drawable CreateDrawable(BeatmapInfo model) { - return new DelayedLoadUnloadWrapper(() => { + return new DelayedLoadUnloadWrapper(() => + { Drawable drawable; var localBeatmap = beatmaps.GetWorkingBeatmap(model); diff --git a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs index 45df2b3406..edc0623650 100644 --- a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs +++ b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs @@ -13,12 +13,14 @@ namespace osu.Game.Beatmaps.Drawables private Drawable displayedCover; private BeatmapSetInfo beatmapSet; + public BeatmapSetInfo BeatmapSet { get { return beatmapSet; } set { if (value == beatmapSet) return; + beatmapSet = value; if (IsLoaded) @@ -27,12 +29,14 @@ namespace osu.Game.Beatmaps.Drawables } private BeatmapSetCoverType coverType = BeatmapSetCoverType.Cover; + public BeatmapSetCoverType CoverType { get { return coverType; } set { if (value == coverType) return; + coverType = value; if (IsLoaded) diff --git a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs index 34e5afd1cd..040f582e3b 100644 --- a/osu.Game/Beatmaps/Formats/LegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/LegacyDecoder.cs @@ -72,6 +72,7 @@ namespace osu.Game.Beatmaps.Formats var index = line.AsSpan().IndexOf("//".AsSpan()); if (index > 0) return line.Substring(0, index); + return line; } @@ -115,6 +116,7 @@ namespace osu.Game.Beatmaps.Formats else { if (!(output is IHasCustomColours tHasCustomColours)) return; + tHasCustomColours.CustomColours[pair.Key] = colour; } } diff --git a/osu.Game/Configuration/RandomSelectAlgorithm.cs b/osu.Game/Configuration/RandomSelectAlgorithm.cs index 35240db0ee..8d0c87374f 100644 --- a/osu.Game/Configuration/RandomSelectAlgorithm.cs +++ b/osu.Game/Configuration/RandomSelectAlgorithm.cs @@ -5,10 +5,11 @@ using System.ComponentModel; namespace osu.Game.Configuration { - public enum RandomSelectAlgorithm + public enum RandomSelectAlgorithm { [Description("Never repeat")] RandomPermutation, + [Description("Random")] Random } diff --git a/osu.Game/Configuration/RankingType.cs b/osu.Game/Configuration/RankingType.cs index 6514be750d..7701e1dd1d 100644 --- a/osu.Game/Configuration/RankingType.cs +++ b/osu.Game/Configuration/RankingType.cs @@ -8,8 +8,10 @@ namespace osu.Game.Configuration public enum RankingType { Local, + [Description("Global")] Top, + [Description("Selected Mods")] SelectedMod, Friends, diff --git a/osu.Game/Configuration/ScalingMode.cs b/osu.Game/Configuration/ScalingMode.cs index 1dadfcecc9..0bcc908f71 100644 --- a/osu.Game/Configuration/ScalingMode.cs +++ b/osu.Game/Configuration/ScalingMode.cs @@ -9,6 +9,7 @@ namespace osu.Game.Configuration { Off, Everything, + [Description("Excluding overlays")] ExcludeOverlays, Gameplay, diff --git a/osu.Game/Configuration/ScreenshotFormat.cs b/osu.Game/Configuration/ScreenshotFormat.cs index 8015945747..6d4c96bfa9 100644 --- a/osu.Game/Configuration/ScreenshotFormat.cs +++ b/osu.Game/Configuration/ScreenshotFormat.cs @@ -9,6 +9,7 @@ namespace osu.Game.Configuration { [Description("JPG (web-friendly)")] Jpg = 1, + [Description("PNG (lossless)")] Png = 2 } diff --git a/osu.Game/Configuration/ScrollVisualisationMethod.cs b/osu.Game/Configuration/ScrollVisualisationMethod.cs index d2c09f9128..5f48fe8bfd 100644 --- a/osu.Game/Configuration/ScrollVisualisationMethod.cs +++ b/osu.Game/Configuration/ScrollVisualisationMethod.cs @@ -9,8 +9,10 @@ namespace osu.Game.Configuration { [Description("Sequential")] Sequential, + [Description("Overlapping")] Overlapping, + [Description("Constant")] Constant } diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 6bf9e2ff37..8c97a65c3a 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -539,6 +539,7 @@ namespace osu.Game.Database return new LegacyDirectoryArchiveReader(path); if (File.Exists(path)) return new LegacyFileArchiveReader(path); + throw new InvalidFormatException($"{path} is not a valid archive"); } } diff --git a/osu.Game/Database/DatabaseWriteUsage.cs b/osu.Game/Database/DatabaseWriteUsage.cs index 4659c212f3..1fd2f23d50 100644 --- a/osu.Game/Database/DatabaseWriteUsage.cs +++ b/osu.Game/Database/DatabaseWriteUsage.cs @@ -31,6 +31,7 @@ namespace osu.Game.Database protected void Dispose(bool disposing) { if (isDisposed) return; + isDisposed = true; try diff --git a/osu.Game/Database/MutableDatabaseBackedStore.cs b/osu.Game/Database/MutableDatabaseBackedStore.cs index 5e820d1478..8ed38fedb8 100644 --- a/osu.Game/Database/MutableDatabaseBackedStore.cs +++ b/osu.Game/Database/MutableDatabaseBackedStore.cs @@ -71,6 +71,7 @@ namespace osu.Game.Database Refresh(ref item); if (item.DeletePending) return false; + item.DeletePending = true; } @@ -89,6 +90,7 @@ namespace osu.Game.Database Refresh(ref item, ConsumableItems); if (!item.DeletePending) return false; + item.DeletePending = false; } diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index f4abcd6496..1939016a3b 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -110,10 +110,10 @@ namespace osu.Game.Graphics.Backgrounds if (CreateNewTriangles) addTriangles(false); - float adjustedAlpha = HideAlphaDiscrepancies ? + float adjustedAlpha = HideAlphaDiscrepancies // Cubically scale alpha to make it drop off more sharply. - (float)Math.Pow(DrawColourInfo.Colour.AverageColour.Linear.A, 3) : - 1; + ? (float)Math.Pow(DrawColourInfo.Colour.AverageColour.Linear.A, 3) + : 1; float elapsedSeconds = (float)Time.Elapsed / 1000; // Since position is relative, the velocity needs to scale inversely with DrawHeight. @@ -181,6 +181,7 @@ namespace osu.Game.Graphics.Backgrounds protected override DrawNode CreateDrawNode() => new TrianglesDrawNode(); private readonly TrianglesDrawNodeSharedData sharedData = new TrianglesDrawNodeSharedData(); + protected override void ApplyDrawNode(DrawNode node) { base.ApplyDrawNode(node); diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index bf48631569..18d1bf3533 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -96,6 +96,7 @@ namespace osu.Game.Graphics.Containers } else State = Visibility.Hidden; + break; case Visibility.Hidden: if (PlaySamplesOnStateChange) samplePopOut?.Play(); diff --git a/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs b/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs index e8b8537807..56e5f411b8 100644 --- a/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs +++ b/osu.Game/Graphics/Containers/OsuTextFlowContainer.cs @@ -12,7 +12,8 @@ namespace osu.Game.Graphics.Containers { public class OsuTextFlowContainer : TextFlowContainer { - public OsuTextFlowContainer(Action defaultCreationParameters = null) : base(defaultCreationParameters) + public OsuTextFlowContainer(Action defaultCreationParameters = null) + : base(defaultCreationParameters) { } diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index b8ea4e299c..ce1e515e8e 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -110,6 +110,7 @@ namespace osu.Game.Graphics.Containers private float headerHeight, footerHeight; private readonly MarginPadding originalSectionsMargin; + private void updateSectionsMargin() { if (!Children.Any()) return; @@ -142,6 +143,7 @@ namespace osu.Game.Graphics.Containers public void ScrollToTop() => scrollContainer.ScrollTo(0); private float lastKnownScroll; + protected override void UpdateAfterChildren() { base.UpdateAfterChildren(); diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 6e6f5f351e..059beeca4d 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -85,6 +85,7 @@ namespace osu.Game.Graphics.Cursor dragRotationState = DragRotationState.DragStarted; positionMouseDown = e.MousePosition; } + return base.OnMouseDown(e); } @@ -102,6 +103,7 @@ namespace osu.Game.Graphics.Cursor activeCursor.RotateTo(0, 600 * (1 + Math.Abs(activeCursor.Rotation / 720)), Easing.OutElasticHalf); dragRotationState = DragRotationState.NotDragging; } + return base.OnMouseUp(e); } diff --git a/osu.Game/Graphics/Cursor/MenuCursorContainer.cs b/osu.Game/Graphics/Cursor/MenuCursorContainer.cs index 5f9b428dfc..92e5ba6195 100644 --- a/osu.Game/Graphics/Cursor/MenuCursorContainer.cs +++ b/osu.Game/Graphics/Cursor/MenuCursorContainer.cs @@ -43,6 +43,7 @@ namespace osu.Game.Graphics.Cursor } private IProvideCursor currentTarget; + protected override void Update() { base.Update(); diff --git a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs index ec4cbb808e..4e0ce4a3e1 100644 --- a/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs +++ b/osu.Game/Graphics/Cursor/OsuTooltipContainer.cs @@ -17,7 +17,8 @@ namespace osu.Game.Graphics.Cursor { protected override ITooltip CreateTooltip() => new OsuTooltip(); - public OsuTooltipContainer(CursorContainer cursor) : base(cursor) + public OsuTooltipContainer(CursorContainer cursor) + : base(cursor) { } diff --git a/osu.Game/Graphics/DrawableDate.cs b/osu.Game/Graphics/DrawableDate.cs index fc5abcdcb8..3ae1033f5d 100644 --- a/osu.Game/Graphics/DrawableDate.cs +++ b/osu.Game/Graphics/DrawableDate.cs @@ -21,6 +21,7 @@ namespace osu.Game.Graphics { if (date == value) return; + date = value.ToLocalTime(); if (LoadState >= LoadState.Ready) diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs index dcb29d50ea..7556cded03 100644 --- a/osu.Game/Graphics/SpriteIcon.cs +++ b/osu.Game/Graphics/SpriteIcon.cs @@ -65,6 +65,7 @@ namespace osu.Game.Graphics } private FontAwesome loadedIcon; + private void updateTexture() { var loadableIcon = icon; @@ -104,6 +105,7 @@ namespace osu.Game.Graphics } private bool shadow; + public bool Shadow { get { return shadow; } @@ -119,10 +121,7 @@ namespace osu.Game.Graphics public FontAwesome Icon { - get - { - return icon; - } + get { return icon; } set { diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index 92b71a1cc3..bd236c7b67 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -26,10 +26,7 @@ namespace osu.Game.Graphics.UserInterface /// public float Length { - get - { - return length; - } + get { return length; } set { length = MathHelper.Clamp(value, 0, 1); @@ -39,35 +36,21 @@ 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 { return direction; } set { direction = value; diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 97335e3c42..56854f0d4f 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -17,6 +17,7 @@ namespace osu.Game.Graphics.UserInterface public float? MaxValue { get; set; } private BarDirection direction = BarDirection.BottomToTop; + public new BarDirection Direction { get @@ -69,6 +70,7 @@ namespace osu.Game.Graphics.UserInterface }); } } + //I'm using ToList() here because Where() returns an Enumerable which can change it's elements afterwards RemoveRange(Children.Where((bar, index) => index >= value.Count()).ToList()); } diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index e40168d213..b026ed6932 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -61,6 +61,7 @@ namespace osu.Game.Graphics.UserInterface set { if (value == state) return; + state = value; const float transition_duration = 500; @@ -80,7 +81,8 @@ namespace osu.Game.Graphics.UserInterface } } - public BreadcrumbTabItem(T value) : base(value) + public BreadcrumbTabItem(T value) + : base(value) { Text.Font = Text.Font.With(size: 18); Text.Margin = new MarginPadding { Vertical = 8 }; diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 2796db51a5..2a37dd11f2 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -154,12 +154,10 @@ namespace osu.Game.Graphics.UserInterface } private Color4 buttonColour; + public Color4 ButtonColour { - get - { - return buttonColour; - } + get { return buttonColour; } set { buttonColour = value; @@ -169,12 +167,10 @@ namespace osu.Game.Graphics.UserInterface } private Color4 backgroundColour = OsuColour.Gray(34); + public Color4 BackgroundColour { - get - { - return backgroundColour; - } + get { return backgroundColour; } set { backgroundColour = value; @@ -183,12 +179,10 @@ namespace osu.Game.Graphics.UserInterface } private string text; + public string Text { - get - { - return text; - } + get { return text; } set { text = value; diff --git a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs index 309021b7d6..2ed37799f6 100644 --- a/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs +++ b/osu.Game/Graphics/UserInterface/ExternalLinkButton.cs @@ -51,7 +51,7 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnClick(ClickEvent e) { - if(Link != null) + if (Link != null) host.OpenUrlExternally(Link); return true; } diff --git a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs index 4f84108d8a..cbbaa6d303 100644 --- a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs @@ -17,7 +17,8 @@ namespace osu.Game.Graphics.UserInterface { private SampleChannel sampleClick; - public HoverClickSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal) : base(sampleSet) + public HoverClickSounds(HoverSampleSet sampleSet = HoverSampleSet.Normal) + : base(sampleSet) { } diff --git a/osu.Game/Graphics/UserInterface/HoverSounds.cs b/osu.Game/Graphics/UserInterface/HoverSounds.cs index b2cd4aab19..b246092a7f 100644 --- a/osu.Game/Graphics/UserInterface/HoverSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverSounds.cs @@ -45,8 +45,10 @@ namespace osu.Game.Graphics.UserInterface { [Description("")] Loud, + [Description("-soft")] Normal, + [Description("-softer")] Soft } diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs index 88d64c1bfb..c43dc3a38a 100644 --- a/osu.Game/Graphics/UserInterface/LineGraph.cs +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -112,6 +112,7 @@ namespace osu.Game.Graphics.UserInterface protected float GetYPosition(float value) { if (ActualMaxValue == ActualMinValue) return 0; + return (ActualMaxValue - value) / (ActualMaxValue - ActualMinValue); } } diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index 470297a83c..c518bb75f1 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -72,6 +72,7 @@ namespace osu.Game.Graphics.UserInterface } private bool glowing; + public bool Glowing { get { return glowing; } @@ -94,10 +95,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 current = new Bindable(); @@ -116,6 +114,7 @@ namespace osu.Game.Graphics.UserInterface } private Color4 accentColour; + public Color4 AccentColour { get { return accentColour; } @@ -128,6 +127,7 @@ namespace osu.Game.Graphics.UserInterface } private Color4 glowingAccentColour; + public Color4 GlowingAccentColour { get { return glowingAccentColour; } @@ -140,6 +140,7 @@ namespace osu.Game.Graphics.UserInterface } private Color4 glowColour; + public Color4 GlowColour { get { return glowColour; } diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 0877776d0e..6d919683fb 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -17,6 +17,7 @@ namespace osu.Game.Graphics.UserInterface public class OsuDropdown : Dropdown, IHasAccentColour { private Color4 accentColour; + public Color4 AccentColour { get { return accentColour; } @@ -49,6 +50,7 @@ namespace osu.Game.Graphics.UserInterface protected override DropdownMenu CreateMenu() => new OsuDropdownMenu(); #region OsuDropdownMenu + protected class OsuDropdownMenu : DropdownMenu, IHasAccentColour { public override bool HandleNonPositionalInput => State == MenuState.Open; @@ -83,6 +85,7 @@ namespace osu.Game.Graphics.UserInterface } private Color4 accentColour; + public Color4 AccentColour { get { return accentColour; } @@ -97,12 +100,14 @@ namespace osu.Game.Graphics.UserInterface protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableOsuDropdownMenuItem(item) { AccentColour = accentColour }; #region DrawableOsuDropdownMenuItem + public class DrawableOsuDropdownMenuItem : DrawableDropdownMenuItem, IHasAccentColour { // IsHovered is used public override bool HandlePositionalInput => true; private Color4? accentColour; + public Color4 AccentColour { get { return accentColour ?? nonAccentSelectedColour; } @@ -194,13 +199,16 @@ namespace osu.Game.Graphics.UserInterface } } } + #endregion } + #endregion public class OsuDropdownHeader : DropdownHeader, IHasAccentColour { protected readonly SpriteText Text; + protected override string Label { get { return Text.Text; } @@ -210,6 +218,7 @@ namespace osu.Game.Graphics.UserInterface protected readonly SpriteIcon Icon; private Color4 accentColour; + public virtual Color4 AccentColour { get { return accentColour; } diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 3fd0ead760..bc5f454287 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -35,6 +35,7 @@ namespace osu.Game.Graphics.UserInterface public virtual string TooltipText { get; private set; } private Color4 accentColour; + public Color4 AccentColour { get { return accentColour; } @@ -79,10 +80,7 @@ namespace osu.Game.Graphics.UserInterface new HoverClickSounds() }; - Current.DisabledChanged += disabled => - { - Alpha = disabled ? 0.3f : 1; - }; + Current.DisabledChanged += disabled => { Alpha = disabled ? 0.3f : 1; }; } [BackgroundDependencyLoader] diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 2db0325813..3aabe8431c 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -58,6 +58,7 @@ namespace osu.Game.Graphics.UserInterface } private Color4 accentColour; + public Color4 AccentColour { get { return accentColour; } @@ -101,6 +102,7 @@ namespace osu.Game.Graphics.UserInterface protected readonly Box Bar; private Color4 accentColour; + public Color4 AccentColour { get { return accentColour; } @@ -146,7 +148,8 @@ namespace osu.Game.Graphics.UserInterface AccentColour = colours.Blue; } - public OsuTabItem(T value) : base(value) + public OsuTabItem(T value) + : base(value) { AutoSizeAxes = Axes.X; RelativeSizeAxes = Axes.Y; @@ -224,10 +227,7 @@ namespace osu.Game.Graphics.UserInterface { public override Color4 AccentColour { - get - { - return base.AccentColour; - } + get { return base.AccentColour; } set { diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs index b56b9ec18f..6f36479ac4 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs @@ -24,6 +24,7 @@ namespace osu.Game.Graphics.UserInterface private readonly SpriteIcon icon; private Color4? accentColour; + public Color4 AccentColour { get { return accentColour.GetValueOrDefault(); } diff --git a/osu.Game/Graphics/UserInterface/PageTabControl.cs b/osu.Game/Graphics/UserInterface/PageTabControl.cs index cc3415e9d2..156a556b5e 100644 --- a/osu.Game/Graphics/UserInterface/PageTabControl.cs +++ b/osu.Game/Graphics/UserInterface/PageTabControl.cs @@ -32,7 +32,8 @@ namespace osu.Game.Graphics.UserInterface protected readonly SpriteText Text; - public PageTabItem(T value) : base(value) + public PageTabItem(T value) + : base(value) { AutoSizeAxes = Axes.X; RelativeSizeAxes = Axes.Y; diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 52cd69a76e..01cd1dbc0c 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -54,6 +54,7 @@ namespace osu.Game.Graphics.UserInterface { if (EqualityComparer.Default.Equals(displayedCount, value)) return; + displayedCount = value; DisplayedCountSpriteText.Text = FormatCount(value); } diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index ad8ff8ec74..11cf800ea4 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -137,6 +137,7 @@ namespace osu.Game.Graphics.UserInterface private class Star : Container { public readonly SpriteIcon Icon; + public Star() { Size = new Vector2(star_size); diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index eddacf8e2d..02f8badff9 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -48,10 +48,7 @@ namespace osu.Game.Graphics.UserInterface public override Anchor Origin { - get - { - return base.Origin; - } + get { return 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,10 @@ 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() { diff --git a/osu.Game/IO/FileStore.cs b/osu.Game/IO/FileStore.cs index 21639e4f43..458f8964f9 100644 --- a/osu.Game/IO/FileStore.cs +++ b/osu.Game/IO/FileStore.cs @@ -21,7 +21,8 @@ namespace osu.Game.IO public new Storage Storage => base.Storage; - public FileStore(IDatabaseContextFactory contextFactory, Storage storage) : base(contextFactory, storage.GetStorageForDirectory(@"files")) + public FileStore(IDatabaseContextFactory contextFactory, Storage storage) + : base(contextFactory, storage.GetStorageForDirectory(@"files")) { Store = new StorageBackedResourceStore(Storage); } diff --git a/osu.Game/IO/Legacy/SerializationReader.cs b/osu.Game/IO/Legacy/SerializationReader.cs index aba9c289fa..95ee5aea6b 100644 --- a/osu.Game/IO/Legacy/SerializationReader.cs +++ b/osu.Game/IO/Legacy/SerializationReader.cs @@ -39,6 +39,7 @@ namespace osu.Game.IO.Legacy public override string ReadString() { if (ReadByte() == 0) return null; + return base.ReadString(); } @@ -48,6 +49,7 @@ namespace osu.Game.IO.Legacy int len = ReadInt32(); if (len > 0) return ReadBytes(len); if (len < 0) return null; + return Array.Empty(); } @@ -57,6 +59,7 @@ namespace osu.Game.IO.Legacy int len = ReadInt32(); if (len > 0) return ReadChars(len); if (len < 0) return null; + return Array.Empty(); } @@ -65,6 +68,7 @@ namespace osu.Game.IO.Legacy { long ticks = ReadInt64(); if (ticks < 0) throw new IOException("Bad ticks count read!"); + return new DateTime(ticks, DateTimeKind.Utc); } @@ -73,6 +77,7 @@ namespace osu.Game.IO.Legacy { int count = ReadInt32(); if (count < 0) return null; + IList d = new List(count); SerializationReader sr = new SerializationReader(BaseStream); @@ -88,6 +93,7 @@ namespace osu.Game.IO.Legacy { if (skipErrors) continue; + throw; } @@ -102,6 +108,7 @@ namespace osu.Game.IO.Legacy { int count = ReadInt32(); if (count < 0) return null; + IList d = new List(count); for (int i = 0; i < count; i++) d.Add((T)ReadObject()); return d; @@ -112,6 +119,7 @@ namespace osu.Game.IO.Legacy { int count = ReadInt32(); if (count < 0) return null; + IDictionary d = new Dictionary(); for (int i = 0; i < count; i++) d[(T)ReadObject()] = (U)ReadObject(); return d; @@ -174,7 +182,7 @@ namespace osu.Game.IO.Legacy versionBinder = new VersionConfigToNamespaceAssemblyObjectBinder(); formatter = new BinaryFormatter { -// AssemblyFormat = FormatterAssemblyStyle.Simple, + // AssemblyFormat = FormatterAssemblyStyle.Simple, Binder = versionBinder }; } @@ -224,6 +232,7 @@ namespace osu.Game.IO.Legacy genType = BindToType(assemblyName, typ); } } + if (genType != null && tmpTypes.Count > 0) { return genType.MakeGenericType(tmpTypes.ToArray()); diff --git a/osu.Game/IO/Legacy/SerializationWriter.cs b/osu.Game/IO/Legacy/SerializationWriter.cs index be6e9a0afe..695767c822 100644 --- a/osu.Game/IO/Legacy/SerializationWriter.cs +++ b/osu.Game/IO/Legacy/SerializationWriter.cs @@ -8,6 +8,7 @@ using System.Runtime.Serialization; using System.Runtime.Serialization.Formatters; using System.Runtime.Serialization.Formatters.Binary; using System.Text; + // ReSharper disable ConditionIsAlwaysTrueOrFalse (we're allowing nulls to be passed to the writer where the underlying class doesn't). // ReSharper disable HeuristicUnreachableCode @@ -219,7 +220,7 @@ namespace osu.Game.IO.Legacy Write((byte)ObjType.otherType); BinaryFormatter b = new BinaryFormatter { -// AssemblyFormat = FormatterAssemblyStyle.Simple, + // AssemblyFormat = FormatterAssemblyStyle.Simple, TypeFormat = FormatterTypeStyle.TypesWhenNeeded }; b.Serialize(BaseStream, obj); diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index 844b6ea658..97f4a9771f 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -62,31 +62,41 @@ namespace osu.Game.Input.Bindings { [Description("Toggle chat overlay")] ToggleChat, + [Description("Toggle social overlay")] ToggleSocial, + [Description("Reset input settings")] ResetInputSettings, + [Description("Toggle toolbar")] ToggleToolbar, + [Description("Toggle settings")] ToggleSettings, + [Description("Toggle osu!direct")] ToggleDirect, + [Description("Increase volume")] IncreaseVolume, + [Description("Decrease volume")] DecreaseVolume, + [Description("Toggle mute")] ToggleMute, // In-Game Keybindings [Description("Skip cutscene")] SkipCutscene, + [Description("Quick retry (hold)")] QuickRetry, [Description("Take screenshot")] TakeScreenshot, + [Description("Toggle gameplay mouse buttons")] ToggleGameplayMouseButtons, diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 9e84fd6009..403587e7f9 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -176,6 +176,7 @@ namespace osu.Game.Online.API lock (queue) { if (queue.Count == 0) break; + req = queue.Dequeue(); } diff --git a/osu.Game/Online/API/APIRequest.cs b/osu.Game/Online/API/APIRequest.cs index 59cd685295..2781a5709b 100644 --- a/osu.Game/Online/API/APIRequest.cs +++ b/osu.Game/Online/API/APIRequest.cs @@ -121,7 +121,10 @@ namespace osu.Game.Online.API } public delegate void APIFailureHandler(Exception e); + public delegate void APISuccessHandler(); + public delegate void APIProgressHandler(long current, long total); + public delegate void APISuccessHandler(T content); } diff --git a/osu.Game/Online/API/OAuthToken.cs b/osu.Game/Online/API/OAuthToken.cs index 4c9c7b808f..e04323c853 100644 --- a/osu.Game/Online/API/OAuthToken.cs +++ b/osu.Game/Online/API/OAuthToken.cs @@ -19,15 +19,9 @@ namespace osu.Game.Online.API [JsonProperty(@"expires_in")] public long ExpiresIn { - get - { - return AccessTokenExpiry - DateTimeOffset.UtcNow.ToUnixTimeSeconds(); - } + get { return AccessTokenExpiry - DateTimeOffset.UtcNow.ToUnixTimeSeconds(); } - set - { - AccessTokenExpiry = DateTimeOffset.Now.AddSeconds(value).ToUnixTimeSeconds(); - } + set { AccessTokenExpiry = DateTimeOffset.Now.AddSeconds(value).ToUnixTimeSeconds(); } } public bool IsValid => !string.IsNullOrEmpty(AccessToken) && ExpiresIn > 30; @@ -57,6 +51,7 @@ namespace osu.Game.Online.API catch { } + return null; } } diff --git a/osu.Game/Online/Chat/ErrorMessage.cs b/osu.Game/Online/Chat/ErrorMessage.cs index 46e222f11d..a8ff0e9a98 100644 --- a/osu.Game/Online/Chat/ErrorMessage.cs +++ b/osu.Game/Online/Chat/ErrorMessage.cs @@ -5,7 +5,8 @@ namespace osu.Game.Online.Chat { public class ErrorMessage : InfoMessage { - public ErrorMessage(string message) : base(message) + public ErrorMessage(string message) + : base(message) { Sender.Colour = @"ff0000"; } diff --git a/osu.Game/Online/Chat/InfoMessage.cs b/osu.Game/Online/Chat/InfoMessage.cs index 4ef0d5ec65..8dce188804 100644 --- a/osu.Game/Online/Chat/InfoMessage.cs +++ b/osu.Game/Online/Chat/InfoMessage.cs @@ -10,7 +10,8 @@ namespace osu.Game.Online.Chat { private static int infoID = -1; - public InfoMessage(string message) : base(infoID--) + public InfoMessage(string message) + : base(infoID--) { Timestamp = DateTimeOffset.Now; Content = message; diff --git a/osu.Game/Online/Chat/LocalEchoMessage.cs b/osu.Game/Online/Chat/LocalEchoMessage.cs index 639509851d..8a39515575 100644 --- a/osu.Game/Online/Chat/LocalEchoMessage.cs +++ b/osu.Game/Online/Chat/LocalEchoMessage.cs @@ -5,7 +5,8 @@ namespace osu.Game.Online.Chat { public class LocalEchoMessage : LocalMessage { - public LocalEchoMessage() : base(null) + public LocalEchoMessage() + : base(null) { } } diff --git a/osu.Game/Online/Chat/MessageFormatter.cs b/osu.Game/Online/Chat/MessageFormatter.cs index 726f6ad2f0..d35dc07368 100644 --- a/osu.Game/Online/Chat/MessageFormatter.cs +++ b/osu.Game/Online/Chat/MessageFormatter.cs @@ -25,19 +25,19 @@ namespace osu.Game.Online.Chat // This is in the format (, [optional]): // http[s]://.[:port][/path][?query][#fragment] private static readonly Regex advanced_link_regex = new Regex( - // protocol - @"(?[a-z]*?:\/\/" + - // domain + tld - @"(?(?:[a-z0-9]\.|[a-z0-9][a-z0-9-]*[a-z0-9]\.)*[a-z0-9-]*[a-z0-9]" + - // port (optional) - @"(?::\d+)?)" + - // path (optional) - @"(?(?:(?:\/+(?:[a-z0-9$_\.\+!\*\',;:\(\)@&~=-]|%[0-9a-f]{2})*)*" + - // query (optional) - @"(?:\?(?:[a-z0-9$_\+!\*\',;:\(\)@&=\/~-]|%[0-9a-f]{2})*)?)?" + - // fragment (optional) - @"(?:#(?:[a-z0-9$_\+!\*\',;:\(\)@&=\/~-]|%[0-9a-f]{2})*)?)?)", - RegexOptions.IgnoreCase); + // protocol + @"(?[a-z]*?:\/\/" + + // domain + tld + @"(?(?:[a-z0-9]\.|[a-z0-9][a-z0-9-]*[a-z0-9]\.)*[a-z0-9-]*[a-z0-9]" + + // port (optional) + @"(?::\d+)?)" + + // path (optional) + @"(?(?:(?:\/+(?:[a-z0-9$_\.\+!\*\',;:\(\)@&~=-]|%[0-9a-f]{2})*)*" + + // query (optional) + @"(?:\?(?:[a-z0-9$_\+!\*\',;:\(\)@&=\/~-]|%[0-9a-f]{2})*)?)?" + + // fragment (optional) + @"(?:#(?:[a-z0-9$_\+!\*\',;:\(\)@&=\/~-]|%[0-9a-f]{2})*)?)?)", + RegexOptions.IgnoreCase); // 00:00:000 (1,2,3) - test private static readonly Regex time_regex = new Regex(@"\d\d:\d\d:\d\d\d? [^-]*"); @@ -56,14 +56,14 @@ namespace osu.Game.Online.Chat var index = m.Index - captureOffset; var displayText = string.Format(display, - m.Groups[0], - m.Groups.Count > 1 ? m.Groups[1].Value : "", - m.Groups.Count > 2 ? m.Groups[2].Value : "").Trim(); + m.Groups[0], + m.Groups.Count > 1 ? m.Groups[1].Value : "", + m.Groups.Count > 2 ? m.Groups[2].Value : "").Trim(); var linkText = string.Format(link, - m.Groups[0], - m.Groups.Count > 1 ? m.Groups[1].Value : "", - m.Groups.Count > 2 ? m.Groups[2].Value : "").Trim(); + m.Groups[0], + m.Groups.Count > 1 ? m.Groups[1].Value : "", + m.Groups.Count > 2 ? m.Groups[2].Value : "").Trim(); if (displayText.Length == 0 || linkText.Length == 0) continue; diff --git a/osu.Game/Online/Chat/StandAloneChatDisplay.cs b/osu.Game/Online/Chat/StandAloneChatDisplay.cs index 3dbd174760..438bf231c4 100644 --- a/osu.Game/Online/Chat/StandAloneChatDisplay.cs +++ b/osu.Game/Online/Chat/StandAloneChatDisplay.cs @@ -126,7 +126,7 @@ namespace osu.Game.Online.Chat protected class StandAloneDrawableChannel : DrawableChannel { - public Func CreateChatLineAction; + public Func CreateChatLineAction; protected override ChatLine CreateChatLine(Message m) => CreateChatLineAction(m); @@ -144,7 +144,8 @@ namespace osu.Game.Online.Chat protected override float HorizontalPadding => 10; protected override float MessagePadding => 120; - public StandAloneMessage(Message message) : base(message) + public StandAloneMessage(Message message) + : base(message) { } } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 59b7120d95..54796dff77 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -482,6 +482,7 @@ namespace osu.Game overlay.StateChanged += state => { if (state == Visibility.Hidden) return; + singleDisplaySideOverlays.Where(o => o != overlay).ForEach(o => o.Hide()); }; } @@ -495,6 +496,7 @@ namespace osu.Game overlay.StateChanged += state => { if (state == Visibility.Hidden) return; + informationalOverlays.Where(o => o != overlay).ForEach(o => o.Hide()); }; } diff --git a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs index 8a75cfea50..7c8b4901e6 100644 --- a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs +++ b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs @@ -31,6 +31,7 @@ namespace osu.Game.Overlays.BeatmapSet set { if (value == beatmapSet) return; + beatmapSet = value; updateDisplay(); diff --git a/osu.Game/Overlays/BeatmapSet/BasicStats.cs b/osu.Game/Overlays/BeatmapSet/BasicStats.cs index ac2e5497af..131ea80fa2 100644 --- a/osu.Game/Overlays/BeatmapSet/BasicStats.cs +++ b/osu.Game/Overlays/BeatmapSet/BasicStats.cs @@ -25,6 +25,7 @@ namespace osu.Game.Overlays.BeatmapSet set { if (value == beatmapSet) return; + beatmapSet = value; updateDisplay(); @@ -39,6 +40,7 @@ namespace osu.Game.Overlays.BeatmapSet set { if (value == beatmap) return; + beatmap = value; updateDisplay(); diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs index 9f4ec0e814..81745673ee 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs @@ -33,12 +33,14 @@ namespace osu.Game.Overlays.BeatmapSet public readonly Bindable Beatmap = new Bindable(); private BeatmapSetInfo beatmapSet; + public BeatmapSetInfo BeatmapSet { get { return beatmapSet; } set { if (value == beatmapSet) return; + beatmapSet = value; updateDisplay(); @@ -194,12 +196,14 @@ namespace osu.Game.Overlays.BeatmapSet public event Action StateChanged; private DifficultySelectorState state; + public DifficultySelectorState State { get { return state; } set { if (value == state) return; + state = value; StateChanged?.Invoke(State); @@ -277,6 +281,7 @@ namespace osu.Game.Overlays.BeatmapSet private readonly OsuSpriteText text; private int value; + public int Value { get { return value; } diff --git a/osu.Game/Overlays/BeatmapSet/Details.cs b/osu.Game/Overlays/BeatmapSet/Details.cs index 538d327d98..5627c50118 100644 --- a/osu.Game/Overlays/BeatmapSet/Details.cs +++ b/osu.Game/Overlays/BeatmapSet/Details.cs @@ -29,6 +29,7 @@ namespace osu.Game.Overlays.BeatmapSet set { if (value == beatmapSet) return; + beatmapSet = value; basic.BeatmapSet = preview.BeatmapSet = BeatmapSet; diff --git a/osu.Game/Overlays/BeatmapSet/Info.cs b/osu.Game/Overlays/BeatmapSet/Info.cs index b6793d2609..3651c6428c 100644 --- a/osu.Game/Overlays/BeatmapSet/Info.cs +++ b/osu.Game/Overlays/BeatmapSet/Info.cs @@ -26,12 +26,14 @@ namespace osu.Game.Overlays.BeatmapSet private readonly SuccessRate successRate; private BeatmapSetInfo beatmapSet; + public BeatmapSetInfo BeatmapSet { get { return beatmapSet; } set { if (value == beatmapSet) return; + beatmapSet = value; updateDisplay(); diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs index 7933bfd9b6..71dc550b30 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs @@ -17,12 +17,14 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private UserProfileOverlay profile; private User user; + public User User { get { return user; } set { if (user == value) return; + user = value; text.Text = user.Username; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index c64bda9dfd..327b6e8c08 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -44,12 +44,14 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly ScoreModsContainer modsContainer; private APIScoreInfo score; + public APIScoreInfo Score { get { return score; } set { if (score == value) return; + score = value; avatar.User = username.User = score.User; @@ -207,6 +209,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores { if (valueText.Text == value) return; + valueText.Text = value; } get { return valueText.Text; } diff --git a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs index 0a844028fe..5fc0ed322b 100644 --- a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs +++ b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs @@ -21,12 +21,14 @@ namespace osu.Game.Overlays.BeatmapSet private readonly FailRetryGraph graph; private BeatmapInfo beatmap; + public BeatmapInfo Beatmap { get { return beatmap; } set { if (value == beatmap) return; + beatmap = value; updateDisplay(); diff --git a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs index 1dd888a3e9..56a454b1e0 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs @@ -36,12 +36,10 @@ namespace osu.Game.Overlays.Chat.Selection private Color4 hoverColour; public IEnumerable FilterTerms => new[] { channel.Name }; + public bool MatchingFilter { - set - { - this.FadeTo(value ? 1f : 0f, 100); - } + set { this.FadeTo(value ? 1f : 0f, 100); } } public Action OnRequestJoin; diff --git a/osu.Game/Overlays/Chat/Selection/ChannelSection.cs b/osu.Game/Overlays/Chat/Selection/ChannelSection.cs index 160bf05a2b..e2f63d6750 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelSection.cs @@ -21,12 +21,10 @@ namespace osu.Game.Overlays.Chat.Selection public IEnumerable FilterableChildren => ChannelFlow.Children; public IEnumerable FilterTerms => Array.Empty(); + public bool MatchingFilter { - set - { - this.FadeTo(value ? 1f : 0f, 100); - } + set { this.FadeTo(value ? 1f : 0f, 100); } } public string Header diff --git a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs index 6ac6133fd0..52260506fe 100644 --- a/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs +++ b/osu.Game/Overlays/Chat/Tabs/ChannelSelectorTabItem.cs @@ -13,7 +13,8 @@ namespace osu.Game.Overlays.Chat.Tabs public override bool IsSwitchable => false; - public ChannelSelectorTabItem(Channel value) : base(value) + public ChannelSelectorTabItem(Channel value) + : base(value) { Depth = float.MaxValue; Width = 45; diff --git a/osu.Game/Overlays/Dialog/PopupDialog.cs b/osu.Game/Overlays/Dialog/PopupDialog.cs index 781d1a5b7e..72e3cc4f6a 100644 --- a/osu.Game/Overlays/Dialog/PopupDialog.cs +++ b/osu.Game/Overlays/Dialog/PopupDialog.cs @@ -53,6 +53,7 @@ namespace osu.Game.Overlays.Dialog { if (text == value) return; + text = value; header.Text = value; diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index d6ac51b2d6..1413f0f885 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -29,7 +29,8 @@ namespace osu.Game.Overlays.Direct protected override PlayButton PlayButton => playButton; protected override Box PreviewBar => progressBar; - public DirectGridPanel(BeatmapSetInfo beatmap) : base(beatmap) + public DirectGridPanel(BeatmapSetInfo beatmap) + : base(beatmap) { Width = 380; Height = 140 + vertical_padding; //full height of all the elements plus vertical padding (autosize uses the image) diff --git a/osu.Game/Overlays/Direct/Header.cs b/osu.Game/Overlays/Direct/Header.cs index d1478cf3b6..e85cb3b4ac 100644 --- a/osu.Game/Overlays/Direct/Header.cs +++ b/osu.Game/Overlays/Direct/Header.cs @@ -28,10 +28,13 @@ namespace osu.Game.Overlays.Direct public enum DirectTab { Search, + [Description("Newest Maps")] NewestMaps = DirectSortCriteria.Ranked, + [Description("Top Rated")] TopRated = DirectSortCriteria.Rating, + [Description("Most Played")] MostPlayed = DirectSortCriteria.Plays, } diff --git a/osu.Game/Overlays/Direct/PlayButton.cs b/osu.Game/Overlays/Direct/PlayButton.cs index e001c2d3ea..8864488bb9 100644 --- a/osu.Game/Overlays/Direct/PlayButton.cs +++ b/osu.Game/Overlays/Direct/PlayButton.cs @@ -28,6 +28,7 @@ namespace osu.Game.Overlays.Direct set { if (value == beatmapSet) return; + beatmapSet = value; Preview?.Stop(); diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index d3881b6ef8..a83b4fdce9 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -76,6 +76,7 @@ namespace osu.Game.Overlays set { if (value == ResultAmounts) return; + resultAmounts = value; updateResultCounts(); diff --git a/osu.Game/Overlays/KeyBinding/GlobalKeyBindingsSection.cs b/osu.Game/Overlays/KeyBinding/GlobalKeyBindingsSection.cs index b67081846c..82e24f550b 100644 --- a/osu.Game/Overlays/KeyBinding/GlobalKeyBindingsSection.cs +++ b/osu.Game/Overlays/KeyBinding/GlobalKeyBindingsSection.cs @@ -33,7 +33,8 @@ namespace osu.Game.Overlays.KeyBinding { protected override string Header => "In Game"; - public InGameKeyBindingsSubsection(GlobalActionContainer manager) : base(null) + public InGameKeyBindingsSubsection(GlobalActionContainer manager) + : base(null) { Defaults = manager.InGameKeyBindings; } diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index 8a8ad0d964..d95fec8a65 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -313,6 +313,7 @@ namespace osu.Game.Overlays.KeyBinding set { if (value == isBinding) return; + isBinding = value; updateHoverState(); diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index 76efd74006..b8ad604e88 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -216,20 +216,20 @@ namespace osu.Game.Overlays rightStrip.ResizeWidthTo(1f, step_duration, Easing.OutQuint); this.Animate().Schedule(() => - { - if (drawableMedal.State != DisplayState.Full) - drawableMedal.State = DisplayState.Icon; - }) - .Delay(step_duration).Schedule(() => - { - if (drawableMedal.State != DisplayState.Full) - drawableMedal.State = DisplayState.MedalUnlocked; - }) - .Delay(step_duration).Schedule(() => - { - if (drawableMedal.State != DisplayState.Full) - drawableMedal.State = DisplayState.Full; - }); + { + if (drawableMedal.State != DisplayState.Full) + drawableMedal.State = DisplayState.Icon; + }) + .Delay(step_duration).Schedule(() => + { + if (drawableMedal.State != DisplayState.Full) + drawableMedal.State = DisplayState.MedalUnlocked; + }) + .Delay(step_duration).Schedule(() => + { + if (drawableMedal.State != DisplayState.Full) + drawableMedal.State = DisplayState.Full; + }); } } } diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index 2dedef8fb2..eaf440b4fd 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -29,6 +29,7 @@ namespace osu.Game.Overlays.MedalSplash private readonly OsuSpriteText unlocked, name; private readonly TextFlowContainer description; private DisplayState state; + public DrawableMedal(Medal medal) { this.medal = medal; diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index f9cc19419c..98dd3cbbbb 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -111,6 +111,7 @@ namespace osu.Game.Overlays.Mods set { if (value == selectedColour) return; + selectedColour = value; if (Selected) foregroundIcon.Colour = value; } diff --git a/osu.Game/Overlays/Mods/ModSection.cs b/osu.Game/Overlays/Mods/ModSection.cs index bf9efa75ea..a118357f21 100644 --- a/osu.Game/Overlays/Mods/ModSection.cs +++ b/osu.Game/Overlays/Mods/ModSection.cs @@ -81,6 +81,7 @@ namespace osu.Game.Overlays.Mods { Mod selected = button.SelectedMod; if (selected == null) continue; + foreach (var type in modTypes) if (type.IsInstanceOfType(selected)) { diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index f6cccdef5f..24faf36ef8 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -168,6 +168,7 @@ namespace osu.Game.Overlays.Mods public void DeselectTypes(Type[] modTypes, bool immediate = false) { if (modTypes.Length == 0) return; + foreach (ModSection section in ModSectionsContainer.Children) section.DeselectTypes(modTypes, immediate); } diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 65f02e1839..6065bcc3e9 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -50,12 +50,14 @@ namespace osu.Game.Overlays.Music } private bool selected; + public bool Selected { get { return selected; } set { if (value == selected) return; + selected = value; FinishTransforms(true); diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index b02ad242aa..6fb24fb33d 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -130,6 +130,7 @@ namespace osu.Game.Overlays.Music nativeDragPosition = e.ScreenSpaceMousePosition; if (draggedItem == null) return base.OnDrag(e); + return true; } diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index 55b1f04528..ad41ef803c 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -78,6 +78,7 @@ namespace osu.Game.Overlays } private ScheduledDelegate notificationsEnabler; + private void updateProcessingMode() { bool enabled = OverlayActivationMode.Value == OverlayActivation.All || State == Visibility.Visible; diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index b77b6f837d..324be51d37 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -151,6 +151,7 @@ namespace osu.Game.Overlays.Notifications public virtual void Close() { if (WasClosed) return; + WasClosed = true; Closed?.Invoke(); diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index efb66a7153..fe46a5d518 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -17,10 +17,7 @@ namespace osu.Game.Overlays.Notifications { public string Text { - set - { - Schedule(() => textDrawable.Text = value); - } + set { Schedule(() => textDrawable.Text = value); } } public string CompletionText { get; set; } = "Task has completed!"; @@ -178,6 +175,7 @@ namespace osu.Game.Overlays.Notifications private Color4 colourInactive; private float progress; + public float Progress { get { return progress; } diff --git a/osu.Game/Overlays/Notifications/SimpleNotification.cs b/osu.Game/Overlays/Notifications/SimpleNotification.cs index 91dab14a62..8fc4193016 100644 --- a/osu.Game/Overlays/Notifications/SimpleNotification.cs +++ b/osu.Game/Overlays/Notifications/SimpleNotification.cs @@ -15,6 +15,7 @@ namespace osu.Game.Overlays.Notifications public class SimpleNotification : Notification { private string text = string.Empty; + public string Text { get { return text; } @@ -26,6 +27,7 @@ namespace osu.Game.Overlays.Notifications } private FontAwesome icon = FontAwesome.fa_info_circle; + public FontAwesome Icon { get { return icon; } @@ -76,10 +78,7 @@ namespace osu.Game.Overlays.Notifications public override bool Read { - get - { - return base.Read; - } + get { return base.Read; } set { diff --git a/osu.Game/Overlays/Profile/Header/RankGraph.cs b/osu.Game/Overlays/Profile/Header/RankGraph.cs index 05161de4c0..3df0677576 100644 --- a/osu.Game/Overlays/Profile/Header/RankGraph.cs +++ b/osu.Game/Overlays/Profile/Header/RankGraph.cs @@ -140,6 +140,7 @@ namespace osu.Game.Overlays.Profile.Header graph.UpdateBallPosition(e.MousePosition.X); graph.ShowBall(); } + return base.OnHover(e); } diff --git a/osu.Game/Overlays/Profile/Header/SupporterIcon.cs b/osu.Game/Overlays/Profile/Header/SupporterIcon.cs index 92c8a34728..722c9c9af2 100644 --- a/osu.Game/Overlays/Profile/Header/SupporterIcon.cs +++ b/osu.Game/Overlays/Profile/Header/SupporterIcon.cs @@ -23,35 +23,35 @@ namespace osu.Game.Overlays.Profile.Header Masking = true; Children = new Drawable[] { - new Box { RelativeSizeAxes = Axes.Both }, - new CircularContainer + new Box { RelativeSizeAxes = Axes.Both }, + new CircularContainer + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Scale = new Vector2(0.8f), + Masking = true, + Children = new Drawable[] { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Scale = new Vector2(0.8f), - Masking = true, - Children = new Drawable[] + background = new Box { RelativeSizeAxes = Axes.Both }, + new Triangles { - background = new Box { RelativeSizeAxes = Axes.Both }, - new Triangles - { - TriangleScale = 0.2f, - ColourLight = OsuColour.FromHex(@"ff7db7"), - ColourDark = OsuColour.FromHex(@"de5b95"), - RelativeSizeAxes = Axes.Both, - Velocity = 0.3f, - }, - } - }, - new SpriteIcon - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Icon = FontAwesome.fa_heart, - Scale = new Vector2(0.45f), + TriangleScale = 0.2f, + ColourLight = OsuColour.FromHex(@"ff7db7"), + ColourDark = OsuColour.FromHex(@"de5b95"), + RelativeSizeAxes = Axes.Both, + Velocity = 0.3f, + }, } + }, + new SpriteIcon + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + Icon = FontAwesome.fa_heart, + Scale = new Vector2(0.45f), + } }; } diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs index 64c8260524..ef2b8739d9 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs @@ -48,7 +48,7 @@ namespace osu.Game.Overlays.Profile.Sections new OsuSpriteText { Text = new LocalisedString(($"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ", - $"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")), + $"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")), Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold, italics: true) }, new OsuSpriteText diff --git a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs index 4757f676c8..f2eb32c53b 100644 --- a/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Historical/PaginatedMostPlayedBeatmapContainer.cs @@ -15,7 +15,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical private GetUserMostPlayedBeatmapsRequest request; public PaginatedMostPlayedBeatmapContainer(Bindable user) - :base(user, "Most Played Beatmaps", "No records. :(") + : base(user, "Most Played Beatmaps", "No records. :(") { ItemsPerPage = 5; diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs index 7164bc7cd1..497d6c3fc4 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainer.cs @@ -65,7 +65,7 @@ namespace osu.Game.Overlays.Profile.Sections { Font = OsuFont.GetFont(size: 14), Text = "show more", - Padding = new MarginPadding {Vertical = 10, Horizontal = 15 }, + Padding = new MarginPadding { Vertical = 10, Horizontal = 15 }, } }, ShowMoreLoading = new LoadingAnimation diff --git a/osu.Game/Overlays/SearchableList/HeaderTabControl.cs b/osu.Game/Overlays/SearchableList/HeaderTabControl.cs index 39348a9ad7..2087a72c54 100644 --- a/osu.Game/Overlays/SearchableList/HeaderTabControl.cs +++ b/osu.Game/Overlays/SearchableList/HeaderTabControl.cs @@ -19,7 +19,8 @@ namespace osu.Game.Overlays.SearchableList private class HeaderTabItem : OsuTabItem { - public HeaderTabItem(T value) : base(value) + public HeaderTabItem(T value) + : base(value) { Text.Font = Text.Font.With(size: 16); } diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 4e1130690f..7f5bb279fc 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -277,6 +277,7 @@ namespace osu.Game.Overlays.Settings.Sections.General { var h = Header as UserDropdownHeader; if (h == null) return; + h.StatusColour = value; } } diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 628cdb944a..53146ba102 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -84,7 +84,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics AutoSizeDuration = transition_duration, AutoSizeEasing = Easing.OutQuint, Masking = true, - Children = new [] + Children = new[] { new SettingsSlider { @@ -171,6 +171,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics } private Drawable preview; + private void showPreview() { if (preview?.IsAlive != true) @@ -225,6 +226,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { if (item == new Size(9999, 9999)) return "Default"; + return $"{item.Width}x{item.Height}"; } } diff --git a/osu.Game/Overlays/Settings/SettingsSubsection.cs b/osu.Game/Overlays/Settings/SettingsSubsection.cs index 9a3eeac5d0..ff4e6ae175 100644 --- a/osu.Game/Overlays/Settings/SettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/SettingsSubsection.cs @@ -22,12 +22,10 @@ namespace osu.Game.Overlays.Settings public IEnumerable FilterableChildren => Children.OfType(); public IEnumerable FilterTerms => new[] { Header }; + public bool MatchingFilter { - set - { - this.FadeTo(value ? 1 : 0); - } + set { this.FadeTo(value ? 1 : 0); } } protected SettingsSubsection() diff --git a/osu.Game/Overlays/Settings/SidebarButton.cs b/osu.Game/Overlays/Settings/SidebarButton.cs index c53596cabe..1390230cf8 100644 --- a/osu.Game/Overlays/Settings/SidebarButton.cs +++ b/osu.Game/Overlays/Settings/SidebarButton.cs @@ -26,12 +26,10 @@ namespace osu.Game.Overlays.Settings public new Action Action; private SettingsSection section; + public SettingsSection Section { - get - { - return section; - } + get { return section; } set { section = value; @@ -41,6 +39,7 @@ namespace osu.Game.Overlays.Settings } private bool selected; + public bool Selected { get { return selected; } diff --git a/osu.Game/Overlays/Social/Header.cs b/osu.Game/Overlays/Social/Header.cs index fb72051a41..cf8053ac6e 100644 --- a/osu.Game/Overlays/Social/Header.cs +++ b/osu.Game/Overlays/Social/Header.cs @@ -54,6 +54,7 @@ namespace osu.Game.Overlays.Social { [Description("All Players")] AllPlayers, + [Description("Friends")] Friends, //[Description("Team Members")] diff --git a/osu.Game/Overlays/Social/SocialGridPanel.cs b/osu.Game/Overlays/Social/SocialGridPanel.cs index ccb8870bc9..6f707d640b 100644 --- a/osu.Game/Overlays/Social/SocialGridPanel.cs +++ b/osu.Game/Overlays/Social/SocialGridPanel.cs @@ -7,7 +7,8 @@ namespace osu.Game.Overlays.Social { public class SocialGridPanel : SocialPanel { - public SocialGridPanel(User user) : base(user) + public SocialGridPanel(User user) + : base(user) { Width = 300; } diff --git a/osu.Game/Overlays/Social/SocialListPanel.cs b/osu.Game/Overlays/Social/SocialListPanel.cs index 52c2caaa49..1ba91e9204 100644 --- a/osu.Game/Overlays/Social/SocialListPanel.cs +++ b/osu.Game/Overlays/Social/SocialListPanel.cs @@ -8,7 +8,8 @@ namespace osu.Game.Overlays.Social { public class SocialListPanel : SocialPanel { - public SocialListPanel(User user) : base(user) + public SocialListPanel(User user) + : base(user) { RelativeSizeAxes = Axes.X; } diff --git a/osu.Game/Overlays/Social/SocialPanel.cs b/osu.Game/Overlays/Social/SocialPanel.cs index bf1be29aa1..738f940484 100644 --- a/osu.Game/Overlays/Social/SocialPanel.cs +++ b/osu.Game/Overlays/Social/SocialPanel.cs @@ -15,7 +15,8 @@ namespace osu.Game.Overlays.Social { private const double hover_transition_time = 400; - public SocialPanel(User user) : base(user) + public SocialPanel(User user) + : base(user) { } diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 9ee255819a..e206bbc055 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -34,6 +34,7 @@ namespace osu.Game.Overlays protected override SearchableListFilterControl CreateFilterControl() => new FilterControl(); private IEnumerable users; + public IEnumerable Users { get { return users; } @@ -123,6 +124,7 @@ namespace osu.Game.Overlays panel = new SocialListPanel(u); break; } + panel.Status.BindTo(u.Status); return panel; }) @@ -130,7 +132,7 @@ namespace osu.Game.Overlays LoadComponentAsync(newPanels, f => { - if(panels != null) + if (panels != null) ScrollFlow.Remove(panels); ScrollFlow.Add(panels = newPanels); @@ -171,6 +173,7 @@ namespace osu.Game.Overlays api.Queue(getUsersRequest = userRequest); break; } + loading.Show(); } diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 32ab80d50f..2c1b78dbe5 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -41,28 +41,19 @@ namespace osu.Game.Overlays.Toolbar public string Text { get { return DrawableText.Text; } - set - { - DrawableText.Text = value; - } + set { DrawableText.Text = value; } } public string TooltipMain { get { return tooltip1.Text; } - set - { - tooltip1.Text = value; - } + set { tooltip1.Text = value; } } public string TooltipSub { get { return tooltip2.Text; } - set - { - tooltip2.Text = value; - } + set { tooltip2.Text = value; } } protected virtual Anchor TooltipAnchor => Anchor.TopLeft; @@ -75,7 +66,8 @@ namespace osu.Game.Overlays.Toolbar private readonly SpriteText tooltip2; protected FillFlowContainer Flow; - public ToolbarButton() : base(HoverSampleSet.Loud) + public ToolbarButton() + : base(HoverSampleSet.Loud) { Width = WIDTH; RelativeSizeAxes = Axes.Y; diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs index 07a53f0bae..466e3a6fc3 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs @@ -10,6 +10,7 @@ namespace osu.Game.Overlays.Toolbar public class ToolbarRulesetButton : ToolbarButton { private RulesetInfo ruleset; + public RulesetInfo Ruleset { get { return ruleset; } diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs index eeb9527b50..f9cf5d4350 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarUserArea.cs @@ -22,7 +22,8 @@ namespace osu.Game.Overlays.Toolbar RelativeSizeAxes = Axes.Y; AutoSizeAxes = Axes.X; - Children = new Drawable[] { + Children = new Drawable[] + { button = new ToolbarUserButton { Action = () => LoginOverlay.ToggleVisibility(), diff --git a/osu.Game/Overlays/UserProfileOverlay.cs b/osu.Game/Overlays/UserProfileOverlay.cs index 80ed6128b8..1ff1c2ce91 100644 --- a/osu.Game/Overlays/UserProfileOverlay.cs +++ b/osu.Game/Overlays/UserProfileOverlay.cs @@ -144,6 +144,7 @@ namespace osu.Game.Overlays tabs.Current.Value = lastSection; return; } + if (lastSection != section.NewValue) { lastSection = section.NewValue; @@ -212,7 +213,8 @@ namespace osu.Game.Overlays private class ProfileTabItem : PageTabItem { - public ProfileTabItem(ProfileSection value) : base(value) + public ProfileTabItem(ProfileSection value) + : base(value) { Text.Text = value.Title; } diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index a5cb805300..db8bdde6bb 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -113,12 +113,15 @@ namespace osu.Game.Rulesets.Difficulty case 0: // Initial-case: Empty current set yield return new ModNoMod(); + break; case 1: yield return currentSet.Single(); + break; default: yield return new MultiMod(currentSet.ToArray()); + break; } diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index e557edf49f..025564e249 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -111,8 +111,8 @@ namespace osu.Game.Rulesets.Edit toolboxCollection.Items = CompositionTools.Select(t => new RadioButton(t.Name, () => blueprintContainer.CurrentTool = t)) - .Prepend(new RadioButton("Select", () => blueprintContainer.CurrentTool = null)) - .ToList(); + .Prepend(new RadioButton("Select", () => blueprintContainer.CurrentTool = null)) + .ToList(); toolboxCollection.Items[0].Select(); } diff --git a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs index 434ce4a721..74aa9ace2d 100644 --- a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs +++ b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs @@ -75,6 +75,7 @@ namespace osu.Game.Rulesets.Edit { if (state == value) return; + state = value; if (state == PlacementState.Shown) diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index 2a416b2705..dfada5614a 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -109,6 +109,7 @@ namespace osu.Game.Rulesets.Mods protected abstract string FragmentShader { get; } private Vector2 flashlightPosition; + protected Vector2 FlashlightPosition { get => flashlightPosition; @@ -122,6 +123,7 @@ namespace osu.Game.Rulesets.Mods } private Vector2 flashlightSize; + protected Vector2 FlashlightSize { get => flashlightSize; diff --git a/osu.Game/Rulesets/Mods/ModHidden.cs b/osu.Game/Rulesets/Mods/ModHidden.cs index 2989ec2304..e526125947 100644 --- a/osu.Game/Rulesets/Mods/ModHidden.cs +++ b/osu.Game/Rulesets/Mods/ModHidden.cs @@ -31,6 +31,8 @@ namespace osu.Game.Rulesets.Mods d.ApplyCustomUpdateState += ApplyHiddenState; } - protected virtual void ApplyHiddenState(DrawableHitObject hitObject, ArmedState state) { } + protected virtual void ApplyHiddenState(DrawableHitObject hitObject, ArmedState state) + { + } } } diff --git a/osu.Game/Rulesets/Objects/HitWindows.cs b/osu.Game/Rulesets/Objects/HitWindows.cs index 6c97f6b6da..c5b7686da6 100644 --- a/osu.Game/Rulesets/Objects/HitWindows.cs +++ b/osu.Game/Rulesets/Objects/HitWindows.cs @@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Objects private static readonly IReadOnlyDictionary base_ranges = new Dictionary { { HitResult.Perfect, (44.8, 38.8, 27.8) }, - { HitResult.Great, (128, 98, 68 ) }, + { HitResult.Great, (128, 98, 68) }, { HitResult.Good, (194, 164, 134) }, { HitResult.Ok, (254, 224, 194) }, { HitResult.Meh, (302, 272, 242) }, diff --git a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs index 6917d009f4..c9f7224643 100644 --- a/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs +++ b/osu.Game/Rulesets/Objects/Legacy/ConvertHitObjectType.cs @@ -12,7 +12,7 @@ namespace osu.Game.Rulesets.Objects.Legacy Slider = 1 << 1, NewCombo = 1 << 2, Spinner = 1 << 3, - ComboOffset = 1 << 4 | 1 << 5 | 1 << 6, + ComboOffset = (1 << 4) | (1 << 5) | (1 << 6), Hold = 1 << 7 } } diff --git a/osu.Game/Rulesets/Objects/SliderPath.cs b/osu.Game/Rulesets/Objects/SliderPath.cs index 8cadb38190..1e9767a54f 100644 --- a/osu.Game/Rulesets/Objects/SliderPath.cs +++ b/osu.Game/Rulesets/Objects/SliderPath.cs @@ -125,6 +125,7 @@ namespace osu.Game.Rulesets.Objects { if (isInitialised) return; + isInitialised = true; controlPoints = controlPoints ?? Array.Empty(); @@ -280,6 +281,7 @@ namespace osu.Game.Rulesets.Objects public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; + return obj is SliderPath other && Equals(other); } } diff --git a/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs index ed4be4b815..c89ac59e10 100644 --- a/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs +++ b/osu.Game/Rulesets/Replays/FramedReplayInputHandler.cs @@ -99,6 +99,7 @@ namespace osu.Game.Rulesets.Replays // that would occur as a result of this frame in forward playback if (currentDirection == -1) return CurrentTime = CurrentFrame.Time - 1; + return CurrentTime = CurrentFrame.Time; } } diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs b/osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs index 1a307c29b8..81e1a6c916 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs +++ b/osu.Game/Rulesets/UI/Scrolling/ScrollingDirection.cs @@ -9,14 +9,17 @@ namespace osu.Game.Rulesets.UI.Scrolling /// Hit objects will scroll vertically from the bottom of the hitobject container. /// Up, + /// /// Hit objects will scroll vertically from the top of the hitobject container. /// Down, + /// /// Hit objects will scroll horizontally from the right of the hitobject container. /// Left, + /// /// Hit objects will scroll horizontally from the left of the hitobject container. /// diff --git a/osu.Game/Scoring/Legacy/LegacyScoreParser.cs b/osu.Game/Scoring/Legacy/LegacyScoreParser.cs index f89f8e80bf..ace8892330 100644 --- a/osu.Game/Scoring/Legacy/LegacyScoreParser.cs +++ b/osu.Game/Scoring/Legacy/LegacyScoreParser.cs @@ -111,12 +111,14 @@ namespace osu.Game.Scoring.Legacy byte[] properties = new byte[5]; if (replayInStream.Read(properties, 0, 5) != 5) throw new IOException("input .lzma is too short"); + long outSize = 0; for (int i = 0; i < 8; i++) { int v = replayInStream.ReadByte(); if (v < 0) throw new IOException("Can't Read 1"); + outSize |= (long)(byte)v << (8 * i); } @@ -264,6 +266,7 @@ namespace osu.Game.Scoring.Legacy var convertible = currentRuleset.CreateConvertibleReplayFrame(); if (convertible == null) throw new InvalidOperationException($"Legacy replay cannot be converted for the ruleset: {currentRuleset.Description}"); + convertible.ConvertFrom(legacyFrame, currentBeatmap); var frame = (ReplayFrame)convertible; diff --git a/osu.Game/Scoring/ScoreRank.cs b/osu.Game/Scoring/ScoreRank.cs index 05a0efe45c..82c33748bb 100644 --- a/osu.Game/Scoring/ScoreRank.cs +++ b/osu.Game/Scoring/ScoreRank.cs @@ -9,20 +9,28 @@ namespace osu.Game.Scoring { [Description(@"F")] F, + [Description(@"F")] D, + [Description(@"C")] C, + [Description(@"B")] B, + [Description(@"A")] A, + [Description(@"S")] S, + [Description(@"SPlus")] SH, + [Description(@"SS")] X, + [Description(@"SSPlus")] XH, } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 0306f69755..87a6b5d591 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -70,7 +70,8 @@ namespace osu.Game.Screens.Backgrounds { private readonly Skin skin; - public SkinnedBackground(Skin skin, string fallbackTextureName) : base(fallbackTextureName) + public SkinnedBackground(Skin skin, string fallbackTextureName) + : base(fallbackTextureName) { this.skin = skin; } diff --git a/osu.Game/Screens/Charts/ChartListing.cs b/osu.Game/Screens/Charts/ChartListing.cs index ea60dc4365..18bba6433f 100644 --- a/osu.Game/Screens/Charts/ChartListing.cs +++ b/osu.Game/Screens/Charts/ChartListing.cs @@ -8,8 +8,9 @@ namespace osu.Game.Screens.Charts { public class ChartListing : ScreenWhiteBox { - protected override IEnumerable PossibleChildren => new[] { - typeof(ChartInfo) + protected override IEnumerable PossibleChildren => new[] + { + typeof(ChartInfo) }; } } diff --git a/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs index ae2ac61c90..752615245e 100644 --- a/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs +++ b/osu.Game/Screens/Edit/Components/Menus/EditorMenuBar.cs @@ -175,6 +175,7 @@ namespace osu.Game.Screens.Edit.Components.Menus { if (Item is EditorMenuItemSpacer) return true; + return base.OnHover(e); } @@ -182,6 +183,7 @@ namespace osu.Game.Screens.Edit.Components.Menus { if (Item is EditorMenuItemSpacer) return true; + return base.OnClick(e); } } diff --git a/osu.Game/Screens/Edit/Components/PlaybackControl.cs b/osu.Game/Screens/Edit/Components/PlaybackControl.cs index 12d17f4f0f..227ad29000 100644 --- a/osu.Game/Screens/Edit/Components/PlaybackControl.cs +++ b/osu.Game/Screens/Edit/Components/PlaybackControl.cs @@ -114,7 +114,8 @@ namespace osu.Game.Screens.Edit.Components private readonly OsuSpriteText text; private readonly OsuSpriteText textBold; - public PlaybackTabItem(double value) : base(value) + public PlaybackTabItem(double value) + : base(value) { RelativeSizeAxes = Axes.Both; diff --git a/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs b/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs index c6ecdde7f6..f53bcefc4e 100644 --- a/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs +++ b/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs @@ -12,6 +12,7 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons public class RadioButtonCollection : CompositeDrawable { private IReadOnlyList items; + public IReadOnlyList Items { get { return items; } @@ -19,6 +20,7 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons { if (ReferenceEquals(items, value)) return; + items = value; buttonContainer.Clear(); @@ -42,6 +44,7 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons } private RadioButton currentlySelected; + private void addButton(RadioButton button) { button.Selected.ValueChanged += selected => diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs index 5bc70746bd..102955657e 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/ControlPointPart.cs @@ -26,12 +26,12 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts // Consider all non-timing points as the same type cpi.SamplePoints.Select(c => (ControlPoint)c) - .Concat(cpi.EffectPoints) - .Concat(cpi.DifficultyPoints) - .Distinct() - // Non-timing points should not be added where there are timing points - .Where(c => cpi.TimingPointAt(c.Time).Time != c.Time) - .ForEach(addNonTimingPoint); + .Concat(cpi.EffectPoints) + .Concat(cpi.DifficultyPoints) + .Distinct() + // Non-timing points should not be added where there are timing points + .Where(c => cpi.TimingPointAt(c.Time).Time != c.Time) + .ForEach(addNonTimingPoint); } private void addTimingPoint(ControlPoint controlPoint) => Add(new TimingPointVisualisation(controlPoint)); diff --git a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs index 3ac34e227b..07d307f293 100644 --- a/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs +++ b/osu.Game/Screens/Edit/Components/Timelines/Summary/Parts/MarkerPart.cs @@ -32,6 +32,7 @@ namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts protected override bool OnDragStart(DragStartEvent e) => true; protected override bool OnDragEnd(DragEndEvent e) => true; + protected override bool OnDrag(DragEvent e) { seekToPosition(e.ScreenSpaceMousePosition); diff --git a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs index e7a9d148bb..a1e62cd38b 100644 --- a/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/BlueprintContainer.cs @@ -68,6 +68,7 @@ namespace osu.Game.Screens.Edit.Compose.Components { if (currentTool == value) return; + currentTool = value; refreshTool(); @@ -188,6 +189,7 @@ namespace osu.Game.Screens.Edit.Compose.Components { if (!(x is SelectionBlueprint xBlueprint) || !(y is SelectionBlueprint yBlueprint)) return base.Compare(x, y); + return Compare(xBlueprint, yBlueprint); } diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs index 2060fe6694..1e94a20dc7 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/ZoomableScrollContainer.cs @@ -47,6 +47,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline { if (value < 1) throw new ArgumentException($"{nameof(MinZoom)} must be >= 1.", nameof(value)); + minZoom = value; if (Zoom < value) @@ -66,6 +67,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline { if (value < 1) throw new ArgumentException($"{nameof(MaxZoom)} must be >= 1.", nameof(value)); + maxZoom = value; if (Zoom > value) @@ -108,6 +110,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline } private float zoomTarget = 1; + private void setZoomTarget(float newZoom, float focusPoint) { zoomTarget = MathHelper.Clamp(newZoom, MinZoom, MaxZoom); diff --git a/osu.Game/Screens/Edit/EditorScreenMode.cs b/osu.Game/Screens/Edit/EditorScreenMode.cs index 12fd67ebfd..12cfcc605b 100644 --- a/osu.Game/Screens/Edit/EditorScreenMode.cs +++ b/osu.Game/Screens/Edit/EditorScreenMode.cs @@ -9,10 +9,13 @@ namespace osu.Game.Screens.Edit { [Description("setup")] SongSetup, + [Description("compose")] Compose, + [Description("design")] Design, + [Description("timing")] Timing, } diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 14124d283f..8c1cfdcda1 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -76,7 +76,7 @@ namespace osu.Game.Screens.Menu textFlow.NewParagraph(); textFlow.AddText("Visit ", format); - textFlow.AddLink("discord.gg/ppy", "https://discord.gg/ppy", creationParameters:format); + textFlow.AddLink("discord.gg/ppy", "https://discord.gg/ppy", creationParameters: format); textFlow.AddText(" to help out or follow progress!", format); textFlow.NewParagraph(); diff --git a/osu.Game/Screens/Menu/IntroSequence.cs b/osu.Game/Screens/Menu/IntroSequence.cs index 98640ef38c..093d01f12d 100644 --- a/osu.Game/Screens/Menu/IntroSequence.cs +++ b/osu.Game/Screens/Menu/IntroSequence.cs @@ -57,7 +57,7 @@ namespace osu.Game.Screens.Menu Anchor = Anchor.Centre, Origin = Anchor.Centre, AutoSizeAxes = Axes.Both, - Children = new [] + Children = new[] { lineTopLeft = new Box { diff --git a/osu.Game/Screens/Menu/LogoVisualisation.cs b/osu.Game/Screens/Menu/LogoVisualisation.cs index a45c80669c..e930f924be 100644 --- a/osu.Game/Screens/Menu/LogoVisualisation.cs +++ b/osu.Game/Screens/Menu/LogoVisualisation.cs @@ -156,7 +156,9 @@ namespace osu.Game.Screens.Menu { public Shader Shader; public Texture Texture; + public VisualiserSharedData Shared; + //Asuming the logo is a circle, we don't need a second dimension. public float Size; @@ -213,6 +215,7 @@ namespace osu.Game.Screens.Menu } } } + Shader.Unbind(); } } diff --git a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs index 101ff8bf94..e096fb33da 100644 --- a/osu.Game/Screens/Multi/Components/BeatmapTitle.cs +++ b/osu.Game/Screens/Multi/Components/BeatmapTitle.cs @@ -37,6 +37,7 @@ namespace osu.Game.Screens.Multi.Components { if (textSize == value) return; + textSize = value; updateText(); diff --git a/osu.Game/Screens/Multi/Components/DisableableTabControl.cs b/osu.Game/Screens/Multi/Components/DisableableTabControl.cs index 5bd002f8dc..b6b0332cf3 100644 --- a/osu.Game/Screens/Multi/Components/DisableableTabControl.cs +++ b/osu.Game/Screens/Multi/Components/DisableableTabControl.cs @@ -31,6 +31,7 @@ namespace osu.Game.Screens.Multi.Components { if (!Enabled.Value) return true; + return base.OnClick(e); } } diff --git a/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs index 14d66389ca..0adbcb670c 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs @@ -43,12 +43,14 @@ namespace osu.Game.Screens.Multi.Lounge.Components public readonly Room Room; private SelectionState state; + public SelectionState State { get { return state; } set { if (value == state) return; + state = value; if (state == SelectionState.Selected) @@ -63,6 +65,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components public IEnumerable FilterTerms => new[] { Room.Name.Value }; private bool matchingFilter; + public bool MatchingFilter { get { return matchingFilter; } diff --git a/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs b/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs index 87c4539756..8e14f76e4b 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/FilterControl.cs @@ -54,6 +54,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components public enum PrimaryFilter { Open, + [Description("Recently Ended")] RecentlyEnded, Participated, diff --git a/osu.Game/Screens/Multi/Match/Components/MatchTabControl.cs b/osu.Game/Screens/Multi/Match/Components/MatchTabControl.cs index 9e04bb6f60..c700d7b88a 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchTabControl.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchTabControl.cs @@ -58,6 +58,7 @@ namespace osu.Game.Screens.Multi.Match.Components { if (!enabled.Value) return true; + return base.OnClick(e); } } diff --git a/osu.Game/Screens/Multi/Match/Components/RoomAvailabilityPicker.cs b/osu.Game/Screens/Multi/Match/Components/RoomAvailabilityPicker.cs index e9dbd6982d..8751e27552 100644 --- a/osu.Game/Screens/Multi/Match/Components/RoomAvailabilityPicker.cs +++ b/osu.Game/Screens/Multi/Match/Components/RoomAvailabilityPicker.cs @@ -39,7 +39,8 @@ namespace osu.Game.Screens.Multi.Match.Components private readonly Box hover, selection; - public RoomAvailabilityPickerItem(RoomAvailability value) : base(value) + public RoomAvailabilityPickerItem(RoomAvailability value) + : base(value) { RelativeSizeAxes = Axes.Y; Width = 102; diff --git a/osu.Game/Screens/Play/Break/BreakInfoLine.cs b/osu.Game/Screens/Play/Break/BreakInfoLine.cs index 4c5e228fa5..4b07405812 100644 --- a/osu.Game/Screens/Play/Break/BreakInfoLine.cs +++ b/osu.Game/Screens/Play/Break/BreakInfoLine.cs @@ -72,7 +72,8 @@ namespace osu.Game.Screens.Play.Break public class PercentageBreakInfoLine : BreakInfoLine { - public PercentageBreakInfoLine(string name, string prefix = "") : base(name, prefix) + public PercentageBreakInfoLine(string name, string prefix = "") + : base(name, prefix) { } diff --git a/osu.Game/Screens/Play/HUD/ComboCounter.cs b/osu.Game/Screens/Play/HUD/ComboCounter.cs index eb9db9745f..b6dcfdd1e3 100644 --- a/osu.Game/Screens/Play/HUD/ComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboCounter.cs @@ -78,6 +78,7 @@ namespace osu.Game.Screens.Play.HUD } private int displayedCount; + /// /// Value shown at the current moment. /// @@ -88,11 +89,13 @@ namespace osu.Game.Screens.Play.HUD { if (displayedCount.Equals(value)) return; + updateDisplayedCount(displayedCount, value, IsRolling); } } private float textSize; + public float TextSize { get { return textSize; } diff --git a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs index 863fee2257..d3dba88281 100644 --- a/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs +++ b/osu.Game/Screens/Play/HUD/PlayerSettingsOverlay.cs @@ -17,6 +17,7 @@ namespace osu.Game.Screens.Play.HUD public bool ReplayLoaded; public readonly PlaybackSettings PlaybackSettings; + public readonly VisualSettings VisualSettings; //public readonly CollectionSettings CollectionSettings; //public readonly DiscussionSettings DiscussionSettings; diff --git a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs index f961e6b227..3bee92198a 100644 --- a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs @@ -49,6 +49,7 @@ namespace osu.Game.Screens.Play.HUD } private Color4 glowColour; + public Color4 GlowColour { get { return glowColour; } @@ -56,6 +57,7 @@ namespace osu.Game.Screens.Play.HUD { if (glowColour == value) return; + glowColour = value; fill.EdgeEffect = new EdgeEffectParameters diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 406cd3810e..962d066545 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -27,6 +27,7 @@ namespace osu.Game.Screens.Play public bool IsCounting { get; set; } = true; private int countPresses; + public int CountPresses { get { return countPresses; } @@ -41,6 +42,7 @@ namespace osu.Game.Screens.Play } private bool isLit; + public bool IsLit { get { return isLit; } diff --git a/osu.Game/Screens/Play/KeyCounterAction.cs b/osu.Game/Screens/Play/KeyCounterAction.cs index 3a17379da9..8deac653ad 100644 --- a/osu.Game/Screens/Play/KeyCounterAction.cs +++ b/osu.Game/Screens/Play/KeyCounterAction.cs @@ -10,7 +10,8 @@ namespace osu.Game.Screens.Play { public T Action { get; } - public KeyCounterAction(T action) : base($"B{(int)(object)action + 1}") + public KeyCounterAction(T action) + : base($"B{(int)(object)action + 1}") { Action = action; } diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 71e8da06ba..e4ea1673c0 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -58,6 +58,7 @@ namespace osu.Game.Screens.Play } private bool isCounting = true; + public bool IsCounting { get { return isCounting; } @@ -72,6 +73,7 @@ namespace osu.Game.Screens.Play } private int fadeTime; + public int FadeTime { get { return fadeTime; } @@ -87,6 +89,7 @@ namespace osu.Game.Screens.Play } private Color4 keyDownTextColor = Color4.DarkGray; + public Color4 KeyDownTextColor { get { return keyDownTextColor; } @@ -102,6 +105,7 @@ namespace osu.Game.Screens.Play } private Color4 keyUpTextColor = Color4.White; + public Color4 KeyUpTextColor { get { return keyUpTextColor; } @@ -161,6 +165,7 @@ namespace osu.Game.Screens.Play case MouseUpEvent _: return Target.Children.Any(c => c.TriggerEvent(e)); } + return base.Handle(e); } } diff --git a/osu.Game/Screens/Play/KeyCounterKeyboard.cs b/osu.Game/Screens/Play/KeyCounterKeyboard.cs index 9e8d5b9d39..d9b6dca79d 100644 --- a/osu.Game/Screens/Play/KeyCounterKeyboard.cs +++ b/osu.Game/Screens/Play/KeyCounterKeyboard.cs @@ -9,7 +9,9 @@ namespace osu.Game.Screens.Play public class KeyCounterKeyboard : KeyCounter { public Key Key { get; } - public KeyCounterKeyboard(Key key) : base(key.ToString()) + + public KeyCounterKeyboard(Key key) + : base(key.ToString()) { Key = key; } diff --git a/osu.Game/Screens/Play/KeyCounterMouse.cs b/osu.Game/Screens/Play/KeyCounterMouse.cs index 0fe667b403..13dbe40a8b 100644 --- a/osu.Game/Screens/Play/KeyCounterMouse.cs +++ b/osu.Game/Screens/Play/KeyCounterMouse.cs @@ -11,7 +11,8 @@ namespace osu.Game.Screens.Play { public MouseButton Button { get; } - public KeyCounterMouse(MouseButton button) : base(getStringRepresentation(button)) + public KeyCounterMouse(MouseButton button) + : base(getStringRepresentation(button)) { Button = button; } diff --git a/osu.Game/Screens/Play/PauseContainer.cs b/osu.Game/Screens/Play/PauseContainer.cs index 0222cefdd3..a851163dee 100644 --- a/osu.Game/Screens/Play/PauseContainer.cs +++ b/osu.Game/Screens/Play/PauseContainer.cs @@ -32,7 +32,10 @@ namespace osu.Game.Screens.Play protected override Container Content => content; - public int Retries { set { pauseOverlay.Retries = value; } } + public int Retries + { + set { pauseOverlay.Retries = value; } + } public bool CanPause => (CheckCanPause?.Invoke() ?? true) && Time.Current >= lastPauseActionTime + pause_cooldown; public bool IsResuming { get; private set; } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 9198d1a646..d2f75a0ce1 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -261,6 +261,7 @@ namespace osu.Game.Screens.Play private void performUserRequestedExit() { if (!this.IsCurrentScreen()) return; + this.Exit(); } @@ -296,7 +297,7 @@ namespace osu.Game.Screens.Play if (RulesetContainer.ReplayScore == null) scoreManager.Import(score, true); - this.Push(CreateResults(score)); + this.Push(CreateResults(score)); onCompletionEvent = null; }); diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index 49bcf0b8dc..634e68aa14 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -38,6 +38,7 @@ namespace osu.Game.Screens.Play.PlayerSettings set { if (expanded == value) return; + expanded = value; content.ClearTransforms(); diff --git a/osu.Game/Screens/Play/SongProgressInfo.cs b/osu.Game/Screens/Play/SongProgressInfo.cs index d24e484001..3a3f9c1e32 100644 --- a/osu.Game/Screens/Play/SongProgressInfo.cs +++ b/osu.Game/Screens/Play/SongProgressInfo.cs @@ -29,8 +29,15 @@ namespace osu.Game.Screens.Play public IClock AudioClock; - public double StartTime { set { startTime = value; } } - public double EndTime { set { endTime = value; } } + public double StartTime + { + set { startTime = value; } + } + + public double EndTime + { + set { endTime = value; } + } [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Screens/ScreenWhiteBox.cs b/osu.Game/Screens/ScreenWhiteBox.cs index c8ca21d4ba..b222b91221 100644 --- a/osu.Game/Screens/ScreenWhiteBox.cs +++ b/osu.Game/Screens/ScreenWhiteBox.cs @@ -169,10 +169,7 @@ namespace osu.Game.Screens Text = $@"{t.Name}", BackgroundColour = getColourFor(t), HoverColour = getColourFor(t).Lighten(0.2f), - Action = delegate - { - this.Push(Activator.CreateInstance(t) as Screen); - } + Action = delegate { this.Push(Activator.CreateInstance(t) as Screen); } }); } } diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 4490818a23..389f614ef2 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -254,6 +254,7 @@ namespace osu.Game.Screens.Select { case CarouselBeatmap beatmap: if (skipDifficulties) continue; + select(beatmap); return; case CarouselBeatmapSet set: @@ -327,6 +328,7 @@ namespace osu.Game.Screens.Select private void select(CarouselItem item) { if (item == null) return; + item.State.Value = CarouselItemState.Selected; } diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 03e94c86b6..f6d678eb2c 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -20,12 +20,10 @@ namespace osu.Game.Screens.Select public readonly BeatmapLeaderboard Leaderboard; private WorkingBeatmap beatmap; + public WorkingBeatmap Beatmap { - get - { - return beatmap; - } + get { return beatmap; } set { beatmap = value; diff --git a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs index edb9d79ddb..5d8f4f0ec6 100644 --- a/osu.Game/Screens/Select/Carousel/CarouselGroup.cs +++ b/osu.Game/Screens/Select/Carousel/CarouselGroup.cs @@ -96,6 +96,7 @@ namespace osu.Game.Screens.Select.Carousel foreach (var b in InternalChildren) { if (item == b) continue; + b.State.Value = CarouselItemState.NotSelected; } diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs index 00fce20ac3..38ca9a9aed 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmap.cs @@ -38,7 +38,8 @@ namespace osu.Game.Screens.Select.Carousel private BeatmapSetOverlay beatmapOverlay; - public DrawableCarouselBeatmap(CarouselBeatmap panel) : base(panel) + public DrawableCarouselBeatmap(CarouselBeatmap panel) + : base(panel) { beatmap = panel.Beatmap; Height *= 0.60f; diff --git a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs index 540d74a8d3..e01149ebc8 100644 --- a/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs +++ b/osu.Game/Screens/Select/Carousel/DrawableCarouselBeatmapSet.cs @@ -49,11 +49,11 @@ namespace osu.Game.Screens.Select.Carousel Children = new Drawable[] { new DelayedLoadUnloadWrapper(() => - new PanelBackground(manager.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault())) - { - RelativeSizeAxes = Axes.Both, - OnLoadComplete = d => d.FadeInFromZero(1000, Easing.OutQuint), - }, 300, 5000 + new PanelBackground(manager.GetWorkingBeatmap(beatmapSet.Beatmaps.FirstOrDefault())) + { + RelativeSizeAxes = Axes.Both, + OnLoadComplete = d => d.FadeInFromZero(1000, Easing.OutQuint), + }, 300, 5000 ), new FillFlowContainer { diff --git a/osu.Game/Screens/Select/Details/AdvancedStats.cs b/osu.Game/Screens/Select/Details/AdvancedStats.cs index 2d897148c1..456a5a9653 100644 --- a/osu.Game/Screens/Select/Details/AdvancedStats.cs +++ b/osu.Game/Screens/Select/Details/AdvancedStats.cs @@ -20,12 +20,14 @@ namespace osu.Game.Screens.Select.Details private readonly StatisticRow firstValue, hpDrain, accuracy, approachRate, starDifficulty; private BeatmapInfo beatmap; + public BeatmapInfo Beatmap { get { return beatmap; } set { if (value == beatmap) return; + beatmap = value; //mania specific @@ -88,6 +90,7 @@ namespace osu.Game.Screens.Select.Details } private float difficultyValue; + public float Value { get { return difficultyValue; } diff --git a/osu.Game/Screens/Select/Details/FailRetryGraph.cs b/osu.Game/Screens/Select/Details/FailRetryGraph.cs index 32067a69a0..41099854ec 100644 --- a/osu.Game/Screens/Select/Details/FailRetryGraph.cs +++ b/osu.Game/Screens/Select/Details/FailRetryGraph.cs @@ -17,12 +17,14 @@ namespace osu.Game.Screens.Select.Details private readonly BarGraph retryGraph, failGraph; private BeatmapMetrics metrics; + public BeatmapMetrics Metrics { get { return metrics; } set { if (value == metrics) return; + metrics = value; var retries = Metrics?.Retries ?? new int[0]; diff --git a/osu.Game/Screens/Select/Details/UserRatings.cs b/osu.Game/Screens/Select/Details/UserRatings.cs index db796ba5d2..d74e4eac97 100644 --- a/osu.Game/Screens/Select/Details/UserRatings.cs +++ b/osu.Game/Screens/Select/Details/UserRatings.cs @@ -28,6 +28,7 @@ namespace osu.Game.Screens.Select.Details set { if (value == metrics) return; + metrics = value; const int rating_range = 10; diff --git a/osu.Game/Screens/Select/Filter/GroupMode.cs b/osu.Game/Screens/Select/Filter/GroupMode.cs index 6abb32bbac..d794c215a3 100644 --- a/osu.Game/Screens/Select/Filter/GroupMode.cs +++ b/osu.Game/Screens/Select/Filter/GroupMode.cs @@ -9,32 +9,46 @@ namespace osu.Game.Screens.Select.Filter { [Description("All")] All, + [Description("Artist")] Artist, + [Description("Author")] Author, + [Description("BPM")] BPM, + [Description("Collections")] Collections, + [Description("Date Added")] DateAdded, + [Description("Difficulty")] Difficulty, + [Description("Favourites")] Favourites, + [Description("Length")] Length, + [Description("My Maps")] MyMaps, + [Description("No Grouping")] NoGrouping, + [Description("Rank Achieved")] RankAchieved, + [Description("Ranked Status")] RankedStatus, + [Description("Recently Played")] RecentlyPlayed, + [Description("Title")] Title } diff --git a/osu.Game/Screens/Select/Filter/SortMode.cs b/osu.Game/Screens/Select/Filter/SortMode.cs index 92ae177011..be76fbc3ba 100644 --- a/osu.Game/Screens/Select/Filter/SortMode.cs +++ b/osu.Game/Screens/Select/Filter/SortMode.cs @@ -9,18 +9,25 @@ namespace osu.Game.Screens.Select.Filter { [Description("Artist")] Artist, + [Description("Author")] Author, + [Description("BPM")] BPM, + [Description("Date Added")] DateAdded, + [Description("Difficulty")] Difficulty, + [Description("Length")] Length, + [Description("Rank Achieved")] RankAchieved, + [Description("Title")] Title } diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index aa8b48588a..807cd7e5ca 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -29,6 +29,7 @@ namespace osu.Game.Screens.Select } private Color4 deselectedColour; + public Color4 DeselectedColour { get { return deselectedColour; } @@ -41,6 +42,7 @@ namespace osu.Game.Screens.Select } private Color4 selectedColour; + public Color4 SelectedColour { get { return selectedColour; } diff --git a/osu.Game/Screens/Select/PlaySongSelect.cs b/osu.Game/Screens/Select/PlaySongSelect.cs index b5e9cd5f41..d06436c92e 100644 --- a/osu.Game/Screens/Select/PlaySongSelect.cs +++ b/osu.Game/Screens/Select/PlaySongSelect.cs @@ -65,7 +65,7 @@ namespace osu.Game.Screens.Select LoadComponentAsync(player = new PlayerLoader(() => new Player()), l => { - if (this.IsCurrentScreen())this.Push(player); + if (this.IsCurrentScreen()) this.Push(player); }); return true; diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index da2fc7fb5b..a6397622ca 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -84,6 +84,7 @@ namespace osu.Game.Screens.Tournament } private ScrollState _scrollState; + private ScrollState scrollState { get { return _scrollState; } @@ -326,6 +327,7 @@ namespace osu.Game.Screens.Tournament private readonly Box outline; private bool selected; + public bool Selected { get { return selected; } diff --git a/osu.Game/Skinning/LegacySkin.cs b/osu.Game/Skinning/LegacySkin.cs index 5dfefcb777..358b2b222b 100644 --- a/osu.Game/Skinning/LegacySkin.cs +++ b/osu.Game/Skinning/LegacySkin.cs @@ -28,7 +28,8 @@ namespace osu.Game.Skinning { } - protected LegacySkin(SkinInfo skin, IResourceStore storage, AudioManager audioManager, string filename) : base(skin) + protected LegacySkin(SkinInfo skin, IResourceStore storage, AudioManager audioManager, string filename) + : base(skin) { Stream stream = storage.GetStream(filename); if (stream != null) diff --git a/osu.Game/Skinning/Skin.cs b/osu.Game/Skinning/Skin.cs index de0374f29a..1d14f9cd6a 100644 --- a/osu.Game/Skinning/Skin.cs +++ b/osu.Game/Skinning/Skin.cs @@ -49,6 +49,7 @@ namespace osu.Game.Skinning { if (isDisposed) return; + isDisposed = true; } diff --git a/osu.Game/Skinning/SkinnableSpriteText.cs b/osu.Game/Skinning/SkinnableSpriteText.cs index b380b74e3d..36e646d743 100644 --- a/osu.Game/Skinning/SkinnableSpriteText.cs +++ b/osu.Game/Skinning/SkinnableSpriteText.cs @@ -30,6 +30,7 @@ namespace osu.Game.Skinning { if (text == value) return; + text = value; if (Drawable is IHasText textDrawable) diff --git a/osu.Game/Storyboards/CommandTimeline.cs b/osu.Game/Storyboards/CommandTimeline.cs index 40e4848874..aa1f137cf3 100644 --- a/osu.Game/Storyboards/CommandTimeline.cs +++ b/osu.Game/Storyboards/CommandTimeline.cs @@ -52,6 +52,7 @@ namespace osu.Game.Storyboards { var result = StartTime.CompareTo(other.StartTime); if (result != 0) return result; + return EndTime.CompareTo(other.EndTime); } diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs index c92fe9812e..af71518e6f 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs @@ -20,12 +20,14 @@ namespace osu.Game.Storyboards.Drawables protected override Vector2 DrawScale => new Vector2(Parent.DrawHeight / 480); private bool passing = true; + public bool Passing { get { return passing; } set { if (passing == value) return; + passing = value; updateLayerVisibility(); } @@ -34,6 +36,7 @@ namespace osu.Game.Storyboards.Drawables public override bool RemoveCompletedTransforms => false; private DependencyContainer dependencies; + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs index 02691da9a9..0b9ebaf3a7 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboardAnimation.cs @@ -78,6 +78,7 @@ namespace osu.Game.Storyboards.Drawables var texture = textureStore.Get(path); AddFrame(texture, Animation.FrameDelay); } + Animation.ApplyTransforms(this); } } diff --git a/osu.Game/Storyboards/Storyboard.cs b/osu.Game/Storyboards/Storyboard.cs index 4128b342c9..0cc753ff7e 100644 --- a/osu.Game/Storyboards/Storyboard.cs +++ b/osu.Game/Storyboards/Storyboard.cs @@ -76,6 +76,7 @@ namespace osu.Game.Storyboards { if (isDisposed) return; + isDisposed = true; } diff --git a/osu.Game/Storyboards/StoryboardSprite.cs b/osu.Game/Storyboards/StoryboardSprite.cs index 3b9ea27e4e..d234d7ace2 100644 --- a/osu.Game/Storyboards/StoryboardSprite.cs +++ b/osu.Game/Storyboards/StoryboardSprite.cs @@ -34,6 +34,7 @@ namespace osu.Game.Storyboards public bool HasCommands => TimelineGroup.HasCommands || loops.Any(l => l.HasCommands); private delegate void DrawablePropertyInitializer(Drawable drawable, T value); + private delegate void DrawableTransformer(Drawable drawable, T value, double duration, Easing easing); public StoryboardSprite(string path, Anchor origin, Vector2 initialPosition) @@ -90,6 +91,7 @@ namespace osu.Game.Storyboards initializeProperty.Invoke(drawable, command.StartValue); initialized = true; } + using (drawable.BeginAbsoluteSequence(command.StartTime)) { transform(drawable, command.StartValue, 0, Easing.None); diff --git a/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs b/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs index be8dff2296..44ac38044d 100644 --- a/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs +++ b/osu.Game/Tests/Beatmaps/BeatmapConversionTest.cs @@ -39,6 +39,7 @@ namespace osu.Game.Tests.Beatmaps { if (mappingCounter >= ourResult.Mappings.Count && mappingCounter >= expectedResult.Mappings.Count) break; + if (mappingCounter >= ourResult.Mappings.Count) Assert.Fail($"A conversion did not generate any hitobjects, but should have, for hitobject at time: {expectedResult.Mappings[mappingCounter].StartTime}\n"); else if (mappingCounter >= expectedResult.Mappings.Count) @@ -64,6 +65,7 @@ namespace osu.Game.Tests.Beatmaps { if (objectCounter >= ourMapping.Objects.Count && objectCounter >= expectedMapping.Objects.Count) break; + if (objectCounter >= ourMapping.Objects.Count) Assert.Fail($"The conversion did not generate a hitobject, but should have, for hitobject at time: {expectedMapping.StartTime}:\n" + $"Expected: {JsonConvert.SerializeObject(expectedMapping.Objects[objectCounter])}\n"); @@ -189,7 +191,10 @@ namespace osu.Game.Tests.Beatmaps public List Objects = new List(); [JsonProperty("Objects")] - private List setObjects { set => Objects = value; } + private List setObjects + { + set => Objects = value; + } public virtual bool Equals(ConvertMapping other) => StartTime.Equals(other?.StartTime); } diff --git a/osu.Game/Tests/Beatmaps/TestBeatmap.cs b/osu.Game/Tests/Beatmaps/TestBeatmap.cs index c7b24ac83a..d1263984ac 100644 --- a/osu.Game/Tests/Beatmaps/TestBeatmap.cs +++ b/osu.Game/Tests/Beatmaps/TestBeatmap.cs @@ -30,8 +30,7 @@ namespace osu.Game.Tests.Beatmaps return Decoder.GetDecoder(reader).Decode(reader); } - private const string test_beatmap_data = -@"osu file format v14 + private const string test_beatmap_data = @"osu file format v14 [General] AudioLeadIn: 500 diff --git a/osu.Game/Tests/Visual/ScrollingTestContainer.cs b/osu.Game/Tests/Visual/ScrollingTestContainer.cs index 19d1e18939..f2e03208fd 100644 --- a/osu.Game/Tests/Visual/ScrollingTestContainer.cs +++ b/osu.Game/Tests/Visual/ScrollingTestContainer.cs @@ -20,9 +20,15 @@ namespace osu.Game.Tests.Visual { public SortedList ControlPoints => scrollingInfo.Algorithm.ControlPoints; - public ScrollVisualisationMethod ScrollAlgorithm { set => scrollingInfo.Algorithm.Algorithm = value; } + public ScrollVisualisationMethod ScrollAlgorithm + { + set => scrollingInfo.Algorithm.Algorithm = value; + } - public double TimeRange { set => scrollingInfo.TimeRange.Value = value; } + public double TimeRange + { + set => scrollingInfo.TimeRange.Value = value; + } public IScrollingInfo ScrollingInfo => scrollingInfo; diff --git a/osu.Game/Users/Avatar.cs b/osu.Game/Users/Avatar.cs index fb586d6f58..3df5957ff9 100644 --- a/osu.Game/Users/Avatar.cs +++ b/osu.Game/Users/Avatar.cs @@ -80,6 +80,7 @@ namespace osu.Game.Users { if (!Enabled.Value) return false; + return base.OnClick(e); } } diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index e17afbc77f..2b584cd6ae 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.cs @@ -33,6 +33,7 @@ namespace osu.Game.Users private TextureStore textures; private Country country; + public Country Country { get { return country; } diff --git a/osu.Game/Users/UserStatistics.cs b/osu.Game/Users/UserStatistics.cs index 40f9f06cde..2de54ed8be 100644 --- a/osu.Game/Users/UserStatistics.cs +++ b/osu.Game/Users/UserStatistics.cs @@ -23,7 +23,10 @@ namespace osu.Game.Users public decimal? PP; [JsonProperty(@"pp_rank")] // the API sometimes only returns this value in condensed user responses - private int rank { set => Ranks.Global = value; } + private int rank + { + set => Ranks.Global = value; + } [JsonProperty(@"rank")] public UserRanks Ranks; diff --git a/osu.Game/Users/UserStatus.cs b/osu.Game/Users/UserStatus.cs index 1c34303896..14b4538a00 100644 --- a/osu.Game/Users/UserStatus.cs +++ b/osu.Game/Users/UserStatus.cs @@ -39,7 +39,7 @@ namespace osu.Game.Users public override string Message => @"in Multiplayer Lobby"; } - public class UserStatusSoloGame : UserStatusBusy + public class UserStatusSoloGame : UserStatusBusy { public override string Message => @"Solo Game"; } From 42be7857d1cbd30c7cccee384163004479174070 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Feb 2019 13:58:19 +0900 Subject: [PATCH 268/327] Use expression body for property get/set where possible --- .../Objects/Drawable/DrawableDroplet.cs | 2 +- .../Objects/Drawable/Pieces/Pulp.cs | 2 +- osu.Game.Rulesets.Catch/UI/CatcherArea.cs | 6 ++-- .../Objects/Drawables/DrawableHoldNote.cs | 2 +- .../Objects/Drawables/DrawableHoldNoteTick.cs | 2 +- .../Objects/Drawables/DrawableNote.cs | 2 +- .../Objects/Drawables/Pieces/BodyPiece.cs | 4 +-- .../Objects/Drawables/Pieces/GlowPiece.cs | 2 +- .../Objects/Drawables/Pieces/LaneGlowPiece.cs | 4 +-- .../Objects/Drawables/Pieces/NotePiece.cs | 2 +- osu.Game.Rulesets.Mania/Objects/HoldNote.cs | 6 ++-- osu.Game.Rulesets.Mania/UI/Column.cs | 4 +-- .../Connections/FollowPointRenderer.cs | 6 ++-- .../Objects/Drawables/DrawableHitCircle.cs | 2 +- .../Objects/Drawables/DrawableSlider.cs | 2 +- .../Objects/Drawables/Pieces/NumberPiece.cs | 4 +-- .../Objects/Drawables/Pieces/SliderBall.cs | 4 +-- .../Drawables/Pieces/SpinnerBackground.cs | 5 +--- .../Objects/Drawables/Pieces/SpinnerDisc.cs | 8 ++--- .../Drawables/Pieces/SpinnerSpmCounter.cs | 2 +- .../Objects/Drawables/Pieces/CirclePiece.cs | 4 +-- .../Objects/Drawables/Pieces/TaikoPiece.cs | 11 +++---- .../Objects/Drawables/Pieces/TickPiece.cs | 2 +- .../Visual/TestCaseBeatSyncedContainer.cs | 2 +- osu.Game/Beatmaps/BeatmapMetadata.cs | 4 +-- .../Drawables/UpdateableBeatmapSetCover.cs | 4 +-- osu.Game/Graphics/Backgrounds/Triangles.cs | 2 +- .../Containers/ConstrainedIconContainer.cs | 14 +++------ .../Graphics/Containers/SectionsContainer.cs | 8 ++--- osu.Game/Graphics/SpriteIcon.cs | 7 ++--- osu.Game/Graphics/UserInterface/Bar.cs | 30 ++++--------------- osu.Game/Graphics/UserInterface/BarGraph.cs | 5 +--- .../UserInterface/BreadcrumbControl.cs | 2 +- .../Graphics/UserInterface/DialogButton.cs | 15 ++-------- osu.Game/Graphics/UserInterface/IconButton.cs | 14 ++++----- osu.Game/Graphics/UserInterface/LineGraph.cs | 2 +- osu.Game/Graphics/UserInterface/Nub.cs | 13 ++++---- .../Graphics/UserInterface/OsuCheckbox.cs | 4 +-- .../Graphics/UserInterface/OsuDropdown.cs | 16 +++++----- osu.Game/Graphics/UserInterface/OsuMenu.cs | 2 +- .../Graphics/UserInterface/OsuSliderBar.cs | 2 +- .../Graphics/UserInterface/OsuTabControl.cs | 9 ++---- .../UserInterface/OsuTabControlCheckbox.cs | 6 ++-- .../Graphics/UserInterface/ProgressBar.cs | 6 ++-- .../Graphics/UserInterface/RollingCounter.cs | 9 ++---- .../Graphics/UserInterface/StarCounter.cs | 5 +--- .../Graphics/UserInterface/TriangleButton.cs | 5 +--- .../Graphics/UserInterface/TwoLayerButton.cs | 17 +++-------- .../Input/Bindings/DatabasedKeyBinding.cs | 8 ++--- osu.Game/Online/API/APIAccess.cs | 2 +- osu.Game/Online/API/OAuthToken.cs | 10 ++----- osu.Game/Online/Leaderboards/Leaderboard.cs | 6 ++-- osu.Game/Overlays/BeatmapSet/AuthorInfo.cs | 2 +- osu.Game/Overlays/BeatmapSet/BasicStats.cs | 8 ++--- osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs | 6 ++-- .../BeatmapSet/Buttons/PreviewButton.cs | 4 +-- osu.Game/Overlays/BeatmapSet/Details.cs | 4 +-- osu.Game/Overlays/BeatmapSet/Info.cs | 10 +++---- .../BeatmapSet/Scores/ClickableUsername.cs | 2 +- .../BeatmapSet/Scores/DrawableTopScore.cs | 4 +-- .../BeatmapSet/Scores/ScoresContainer.cs | 2 +- osu.Game/Overlays/BeatmapSet/SuccessRate.cs | 2 +- .../Chat/Selection/ChannelListItem.cs | 5 +--- .../Overlays/Chat/Selection/ChannelSection.cs | 11 +++---- osu.Game/Overlays/Direct/DirectPanel.cs | 2 +- osu.Game/Overlays/Direct/PlayButton.cs | 2 +- osu.Game/Overlays/DirectOverlay.cs | 4 +-- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 4 +-- .../Overlays/MedalSplash/DrawableMedal.cs | 2 +- osu.Game/Overlays/Mods/ModButton.cs | 4 +-- osu.Game/Overlays/Music/PlaylistItem.cs | 4 +-- osu.Game/Overlays/Music/PlaylistList.cs | 8 ++--- .../Overlays/Notifications/Notification.cs | 2 +- .../Notifications/NotificationSection.cs | 8 ++--- .../Notifications/ProgressNotification.cs | 19 +++++------- .../Notifications/SimpleNotification.cs | 9 ++---- osu.Game/Overlays/Profile/ProfileHeader.cs | 2 +- .../Profile/Sections/Kudosu/KudosuInfo.cs | 2 +- .../Sections/General/LoginSettings.cs | 4 +-- .../Overlays/Settings/SettingsCheckbox.cs | 4 +-- osu.Game/Overlays/Settings/SettingsItem.cs | 12 +++----- osu.Game/Overlays/Settings/SettingsSection.cs | 2 +- .../Overlays/Settings/SettingsSubsection.cs | 5 +--- osu.Game/Overlays/Settings/Sidebar.cs | 2 +- osu.Game/Overlays/Settings/SidebarButton.cs | 7 ++--- osu.Game/Overlays/SocialOverlay.cs | 2 +- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 23 +++++--------- .../Toolbar/ToolbarNotificationButton.cs | 2 +- .../Toolbar/ToolbarOverlayToggleButton.cs | 2 +- .../Overlays/Toolbar/ToolbarRulesetButton.cs | 2 +- osu.Game/Rulesets/UI/ModIcon.cs | 6 ++-- .../Backgrounds/BackgroundScreenBeatmap.cs | 2 +- osu.Game/Screens/Edit/BindableBeatDivisor.cs | 2 +- .../RadioButtons/RadioButtonCollection.cs | 2 +- .../Components/Timeline/TimelineButton.cs | 4 +-- osu.Game/Screens/Menu/Button.cs | 2 +- osu.Game/Screens/Menu/ButtonSystem.cs | 2 +- osu.Game/Screens/Menu/OsuLogo.cs | 6 ++-- .../Multi/Lounge/Components/DrawableRoom.cs | 4 +-- osu.Game/Screens/Play/Break/BlurredIcon.cs | 6 ++-- osu.Game/Screens/Play/Break/GlowIcon.cs | 10 +++---- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 2 +- osu.Game/Screens/Play/HUD/ComboCounter.cs | 4 +-- .../Screens/Play/HUD/StandardHealthDisplay.cs | 6 ++-- osu.Game/Screens/Play/KeyCounter.cs | 4 +-- osu.Game/Screens/Play/KeyCounterCollection.cs | 8 ++--- osu.Game/Screens/Play/PauseContainer.cs | 2 +- .../PlayerSettings/PlayerSettingsGroup.cs | 2 +- osu.Game/Screens/Play/SkipOverlay.cs | 2 +- osu.Game/Screens/Play/SongProgress.cs | 7 ++--- osu.Game/Screens/Play/SongProgressBar.cs | 8 ++--- osu.Game/Screens/Play/SongProgressInfo.cs | 4 +-- osu.Game/Screens/Play/SquareGraph.cs | 10 +++---- osu.Game/Screens/Select/BeatmapDetailArea.cs | 5 +--- osu.Game/Screens/Select/BeatmapDetails.cs | 2 +- .../Screens/Select/Details/AdvancedStats.cs | 12 ++++---- .../Screens/Select/Details/FailRetryGraph.cs | 2 +- .../Screens/Select/Details/UserRatings.cs | 2 +- osu.Game/Screens/Select/FilterControl.cs | 4 +-- osu.Game/Screens/Select/FilterCriteria.cs | 2 +- osu.Game/Screens/Select/FooterButton.cs | 6 ++-- .../Select/Leaderboards/BeatmapLeaderboard.cs | 2 +- .../Select/Options/BeatmapOptionsButton.cs | 16 +++++----- .../Components/VisualiserContainer.cs | 2 +- .../Tournament/ScrollingTeamContainer.cs | 4 +-- .../Drawables/DrawableStoryboard.cs | 2 +- osu.Game/Users/Country.cs | 2 +- osu.Game/Users/UpdateableAvatar.cs | 2 +- osu.Game/Users/User.cs | 4 +-- osu.sln.DotSettings | 10 ++++++- 130 files changed, 297 insertions(+), 403 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs index c80dacde93..8fed8eb4cd 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/DrawableDroplet.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable public override Color4 AccentColour { - get { return base.AccentColour; } + get => base.AccentColour; set { base.AccentColour = value; diff --git a/osu.Game.Rulesets.Catch/Objects/Drawable/Pieces/Pulp.cs b/osu.Game.Rulesets.Catch/Objects/Drawable/Pieces/Pulp.cs index d5adbee8aa..e150869132 100644 --- a/osu.Game.Rulesets.Catch/Objects/Drawable/Pieces/Pulp.cs +++ b/osu.Game.Rulesets.Catch/Objects/Drawable/Pieces/Pulp.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Catch.Objects.Drawable.Pieces private Color4 accentColour; public Color4 AccentColour { - get { return accentColour; } + get => accentColour; set { accentColour = value; diff --git a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs index 438bfaef55..d0f50c6af2 100644 --- a/osu.Game.Rulesets.Catch/UI/CatcherArea.cs +++ b/osu.Game.Rulesets.Catch/UI/CatcherArea.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Catch.UI public Container ExplodingFruitTarget { - set { MovableCatcher.ExplodingFruitTarget = value; } + set => MovableCatcher.ExplodingFruitTarget = value; } public CatcherArea(BeatmapDifficulty difficulty = null) @@ -158,7 +158,7 @@ namespace osu.Game.Rulesets.Catch.UI protected bool Dashing { - get { return dashing; } + get => dashing; set { if (value == dashing) return; @@ -176,7 +176,7 @@ namespace osu.Game.Rulesets.Catch.UI /// protected bool Trail { - get { return trail; } + get => trail; set { if (value == trail) return; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs index 777c0ae566..4bfd940aa0 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNote.cs @@ -85,7 +85,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables public override Color4 AccentColour { - get { return base.AccentColour; } + get => base.AccentColour; set { base.AccentColour = value; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs index eb7d153a90..43aac7907f 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableHoldNoteTick.cs @@ -56,7 +56,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables public override Color4 AccentColour { - get { return base.AccentColour; } + get => base.AccentColour; set { base.AccentColour = value; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs index c80681ea23..7ef90cdb9c 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/DrawableNote.cs @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables public override Color4 AccentColour { - get { return base.AccentColour; } + get => base.AccentColour; set { base.AccentColour = value; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs index 3decd46888..2858ae8c5b 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/BodyPiece.cs @@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces public Color4 AccentColour { - get { return accentColour; } + get => accentColour; set { if (accentColour == value) @@ -90,7 +90,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces public bool Hitting { - get { return hitting; } + get => hitting; set { hitting = value; diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs index 4a54ac0aac..175a33d5b8 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/GlowPiece.cs @@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces private Color4 accentColour; public Color4 AccentColour { - get { return accentColour; } + get => accentColour; set { if (accentColour == value) diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/LaneGlowPiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/LaneGlowPiece.cs index 8927e0b068..9e0307c5c2 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/LaneGlowPiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/LaneGlowPiece.cs @@ -78,8 +78,8 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces public Color4 AccentColour { - get { return Colour; } - set { Colour = value; } + get => Colour; + set => Colour = value; } } } diff --git a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs index c5db6d7bd9..4d37b277b8 100644 --- a/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs +++ b/osu.Game.Rulesets.Mania/Objects/Drawables/Pieces/NotePiece.cs @@ -58,7 +58,7 @@ namespace osu.Game.Rulesets.Mania.Objects.Drawables.Pieces private Color4 accentColour; public Color4 AccentColour { - get { return accentColour; } + get => accentColour; set { if (accentColour == value) diff --git a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs index 8bb22fb586..6c2ac71ce3 100644 --- a/osu.Game.Rulesets.Mania/Objects/HoldNote.cs +++ b/osu.Game.Rulesets.Mania/Objects/HoldNote.cs @@ -19,7 +19,7 @@ namespace osu.Game.Rulesets.Mania.Objects private double duration; public double Duration { - get { return duration; } + get => duration; set { duration = value; @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Mania.Objects public override double StartTime { - get { return base.StartTime; } + get => base.StartTime; set { base.StartTime = value; @@ -40,7 +40,7 @@ namespace osu.Game.Rulesets.Mania.Objects public override int Column { - get { return base.Column; } + get => base.Column; set { base.Column = value; diff --git a/osu.Game.Rulesets.Mania/UI/Column.cs b/osu.Game.Rulesets.Mania/UI/Column.cs index 856ae8af33..2af99693eb 100644 --- a/osu.Game.Rulesets.Mania/UI/Column.cs +++ b/osu.Game.Rulesets.Mania/UI/Column.cs @@ -99,7 +99,7 @@ namespace osu.Game.Rulesets.Mania.UI private bool isSpecial; public bool IsSpecial { - get { return isSpecial; } + get => isSpecial; set { if (isSpecial == value) @@ -113,7 +113,7 @@ namespace osu.Game.Rulesets.Mania.UI private Color4 accentColour; public Color4 AccentColour { - get { return accentColour; } + get => accentColour; set { if (accentColour == value) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs index ec8573cb94..1462f0459e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Connections/FollowPointRenderer.cs @@ -17,7 +17,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections /// public int PointDistance { - get { return pointDistance; } + get => pointDistance; set { if (pointDistance == value) return; @@ -32,7 +32,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections /// public int PreEmpt { - get { return preEmpt; } + get => preEmpt; set { if (preEmpt == value) return; @@ -44,7 +44,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Connections private IEnumerable hitObjects; public override IEnumerable HitObjects { - get { return hitObjects; } + get => hitObjects; set { hitObjects = value; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs index d582113d25..decd0ce073 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableHitCircle.cs @@ -102,7 +102,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public override Color4 AccentColour { - get { return base.AccentColour; } + get => base.AccentColour; set { base.AccentColour = value; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index b55ec10d1d..6595e53a6a 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -115,7 +115,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables public override Color4 AccentColour { - get { return base.AccentColour; } + get => base.AccentColour; set { base.AccentColour = value; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs index 813cd51593..93ac8748dd 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/NumberPiece.cs @@ -18,8 +18,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces public string Text { - get { return number.Text; } - set { number.Text = value; } + get => number.Text; + set => number.Text = value; } public NumberPiece() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs index afa7f22140..cd69a050aa 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SliderBall.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces /// public Color4 AccentColour { - get { return accentColour; } + get => accentColour; set { accentColour = value; @@ -136,7 +136,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces public bool Tracking { - get { return tracking; } + get => tracking; private set { if (value == tracking) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs index 0d970f4c2c..c982f53c2b 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerBackground.cs @@ -15,10 +15,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces public Color4 AccentColour { - get - { - return Disc.Colour; - } + get => Disc.Colour; set { Disc.Colour = value; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs index 4206852b6c..18f9e85b33 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerDisc.cs @@ -17,8 +17,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces public Color4 AccentColour { - get { return background.AccentColour; } - set { background.AccentColour = value; } + get => background.AccentColour; + set => background.AccentColour = value; } private readonly SpinnerBackground background; @@ -45,7 +45,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces private bool tracking; public bool Tracking { - get { return tracking; } + get => tracking; set { if (value == tracking) return; @@ -58,7 +58,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces private bool complete; public bool Complete { - get { return complete; } + get => complete; set { if (value == complete) return; diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs index 19f85bf4c3..b1b365920c 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/Pieces/SpinnerSpmCounter.cs @@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces public double SpinsPerMinute { - get { return spm; } + get => spm; private set { if (value == spm) return; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs index 5369499dbc..53dbe5d08e 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/CirclePiece.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces /// public override Color4 AccentColour { - get { return base.AccentColour; } + get => base.AccentColour; set { base.AccentColour = value; @@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces /// public override bool KiaiMode { - get { return base.KiaiMode; } + get => base.KiaiMode; set { base.KiaiMode = value; diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs index dd6a1a5021..abc42dec83 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TaikoPiece.cs @@ -16,8 +16,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces /// public virtual Color4 AccentColour { - get { return accentColour; } - set { accentColour = value; } + get => accentColour; + set => accentColour = value; } private bool kiaiMode; @@ -26,11 +26,8 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces /// public virtual bool KiaiMode { - get { return kiaiMode; } - set - { - kiaiMode = value; - } + get => kiaiMode; + set => kiaiMode = value; } public TaikoPiece() diff --git a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs index d625047d29..d53cb14909 100644 --- a/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs +++ b/osu.Game.Rulesets.Taiko/Objects/Drawables/Pieces/TickPiece.cs @@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Taiko.Objects.Drawables.Pieces private bool filled; public bool Filled { - get { return filled; } + get => filled; set { filled = value; diff --git a/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs b/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs index 127ee9e482..92c1de6b9e 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs @@ -190,7 +190,7 @@ namespace osu.Game.Tests.Visual public double Value { - set { valueText.Text = $"{value:G}"; } + set => valueText.Text = $"{value:G}"; } public InfoString(string header) diff --git a/osu.Game/Beatmaps/BeatmapMetadata.cs b/osu.Game/Beatmaps/BeatmapMetadata.cs index bac8ad5ed7..91398dcd50 100644 --- a/osu.Game/Beatmaps/BeatmapMetadata.cs +++ b/osu.Game/Beatmaps/BeatmapMetadata.cs @@ -34,8 +34,8 @@ namespace osu.Game.Beatmaps [Column("Author")] public string AuthorString { - get { return Author?.Username; } - set { Author = new User { Username = value }; } + get => Author?.Username; + set => Author = new User { Username = value }; } /// diff --git a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs index 45df2b3406..dedd6764e5 100644 --- a/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs +++ b/osu.Game/Beatmaps/Drawables/UpdateableBeatmapSetCover.cs @@ -15,7 +15,7 @@ namespace osu.Game.Beatmaps.Drawables private BeatmapSetInfo beatmapSet; public BeatmapSetInfo BeatmapSet { - get { return beatmapSet; } + get => beatmapSet; set { if (value == beatmapSet) return; @@ -29,7 +29,7 @@ namespace osu.Game.Beatmaps.Drawables private BeatmapSetCoverType coverType = BeatmapSetCoverType.Cover; public BeatmapSetCoverType CoverType { - get { return coverType; } + get => coverType; set { if (value == coverType) return; diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index f4abcd6496..3d881d73ca 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -86,7 +86,7 @@ namespace osu.Game.Graphics.Backgrounds public float TriangleScale { - get { return triangleScale; } + get => triangleScale; set { float change = value / triangleScale; diff --git a/osu.Game/Graphics/Containers/ConstrainedIconContainer.cs b/osu.Game/Graphics/Containers/ConstrainedIconContainer.cs index e2e1385f3e..c1811f37d5 100644 --- a/osu.Game/Graphics/Containers/ConstrainedIconContainer.cs +++ b/osu.Game/Graphics/Containers/ConstrainedIconContainer.cs @@ -15,15 +15,9 @@ namespace osu.Game.Graphics.Containers { public Drawable Icon { - get - { - return InternalChild; - } + get => InternalChild; - set - { - InternalChild = value; - } + set => InternalChild = value; } /// @@ -33,8 +27,8 @@ namespace osu.Game.Graphics.Containers /// public new EdgeEffectParameters EdgeEffect { - get { return base.EdgeEffect; } - set { base.EdgeEffect = value; } + get => base.EdgeEffect; + set => base.EdgeEffect = value; } protected override void Update() diff --git a/osu.Game/Graphics/Containers/SectionsContainer.cs b/osu.Game/Graphics/Containers/SectionsContainer.cs index b8ea4e299c..0878915e28 100644 --- a/osu.Game/Graphics/Containers/SectionsContainer.cs +++ b/osu.Game/Graphics/Containers/SectionsContainer.cs @@ -24,7 +24,7 @@ namespace osu.Game.Graphics.Containers public Drawable ExpandableHeader { - get { return expandableHeader; } + get => expandableHeader; set { if (value == expandableHeader) return; @@ -40,7 +40,7 @@ namespace osu.Game.Graphics.Containers public Drawable FixedHeader { - get { return fixedHeader; } + get => fixedHeader; set { if (value == fixedHeader) return; @@ -56,7 +56,7 @@ namespace osu.Game.Graphics.Containers public Drawable Footer { - get { return footer; } + get => footer; set { if (value == footer) return; @@ -75,7 +75,7 @@ namespace osu.Game.Graphics.Containers public Drawable HeaderBackground { - get { return headerBackground; } + get => headerBackground; set { if (value == headerBackground) return; diff --git a/osu.Game/Graphics/SpriteIcon.cs b/osu.Game/Graphics/SpriteIcon.cs index dcb29d50ea..907e6035df 100644 --- a/osu.Game/Graphics/SpriteIcon.cs +++ b/osu.Game/Graphics/SpriteIcon.cs @@ -106,7 +106,7 @@ namespace osu.Game.Graphics private bool shadow; public bool Shadow { - get { return shadow; } + get => shadow; set { shadow = value; @@ -119,10 +119,7 @@ namespace osu.Game.Graphics public FontAwesome Icon { - get - { - return icon; - } + get => icon; set { diff --git a/osu.Game/Graphics/UserInterface/Bar.cs b/osu.Game/Graphics/UserInterface/Bar.cs index 92b71a1cc3..37829f31e4 100644 --- a/osu.Game/Graphics/UserInterface/Bar.cs +++ b/osu.Game/Graphics/UserInterface/Bar.cs @@ -26,10 +26,7 @@ namespace osu.Game.Graphics.UserInterface /// 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; diff --git a/osu.Game/Graphics/UserInterface/BarGraph.cs b/osu.Game/Graphics/UserInterface/BarGraph.cs index 97335e3c42..10e786a2fd 100644 --- a/osu.Game/Graphics/UserInterface/BarGraph.cs +++ b/osu.Game/Graphics/UserInterface/BarGraph.cs @@ -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; diff --git a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs index e40168d213..5f2207384b 100644 --- a/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs +++ b/osu.Game/Graphics/UserInterface/BreadcrumbControl.cs @@ -57,7 +57,7 @@ namespace osu.Game.Graphics.UserInterface public Visibility State { - get { return state; } + get => state; set { if (value == state) return; diff --git a/osu.Game/Graphics/UserInterface/DialogButton.cs b/osu.Game/Graphics/UserInterface/DialogButton.cs index 2796db51a5..fc0b28c328 100644 --- a/osu.Game/Graphics/UserInterface/DialogButton.cs +++ b/osu.Game/Graphics/UserInterface/DialogButton.cs @@ -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; diff --git a/osu.Game/Graphics/UserInterface/IconButton.cs b/osu.Game/Graphics/UserInterface/IconButton.cs index b9062b8d39..025aa30986 100644 --- a/osu.Game/Graphics/UserInterface/IconButton.cs +++ b/osu.Game/Graphics/UserInterface/IconButton.cs @@ -19,7 +19,7 @@ namespace osu.Game.Graphics.UserInterface /// public Color4 IconColour { - get { return iconColour ?? Color4.White; } + get => iconColour ?? Color4.White; set { iconColour = value; @@ -34,8 +34,8 @@ namespace osu.Game.Graphics.UserInterface /// public Color4 IconHoverColour { - get { return iconHoverColour ?? IconColour; } - set { iconHoverColour = value; } + get => iconHoverColour ?? IconColour; + set => iconHoverColour = value; } /// @@ -43,8 +43,8 @@ namespace osu.Game.Graphics.UserInterface /// public FontAwesome Icon { - get { return icon.Icon; } - set { icon.Icon = value; } + get => icon.Icon; + set => icon.Icon = value; } /// @@ -52,8 +52,8 @@ namespace osu.Game.Graphics.UserInterface /// public Vector2 IconScale { - get { return icon.Scale; } - set { icon.Scale = value; } + get => icon.Scale; + set => icon.Scale = value; } /// diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs index 88d64c1bfb..4c4dbaf75a 100644 --- a/osu.Game/Graphics/UserInterface/LineGraph.cs +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -44,7 +44,7 @@ namespace osu.Game.Graphics.UserInterface /// public IEnumerable Values { - get { return values; } + get => values; set { values = value.ToArray(); diff --git a/osu.Game/Graphics/UserInterface/Nub.cs b/osu.Game/Graphics/UserInterface/Nub.cs index 470297a83c..fb3a947de1 100644 --- a/osu.Game/Graphics/UserInterface/Nub.cs +++ b/osu.Game/Graphics/UserInterface/Nub.cs @@ -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 current = new Bindable(); @@ -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; diff --git a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs index 9f5fc503ad..de3d93d845 100644 --- a/osu.Game/Graphics/UserInterface/OsuCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuCheckbox.cs @@ -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) diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 0877776d0e..4af621a94a 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -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; diff --git a/osu.Game/Graphics/UserInterface/OsuMenu.cs b/osu.Game/Graphics/UserInterface/OsuMenu.cs index 7fcefee23a..9b5755ea8b 100644 --- a/osu.Game/Graphics/UserInterface/OsuMenu.cs +++ b/osu.Game/Graphics/UserInterface/OsuMenu.cs @@ -125,7 +125,7 @@ namespace osu.Game.Graphics.UserInterface { public string Text { - get { return NormalText.Text; } + get => NormalText.Text; set { NormalText.Text = value; diff --git a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs index 3fd0ead760..59d6d99a41 100644 --- a/osu.Game/Graphics/UserInterface/OsuSliderBar.cs +++ b/osu.Game/Graphics/UserInterface/OsuSliderBar.cs @@ -37,7 +37,7 @@ namespace osu.Game.Graphics.UserInterface private Color4 accentColour; public Color4 AccentColour { - get { return accentColour; } + get => accentColour; set { accentColour = value; diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 2db0325813..d29e81f423 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -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 { diff --git a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs index b56b9ec18f..71ad4c0255 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControlCheckbox.cs @@ -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; diff --git a/osu.Game/Graphics/UserInterface/ProgressBar.cs b/osu.Game/Graphics/UserInterface/ProgressBar.cs index 04f85e62b7..d271cd121c 100644 --- a/osu.Game/Graphics/UserInterface/ProgressBar.cs +++ b/osu.Game/Graphics/UserInterface/ProgressBar.cs @@ -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() diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 52cd69a76e..249ff806b1 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -45,10 +45,7 @@ namespace osu.Game.Graphics.UserInterface /// 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; } /// diff --git a/osu.Game/Graphics/UserInterface/StarCounter.cs b/osu.Game/Graphics/UserInterface/StarCounter.cs index ad8ff8ec74..efdb466ae1 100644 --- a/osu.Game/Graphics/UserInterface/StarCounter.cs +++ b/osu.Game/Graphics/UserInterface/StarCounter.cs @@ -41,10 +41,7 @@ namespace osu.Game.Graphics.UserInterface /// public float CountStars { - get - { - return countStars; - } + get => countStars; set { diff --git a/osu.Game/Graphics/UserInterface/TriangleButton.cs b/osu.Game/Graphics/UserInterface/TriangleButton.cs index 2375017878..685d230a4b 100644 --- a/osu.Game/Graphics/UserInterface/TriangleButton.cs +++ b/osu.Game/Graphics/UserInterface/TriangleButton.cs @@ -31,10 +31,7 @@ namespace osu.Game.Graphics.UserInterface public bool MatchingFilter { - set - { - this.FadeTo(value ? 1 : 0); - } + set => this.FadeTo(value ? 1 : 0); } } } diff --git a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs index eddacf8e2d..3dcc475407 100644 --- a/osu.Game/Graphics/UserInterface/TwoLayerButton.cs +++ b/osu.Game/Graphics/UserInterface/TwoLayerButton.cs @@ -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() { diff --git a/osu.Game/Input/Bindings/DatabasedKeyBinding.cs b/osu.Game/Input/Bindings/DatabasedKeyBinding.cs index 5e15b07b46..8c0072c3da 100644 --- a/osu.Game/Input/Bindings/DatabasedKeyBinding.cs +++ b/osu.Game/Input/Bindings/DatabasedKeyBinding.cs @@ -19,15 +19,15 @@ namespace osu.Game.Input.Bindings [Column("Keys")] public string KeysString { - get { return KeyCombination.ToString(); } - private set { KeyCombination = value; } + get => KeyCombination.ToString(); + private set => KeyCombination = value; } [Column("Action")] public int IntAction { - get { return (int)Action; } - set { Action = value; } + get => (int)Action; + set => Action = value; } } } diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 9e84fd6009..df4b8464ab 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -260,7 +260,7 @@ namespace osu.Game.Online.API public APIState State { - get { return state; } + get => state; private set { APIState oldState = state; diff --git a/osu.Game/Online/API/OAuthToken.cs b/osu.Game/Online/API/OAuthToken.cs index 4c9c7b808f..1af8a2b652 100644 --- a/osu.Game/Online/API/OAuthToken.cs +++ b/osu.Game/Online/API/OAuthToken.cs @@ -19,15 +19,9 @@ namespace osu.Game.Online.API [JsonProperty(@"expires_in")] public long ExpiresIn { - get - { - return AccessTokenExpiry - DateTimeOffset.UtcNow.ToUnixTimeSeconds(); - } + get => AccessTokenExpiry - DateTimeOffset.UtcNow.ToUnixTimeSeconds(); - set - { - AccessTokenExpiry = DateTimeOffset.Now.AddSeconds(value).ToUnixTimeSeconds(); - } + set => AccessTokenExpiry = DateTimeOffset.Now.AddSeconds(value).ToUnixTimeSeconds(); } public bool IsValid => !string.IsNullOrEmpty(AccessToken) && ExpiresIn > 30; diff --git a/osu.Game/Online/Leaderboards/Leaderboard.cs b/osu.Game/Online/Leaderboards/Leaderboard.cs index f3e7bb5c34..38df0efd6f 100644 --- a/osu.Game/Online/Leaderboards/Leaderboard.cs +++ b/osu.Game/Online/Leaderboards/Leaderboard.cs @@ -39,7 +39,7 @@ namespace osu.Game.Online.Leaderboards public IEnumerable Scores { - get { return scores; } + get => scores; set { scores = value; @@ -98,7 +98,7 @@ namespace osu.Game.Online.Leaderboards public TScope Scope { - get { return scope; } + get => scope; set { if (value.Equals(scope)) @@ -117,7 +117,7 @@ namespace osu.Game.Online.Leaderboards /// protected PlaceholderState PlaceholderState { - get { return placeholderState; } + get => placeholderState; set { if (value != PlaceholderState.Successful) diff --git a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs index 8a75cfea50..e10fc6ba20 100644 --- a/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs +++ b/osu.Game/Overlays/BeatmapSet/AuthorInfo.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.BeatmapSet public BeatmapSetInfo BeatmapSet { - get { return beatmapSet; } + get => beatmapSet; set { if (value == beatmapSet) return; diff --git a/osu.Game/Overlays/BeatmapSet/BasicStats.cs b/osu.Game/Overlays/BeatmapSet/BasicStats.cs index ac2e5497af..ed8c50272c 100644 --- a/osu.Game/Overlays/BeatmapSet/BasicStats.cs +++ b/osu.Game/Overlays/BeatmapSet/BasicStats.cs @@ -21,7 +21,7 @@ namespace osu.Game.Overlays.BeatmapSet public BeatmapSetInfo BeatmapSet { - get { return beatmapSet; } + get => beatmapSet; set { if (value == beatmapSet) return; @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.BeatmapSet public BeatmapInfo Beatmap { - get { return beatmap; } + get => beatmap; set { if (value == beatmap) return; @@ -95,8 +95,8 @@ namespace osu.Game.Overlays.BeatmapSet public string Value { - get { return value.Text; } - set { this.value.Text = value; } + get => value.Text; + set => this.value.Text = value; } public Statistic(FontAwesome icon, string name) diff --git a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs index 9f4ec0e814..1a16ea6a4a 100644 --- a/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs +++ b/osu.Game/Overlays/BeatmapSet/BeatmapPicker.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.BeatmapSet private BeatmapSetInfo beatmapSet; public BeatmapSetInfo BeatmapSet { - get { return beatmapSet; } + get => beatmapSet; set { if (value == beatmapSet) return; @@ -196,7 +196,7 @@ namespace osu.Game.Overlays.BeatmapSet private DifficultySelectorState state; public DifficultySelectorState State { - get { return state; } + get => state; set { if (value == state) return; @@ -279,7 +279,7 @@ namespace osu.Game.Overlays.BeatmapSet private int value; public int Value { - get { return value; } + get => value; set { this.value = value; diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs index 269342525b..8c884e0950 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/PreviewButton.cs @@ -30,8 +30,8 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons public BeatmapSetInfo BeatmapSet { - get { return playButton.BeatmapSet; } - set { playButton.BeatmapSet = value; } + get => playButton.BeatmapSet; + set => playButton.BeatmapSet = value; } public PreviewButton() diff --git a/osu.Game/Overlays/BeatmapSet/Details.cs b/osu.Game/Overlays/BeatmapSet/Details.cs index 538d327d98..b62e211f18 100644 --- a/osu.Game/Overlays/BeatmapSet/Details.cs +++ b/osu.Game/Overlays/BeatmapSet/Details.cs @@ -25,7 +25,7 @@ namespace osu.Game.Overlays.BeatmapSet public BeatmapSetInfo BeatmapSet { - get { return beatmapSet; } + get => beatmapSet; set { if (value == beatmapSet) return; @@ -39,7 +39,7 @@ namespace osu.Game.Overlays.BeatmapSet public BeatmapInfo Beatmap { - get { return beatmap; } + get => beatmap; set { if (value == beatmap) return; diff --git a/osu.Game/Overlays/BeatmapSet/Info.cs b/osu.Game/Overlays/BeatmapSet/Info.cs index b6793d2609..8efb4d814e 100644 --- a/osu.Game/Overlays/BeatmapSet/Info.cs +++ b/osu.Game/Overlays/BeatmapSet/Info.cs @@ -28,7 +28,7 @@ namespace osu.Game.Overlays.BeatmapSet private BeatmapSetInfo beatmapSet; public BeatmapSetInfo BeatmapSet { - get { return beatmapSet; } + get => beatmapSet; set { if (value == beatmapSet) return; @@ -46,8 +46,8 @@ namespace osu.Game.Overlays.BeatmapSet public BeatmapInfo Beatmap { - get { return successRate.Beatmap; } - set { successRate.Beatmap = value; } + get => successRate.Beatmap; + set => successRate.Beatmap = value; } public Info() @@ -162,8 +162,8 @@ namespace osu.Game.Overlays.BeatmapSet public Color4 TextColour { - get { return textFlow.Colour; } - set { textFlow.Colour = value; } + get => textFlow.Colour; + set => textFlow.Colour = value; } public MetadataSection(string title) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs index 7933bfd9b6..168ce382a5 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ClickableUsername.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private User user; public User User { - get { return user; } + get => user; set { if (user == value) return; diff --git a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs index c64bda9dfd..aeb314853f 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/DrawableTopScore.cs @@ -46,7 +46,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private APIScoreInfo score; public APIScoreInfo Score { - get { return score; } + get => score; set { if (score == value) return; @@ -209,7 +209,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores return; valueText.Text = value; } - get { return valueText.Text; } + get => valueText.Text; } public InfoColumn(string header) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index ab34d2ba1d..6c65d491af 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -34,7 +34,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores public IEnumerable Scores { - get { return scores; } + get => scores; set { getScoresRequest?.Cancel(); diff --git a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs index 0a844028fe..1ca83849d5 100644 --- a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs +++ b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs @@ -23,7 +23,7 @@ namespace osu.Game.Overlays.BeatmapSet private BeatmapInfo beatmap; public BeatmapInfo Beatmap { - get { return beatmap; } + get => beatmap; set { if (value == beatmap) return; diff --git a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs index 1dd888a3e9..71d915d577 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelListItem.cs @@ -38,10 +38,7 @@ namespace osu.Game.Overlays.Chat.Selection public IEnumerable FilterTerms => new[] { channel.Name }; public bool MatchingFilter { - set - { - this.FadeTo(value ? 1f : 0f, 100); - } + set => this.FadeTo(value ? 1f : 0f, 100); } public Action OnRequestJoin; diff --git a/osu.Game/Overlays/Chat/Selection/ChannelSection.cs b/osu.Game/Overlays/Chat/Selection/ChannelSection.cs index 160bf05a2b..dbb40cec95 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelSection.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelSection.cs @@ -23,21 +23,18 @@ namespace osu.Game.Overlays.Chat.Selection public IEnumerable FilterTerms => Array.Empty(); public bool MatchingFilter { - set - { - this.FadeTo(value ? 1f : 0f, 100); - } + set => this.FadeTo(value ? 1f : 0f, 100); } public string Header { - get { return header.Text; } - set { header.Text = value.ToUpperInvariant(); } + get => header.Text; + set => header.Text = value.ToUpperInvariant(); } public IEnumerable Channels { - set { ChannelFlow.ChildrenEnumerable = value.Select(c => new ChannelListItem(c)); } + set => ChannelFlow.ChildrenEnumerable = value.Select(c => new ChannelListItem(c)); } public ChannelSection() diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index d7eae000b8..3867886f6d 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -158,7 +158,7 @@ namespace osu.Game.Overlays.Direct public int Value { - get { return value; } + get => value; set { this.value = value; diff --git a/osu.Game/Overlays/Direct/PlayButton.cs b/osu.Game/Overlays/Direct/PlayButton.cs index e001c2d3ea..2f064a285c 100644 --- a/osu.Game/Overlays/Direct/PlayButton.cs +++ b/osu.Game/Overlays/Direct/PlayButton.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Direct public BeatmapSetInfo BeatmapSet { - get { return beatmapSet; } + get => beatmapSet; set { if (value == beatmapSet) return; diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index d3881b6ef8..cef022b3a4 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -45,7 +45,7 @@ namespace osu.Game.Overlays public IEnumerable BeatmapSets { - get { return beatmapSets; } + get => beatmapSets; set { if (beatmapSets?.Equals(value) ?? false) return; @@ -72,7 +72,7 @@ namespace osu.Game.Overlays public ResultCounts ResultAmounts { - get { return resultAmounts; } + get => resultAmounts; set { if (value == ResultAmounts) return; diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index 8a8ad0d964..31fa1d5a7b 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -35,7 +35,7 @@ namespace osu.Game.Overlays.KeyBinding public bool MatchingFilter { - get { return matchingFilter; } + get => matchingFilter; set { matchingFilter = value; @@ -309,7 +309,7 @@ namespace osu.Game.Overlays.KeyBinding public bool IsBinding { - get { return isBinding; } + get => isBinding; set { if (value == isBinding) return; diff --git a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs index 2dedef8fb2..d0d843d951 100644 --- a/osu.Game/Overlays/MedalSplash/DrawableMedal.cs +++ b/osu.Game/Overlays/MedalSplash/DrawableMedal.cs @@ -132,7 +132,7 @@ namespace osu.Game.Overlays.MedalSplash public DisplayState State { - get { return state; } + get => state; set { if (state == value) return; diff --git a/osu.Game/Overlays/Mods/ModButton.cs b/osu.Game/Overlays/Mods/ModButton.cs index f9cc19419c..abadfcf39d 100644 --- a/osu.Game/Overlays/Mods/ModButton.cs +++ b/osu.Game/Overlays/Mods/ModButton.cs @@ -107,7 +107,7 @@ namespace osu.Game.Overlays.Mods public Color4 SelectedColour { - get { return selectedColour; } + get => selectedColour; set { if (value == selectedColour) return; @@ -121,7 +121,7 @@ namespace osu.Game.Overlays.Mods public Mod Mod { - get { return mod; } + get => mod; set { mod = value; diff --git a/osu.Game/Overlays/Music/PlaylistItem.cs b/osu.Game/Overlays/Music/PlaylistItem.cs index 65f02e1839..5f188e3412 100644 --- a/osu.Game/Overlays/Music/PlaylistItem.cs +++ b/osu.Game/Overlays/Music/PlaylistItem.cs @@ -52,7 +52,7 @@ namespace osu.Game.Overlays.Music private bool selected; public bool Selected { - get { return selected; } + get => selected; set { if (value == selected) return; @@ -142,7 +142,7 @@ namespace osu.Game.Overlays.Music public bool MatchingFilter { - get { return matching; } + get => matching; set { if (matching == value) return; diff --git a/osu.Game/Overlays/Music/PlaylistList.cs b/osu.Game/Overlays/Music/PlaylistList.cs index b02ad242aa..1496523db0 100644 --- a/osu.Game/Overlays/Music/PlaylistList.cs +++ b/osu.Game/Overlays/Music/PlaylistList.cs @@ -34,8 +34,8 @@ namespace osu.Game.Overlays.Music public new MarginPadding Padding { - get { return base.Padding; } - set { base.Padding = value; } + get => base.Padding; + set => base.Padding = value; } public BeatmapSetInfo FirstVisibleSet => items.FirstVisibleSet; @@ -109,8 +109,8 @@ namespace osu.Game.Overlays.Music public string SearchTerm { - get { return search.SearchTerm; } - set { search.SearchTerm = value; } + get => search.SearchTerm; + set => search.SearchTerm = value; } public BeatmapSetInfo FirstVisibleSet => items.FirstOrDefault(i => i.MatchingFilter)?.BeatmapSetInfo; diff --git a/osu.Game/Overlays/Notifications/Notification.cs b/osu.Game/Overlays/Notifications/Notification.cs index b77b6f837d..fc5812e9e2 100644 --- a/osu.Game/Overlays/Notifications/Notification.cs +++ b/osu.Game/Overlays/Notifications/Notification.cs @@ -205,7 +205,7 @@ namespace osu.Game.Overlays.Notifications public bool Pulsate { - get { return pulsate; } + get => pulsate; set { if (pulsate == value) return; diff --git a/osu.Game/Overlays/Notifications/NotificationSection.cs b/osu.Game/Overlays/Notifications/NotificationSection.cs index 6b0e17a482..4608d78324 100644 --- a/osu.Game/Overlays/Notifications/NotificationSection.cs +++ b/osu.Game/Overlays/Notifications/NotificationSection.cs @@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Notifications public string ClearText { - get { return clearText; } + get => clearText; set { clearText = value; @@ -51,7 +51,7 @@ namespace osu.Game.Overlays.Notifications public string Title { - get { return title; } + get => title; set { title = value; @@ -153,8 +153,8 @@ namespace osu.Game.Overlays.Notifications public string Text { - get { return text.Text; } - set { text.Text = value.ToUpperInvariant(); } + get => text.Text; + set => text.Text = value.ToUpperInvariant(); } } diff --git a/osu.Game/Overlays/Notifications/ProgressNotification.cs b/osu.Game/Overlays/Notifications/ProgressNotification.cs index efb66a7153..e0c0a624ca 100644 --- a/osu.Game/Overlays/Notifications/ProgressNotification.cs +++ b/osu.Game/Overlays/Notifications/ProgressNotification.cs @@ -17,18 +17,15 @@ namespace osu.Game.Overlays.Notifications { public string Text { - set - { - Schedule(() => textDrawable.Text = value); - } + set => Schedule(() => textDrawable.Text = value); } public string CompletionText { get; set; } = "Task has completed!"; public float Progress { - get { return progressBar.Progress; } - set { Schedule(() => progressBar.Progress = value); } + get => progressBar.Progress; + set => Schedule(() => progressBar.Progress = value); } protected override void LoadComplete() @@ -41,9 +38,8 @@ namespace osu.Game.Overlays.Notifications public virtual ProgressNotificationState State { - get { return state; } - set - { + get => state; + set => Schedule(() => { bool stateChanged = state != value; @@ -82,7 +78,6 @@ namespace osu.Game.Overlays.Notifications } } }); - } } private ProgressNotificationState state; @@ -180,7 +175,7 @@ namespace osu.Game.Overlays.Notifications private float progress; public float Progress { - get { return progress; } + get => progress; set { if (progress == value) return; @@ -194,7 +189,7 @@ namespace osu.Game.Overlays.Notifications public bool Active { - get { return active; } + get => active; set { active = value; diff --git a/osu.Game/Overlays/Notifications/SimpleNotification.cs b/osu.Game/Overlays/Notifications/SimpleNotification.cs index 91dab14a62..b7e01b57c7 100644 --- a/osu.Game/Overlays/Notifications/SimpleNotification.cs +++ b/osu.Game/Overlays/Notifications/SimpleNotification.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Notifications private string text = string.Empty; public string Text { - get { return text; } + get => text; set { text = value; @@ -28,7 +28,7 @@ namespace osu.Game.Overlays.Notifications private FontAwesome icon = FontAwesome.fa_info_circle; public FontAwesome Icon { - get { return icon; } + get => icon; set { icon = value; @@ -76,10 +76,7 @@ namespace osu.Game.Overlays.Notifications public override bool Read { - get - { - return base.Read; - } + get => base.Read; set { diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 56e34cf296..2f807edd06 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -318,7 +318,7 @@ namespace osu.Game.Overlays.Profile public User User { - get { return user; } + get => user; set { user = value; diff --git a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs index 9d60851f6e..3c69082e9d 100644 --- a/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs +++ b/osu.Game/Overlays/Profile/Sections/Kudosu/KudosuInfo.cs @@ -78,7 +78,7 @@ namespace osu.Game.Overlays.Profile.Sections.Kudosu public new int Count { - set { valueText.Text = value.ToString(); } + set => valueText.Text = value.ToString(); } public CountSection(string header, string description) diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 4e1130690f..d5b9b241aa 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Settings.Sections.General public bool Bounding { - get { return bounding; } + get => bounding; set { bounding = value; @@ -338,7 +338,7 @@ namespace osu.Game.Overlays.Settings.Sections.General public Color4 StatusColour { - set { statusIcon.FadeColour(value, 500, Easing.OutQuint); } + set => statusIcon.FadeColour(value, 500, Easing.OutQuint); } public UserDropdownHeader() diff --git a/osu.Game/Overlays/Settings/SettingsCheckbox.cs b/osu.Game/Overlays/Settings/SettingsCheckbox.cs index 71c197b784..46c23c3bbf 100644 --- a/osu.Game/Overlays/Settings/SettingsCheckbox.cs +++ b/osu.Game/Overlays/Settings/SettingsCheckbox.cs @@ -14,8 +14,8 @@ namespace osu.Game.Overlays.Settings public override string LabelText { - get { return checkbox.LabelText; } - set { checkbox.LabelText = value; } + get => checkbox.LabelText; + set => checkbox.LabelText = value; } } } diff --git a/osu.Game/Overlays/Settings/SettingsItem.cs b/osu.Game/Overlays/Settings/SettingsItem.cs index de7e8bbd71..f6517bafd6 100644 --- a/osu.Game/Overlays/Settings/SettingsItem.cs +++ b/osu.Game/Overlays/Settings/SettingsItem.cs @@ -39,7 +39,7 @@ namespace osu.Game.Overlays.Settings public virtual string LabelText { - get { return text?.Text ?? string.Empty; } + get => text?.Text ?? string.Empty; set { if (text == null) @@ -58,7 +58,7 @@ namespace osu.Game.Overlays.Settings public virtual Bindable Bindable { - get { return bindable; } + get => bindable; set { @@ -76,11 +76,7 @@ namespace osu.Game.Overlays.Settings public bool MatchingFilter { - set - { - // probably needs a better transition. - this.FadeTo(value ? 1 : 0); - } + set => this.FadeTo(value ? 1 : 0); } protected SettingsItem() @@ -115,7 +111,7 @@ namespace osu.Game.Overlays.Settings public Bindable Bindable { - get { return bindable; } + get => bindable; set { bindable = value; diff --git a/osu.Game/Overlays/Settings/SettingsSection.cs b/osu.Game/Overlays/Settings/SettingsSection.cs index cf8544af17..38a8b58a68 100644 --- a/osu.Game/Overlays/Settings/SettingsSection.cs +++ b/osu.Game/Overlays/Settings/SettingsSection.cs @@ -31,7 +31,7 @@ namespace osu.Game.Overlays.Settings public bool MatchingFilter { - set { this.FadeTo(value ? 1 : 0); } + set => this.FadeTo(value ? 1 : 0); } protected SettingsSection() diff --git a/osu.Game/Overlays/Settings/SettingsSubsection.cs b/osu.Game/Overlays/Settings/SettingsSubsection.cs index 9a3eeac5d0..3853308b28 100644 --- a/osu.Game/Overlays/Settings/SettingsSubsection.cs +++ b/osu.Game/Overlays/Settings/SettingsSubsection.cs @@ -24,10 +24,7 @@ namespace osu.Game.Overlays.Settings public IEnumerable FilterTerms => new[] { Header }; public bool MatchingFilter { - set - { - this.FadeTo(value ? 1 : 0); - } + set => this.FadeTo(value ? 1 : 0); } protected SettingsSubsection() diff --git a/osu.Game/Overlays/Settings/Sidebar.cs b/osu.Game/Overlays/Settings/Sidebar.cs index 960ceaa78f..969686e36d 100644 --- a/osu.Game/Overlays/Settings/Sidebar.cs +++ b/osu.Game/Overlays/Settings/Sidebar.cs @@ -88,7 +88,7 @@ namespace osu.Game.Overlays.Settings public ExpandedState State { - get { return state; } + get => state; set { expandEvent?.Cancel(); diff --git a/osu.Game/Overlays/Settings/SidebarButton.cs b/osu.Game/Overlays/Settings/SidebarButton.cs index c53596cabe..a900afd41a 100644 --- a/osu.Game/Overlays/Settings/SidebarButton.cs +++ b/osu.Game/Overlays/Settings/SidebarButton.cs @@ -28,10 +28,7 @@ namespace osu.Game.Overlays.Settings private SettingsSection section; public SettingsSection Section { - get - { - return section; - } + get => section; set { section = value; @@ -43,7 +40,7 @@ namespace osu.Game.Overlays.Settings private bool selected; public bool Selected { - get { return selected; } + get => selected; set { selected = value; diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 9ee255819a..b89fd6c2e6 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -36,7 +36,7 @@ namespace osu.Game.Overlays private IEnumerable users; public IEnumerable Users { - get { return users; } + get => users; set { if (users?.Equals(value) ?? false) diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 32ab80d50f..ef8d54a69e 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -35,34 +35,25 @@ namespace osu.Game.Overlays.Toolbar public FontAwesome Icon { - set { SetIcon(value); } + set => SetIcon(value); } public string Text { - get { return DrawableText.Text; } - set - { - DrawableText.Text = value; - } + get => DrawableText.Text; + set => DrawableText.Text = value; } public string TooltipMain { - get { return tooltip1.Text; } - set - { - tooltip1.Text = value; - } + get => tooltip1.Text; + set => tooltip1.Text = value; } public string TooltipSub { - get { return tooltip2.Text; } - set - { - tooltip2.Text = value; - } + get => tooltip2.Text; + set => tooltip2.Text = value; } protected virtual Anchor TooltipAnchor => Anchor.TopLeft; diff --git a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs index 2e1e2c0df8..751045f61c 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarNotificationButton.cs @@ -66,7 +66,7 @@ namespace osu.Game.Overlays.Toolbar public int Count { - get { return count; } + get => count; set { if (count == value) diff --git a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs index fc6a54477c..ca86ce7aa7 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarOverlayToggleButton.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Toolbar public OverlayContainer StateContainer { - get { return stateContainer; } + get => stateContainer; set { stateContainer = value; diff --git a/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs b/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs index 07a53f0bae..3c6749d885 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarRulesetButton.cs @@ -12,7 +12,7 @@ namespace osu.Game.Overlays.Toolbar private RulesetInfo ruleset; public RulesetInfo Ruleset { - get { return ruleset; } + get => ruleset; set { ruleset = value; diff --git a/osu.Game/Rulesets/UI/ModIcon.cs b/osu.Game/Rulesets/UI/ModIcon.cs index 12b9134f92..9f80dea9f7 100644 --- a/osu.Game/Rulesets/UI/ModIcon.cs +++ b/osu.Game/Rulesets/UI/ModIcon.cs @@ -22,8 +22,8 @@ namespace osu.Game.Rulesets.UI public FontAwesome Icon { - get { return modIcon.Icon; } - set { modIcon.Icon = value; } + get => modIcon.Icon; + set => modIcon.Icon = value; } private readonly ModType type; @@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.UI public bool Highlighted { - get { return highlighted; } + get => highlighted; set { diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 8706cc6668..3a49d21b34 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -15,7 +15,7 @@ namespace osu.Game.Screens.Backgrounds public WorkingBeatmap Beatmap { - get { return beatmap; } + get => beatmap; set { if (beatmap == value && beatmap != null) diff --git a/osu.Game/Screens/Edit/BindableBeatDivisor.cs b/osu.Game/Screens/Edit/BindableBeatDivisor.cs index bea4d9a7a4..ea3b68e3bd 100644 --- a/osu.Game/Screens/Edit/BindableBeatDivisor.cs +++ b/osu.Game/Screens/Edit/BindableBeatDivisor.cs @@ -22,7 +22,7 @@ namespace osu.Game.Screens.Edit public override int Value { - get { return base.Value; } + get => base.Value; set { if (!VALID_DIVISORS.Contains(value)) diff --git a/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs b/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs index c6ecdde7f6..5ff846157d 100644 --- a/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs +++ b/osu.Game/Screens/Edit/Components/RadioButtons/RadioButtonCollection.cs @@ -14,7 +14,7 @@ namespace osu.Game.Screens.Edit.Components.RadioButtons private IReadOnlyList items; public IReadOnlyList Items { - get { return items; } + get => items; set { if (ReferenceEquals(items, value)) diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs index 806a55c931..5ded97393b 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineButton.cs @@ -19,8 +19,8 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline public FontAwesome Icon { - get { return button.Icon; } - set { button.Icon = value; } + get => button.Icon; + set => button.Icon = value; } private readonly IconButton button; diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index fc285fb724..a02c2a37fa 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -242,7 +242,7 @@ namespace osu.Game.Screens.Menu public ButtonState State { - get { return state; } + get => state; set { diff --git a/osu.Game/Screens/Menu/ButtonSystem.cs b/osu.Game/Screens/Menu/ButtonSystem.cs index 42d67ceffc..1f68818669 100644 --- a/osu.Game/Screens/Menu/ButtonSystem.cs +++ b/osu.Game/Screens/Menu/ButtonSystem.cs @@ -206,7 +206,7 @@ namespace osu.Game.Screens.Menu public ButtonSystemState State { - get { return state; } + get => state; set { diff --git a/osu.Game/Screens/Menu/OsuLogo.cs b/osu.Game/Screens/Menu/OsuLogo.cs index e682d5f711..af697d37bd 100644 --- a/osu.Game/Screens/Menu/OsuLogo.cs +++ b/osu.Game/Screens/Menu/OsuLogo.cs @@ -62,7 +62,7 @@ namespace osu.Game.Screens.Menu public bool Triangles { - set { colourAndTriangles.FadeTo(value ? 1 : 0, transition_length, Easing.OutQuint); } + set => colourAndTriangles.FadeTo(value ? 1 : 0, transition_length, Easing.OutQuint); } public bool BeatMatching = true; @@ -71,8 +71,8 @@ namespace osu.Game.Screens.Menu public bool Ripple { - get { return rippleContainer.Alpha > 0; } - set { rippleContainer.FadeTo(value ? 1 : 0, transition_length, Easing.OutQuint); } + get => rippleContainer.Alpha > 0; + set => rippleContainer.FadeTo(value ? 1 : 0, transition_length, Easing.OutQuint); } private readonly Box flashLayer; diff --git a/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs b/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs index 14d66389ca..865a3f0496 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/DrawableRoom.cs @@ -45,7 +45,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components private SelectionState state; public SelectionState State { - get { return state; } + get => state; set { if (value == state) return; @@ -65,7 +65,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components private bool matchingFilter; public bool MatchingFilter { - get { return matchingFilter; } + get => matchingFilter; set { matchingFilter = value; diff --git a/osu.Game/Screens/Play/Break/BlurredIcon.cs b/osu.Game/Screens/Play/Break/BlurredIcon.cs index 04b87d123f..53b968959c 100644 --- a/osu.Game/Screens/Play/Break/BlurredIcon.cs +++ b/osu.Game/Screens/Play/Break/BlurredIcon.cs @@ -15,8 +15,8 @@ namespace osu.Game.Screens.Play.Break public FontAwesome Icon { - set { icon.Icon = value; } - get { return icon.Icon; } + set => icon.Icon = value; + get => icon.Icon; } public override Vector2 Size @@ -27,7 +27,7 @@ namespace osu.Game.Screens.Play.Break base.Size = value + BlurSigma * 2.5f; ForceRedraw(); } - get { return base.Size; } + get => base.Size; } public BlurredIcon() diff --git a/osu.Game/Screens/Play/Break/GlowIcon.cs b/osu.Game/Screens/Play/Break/GlowIcon.cs index 8843373ded..8d918cd225 100644 --- a/osu.Game/Screens/Play/Break/GlowIcon.cs +++ b/osu.Game/Screens/Play/Break/GlowIcon.cs @@ -16,7 +16,7 @@ namespace osu.Game.Screens.Play.Break public override Vector2 Size { - get { return base.Size; } + get => base.Size; set { blurredIcon.Size = spriteIcon.Size = value; @@ -26,14 +26,14 @@ namespace osu.Game.Screens.Play.Break public Vector2 BlurSigma { - get { return blurredIcon.BlurSigma; } - set { blurredIcon.BlurSigma = value; } + get => blurredIcon.BlurSigma; + set => blurredIcon.BlurSigma = value; } public FontAwesome Icon { - get { return spriteIcon.Icon; } - set { spriteIcon.Icon = blurredIcon.Icon = value; } + get => spriteIcon.Icon; + set => spriteIcon.Icon = blurredIcon.Icon = value; } public GlowIcon() diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index bcd7452ba6..558c85a83e 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -184,7 +184,7 @@ namespace osu.Game.Screens.Play private int selectionIndex { - get { return _selectionIndex; } + get => _selectionIndex; set { if (_selectionIndex == value) diff --git a/osu.Game/Screens/Play/HUD/ComboCounter.cs b/osu.Game/Screens/Play/HUD/ComboCounter.cs index eb9db9745f..aeec0e7af0 100644 --- a/osu.Game/Screens/Play/HUD/ComboCounter.cs +++ b/osu.Game/Screens/Play/HUD/ComboCounter.cs @@ -83,7 +83,7 @@ namespace osu.Game.Screens.Play.HUD /// public virtual int DisplayedCount { - get { return displayedCount; } + get => displayedCount; protected set { if (displayedCount.Equals(value)) @@ -95,7 +95,7 @@ namespace osu.Game.Screens.Play.HUD private float textSize; public float TextSize { - get { return textSize; } + get => textSize; set { textSize = value; diff --git a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs index f961e6b227..5e90de18f3 100644 --- a/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs +++ b/osu.Game/Screens/Play/HUD/StandardHealthDisplay.cs @@ -44,14 +44,14 @@ namespace osu.Game.Screens.Play.HUD public Color4 AccentColour { - get { return fill.Colour; } - set { fill.Colour = value; } + get => fill.Colour; + set => fill.Colour = value; } private Color4 glowColour; public Color4 GlowColour { - get { return glowColour; } + get => glowColour; set { if (glowColour == value) diff --git a/osu.Game/Screens/Play/KeyCounter.cs b/osu.Game/Screens/Play/KeyCounter.cs index 406cd3810e..730ce8c568 100644 --- a/osu.Game/Screens/Play/KeyCounter.cs +++ b/osu.Game/Screens/Play/KeyCounter.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Play private int countPresses; public int CountPresses { - get { return countPresses; } + get => countPresses; private set { if (countPresses != value) @@ -43,7 +43,7 @@ namespace osu.Game.Screens.Play private bool isLit; public bool IsLit { - get { return isLit; } + get => isLit; protected set { if (isLit != value) diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 71e8da06ba..b37917ad44 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -60,7 +60,7 @@ namespace osu.Game.Screens.Play private bool isCounting = true; public bool IsCounting { - get { return isCounting; } + get => isCounting; set { if (value == isCounting) return; @@ -74,7 +74,7 @@ namespace osu.Game.Screens.Play private int fadeTime; public int FadeTime { - get { return fadeTime; } + get => fadeTime; set { if (value != fadeTime) @@ -89,7 +89,7 @@ namespace osu.Game.Screens.Play private Color4 keyDownTextColor = Color4.DarkGray; public Color4 KeyDownTextColor { - get { return keyDownTextColor; } + get => keyDownTextColor; set { if (value != keyDownTextColor) @@ -104,7 +104,7 @@ namespace osu.Game.Screens.Play private Color4 keyUpTextColor = Color4.White; public Color4 KeyUpTextColor { - get { return keyUpTextColor; } + get => keyUpTextColor; set { if (value != keyUpTextColor) diff --git a/osu.Game/Screens/Play/PauseContainer.cs b/osu.Game/Screens/Play/PauseContainer.cs index 0222cefdd3..54f3a4b2c1 100644 --- a/osu.Game/Screens/Play/PauseContainer.cs +++ b/osu.Game/Screens/Play/PauseContainer.cs @@ -32,7 +32,7 @@ namespace osu.Game.Screens.Play protected override Container Content => content; - public int Retries { set { pauseOverlay.Retries = value; } } + public int Retries { set => pauseOverlay.Retries = value; } public bool CanPause => (CheckCanPause?.Invoke() ?? true) && Time.Current >= lastPauseActionTime + pause_cooldown; public bool IsResuming { get; private set; } diff --git a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs index 49bcf0b8dc..ffe239c52a 100644 --- a/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs +++ b/osu.Game/Screens/Play/PlayerSettings/PlayerSettingsGroup.cs @@ -34,7 +34,7 @@ namespace osu.Game.Screens.Play.PlayerSettings public bool Expanded { - get { return expanded; } + get => expanded; set { if (expanded == value) return; diff --git a/osu.Game/Screens/Play/SkipOverlay.cs b/osu.Game/Screens/Play/SkipOverlay.cs index f5983029e2..010d9228de 100644 --- a/osu.Game/Screens/Play/SkipOverlay.cs +++ b/osu.Game/Screens/Play/SkipOverlay.cs @@ -158,7 +158,7 @@ namespace osu.Game.Screens.Play public Visibility State { - get { return state; } + get => state; set { bool stateChanged = value != state; diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index 443df27b42..ea9f1860c1 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Play public override bool HandlePositionalInput => AllowSeeking; private IClock audioClock; - public IClock AudioClock { set { audioClock = info.AudioClock = value; } } + public IClock AudioClock { set => audioClock = info.AudioClock = value; } private double lastHitTime => ((objects.Last() as IHasEndTime)?.EndTime ?? objects.Last().StartTime) + 1; @@ -117,10 +117,7 @@ namespace osu.Game.Screens.Play public bool AllowSeeking { - get - { - return allowSeeking; - } + get => allowSeeking; set { diff --git a/osu.Game/Screens/Play/SongProgressBar.cs b/osu.Game/Screens/Play/SongProgressBar.cs index ee9d711d54..2e7d452fe7 100644 --- a/osu.Game/Screens/Play/SongProgressBar.cs +++ b/osu.Game/Screens/Play/SongProgressBar.cs @@ -20,22 +20,22 @@ namespace osu.Game.Screens.Play public Color4 FillColour { - set { fill.Colour = value; } + set => fill.Colour = value; } public double StartTime { - set { CurrentNumber.MinValue = value; } + set => CurrentNumber.MinValue = value; } public double EndTime { - set { CurrentNumber.MaxValue = value; } + set => CurrentNumber.MaxValue = value; } public double CurrentTime { - set { CurrentNumber.Value = value; } + set => CurrentNumber.Value = value; } public SongProgressBar(float barHeight, float handleBarHeight, Vector2 handleSize) diff --git a/osu.Game/Screens/Play/SongProgressInfo.cs b/osu.Game/Screens/Play/SongProgressInfo.cs index d24e484001..bf4372144f 100644 --- a/osu.Game/Screens/Play/SongProgressInfo.cs +++ b/osu.Game/Screens/Play/SongProgressInfo.cs @@ -29,8 +29,8 @@ namespace osu.Game.Screens.Play public IClock AudioClock; - public double StartTime { set { startTime = value; } } - public double EndTime { set { endTime = value; } } + public double StartTime { set => startTime = value; } + public double EndTime { set => endTime = value; } [BackgroundDependencyLoader] private void load(OsuColour colours) diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index 15102edc42..c9b22725f3 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -28,7 +28,7 @@ namespace osu.Game.Screens.Play public int Progress { - get { return progress; } + get => progress; set { if (value == progress) return; @@ -43,7 +43,7 @@ namespace osu.Game.Screens.Play public int[] Values { - get { return values; } + get => values; set { if (value == values) return; @@ -56,7 +56,7 @@ namespace osu.Game.Screens.Play public Color4 FillColour { - get { return fillColour; } + get => fillColour; set { if (value == fillColour) return; @@ -193,7 +193,7 @@ namespace osu.Game.Screens.Play public float Filled { - get { return filled; } + get => filled; set { if (value == filled) return; @@ -207,7 +207,7 @@ namespace osu.Game.Screens.Play public ColumnState State { - get { return state; } + get => state; set { if (value == state) return; diff --git a/osu.Game/Screens/Select/BeatmapDetailArea.cs b/osu.Game/Screens/Select/BeatmapDetailArea.cs index 03e94c86b6..e3580f5104 100644 --- a/osu.Game/Screens/Select/BeatmapDetailArea.cs +++ b/osu.Game/Screens/Select/BeatmapDetailArea.cs @@ -22,10 +22,7 @@ namespace osu.Game.Screens.Select private WorkingBeatmap beatmap; public WorkingBeatmap Beatmap { - get - { - return beatmap; - } + get => beatmap; set { beatmap = value; diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 9f9263927e..665f9b7255 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -43,7 +43,7 @@ namespace osu.Game.Screens.Select private BeatmapInfo beatmap; public BeatmapInfo Beatmap { - get { return beatmap; } + get => beatmap; set { if (value == beatmap) return; diff --git a/osu.Game/Screens/Select/Details/AdvancedStats.cs b/osu.Game/Screens/Select/Details/AdvancedStats.cs index 2d897148c1..4026bb8eb3 100644 --- a/osu.Game/Screens/Select/Details/AdvancedStats.cs +++ b/osu.Game/Screens/Select/Details/AdvancedStats.cs @@ -22,7 +22,7 @@ namespace osu.Game.Screens.Select.Details private BeatmapInfo beatmap; public BeatmapInfo Beatmap { - get { return beatmap; } + get => beatmap; set { if (value == beatmap) return; @@ -83,14 +83,14 @@ namespace osu.Game.Screens.Select.Details public string Title { - get { return name.Text; } - set { name.Text = value; } + get => name.Text; + set => name.Text = value; } private float difficultyValue; public float Value { - get { return difficultyValue; } + get => difficultyValue; set { difficultyValue = value; @@ -101,8 +101,8 @@ namespace osu.Game.Screens.Select.Details public Color4 AccentColour { - get { return bar.AccentColour; } - set { bar.AccentColour = value; } + get => bar.AccentColour; + set => bar.AccentColour = value; } public StatisticRow(float maxValue = 10, bool forceDecimalPlaces = false) diff --git a/osu.Game/Screens/Select/Details/FailRetryGraph.cs b/osu.Game/Screens/Select/Details/FailRetryGraph.cs index 32067a69a0..f7d5e77f18 100644 --- a/osu.Game/Screens/Select/Details/FailRetryGraph.cs +++ b/osu.Game/Screens/Select/Details/FailRetryGraph.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Select.Details private BeatmapMetrics metrics; public BeatmapMetrics Metrics { - get { return metrics; } + get => metrics; set { if (value == metrics) return; diff --git a/osu.Game/Screens/Select/Details/UserRatings.cs b/osu.Game/Screens/Select/Details/UserRatings.cs index db796ba5d2..19855e5e23 100644 --- a/osu.Game/Screens/Select/Details/UserRatings.cs +++ b/osu.Game/Screens/Select/Details/UserRatings.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Select.Details public BeatmapMetrics Metrics { - get { return metrics; } + get => metrics; set { if (value == metrics) return; diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 72a15e37e1..bd0b0dd5cd 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -32,7 +32,7 @@ namespace osu.Game.Screens.Select public SortMode Sort { - get { return sort; } + get => sort; set { if (sort != value) @@ -47,7 +47,7 @@ namespace osu.Game.Screens.Select public GroupMode Group { - get { return group; } + get => group; set { if (group != value) diff --git a/osu.Game/Screens/Select/FilterCriteria.cs b/osu.Game/Screens/Select/FilterCriteria.cs index 4c3b77d483..140010ff54 100644 --- a/osu.Game/Screens/Select/FilterCriteria.cs +++ b/osu.Game/Screens/Select/FilterCriteria.cs @@ -22,7 +22,7 @@ namespace osu.Game.Screens.Select public string SearchText { - get { return searchText; } + get => searchText; set { searchText = value; diff --git a/osu.Game/Screens/Select/FooterButton.cs b/osu.Game/Screens/Select/FooterButton.cs index aa8b48588a..68ac1cc662 100644 --- a/osu.Game/Screens/Select/FooterButton.cs +++ b/osu.Game/Screens/Select/FooterButton.cs @@ -20,7 +20,7 @@ namespace osu.Game.Screens.Select public string Text { - get { return spriteText?.Text; } + get => spriteText?.Text; set { if (spriteText != null) @@ -31,7 +31,7 @@ namespace osu.Game.Screens.Select private Color4 deselectedColour; public Color4 DeselectedColour { - get { return deselectedColour; } + get => deselectedColour; set { deselectedColour = value; @@ -43,7 +43,7 @@ namespace osu.Game.Screens.Select private Color4 selectedColour; public Color4 SelectedColour { - get { return selectedColour; } + get => selectedColour; set { selectedColour = value; diff --git a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs index 4f1fd0188e..adf989ee62 100644 --- a/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs +++ b/osu.Game/Screens/Select/Leaderboards/BeatmapLeaderboard.cs @@ -23,7 +23,7 @@ namespace osu.Game.Screens.Select.Leaderboards public BeatmapInfo Beatmap { - get { return beatmap; } + get => beatmap; set { if (beatmap == value) diff --git a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs index 6960739987..758e1c24c3 100644 --- a/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs +++ b/osu.Game/Screens/Select/Options/BeatmapOptionsButton.cs @@ -28,26 +28,26 @@ namespace osu.Game.Screens.Select.Options public Color4 ButtonColour { - get { return background.Colour; } - set { background.Colour = value; } + get => background.Colour; + set => background.Colour = value; } public FontAwesome Icon { - get { return iconText.Icon; } - set { iconText.Icon = value; } + get => iconText.Icon; + set => iconText.Icon = value; } public string FirstLineText { - get { return firstLine.Text; } - set { firstLine.Text = value; } + get => firstLine.Text; + set => firstLine.Text = value; } public string SecondLineText { - get { return secondLine.Text; } - set { secondLine.Text = value; } + get => secondLine.Text; + set => secondLine.Text = value; } public Key? HotKey; diff --git a/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs b/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs index 854eb809e8..6b0888313b 100644 --- a/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs +++ b/osu.Game/Screens/Tournament/Components/VisualiserContainer.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Tournament.Components /// public int Lines { - get { return allLines.Count; } + get => allLines.Count; set { while (value > allLines.Count) diff --git a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs index da2fc7fb5b..36b6cf425c 100644 --- a/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs +++ b/osu.Game/Screens/Tournament/ScrollingTeamContainer.cs @@ -86,7 +86,7 @@ namespace osu.Game.Screens.Tournament private ScrollState _scrollState; private ScrollState scrollState { - get { return _scrollState; } + get => _scrollState; set { @@ -328,7 +328,7 @@ namespace osu.Game.Screens.Tournament private bool selected; public bool Selected { - get { return selected; } + get => selected; set { diff --git a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs index c92fe9812e..1021529ab2 100644 --- a/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs +++ b/osu.Game/Storyboards/Drawables/DrawableStoryboard.cs @@ -22,7 +22,7 @@ namespace osu.Game.Storyboards.Drawables private bool passing = true; public bool Passing { - get { return passing; } + get => passing; set { if (passing == value) return; diff --git a/osu.Game/Users/Country.cs b/osu.Game/Users/Country.cs index e17afbc77f..4007bf3991 100644 --- a/osu.Game/Users/Country.cs +++ b/osu.Game/Users/Country.cs @@ -35,7 +35,7 @@ namespace osu.Game.Users private Country country; public Country Country { - get { return country; } + get => country; set { if (value == country) diff --git a/osu.Game/Users/UpdateableAvatar.cs b/osu.Game/Users/UpdateableAvatar.cs index 4039e45e3d..cefb91797b 100644 --- a/osu.Game/Users/UpdateableAvatar.cs +++ b/osu.Game/Users/UpdateableAvatar.cs @@ -23,7 +23,7 @@ namespace osu.Game.Users public User User { - get { return user; } + get => user; set { if (user?.Id == value?.Id) diff --git a/osu.Game/Users/User.cs b/osu.Game/Users/User.cs index 745ebb75fc..292ac90245 100644 --- a/osu.Game/Users/User.cs +++ b/osu.Game/Users/User.cs @@ -34,8 +34,8 @@ namespace osu.Game.Users [JsonProperty(@"cover_url")] public string CoverUrl { - get { return Cover?.Url; } - set { Cover = new UserCover { Url = value }; } + get => Cover?.Url; + set => Cover = new UserCover { Url = value }; } [JsonProperty(@"cover")] diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index ad0d8a55a2..9ba4e57f6c 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -6,7 +6,12 @@ ExplicitlyExcluded ExplicitlyExcluded SOLUTION - HINT + WARNING + WARNING + HINT + + HINT + WARNING True @@ -168,6 +173,9 @@ WARNING <?xml version="1.0" encoding="utf-16"?><Profile name="Code Cleanup (peppy)"><CSArrangeThisQualifier>True</CSArrangeThisQualifier><CSUseVar><BehavourStyle>CAN_CHANGE_TO_EXPLICIT</BehavourStyle><LocalVariableStyle>ALWAYS_EXPLICIT</LocalVariableStyle><ForeachVariableStyle>ALWAYS_EXPLICIT</ForeachVariableStyle></CSUseVar><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSShortenReferences>True</CSShortenReferences><CSReformatCode>True</CSReformatCode><CSUpdateFileHeader>True</CSUpdateFileHeader><CSCodeStyleAttributes ArrangeTypeAccessModifier="False" ArrangeTypeMemberAccessModifier="False" SortModifiers="True" RemoveRedundantParentheses="True" AddMissingParentheses="False" ArrangeBraces="False" ArrangeAttributes="False" ArrangeArgumentsStyle="False" /><XAMLCollapseEmptyTags>False</XAMLCollapseEmptyTags><CSFixBuiltinTypeReferences>True</CSFixBuiltinTypeReferences><CSArrangeQualifiers>True</CSArrangeQualifiers></Profile> Code Cleanup (peppy) + ExpressionBody + ExpressionBody + False True True True From e5607d7711be01085c6dd1ddc72d89d4c76b26aa Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 28 Feb 2019 14:33:29 +0900 Subject: [PATCH 269/327] Add back "THIS IS A STORYBOARD" storyboard --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 47ea1a0213..9198e60bcb 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -10,7 +10,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; using osu.Framework.Platform; using osu.Framework.Screens; using osu.Game.Beatmaps; @@ -249,10 +249,14 @@ namespace osu.Game.Tests.Visual { player.ReplacesBackground.Value = true; player.StoryboardEnabled.Value = true; - player.CurrentStoryboardContainer.Add(new Box + player.CurrentStoryboardContainer.Add(new SpriteText { + Size = new Vector2(250, 50), Alpha = 1, - Colour = Color4.Tomato + Colour = Color4.White, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Text = "THIS IS A STORYBOARD", }); }); From e2c6a8bc077d95e048d13782da298a29f77fb30c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Feb 2019 14:35:00 +0900 Subject: [PATCH 270/327] Use pattern matching wherever possible --- osu.Desktop/OsuGameDesktop.cs | 3 +-- .../Beatmaps/ManiaBeatmapConverter.cs | 3 +-- .../Difficulty/Preprocessing/OsuDifficultyHitObject.cs | 3 +-- osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs | 3 +-- osu.Game/Graphics/UserInterface/OsuDropdown.cs | 9 +++------ osu.Game/Graphics/UserInterface/OsuTabControl.cs | 3 +-- osu.Game/OsuGame.cs | 3 +-- osu.Game/Overlays/NotificationOverlay.cs | 3 +-- osu.Game/Rulesets/Mods/ModDaycore.cs | 3 +-- osu.Game/Rulesets/Mods/ModNightcore.cs | 3 +-- osu.Game/Screens/Play/HUDOverlay.cs | 3 +-- osu.Game/Storyboards/StoryboardSprite.cs | 3 +-- osu.sln.DotSettings | 4 +++- 13 files changed, 17 insertions(+), 29 deletions(-) diff --git a/osu.Desktop/OsuGameDesktop.cs b/osu.Desktop/OsuGameDesktop.cs index ef8ec0c105..7e5b003f03 100644 --- a/osu.Desktop/OsuGameDesktop.cs +++ b/osu.Desktop/OsuGameDesktop.cs @@ -83,8 +83,7 @@ namespace osu.Desktop public override void SetHost(GameHost host) { base.SetHost(host); - var desktopWindow = host.Window as DesktopGameWindow; - if (desktopWindow != null) + if (host.Window is DesktopGameWindow desktopWindow) { desktopWindow.CursorState |= CursorState.Hidden; diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 380ce533bb..5dfd9b859e 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -74,8 +74,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps protected override IEnumerable ConvertHitObject(HitObject original, IBeatmap beatmap) { - var maniaOriginal = original as ManiaHitObject; - if (maniaOriginal != null) + if (original is ManiaHitObject maniaOriginal) { yield return maniaOriginal; yield break; diff --git a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs index 930c711783..56ebf31ecf 100644 --- a/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs +++ b/osu.Game.Rulesets.Osu/Difficulty/Preprocessing/OsuDifficultyHitObject.cs @@ -127,8 +127,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing { Vector2 pos = hitObject.StackedPosition; - var slider = hitObject as Slider; - if (slider != null) + if (hitObject is Slider slider) { computeSliderCursorPosition(slider); pos = slider.LazyEndPosition ?? pos; diff --git a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs index dcf3a9dd9a..2db2b45540 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuPlayfield.cs @@ -58,8 +58,7 @@ namespace osu.Game.Rulesets.Osu.UI { h.OnNewResult += onNewResult; - var c = h as IDrawableHitObjectWithProxiedApproach; - if (c != null) + if (h is IDrawableHitObjectWithProxiedApproach c) { var original = c.ProxiedLayer; diff --git a/osu.Game/Graphics/UserInterface/OsuDropdown.cs b/osu.Game/Graphics/UserInterface/OsuDropdown.cs index 0877776d0e..1c263e25cd 100644 --- a/osu.Game/Graphics/UserInterface/OsuDropdown.cs +++ b/osu.Game/Graphics/UserInterface/OsuDropdown.cs @@ -37,11 +37,9 @@ namespace osu.Game.Graphics.UserInterface private void updateAccentColour() { - var header = Header as IHasAccentColour; - if (header != null) header.AccentColour = accentColour; + if (Header is IHasAccentColour header) header.AccentColour = accentColour; - var menu = Menu as IHasAccentColour; - if (menu != null) menu.AccentColour = accentColour; + if (Menu is IHasAccentColour menu) menu.AccentColour = accentColour; } protected override DropdownHeader CreateHeader() => new OsuDropdownHeader(); @@ -149,8 +147,7 @@ namespace osu.Game.Graphics.UserInterface { base.UpdateForegroundColour(); - var content = Foreground.Children.FirstOrDefault() as Content; - if (content != null) content.Chevron.Alpha = IsHovered ? 1 : 0; + if (Foreground.Children.FirstOrDefault() is Content content) content.Chevron.Alpha = IsHovered ? 1 : 0; } protected override Drawable CreateContent() => new Content(); diff --git a/osu.Game/Graphics/UserInterface/OsuTabControl.cs b/osu.Game/Graphics/UserInterface/OsuTabControl.cs index 2db0325813..fe4738d980 100644 --- a/osu.Game/Graphics/UserInterface/OsuTabControl.cs +++ b/osu.Game/Graphics/UserInterface/OsuTabControl.cs @@ -64,8 +64,7 @@ namespace osu.Game.Graphics.UserInterface set { accentColour = value; - var dropdown = Dropdown as IHasAccentColour; - if (dropdown != null) + if (Dropdown is IHasAccentColour dropdown) dropdown.AccentColour = value; foreach (var i in TabContainer.Children.OfType()) i.AccentColour = value; diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 59b7120d95..2298965e4e 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -600,8 +600,7 @@ namespace osu.Game private void loadComponentSingleFile(T d, Action add) where T : Drawable { - var focused = d as FocusedOverlayContainer; - if (focused != null) + if (d is FocusedOverlayContainer focused) { focused.StateChanged += s => { diff --git a/osu.Game/Overlays/NotificationOverlay.cs b/osu.Game/Overlays/NotificationOverlay.cs index 55b1f04528..7993c88c8c 100644 --- a/osu.Game/Overlays/NotificationOverlay.cs +++ b/osu.Game/Overlays/NotificationOverlay.cs @@ -118,8 +118,7 @@ namespace osu.Game.Overlays notification.Closed += notificationClosed; - var hasCompletionTarget = notification as IHasCompletionTarget; - if (hasCompletionTarget != null) + if (notification is IHasCompletionTarget hasCompletionTarget) hasCompletionTarget.CompletionTarget = Post; var ourType = notification.GetType(); diff --git a/osu.Game/Rulesets/Mods/ModDaycore.cs b/osu.Game/Rulesets/Mods/ModDaycore.cs index 74216653c7..2eea6a237c 100644 --- a/osu.Game/Rulesets/Mods/ModDaycore.cs +++ b/osu.Game/Rulesets/Mods/ModDaycore.cs @@ -16,8 +16,7 @@ namespace osu.Game.Rulesets.Mods public override void ApplyToClock(IAdjustableClock clock) { - var pitchAdjust = clock as IHasPitchAdjust; - if (pitchAdjust != null) + if (clock is IHasPitchAdjust pitchAdjust) pitchAdjust.PitchAdjust = 0.75; else base.ApplyToClock(clock); diff --git a/osu.Game/Rulesets/Mods/ModNightcore.cs b/osu.Game/Rulesets/Mods/ModNightcore.cs index 4dd8972dd6..e6bd532f72 100644 --- a/osu.Game/Rulesets/Mods/ModNightcore.cs +++ b/osu.Game/Rulesets/Mods/ModNightcore.cs @@ -16,8 +16,7 @@ namespace osu.Game.Rulesets.Mods public override void ApplyToClock(IAdjustableClock clock) { - var pitchAdjust = clock as IHasPitchAdjust; - if (pitchAdjust != null) + if (clock is IHasPitchAdjust pitchAdjust) pitchAdjust.PitchAdjust = 1.5; else base.ApplyToClock(clock); diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index b5f04c3474..130d2ecc95 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -241,8 +241,7 @@ namespace osu.Game.Screens.Play ComboCounter?.Current.BindTo(processor.Combo); HealthDisplay?.Current.BindTo(processor.Health); - var shd = HealthDisplay as StandardHealthDisplay; - if (shd != null) + if (HealthDisplay is StandardHealthDisplay shd) processor.NewJudgement += shd.Flash; } } diff --git a/osu.Game/Storyboards/StoryboardSprite.cs b/osu.Game/Storyboards/StoryboardSprite.cs index 3b9ea27e4e..10892ffc66 100644 --- a/osu.Game/Storyboards/StoryboardSprite.cs +++ b/osu.Game/Storyboards/StoryboardSprite.cs @@ -70,8 +70,7 @@ namespace osu.Game.Storyboards applyCommands(drawable, getCommands(g => g.Alpha, triggeredGroups), (d, value) => d.Alpha = value, (d, value, duration, easing) => d.FadeTo(value, duration, easing)); applyCommands(drawable, getCommands(g => g.BlendingMode, triggeredGroups), (d, value) => d.Blending = value, (d, value, duration, easing) => d.TransformBlendingMode(value, duration), false); - var flippable = drawable as IFlippable; - if (flippable != null) + if (drawable is IFlippable flippable) { applyCommands(drawable, getCommands(g => g.FlipH, triggeredGroups), (d, value) => flippable.FlipH = value, (d, value, duration, easing) => flippable.TransformFlipH(value, duration), false); applyCommands(drawable, getCommands(g => g.FlipV, triggeredGroups), (d, value) => flippable.FlipV = value, (d, value, duration, easing) => flippable.TransformFlipV(value, duration), false); diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index ad0d8a55a2..75a57e404f 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -158,9 +158,11 @@ WARNING WARNING WARNING + + True WARNING WARNING - HINT + WARNING WARNING WARNING HINT From 4ceafef79c877dbe25bbfc7685e58f79139c0aa9 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 28 Feb 2019 14:40:31 +0900 Subject: [PATCH 271/327] Add missing reference --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 9198e60bcb..2a6bb4e691 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -28,6 +28,7 @@ using osu.Game.Screens.Play.PlayerSettings; using osu.Game.Screens.Select; using osu.Game.Tests.Resources; using osu.Game.Users; +using osuTK; using osuTK.Graphics; namespace osu.Game.Tests.Visual @@ -123,11 +124,9 @@ namespace osu.Game.Tests.Visual }); AddUntilStep(() => player?.IsLoaded ?? false, "Wait for player to load"); AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent()); - AddStep("Trigger background preview when loaded", () => - { - InputManager.MoveMouseTo(playerLoader.VisualSettingsPos); - InputManager.MoveMouseTo(playerLoader.ScreenPos); - }); + AddStep("Trigger background preview when loaded", () => InputManager.MoveMouseTo(playerLoader.VisualSettingsPos)); + AddWaitStep(1); + AddStep("Untrigger background preview", () => InputManager.MoveMouseTo(playerLoader.ScreenPos)); waitForDim(); AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); } @@ -310,6 +309,7 @@ namespace osu.Game.Tests.Visual config.BindWith(OsuSetting.DimLevel, DimLevel); } + //public bool IsBackgroundDimmed() => ((FadeAccessibleBackground)Background).CurrentColour == OsuColour.Gray(1 - (float)DimLevel.Value); public bool IsBackgroundDimmed() => ((FadeAccessibleBackground)Background).CurrentColour == OsuColour.Gray(1 - (float)DimLevel.Value); public bool IsBackgroundUndimmed() => ((FadeAccessibleBackground)Background).CurrentColour == Color4.White; From 774116923be6be29acd3695300db67456cb95a1f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Feb 2019 14:45:59 +0900 Subject: [PATCH 272/327] A few fixes --- .../Visual/TestCaseBeatmapCarousel.cs | 11 ++++---- osu.Game/Overlays/MedalOverlay.cs | 26 +++++++++---------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs b/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs index bab9fdd51c..618d8376c0 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs @@ -163,12 +163,11 @@ namespace osu.Game.Tests.Visual private void checkNonmatchingFilter() { AddStep("Toggle non-matching filter", () => - { - carousel.Filter(new FilterCriteria { SearchText = "Dingo" }, false); - carousel.Filter(new FilterCriteria(), false); - eagerSelectedIDs.Add(carousel.SelectedBeatmapSet.ID); - } - ); + { + carousel.Filter(new FilterCriteria { SearchText = "Dingo" }, false); + carousel.Filter(new FilterCriteria(), false); + eagerSelectedIDs.Add(carousel.SelectedBeatmapSet.ID); + }); } /// diff --git a/osu.Game/Overlays/MedalOverlay.cs b/osu.Game/Overlays/MedalOverlay.cs index b8ad604e88..a5703eba92 100644 --- a/osu.Game/Overlays/MedalOverlay.cs +++ b/osu.Game/Overlays/MedalOverlay.cs @@ -216,20 +216,18 @@ namespace osu.Game.Overlays rightStrip.ResizeWidthTo(1f, step_duration, Easing.OutQuint); this.Animate().Schedule(() => - { - if (drawableMedal.State != DisplayState.Full) - drawableMedal.State = DisplayState.Icon; - }) - .Delay(step_duration).Schedule(() => - { - if (drawableMedal.State != DisplayState.Full) - drawableMedal.State = DisplayState.MedalUnlocked; - }) - .Delay(step_duration).Schedule(() => - { - if (drawableMedal.State != DisplayState.Full) - drawableMedal.State = DisplayState.Full; - }); + { + if (drawableMedal.State != DisplayState.Full) + drawableMedal.State = DisplayState.Icon; + }).Delay(step_duration).Schedule(() => + { + if (drawableMedal.State != DisplayState.Full) + drawableMedal.State = DisplayState.MedalUnlocked; + }).Delay(step_duration).Schedule(() => + { + if (drawableMedal.State != DisplayState.Full) + drawableMedal.State = DisplayState.Full; + }); } } } From 99e2e6cf1c6e23b12b8736b263d6580653aa49d2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Feb 2019 14:46:52 +0900 Subject: [PATCH 273/327] Align text --- osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs index ef2b8739d9..bb55816880 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapMetadataContainer.cs @@ -47,7 +47,8 @@ namespace osu.Game.Overlays.Profile.Sections { new OsuSpriteText { - Text = new LocalisedString(($"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ", + Text = new LocalisedString(( + $"{beatmap.Metadata.TitleUnicode ?? beatmap.Metadata.Title} [{beatmap.Version}] ", $"{beatmap.Metadata.Title ?? beatmap.Metadata.TitleUnicode} [{beatmap.Version}] ")), Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold, italics: true) }, From 2241e1af9d5558e0a736d4ca7547376538079258 Mon Sep 17 00:00:00 2001 From: Joehu Date: Wed, 27 Feb 2019 21:55:45 -0800 Subject: [PATCH 274/327] Use ToQuantity for words with number prefixes --- osu.Game/Overlays/DirectOverlay.cs | 12 ++++-------- osu.Game/Overlays/Profile/ProfileHeader.cs | 3 ++- .../Multi/Lounge/Components/ParticipantInfo.cs | 2 +- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 5 +++-- 4 files changed, 10 insertions(+), 12 deletions(-) diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs index d3881b6ef8..dae39bb64a 100644 --- a/osu.Game/Overlays/DirectOverlay.cs +++ b/osu.Game/Overlays/DirectOverlay.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Humanizer; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -189,14 +190,9 @@ namespace osu.Game.Overlays resultCountsContainer.FadeTo(ResultAmounts == null ? 0f : 1f, 200, Easing.OutQuint); if (ResultAmounts == null) return; - resultCountsText.Text = pluralize("Artist", ResultAmounts.Artists) + ", " + - pluralize("Song", ResultAmounts.Songs) + ", " + - pluralize("Tag", ResultAmounts.Tags); - } - - private string pluralize(string prefix, int value) - { - return $@"{value} {prefix}" + (value == 1 ? string.Empty : @"s"); + resultCountsText.Text = "Artist".ToQuantity(ResultAmounts.Artists) + ", " + + "Song".ToQuantity(ResultAmounts.Songs) + ", " + + "Tag".ToQuantity(ResultAmounts.Tags); } private void recreatePanels(PanelDisplayStyle displayStyle) diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 56e34cf296..ae1a2786fd 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -19,6 +19,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Profile.Components; using osu.Game.Overlays.Profile.Header; using osu.Game.Users; +using Humanizer; namespace osu.Game.Overlays.Profile { @@ -401,7 +402,7 @@ namespace osu.Game.Overlays.Profile infoTextLeft.NewLine(); infoTextLeft.AddText("Contributed ", lightText); - infoTextLeft.AddLink($@"{user.PostCount} forum posts", url: $"https://osu.ppy.sh/users/{user.Id}/posts", creationParameters: boldItalic); + infoTextLeft.AddLink("forum post".ToQuantity(user.PostCount), url: $"https://osu.ppy.sh/users/{user.Id}/posts", creationParameters: boldItalic); string websiteWithoutProtcol = user.Website; if (!string.IsNullOrEmpty(websiteWithoutProtcol)) diff --git a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs index ca5e5f72c4..40e59de25d 100644 --- a/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs +++ b/osu.Game/Screens/Multi/Lounge/Components/ParticipantInfo.cs @@ -101,7 +101,7 @@ namespace osu.Game.Screens.Multi.Lounge.Components } }, true); - ParticipantCount.BindValueChanged(count => summary.Text = $"{count.NewValue:#,0}{" participant".Pluralize(count.NewValue == 1)}", true); + ParticipantCount.BindValueChanged(count => summary.Text = "participant".ToQuantity(count.NewValue), true); /*Participants.BindValueChanged(e => { diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index bcd7452ba6..af9ebb3209 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -18,6 +18,7 @@ using System.Linq; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; using osu.Game.Input.Bindings; +using Humanizer; namespace osu.Game.Screens.Play { @@ -263,14 +264,14 @@ namespace osu.Game.Screens.Play }, new OsuSpriteText { - Text = $"{retries:n0}", + Text = "time".ToQuantity(retries), Font = OsuFont.GetFont(weight: FontWeight.Bold, size: 18), Shadow = true, ShadowColour = new Color4(0, 0, 0, 0.25f), }, new OsuSpriteText { - Text = $" time{(retries == 1 ? "" : "s")} in this session", + Text = " in this session", Shadow = true, ShadowColour = new Color4(0, 0, 0, 0.25f), Font = OsuFont.GetFont(size: 18), From cf2feec7df7c2f19ef8e035b2187729e71ff89dd Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 28 Feb 2019 14:58:44 +0900 Subject: [PATCH 275/327] Fix multiplayer enabled mods check --- osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs b/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs index 7d35276442..374aad5681 100644 --- a/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs +++ b/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Linq; using System.Threading; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -60,7 +61,7 @@ namespace osu.Game.Screens.Multi.Play if (ruleset.Value.ID != playlistItem.Ruleset.ID) throw new InvalidOperationException("Current Ruleset does not match PlaylistItem's Ruleset"); - if (!CurrentMods.Value.Equals(playlistItem.RequiredMods)) + if (!playlistItem.RequiredMods.All(m => CurrentMods.Value.Contains(m))) throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods"); var req = new CreateRoomScoreRequest(roomId.Value ?? 0, playlistItem.ID); From 6e821a426d4bcc234788a7703110ed9fc7ad5185 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 28 Feb 2019 15:01:32 +0900 Subject: [PATCH 276/327] Fix restoration of enabled mods when cancelling song select --- osu.Game/Screens/Select/MatchSongSelect.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/MatchSongSelect.cs b/osu.Game/Screens/Select/MatchSongSelect.cs index bdff35e345..ec4a39206b 100644 --- a/osu.Game/Screens/Select/MatchSongSelect.cs +++ b/osu.Game/Screens/Select/MatchSongSelect.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; using Humanizer; using osu.Framework.Allocation; using osu.Framework.Bindables; @@ -9,6 +10,7 @@ using osu.Framework.Graphics; using osu.Framework.Screens; using osu.Game.Beatmaps; using osu.Game.Online.Multiplayer; +using osu.Game.Rulesets.Mods; using osu.Game.Screens.Multi; namespace osu.Game.Screens.Select @@ -23,6 +25,9 @@ namespace osu.Game.Screens.Select [Resolved(typeof(Room))] protected Bindable CurrentItem { get; private set; } + [Resolved] + protected Bindable> CurrentMods { get; private set; } + [Resolved] private BeatmapManager beatmaps { get; set; } @@ -56,9 +61,8 @@ namespace osu.Game.Screens.Select return true; Beatmap.Value = beatmaps.GetWorkingBeatmap(CurrentItem.Value?.Beatmap); + Beatmap.Value.Mods.Value = CurrentMods.Value = CurrentItem.Value?.RequiredMods; Ruleset.Value = CurrentItem.Value?.Ruleset; - CurrentItem.Value?.RequiredMods.Clear(); - CurrentItem.Value?.RequiredMods.AddRange(SelectedMods.Value); Beatmap.Disabled = true; Ruleset.Disabled = true; From 8cf83e2f4a1c90185b0ceb4dc55ad0fa91ae1780 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 28 Feb 2019 16:14:50 +0900 Subject: [PATCH 277/327] Fix the check of beatmapset local availability --- osu.Game/Overlays/Direct/DownloadTrackingComposite.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs index e37156b39d..7be9eadefb 100644 --- a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs +++ b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs @@ -2,7 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; -using Microsoft.EntityFrameworkCore.Internal; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics.Containers; @@ -41,7 +41,7 @@ namespace osu.Game.Overlays.Direct { if (setInfo.NewValue == null) attachDownload(null); - else if (beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == setInfo.NewValue.OnlineBeatmapSetID).Any()) + else if (beatmaps.GetAllUsableBeatmapSetsEnumerable().Any(s => s.OnlineBeatmapSetID == setInfo.NewValue.OnlineBeatmapSetID)) State.Value = DownloadState.LocallyAvailable; else attachDownload(beatmaps.GetExistingDownload(setInfo.NewValue)); From dbe5887f7e3f19130e724fb87d73f8c7631e2fda Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 28 Feb 2019 16:18:46 +0900 Subject: [PATCH 278/327] Fix issue for user hover blur for now by checking for current screen, fix test. --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 2a6bb4e691..bec113430b 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -11,6 +11,8 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input.Events; +using osu.Framework.Input.States; using osu.Framework.Platform; using osu.Framework.Screens; using osu.Game.Beatmaps; @@ -123,12 +125,11 @@ namespace osu.Game.Tests.Visual InputManager.MoveMouseTo(playerLoader.ScreenPos); }); AddUntilStep(() => player?.IsLoaded ?? false, "Wait for player to load"); + AddStep("Trigger hover event", () => playerLoader.TriggerOnHover()); AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent()); - AddStep("Trigger background preview when loaded", () => InputManager.MoveMouseTo(playerLoader.VisualSettingsPos)); - AddWaitStep(1); - AddStep("Untrigger background preview", () => InputManager.MoveMouseTo(playerLoader.ScreenPos)); waitForDim(); AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); + AddAssert("Screen is unblurred", () => songSelect.IsBackgroundUnblurred()); } /// @@ -252,7 +253,7 @@ namespace osu.Game.Tests.Visual { Size = new Vector2(250, 50), Alpha = 1, - Colour = Color4.White, + Colour = Color4.Tomato, Anchor = Anchor.Centre, Origin = Anchor.Centre, Text = "THIS IS A STORYBOARD", @@ -285,6 +286,7 @@ namespace osu.Game.Tests.Visual { Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { new OsuModNoFail() }); songSelect.DimLevel.Value = 0.7f; + songSelect.BlurLevel.Value = 0.0f; }); AddUntilStep(() => songSelect.Carousel.SelectedBeatmap != null, "Song select has selection"); } @@ -300,6 +302,7 @@ namespace osu.Game.Tests.Visual public readonly Bindable DimEnabled = new Bindable(); public readonly Bindable DimLevel = new Bindable(); + public readonly Bindable BlurLevel = new Bindable(); public new BeatmapCarousel Carousel => base.Carousel; @@ -307,11 +310,13 @@ namespace osu.Game.Tests.Visual private void load(OsuConfigManager config) { config.BindWith(OsuSetting.DimLevel, DimLevel); + config.BindWith(OsuSetting.BlurLevel, BlurLevel); } - //public bool IsBackgroundDimmed() => ((FadeAccessibleBackground)Background).CurrentColour == OsuColour.Gray(1 - (float)DimLevel.Value); public bool IsBackgroundDimmed() => ((FadeAccessibleBackground)Background).CurrentColour == OsuColour.Gray(1 - (float)DimLevel.Value); + public bool IsBackgroundUnblurred() => ((FadeAccessibleBackground)Background).CurrentBlur == new Vector2(0); + public bool IsBackgroundUndimmed() => ((FadeAccessibleBackground)Background).CurrentColour == Color4.White; public bool IsBackgroundInvisible() => ((FadeAccessibleBackground)Background).CurrentAlpha == 0; @@ -396,6 +401,11 @@ namespace osu.Game.Tests.Visual { } + public void TriggerOnHover() + { + OnHover(new HoverEvent(new InputState())); + } + protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value); } @@ -406,6 +416,8 @@ namespace osu.Game.Tests.Visual public Color4 CurrentColour => ((TestUserDimContainer)FadeContainer).CurrentColour; public float CurrentAlpha => ((TestUserDimContainer)FadeContainer).CurrentAlpha; + public Vector2 CurrentBlur => Background.BlurSigma; + public FadeAccessibleBackground(WorkingBeatmap beatmap) : base(beatmap) { From 69b1c76dce86e928c8ead423c78fea902542aefb Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 28 Feb 2019 16:51:17 +0900 Subject: [PATCH 279/327] Actually implement blurring fix --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 20 ++++++++++++------- osu.Game.Tests/Visual/TestCasePlayerLoader.cs | 2 +- .../Graphics/Containers/UserDimContainer.cs | 4 ++-- .../Backgrounds/BackgroundScreenBeatmap.cs | 1 + osu.Game/Screens/Play/PlayerLoader.cs | 5 ++++- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index bec113430b..4ef52ec712 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -162,6 +162,7 @@ namespace osu.Game.Tests.Visual AddUntilStep(() => { if (songSelect.IsCurrentScreen()) return true; + songSelect.MakeCurrent(); return false; }, "Wait for song select is current"); @@ -264,13 +265,16 @@ namespace osu.Game.Tests.Visual { createSongSelect(); - AddStep("Start player loader", () => { songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer + AddStep("Start player loader", () => { - AllowLeadIn = false, - AllowResults = false, - AllowPause = allowPause, - Ready = true, - })); }); + songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer + { + AllowLeadIn = false, + AllowResults = false, + AllowPause = allowPause, + Ready = true, + })); + }); AddUntilStep(() => playerLoader.IsLoaded, "Wait for Player Loader to load"); AddStep("Move mouse to center of screen", () => InputManager.MoveMouseTo(playerLoader.ScreenPos)); AddUntilStep(() => player.IsLoaded, "Wait for player to load"); @@ -279,7 +283,7 @@ namespace osu.Game.Tests.Visual private void createSongSelect() { AddStep("Create new screen stack", () => Child = screenStackContainer = new ScreenStackCacheContainer { RelativeSizeAxes = Axes.Both }); - AddUntilStep(() => screenStackContainer.IsLoaded,"Wait for screen stack creation"); + AddUntilStep(() => screenStackContainer.IsLoaded, "Wait for screen stack creation"); AddStep("Create new song select", () => screenStackContainer.ScreenStack.Push(songSelect = new DummySongSelect())); AddUntilStep(() => songSelect.IsLoaded, "Wait for song select to load"); AddStep("Set user settings", () => @@ -355,6 +359,7 @@ namespace osu.Game.Tests.Visual } public UserDimContainer CurrentStoryboardContainer => StoryboardContainer; + // Whether or not the player should be allowed to load. public bool Ready; @@ -430,6 +435,7 @@ namespace osu.Game.Tests.Visual : base(isStoryboard) { } + public Color4 CurrentColour => DimContainer.Colour; public float CurrentAlpha => DimContainer.Alpha; } diff --git a/osu.Game.Tests/Visual/TestCasePlayerLoader.cs b/osu.Game.Tests/Visual/TestCasePlayerLoader.cs index 156393670d..244f553e97 100644 --- a/osu.Game.Tests/Visual/TestCasePlayerLoader.cs +++ b/osu.Game.Tests/Visual/TestCasePlayerLoader.cs @@ -21,7 +21,7 @@ namespace osu.Game.Tests.Visual public TestCasePlayerLoader() { - InputManager.Add(backgroundStack = new BackgroundScreenStack {RelativeSizeAxes = Axes.Both}); + InputManager.Add(backgroundStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both }); InputManager.Add(stack = new ScreenStack { RelativeSizeAxes = Axes.Both }); } diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index 5aa0cad148..6e3b9c0d79 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -57,8 +57,8 @@ namespace osu.Game.Graphics.Containers { DimLevel = config.GetBindable(OsuSetting.DimLevel); ShowStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); - EnableUserDim.ValueChanged += _ => updateBackgroundDim(); - DimLevel.ValueChanged += _ => updateBackgroundDim(); + EnableUserDim.ValueChanged += _ => updateBackgroundDim(); + DimLevel.ValueChanged += _ => updateBackgroundDim(); ShowStoryboard.ValueChanged += _ => updateBackgroundDim(); StoryboardReplacesBackground.ValueChanged += _ => updateBackgroundDim(); } diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 382c3f57ba..5ccff7b93b 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -48,6 +48,7 @@ namespace osu.Game.Screens.Backgrounds Background.FadeOut(250); Background.Expire(); } + b.Depth = newDepth; FadeContainer.Add(Background = b); Background.BlurSigma = BlurTarget; diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index e358188fe9..5c9acade7b 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -158,9 +158,12 @@ namespace osu.Game.Screens.Play protected override bool OnHover(HoverEvent e) { // restore our screen defaults - InitializeBackgroundElements(); if (this.IsCurrentScreen()) + { + InitializeBackgroundElements(); Background.EnableUserDim.Value = false; + } + return base.OnHover(e); } From 4c8aa65200aed962bffbc3a48d2112d18930a7c5 Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 28 Feb 2019 17:02:45 +0900 Subject: [PATCH 280/327] private + renaming --- osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs | 4 ++-- osu.Game/Screens/Select/MatchSongSelect.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs b/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs index 374aad5681..2e758d34c5 100644 --- a/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs +++ b/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs @@ -38,7 +38,7 @@ namespace osu.Game.Screens.Multi.Play private IBindable ruleset { get; set; } [Resolved] - protected Bindable> CurrentMods { get; private set; } + private Bindable> currentMods { get; set; } public TimeshiftPlayer(PlaylistItem playlistItem) { @@ -61,7 +61,7 @@ namespace osu.Game.Screens.Multi.Play if (ruleset.Value.ID != playlistItem.Ruleset.ID) throw new InvalidOperationException("Current Ruleset does not match PlaylistItem's Ruleset"); - if (!playlistItem.RequiredMods.All(m => CurrentMods.Value.Contains(m))) + if (!playlistItem.RequiredMods.All(m => currentMods.Value.Contains(m))) throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods"); var req = new CreateRoomScoreRequest(roomId.Value ?? 0, playlistItem.ID); diff --git a/osu.Game/Screens/Select/MatchSongSelect.cs b/osu.Game/Screens/Select/MatchSongSelect.cs index ec4a39206b..f6d758df29 100644 --- a/osu.Game/Screens/Select/MatchSongSelect.cs +++ b/osu.Game/Screens/Select/MatchSongSelect.cs @@ -26,7 +26,7 @@ namespace osu.Game.Screens.Select protected Bindable CurrentItem { get; private set; } [Resolved] - protected Bindable> CurrentMods { get; private set; } + private Bindable> selectedMods { get; set; } [Resolved] private BeatmapManager beatmaps { get; set; } @@ -61,7 +61,7 @@ namespace osu.Game.Screens.Select return true; Beatmap.Value = beatmaps.GetWorkingBeatmap(CurrentItem.Value?.Beatmap); - Beatmap.Value.Mods.Value = CurrentMods.Value = CurrentItem.Value?.RequiredMods; + Beatmap.Value.Mods.Value = selectedMods.Value = CurrentItem.Value?.RequiredMods; Ruleset.Value = CurrentItem.Value?.Ruleset; Beatmap.Disabled = true; From 9f9b2b1902b4f6d069408aeb5aa5afd1f2769779 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 28 Feb 2019 17:13:25 +0900 Subject: [PATCH 281/327] Remove redundant setters --- osu.Game/Scoring/ScoreInfo.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Scoring/ScoreInfo.cs b/osu.Game/Scoring/ScoreInfo.cs index 710f239156..aeaf6b9fc9 100644 --- a/osu.Game/Scoring/ScoreInfo.cs +++ b/osu.Game/Scoring/ScoreInfo.cs @@ -115,7 +115,6 @@ namespace osu.Game.Scoring User = new User(); User.Username = value; - User.Id = UserID ?? 1; } } @@ -130,7 +129,6 @@ namespace osu.Game.Scoring User = new User(); User.Id = value ?? 1; - User.Username = UserString; } } From 951b95ff7838ff7dfde8f6fc196be7118088626f Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 28 Feb 2019 17:17:51 +0900 Subject: [PATCH 282/327] Fix potential race condition --- osu.Game/OsuGame.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 3c6922d8a1..f7dbbfd152 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using osu.Framework.Configuration; using osu.Framework.Screens; using osu.Game.Configuration; @@ -628,10 +629,24 @@ namespace osu.Game { Logger.Log($"Loading {d}...", level: LogLevel.Debug); + // Since this is running in a separate thread, it is possible for OsuGame to be disposed after LoadComponentAsync has been called + // throwing an exception. To avoid this, the call is scheduled on the update thread, which does not run if IsDisposed = true + Task task = null; + var del = new ScheduledDelegate(() => task = LoadComponentAsync(d, add)); + Scheduler.Add(del); + + // The delegate won't complete if OsuGame has been disposed in the meantime + while (!IsDisposed && !del.Completed) + await Task.Delay(10); + + // Either we're disposed or the load process has started successfully if (IsDisposed) return; - await LoadComponentAsync(d, add); + Debug.Assert(task != null); + + await task; + Logger.Log($"Loaded {d}!", level: LogLevel.Debug); } catch (OperationCanceledException) From 921346d303e9266b5b91e0a7060d82701a498c89 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 28 Feb 2019 17:27:28 +0900 Subject: [PATCH 283/327] Rename a few more members --- osu.Game/Screens/Multi/Match/MatchSubScreen.cs | 6 +++--- osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs index c3f7cea43e..229b9bde6a 100644 --- a/osu.Game/Screens/Multi/Match/MatchSubScreen.cs +++ b/osu.Game/Screens/Multi/Match/MatchSubScreen.cs @@ -43,7 +43,7 @@ namespace osu.Game.Screens.Multi.Match protected Bindable CurrentItem { get; private set; } [Resolved] - protected Bindable> CurrentMods { get; private set; } + protected Bindable> SelectedMods { get; private set; } [Resolved] private BeatmapManager beatmapManager { get; set; } @@ -194,7 +194,7 @@ namespace osu.Game.Screens.Multi.Match var localBeatmap = e.NewValue?.Beatmap == null ? null : beatmapManager.QueryBeatmap(b => b.OnlineBeatmapID == e.NewValue.Beatmap.OnlineBeatmapID); Beatmap.Value = beatmapManager.GetWorkingBeatmap(localBeatmap); - CurrentMods.Value = e.NewValue?.RequiredMods ?? Enumerable.Empty(); + SelectedMods.Value = e.NewValue?.RequiredMods ?? Enumerable.Empty(); if (e.NewValue?.Ruleset != null) Ruleset.Value = e.NewValue.Ruleset; } @@ -222,7 +222,7 @@ namespace osu.Game.Screens.Multi.Match private void onStart() { - Beatmap.Value.Mods.Value = CurrentMods.Value.ToArray(); + Beatmap.Value.Mods.Value = SelectedMods.Value.ToArray(); switch (type.Value) { diff --git a/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs b/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs index 2e758d34c5..6b88403b9e 100644 --- a/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs +++ b/osu.Game/Screens/Multi/Play/TimeshiftPlayer.cs @@ -38,7 +38,7 @@ namespace osu.Game.Screens.Multi.Play private IBindable ruleset { get; set; } [Resolved] - private Bindable> currentMods { get; set; } + private Bindable> selectedMods { get; set; } public TimeshiftPlayer(PlaylistItem playlistItem) { @@ -61,7 +61,7 @@ namespace osu.Game.Screens.Multi.Play if (ruleset.Value.ID != playlistItem.Ruleset.ID) throw new InvalidOperationException("Current Ruleset does not match PlaylistItem's Ruleset"); - if (!playlistItem.RequiredMods.All(m => currentMods.Value.Contains(m))) + if (!playlistItem.RequiredMods.All(m => selectedMods.Value.Contains(m))) throw new InvalidOperationException("Current Mods do not match PlaylistItem's RequiredMods"); var req = new CreateRoomScoreRequest(roomId.Value ?? 0, playlistItem.ID); From 99812bd448b8ee7a28660eba80adee368db9587a Mon Sep 17 00:00:00 2001 From: Dan Balasescu <1329837+smoogipoo@users.noreply.github.com> Date: Thu, 28 Feb 2019 18:25:58 +0900 Subject: [PATCH 284/327] Apply suggestions from code review Co-Authored-By: nyquillerium --- osu.Game/Graphics/Containers/UserDimContainer.cs | 9 +++++---- osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs | 6 +++--- osu.Game/Screens/Play/Player.cs | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index 6e3b9c0d79..25a81b011d 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -16,9 +16,9 @@ namespace osu.Game.Graphics.Containers /// public class UserDimContainer : Container { - protected Bindable DimLevel; + protected Bindable DimLevel { get; private set; } - protected Bindable ShowStoryboard; + protected Bindable ShowStoryboard { get; private set; } /// /// Whether or not user-configured dim levels should be applied to the container. @@ -28,9 +28,9 @@ namespace osu.Game.Graphics.Containers /// /// Whether or not the storyboard loaded should completely hide the background behind it. /// - public Bindable StoryboardReplacesBackground = new Bindable(); + public readonly Bindable StoryboardReplacesBackground = new Bindable(); - protected Container DimContainer; + protected Container DimContainer { get; private set; } protected override Container Content => DimContainer; @@ -39,6 +39,7 @@ namespace osu.Game.Graphics.Containers private const float background_fade_duration = 800; /// + /// Creates a new . /// /// /// Whether or not this instance of UserDimContainer contains a storyboard. diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 9fb452e15d..9333685e6c 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -18,11 +18,11 @@ namespace osu.Game.Screens.Backgrounds /// /// Whether or not user dim settings should be applied to this Background. /// - public Bindable EnableUserDim = new Bindable(); + public readonly Bindable EnableUserDim = new Bindable(); - public Bindable StoryboardReplacesBackground = new Bindable(); + public readonly Bindable StoryboardReplacesBackground = new Bindable(); - protected UserDimContainer FadeContainer; + protected UserDimContainer FadeContainer { get; private set; } protected virtual UserDimContainer CreateFadeContainer() => new UserDimContainer { RelativeSizeAxes = Axes.Both }; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2f5d776244..2880013b32 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -87,7 +87,7 @@ namespace osu.Game.Screens.Play private FailOverlay failOverlay; private DrawableStoryboard storyboard; - protected UserDimContainer StoryboardContainer; + protected UserDimContainer StoryboardContainer { get; private set; } protected virtual UserDimContainer CreateStoryboardContainer() => new UserDimContainer(true) { @@ -358,7 +358,7 @@ namespace osu.Game.Screens.Play Background.EnableUserDim.Value = true; storyboardReplacesBackground.BindTo(Background.StoryboardReplacesBackground); - StoryboardContainer.StoryboardReplacesBackground.BindTo(Background.StoryboardReplacesBackground); + StoryboardContainer.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground); storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable; Task.Run(() => From 19d529c1c8ee1c764c7835a4936577f84eb6c7e5 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 28 Feb 2019 18:26:41 +0900 Subject: [PATCH 285/327] Move test steps into setup --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 4ef52ec712..ab8d039a40 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -85,6 +85,8 @@ namespace osu.Game.Tests.Visual manager.Delete(manager.GetAllUsableBeatmapSets()); var temp = TestResources.GetTestBeatmapForImport(); manager.Import(temp); + Child = screenStackContainer = new ScreenStackCacheContainer { RelativeSizeAxes = Axes.Both }; + screenStackContainer.ScreenStack.Push(songSelect = new DummySongSelect()); }); } @@ -94,7 +96,7 @@ namespace osu.Game.Tests.Visual [Test] public void PlayerLoaderSettingsHoverTest() { - createSongSelect(); + setupUserSettings(); AddStep("Start player loader", () => songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer()))); AddUntilStep(() => playerLoader?.IsLoaded ?? false, "Wait for Player Loader to load"); AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent()); @@ -116,7 +118,7 @@ namespace osu.Game.Tests.Visual [Test] public void PlayerLoaderTransitionTest() { - createSongSelect(); + setupUserSettings(); AddStep("Start player loader", () => { songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer())); }); AddUntilStep(() => playerLoader?.IsLoaded ?? false, "Wait for Player Loader to load"); AddStep("Allow beatmap to load", () => @@ -138,7 +140,7 @@ namespace osu.Game.Tests.Visual [Test] public void StoryboardBackgroundVisibilityTest() { - performSetup(); + performFullSetup(); createFakeStoryboard(); waitForDim(); AddAssert("Background is invisible, storyboard is visible", () => songSelect.IsBackgroundInvisible() && player.IsStoryboardVisible()); @@ -157,7 +159,7 @@ namespace osu.Game.Tests.Visual [Test] public void StoryboardTransitionTest() { - performSetup(); + performFullSetup(); createFakeStoryboard(); AddUntilStep(() => { @@ -176,7 +178,7 @@ namespace osu.Game.Tests.Visual [Test] public void DisableUserDimTest() { - performSetup(); + performFullSetup(); AddStep("Test User Undimming", () => songSelect.DimEnabled.Value = false); waitForDim(); AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); @@ -188,7 +190,7 @@ namespace osu.Game.Tests.Visual [Test] public void EnableUserDimTest() { - performSetup(); + performFullSetup(); AddStep("Test User Dimming", () => songSelect.DimEnabled.Value = true); waitForDim(); AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); @@ -200,7 +202,7 @@ namespace osu.Game.Tests.Visual [Test] public void PauseTest() { - performSetup(true); + performFullSetup(true); AddStep("Transition to Pause", () => { if (!player.IsPaused.Value) @@ -216,7 +218,7 @@ namespace osu.Game.Tests.Visual [Test] public void TransitionTest() { - performSetup(); + performFullSetup(); AddStep("Transition to Results", () => player.Push(new FadeAccesibleResults(new ScoreInfo { User = new User { Username = "osu!" } }))); waitForDim(); AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); @@ -229,7 +231,7 @@ namespace osu.Game.Tests.Visual [Test] public void TransitionOutTest() { - performSetup(); + performFullSetup(); AddUntilStep(() => { if (!songSelect.IsCurrentScreen()) @@ -261,9 +263,9 @@ namespace osu.Game.Tests.Visual }); }); - private void performSetup(bool allowPause = false) + private void performFullSetup(bool allowPause = false) { - createSongSelect(); + setupUserSettings(); AddStep("Start player loader", () => { @@ -280,19 +282,15 @@ namespace osu.Game.Tests.Visual AddUntilStep(() => player.IsLoaded, "Wait for player to load"); } - private void createSongSelect() + private void setupUserSettings() { - AddStep("Create new screen stack", () => Child = screenStackContainer = new ScreenStackCacheContainer { RelativeSizeAxes = Axes.Both }); - AddUntilStep(() => screenStackContainer.IsLoaded, "Wait for screen stack creation"); - AddStep("Create new song select", () => screenStackContainer.ScreenStack.Push(songSelect = new DummySongSelect())); - AddUntilStep(() => songSelect.IsLoaded, "Wait for song select to load"); - AddStep("Set user settings", () => + AddUntilStep(() => songSelect.Carousel.SelectedBeatmap != null, "Song select has selection"); + AddStep("Set default user settings", () => { Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { new OsuModNoFail() }); songSelect.DimLevel.Value = 0.7f; songSelect.BlurLevel.Value = 0.0f; }); - AddUntilStep(() => songSelect.Carousel.SelectedBeatmap != null, "Song select has selection"); } private class DummySongSelect : PlaySongSelect From b7f717405523b90c2cd9fe7f7dc60cd91135e44d Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 28 Feb 2019 18:44:40 +0900 Subject: [PATCH 286/327] Refactor BeatmapSetOverlay to use chained bindables instead of accessors to distribute changes --- osu.Game/Overlays/BeatmapSet/Info.cs | 30 +++++++------------------- osu.Game/Overlays/BeatmapSetOverlay.cs | 30 ++++++++++---------------- 2 files changed, 19 insertions(+), 41 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Info.cs b/osu.Game/Overlays/BeatmapSet/Info.cs index 4229b81610..47f0c848b2 100644 --- a/osu.Game/Overlays/BeatmapSet/Info.cs +++ b/osu.Game/Overlays/BeatmapSet/Info.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -25,26 +26,7 @@ namespace osu.Game.Overlays.BeatmapSet private readonly Box successRateBackground; private readonly SuccessRate successRate; - private BeatmapSetInfo beatmapSet; - - public BeatmapSetInfo BeatmapSet - { - get => beatmapSet; - set - { - if (value == beatmapSet) return; - - beatmapSet = value; - - updateDisplay(); - } - } - - private void updateDisplay() - { - source.Text = BeatmapSet?.Metadata.Source ?? string.Empty; - tags.Text = BeatmapSet?.Metadata.Tags ?? string.Empty; - } + public readonly Bindable BeatmapSet = new Bindable(); public BeatmapInfo Beatmap { @@ -131,14 +113,18 @@ namespace osu.Game.Overlays.BeatmapSet }, }, }; + + BeatmapSet.ValueChanged += b => + { + source.Text = b.NewValue?.Metadata.Source ?? string.Empty; + tags.Text = b.NewValue?.Metadata.Tags ?? string.Empty; + }; } [BackgroundDependencyLoader] private void load(OsuColour colours) { successRateBackground.Colour = colours.GrayE; - - updateDisplay(); } private class MetadataSection : FillFlowContainer diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index ff8603c749..23ed7bc731 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -3,6 +3,7 @@ using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -36,19 +37,7 @@ namespace osu.Game.Overlays private readonly ScrollContainer scroll; - private BeatmapSetInfo beatmapSet; - - public BeatmapSetInfo BeatmapSet - { - get => beatmapSet; - set - { - if (value == beatmapSet) - return; - - header.BeatmapSet.Value = info.BeatmapSet = beatmapSet = value; - } - } + private readonly Bindable beatmapSet = new Bindable(); // receive input outside our bounds so we can trigger a close event on ourselves. public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; @@ -101,6 +90,9 @@ namespace osu.Game.Overlays }, }; + header.BeatmapSet.BindTo(beatmapSet); + info.BeatmapSet.BindTo(beatmapSet); + header.Picker.Beatmap.ValueChanged += b => { info.Beatmap = b.NewValue; @@ -124,7 +116,7 @@ namespace osu.Game.Overlays protected override void PopOut() { base.PopOut(); - FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out).OnComplete(_ => BeatmapSet = null); + FadeEdgeEffectTo(0, WaveContainer.DISAPPEAR_DURATION, Easing.Out).OnComplete(_ => beatmapSet.Value = null); } protected override bool OnClick(ClickEvent e) @@ -135,11 +127,11 @@ namespace osu.Game.Overlays public void FetchAndShowBeatmap(int beatmapId) { - BeatmapSet = null; + beatmapSet.Value = null; var req = new GetBeatmapSetRequest(beatmapId, BeatmapSetLookupType.BeatmapId); req.Success += res => { - BeatmapSet = res.ToBeatmapSet(rulesets); + beatmapSet.Value = res.ToBeatmapSet(rulesets); header.Picker.Beatmap.Value = header.BeatmapSet.Value.Beatmaps.First(b => b.OnlineBeatmapID == beatmapId); }; api.Queue(req); @@ -148,16 +140,16 @@ namespace osu.Game.Overlays public void FetchAndShowBeatmapSet(int beatmapSetId) { - BeatmapSet = null; + beatmapSet.Value = null; var req = new GetBeatmapSetRequest(beatmapSetId); - req.Success += res => BeatmapSet = res.ToBeatmapSet(rulesets); + req.Success += res => beatmapSet.Value = res.ToBeatmapSet(rulesets); api.Queue(req); Show(); } public void ShowBeatmapSet(BeatmapSetInfo set) { - BeatmapSet = set; + beatmapSet.Value = set; Show(); scroll.ScrollTo(0); } From 48fcaf34e661a322ee9ccafaa075e63a3d49ac00 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Feb 2019 18:49:59 +0900 Subject: [PATCH 287/327] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 82c23fc491..f8d89ec8a5 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -16,7 +16,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index f95f42d933..16eeb46683 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From d10ad3c8a776769da3cf1764485f59862f850025 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Feb 2019 18:58:52 +0900 Subject: [PATCH 288/327] Fix warnings --- osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs | 1 - .../Overlays/Settings/Sections/Maintenance/GeneralSettings.cs | 1 - osu.Game/Screens/Edit/Editor.cs | 1 + 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs b/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs index 230e6983f6..188c9c05ef 100644 --- a/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs @@ -3,7 +3,6 @@ using osu.Framework; using osu.Framework.Allocation; -using osu.Framework.Graphics; using osu.Framework.Platform; using osu.Game.Configuration; diff --git a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs index 67d60fa9e7..398a091486 100644 --- a/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Maintenance/GeneralSettings.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Platform; using osu.Game.Beatmaps; using osu.Game.Graphics.UserInterface; using osu.Game.Skinning; diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index 21ea51bcd3..f2d2381d20 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -75,6 +75,7 @@ namespace osu.Game.Screens.Edit fileMenuItems.Add(new EditorMenuItem("Export", MenuItemType.Standard, exportBeatmap)); fileMenuItems.Add(new EditorMenuItemSpacer()); } + fileMenuItems.Add(new EditorMenuItem("Exit", MenuItemType.Standard, this.Exit)); InternalChildren = new[] From 4b2be4612f4c48398bb191bfae80f1e41ff81eed Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 28 Feb 2019 19:07:43 +0900 Subject: [PATCH 289/327] support duel mode in mania beatmap --- .../Beatmaps/ManiaBeatmapConverter.cs | 18 ++++++++++++++- .../Mods/ManiaModDualStages.cs | 23 ++----------------- .../UI/ManiaRulesetContainer.cs | 3 +-- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index daefdf1128..8471bd5123 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -27,6 +27,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps protected override IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) }; public int TargetColumns; + public bool IsDuel; public readonly bool IsForCurrentRuleset; // Internal for testing purposes @@ -45,7 +46,14 @@ namespace osu.Game.Rulesets.Mania.Beatmaps var roundedOverallDifficulty = Math.Round(beatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty); if (IsForCurrentRuleset) + { TargetColumns = (int)Math.Max(1, roundedCircleSize); + if (TargetColumns >= 10) + { + TargetColumns = TargetColumns / 2; + IsDuel = true; + } + } else { float percentSliderOrSpinner = (float)beatmap.HitObjects.Count(h => h is IHasEndTime) / beatmap.HitObjects.Count; @@ -70,7 +78,15 @@ namespace osu.Game.Rulesets.Mania.Beatmaps return base.ConvertBeatmap(original); } - protected override Beatmap CreateBeatmap() => beatmap = new ManiaBeatmap(new StageDefinition { Columns = TargetColumns }); + protected override Beatmap CreateBeatmap() + { + beatmap = new ManiaBeatmap(new StageDefinition { Columns = TargetColumns }); + + if(IsDuel) + beatmap.Stages.Add(new StageDefinition { Columns = TargetColumns }); + + return beatmap; + } protected override IEnumerable ConvertHitObject(HitObject original, IBeatmap beatmap) { diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs index 7b2ee9a632..bc2726760a 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs @@ -1,15 +1,13 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Collections.Generic; using osu.Game.Beatmaps; using osu.Game.Rulesets.Mania.Beatmaps; -using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mods; namespace osu.Game.Rulesets.Mania.Mods { - public class ManiaModDualStages : Mod, IPlayfieldTypeMod, IApplicableToBeatmapConverter, IApplicableToBeatmap + public class ManiaModDualStages : Mod, IPlayfieldTypeMod, IApplicableToBeatmapConverter { public override string Name => "Dual Stages"; public override string Acronym => "DS"; @@ -29,24 +27,7 @@ namespace osu.Game.Rulesets.Mania.Mods if (isForCurrentRuleset) return; - mbc.TargetColumns *= 2; - } - - public void ApplyToBeatmap(Beatmap beatmap) - { - if (isForCurrentRuleset) - return; - - var maniaBeatmap = (ManiaBeatmap)beatmap; - - var newDefinitions = new List(); - foreach (var existing in maniaBeatmap.Stages) - { - newDefinitions.Add(new StageDefinition { Columns = existing.Columns / 2 }); - newDefinitions.Add(new StageDefinition { Columns = existing.Columns / 2 }); - } - - maniaBeatmap.Stages = newDefinitions; + mbc.IsDuel = true; } public PlayfieldType PlayfieldType => PlayfieldType.Dual; diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index b451e28088..9b8d63dc92 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -15,7 +15,6 @@ using osu.Game.Input.Handlers; using osu.Game.Replays; using osu.Game.Rulesets.Mania.Beatmaps; using osu.Game.Rulesets.Mania.Configuration; -using osu.Game.Rulesets.Mania.Mods; using osu.Game.Rulesets.Mania.Objects; using osu.Game.Rulesets.Mania.Objects.Drawables; using osu.Game.Rulesets.Mania.Replays; @@ -96,7 +95,7 @@ namespace osu.Game.Rulesets.Mania.UI public override ScoreProcessor CreateScoreProcessor() => new ManiaScoreProcessor(this); - public override int Variant => (int)(Mods.OfType().FirstOrDefault()?.PlayfieldType ?? PlayfieldType.Single) + Beatmap.TotalColumns; + public override int Variant => (int)(Beatmap.Stages.Count == 1 ? PlayfieldType.Single : PlayfieldType.Dual) + Beatmap.TotalColumns; public override PassThroughInputManager CreateInputManager() => new ManiaInputManager(Ruleset.RulesetInfo, Variant); From 1f273a4c3a700f1a5f13124eeca4eea98b9af9fc Mon Sep 17 00:00:00 2001 From: Jamie Taylor Date: Thu, 28 Feb 2019 19:58:21 +0900 Subject: [PATCH 290/327] Use local variables where appropriate --- osu.Game/Overlays/BeatmapSet/Info.cs | 2 +- osu.Game/Overlays/BeatmapSetOverlay.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/BeatmapSet/Info.cs b/osu.Game/Overlays/BeatmapSet/Info.cs index 47f0c848b2..4d974a0b63 100644 --- a/osu.Game/Overlays/BeatmapSet/Info.cs +++ b/osu.Game/Overlays/BeatmapSet/Info.cs @@ -22,7 +22,6 @@ namespace osu.Game.Overlays.BeatmapSet private const float metadata_width = 225; private const float spacing = 20; - private readonly MetadataSection source, tags; private readonly Box successRateBackground; private readonly SuccessRate successRate; @@ -36,6 +35,7 @@ namespace osu.Game.Overlays.BeatmapSet public Info() { + MetadataSection source, tags; RelativeSizeAxes = Axes.X; Height = 220; Masking = true; diff --git a/osu.Game/Overlays/BeatmapSetOverlay.cs b/osu.Game/Overlays/BeatmapSetOverlay.cs index 23ed7bc731..55c21b7fc9 100644 --- a/osu.Game/Overlays/BeatmapSetOverlay.cs +++ b/osu.Game/Overlays/BeatmapSetOverlay.cs @@ -30,7 +30,6 @@ namespace osu.Game.Overlays public const float RIGHT_WIDTH = 275; private readonly Header header; - private readonly Info info; private APIAccess api; private RulesetStore rulesets; @@ -44,6 +43,7 @@ namespace osu.Game.Overlays public BeatmapSetOverlay() { + Info info; ScoresContainer scores; Waves.FirstWaveColour = OsuColour.Gray(0.4f); Waves.SecondWaveColour = OsuColour.Gray(0.3f); From e3338e94d1def591ca114382ca9e1d2b5fce5d78 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 28 Feb 2019 20:01:15 +0900 Subject: [PATCH 291/327] Make test cases more compact, add two way toggles --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 113 +++++++----------- .../Graphics/Containers/UserDimContainer.cs | 9 +- .../Backgrounds/BackgroundScreenBeatmap.cs | 12 +- osu.Game/Screens/Play/Player.cs | 26 ++-- 4 files changed, 66 insertions(+), 94 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index ab8d039a40..d850c58f09 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -91,7 +91,7 @@ namespace osu.Game.Tests.Visual } /// - /// Check if PlayerLoader properly triggers background dim previews when a user hovers over the visual settings panel. + /// Check if properly triggers background dim previews when a user hovers over the visual settings panel. /// [Test] public void PlayerLoaderSettingsHoverTest() @@ -105,9 +105,11 @@ namespace osu.Game.Tests.Visual InputManager.MoveMouseTo(playerLoader.ScreenPos); InputManager.MoveMouseTo(playerLoader.VisualSettingsPos); }); - waitForDim(); AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); + AddStep("Stop background preview", () => InputManager.MoveMouseTo(playerLoader.ScreenPos)); + waitForDim(); + AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); } /// @@ -118,20 +120,11 @@ namespace osu.Game.Tests.Visual [Test] public void PlayerLoaderTransitionTest() { - setupUserSettings(); - AddStep("Start player loader", () => { songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer())); }); - AddUntilStep(() => playerLoader?.IsLoaded ?? false, "Wait for Player Loader to load"); - AddStep("Allow beatmap to load", () => - { - player.Ready = true; - InputManager.MoveMouseTo(playerLoader.ScreenPos); - }); - AddUntilStep(() => player?.IsLoaded ?? false, "Wait for player to load"); + performFullSetup(); AddStep("Trigger hover event", () => playerLoader.TriggerOnHover()); AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent()); waitForDim(); - AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); - AddAssert("Screen is unblurred", () => songSelect.IsBackgroundUnblurred()); + AddAssert("Screen is dimmed and unblurred", () => songSelect.IsBackgroundDimmed() && songSelect.IsBackgroundUnblurred()); } /// @@ -142,9 +135,14 @@ namespace osu.Game.Tests.Visual { performFullSetup(); createFakeStoryboard(); + AddStep("Storyboard Enabled", () => + { + player.ReplacesBackground.Value = true; + player.StoryboardEnabled.Value = true; + }); waitForDim(); AddAssert("Background is invisible, storyboard is visible", () => songSelect.IsBackgroundInvisible() && player.IsStoryboardVisible()); - AddStep("Disable storyboard", () => + AddStep("Storyboard Disabled", () => { player.ReplacesBackground.Value = false; player.StoryboardEnabled.Value = false; @@ -161,37 +159,24 @@ namespace osu.Game.Tests.Visual { performFullSetup(); createFakeStoryboard(); - AddUntilStep(() => - { - if (songSelect.IsCurrentScreen()) return true; - - songSelect.MakeCurrent(); - return false; - }, "Wait for song select is current"); + AddStep("Exit to song select", () => player.Exit()); waitForDim(); AddAssert("Background is visible", () => songSelect.IsBackgroundVisible()); } /// - /// Check if the fade container is properly being reset when screen dim is disabled. + /// Check if the is properly accepting user dim changes at all. /// [Test] public void DisableUserDimTest() { performFullSetup(); - AddStep("Test User Undimming", () => songSelect.DimEnabled.Value = false); + waitForDim(); + AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); + AddStep("EnableUserDim disabled", () => songSelect.DimEnabled.Value = false); waitForDim(); AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); - } - - /// - /// Check if the fade container is properly being faded when screen dim is enabled. - /// - [Test] - public void EnableUserDimTest() - { - performFullSetup(); - AddStep("Test User Dimming", () => songSelect.DimEnabled.Value = true); + AddStep("EnableUserDim enabled", () => songSelect.DimEnabled.Value = true); waitForDim(); AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); } @@ -203,55 +188,44 @@ namespace osu.Game.Tests.Visual public void PauseTest() { performFullSetup(true); - AddStep("Transition to Pause", () => - { - if (!player.IsPaused.Value) - player.Exit(); - }); + AddStep("Pause", () => player.CurrentPauseContainer.Pause()); + waitForDim(); + AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); + AddStep("Unpause", () => player.CurrentPauseContainer.Resume()); waitForDim(); AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); } /// - /// Check if the fade container removes user dim when suspending player for results + /// Check if the fade container removes user dim when suspending for /// [Test] public void TransitionTest() { performFullSetup(); - AddStep("Transition to Results", () => player.Push(new FadeAccesibleResults(new ScoreInfo { User = new User { Username = "osu!" } }))); + AddStep("Transition to Results", () => player.Push(new FadeAccessibleResults(new ScoreInfo { User = new User { Username = "osu!" } }))); waitForDim(); - AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); - AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent()); + AddAssert("Screen is undimmed and is original background", () => songSelect.IsBackgroundUndimmed() && songSelect.IsBackgroundCurrent()); } /// - /// Check if background gets undimmed when leaving the player for the previous screen + /// Check if background gets undimmed when leaving for /// [Test] public void TransitionOutTest() { performFullSetup(); - AddUntilStep(() => - { - if (!songSelect.IsCurrentScreen()) - { - songSelect.MakeCurrent(); - return false; - } - - return true; - }, "Wait for song select is current"); + AddStep("Exit to song select", () => player.Exit()); waitForDim(); AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); } private void waitForDim() => AddWaitStep(5, "Wait for dim"); - private void createFakeStoryboard() => AddStep("Enable storyboard", () => + private void createFakeStoryboard() => AddStep("Create storyboard", () => { - player.ReplacesBackground.Value = true; - player.StoryboardEnabled.Value = true; + player.StoryboardEnabled.Value = false; + player.ReplacesBackground.Value = false; player.CurrentStoryboardContainer.Add(new SpriteText { Size = new Vector2(250, 50), @@ -271,8 +245,6 @@ namespace osu.Game.Tests.Visual { songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer { - AllowLeadIn = false, - AllowResults = false, AllowPause = allowPause, Ready = true, })); @@ -332,9 +304,9 @@ namespace osu.Game.Tests.Visual public bool IsBackgroundCurrent() => ((FadeAccessibleBackground)Background).IsCurrentScreen(); } - private class FadeAccesibleResults : SoloResults + private class FadeAccessibleResults : SoloResults { - public FadeAccesibleResults(ScoreInfo score) + public FadeAccessibleResults(ScoreInfo score) : base(score) { } @@ -356,6 +328,8 @@ namespace osu.Game.Tests.Visual }; } + public PauseContainer CurrentPauseContainer => PauseContainer; + public UserDimContainer CurrentStoryboardContainer => StoryboardContainer; // Whether or not the player should be allowed to load. @@ -404,23 +378,22 @@ namespace osu.Game.Tests.Visual { } - public void TriggerOnHover() - { - OnHover(new HoverEvent(new InputState())); - } + public void TriggerOnHover() => OnHover(new HoverEvent(new InputState())); protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value); } private class FadeAccessibleBackground : BackgroundScreenBeatmap { - protected override UserDimContainer CreateFadeContainer() => new TestUserDimContainer { RelativeSizeAxes = Axes.Both }; + protected override UserDimContainer CreateFadeContainer() => fadeContainer = new TestUserDimContainer { RelativeSizeAxes = Axes.Both }; - public Color4 CurrentColour => ((TestUserDimContainer)FadeContainer).CurrentColour; - public float CurrentAlpha => ((TestUserDimContainer)FadeContainer).CurrentAlpha; + public Color4 CurrentColour => fadeContainer.CurrentColour; + public float CurrentAlpha => fadeContainer.CurrentAlpha; public Vector2 CurrentBlur => Background.BlurSigma; + private TestUserDimContainer fadeContainer; + public FadeAccessibleBackground(WorkingBeatmap beatmap) : base(beatmap) { @@ -429,13 +402,13 @@ namespace osu.Game.Tests.Visual private class TestUserDimContainer : UserDimContainer { + public Color4 CurrentColour => DimContainer.Colour; + public float CurrentAlpha => DimContainer.Alpha; + public TestUserDimContainer(bool isStoryboard = false) : base(isStoryboard) { } - - public Color4 CurrentColour => DimContainer.Colour; - public float CurrentAlpha => DimContainer.Alpha; } } } diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index 25a81b011d..e70bec1d2d 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -16,6 +16,8 @@ namespace osu.Game.Graphics.Containers /// public class UserDimContainer : Container { + private const float background_fade_duration = 800; + protected Bindable DimLevel { get; private set; } protected Bindable ShowStoryboard { get; private set; } @@ -30,14 +32,12 @@ namespace osu.Game.Graphics.Containers /// public readonly Bindable StoryboardReplacesBackground = new Bindable(); - protected Container DimContainer { get; private set; } + protected Container DimContainer { get; } protected override Container Content => DimContainer; private readonly bool isStoryboard; - private const float background_fade_duration = 800; - /// /// Creates a new . /// @@ -48,9 +48,8 @@ namespace osu.Game.Graphics.Containers /// public UserDimContainer(bool isStoryboard = false) { - DimContainer = new Container { RelativeSizeAxes = Axes.Both }; this.isStoryboard = isStoryboard; - AddInternal(DimContainer); + AddInternal(DimContainer = new Container { RelativeSizeAxes = Axes.Both }); } [BackgroundDependencyLoader] diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 9333685e6c..5883f61982 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -8,6 +8,7 @@ using osu.Framework.Graphics.Textures; using osu.Game.Beatmaps; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; +using osu.Game.Users; namespace osu.Game.Screens.Backgrounds { @@ -22,7 +23,7 @@ namespace osu.Game.Screens.Backgrounds public readonly Bindable StoryboardReplacesBackground = new Bindable(); - protected UserDimContainer FadeContainer { get; private set; } + private readonly UserDimContainer fadeContainer; protected virtual UserDimContainer CreateFadeContainer() => new UserDimContainer { RelativeSizeAxes = Axes.Both }; @@ -50,9 +51,9 @@ namespace osu.Game.Screens.Backgrounds } b.Depth = newDepth; - FadeContainer.Add(Background = b); + fadeContainer.Add(Background = b); Background.BlurSigma = BlurTarget; - FadeContainer.StoryboardReplacesBackground.BindTo(StoryboardReplacesBackground); + StoryboardReplacesBackground.BindTo(fadeContainer.StoryboardReplacesBackground); })); }); } @@ -60,10 +61,9 @@ namespace osu.Game.Screens.Backgrounds public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null) { - FadeContainer = CreateFadeContainer(); - InternalChild = FadeContainer; - EnableUserDim.BindTo(FadeContainer.EnableUserDim); Beatmap = beatmap; + InternalChild = fadeContainer = CreateFadeContainer(); + fadeContainer.EnableUserDim.BindTo(EnableUserDim); } public override bool Equals(BackgroundScreen other) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 2880013b32..fe139fd9dd 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -72,7 +72,7 @@ namespace osu.Game.Screens.Play [Resolved] private ScoreManager scoreManager { get; set; } - private PauseContainer pauseContainer; + protected PauseContainer PauseContainer { get; private set; } private RulesetInfo ruleset; @@ -80,10 +80,10 @@ namespace osu.Game.Screens.Play private SampleChannel sampleRestart; - protected ScoreProcessor ScoreProcessor; - protected RulesetContainer RulesetContainer; + protected ScoreProcessor ScoreProcessor { get; private set; } + protected RulesetContainer RulesetContainer { get; private set; } - protected HUDOverlay HUDOverlay; + protected HUDOverlay HUDOverlay { get; private set; } private FailOverlay failOverlay; private DrawableStoryboard storyboard; @@ -175,7 +175,7 @@ namespace osu.Game.Screens.Play InternalChildren = new Drawable[] { - pauseContainer = new PauseContainer(offsetClock, adjustableClock) + PauseContainer = new PauseContainer(offsetClock, adjustableClock) { Retries = RestartCount, OnRetry = Restart, @@ -239,7 +239,7 @@ namespace osu.Game.Screens.Play HUDOverlay.HoldToQuit.Action = performUserRequestedExit; HUDOverlay.KeyCounter.Visible.BindTo(RulesetContainer.HasReplayLoaded); - RulesetContainer.IsPaused.BindTo(pauseContainer.IsPaused); + RulesetContainer.IsPaused.BindTo(PauseContainer.IsPaused); if (ShowStoryboard.Value) initializeStoryboard(false); @@ -357,7 +357,7 @@ namespace osu.Game.Screens.Play Background.EnableUserDim.Value = true; - storyboardReplacesBackground.BindTo(Background.StoryboardReplacesBackground); + Background.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground); StoryboardContainer.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground); storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable; @@ -372,7 +372,7 @@ namespace osu.Game.Screens.Play this.Delay(750).Schedule(() => { - if (!pauseContainer.IsPaused.Value) + if (!PauseContainer.IsPaused.Value) { adjustableClock.Start(); } @@ -380,8 +380,8 @@ namespace osu.Game.Screens.Play }); }); - pauseContainer.Alpha = 0; - pauseContainer.FadeIn(750, Easing.OutQuint); + PauseContainer.Alpha = 0; + PauseContainer.FadeIn(750, Easing.OutQuint); } public override void OnSuspending(IScreen next) @@ -399,7 +399,7 @@ namespace osu.Game.Screens.Play return true; } - if ((!AllowPause || HasFailed || !ValidForResume || pauseContainer?.IsPaused.Value != false || RulesetContainer?.HasReplayLoaded.Value != false) && (!pauseContainer?.IsResuming ?? true)) + if ((!AllowPause || HasFailed || !ValidForResume || PauseContainer?.IsPaused.Value != false || RulesetContainer?.HasReplayLoaded.Value != false) && (!PauseContainer?.IsResuming ?? true)) { // In the case of replays, we may have changed the playback rate. applyRateFromMods(); @@ -408,7 +408,7 @@ namespace osu.Game.Screens.Play } if (LoadedBeatmapSuccessfully) - pauseContainer?.Pause(); + PauseContainer?.Pause(); return true; } @@ -421,7 +421,7 @@ namespace osu.Game.Screens.Play storyboardReplacesBackground.Value = false; } - protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !pauseContainer.IsPaused.Value; + protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !PauseContainer.IsPaused.Value; private void initializeStoryboard(bool asyncLoad) { From c5270dd577cb607566d2aeeafb21b3d0de514d1f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Feb 2019 20:17:00 +0900 Subject: [PATCH 292/327] Remove unnecessary using --- osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 5883f61982..13d1ff39ef 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -8,7 +8,6 @@ using osu.Framework.Graphics.Textures; using osu.Game.Beatmaps; using osu.Game.Graphics.Backgrounds; using osu.Game.Graphics.Containers; -using osu.Game.Users; namespace osu.Game.Screens.Backgrounds { From 94199e628c70d812e4341819314b93ca770f8961 Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Thu, 28 Feb 2019 20:19:51 +0900 Subject: [PATCH 293/327] Only display SupportedWindowModes in settings --- .../Sections/Graphics/LayoutSettings.cs | 8 +++++--- osu.Game/Overlays/Settings/SettingsDropdown.cs | 17 ++++++++++++++++- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 53146ba102..61f8c1c634 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -11,6 +11,7 @@ using osu.Framework.Extensions.IEnumerableExtensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Platform; using osu.Game.Configuration; using osu.Game.Graphics.Containers; using osu.Game.Graphics.UserInterface; @@ -29,7 +30,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private OsuGameBase game; private SettingsDropdown resolutionDropdown; - private SettingsEnumDropdown windowModeDropdown; + private SettingsDropdown windowModeDropdown; private Bindable scalingPositionX; private Bindable scalingPositionY; @@ -39,7 +40,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private const int transition_duration = 400; [BackgroundDependencyLoader] - private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, OsuGameBase game) + private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, OsuGameBase game, GameHost host) { this.game = game; @@ -54,10 +55,11 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics Children = new Drawable[] { - windowModeDropdown = new SettingsEnumDropdown + windowModeDropdown = new SettingsDropdown { LabelText = "Screen mode", Bindable = config.GetBindable(FrameworkSetting.WindowMode), + ItemSource = host.Window.SupportedWindowModes, }, resolutionSettingsContainer = new Container { diff --git a/osu.Game/Overlays/Settings/SettingsDropdown.cs b/osu.Game/Overlays/Settings/SettingsDropdown.cs index 1829bbdcbc..de3f741cd7 100644 --- a/osu.Game/Overlays/Settings/SettingsDropdown.cs +++ b/osu.Game/Overlays/Settings/SettingsDropdown.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; @@ -26,11 +27,25 @@ namespace osu.Game.Overlays.Settings } } + private IBindableList itemSource; + + public IBindableList ItemSource + { + get => itemSource; + set + { + itemSource = value; + + if (Control != null) + Control.ItemSource = value; + } + } + public override IEnumerable FilterTerms => base.FilterTerms.Concat(Control.Items.Select(i => i.ToString())); protected sealed override Drawable CreateControl() => CreateDropdown(); - protected virtual OsuDropdown CreateDropdown() => new DropdownControl { Items = Items }; + protected virtual OsuDropdown CreateDropdown() => new DropdownControl { Items = Items, ItemSource = ItemSource }; protected class DropdownControl : OsuDropdown { From 6861163226851ae02d41c9529868f210ed80e455 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Feb 2019 20:21:27 +0900 Subject: [PATCH 294/327] Remove pointless method --- osu.Game/Screens/Play/Player.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index fe139fd9dd..94f0a91b1c 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -439,13 +439,6 @@ namespace osu.Game.Screens.Play StoryboardContainer.Add(storyboard); } - protected override void UpdateBackgroundElements() - { - if (!this.IsCurrentScreen()) return; - - base.UpdateBackgroundElements(); - } - protected virtual Results CreateResults(ScoreInfo score) => new SoloResults(score); } } From 86913e720fd92ee34edacea1b330f89f65f0a0c0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Feb 2019 20:24:09 +0900 Subject: [PATCH 295/327] Remove extra space --- osu.Game/Graphics/Containers/UserDimContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index e70bec1d2d..4d4b9da76f 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -39,7 +39,7 @@ namespace osu.Game.Graphics.Containers private readonly bool isStoryboard; /// - /// Creates a new . + /// Creates a new . /// /// /// Whether or not this instance of UserDimContainer contains a storyboard. From 53eb0e7e4e3adc354bae27005ea69b10ea895b74 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Feb 2019 20:30:23 +0900 Subject: [PATCH 296/327] More formatting fixes --- .../Graphics/Containers/UserDimContainer.cs | 25 ++++++++++--------- osu.Game/Screens/Play/Player.cs | 2 ++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index 4d4b9da76f..4c8928e122 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -18,9 +18,9 @@ namespace osu.Game.Graphics.Containers { private const float background_fade_duration = 800; - protected Bindable DimLevel { get; private set; } + private Bindable dimLevel { get; set; } - protected Bindable ShowStoryboard { get; private set; } + private Bindable showStoryboard { get; set; } /// /// Whether or not user-configured dim levels should be applied to the container. @@ -41,10 +41,11 @@ namespace osu.Game.Graphics.Containers /// /// Creates a new . /// - /// - /// Whether or not this instance of UserDimContainer contains a storyboard. - /// While both backgrounds and storyboards allow user dim levels to be applied, storyboards can be toggled via + /// Whether or not this instance of UserDimContainer contains a storyboard. + /// + /// While both backgrounds and storyboards allow user dim levels to be applied, storyboards can be toggled via /// and can cause backgrounds to become hidden via . + /// /// public UserDimContainer(bool isStoryboard = false) { @@ -55,11 +56,11 @@ namespace osu.Game.Graphics.Containers [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - DimLevel = config.GetBindable(OsuSetting.DimLevel); - ShowStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); + dimLevel = config.GetBindable(OsuSetting.DimLevel); + showStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); EnableUserDim.ValueChanged += _ => updateBackgroundDim(); - DimLevel.ValueChanged += _ => updateBackgroundDim(); - ShowStoryboard.ValueChanged += _ => updateBackgroundDim(); + dimLevel.ValueChanged += _ => updateBackgroundDim(); + showStoryboard.ValueChanged += _ => updateBackgroundDim(); StoryboardReplacesBackground.ValueChanged += _ => updateBackgroundDim(); } @@ -73,15 +74,15 @@ namespace osu.Game.Graphics.Containers { if (isStoryboard) { - DimContainer.FadeTo(!ShowStoryboard.Value || DimLevel.Value == 1 ? 0 : 1, background_fade_duration, Easing.OutQuint); + DimContainer.FadeTo(!showStoryboard.Value || dimLevel.Value == 1 ? 0 : 1, background_fade_duration, Easing.OutQuint); } else { // The background needs to be hidden in the case of it being replaced by the storyboard - DimContainer.FadeTo(ShowStoryboard.Value && StoryboardReplacesBackground.Value ? 0 : 1, background_fade_duration, Easing.OutQuint); + DimContainer.FadeTo(showStoryboard.Value && StoryboardReplacesBackground.Value ? 0 : 1, background_fade_duration, Easing.OutQuint); } - DimContainer.FadeColour(EnableUserDim.Value ? OsuColour.Gray(1 - (float)DimLevel.Value) : Color4.White, background_fade_duration, Easing.OutQuint); + DimContainer.FadeColour(EnableUserDim.Value ? OsuColour.Gray(1 - (float)dimLevel.Value) : Color4.White, background_fade_duration, Easing.OutQuint); } } } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 94f0a91b1c..27a888f58a 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -359,6 +359,7 @@ namespace osu.Game.Screens.Play Background.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground); StoryboardContainer.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground); + storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable; Task.Run(() => @@ -417,6 +418,7 @@ namespace osu.Game.Screens.Play { float fadeOutDuration = instant ? 0 : 250; this.FadeOut(fadeOutDuration); + Background.EnableUserDim.Value = false; storyboardReplacesBackground.Value = false; } From 30e820d107c9ddff861bdbae0d3bea47b6c60d04 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 28 Feb 2019 20:36:00 +0900 Subject: [PATCH 297/327] Fix storyboard potentially being loaded many times --- osu.Game/Screens/Play/Player.cs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 27a888f58a..bb2211a533 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -349,10 +349,9 @@ namespace osu.Game.Screens.Play .Delay(250) .FadeIn(250); - ShowStoryboard.ValueChanged += s => + ShowStoryboard.ValueChanged += enabled => { - if (s.NewValue && storyboard == null) - initializeStoryboard(true); + if (enabled.NewValue) initializeStoryboard(true); }; Background.EnableUserDim.Value = true; @@ -427,7 +426,7 @@ namespace osu.Game.Screens.Play private void initializeStoryboard(bool asyncLoad) { - if (StoryboardContainer == null) + if (StoryboardContainer == null || storyboard != null) return; var beatmap = Beatmap.Value; From b159e3ec310edb22553a9cdd5d823c634f2e1178 Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Thu, 28 Feb 2019 20:39:55 +0900 Subject: [PATCH 298/327] Fix headless tests --- osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 61f8c1c634..92e266a24b 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -59,7 +59,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { LabelText = "Screen mode", Bindable = config.GetBindable(FrameworkSetting.WindowMode), - ItemSource = host.Window.SupportedWindowModes, + ItemSource = host.Window?.SupportedWindowModes, }, resolutionSettingsContainer = new Container { From dfb3fef9e1ff6a79ca131b473248f79b2bf07e49 Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Thu, 28 Feb 2019 21:38:55 +0900 Subject: [PATCH 299/327] Hide WindowMode dropdown if only one is selectable --- .../Sections/Graphics/LayoutSettings.cs | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 92e266a24b..86bc965480 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -27,6 +27,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private Bindable scalingMode; private Bindable sizeFullscreen; + private readonly BindableList windowModes = new BindableList(); private OsuGameBase game; private SettingsDropdown resolutionDropdown; @@ -51,6 +52,9 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics scalingPositionX = osuConfig.GetBindable(OsuSetting.ScalingPositionX); scalingPositionY = osuConfig.GetBindable(OsuSetting.ScalingPositionY); + if (host.Window != null) + windowModes.BindTo(host.Window.SupportedWindowModes); + Container resolutionSettingsContainer; Children = new Drawable[] @@ -59,7 +63,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { LabelText = "Screen mode", Bindable = config.GetBindable(FrameworkSetting.WindowMode), - ItemSource = host.Window?.SupportedWindowModes, + ItemSource = windowModes, }, resolutionSettingsContainer = new Container { @@ -152,6 +156,19 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics scalingSettings.ForEach(s => s.TransferValueOnCommit = mode.NewValue == ScalingMode.Everything); }, true); + + windowModes.ItemsAdded += _ => windowModesChanged(); + windowModes.ItemsRemoved += _ => windowModesChanged(); + + windowModesChanged(); + } + + private void windowModesChanged() + { + if (windowModes.Count() > 1) + windowModeDropdown.Show(); + else + windowModeDropdown.Hide(); } /// From f1912a281c54166058667afa63efa753c1fd4934 Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Thu, 28 Feb 2019 21:46:49 +0900 Subject: [PATCH 300/327] Use Count property --- osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 86bc965480..58d2eb1f1e 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -165,7 +165,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private void windowModesChanged() { - if (windowModes.Count() > 1) + if (windowModes.Count > 1) windowModeDropdown.Show(); else windowModeDropdown.Hide(); From e634475bf4051c6acf9627ce5034b3629f16ba93 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Thu, 28 Feb 2019 23:40:03 +0900 Subject: [PATCH 301/327] IsDuel -> Dual --- osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs | 6 +++--- osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 8471bd5123..89abe11a18 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps protected override IEnumerable ValidConversionTypes { get; } = new[] { typeof(IHasXPosition) }; public int TargetColumns; - public bool IsDuel; + public bool Dual; public readonly bool IsForCurrentRuleset; // Internal for testing purposes @@ -51,7 +51,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps if (TargetColumns >= 10) { TargetColumns = TargetColumns / 2; - IsDuel = true; + Dual = true; } } else @@ -82,7 +82,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps { beatmap = new ManiaBeatmap(new StageDefinition { Columns = TargetColumns }); - if(IsDuel) + if(Dual) beatmap.Stages.Add(new StageDefinition { Columns = TargetColumns }); return beatmap; diff --git a/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs b/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs index bc2726760a..c78bf72979 100644 --- a/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs +++ b/osu.Game.Rulesets.Mania/Mods/ManiaModDualStages.cs @@ -27,7 +27,7 @@ namespace osu.Game.Rulesets.Mania.Mods if (isForCurrentRuleset) return; - mbc.IsDuel = true; + mbc.Dual = true; } public PlayfieldType PlayfieldType => PlayfieldType.Dual; From 67928ac1fe6e5dc170e1893e1d96e438e91830cf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 09:49:11 +0900 Subject: [PATCH 302/327] Remove pointless check --- osu.Game/Screens/Select/SongSelect.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 9d8e58a496..5d63524001 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -628,8 +628,6 @@ namespace osu.Game.Screens.Select private void clearScores(BeatmapInfo beatmap) { - if (BeatmapDetails.Leaderboard.Scope != BeatmapLeaderboardScope.Local) return; - if (beatmap == null || beatmap.ID <= 0) return; if (BeatmapDetails.Leaderboard.Scores == null || !BeatmapDetails.Leaderboard.Scores.Any()) return; From 80b5f1c5239277c0003c9bbedaf85be7832da620 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 09:49:36 +0900 Subject: [PATCH 303/327] Fix code formatting issues --- osu.Game/Screens/Select/BeatmapClearScoresDialog.cs | 3 +-- osu.Game/Screens/Select/SongSelect.cs | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs index c99e9eb428..aec6211076 100644 --- a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs +++ b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs @@ -7,7 +7,6 @@ using osu.Game.Graphics; using osu.Game.Overlays.Dialog; using osu.Game.Scoring; using System; -using System.Collections.Generic; using System.Linq; namespace osu.Game.Screens.Select @@ -26,7 +25,7 @@ namespace osu.Game.Screens.Select { BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}"; Icon = FontAwesome.fa_eraser; - HeaderText = $@"Clearing all local scores. Are you sure?"; + HeaderText = @"Clearing all local scores. Are you sure?"; Buttons = new PopupDialogButton[] { new PopupDialogOkButton diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 5d63524001..6697c1cebc 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -24,7 +24,6 @@ using osu.Game.Screens.Backgrounds; using osu.Game.Screens.Edit; using osu.Game.Screens.Menu; using osu.Game.Screens.Play; -using osu.Game.Screens.Select.Leaderboards; using osu.Game.Screens.Select.Options; using osu.Game.Skinning; using osuTK; From acc2113027edb05b31171aca8e2f0d0c7b7a9cbe Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 10:09:03 +0900 Subject: [PATCH 304/327] Make operation run asynchronously --- .../Select/BeatmapClearScoresDialog.cs | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs index aec6211076..d720a8c69a 100644 --- a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs +++ b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs @@ -8,20 +8,15 @@ using osu.Game.Overlays.Dialog; using osu.Game.Scoring; using System; using System.Linq; +using System.Threading.Tasks; namespace osu.Game.Screens.Select { public class BeatmapClearScoresDialog : PopupDialog { - private ScoreManager manager; + private ScoreManager scoreManager; - [BackgroundDependencyLoader] - private void load(ScoreManager scoreManager) - { - manager = scoreManager; - } - - public BeatmapClearScoresDialog(BeatmapInfo beatmap, Action refresh) + public BeatmapClearScoresDialog(BeatmapInfo beatmap, Action onCompletion) { BodyText = $@"{beatmap.Metadata?.Artist} - {beatmap.Metadata?.Title}"; Icon = FontAwesome.fa_eraser; @@ -33,8 +28,8 @@ namespace osu.Game.Screens.Select Text = @"Yes. Please.", Action = () => { - manager.Delete(manager.QueryScores(s => !s.DeletePending && s.Beatmap.ID == beatmap.ID).ToList()); - refresh(); + Task.Run(() => scoreManager.Delete(scoreManager.QueryScores(s => !s.DeletePending && s.Beatmap.ID == beatmap.ID).ToList())) + .ContinueWith(t => Schedule(onCompletion)); } }, new PopupDialogCancelButton @@ -43,5 +38,11 @@ namespace osu.Game.Screens.Select }, }; } + + [BackgroundDependencyLoader] + private void load(ScoreManager scoreManager) + { + this.scoreManager = scoreManager; + } } } From d4041d5d4225c0ec3b1999c93a8545dd540f3db3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 10:25:21 +0900 Subject: [PATCH 305/327] Automate includes of files in ArchiveModelManager use cases --- osu.Game/Beatmaps/BeatmapStore.cs | 11 ++++----- osu.Game/Database/ArchiveModelManager.cs | 2 +- ...ableDatabaseBackedStoreWithFileIncludes.cs | 23 +++++++++++++++++++ osu.Game/Scoring/ScoreStore.cs | 3 +-- osu.Game/Skinning/SkinStore.cs | 8 +------ 5 files changed, 31 insertions(+), 16 deletions(-) create mode 100644 osu.Game/Database/MutableDatabaseBackedStoreWithFileIncludes.cs diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs index 6786a780b6..f4b7b1d74f 100644 --- a/osu.Game/Beatmaps/BeatmapStore.cs +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -12,7 +12,7 @@ namespace osu.Game.Beatmaps /// /// Handles the storage and retrieval of Beatmaps/BeatmapSets to the database backing /// - public class BeatmapStore : MutableDatabaseBackedStore + public class BeatmapStore : MutableDatabaseBackedStoreWithFileIncludes { public event Action BeatmapHidden; public event Action BeatmapRestored; @@ -64,18 +64,17 @@ namespace osu.Game.Beatmaps protected override IQueryable AddIncludesForDeletion(IQueryable query) => base.AddIncludesForDeletion(query) - .Include(s => s.Beatmaps).ThenInclude(b => b.Metadata) - .Include(s => s.Beatmaps).ThenInclude(b => b.BaseDifficulty) .Include(s => s.Metadata) - .Include(s => s.Beatmaps).ThenInclude(b => b.Scores); + .Include(s => s.Beatmaps).ThenInclude(b => b.Scores) + .Include(s => s.Beatmaps).ThenInclude(b => b.BaseDifficulty) + .Include(s => s.Beatmaps).ThenInclude(b => b.Metadata); protected override IQueryable AddIncludesForConsumption(IQueryable query) => base.AddIncludesForConsumption(query) .Include(s => s.Metadata) .Include(s => s.Beatmaps).ThenInclude(s => s.Ruleset) .Include(s => s.Beatmaps).ThenInclude(b => b.BaseDifficulty) - .Include(s => s.Beatmaps).ThenInclude(b => b.Metadata) - .Include(s => s.Files).ThenInclude(f => f.FileInfo); + .Include(s => s.Beatmaps).ThenInclude(b => b.Metadata); protected override void Purge(List items, OsuDbContext context) { diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index 86c97df191..5b4a191682 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -108,7 +108,7 @@ namespace osu.Game.Database a.Invoke(); } - protected ArchiveModelManager(Storage storage, IDatabaseContextFactory contextFactory, MutableDatabaseBackedStore modelStore, IIpcHost importHost = null) + protected ArchiveModelManager(Storage storage, IDatabaseContextFactory contextFactory, MutableDatabaseBackedStoreWithFileIncludes modelStore, IIpcHost importHost = null) { ContextFactory = contextFactory; diff --git a/osu.Game/Database/MutableDatabaseBackedStoreWithFileIncludes.cs b/osu.Game/Database/MutableDatabaseBackedStoreWithFileIncludes.cs new file mode 100644 index 0000000000..3419a87507 --- /dev/null +++ b/osu.Game/Database/MutableDatabaseBackedStoreWithFileIncludes.cs @@ -0,0 +1,23 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Linq; +using Microsoft.EntityFrameworkCore; +using osu.Framework.Platform; + +namespace osu.Game.Database +{ + public abstract class MutableDatabaseBackedStoreWithFileIncludes : MutableDatabaseBackedStore + where T : class, IHasPrimaryKey, ISoftDelete, IHasFiles + where U : INamedFileInfo + { + protected MutableDatabaseBackedStoreWithFileIncludes(IDatabaseContextFactory contextFactory, Storage storage = null) + : base(contextFactory, storage) + { + } + + protected override IQueryable AddIncludesForConsumption(IQueryable query) => + base.AddIncludesForConsumption(query) + .Include(s => s.Files).ThenInclude(f => f.FileInfo); + } +} diff --git a/osu.Game/Scoring/ScoreStore.cs b/osu.Game/Scoring/ScoreStore.cs index 745bb6cc29..9627481f4d 100644 --- a/osu.Game/Scoring/ScoreStore.cs +++ b/osu.Game/Scoring/ScoreStore.cs @@ -8,7 +8,7 @@ using osu.Game.Database; namespace osu.Game.Scoring { - public class ScoreStore : MutableDatabaseBackedStore + public class ScoreStore : MutableDatabaseBackedStoreWithFileIncludes { public ScoreStore(IDatabaseContextFactory factory, Storage storage) : base(factory, storage) @@ -17,7 +17,6 @@ namespace osu.Game.Scoring protected override IQueryable AddIncludesForConsumption(IQueryable query) => base.AddIncludesForConsumption(query) - .Include(s => s.Files).ThenInclude(f => f.FileInfo) .Include(s => s.Beatmap) .Include(s => s.Ruleset); } diff --git a/osu.Game/Skinning/SkinStore.cs b/osu.Game/Skinning/SkinStore.cs index e80b03b935..31cadb0a24 100644 --- a/osu.Game/Skinning/SkinStore.cs +++ b/osu.Game/Skinning/SkinStore.cs @@ -1,22 +1,16 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Linq; -using Microsoft.EntityFrameworkCore; using osu.Framework.Platform; using osu.Game.Database; namespace osu.Game.Skinning { - public class SkinStore : MutableDatabaseBackedStore + public class SkinStore : MutableDatabaseBackedStoreWithFileIncludes { public SkinStore(DatabaseContextFactory contextFactory, Storage storage = null) : base(contextFactory, storage) { } - - protected override IQueryable AddIncludesForConsumption(IQueryable query) => - base.AddIncludesForConsumption(query) - .Include(s => s.Files).ThenInclude(f => f.FileInfo); } } From 0300f0d665dc8886f3f7f2f8a10e8df98ffe5914 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 10:47:45 +0900 Subject: [PATCH 306/327] Ensure deletions are correct without relying on FK cascade rule --- .../Database/MutableDatabaseBackedStoreWithFileIncludes.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Database/MutableDatabaseBackedStoreWithFileIncludes.cs b/osu.Game/Database/MutableDatabaseBackedStoreWithFileIncludes.cs index 3419a87507..5d6ff6b09b 100644 --- a/osu.Game/Database/MutableDatabaseBackedStoreWithFileIncludes.cs +++ b/osu.Game/Database/MutableDatabaseBackedStoreWithFileIncludes.cs @@ -19,5 +19,9 @@ namespace osu.Game.Database protected override IQueryable AddIncludesForConsumption(IQueryable query) => base.AddIncludesForConsumption(query) .Include(s => s.Files).ThenInclude(f => f.FileInfo); + + protected override IQueryable AddIncludesForDeletion(IQueryable query) => + base.AddIncludesForDeletion(query) + .Include(s => s.Files); // don't include FileInfo. these are handled by the FileStore itself. } } From 49cbaecf4c8f046c5f4058878ac0e4f41206a7dd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 10:52:53 +0900 Subject: [PATCH 307/327] Update licence header --- osu.Game/Screens/Select/BeatmapClearScoresDialog.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs index d720a8c69a..5fa50e00b9 100644 --- a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs +++ b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs @@ -1,5 +1,5 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; using osu.Game.Beatmaps; From f6303a28558cba4a0eee8b4b5695d18789d4e4f4 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 1 Mar 2019 11:49:04 +0900 Subject: [PATCH 308/327] Fix songselect blur potentially never being applied --- osu.Game/Screens/BlurrableBackgroundScreen.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/BlurrableBackgroundScreen.cs b/osu.Game/Screens/BlurrableBackgroundScreen.cs index cbd33136f1..d19e699acb 100644 --- a/osu.Game/Screens/BlurrableBackgroundScreen.cs +++ b/osu.Game/Screens/BlurrableBackgroundScreen.cs @@ -15,6 +15,9 @@ namespace osu.Game.Screens protected Vector2 BlurTarget; public TransformSequence BlurTo(Vector2 sigma, double duration, Easing easing = Easing.None) - => Background?.BlurTo(BlurTarget = sigma, duration, easing); + { + BlurTarget = sigma; + return Background?.BlurTo(BlurTarget, duration, easing); + } } } From 5d1eacf1c14d64cb00d66895d638f9adc5f390c8 Mon Sep 17 00:00:00 2001 From: Shane Woolcock Date: Fri, 1 Mar 2019 12:20:31 +0900 Subject: [PATCH 309/327] Ensure all OsuFocusedOverlayContainers contribute to screen fading --- .../Containers/OsuFocusedOverlayContainer.cs | 18 +++++++++--- osu.Game/OsuGame.cs | 29 ++++++++++++------- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 18d1bf3533..8e47bf2e99 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -24,7 +24,11 @@ namespace osu.Game.Graphics.Containers protected override bool BlockNonPositionalInput => true; - private PreviewTrackManager previewTrackManager; + [Resolved(CanBeNull = true)] + private OsuGame osuGame { get; set; } + + [Resolved] + private PreviewTrackManager previewTrackManager { get; set; } protected readonly Bindable OverlayActivationMode = new Bindable(OverlayActivation.All); @@ -36,10 +40,8 @@ namespace osu.Game.Graphics.Containers } [BackgroundDependencyLoader(true)] - private void load(OsuGame osuGame, AudioManager audio, PreviewTrackManager previewTrackManager) + private void load(AudioManager audio) { - this.previewTrackManager = previewTrackManager; - if (osuGame != null) OverlayActivationMode.BindTo(osuGame.OverlayActivationMode); @@ -93,6 +95,7 @@ namespace osu.Game.Graphics.Containers if (OverlayActivationMode.Value != OverlayActivation.Disabled) { if (PlaySamplesOnStateChange) samplePopIn?.Play(); + if (BlockScreenWideMouse) osuGame?.AddBlockingOverlay(this); } else State = Visibility.Hidden; @@ -100,6 +103,7 @@ namespace osu.Game.Graphics.Containers break; case Visibility.Hidden: if (PlaySamplesOnStateChange) samplePopOut?.Play(); + if (BlockScreenWideMouse) osuGame?.RemoveBlockingOverlay(this); break; } } @@ -109,5 +113,11 @@ namespace osu.Game.Graphics.Containers base.PopOut(); previewTrackManager.StopAnyPlaying(this); } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + osuGame?.RemoveBlockingOverlay(this); + } } } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index f7dbbfd152..dea9395e0f 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -110,6 +110,8 @@ namespace osu.Game private readonly List overlays = new List(); + private readonly List visibleBlockingOverlays = new List(); + // todo: move this to SongSelect once Screen has the ability to unsuspend. [Cached] [Cached(Type = typeof(IBindable>))] @@ -128,6 +130,23 @@ namespace osu.Game public void ToggleDirect() => direct.ToggleVisibility(); + private void updateBlockingOverlayFade() => + screenContainer.FadeColour(visibleBlockingOverlays.Any() ? OsuColour.Gray(0.5f) : Color4.White, 500, Easing.OutQuint); + + public void AddBlockingOverlay(OverlayContainer overlay) + { + if (!visibleBlockingOverlays.Contains(overlay)) + visibleBlockingOverlays.Add(overlay); + updateBlockingOverlayFade(); + } + + public void RemoveBlockingOverlay(OverlayContainer overlay) + { + if (visibleBlockingOverlays.Contains(overlay)) + visibleBlockingOverlays.Remove(overlay); + updateBlockingOverlayFade(); + } + /// /// Close all game-wide overlays. /// @@ -598,20 +617,10 @@ namespace osu.Game } private Task asyncLoadStream; - private int visibleOverlayCount; private void loadComponentSingleFile(T d, Action add) where T : Drawable { - if (d is FocusedOverlayContainer focused) - { - focused.StateChanged += s => - { - visibleOverlayCount += s == Visibility.Visible ? 1 : -1; - screenContainer.FadeColour(visibleOverlayCount > 0 ? OsuColour.Gray(0.5f) : Color4.White, 500, Easing.OutQuint); - }; - } - // schedule is here to ensure that all component loads are done after LoadComplete is run (and thus all dependencies are cached). // with some better organisation of LoadComplete to do construction and dependency caching in one step, followed by calls to loadComponentSingleFile, // we could avoid the need for scheduling altogether. From 7583279e08c7edd7e33130093b36e8edb9389ff8 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 1 Mar 2019 13:29:02 +0900 Subject: [PATCH 310/327] Remove unnecessary precondition --- osu.Game/OsuGame.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index dea9395e0f..bf9b4ced3b 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -142,8 +142,7 @@ namespace osu.Game public void RemoveBlockingOverlay(OverlayContainer overlay) { - if (visibleBlockingOverlays.Contains(overlay)) - visibleBlockingOverlays.Remove(overlay); + visibleBlockingOverlays.Remove(overlay); updateBlockingOverlayFade(); } From 19ce1f28696616e224467a5e450d103151fa86c0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 13:43:16 +0900 Subject: [PATCH 311/327] Remove second conditional --- osu.Game/Screens/Select/SongSelect.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index fd3c4e003e..c794d32d49 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -625,8 +625,6 @@ namespace osu.Game.Screens.Select { if (beatmap == null || beatmap.ID <= 0) return; - if (BeatmapDetails.Leaderboard.Scores == null || !BeatmapDetails.Leaderboard.Scores.Any()) return; - dialogOverlay?.Push(new BeatmapClearScoresDialog(beatmap, () => BeatmapDetails.Leaderboard.RefreshScores())); } From c722ea0299aa2de725b8669c1ece961ae96f9f83 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 1 Mar 2019 14:30:58 +0900 Subject: [PATCH 312/327] Add space --- osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs index 89abe11a18..71df68c087 100644 --- a/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs +++ b/osu.Game.Rulesets.Mania/Beatmaps/ManiaBeatmapConverter.cs @@ -82,7 +82,7 @@ namespace osu.Game.Rulesets.Mania.Beatmaps { beatmap = new ManiaBeatmap(new StageDefinition { Columns = TargetColumns }); - if(Dual) + if (Dual) beatmap.Stages.Add(new StageDefinition { Columns = TargetColumns }); return beatmap; From f7b6c014e4ed33b8f7ca4632eb5e1e4423a5bd33 Mon Sep 17 00:00:00 2001 From: build Date: Fri, 1 Mar 2019 14:46:48 +0900 Subject: [PATCH 313/327] Fastlane initial setup --- .gitignore | 1 + Gemfile | 6 ++ Gemfile.lock | 171 ++++++++++++++++++++++++++++++++++++++++++++ fastlane/Appfile | 2 + fastlane/Fastfile | 57 +++++++++++++++ fastlane/Matchfile | 1 + fastlane/Pluginfile | 6 ++ fastlane/README.md | 54 ++++++++++++++ osu.iOS.props | 4 +- osu.iOS/Info.plist | 24 +++---- 10 files changed, 312 insertions(+), 14 deletions(-) create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 fastlane/Appfile create mode 100644 fastlane/Fastfile create mode 100644 fastlane/Matchfile create mode 100644 fastlane/Pluginfile create mode 100644 fastlane/README.md diff --git a/.gitignore b/.gitignore index 6186cb870d..0e2850a01c 100644 --- a/.gitignore +++ b/.gitignore @@ -14,6 +14,7 @@ tools/** build/tools/** +fastlane/report.xml # Build results bin/[Dd]ebug/ diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000000..cdd3a6b349 --- /dev/null +++ b/Gemfile @@ -0,0 +1,6 @@ +source "https://rubygems.org" + +gem "fastlane" + +plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') +eval_gemfile(plugins_path) if File.exist?(plugins_path) diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000000..8962cbdefe --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,171 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.0) + addressable (2.6.0) + public_suffix (>= 2.0.2, < 4.0) + atomos (0.1.3) + babosa (1.0.2) + claide (1.0.2) + colored (1.2) + colored2 (3.1.2) + commander-fastlane (4.4.6) + highline (~> 1.7.2) + declarative (0.0.10) + declarative-option (0.1.0) + digest-crc (0.4.1) + domain_name (0.5.20180417) + unf (>= 0.0.5, < 1.0.0) + dotenv (2.7.1) + emoji_regex (1.0.1) + excon (0.62.0) + faraday (0.15.4) + multipart-post (>= 1.2, < 3) + faraday-cookie_jar (0.0.6) + faraday (>= 0.7.4) + http-cookie (~> 1.0.0) + faraday_middleware (0.13.1) + faraday (>= 0.7.4, < 1.0) + fastimage (2.1.5) + fastlane (2.116.1) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.3, < 3.0.0) + babosa (>= 1.0.2, < 2.0.0) + bundler (>= 1.12.0, < 3.0.0) + colored + commander-fastlane (>= 4.4.6, < 5.0.0) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 2.0) + excon (>= 0.45.0, < 1.0.0) + faraday (~> 0.9) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 0.9) + fastimage (>= 2.1.0, < 3.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-api-client (>= 0.21.2, < 0.24.0) + google-cloud-storage (>= 1.15.0, < 2.0.0) + highline (>= 1.7.2, < 2.0.0) + json (< 3.0.0) + mini_magick (~> 4.5.1) + multi_json + multi_xml (~> 0.5) + multipart-post (~> 2.0.0) + plist (>= 3.1.0, < 4.0.0) + public_suffix (~> 2.0.0) + rubyzip (>= 1.2.2, < 2.0.0) + security (= 0.1.3) + simctl (~> 1.6.3) + slack-notifier (>= 2.0.0, < 3.0.0) + terminal-notifier (>= 1.6.2, < 2.0.0) + terminal-table (>= 1.4.5, < 2.0.0) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.6.0, < 2.0.0) + xcpretty (~> 0.3.0) + xcpretty-travis-formatter (>= 0.0.3) + fastlane-plugin-clean_testflight_testers (0.2.0) + fastlane-plugin-souyuz (0.8.1) + souyuz (>= 0.8.1) + gh_inspector (1.1.3) + google-api-client (0.23.9) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.5, < 0.7.0) + httpclient (>= 2.8.1, < 3.0) + mime-types (~> 3.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.0) + signet (~> 0.9) + google-cloud-core (1.3.0) + google-cloud-env (~> 1.0) + google-cloud-env (1.0.5) + faraday (~> 0.11) + google-cloud-storage (1.16.0) + digest-crc (~> 0.4) + google-api-client (~> 0.23) + google-cloud-core (~> 1.2) + googleauth (>= 0.6.2, < 0.10.0) + googleauth (0.6.7) + faraday (~> 0.12) + jwt (>= 1.4, < 3.0) + memoist (~> 0.16) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (~> 0.7) + highline (1.7.10) + http-cookie (1.0.3) + domain_name (~> 0.5) + httpclient (2.8.3) + json (2.2.0) + jwt (2.1.0) + memoist (0.16.0) + mime-types (3.2.2) + mime-types-data (~> 3.2015) + mime-types-data (3.2018.0812) + mini_magick (4.5.1) + mini_portile2 (2.4.0) + multi_json (1.13.1) + multi_xml (0.6.0) + multipart-post (2.0.0) + nanaimo (0.2.6) + naturally (2.2.0) + nokogiri (1.10.1) + mini_portile2 (~> 2.4.0) + os (1.0.0) + plist (3.5.0) + public_suffix (2.0.5) + representable (3.0.4) + declarative (< 0.1.0) + declarative-option (< 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rouge (2.0.7) + rubyzip (1.2.2) + security (0.1.3) + signet (0.11.0) + addressable (~> 2.3) + faraday (~> 0.9) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + simctl (1.6.5) + CFPropertyList + naturally + slack-notifier (2.3.2) + souyuz (0.8.1) + fastlane (>= 2.29.0) + highline (~> 1.7) + nokogiri (~> 1.7) + terminal-notifier (1.8.0) + terminal-table (1.8.0) + unicode-display_width (~> 1.1, >= 1.1.1) + tty-cursor (0.6.1) + tty-screen (0.6.5) + tty-spinner (0.9.0) + tty-cursor (~> 0.6.0) + uber (0.1.0) + unf (0.1.4) + unf_ext + unf_ext (0.0.7.5) + unicode-display_width (1.4.1) + word_wrap (1.0.0) + xcodeproj (1.8.1) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.2.6) + xcpretty (0.3.0) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.0) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + ruby + +DEPENDENCIES + fastlane + fastlane-plugin-clean_testflight_testers + fastlane-plugin-souyuz + +BUNDLED WITH + 2.0.1 diff --git a/fastlane/Appfile b/fastlane/Appfile new file mode 100644 index 0000000000..083de66985 --- /dev/null +++ b/fastlane/Appfile @@ -0,0 +1,2 @@ +app_identifier("sh.ppy.osulazer") # The bundle identifier of your app +apple_id("apple-dev@ppy.sh") # Your Apple email address diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 0000000000..49f47135db --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,57 @@ +update_fastlane + +default_platform(:ios) + +platform :ios do + lane :clean_dryrun do + clean_testflight_testers(days_of_inactivity:45, dry_run: true) + end + + # Specify a custom number for what's "inactive" + lane :clean do + clean_testflight_testers(days_of_inactivity: 45) # 120 days, so about 4 months + end + + lane :update_version do |options| + options[:plist_path] = '../osu.iOS/Info.plist' + app_version(options) + end + + desc 'Deploy to testflight' + lane :beta do |options| + provision( + type: 'appstore' + ) + + build( + build_configuration: 'Release', + build_platform: 'iPhone' + ) + + pilot( + skip_waiting_for_build_processing: true, + changelog: "i am woot poot", + ipa: './osu.iOS/bin/iPhone/Release/osu.iOS.ipa' + ) + end + + desc 'Compile the project' + lane :build do + souyuz( + platform: "ios", + build_target: "osu_iOS", + plist_path: "../osu.iOS/Info.plist" + ) + end + + desc 'Install provisioning profiles using match' + lane :provision do |options| + if Helper.is_ci? + # CI should not do stuff in ADP + options[:readonly] = true + end + + # update provisioning profiles + match(options) + end +end diff --git a/fastlane/Matchfile b/fastlane/Matchfile new file mode 100644 index 0000000000..40c974b09e --- /dev/null +++ b/fastlane/Matchfile @@ -0,0 +1 @@ +git_url('https://github.com/peppy/apple-certificates') diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile new file mode 100644 index 0000000000..0b4207fc5f --- /dev/null +++ b/fastlane/Pluginfile @@ -0,0 +1,6 @@ +# Autogenerated by fastlane +# +# Ensure this file is checked in to source control! + +gem 'fastlane-plugin-clean_testflight_testers' +gem 'fastlane-plugin-souyuz' diff --git a/fastlane/README.md b/fastlane/README.md new file mode 100644 index 0000000000..70e5a52b1a --- /dev/null +++ b/fastlane/README.md @@ -0,0 +1,54 @@ +fastlane documentation +================ +# Installation + +Make sure you have the latest version of the Xcode command line tools installed: + +``` +xcode-select --install +``` + +Install _fastlane_ using +``` +[sudo] gem install fastlane -NV +``` +or alternatively using `brew cask install fastlane` + +# Available Actions +## iOS +### ios clean_dryrun +``` +fastlane ios clean_dryrun +``` + +### ios clean +``` +fastlane ios clean +``` + +### ios update_version +``` +fastlane ios update_version +``` + +### ios beta +``` +fastlane ios beta +``` +Deploy to testflight +### ios build +``` +fastlane ios build +``` +Compile the project +### ios provision +``` +fastlane ios provision +``` +Install provisioning profiles using match + +---- + +This README.md is auto-generated and will be re-generated every time [fastlane](https://fastlane.tools) is run. +More information about fastlane can be found on [fastlane.tools](https://fastlane.tools). +The documentation of fastlane can be found on [docs.fastlane.tools](https://docs.fastlane.tools). diff --git a/osu.iOS.props b/osu.iOS.props index 16eeb46683..099369f66a 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -35,7 +35,7 @@ prompt 4 - iPhone Developer + iPhone Distribution true true Entitlements.plist @@ -113,4 +113,4 @@ - \ No newline at end of file + diff --git a/osu.iOS/Info.plist b/osu.iOS/Info.plist index fe711fc03c..f0bd70b00f 100644 --- a/osu.iOS/Info.plist +++ b/osu.iOS/Info.plist @@ -2,6 +2,14 @@ + CFBundleIdentifier + sh.ppy.osulazer + CFBundleName + osu! + CFBundleShortVersionString + 0.1 + CFBundleVersion + 2019.301.0 LSRequiresIPhoneOS MinimumOSVersion @@ -17,6 +25,10 @@ armv7 + UIRequiresFullScreen + + UIStatusBarHidden + UISupportedInterfaceOrientations UIInterfaceOrientationPortrait @@ -26,17 +38,5 @@ XSAppIconAssets Assets.xcassets/AppIcon.appiconset - UIStatusBarHidden - - UIRequiresFullScreen - - CFBundleIdentifier - sh.ppy.osulazer - CFBundleName - osu! - CFBundleShortVersionString - 0.1 - CFBundleVersion - 0.1.1 From dd1bba5ad2a1a34882f890f3c0753980d4bfe0d4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 16:02:43 +0900 Subject: [PATCH 314/327] Add nuget restore --- Gemfile.lock | 2 ++ fastlane/Fastfile | 4 ++++ fastlane/Pluginfile | 1 + 3 files changed, 7 insertions(+) diff --git a/Gemfile.lock b/Gemfile.lock index 8962cbdefe..325c518231 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -67,6 +67,7 @@ GEM fastlane-plugin-clean_testflight_testers (0.2.0) fastlane-plugin-souyuz (0.8.1) souyuz (>= 0.8.1) + fastlane-plugin-xamarin (0.6.3) gh_inspector (1.1.3) google-api-client (0.23.9) addressable (~> 2.5, >= 2.5.1) @@ -166,6 +167,7 @@ DEPENDENCIES fastlane fastlane-plugin-clean_testflight_testers fastlane-plugin-souyuz + fastlane-plugin-xamarin BUNDLED WITH 2.0.1 diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 49f47135db..b176a1c52b 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -37,6 +37,10 @@ platform :ios do desc 'Compile the project' lane :build do + nuget_restore( + project_path: 'osu.iOS.sln' + ) + souyuz( platform: "ios", build_target: "osu_iOS", diff --git a/fastlane/Pluginfile b/fastlane/Pluginfile index 0b4207fc5f..9f4f47f213 100644 --- a/fastlane/Pluginfile +++ b/fastlane/Pluginfile @@ -4,3 +4,4 @@ gem 'fastlane-plugin-clean_testflight_testers' gem 'fastlane-plugin-souyuz' +gem 'fastlane-plugin-xamarin' From 43f1099e778c6546687950552f83679ee864d07b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 17:19:41 +0900 Subject: [PATCH 315/327] Automate change notes --- fastlane/Fastfile | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index b176a1c52b..81d39356bd 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -28,9 +28,13 @@ platform :ios do build_platform: 'iPhone' ) + client = HTTPClient.new + changelog = client.get_content 'https://gist.githubusercontent.com/peppy/ab89c29dcc0dce95f39eb218e8fad197/raw' + changelog.gsub!('$BUILD_ID', options[:build]) + pilot( - skip_waiting_for_build_processing: true, - changelog: "i am woot poot", + wait_processing_interval: 600, + changelog: changelog, ipa: './osu.iOS/bin/iPhone/Release/osu.iOS.ipa' ) end From a6ed64754ce522ee10a63b7bb660e943ea08b530 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 17:20:03 +0900 Subject: [PATCH 316/327] Reset bundle version --- osu.iOS/Info.plist | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.iOS/Info.plist b/osu.iOS/Info.plist index f0bd70b00f..0627feab78 100644 --- a/osu.iOS/Info.plist +++ b/osu.iOS/Info.plist @@ -9,7 +9,7 @@ CFBundleShortVersionString 0.1 CFBundleVersion - 2019.301.0 + 0.1.0 LSRequiresIPhoneOS MinimumOSVersion From 2dacd754a3b6e7d1a9a83dcb64645c4fcf4ab631 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 17:20:13 +0900 Subject: [PATCH 317/327] Update fastlane version --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index 325c518231..17c0db12e7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -27,7 +27,7 @@ GEM faraday_middleware (0.13.1) faraday (>= 0.7.4, < 1.0) fastimage (2.1.5) - fastlane (2.116.1) + fastlane (2.117.0) CFPropertyList (>= 2.3, < 4.0.0) addressable (>= 2.3, < 3.0.0) babosa (>= 1.0.2, < 2.0.0) From c0440ca4fe6aa326a36f8c316b9fc361fb3a1781 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 17:20:28 +0900 Subject: [PATCH 318/327] Always update version number in beta lane --- fastlane/Fastfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 81d39356bd..c33e44e877 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -19,6 +19,8 @@ platform :ios do desc 'Deploy to testflight' lane :beta do |options| + update_version(options) + provision( type: 'appstore' ) From 70d1c6fba4526e22eaf35fe4b6cde61368edee45 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 17:37:28 +0900 Subject: [PATCH 319/327] Wait longer --- fastlane/Fastfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index c33e44e877..78507b3aa9 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -35,7 +35,7 @@ platform :ios do changelog.gsub!('$BUILD_ID', options[:build]) pilot( - wait_processing_interval: 600, + wait_processing_interval: 900, changelog: changelog, ipa: './osu.iOS/bin/iPhone/Release/osu.iOS.ipa' ) From 0df49e6df370305155edc9498fbf31560bea5438 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 17:37:41 +0900 Subject: [PATCH 320/327] Clean up config further --- fastlane/Fastfile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 78507b3aa9..3f64bcdf19 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -3,12 +3,12 @@ update_fastlane default_platform(:ios) platform :ios do - lane :clean_dryrun do + lane :testflight_prune_dry do clean_testflight_testers(days_of_inactivity:45, dry_run: true) end # Specify a custom number for what's "inactive" - lane :clean do + lane :testflight_prune do clean_testflight_testers(days_of_inactivity: 45) # 120 days, so about 4 months end @@ -57,11 +57,9 @@ platform :ios do desc 'Install provisioning profiles using match' lane :provision do |options| if Helper.is_ci? - # CI should not do stuff in ADP options[:readonly] = true end - # update provisioning profiles match(options) end end From 521e2a30ae5ce3d8bb2f97624071426f169bcf08 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 18:16:17 +0900 Subject: [PATCH 321/327] Update readme --- fastlane/README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fastlane/README.md b/fastlane/README.md index 70e5a52b1a..53bbc62cae 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -16,14 +16,14 @@ or alternatively using `brew cask install fastlane` # Available Actions ## iOS -### ios clean_dryrun +### ios testflight_prune_dry ``` -fastlane ios clean_dryrun +fastlane ios testflight_prune_dry ``` -### ios clean +### ios testflight_prune ``` -fastlane ios clean +fastlane ios testflight_prune ``` ### ios update_version From 9885913fff0775f53c29c949f18946ddeba4f997 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 19:59:39 +0900 Subject: [PATCH 322/327] Fix iOS builds not being able to read their deploy version --- osu.Game/OsuGameBase.cs | 8 ++++---- osu.iOS/AppDelegate.cs | 4 ++-- osu.iOS/OsuGameIOS.cs | 14 ++++++++++++++ osu.iOS/osu.iOS.csproj | 1 + 4 files changed, 21 insertions(+), 6 deletions(-) create mode 100644 osu.iOS/OsuGameIOS.cs diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 487ef10ffb..43f18456d3 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -75,9 +75,9 @@ namespace osu.Game private Bindable fpsDisplayVisible; - protected AssemblyName AssemblyName => Assembly.GetEntryAssembly()?.GetName() ?? new AssemblyName { Version = new Version() }; + protected virtual Version AssemblyVersion => Assembly.GetEntryAssembly()?.GetName()?.Version ?? new Version(); - public bool IsDeployedBuild => AssemblyName.Version.Major > 0; + public bool IsDeployedBuild => AssemblyVersion.Major > 0; public string Version { @@ -86,8 +86,8 @@ namespace osu.Game if (!IsDeployedBuild) return @"local " + (DebugUtils.IsDebug ? @"debug" : @"release"); - var assembly = AssemblyName; - return $@"{assembly.Version.Major}.{assembly.Version.Minor}.{assembly.Version.Build}"; + var version = AssemblyVersion; + return $@"{version.Major}.{version.Minor}.{version.Build}"; } } diff --git a/osu.iOS/AppDelegate.cs b/osu.iOS/AppDelegate.cs index 97621e1e52..058e246ed8 100644 --- a/osu.iOS/AppDelegate.cs +++ b/osu.iOS/AppDelegate.cs @@ -1,4 +1,4 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using Foundation; @@ -10,6 +10,6 @@ namespace osu.iOS [Register("AppDelegate")] public class AppDelegate : GameAppDelegate { - protected override Framework.Game CreateGame() => new OsuGame(); + protected override Framework.Game CreateGame() => new OsuGameIOS(); } } diff --git a/osu.iOS/OsuGameIOS.cs b/osu.iOS/OsuGameIOS.cs new file mode 100644 index 0000000000..b94119af55 --- /dev/null +++ b/osu.iOS/OsuGameIOS.cs @@ -0,0 +1,14 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using Foundation; +using osu.Game; + +namespace osu.iOS +{ + public class OsuGameIOS : OsuGame + { + protected override Version AssemblyVersion => new Version(NSBundle.MainBundle.InfoDictionary["CFBundleVersion"].ToString()); + } +} diff --git a/osu.iOS/osu.iOS.csproj b/osu.iOS/osu.iOS.csproj index 9c69dd40ba..9df3ad5516 100644 --- a/osu.iOS/osu.iOS.csproj +++ b/osu.iOS/osu.iOS.csproj @@ -48,6 +48,7 @@ + From 431d43950055dab1891b19224a29d3fa20390241 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 20:15:09 +0900 Subject: [PATCH 323/327] Make attribute public --- osu.Game/OsuGameBase.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 43f18456d3..643a673faf 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -75,7 +75,7 @@ namespace osu.Game private Bindable fpsDisplayVisible; - protected virtual Version AssemblyVersion => Assembly.GetEntryAssembly()?.GetName()?.Version ?? new Version(); + public virtual Version AssemblyVersion => Assembly.GetEntryAssembly()?.GetName().Version ?? new Version(); public bool IsDeployedBuild => AssemblyVersion.Major > 0; From 02fb41a3123a23670108a92cbfaf0fa828ec8f42 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 1 Mar 2019 20:17:39 +0900 Subject: [PATCH 324/327] Use style heuristics --- osu.sln.DotSettings | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index a4551422cb..5363d6dddf 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -219,7 +219,7 @@ Code Cleanup (peppy) ExpressionBody ExpressionBody - False + True True True True From c01990d00587ba3f652ae4623c8a2d13de562860 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 20:52:34 +0900 Subject: [PATCH 325/327] Fix callback potentially not getting fired --- osu.Game/Screens/Select/BeatmapClearScoresDialog.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs index 5fa50e00b9..a37327f2c3 100644 --- a/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs +++ b/osu.Game/Screens/Select/BeatmapClearScoresDialog.cs @@ -29,7 +29,7 @@ namespace osu.Game.Screens.Select Action = () => { Task.Run(() => scoreManager.Delete(scoreManager.QueryScores(s => !s.DeletePending && s.Beatmap.ID == beatmap.ID).ToList())) - .ContinueWith(t => Schedule(onCompletion)); + .ContinueWith(_ => onCompletion); } }, new PopupDialogCancelButton diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index c794d32d49..866c7e0926 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -625,7 +625,9 @@ namespace osu.Game.Screens.Select { if (beatmap == null || beatmap.ID <= 0) return; - dialogOverlay?.Push(new BeatmapClearScoresDialog(beatmap, () => BeatmapDetails.Leaderboard.RefreshScores())); + dialogOverlay?.Push(new BeatmapClearScoresDialog(beatmap, () => + // schedule done here rather than inside the dialog as the dialog may fade out and never callback. + Schedule(() => BeatmapDetails.Leaderboard.RefreshScores()))); } public override bool OnPressed(GlobalAction action) From 7f1f812f297a155328cb5a37d29bfb7c302285c5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 22:06:42 +0900 Subject: [PATCH 326/327] Update framework --- osu.Game/osu.Game.csproj | 2 +- osu.iOS.props | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index f8d89ec8a5..8f9a7cd14b 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -16,7 +16,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 099369f66a..499878347b 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From 180aee6048e69c7119849a9037a85fbcefaa3137 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 23:20:34 +0900 Subject: [PATCH 327/327] Fix iOS build --- osu.iOS/OsuGameIOS.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.iOS/OsuGameIOS.cs b/osu.iOS/OsuGameIOS.cs index b94119af55..6cf18df9a6 100644 --- a/osu.iOS/OsuGameIOS.cs +++ b/osu.iOS/OsuGameIOS.cs @@ -9,6 +9,6 @@ namespace osu.iOS { public class OsuGameIOS : OsuGame { - protected override Version AssemblyVersion => new Version(NSBundle.MainBundle.InfoDictionary["CFBundleVersion"].ToString()); + public override Version AssemblyVersion => new Version(NSBundle.MainBundle.InfoDictionary["CFBundleVersion"].ToString()); } }