From 6f8a2e6ff240ef63505f3bcf2f84c03e786a4b68 Mon Sep 17 00:00:00 2001 From: ekrctb Date: Thu, 13 Dec 2018 14:55:28 +0900 Subject: [PATCH 001/185] 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 002/185] 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 003/185] 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 004/185] 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 005/185] 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 006/185] 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 007/185] 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 008/185] 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 4a9bcf4937f7f8a1477ac97d5951002342cdb310 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 23 Jan 2019 11:38:48 +0100 Subject: [PATCH 009/185] rename OsuConfigManager to GameConfigManager also OsuSetting to GameSetting --- osu.Desktop/Overlays/VersionManager.cs | 8 +- .../Objects/Drawables/DrawableSlider.cs | 6 +- .../UI/Cursor/GameplayCursor.cs | 6 +- osu.Game.Rulesets.Osu/UI/OsuSettings.cs | 6 +- osu.Game/Configuration/GameConfigManager.cs | 175 ++++++++++++++++++ osu.Game/Configuration/OsuConfigManager.cs | 175 ------------------ .../Graphics/Containers/ParallaxContainer.cs | 4 +- .../Graphics/Containers/ScalingContainer.cs | 16 +- osu.Game/Graphics/Cursor/MenuCursor.cs | 8 +- osu.Game/Graphics/ScreenshotManager.cs | 6 +- osu.Game/Online/API/APIAccess.cs | 12 +- osu.Game/Online/Chat/ExternalLinkOpener.cs | 4 +- osu.Game/OsuGame.cs | 8 +- osu.Game/OsuGameBase.cs | 6 +- osu.Game/Overlays/ChatOverlay.cs | 4 +- osu.Game/Overlays/OnScreenDisplay.cs | 4 +- .../Sections/Audio/MainMenuSettings.cs | 6 +- .../Settings/Sections/Audio/OffsetSettings.cs | 4 +- .../Settings/Sections/Audio/VolumeSettings.cs | 4 +- .../Sections/Gameplay/GeneralSettings.cs | 12 +- .../Sections/Gameplay/ModsSettings.cs | 4 +- .../Sections/Gameplay/SongSelectSettings.cs | 12 +- .../Sections/General/LoginSettings.cs | 6 +- .../Sections/General/UpdateSettings.cs | 4 +- .../Sections/Graphics/DetailSettings.cs | 10 +- .../Sections/Graphics/LayoutSettings.cs | 16 +- .../Sections/Graphics/MainMenuSettings.cs | 4 +- .../Sections/Graphics/RendererSettings.cs | 4 +- .../Settings/Sections/Input/MouseSettings.cs | 6 +- .../Settings/Sections/Online/WebSettings.cs | 4 +- .../Overlays/Settings/Sections/SkinSection.cs | 16 +- osu.Game/Rulesets/Mods/IReadFromConfig.cs | 2 +- osu.Game/Rulesets/Mods/ModHidden.cs | 4 +- osu.Game/Rulesets/UI/RulesetContainer.cs | 4 +- osu.Game/Rulesets/UI/RulesetInputManager.cs | 4 +- osu.Game/Screens/Menu/Intro.cs | 6 +- osu.Game/Screens/Play/HUDOverlay.cs | 4 +- osu.Game/Screens/Play/KeyCounterCollection.cs | 4 +- osu.Game/Screens/Play/Player.cs | 8 +- .../Play/PlayerSettings/DiscussionSettings.cs | 4 +- .../Play/PlayerSettings/InputSettings.cs | 2 +- .../Play/PlayerSettings/VisualSettings.cs | 12 +- .../Play/ScreenWithBeatmapBackground.cs | 8 +- osu.Game/Screens/Select/BeatmapCarousel.cs | 6 +- .../Select/BeatmapDetailAreaTabControl.cs | 4 +- osu.Game/Screens/Select/FilterControl.cs | 4 +- .../Skinning/LocalSkinOverrideContainer.cs | 6 +- 47 files changed, 321 insertions(+), 321 deletions(-) create mode 100644 osu.Game/Configuration/GameConfigManager.cs delete mode 100644 osu.Game/Configuration/OsuConfigManager.cs diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index c1fd34d009..bce1f85dc0 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -22,13 +22,13 @@ namespace osu.Desktop.Overlays { public class VersionManager : OverlayContainer { - private OsuConfigManager config; + private GameConfigManager config; private OsuGameBase game; private NotificationOverlay notificationOverlay; private GameHost host; [BackgroundDependencyLoader] - private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config, GameHost host) + private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, GameConfigManager config, GameHost host) { notificationOverlay = notification; this.config = config; @@ -95,10 +95,10 @@ namespace osu.Desktop.Overlays base.LoadComplete(); var version = game.Version; - var lastVersion = config.Get(OsuSetting.Version); + var lastVersion = config.Get(GameSetting.Version); if (game.IsDeployedBuild && version != lastVersion) { - config.Set(OsuSetting.Version, version); + config.Set(GameSetting.Version, version); // only show a notification if we've previously saved a version to the config file (ie. not the first run). if (!string.IsNullOrEmpty(lastVersion)) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 60377e373a..dafb54ff64 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -93,10 +93,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { - config.BindWith(OsuSetting.SnakingInSliders, Body.SnakingIn); - config.BindWith(OsuSetting.SnakingOutSliders, Body.SnakingOut); + config.BindWith(GameSetting.SnakingInSliders, Body.SnakingIn); + config.BindWith(GameSetting.SnakingOutSliders, Body.SnakingOut); positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); scaleBindable.BindValueChanged(v => diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs index 80beb62d6c..582b99af7c 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs @@ -112,7 +112,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor } [BackgroundDependencyLoader] - private void load(OsuConfigManager config, IBindableBeatmap beatmap) + private void load(GameConfigManager config, IBindableBeatmap beatmap) { InternalChild = expandTarget = new Container { @@ -185,10 +185,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor this.beatmap.BindTo(beatmap); this.beatmap.ValueChanged += v => calculateScale(); - cursorScale = config.GetBindable(OsuSetting.GameplayCursorSize); + cursorScale = config.GetBindable(GameSetting.GameplayCursorSize); cursorScale.ValueChanged += v => calculateScale(); - autoCursorScale = config.GetBindable(OsuSetting.AutoCursorSize); + autoCursorScale = config.GetBindable(GameSetting.AutoCursorSize); autoCursorScale.ValueChanged += v => calculateScale(); calculateScale(); diff --git a/osu.Game.Rulesets.Osu/UI/OsuSettings.cs b/osu.Game.Rulesets.Osu/UI/OsuSettings.cs index 25c009b117..ae0b3ef4dd 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuSettings.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuSettings.cs @@ -18,19 +18,19 @@ namespace osu.Game.Rulesets.Osu.UI } [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { Children = new Drawable[] { new SettingsCheckbox { LabelText = "Snaking in sliders", - Bindable = config.GetBindable(OsuSetting.SnakingInSliders) + Bindable = config.GetBindable(GameSetting.SnakingInSliders) }, new SettingsCheckbox { LabelText = "Snaking out sliders", - Bindable = config.GetBindable(OsuSetting.SnakingOutSliders) + Bindable = config.GetBindable(GameSetting.SnakingOutSliders) }, }; } diff --git a/osu.Game/Configuration/GameConfigManager.cs b/osu.Game/Configuration/GameConfigManager.cs new file mode 100644 index 0000000000..736273dc35 --- /dev/null +++ b/osu.Game/Configuration/GameConfigManager.cs @@ -0,0 +1,175 @@ +// Copyright (c) 2007-2018 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Framework.Configuration; +using osu.Framework.Configuration.Tracking; +using osu.Framework.Extensions; +using osu.Framework.Platform; +using osu.Game.Overlays; +using osu.Game.Rulesets.Scoring; +using osu.Game.Screens.Select; + +namespace osu.Game.Configuration +{ + public class GameConfigManager : IniConfigManager + { + protected override void InitialiseDefaults() + { + // UI/selection defaults + Set(GameSetting.Ruleset, 0, 0, int.MaxValue); + Set(GameSetting.Skin, 0, 0, int.MaxValue); + + Set(GameSetting.BeatmapDetailTab, BeatmapDetailTab.Details); + + Set(GameSetting.ShowConvertedBeatmaps, true); + Set(GameSetting.DisplayStarsMinimum, 0.0, 0, 10, 0.1); + Set(GameSetting.DisplayStarsMaximum, 10.0, 0, 10, 0.1); + + Set(GameSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation); + + Set(GameSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1); + + // Online settings + Set(GameSetting.Username, string.Empty); + Set(GameSetting.Token, string.Empty); + + Set(GameSetting.SavePassword, false).ValueChanged += val => + { + if (val) Set(GameSetting.SaveUsername, true); + }; + + Set(GameSetting.SaveUsername, true).ValueChanged += val => + { + if (!val) Set(GameSetting.SavePassword, false); + }; + + Set(GameSetting.ExternalLinkWarning, true); + + // Audio + Set(GameSetting.VolumeInactive, 0.25, 0, 1, 0.01); + + Set(GameSetting.MenuVoice, true); + Set(GameSetting.MenuMusic, true); + + Set(GameSetting.AudioOffset, 0, -500.0, 500.0, 1); + + // Input + Set(GameSetting.MenuCursorSize, 1.0, 0.5f, 2, 0.01); + Set(GameSetting.GameplayCursorSize, 1.0, 0.5f, 2, 0.01); + Set(GameSetting.AutoCursorSize, false); + + Set(GameSetting.MouseDisableButtons, false); + Set(GameSetting.MouseDisableWheel, false); + + // Graphics + Set(GameSetting.ShowFpsDisplay, false); + + Set(GameSetting.ShowStoryboard, true); + Set(GameSetting.BeatmapSkins, true); + Set(GameSetting.BeatmapHitsounds, true); + + Set(GameSetting.CursorRotation, true); + + Set(GameSetting.MenuParallax, true); + + Set(GameSetting.SnakingInSliders, true); + Set(GameSetting.SnakingOutSliders, true); + + // Gameplay + Set(GameSetting.DimLevel, 0.3, 0, 1, 0.01); + Set(GameSetting.BlurLevel, 0, 0, 1, 0.01); + + Set(GameSetting.ShowInterface, true); + Set(GameSetting.KeyOverlay, false); + + Set(GameSetting.FloatingComments, false); + + Set(GameSetting.ScoreDisplayMode, ScoringMode.Standardised); + + Set(GameSetting.IncreaseFirstObjectVisibility, true); + + // Update + Set(GameSetting.ReleaseStream, ReleaseStream.Lazer); + + Set(GameSetting.Version, string.Empty); + + Set(GameSetting.ScreenshotFormat, ScreenshotFormat.Jpg); + Set(GameSetting.ScreenshotCaptureMenuCursor, false); + + Set(GameSetting.SongSelectRightMouseScroll, false); + + Set(GameSetting.Scaling, ScalingMode.Off); + + Set(GameSetting.ScalingSizeX, 0.8f, 0.2f, 1f); + Set(GameSetting.ScalingSizeY, 0.8f, 0.2f, 1f); + + Set(GameSetting.ScalingPositionX, 0.5f, 0f, 1f); + Set(GameSetting.ScalingPositionY, 0.5f, 0f, 1f); + + Set(GameSetting.UIScale, 1f, 0.8f, 1.6f, 0.01f); + } + + public GameConfigManager(Storage storage) + : base(storage) + { + } + + public override TrackedSettings CreateTrackedSettings() => new TrackedSettings + { + new TrackedSetting(GameSetting.MouseDisableButtons, v => new SettingDescription(!v, "gameplay mouse buttons", v ? "disabled" : "enabled")), + new TrackedSetting(GameSetting.Scaling, m => new SettingDescription(m, "scaling", m.GetDescription())), + }; + } + + public enum GameSetting + { + Ruleset, + Token, + MenuCursorSize, + GameplayCursorSize, + AutoCursorSize, + DimLevel, + BlurLevel, + ShowStoryboard, + KeyOverlay, + FloatingComments, + ShowInterface, + MouseDisableButtons, + MouseDisableWheel, + AudioOffset, + VolumeInactive, + MenuMusic, + MenuVoice, + CursorRotation, + MenuParallax, + BeatmapDetailTab, + Username, + ReleaseStream, + SavePassword, + SaveUsername, + DisplayStarsMinimum, + DisplayStarsMaximum, + RandomSelectAlgorithm, + SnakingInSliders, + SnakingOutSliders, + ShowFpsDisplay, + ChatDisplayHeight, + Version, + ShowConvertedBeatmaps, + Skin, + ScreenshotFormat, + ScreenshotCaptureMenuCursor, + SongSelectRightMouseScroll, + BeatmapSkins, + BeatmapHitsounds, + IncreaseFirstObjectVisibility, + ScoreDisplayMode, + ExternalLinkWarning, + Scaling, + ScalingPositionX, + ScalingPositionY, + ScalingSizeX, + ScalingSizeY, + UIScale + } +} diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs deleted file mode 100644 index 1b279eee44..0000000000 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Configuration; -using osu.Framework.Configuration.Tracking; -using osu.Framework.Extensions; -using osu.Framework.Platform; -using osu.Game.Overlays; -using osu.Game.Rulesets.Scoring; -using osu.Game.Screens.Select; - -namespace osu.Game.Configuration -{ - public class OsuConfigManager : IniConfigManager - { - protected override void InitialiseDefaults() - { - // UI/selection defaults - Set(OsuSetting.Ruleset, 0, 0, int.MaxValue); - Set(OsuSetting.Skin, 0, 0, int.MaxValue); - - Set(OsuSetting.BeatmapDetailTab, BeatmapDetailTab.Details); - - Set(OsuSetting.ShowConvertedBeatmaps, true); - Set(OsuSetting.DisplayStarsMinimum, 0.0, 0, 10, 0.1); - Set(OsuSetting.DisplayStarsMaximum, 10.0, 0, 10, 0.1); - - Set(OsuSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation); - - Set(OsuSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1); - - // Online settings - Set(OsuSetting.Username, string.Empty); - Set(OsuSetting.Token, string.Empty); - - Set(OsuSetting.SavePassword, false).ValueChanged += val => - { - if (val) Set(OsuSetting.SaveUsername, true); - }; - - Set(OsuSetting.SaveUsername, true).ValueChanged += val => - { - if (!val) Set(OsuSetting.SavePassword, false); - }; - - Set(OsuSetting.ExternalLinkWarning, true); - - // Audio - Set(OsuSetting.VolumeInactive, 0.25, 0, 1, 0.01); - - Set(OsuSetting.MenuVoice, true); - Set(OsuSetting.MenuMusic, true); - - Set(OsuSetting.AudioOffset, 0, -500.0, 500.0, 1); - - // Input - Set(OsuSetting.MenuCursorSize, 1.0, 0.5f, 2, 0.01); - Set(OsuSetting.GameplayCursorSize, 1.0, 0.5f, 2, 0.01); - Set(OsuSetting.AutoCursorSize, false); - - Set(OsuSetting.MouseDisableButtons, false); - Set(OsuSetting.MouseDisableWheel, false); - - // Graphics - Set(OsuSetting.ShowFpsDisplay, false); - - Set(OsuSetting.ShowStoryboard, true); - Set(OsuSetting.BeatmapSkins, true); - Set(OsuSetting.BeatmapHitsounds, true); - - Set(OsuSetting.CursorRotation, true); - - Set(OsuSetting.MenuParallax, true); - - Set(OsuSetting.SnakingInSliders, true); - Set(OsuSetting.SnakingOutSliders, true); - - // Gameplay - Set(OsuSetting.DimLevel, 0.3, 0, 1, 0.01); - Set(OsuSetting.BlurLevel, 0, 0, 1, 0.01); - - Set(OsuSetting.ShowInterface, true); - Set(OsuSetting.KeyOverlay, false); - - Set(OsuSetting.FloatingComments, false); - - Set(OsuSetting.ScoreDisplayMode, ScoringMode.Standardised); - - Set(OsuSetting.IncreaseFirstObjectVisibility, true); - - // Update - Set(OsuSetting.ReleaseStream, ReleaseStream.Lazer); - - Set(OsuSetting.Version, string.Empty); - - Set(OsuSetting.ScreenshotFormat, ScreenshotFormat.Jpg); - Set(OsuSetting.ScreenshotCaptureMenuCursor, false); - - Set(OsuSetting.SongSelectRightMouseScroll, false); - - Set(OsuSetting.Scaling, ScalingMode.Off); - - Set(OsuSetting.ScalingSizeX, 0.8f, 0.2f, 1f); - Set(OsuSetting.ScalingSizeY, 0.8f, 0.2f, 1f); - - Set(OsuSetting.ScalingPositionX, 0.5f, 0f, 1f); - Set(OsuSetting.ScalingPositionY, 0.5f, 0f, 1f); - - Set(OsuSetting.UIScale, 1f, 0.8f, 1.6f, 0.01f); - } - - public OsuConfigManager(Storage storage) - : base(storage) - { - } - - public override TrackedSettings CreateTrackedSettings() => new TrackedSettings - { - new TrackedSetting(OsuSetting.MouseDisableButtons, v => new SettingDescription(!v, "gameplay mouse buttons", v ? "disabled" : "enabled")), - new TrackedSetting(OsuSetting.Scaling, m => new SettingDescription(m, "scaling", m.GetDescription())), - }; - } - - public enum OsuSetting - { - Ruleset, - Token, - MenuCursorSize, - GameplayCursorSize, - AutoCursorSize, - DimLevel, - BlurLevel, - ShowStoryboard, - KeyOverlay, - FloatingComments, - ShowInterface, - MouseDisableButtons, - MouseDisableWheel, - AudioOffset, - VolumeInactive, - MenuMusic, - MenuVoice, - CursorRotation, - MenuParallax, - BeatmapDetailTab, - Username, - ReleaseStream, - SavePassword, - SaveUsername, - DisplayStarsMinimum, - DisplayStarsMaximum, - RandomSelectAlgorithm, - SnakingInSliders, - SnakingOutSliders, - ShowFpsDisplay, - ChatDisplayHeight, - Version, - ShowConvertedBeatmaps, - Skin, - ScreenshotFormat, - ScreenshotCaptureMenuCursor, - SongSelectRightMouseScroll, - BeatmapSkins, - BeatmapHitsounds, - IncreaseFirstObjectVisibility, - ScoreDisplayMode, - ExternalLinkWarning, - Scaling, - ScalingPositionX, - ScalingPositionY, - ScalingSizeX, - ScalingSizeY, - UIScale - } -} diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index 97e12ec0f9..40da8a9afb 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -40,9 +40,9 @@ namespace osu.Game.Graphics.Containers protected override Container Content => content; [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { - parallaxEnabled = config.GetBindable(OsuSetting.MenuParallax); + parallaxEnabled = config.GetBindable(GameSetting.MenuParallax); parallaxEnabled.ValueChanged += delegate { if (!parallaxEnabled) diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index 62760b39ea..fe49f282f0 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -65,11 +65,11 @@ namespace osu.Game.Graphics.Containers } [BackgroundDependencyLoader] - private void load(OsuConfigManager osuConfig) + private void load(GameConfigManager gameConfig) { if (applyUIScale) { - uiScale = osuConfig.GetBindable(OsuSetting.UIScale); + uiScale = gameConfig.GetBindable(GameSetting.UIScale); uiScale.BindValueChanged(scaleChanged, true); } } @@ -82,21 +82,21 @@ namespace osu.Game.Graphics.Containers } [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { - scalingMode = config.GetBindable(OsuSetting.Scaling); + scalingMode = config.GetBindable(GameSetting.Scaling); scalingMode.ValueChanged += _ => updateSize(); - sizeX = config.GetBindable(OsuSetting.ScalingSizeX); + sizeX = config.GetBindable(GameSetting.ScalingSizeX); sizeX.ValueChanged += _ => updateSize(); - sizeY = config.GetBindable(OsuSetting.ScalingSizeY); + sizeY = config.GetBindable(GameSetting.ScalingSizeY); sizeY.ValueChanged += _ => updateSize(); - posX = config.GetBindable(OsuSetting.ScalingPositionX); + posX = config.GetBindable(GameSetting.ScalingPositionX); posX.ValueChanged += _ => updateSize(); - posY = config.GetBindable(OsuSetting.ScalingPositionY); + posY = config.GetBindable(GameSetting.ScalingPositionY); posY.ValueChanged += _ => updateSize(); } diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index 87d97806cd..a609249db3 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -31,9 +31,9 @@ namespace osu.Game.Graphics.Cursor private Vector2 positionMouseDown; [BackgroundDependencyLoader(true)] - private void load([NotNull] OsuConfigManager config, [CanBeNull] ScreenshotManager screenshotManager) + private void load([NotNull] GameConfigManager config, [CanBeNull] ScreenshotManager screenshotManager) { - cursorRotate = config.GetBindable(OsuSetting.CursorRotation); + cursorRotate = config.GetBindable(GameSetting.CursorRotation); if (screenshotManager != null) screenshotCursorVisibility.BindTo(screenshotManager.CursorVisibility); @@ -131,7 +131,7 @@ namespace osu.Game.Graphics.Cursor } [BackgroundDependencyLoader] - private void load(OsuConfigManager config, TextureStore textures, OsuColour colour) + private void load(GameConfigManager config, TextureStore textures, OsuColour colour) { Children = new Drawable[] { @@ -155,7 +155,7 @@ namespace osu.Game.Graphics.Cursor } }; - cursorScale = config.GetBindable(OsuSetting.MenuCursorSize); + cursorScale = config.GetBindable(GameSetting.MenuCursorSize); cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale * base_scale); cursorScale.TriggerChange(); } diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index be253f65c1..6d1be73e91 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -42,14 +42,14 @@ namespace osu.Game.Graphics private SampleChannel shutter; [BackgroundDependencyLoader] - private void load(GameHost host, OsuConfigManager config, Storage storage, NotificationOverlay notificationOverlay, AudioManager audio) + private void load(GameHost host, GameConfigManager config, Storage storage, NotificationOverlay notificationOverlay, AudioManager audio) { this.host = host; this.storage = storage.GetStorageForDirectory(@"screenshots"); this.notificationOverlay = notificationOverlay; - screenshotFormat = config.GetBindable(OsuSetting.ScreenshotFormat); - captureMenuCursor = config.GetBindable(OsuSetting.ScreenshotCaptureMenuCursor); + screenshotFormat = config.GetBindable(GameSetting.ScreenshotFormat); + captureMenuCursor = config.GetBindable(GameSetting.ScreenshotCaptureMenuCursor); shutter = audio.Sample.Get("UI/shutter"); } diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index db273dd00a..b733a5143c 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -19,7 +19,7 @@ namespace osu.Game.Online.API { public class APIAccess : Component, IAPIProvider { - private readonly OsuConfigManager config; + private readonly GameConfigManager config; private readonly OAuth authentication; public string Endpoint = @"https://osu.ppy.sh"; @@ -43,16 +43,16 @@ namespace osu.Game.Online.API private readonly Logger log; - public APIAccess(OsuConfigManager config) + public APIAccess(GameConfigManager config) { this.config = config; authentication = new OAuth(client_id, client_secret, Endpoint); log = Logger.GetLogger(LoggingTarget.Network); - ProvidedUsername = config.Get(OsuSetting.Username); + ProvidedUsername = config.Get(GameSetting.Username); - authentication.TokenString = config.Get(OsuSetting.Token); + authentication.TokenString = config.Get(GameSetting.Token); authentication.Token.ValueChanged += onTokenChanged; var thread = new Thread(run) @@ -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(OAuthToken token) => config.Set(GameSetting.Token, config.Get(GameSetting.SavePassword) ? authentication.TokenString : string.Empty); private readonly List components = new List(); @@ -124,7 +124,7 @@ namespace osu.Game.Online.API State = APIState.Connecting; // save the username at this point, if the user requested for it to be. - config.Set(OsuSetting.Username, config.Get(OsuSetting.SaveUsername) ? ProvidedUsername : string.Empty); + config.Set(GameSetting.Username, config.Get(GameSetting.SaveUsername) ? ProvidedUsername : string.Empty); if (!authentication.HasValidAccessToken && !authentication.AuthenticateWithLogin(ProvidedUsername, password)) { diff --git a/osu.Game/Online/Chat/ExternalLinkOpener.cs b/osu.Game/Online/Chat/ExternalLinkOpener.cs index d8b8adbbad..816025c570 100644 --- a/osu.Game/Online/Chat/ExternalLinkOpener.cs +++ b/osu.Game/Online/Chat/ExternalLinkOpener.cs @@ -18,11 +18,11 @@ namespace osu.Game.Online.Chat private Bindable externalLinkWarning; [BackgroundDependencyLoader(true)] - private void load(GameHost host, DialogOverlay dialogOverlay, OsuConfigManager config) + private void load(GameHost host, DialogOverlay dialogOverlay, GameConfigManager config) { this.host = host; this.dialogOverlay = dialogOverlay; - externalLinkWarning = config.GetBindable(OsuSetting.ExternalLinkWarning); + externalLinkWarning = config.GetBindable(GameSetting.ExternalLinkWarning); } public void OpenUrlExternally(string url) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 3dde3d2c60..c6d90de09f 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -174,17 +174,17 @@ namespace osu.Game dependencies.CacheAs>(ruleset); // bind config int to database RulesetInfo - configRuleset = LocalConfig.GetBindable(OsuSetting.Ruleset); + configRuleset = LocalConfig.GetBindable(GameSetting.Ruleset); ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First(); ruleset.ValueChanged += r => configRuleset.Value = r.ID ?? 0; // bind config int to database SkinInfo - configSkin = LocalConfig.GetBindable(OsuSetting.Skin); + configSkin = LocalConfig.GetBindable(GameSetting.Skin); SkinManager.CurrentSkinInfo.ValueChanged += s => configSkin.Value = s.ID; configSkin.ValueChanged += id => SkinManager.CurrentSkinInfo.Value = SkinManager.Query(s => s.ID == id) ?? SkinInfo.Default; configSkin.TriggerChange(); - LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust); + LocalConfig.BindWith(GameSetting.VolumeInactive, inactiveVolumeAdjust); } private ExternalLinkOpener externalLinkOpener; @@ -631,7 +631,7 @@ namespace osu.Game direct.ToggleVisibility(); return true; case GlobalAction.ToggleGameplayMouseButtons: - LocalConfig.Set(OsuSetting.MouseDisableButtons, !LocalConfig.Get(OsuSetting.MouseDisableButtons)); + LocalConfig.Set(GameSetting.MouseDisableButtons, !LocalConfig.Get(GameSetting.MouseDisableButtons)); return true; } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index b6c642c9dc..3c166aeeb3 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -43,7 +43,7 @@ namespace osu.Game /// public class OsuGameBase : Framework.Game, ICanAcceptFiles { - protected OsuConfigManager LocalConfig; + protected GameConfigManager LocalConfig; protected BeatmapManager BeatmapManager; @@ -206,7 +206,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 = LocalConfig.GetBindable(GameSetting.ShowFpsDisplay); fpsDisplayVisible.ValueChanged += val => { FrameStatisticsMode = val ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; }; fpsDisplayVisible.TriggerChange(); } @@ -237,7 +237,7 @@ namespace osu.Game public override void SetHost(GameHost host) { if (LocalConfig == null) - LocalConfig = new OsuConfigManager(host.Storage); + LocalConfig = new GameConfigManager(host.Storage); base.SetHost(host); } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 680e7ac416..6029e80eb0 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -325,9 +325,9 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(OsuConfigManager config, OsuColour colours, ChannelManager channelManager) + private void load(GameConfigManager config, OsuColour colours, ChannelManager channelManager) { - ChatHeight = config.GetBindable(OsuSetting.ChatDisplayHeight); + ChatHeight = config.GetBindable(GameSetting.ChatDisplayHeight); ChatHeight.ValueChanged += h => { chatContainer.Height = (float)h; diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index d78bd744f4..4ff7ee8819 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -117,10 +117,10 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(FrameworkConfigManager frameworkConfig, OsuConfigManager osuConfig) + private void load(FrameworkConfigManager frameworkConfig, GameConfigManager gameConfig) { BeginTracking(this, frameworkConfig); - BeginTracking(this, osuConfig); + BeginTracking(this, gameConfig); } private readonly Dictionary<(object, IConfigManager), TrackedSettings> trackedConfigManagers = new Dictionary<(object, IConfigManager), TrackedSettings>(); diff --git a/osu.Game/Overlays/Settings/Sections/Audio/MainMenuSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/MainMenuSettings.cs index 35f0a19796..c3b46ca1c2 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/MainMenuSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/MainMenuSettings.cs @@ -11,19 +11,19 @@ namespace osu.Game.Overlays.Settings.Sections.Audio protected override string Header => "Main Menu"; [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { Children = new[] { new SettingsCheckbox { LabelText = "Interface voices", - Bindable = config.GetBindable(OsuSetting.MenuVoice) + Bindable = config.GetBindable(GameSetting.MenuVoice) }, new SettingsCheckbox { LabelText = "osu! music theme", - Bindable = config.GetBindable(OsuSetting.MenuMusic) + Bindable = config.GetBindable(GameSetting.MenuMusic) }, }; } diff --git a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs index da96c6ef30..89bc193a07 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs @@ -13,14 +13,14 @@ namespace osu.Game.Overlays.Settings.Sections.Audio protected override string Header => "Offset Adjustment"; [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { Children = new Drawable[] { new SettingsSlider { LabelText = "Audio offset", - Bindable = config.GetBindable(OsuSetting.AudioOffset), + Bindable = config.GetBindable(GameSetting.AudioOffset), KeyboardStep = 1f }, new SettingsButton diff --git a/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs index fa4a714ba3..cf79881224 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs @@ -13,12 +13,12 @@ namespace osu.Game.Overlays.Settings.Sections.Audio protected override string Header => "Volume"; [BackgroundDependencyLoader] - private void load(AudioManager audio, OsuConfigManager config) + private void load(AudioManager audio, GameConfigManager config) { Children = new Drawable[] { new SettingsSlider { LabelText = "Master", Bindable = audio.Volume, KeyboardStep = 0.01f }, - new SettingsSlider { LabelText = "Master (window inactive)", Bindable = config.GetBindable(OsuSetting.VolumeInactive), KeyboardStep = 0.01f }, + new SettingsSlider { LabelText = "Master (window inactive)", Bindable = config.GetBindable(GameSetting.VolumeInactive), KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Effect", Bindable = audio.VolumeSample, KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Music", Bindable = audio.VolumeTrack, KeyboardStep = 0.01f }, }; diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs index 21d5d452bf..b11dd71285 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs @@ -13,36 +13,36 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay protected override string Header => "General"; [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { Children = new Drawable[] { new SettingsSlider { LabelText = "Background dim", - Bindable = config.GetBindable(OsuSetting.DimLevel), + Bindable = config.GetBindable(GameSetting.DimLevel), KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Background blur", - Bindable = config.GetBindable(OsuSetting.BlurLevel), + Bindable = config.GetBindable(GameSetting.BlurLevel), KeyboardStep = 0.01f }, new SettingsCheckbox { LabelText = "Show score overlay", - Bindable = config.GetBindable(OsuSetting.ShowInterface) + Bindable = config.GetBindable(GameSetting.ShowInterface) }, new SettingsCheckbox { LabelText = "Always show key overlay", - Bindable = config.GetBindable(OsuSetting.KeyOverlay) + Bindable = config.GetBindable(GameSetting.KeyOverlay) }, new SettingsEnumDropdown { LabelText = "Score display mode", - Bindable = config.GetBindable(OsuSetting.ScoreDisplayMode) + Bindable = config.GetBindable(GameSetting.ScoreDisplayMode) } }; } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs index a9cefa81da..ad274c2095 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs @@ -11,14 +11,14 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay protected override string Header => "Mods"; [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { Children = new[] { new SettingsCheckbox { LabelText = "Increase visibility of first object with \"Hidden\" mod", - Bindable = config.GetBindable(OsuSetting.IncreaseFirstObjectVisibility) + Bindable = config.GetBindable(GameSetting.IncreaseFirstObjectVisibility) }, }; } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs index 235ff0f319..bc3c3d76ef 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs @@ -13,36 +13,36 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay protected override string Header => "Song Select"; [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { Children = new Drawable[] { new SettingsCheckbox { LabelText = "Right mouse drag to absolute scroll", - Bindable = config.GetBindable(OsuSetting.SongSelectRightMouseScroll), + Bindable = config.GetBindable(GameSetting.SongSelectRightMouseScroll), }, new SettingsCheckbox { LabelText = "Show converted beatmaps", - Bindable = config.GetBindable(OsuSetting.ShowConvertedBeatmaps), + Bindable = config.GetBindable(GameSetting.ShowConvertedBeatmaps), }, new SettingsSlider { LabelText = "Display beatmaps from", - Bindable = config.GetBindable(OsuSetting.DisplayStarsMinimum), + Bindable = config.GetBindable(GameSetting.DisplayStarsMinimum), KeyboardStep = 0.1f }, new SettingsSlider { LabelText = "up to", - Bindable = config.GetBindable(OsuSetting.DisplayStarsMaximum), + Bindable = config.GetBindable(GameSetting.DisplayStarsMaximum), KeyboardStep = 0.1f }, new SettingsEnumDropdown { LabelText = "Random selection algorithm", - Bindable = config.GetBindable(OsuSetting.RandomSelectAlgorithm), + Bindable = config.GetBindable(GameSetting.RandomSelectAlgorithm), } }; } diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 163eced103..0c16a0b0e6 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -206,7 +206,7 @@ namespace osu.Game.Overlays.Settings.Sections.General } [BackgroundDependencyLoader(permitNulls: true)] - private void load(APIAccess api, OsuConfigManager config, AccountCreationOverlay accountCreation) + private void load(APIAccess api, GameConfigManager config, AccountCreationOverlay accountCreation) { this.api = api; Direction = FillDirection.Vertical; @@ -232,12 +232,12 @@ namespace osu.Game.Overlays.Settings.Sections.General new SettingsCheckbox { LabelText = "Remember email address", - Bindable = config.GetBindable(OsuSetting.SaveUsername), + Bindable = config.GetBindable(GameSetting.SaveUsername), }, new SettingsCheckbox { LabelText = "Stay signed in", - Bindable = config.GetBindable(OsuSetting.SavePassword), + Bindable = config.GetBindable(GameSetting.SavePassword), }, new SettingsButton { diff --git a/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs b/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs index 34d13b1462..c54758d569 100644 --- a/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs @@ -13,14 +13,14 @@ namespace osu.Game.Overlays.Settings.Sections.General protected override string Header => "Updates"; [BackgroundDependencyLoader] - private void load(Storage storage, OsuConfigManager config) + private void load(Storage storage, GameConfigManager config) { Children = new Drawable[] { new SettingsEnumDropdown { LabelText = "Release stream", - Bindable = config.GetBindable(OsuSetting.ReleaseStream), + Bindable = config.GetBindable(GameSetting.ReleaseStream), }, new SettingsButton { diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs index 54049bfb1f..9abffc3aaf 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs @@ -12,29 +12,29 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics protected override string Header => "Detail Settings"; [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { Children = new Drawable[] { new SettingsCheckbox { LabelText = "Storyboards", - Bindable = config.GetBindable(OsuSetting.ShowStoryboard) + Bindable = config.GetBindable(GameSetting.ShowStoryboard) }, new SettingsCheckbox { LabelText = "Rotate cursor when dragging", - Bindable = config.GetBindable(OsuSetting.CursorRotation) + Bindable = config.GetBindable(GameSetting.CursorRotation) }, new SettingsEnumDropdown { LabelText = "Screenshot format", - Bindable = config.GetBindable(OsuSetting.ScreenshotFormat) + Bindable = config.GetBindable(GameSetting.ScreenshotFormat) }, new SettingsCheckbox { LabelText = "Show menu cursor in screenshots", - Bindable = config.GetBindable(OsuSetting.ScreenshotCaptureMenuCursor) + Bindable = config.GetBindable(GameSetting.ScreenshotCaptureMenuCursor) } }; } diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index d59e2e033e..0ca2b33d87 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -38,16 +38,16 @@ 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, GameConfigManager gameConfig, OsuGameBase game) { this.game = game; - scalingMode = osuConfig.GetBindable(OsuSetting.Scaling); + scalingMode = gameConfig.GetBindable(GameSetting.Scaling); sizeFullscreen = config.GetBindable(FrameworkSetting.SizeFullscreen); - scalingSizeX = osuConfig.GetBindable(OsuSetting.ScalingSizeX); - scalingSizeY = osuConfig.GetBindable(OsuSetting.ScalingSizeY); - scalingPositionX = osuConfig.GetBindable(OsuSetting.ScalingPositionX); - scalingPositionY = osuConfig.GetBindable(OsuSetting.ScalingPositionY); + scalingSizeX = gameConfig.GetBindable(GameSetting.ScalingSizeX); + scalingSizeY = gameConfig.GetBindable(GameSetting.ScalingSizeY); + scalingPositionX = gameConfig.GetBindable(GameSetting.ScalingPositionX); + scalingPositionY = gameConfig.GetBindable(GameSetting.ScalingPositionY); Container resolutionSettingsContainer; @@ -67,13 +67,13 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { LabelText = "UI Scaling", TransferValueOnCommit = true, - Bindable = osuConfig.GetBindable(OsuSetting.UIScale), + Bindable = gameConfig.GetBindable(GameSetting.UIScale), KeyboardStep = 0.01f }, new SettingsEnumDropdown { LabelText = "Screen Scaling", - Bindable = osuConfig.GetBindable(OsuSetting.Scaling), + Bindable = gameConfig.GetBindable(GameSetting.Scaling), }, scalingSettings = new FillFlowContainer> { diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/MainMenuSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/MainMenuSettings.cs index 71d2b31946..501326022a 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/MainMenuSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/MainMenuSettings.cs @@ -11,14 +11,14 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics protected override string Header => "User Interface"; [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { Children = new[] { new SettingsCheckbox { LabelText = "Parallax", - Bindable = config.GetBindable(OsuSetting.MenuParallax) + Bindable = config.GetBindable(GameSetting.MenuParallax) }, }; } diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs index 5f3c7aa7e9..0e0cb5d683 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs @@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics protected override string Header => "Renderer"; [BackgroundDependencyLoader] - private void load(FrameworkConfigManager config, OsuConfigManager osuConfig) + private void load(FrameworkConfigManager config, GameConfigManager gameConfig) { // NOTE: Compatability mode omitted Children = new Drawable[] @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics new SettingsCheckbox { LabelText = "Show FPS", - Bindable = osuConfig.GetBindable(OsuSetting.ShowFpsDisplay) + Bindable = gameConfig.GetBindable(GameSetting.ShowFpsDisplay) }, }; } diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index e5cde37254..0a4f85fec8 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input private SensitivitySetting sensitivity; [BackgroundDependencyLoader] - private void load(OsuConfigManager osuConfig, FrameworkConfigManager config) + private void load(GameConfigManager gameConfig, FrameworkConfigManager config) { Children = new Drawable[] { @@ -46,12 +46,12 @@ namespace osu.Game.Overlays.Settings.Sections.Input new SettingsCheckbox { LabelText = "Disable mouse wheel during gameplay", - Bindable = osuConfig.GetBindable(OsuSetting.MouseDisableWheel) + Bindable = gameConfig.GetBindable(GameSetting.MouseDisableWheel) }, new SettingsCheckbox { LabelText = "Disable mouse buttons during gameplay", - Bindable = osuConfig.GetBindable(OsuSetting.MouseDisableButtons) + Bindable = gameConfig.GetBindable(GameSetting.MouseDisableButtons) }, }; diff --git a/osu.Game/Overlays/Settings/Sections/Online/WebSettings.cs b/osu.Game/Overlays/Settings/Sections/Online/WebSettings.cs index 62e307f323..c56e9cd2d4 100644 --- a/osu.Game/Overlays/Settings/Sections/Online/WebSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Online/WebSettings.cs @@ -12,14 +12,14 @@ namespace osu.Game.Overlays.Settings.Sections.Online protected override string Header => "Web"; [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { Children = new Drawable[] { new SettingsCheckbox { LabelText = "Warn about opening external links", - Bindable = config.GetBindable(OsuSetting.ExternalLinkWarning) + Bindable = config.GetBindable(GameSetting.ExternalLinkWarning) }, }; } diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index 2cce47b593..b3601d39cc 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Settings.Sections private SkinManager skins; [BackgroundDependencyLoader] - private void load(OsuConfigManager config, SkinManager skins) + private void load(GameConfigManager config, SkinManager skins) { this.skins = skins; @@ -38,41 +38,41 @@ namespace osu.Game.Overlays.Settings.Sections new SettingsSlider { LabelText = "Menu cursor size", - Bindable = config.GetBindable(OsuSetting.MenuCursorSize), + Bindable = config.GetBindable(GameSetting.MenuCursorSize), KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Gameplay cursor size", - Bindable = config.GetBindable(OsuSetting.GameplayCursorSize), + Bindable = config.GetBindable(GameSetting.GameplayCursorSize), KeyboardStep = 0.01f }, new SettingsCheckbox { LabelText = "Adjust gameplay cursor size based on current beatmap", - Bindable = config.GetBindable(OsuSetting.AutoCursorSize) + Bindable = config.GetBindable(GameSetting.AutoCursorSize) }, new SettingsCheckbox { LabelText = "Beatmap skins", - Bindable = config.GetBindable(OsuSetting.BeatmapSkins) + Bindable = config.GetBindable(GameSetting.BeatmapSkins) }, new SettingsCheckbox { LabelText = "Beatmap hitsounds", - Bindable = config.GetBindable(OsuSetting.BeatmapHitsounds) + Bindable = config.GetBindable(GameSetting.BeatmapHitsounds) }, }; skins.ItemAdded += itemAdded; skins.ItemRemoved += itemRemoved; - config.BindWith(OsuSetting.Skin, configBindable); + config.BindWith(GameSetting.Skin, configBindable); skinDropdown.Bindable = dropdownBindable; skinDropdown.Items = skins.GetAllUsableSkins().ToArray(); - // Todo: This should not be necessary when OsuConfigManager is databased + // Todo: This should not be necessary when GameConfigManager is databased if (skinDropdown.Items.All(s => s.ID != configBindable.Value)) configBindable.Value = 0; diff --git a/osu.Game/Rulesets/Mods/IReadFromConfig.cs b/osu.Game/Rulesets/Mods/IReadFromConfig.cs index 93c9ae0c34..2974534c05 100644 --- a/osu.Game/Rulesets/Mods/IReadFromConfig.cs +++ b/osu.Game/Rulesets/Mods/IReadFromConfig.cs @@ -10,6 +10,6 @@ namespace osu.Game.Rulesets.Mods /// public interface IReadFromConfig { - void ReadFromConfig(OsuConfigManager config); + void ReadFromConfig(GameConfigManager config); } } diff --git a/osu.Game/Rulesets/Mods/ModHidden.cs b/osu.Game/Rulesets/Mods/ModHidden.cs index b843171521..f80f19d80c 100644 --- a/osu.Game/Rulesets/Mods/ModHidden.cs +++ b/osu.Game/Rulesets/Mods/ModHidden.cs @@ -20,9 +20,9 @@ namespace osu.Game.Rulesets.Mods protected Bindable IncreaseFirstObjectVisibility = new Bindable(); - public void ReadFromConfig(OsuConfigManager config) + public void ReadFromConfig(GameConfigManager config) { - IncreaseFirstObjectVisibility = config.GetBindable(OsuSetting.IncreaseFirstObjectVisibility); + IncreaseFirstObjectVisibility = config.GetBindable(GameSetting.IncreaseFirstObjectVisibility); } public virtual void ApplyToDrawableHitObjects(IEnumerable drawables) diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index 0ea3377952..422d16509f 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -248,7 +248,7 @@ namespace osu.Game.Rulesets.UI } [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { KeyBindingInputManager.AddRange(new Drawable[] { @@ -291,7 +291,7 @@ namespace osu.Game.Rulesets.UI /// Applies the active mods to this RulesetContainer. /// /// - private void applyRulesetMods(IEnumerable mods, OsuConfigManager config) + private void applyRulesetMods(IEnumerable mods, GameConfigManager config) { if (mods == null) return; diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index e85a048c34..0a4a04558c 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -193,9 +193,9 @@ namespace osu.Game.Rulesets.UI private Bindable mouseDisabled; [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { - mouseDisabled = config.GetBindable(OsuSetting.MouseDisableButtons); + mouseDisabled = config.GetBindable(GameSetting.MouseDisableButtons); } protected override bool Handle(UIEvent e) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 8d9cd8dbe9..b98229e9e6 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -47,12 +47,12 @@ namespace osu.Game.Screens.Menu private WorkingBeatmap introBeatmap; [BackgroundDependencyLoader] - private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap) + private void load(AudioManager audio, GameConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap) { this.beatmap.BindTo(beatmap); - menuVoice = config.GetBindable(OsuSetting.MenuVoice); - menuMusic = config.GetBindable(OsuSetting.MenuMusic); + menuVoice = config.GetBindable(GameSetting.MenuVoice); + menuMusic = config.GetBindable(GameSetting.MenuMusic); BeatmapSetInfo setInfo = null; diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 2fef8dc4f4..9cf4af4ac7 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -101,9 +101,9 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader(true)] - private void load(OsuConfigManager config, NotificationOverlay notificationOverlay) + private void load(GameConfigManager config, NotificationOverlay notificationOverlay) { - showHud = config.GetBindable(OsuSetting.ShowInterface); + showHud = config.GetBindable(GameSetting.ShowInterface); showHud.ValueChanged += hudVisibility => visibilityContainer.FadeTo(hudVisibility ? 1 : 0, duration); showHud.TriggerChange(); diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index ce0e98d032..8a0da52e85 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -49,9 +49,9 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { - config.BindWith(OsuSetting.KeyOverlay, configVisibility); + config.BindWith(GameSetting.KeyOverlay, configVisibility); Visible.BindValueChanged(_ => updateVisibility()); configVisibility.BindValueChanged(_ => updateVisibility(), true); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index a3f46a285e..7140e5a8c6 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -92,7 +92,7 @@ namespace osu.Game.Screens.Play public bool LoadedBeatmapSuccessfully => RulesetContainer?.Objects.Any() == true; [BackgroundDependencyLoader] - private void load(AudioManager audio, APIAccess api, OsuConfigManager config) + private void load(AudioManager audio, APIAccess api, GameConfigManager config) { this.api = api; @@ -102,8 +102,8 @@ namespace osu.Game.Screens.Play sampleRestart = audio.Sample.Get(@"Gameplay/restart"); - mouseWheelDisabled = config.GetBindable(OsuSetting.MouseDisableWheel); - userAudioOffset = config.GetBindable(OsuSetting.AudioOffset); + mouseWheelDisabled = config.GetBindable(GameSetting.MouseDisableWheel); + userAudioOffset = config.GetBindable(GameSetting.AudioOffset); IBeatmap beatmap; @@ -164,7 +164,7 @@ namespace osu.Game.Screens.Play ScoreProcessor = RulesetContainer.CreateScoreProcessor(); if (!ScoreProcessor.Mode.Disabled) - config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode); + config.BindWith(GameSetting.ScoreDisplayMode, ScoreProcessor.Mode); Children = new Drawable[] { diff --git a/osu.Game/Screens/Play/PlayerSettings/DiscussionSettings.cs b/osu.Game/Screens/Play/PlayerSettings/DiscussionSettings.cs index 31d390effe..11e15b0f1e 100644 --- a/osu.Game/Screens/Play/PlayerSettings/DiscussionSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/DiscussionSettings.cs @@ -13,14 +13,14 @@ namespace osu.Game.Screens.Play.PlayerSettings protected override string Title => @"discussions"; [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { Children = new Drawable[] { new PlayerCheckbox { LabelText = "Show floating comments", - Bindable = config.GetBindable(OsuSetting.FloatingComments) + Bindable = config.GetBindable(GameSetting.FloatingComments) }, new FocusedTextBox { diff --git a/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs b/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs index 755ba468cc..daf3886ee9 100644 --- a/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs @@ -25,6 +25,6 @@ namespace osu.Game.Screens.Play.PlayerSettings } [BackgroundDependencyLoader] - private void load(OsuConfigManager config) => mouseButtonsCheckbox.Bindable = config.GetBindable(OsuSetting.MouseDisableButtons); + private void load(GameConfigManager config) => mouseButtonsCheckbox.Bindable = config.GetBindable(GameSetting.MouseDisableButtons); } } diff --git a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs index 439e344020..88017cdc38 100644 --- a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs @@ -43,13 +43,13 @@ namespace osu.Game.Screens.Play.PlayerSettings } [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { - dimSliderBar.Bindable = config.GetBindable(OsuSetting.DimLevel); - blurSliderBar.Bindable = config.GetBindable(OsuSetting.BlurLevel); - showStoryboardToggle.Bindable = config.GetBindable(OsuSetting.ShowStoryboard); - beatmapSkinsToggle.Bindable = config.GetBindable(OsuSetting.BeatmapSkins); - beatmapHitsoundsToggle.Bindable = config.GetBindable(OsuSetting.BeatmapHitsounds); + dimSliderBar.Bindable = config.GetBindable(GameSetting.DimLevel); + blurSliderBar.Bindable = config.GetBindable(GameSetting.BlurLevel); + showStoryboardToggle.Bindable = config.GetBindable(GameSetting.ShowStoryboard); + beatmapSkinsToggle.Bindable = config.GetBindable(GameSetting.BeatmapSkins); + beatmapHitsoundsToggle.Bindable = config.GetBindable(GameSetting.BeatmapHitsounds); } } } diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 61dc70c4ae..051e54120f 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -33,11 +33,11 @@ namespace osu.Game.Screens.Play #endregion [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { - DimLevel = config.GetBindable(OsuSetting.DimLevel); - BlurLevel = config.GetBindable(OsuSetting.BlurLevel); - ShowStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); + DimLevel = config.GetBindable(GameSetting.DimLevel); + BlurLevel = config.GetBindable(GameSetting.BlurLevel); + ShowStoryboard = config.GetBindable(GameSetting.ShowStoryboard); } protected override void OnEntering(Screen last) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 63c97f9bd5..ba1a0308f1 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -125,10 +125,10 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { - config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm); - config.BindWith(OsuSetting.SongSelectRightMouseScroll, RightClickScrollingEnabled); + config.BindWith(GameSetting.RandomSelectAlgorithm, RandomAlgorithm); + config.BindWith(GameSetting.SongSelectRightMouseScroll, RightClickScrollingEnabled); RightClickScrollingEnabled.ValueChanged += v => RightMouseScrollbar = v; RightClickScrollingEnabled.TriggerChange(); diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index e18b70a0e0..62e329f479 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -31,11 +31,11 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader] - private void load(OsuColour colour, OsuConfigManager config) + private void load(OsuColour colour, GameConfigManager config) { modsCheckbox.AccentColour = tabs.AccentColour = colour.YellowLight; - selectedTab = config.GetBindable(OsuSetting.BeatmapDetailTab); + selectedTab = config.GetBindable(GameSetting.BeatmapDetailTab); tabs.Current.BindTo(selectedTab); tabs.Current.TriggerChange(); diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index faffdbf31a..7ff6b3ef6e 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -173,11 +173,11 @@ namespace osu.Game.Screens.Select public readonly Box Background; [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuColour colours, IBindable parentRuleset, OsuConfigManager config) + private void load(OsuColour colours, IBindable parentRuleset, GameConfigManager config) { sortTabs.AccentColour = colours.GreenLight; - showConverted = config.GetBindable(OsuSetting.ShowConvertedBeatmaps); + showConverted = config.GetBindable(GameSetting.ShowConvertedBeatmaps); showConverted.ValueChanged += val => updateCriteria(); ruleset.BindTo(parentRuleset); diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index 2dab671936..19a8ff9baa 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -74,10 +74,10 @@ namespace osu.Game.Skinning } [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(GameConfigManager config) { - config.BindWith(OsuSetting.BeatmapSkins, beatmapSkins); - config.BindWith(OsuSetting.BeatmapHitsounds, beatmapHitsounds); + config.BindWith(GameSetting.BeatmapSkins, beatmapSkins); + config.BindWith(GameSetting.BeatmapHitsounds, beatmapHitsounds); } protected override void LoadComplete() From cf147083cd508f6608d19a76358cb3738551e3e7 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 23 Jan 2019 11:46:53 +0100 Subject: [PATCH 010/185] move osu! settings into its ruleset --- .../Configuration/OsuConfigManager.cs | 30 +++++++++++++++++++ .../Objects/Drawables/DrawableSlider.cs | 8 ++--- osu.Game.Rulesets.Osu/OsuRuleset.cs | 7 ++++- .../UI/OsuRulesetContainer.cs | 3 ++ ...suSettings.cs => OsuSettingsSubsection.cs} | 14 +++++---- 5 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs rename osu.Game.Rulesets.Osu/UI/{OsuSettings.cs => OsuSettingsSubsection.cs} (65%) diff --git a/osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs b/osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs new file mode 100644 index 0000000000..f9039bd190 --- /dev/null +++ b/osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs @@ -0,0 +1,30 @@ +// Copyright (c) 2007-2019 ppy Pty Ltd . +// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE + +using osu.Game.Configuration; +using osu.Game.Rulesets.Configuration; + +namespace osu.Game.Rulesets.Osu.Configuration +{ + public class OsuConfigManager : RulesetConfigManager + { + public OsuConfigManager(SettingsStore settings, RulesetInfo ruleset, int? variant = null) + : base(settings, ruleset, variant) + { + } + + protected override void InitialiseDefaults() + { + base.InitialiseDefaults(); + + Set(OsuSetting.SnakingInSliders, true); + Set(OsuSetting.SnakingOutSliders, true); + } + } + + public enum OsuSetting + { + SnakingInSliders, + SnakingOutSliders + } +} diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index dafb54ff64..cc5d2ac70c 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -10,8 +10,8 @@ using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Graphics.Containers; -using osu.Game.Configuration; using osu.Game.Rulesets.Objects; +using osu.Game.Rulesets.Osu.Configuration; using osu.Game.Rulesets.Scoring; using osuTK.Graphics; using osu.Game.Skinning; @@ -93,10 +93,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { - config.BindWith(GameSetting.SnakingInSliders, Body.SnakingIn); - config.BindWith(GameSetting.SnakingOutSliders, Body.SnakingOut); + config.BindWith(OsuSetting.SnakingInSliders, Body.SnakingIn); + config.BindWith(OsuSetting.SnakingOutSliders, Body.SnakingOut); positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); scaleBindable.BindValueChanged(v => diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 5cfc24bdde..0c0e945668 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -16,8 +16,11 @@ using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Osu.Replays; using osu.Game.Rulesets.Replays.Types; using osu.Game.Beatmaps.Legacy; +using osu.Game.Configuration; +using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Difficulty; using osu.Game.Rulesets.Osu.Beatmaps; +using osu.Game.Rulesets.Osu.Configuration; using osu.Game.Rulesets.Osu.Difficulty; using osu.Game.Scoring; @@ -139,12 +142,14 @@ namespace osu.Game.Rulesets.Osu public override string ShortName => "osu"; - public override RulesetSettingsSubsection CreateSettings() => new OsuSettings(this); + public override RulesetSettingsSubsection CreateSettings() => new OsuSettingsSubsection(this); public override int? LegacyID => 0; public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new OsuReplayFrame(); + public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new OsuConfigManager(settings, RulesetInfo); + public OsuRuleset(RulesetInfo rulesetInfo = null) : base(rulesetInfo) { diff --git a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs index c0e6eae494..8738fea318 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs @@ -8,6 +8,7 @@ using osu.Game.Beatmaps; using osu.Game.Input.Handlers; using osu.Game.Replays; using osu.Game.Rulesets.Objects.Drawables; +using osu.Game.Rulesets.Osu.Configuration; using osu.Game.Rulesets.Osu.Objects; using osu.Game.Rulesets.Osu.Objects.Drawables; using osu.Game.Rulesets.Osu.Replays; @@ -20,6 +21,8 @@ namespace osu.Game.Rulesets.Osu.UI { public class OsuRulesetContainer : RulesetContainer { + protected new OsuConfigManager Config => (OsuConfigManager)base.Config; + public OsuRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) { diff --git a/osu.Game.Rulesets.Osu/UI/OsuSettings.cs b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs similarity index 65% rename from osu.Game.Rulesets.Osu/UI/OsuSettings.cs rename to osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs index ae0b3ef4dd..9aa0f4101d 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuSettings.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs @@ -3,34 +3,36 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Game.Configuration; using osu.Game.Overlays.Settings; +using osu.Game.Rulesets.Osu.Configuration; namespace osu.Game.Rulesets.Osu.UI { - public class OsuSettings : RulesetSettingsSubsection + public class OsuSettingsSubsection : RulesetSettingsSubsection { protected override string Header => "osu!"; - public OsuSettings(Ruleset ruleset) + public OsuSettingsSubsection(Ruleset ruleset) : base(ruleset) { } [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load() { + var config = (OsuConfigManager)Config; + Children = new Drawable[] { new SettingsCheckbox { LabelText = "Snaking in sliders", - Bindable = config.GetBindable(GameSetting.SnakingInSliders) + Bindable = config.GetBindable(OsuSetting.SnakingInSliders) }, new SettingsCheckbox { LabelText = "Snaking out sliders", - Bindable = config.GetBindable(GameSetting.SnakingOutSliders) + Bindable = config.GetBindable(OsuSetting.SnakingOutSliders) }, }; } From 33b46dc4e8bec5ec6cfb6f31646deee7c28ad074 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 23 Jan 2019 12:07:49 +0100 Subject: [PATCH 011/185] adjust year in license header to match CFS's expectations --- osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs b/osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs index f9039bd190..4fa49faf1d 100644 --- a/osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs +++ b/osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.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 using osu.Game.Configuration; From 4d310c3226c34a68abac1a9ca0b1241dd6601050 Mon Sep 17 00:00:00 2001 From: Unknown Date: Wed, 23 Jan 2019 14:03:26 +0100 Subject: [PATCH 012/185] fix missing dependency for slider test cases --- osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs | 12 ++++++++++++ .../TestCaseSliderSelectionBlueprint.cs | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs index 1895913917..9c72c03ab3 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs @@ -16,11 +16,13 @@ using osuTK.Graphics; using osu.Game.Rulesets.Mods; using System.Linq; using NUnit.Framework; +using osu.Framework.Allocation; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Osu.Configuration; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; namespace osu.Game.Rulesets.Osu.Tests @@ -39,6 +41,16 @@ namespace osu.Game.Rulesets.Osu.Tests typeof(DrawableOsuHitObject) }; + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + { + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + + var configCache = dependencies.Get(); + dependencies.CacheAs((OsuConfigManager)configCache.GetConfigFor(new OsuRuleset())); + + return dependencies; + } + private readonly Container content; protected override Container Content => content; diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs index cd07369ccf..c139fb4e29 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs @@ -3,11 +3,13 @@ using System; using System.Collections.Generic; +using osu.Framework.Allocation; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; +using osu.Game.Rulesets.Osu.Configuration; using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders; using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components; using osu.Game.Rulesets.Osu.Objects; @@ -29,6 +31,16 @@ namespace osu.Game.Rulesets.Osu.Tests typeof(PathControlPointPiece) }; + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) + { + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); + + var configCache = dependencies.Get(); + dependencies.CacheAs((OsuConfigManager)configCache.GetConfigFor(new OsuRuleset())); + + return dependencies; + } + private readonly DrawableSlider drawableObject; public TestCaseSliderSelectionBlueprint() From f07ac8ebd80219875b27ce5c1279d7e3596d0cb4 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 24 Jan 2019 16:11:55 +0100 Subject: [PATCH 013/185] remove osu! specific settings from global config again --- osu.Game/Configuration/GameConfigManager.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/osu.Game/Configuration/GameConfigManager.cs b/osu.Game/Configuration/GameConfigManager.cs index 736273dc35..b2f2a8e971 100644 --- a/osu.Game/Configuration/GameConfigManager.cs +++ b/osu.Game/Configuration/GameConfigManager.cs @@ -72,9 +72,6 @@ namespace osu.Game.Configuration Set(GameSetting.MenuParallax, true); - Set(GameSetting.SnakingInSliders, true); - Set(GameSetting.SnakingOutSliders, true); - // Gameplay Set(GameSetting.DimLevel, 0.3, 0, 1, 0.01); Set(GameSetting.BlurLevel, 0, 0, 1, 0.01); @@ -150,8 +147,6 @@ namespace osu.Game.Configuration DisplayStarsMinimum, DisplayStarsMaximum, RandomSelectAlgorithm, - SnakingInSliders, - SnakingOutSliders, ShowFpsDisplay, ChatDisplayHeight, Version, From 8ddff673b76083a393099bfa274403a0c6e8ce47 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 25 Jan 2019 11:14:37 +0100 Subject: [PATCH 014/185] revert previous rename and rename ruleset specific classes instead --- osu.Desktop/Overlays/VersionManager.cs | 8 +- .../TestCaseEditor.cs | 4 +- ...anager.cs => ManiaRulesetConfigManager.cs} | 12 +- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 2 +- .../ManiaSettingsSubsection.cs | 6 +- .../UI/ManiaRulesetContainer.cs | 6 +- osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs | 2 +- .../TestCaseSliderSelectionBlueprint.cs | 2 +- ...gManager.cs => OsuRulesetConfigManager.cs} | 10 +- .../Objects/Drawables/DrawableSlider.cs | 6 +- osu.Game.Rulesets.Osu/OsuRuleset.cs | 2 +- .../UI/Cursor/GameplayCursor.cs | 6 +- .../UI/OsuRulesetContainer.cs | 2 +- osu.Game.Rulesets.Osu/UI/OsuSettings.cs | 38 ---- .../UI/OsuSettingsSubsection.cs | 6 +- osu.Game/Configuration/GameConfigManager.cs | 170 ------------------ osu.Game/Configuration/OsuConfigManager.cs | 5 - .../Graphics/Containers/ParallaxContainer.cs | 4 +- .../Graphics/Containers/ScalingContainer.cs | 16 +- osu.Game/Graphics/Cursor/MenuCursor.cs | 8 +- osu.Game/Graphics/ScreenshotManager.cs | 6 +- osu.Game/Online/API/APIAccess.cs | 12 +- osu.Game/Online/Chat/ExternalLinkOpener.cs | 4 +- osu.Game/OsuGame.cs | 8 +- osu.Game/OsuGameBase.cs | 6 +- osu.Game/Overlays/ChatOverlay.cs | 4 +- osu.Game/Overlays/OnScreenDisplay.cs | 2 +- .../Sections/Audio/MainMenuSettings.cs | 6 +- .../Settings/Sections/Audio/OffsetSettings.cs | 4 +- .../Settings/Sections/Audio/VolumeSettings.cs | 4 +- .../Sections/Gameplay/GeneralSettings.cs | 12 +- .../Sections/Gameplay/ModsSettings.cs | 4 +- .../Sections/Gameplay/SongSelectSettings.cs | 12 +- .../Sections/General/LoginSettings.cs | 6 +- .../Sections/General/UpdateSettings.cs | 4 +- .../Sections/Graphics/DetailSettings.cs | 10 +- .../Sections/Graphics/LayoutSettings.cs | 16 +- .../Sections/Graphics/MainMenuSettings.cs | 4 +- .../Sections/Graphics/RendererSettings.cs | 4 +- .../Settings/Sections/Input/MouseSettings.cs | 6 +- .../Settings/Sections/Online/WebSettings.cs | 4 +- .../Overlays/Settings/Sections/SkinSection.cs | 16 +- osu.Game/Rulesets/Mods/IReadFromConfig.cs | 2 +- osu.Game/Rulesets/Mods/ModHidden.cs | 4 +- osu.Game/Rulesets/UI/RulesetContainer.cs | 4 +- osu.Game/Rulesets/UI/RulesetInputManager.cs | 4 +- osu.Game/Screens/Menu/Intro.cs | 6 +- osu.Game/Screens/Play/HUDOverlay.cs | 4 +- osu.Game/Screens/Play/KeyCounterCollection.cs | 4 +- osu.Game/Screens/Play/Player.cs | 8 +- .../Play/PlayerSettings/DiscussionSettings.cs | 4 +- .../Play/PlayerSettings/InputSettings.cs | 2 +- .../Play/PlayerSettings/VisualSettings.cs | 12 +- .../Play/ScreenWithBeatmapBackground.cs | 8 +- osu.Game/Screens/Select/BeatmapCarousel.cs | 6 +- .../Select/BeatmapDetailAreaTabControl.cs | 4 +- osu.Game/Screens/Select/FilterControl.cs | 4 +- .../Skinning/LocalSkinOverrideContainer.cs | 6 +- 58 files changed, 169 insertions(+), 382 deletions(-) rename osu.Game.Rulesets.Mania/Configuration/{ManiaConfigManager.cs => ManiaRulesetConfigManager.cs} (57%) rename osu.Game.Rulesets.Osu/Configuration/{OsuConfigManager.cs => OsuRulesetConfigManager.cs} (60%) delete mode 100644 osu.Game.Rulesets.Osu/UI/OsuSettings.cs delete mode 100644 osu.Game/Configuration/GameConfigManager.cs diff --git a/osu.Desktop/Overlays/VersionManager.cs b/osu.Desktop/Overlays/VersionManager.cs index da9ff79d3a..5b67d528ae 100644 --- a/osu.Desktop/Overlays/VersionManager.cs +++ b/osu.Desktop/Overlays/VersionManager.cs @@ -22,13 +22,13 @@ namespace osu.Desktop.Overlays { public class VersionManager : OverlayContainer { - private GameConfigManager config; + private OsuConfigManager config; private OsuGameBase game; private NotificationOverlay notificationOverlay; private GameHost host; [BackgroundDependencyLoader] - private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, GameConfigManager config, GameHost host) + private void load(NotificationOverlay notification, OsuColour colours, TextureStore textures, OsuGameBase game, OsuConfigManager config, GameHost host) { notificationOverlay = notification; this.config = config; @@ -95,10 +95,10 @@ namespace osu.Desktop.Overlays base.LoadComplete(); var version = game.Version; - var lastVersion = config.Get(GameSetting.Version); + var lastVersion = config.Get(OsuSetting.Version); if (game.IsDeployedBuild && version != lastVersion) { - config.Set(GameSetting.Version, version); + config.Set(OsuSetting.Version, version); // only show a notification if we've previously saved a version to the config file (ie. not the first run). if (!string.IsNullOrEmpty(lastVersion)) diff --git a/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs b/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs index 32f455bb73..7b865cefa7 100644 --- a/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs +++ b/osu.Game.Rulesets.Mania.Tests/TestCaseEditor.cs @@ -25,8 +25,8 @@ namespace osu.Game.Rulesets.Mania.Tests [BackgroundDependencyLoader] private void load(RulesetConfigCache configCache) { - var config = (ManiaConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance()); - config.BindWith(ManiaSetting.ScrollDirection, direction); + var config = (ManiaRulesetConfigManager)configCache.GetConfigFor(Ruleset.Value.CreateInstance()); + config.BindWith(ManiaRulesetSetting.ScrollDirection, direction); } } } diff --git a/osu.Game.Rulesets.Mania/Configuration/ManiaConfigManager.cs b/osu.Game.Rulesets.Mania/Configuration/ManiaRulesetConfigManager.cs similarity index 57% rename from osu.Game.Rulesets.Mania/Configuration/ManiaConfigManager.cs rename to osu.Game.Rulesets.Mania/Configuration/ManiaRulesetConfigManager.cs index 4e0ad31105..b591f9da22 100644 --- a/osu.Game.Rulesets.Mania/Configuration/ManiaConfigManager.cs +++ b/osu.Game.Rulesets.Mania/Configuration/ManiaRulesetConfigManager.cs @@ -8,9 +8,9 @@ using osu.Game.Rulesets.Mania.UI; namespace osu.Game.Rulesets.Mania.Configuration { - public class ManiaConfigManager : RulesetConfigManager + public class ManiaRulesetConfigManager : RulesetConfigManager { - public ManiaConfigManager(SettingsStore settings, RulesetInfo ruleset, int? variant = null) + public ManiaRulesetConfigManager(SettingsStore settings, RulesetInfo ruleset, int? variant = null) : base(settings, ruleset, variant) { } @@ -19,17 +19,17 @@ namespace osu.Game.Rulesets.Mania.Configuration { base.InitialiseDefaults(); - Set(ManiaSetting.ScrollTime, 2250.0, 50.0, 10000.0, 50.0); - Set(ManiaSetting.ScrollDirection, ManiaScrollingDirection.Down); + Set(ManiaRulesetSetting.ScrollTime, 2250.0, 50.0, 10000.0, 50.0); + Set(ManiaRulesetSetting.ScrollDirection, ManiaScrollingDirection.Down); } public override TrackedSettings CreateTrackedSettings() => new TrackedSettings { - new TrackedSetting(ManiaSetting.ScrollTime, v => new SettingDescription(v, "Scroll Time", $"{v}ms")) + new TrackedSetting(ManiaRulesetSetting.ScrollTime, v => new SettingDescription(v, "Scroll Time", $"{v}ms")) }; } - public enum ManiaSetting + public enum ManiaRulesetSetting { ScrollTime, ScrollDirection diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 57728dd134..c589418450 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -162,7 +162,7 @@ namespace osu.Game.Rulesets.Mania public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new ManiaReplayFrame(); - public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new ManiaConfigManager(settings, RulesetInfo); + public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new ManiaRulesetConfigManager(settings, RulesetInfo); public override RulesetSettingsSubsection CreateSettings() => new ManiaSettingsSubsection(this); diff --git a/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs b/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs index 2ab40b2bc6..2ebfd0cfc1 100644 --- a/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs +++ b/osu.Game.Rulesets.Mania/ManiaSettingsSubsection.cs @@ -22,19 +22,19 @@ namespace osu.Game.Rulesets.Mania [BackgroundDependencyLoader] private void load() { - var config = (ManiaConfigManager)Config; + var config = (ManiaRulesetConfigManager)Config; Children = new Drawable[] { new SettingsEnumDropdown { LabelText = "Scrolling direction", - Bindable = config.GetBindable(ManiaSetting.ScrollDirection) + Bindable = config.GetBindable(ManiaRulesetSetting.ScrollDirection) }, new SettingsSlider { LabelText = "Scroll speed", - Bindable = config.GetBindable(ManiaSetting.ScrollTime) + Bindable = config.GetBindable(ManiaRulesetSetting.ScrollTime) }, }; } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index 892ad584dc..5b9debf42b 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Mania.UI public IEnumerable BarLines; - protected new ManiaConfigManager Config => (ManiaConfigManager)base.Config; + protected new ManiaRulesetConfigManager Config => (ManiaRulesetConfigManager)base.Config; private readonly Bindable configDirection = new Bindable(); @@ -75,10 +75,10 @@ namespace osu.Game.Rulesets.Mania.UI { BarLines.ForEach(Playfield.Add); - Config.BindWith(ManiaSetting.ScrollDirection, configDirection); + Config.BindWith(ManiaRulesetSetting.ScrollDirection, configDirection); configDirection.BindValueChanged(v => Direction.Value = (ScrollingDirection)v, true); - Config.BindWith(ManiaSetting.ScrollTime, TimeRange); + Config.BindWith(ManiaRulesetSetting.ScrollTime, TimeRange); } /// diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs index 6baa02fd1f..5838e1af6a 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs @@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Osu.Tests var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); var configCache = dependencies.Get(); - dependencies.CacheAs((OsuConfigManager)configCache.GetConfigFor(new OsuRuleset())); + dependencies.CacheAs((OsuRulesetConfigManager)configCache.GetConfigFor(new OsuRuleset())); return dependencies; } diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs index a6f7a0b0d7..4279925db5 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs @@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.Tests var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); var configCache = dependencies.Get(); - dependencies.CacheAs((OsuConfigManager)configCache.GetConfigFor(new OsuRuleset())); + dependencies.CacheAs((OsuRulesetConfigManager)configCache.GetConfigFor(new OsuRuleset())); return dependencies; } diff --git a/osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs similarity index 60% rename from osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs rename to osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs index 4fa49faf1d..d931fb0eff 100644 --- a/osu.Game.Rulesets.Osu/Configuration/OsuConfigManager.cs +++ b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs @@ -6,9 +6,9 @@ using osu.Game.Rulesets.Configuration; namespace osu.Game.Rulesets.Osu.Configuration { - public class OsuConfigManager : RulesetConfigManager + public class OsuRulesetConfigManager : RulesetConfigManager { - public OsuConfigManager(SettingsStore settings, RulesetInfo ruleset, int? variant = null) + public OsuRulesetConfigManager(SettingsStore settings, RulesetInfo ruleset, int? variant = null) : base(settings, ruleset, variant) { } @@ -17,12 +17,12 @@ namespace osu.Game.Rulesets.Osu.Configuration { base.InitialiseDefaults(); - Set(OsuSetting.SnakingInSliders, true); - Set(OsuSetting.SnakingOutSliders, true); + Set(OsuRulesetSetting.SnakingInSliders, true); + Set(OsuRulesetSetting.SnakingOutSliders, true); } } - public enum OsuSetting + public enum OsuRulesetSetting { SnakingInSliders, SnakingOutSliders diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index 5ad47a8c27..b107fcc028 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -93,10 +93,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(OsuRulesetConfigManager rulesetConfig) { - config.BindWith(OsuSetting.SnakingInSliders, Body.SnakingIn); - config.BindWith(OsuSetting.SnakingOutSliders, Body.SnakingOut); + rulesetConfig.BindWith(OsuRulesetSetting.SnakingInSliders, Body.SnakingIn); + rulesetConfig.BindWith(OsuRulesetSetting.SnakingOutSliders, Body.SnakingOut); positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); scaleBindable.BindValueChanged(v => diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index 997b2a3c56..8e22d82e30 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -148,7 +148,7 @@ namespace osu.Game.Rulesets.Osu public override IConvertibleReplayFrame CreateConvertibleReplayFrame() => new OsuReplayFrame(); - public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new OsuConfigManager(settings, RulesetInfo); + public override IRulesetConfigManager CreateConfig(SettingsStore settings) => new OsuRulesetConfigManager(settings, RulesetInfo); public OsuRuleset(RulesetInfo rulesetInfo = null) : base(rulesetInfo) diff --git a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs index 0e7566a15d..3fef769174 100644 --- a/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs +++ b/osu.Game.Rulesets.Osu/UI/Cursor/GameplayCursor.cs @@ -112,7 +112,7 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor } [BackgroundDependencyLoader] - private void load(GameConfigManager config, IBindableBeatmap beatmap) + private void load(OsuConfigManager config, IBindableBeatmap beatmap) { InternalChild = expandTarget = new Container { @@ -185,10 +185,10 @@ namespace osu.Game.Rulesets.Osu.UI.Cursor this.beatmap.BindTo(beatmap); this.beatmap.ValueChanged += v => calculateScale(); - cursorScale = config.GetBindable(GameSetting.GameplayCursorSize); + cursorScale = config.GetBindable(OsuSetting.GameplayCursorSize); cursorScale.ValueChanged += v => calculateScale(); - autoCursorScale = config.GetBindable(GameSetting.AutoCursorSize); + autoCursorScale = config.GetBindable(OsuSetting.AutoCursorSize); autoCursorScale.ValueChanged += v => calculateScale(); calculateScale(); diff --git a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs index fcb6b0204d..b096b8992d 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs @@ -21,7 +21,7 @@ namespace osu.Game.Rulesets.Osu.UI { public class OsuRulesetContainer : RulesetContainer { - protected new OsuConfigManager Config => (OsuConfigManager)base.Config; + protected new OsuRulesetConfigManager Config => (OsuRulesetConfigManager)base.Config; public OsuRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) diff --git a/osu.Game.Rulesets.Osu/UI/OsuSettings.cs b/osu.Game.Rulesets.Osu/UI/OsuSettings.cs deleted file mode 100644 index 25c009b117..0000000000 --- a/osu.Game.Rulesets.Osu/UI/OsuSettings.cs +++ /dev/null @@ -1,38 +0,0 @@ -// 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.Framework.Graphics; -using osu.Game.Configuration; -using osu.Game.Overlays.Settings; - -namespace osu.Game.Rulesets.Osu.UI -{ - public class OsuSettings : RulesetSettingsSubsection - { - protected override string Header => "osu!"; - - public OsuSettings(Ruleset ruleset) - : base(ruleset) - { - } - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - Children = new Drawable[] - { - new SettingsCheckbox - { - LabelText = "Snaking in sliders", - Bindable = config.GetBindable(OsuSetting.SnakingInSliders) - }, - new SettingsCheckbox - { - LabelText = "Snaking out sliders", - Bindable = config.GetBindable(OsuSetting.SnakingOutSliders) - }, - }; - } - } -} diff --git a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs index 9aa0f4101d..b4c873cf20 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs @@ -20,19 +20,19 @@ namespace osu.Game.Rulesets.Osu.UI [BackgroundDependencyLoader] private void load() { - var config = (OsuConfigManager)Config; + var config = (OsuRulesetConfigManager)Config; Children = new Drawable[] { new SettingsCheckbox { LabelText = "Snaking in sliders", - Bindable = config.GetBindable(OsuSetting.SnakingInSliders) + Bindable = config.GetBindable(OsuRulesetSetting.SnakingInSliders) }, new SettingsCheckbox { LabelText = "Snaking out sliders", - Bindable = config.GetBindable(OsuSetting.SnakingOutSliders) + Bindable = config.GetBindable(OsuRulesetSetting.SnakingOutSliders) }, }; } diff --git a/osu.Game/Configuration/GameConfigManager.cs b/osu.Game/Configuration/GameConfigManager.cs deleted file mode 100644 index b2f2a8e971..0000000000 --- a/osu.Game/Configuration/GameConfigManager.cs +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) 2007-2018 ppy Pty Ltd . -// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE - -using osu.Framework.Configuration; -using osu.Framework.Configuration.Tracking; -using osu.Framework.Extensions; -using osu.Framework.Platform; -using osu.Game.Overlays; -using osu.Game.Rulesets.Scoring; -using osu.Game.Screens.Select; - -namespace osu.Game.Configuration -{ - public class GameConfigManager : IniConfigManager - { - protected override void InitialiseDefaults() - { - // UI/selection defaults - Set(GameSetting.Ruleset, 0, 0, int.MaxValue); - Set(GameSetting.Skin, 0, 0, int.MaxValue); - - Set(GameSetting.BeatmapDetailTab, BeatmapDetailTab.Details); - - Set(GameSetting.ShowConvertedBeatmaps, true); - Set(GameSetting.DisplayStarsMinimum, 0.0, 0, 10, 0.1); - Set(GameSetting.DisplayStarsMaximum, 10.0, 0, 10, 0.1); - - Set(GameSetting.RandomSelectAlgorithm, RandomSelectAlgorithm.RandomPermutation); - - Set(GameSetting.ChatDisplayHeight, ChatOverlay.DEFAULT_HEIGHT, 0.2, 1); - - // Online settings - Set(GameSetting.Username, string.Empty); - Set(GameSetting.Token, string.Empty); - - Set(GameSetting.SavePassword, false).ValueChanged += val => - { - if (val) Set(GameSetting.SaveUsername, true); - }; - - Set(GameSetting.SaveUsername, true).ValueChanged += val => - { - if (!val) Set(GameSetting.SavePassword, false); - }; - - Set(GameSetting.ExternalLinkWarning, true); - - // Audio - Set(GameSetting.VolumeInactive, 0.25, 0, 1, 0.01); - - Set(GameSetting.MenuVoice, true); - Set(GameSetting.MenuMusic, true); - - Set(GameSetting.AudioOffset, 0, -500.0, 500.0, 1); - - // Input - Set(GameSetting.MenuCursorSize, 1.0, 0.5f, 2, 0.01); - Set(GameSetting.GameplayCursorSize, 1.0, 0.5f, 2, 0.01); - Set(GameSetting.AutoCursorSize, false); - - Set(GameSetting.MouseDisableButtons, false); - Set(GameSetting.MouseDisableWheel, false); - - // Graphics - Set(GameSetting.ShowFpsDisplay, false); - - Set(GameSetting.ShowStoryboard, true); - Set(GameSetting.BeatmapSkins, true); - Set(GameSetting.BeatmapHitsounds, true); - - Set(GameSetting.CursorRotation, true); - - Set(GameSetting.MenuParallax, true); - - // Gameplay - Set(GameSetting.DimLevel, 0.3, 0, 1, 0.01); - Set(GameSetting.BlurLevel, 0, 0, 1, 0.01); - - Set(GameSetting.ShowInterface, true); - Set(GameSetting.KeyOverlay, false); - - Set(GameSetting.FloatingComments, false); - - Set(GameSetting.ScoreDisplayMode, ScoringMode.Standardised); - - Set(GameSetting.IncreaseFirstObjectVisibility, true); - - // Update - Set(GameSetting.ReleaseStream, ReleaseStream.Lazer); - - Set(GameSetting.Version, string.Empty); - - Set(GameSetting.ScreenshotFormat, ScreenshotFormat.Jpg); - Set(GameSetting.ScreenshotCaptureMenuCursor, false); - - Set(GameSetting.SongSelectRightMouseScroll, false); - - Set(GameSetting.Scaling, ScalingMode.Off); - - Set(GameSetting.ScalingSizeX, 0.8f, 0.2f, 1f); - Set(GameSetting.ScalingSizeY, 0.8f, 0.2f, 1f); - - Set(GameSetting.ScalingPositionX, 0.5f, 0f, 1f); - Set(GameSetting.ScalingPositionY, 0.5f, 0f, 1f); - - Set(GameSetting.UIScale, 1f, 0.8f, 1.6f, 0.01f); - } - - public GameConfigManager(Storage storage) - : base(storage) - { - } - - public override TrackedSettings CreateTrackedSettings() => new TrackedSettings - { - new TrackedSetting(GameSetting.MouseDisableButtons, v => new SettingDescription(!v, "gameplay mouse buttons", v ? "disabled" : "enabled")), - new TrackedSetting(GameSetting.Scaling, m => new SettingDescription(m, "scaling", m.GetDescription())), - }; - } - - public enum GameSetting - { - Ruleset, - Token, - MenuCursorSize, - GameplayCursorSize, - AutoCursorSize, - DimLevel, - BlurLevel, - ShowStoryboard, - KeyOverlay, - FloatingComments, - ShowInterface, - MouseDisableButtons, - MouseDisableWheel, - AudioOffset, - VolumeInactive, - MenuMusic, - MenuVoice, - CursorRotation, - MenuParallax, - BeatmapDetailTab, - Username, - ReleaseStream, - SavePassword, - SaveUsername, - DisplayStarsMinimum, - DisplayStarsMaximum, - RandomSelectAlgorithm, - ShowFpsDisplay, - ChatDisplayHeight, - Version, - ShowConvertedBeatmaps, - Skin, - ScreenshotFormat, - ScreenshotCaptureMenuCursor, - SongSelectRightMouseScroll, - BeatmapSkins, - BeatmapHitsounds, - IncreaseFirstObjectVisibility, - ScoreDisplayMode, - ExternalLinkWarning, - Scaling, - ScalingPositionX, - ScalingPositionY, - ScalingSizeX, - ScalingSizeY, - UIScale - } -} diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index 1b279eee44..aed56d79bf 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.cs @@ -72,9 +72,6 @@ namespace osu.Game.Configuration Set(OsuSetting.MenuParallax, true); - Set(OsuSetting.SnakingInSliders, true); - Set(OsuSetting.SnakingOutSliders, true); - // Gameplay Set(OsuSetting.DimLevel, 0.3, 0, 1, 0.01); Set(OsuSetting.BlurLevel, 0, 0, 1, 0.01); @@ -150,8 +147,6 @@ namespace osu.Game.Configuration DisplayStarsMinimum, DisplayStarsMaximum, RandomSelectAlgorithm, - SnakingInSliders, - SnakingOutSliders, ShowFpsDisplay, ChatDisplayHeight, Version, diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index d5ac43bfe5..f7d30dc109 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -40,9 +40,9 @@ namespace osu.Game.Graphics.Containers protected override Container Content => content; [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { - parallaxEnabled = config.GetBindable(GameSetting.MenuParallax); + parallaxEnabled = config.GetBindable(OsuSetting.MenuParallax); parallaxEnabled.ValueChanged += delegate { if (!parallaxEnabled) diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index 4abe42b99b..4973cb0608 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -65,11 +65,11 @@ namespace osu.Game.Graphics.Containers } [BackgroundDependencyLoader] - private void load(GameConfigManager gameConfig) + private void load(OsuConfigManager gameConfig) { if (applyUIScale) { - uiScale = gameConfig.GetBindable(GameSetting.UIScale); + uiScale = gameConfig.GetBindable(OsuSetting.UIScale); uiScale.BindValueChanged(scaleChanged, true); } } @@ -82,21 +82,21 @@ namespace osu.Game.Graphics.Containers } [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { - scalingMode = config.GetBindable(GameSetting.Scaling); + scalingMode = config.GetBindable(OsuSetting.Scaling); scalingMode.ValueChanged += _ => updateSize(); - sizeX = config.GetBindable(GameSetting.ScalingSizeX); + sizeX = config.GetBindable(OsuSetting.ScalingSizeX); sizeX.ValueChanged += _ => updateSize(); - sizeY = config.GetBindable(GameSetting.ScalingSizeY); + sizeY = config.GetBindable(OsuSetting.ScalingSizeY); sizeY.ValueChanged += _ => updateSize(); - posX = config.GetBindable(GameSetting.ScalingPositionX); + posX = config.GetBindable(OsuSetting.ScalingPositionX); posX.ValueChanged += _ => updateSize(); - posY = config.GetBindable(GameSetting.ScalingPositionY); + posY = config.GetBindable(OsuSetting.ScalingPositionY); posY.ValueChanged += _ => updateSize(); } diff --git a/osu.Game/Graphics/Cursor/MenuCursor.cs b/osu.Game/Graphics/Cursor/MenuCursor.cs index d32d06a0fe..76c2345cd5 100644 --- a/osu.Game/Graphics/Cursor/MenuCursor.cs +++ b/osu.Game/Graphics/Cursor/MenuCursor.cs @@ -31,9 +31,9 @@ namespace osu.Game.Graphics.Cursor private Vector2 positionMouseDown; [BackgroundDependencyLoader(true)] - private void load([NotNull] GameConfigManager config, [CanBeNull] ScreenshotManager screenshotManager) + private void load([NotNull] OsuConfigManager config, [CanBeNull] ScreenshotManager screenshotManager) { - cursorRotate = config.GetBindable(GameSetting.CursorRotation); + cursorRotate = config.GetBindable(OsuSetting.CursorRotation); if (screenshotManager != null) screenshotCursorVisibility.BindTo(screenshotManager.CursorVisibility); @@ -131,7 +131,7 @@ namespace osu.Game.Graphics.Cursor } [BackgroundDependencyLoader] - private void load(GameConfigManager config, TextureStore textures, OsuColour colour) + private void load(OsuConfigManager config, TextureStore textures, OsuColour colour) { Children = new Drawable[] { @@ -155,7 +155,7 @@ namespace osu.Game.Graphics.Cursor } }; - cursorScale = config.GetBindable(GameSetting.MenuCursorSize); + cursorScale = config.GetBindable(OsuSetting.MenuCursorSize); cursorScale.ValueChanged += newScale => cursorContainer.Scale = new Vector2((float)newScale * base_scale); cursorScale.TriggerChange(); } diff --git a/osu.Game/Graphics/ScreenshotManager.cs b/osu.Game/Graphics/ScreenshotManager.cs index ce8ee4fff6..ef4209f6f3 100644 --- a/osu.Game/Graphics/ScreenshotManager.cs +++ b/osu.Game/Graphics/ScreenshotManager.cs @@ -42,14 +42,14 @@ namespace osu.Game.Graphics private SampleChannel shutter; [BackgroundDependencyLoader] - private void load(GameHost host, GameConfigManager config, Storage storage, NotificationOverlay notificationOverlay, AudioManager audio) + private void load(GameHost host, OsuConfigManager config, Storage storage, NotificationOverlay notificationOverlay, AudioManager audio) { this.host = host; this.storage = storage.GetStorageForDirectory(@"screenshots"); this.notificationOverlay = notificationOverlay; - screenshotFormat = config.GetBindable(GameSetting.ScreenshotFormat); - captureMenuCursor = config.GetBindable(GameSetting.ScreenshotCaptureMenuCursor); + screenshotFormat = config.GetBindable(OsuSetting.ScreenshotFormat); + captureMenuCursor = config.GetBindable(OsuSetting.ScreenshotCaptureMenuCursor); shutter = audio.Sample.Get("UI/shutter"); } diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 74dcacc5a5..9f5eb1441c 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -19,7 +19,7 @@ namespace osu.Game.Online.API { public class APIAccess : Component, IAPIProvider { - private readonly GameConfigManager config; + private readonly OsuConfigManager config; private readonly OAuth authentication; public string Endpoint = @"https://osu.ppy.sh"; @@ -43,16 +43,16 @@ namespace osu.Game.Online.API private readonly Logger log; - public APIAccess(GameConfigManager config) + public APIAccess(OsuConfigManager config) { this.config = config; authentication = new OAuth(client_id, client_secret, Endpoint); log = Logger.GetLogger(LoggingTarget.Network); - ProvidedUsername = config.Get(GameSetting.Username); + ProvidedUsername = config.Get(OsuSetting.Username); - authentication.TokenString = config.Get(GameSetting.Token); + authentication.TokenString = config.Get(OsuSetting.Token); authentication.Token.ValueChanged += onTokenChanged; var thread = new Thread(run) @@ -64,7 +64,7 @@ namespace osu.Game.Online.API thread.Start(); } - private void onTokenChanged(OAuthToken token) => config.Set(GameSetting.Token, config.Get(GameSetting.SavePassword) ? authentication.TokenString : string.Empty); + private void onTokenChanged(OAuthToken token) => config.Set(OsuSetting.Token, config.Get(OsuSetting.SavePassword) ? authentication.TokenString : string.Empty); private readonly List components = new List(); @@ -124,7 +124,7 @@ namespace osu.Game.Online.API State = APIState.Connecting; // save the username at this point, if the user requested for it to be. - config.Set(GameSetting.Username, config.Get(GameSetting.SaveUsername) ? ProvidedUsername : string.Empty); + config.Set(OsuSetting.Username, config.Get(OsuSetting.SaveUsername) ? ProvidedUsername : string.Empty); if (!authentication.HasValidAccessToken && !authentication.AuthenticateWithLogin(ProvidedUsername, password)) { diff --git a/osu.Game/Online/Chat/ExternalLinkOpener.cs b/osu.Game/Online/Chat/ExternalLinkOpener.cs index b82e8d9bd4..a2c5a3cf8c 100644 --- a/osu.Game/Online/Chat/ExternalLinkOpener.cs +++ b/osu.Game/Online/Chat/ExternalLinkOpener.cs @@ -18,11 +18,11 @@ namespace osu.Game.Online.Chat private Bindable externalLinkWarning; [BackgroundDependencyLoader(true)] - private void load(GameHost host, DialogOverlay dialogOverlay, GameConfigManager config) + private void load(GameHost host, DialogOverlay dialogOverlay, OsuConfigManager config) { this.host = host; this.dialogOverlay = dialogOverlay; - externalLinkWarning = config.GetBindable(GameSetting.ExternalLinkWarning); + externalLinkWarning = config.GetBindable(OsuSetting.ExternalLinkWarning); } public void OpenUrlExternally(string url) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index b9f7013db1..771dacfed3 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -174,17 +174,17 @@ namespace osu.Game dependencies.CacheAs>(ruleset); // bind config int to database RulesetInfo - configRuleset = LocalConfig.GetBindable(GameSetting.Ruleset); + configRuleset = LocalConfig.GetBindable(OsuSetting.Ruleset); ruleset.Value = RulesetStore.GetRuleset(configRuleset.Value) ?? RulesetStore.AvailableRulesets.First(); ruleset.ValueChanged += r => configRuleset.Value = r.ID ?? 0; // bind config int to database SkinInfo - configSkin = LocalConfig.GetBindable(GameSetting.Skin); + 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; configSkin.TriggerChange(); - LocalConfig.BindWith(GameSetting.VolumeInactive, inactiveVolumeAdjust); + LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust); } private ExternalLinkOpener externalLinkOpener; @@ -631,7 +631,7 @@ namespace osu.Game direct.ToggleVisibility(); return true; case GlobalAction.ToggleGameplayMouseButtons: - LocalConfig.Set(GameSetting.MouseDisableButtons, !LocalConfig.Get(GameSetting.MouseDisableButtons)); + LocalConfig.Set(OsuSetting.MouseDisableButtons, !LocalConfig.Get(OsuSetting.MouseDisableButtons)); return true; } diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 17bba66b3f..963d902dc8 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -43,7 +43,7 @@ namespace osu.Game /// public class OsuGameBase : Framework.Game, ICanAcceptFiles { - protected GameConfigManager LocalConfig; + protected OsuConfigManager LocalConfig; protected BeatmapManager BeatmapManager; @@ -206,7 +206,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(GameSetting.ShowFpsDisplay); + fpsDisplayVisible = LocalConfig.GetBindable(OsuSetting.ShowFpsDisplay); fpsDisplayVisible.ValueChanged += val => { FrameStatisticsMode = val ? FrameStatisticsMode.Minimal : FrameStatisticsMode.None; }; fpsDisplayVisible.TriggerChange(); } @@ -237,7 +237,7 @@ namespace osu.Game public override void SetHost(GameHost host) { if (LocalConfig == null) - LocalConfig = new GameConfigManager(host.Storage); + LocalConfig = new OsuConfigManager(host.Storage); base.SetHost(host); } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index 995733ab09..74edf48433 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -325,9 +325,9 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(GameConfigManager config, OsuColour colours, ChannelManager channelManager) + private void load(OsuConfigManager config, OsuColour colours, ChannelManager channelManager) { - ChatHeight = config.GetBindable(GameSetting.ChatDisplayHeight); + ChatHeight = config.GetBindable(OsuSetting.ChatDisplayHeight); ChatHeight.ValueChanged += h => { chatContainer.Height = (float)h; diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index 0a7c869968..becf70b03b 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -117,7 +117,7 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(FrameworkConfigManager frameworkConfig, GameConfigManager gameConfig) + private void load(FrameworkConfigManager frameworkConfig, OsuConfigManager gameConfig) { BeginTracking(this, frameworkConfig); BeginTracking(this, gameConfig); diff --git a/osu.Game/Overlays/Settings/Sections/Audio/MainMenuSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/MainMenuSettings.cs index 2999824df0..4e43caff23 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/MainMenuSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/MainMenuSettings.cs @@ -11,19 +11,19 @@ namespace osu.Game.Overlays.Settings.Sections.Audio protected override string Header => "Main Menu"; [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { Children = new[] { new SettingsCheckbox { LabelText = "Interface voices", - Bindable = config.GetBindable(GameSetting.MenuVoice) + Bindable = config.GetBindable(OsuSetting.MenuVoice) }, new SettingsCheckbox { LabelText = "osu! music theme", - Bindable = config.GetBindable(GameSetting.MenuMusic) + Bindable = config.GetBindable(OsuSetting.MenuMusic) }, }; } diff --git a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs index 514fcac5e4..aaa4302553 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/OffsetSettings.cs @@ -13,14 +13,14 @@ namespace osu.Game.Overlays.Settings.Sections.Audio protected override string Header => "Offset Adjustment"; [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { Children = new Drawable[] { new SettingsSlider { LabelText = "Audio offset", - Bindable = config.GetBindable(GameSetting.AudioOffset), + Bindable = config.GetBindable(OsuSetting.AudioOffset), KeyboardStep = 1f }, new SettingsButton diff --git a/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs b/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs index 9ad6e6ddf8..0124f7090e 100644 --- a/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Audio/VolumeSettings.cs @@ -13,12 +13,12 @@ namespace osu.Game.Overlays.Settings.Sections.Audio protected override string Header => "Volume"; [BackgroundDependencyLoader] - private void load(AudioManager audio, GameConfigManager config) + private void load(AudioManager audio, OsuConfigManager config) { Children = new Drawable[] { new SettingsSlider { LabelText = "Master", Bindable = audio.Volume, KeyboardStep = 0.01f }, - new SettingsSlider { LabelText = "Master (window inactive)", Bindable = config.GetBindable(GameSetting.VolumeInactive), KeyboardStep = 0.01f }, + new SettingsSlider { LabelText = "Master (window inactive)", Bindable = config.GetBindable(OsuSetting.VolumeInactive), KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Effect", Bindable = audio.VolumeSample, KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Music", Bindable = audio.VolumeTrack, KeyboardStep = 0.01f }, }; diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs index 15a854b0a8..997d1354b3 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/GeneralSettings.cs @@ -13,36 +13,36 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay protected override string Header => "General"; [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { Children = new Drawable[] { new SettingsSlider { LabelText = "Background dim", - Bindable = config.GetBindable(GameSetting.DimLevel), + Bindable = config.GetBindable(OsuSetting.DimLevel), KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Background blur", - Bindable = config.GetBindable(GameSetting.BlurLevel), + Bindable = config.GetBindable(OsuSetting.BlurLevel), KeyboardStep = 0.01f }, new SettingsCheckbox { LabelText = "Show score overlay", - Bindable = config.GetBindable(GameSetting.ShowInterface) + Bindable = config.GetBindable(OsuSetting.ShowInterface) }, new SettingsCheckbox { LabelText = "Always show key overlay", - Bindable = config.GetBindable(GameSetting.KeyOverlay) + Bindable = config.GetBindable(OsuSetting.KeyOverlay) }, new SettingsEnumDropdown { LabelText = "Score display mode", - Bindable = config.GetBindable(GameSetting.ScoreDisplayMode) + Bindable = config.GetBindable(OsuSetting.ScoreDisplayMode) } }; } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs index 20912da72c..2cf14f5aff 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/ModsSettings.cs @@ -11,14 +11,14 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay protected override string Header => "Mods"; [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { Children = new[] { new SettingsCheckbox { LabelText = "Increase visibility of first object with \"Hidden\" mod", - Bindable = config.GetBindable(GameSetting.IncreaseFirstObjectVisibility) + Bindable = config.GetBindable(OsuSetting.IncreaseFirstObjectVisibility) }, }; } diff --git a/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs b/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs index db767ac933..3e2272dba6 100644 --- a/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Gameplay/SongSelectSettings.cs @@ -13,36 +13,36 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay protected override string Header => "Song Select"; [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { Children = new Drawable[] { new SettingsCheckbox { LabelText = "Right mouse drag to absolute scroll", - Bindable = config.GetBindable(GameSetting.SongSelectRightMouseScroll), + Bindable = config.GetBindable(OsuSetting.SongSelectRightMouseScroll), }, new SettingsCheckbox { LabelText = "Show converted beatmaps", - Bindable = config.GetBindable(GameSetting.ShowConvertedBeatmaps), + Bindable = config.GetBindable(OsuSetting.ShowConvertedBeatmaps), }, new SettingsSlider { LabelText = "Display beatmaps from", - Bindable = config.GetBindable(GameSetting.DisplayStarsMinimum), + Bindable = config.GetBindable(OsuSetting.DisplayStarsMinimum), KeyboardStep = 0.1f }, new SettingsSlider { LabelText = "up to", - Bindable = config.GetBindable(GameSetting.DisplayStarsMaximum), + Bindable = config.GetBindable(OsuSetting.DisplayStarsMaximum), KeyboardStep = 0.1f }, new SettingsEnumDropdown { LabelText = "Random selection algorithm", - Bindable = config.GetBindable(GameSetting.RandomSelectAlgorithm), + Bindable = config.GetBindable(OsuSetting.RandomSelectAlgorithm), } }; } diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index 23d0dcbe38..4fad999577 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -206,7 +206,7 @@ namespace osu.Game.Overlays.Settings.Sections.General } [BackgroundDependencyLoader(permitNulls: true)] - private void load(APIAccess api, GameConfigManager config, AccountCreationOverlay accountCreation) + private void load(APIAccess api, OsuConfigManager config, AccountCreationOverlay accountCreation) { this.api = api; Direction = FillDirection.Vertical; @@ -232,12 +232,12 @@ namespace osu.Game.Overlays.Settings.Sections.General new SettingsCheckbox { LabelText = "Remember email address", - Bindable = config.GetBindable(GameSetting.SaveUsername), + Bindable = config.GetBindable(OsuSetting.SaveUsername), }, new SettingsCheckbox { LabelText = "Stay signed in", - Bindable = config.GetBindable(GameSetting.SavePassword), + Bindable = config.GetBindable(OsuSetting.SavePassword), }, new SettingsButton { diff --git a/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs b/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs index e94d94dd36..4d889856f6 100644 --- a/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/UpdateSettings.cs @@ -13,14 +13,14 @@ namespace osu.Game.Overlays.Settings.Sections.General protected override string Header => "Updates"; [BackgroundDependencyLoader] - private void load(Storage storage, GameConfigManager config) + private void load(Storage storage, OsuConfigManager config) { Children = new Drawable[] { new SettingsEnumDropdown { LabelText = "Release stream", - Bindable = config.GetBindable(GameSetting.ReleaseStream), + Bindable = config.GetBindable(OsuSetting.ReleaseStream), }, new SettingsButton { diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs index 3917def00b..01cdc9aa32 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/DetailSettings.cs @@ -12,29 +12,29 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics protected override string Header => "Detail Settings"; [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { Children = new Drawable[] { new SettingsCheckbox { LabelText = "Storyboards", - Bindable = config.GetBindable(GameSetting.ShowStoryboard) + Bindable = config.GetBindable(OsuSetting.ShowStoryboard) }, new SettingsCheckbox { LabelText = "Rotate cursor when dragging", - Bindable = config.GetBindable(GameSetting.CursorRotation) + Bindable = config.GetBindable(OsuSetting.CursorRotation) }, new SettingsEnumDropdown { LabelText = "Screenshot format", - Bindable = config.GetBindable(GameSetting.ScreenshotFormat) + Bindable = config.GetBindable(OsuSetting.ScreenshotFormat) }, new SettingsCheckbox { LabelText = "Show menu cursor in screenshots", - Bindable = config.GetBindable(GameSetting.ScreenshotCaptureMenuCursor) + Bindable = config.GetBindable(OsuSetting.ScreenshotCaptureMenuCursor) } }; } diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 768335b127..43309990a1 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -38,16 +38,16 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private const int transition_duration = 400; [BackgroundDependencyLoader] - private void load(FrameworkConfigManager config, GameConfigManager gameConfig, OsuGameBase game) + private void load(FrameworkConfigManager config, OsuConfigManager gameConfig, OsuGameBase game) { this.game = game; - scalingMode = gameConfig.GetBindable(GameSetting.Scaling); + scalingMode = gameConfig.GetBindable(OsuSetting.Scaling); sizeFullscreen = config.GetBindable(FrameworkSetting.SizeFullscreen); - scalingSizeX = gameConfig.GetBindable(GameSetting.ScalingSizeX); - scalingSizeY = gameConfig.GetBindable(GameSetting.ScalingSizeY); - scalingPositionX = gameConfig.GetBindable(GameSetting.ScalingPositionX); - scalingPositionY = gameConfig.GetBindable(GameSetting.ScalingPositionY); + scalingSizeX = gameConfig.GetBindable(OsuSetting.ScalingSizeX); + scalingSizeY = gameConfig.GetBindable(OsuSetting.ScalingSizeY); + scalingPositionX = gameConfig.GetBindable(OsuSetting.ScalingPositionX); + scalingPositionY = gameConfig.GetBindable(OsuSetting.ScalingPositionY); Container resolutionSettingsContainer; @@ -67,13 +67,13 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { LabelText = "UI Scaling", TransferValueOnCommit = true, - Bindable = gameConfig.GetBindable(GameSetting.UIScale), + Bindable = gameConfig.GetBindable(OsuSetting.UIScale), KeyboardStep = 0.01f }, new SettingsEnumDropdown { LabelText = "Screen Scaling", - Bindable = gameConfig.GetBindable(GameSetting.Scaling), + Bindable = gameConfig.GetBindable(OsuSetting.Scaling), }, scalingSettings = new FillFlowContainer> { diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/MainMenuSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/MainMenuSettings.cs index ab50aabe69..92f64d0e14 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/MainMenuSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/MainMenuSettings.cs @@ -11,14 +11,14 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics protected override string Header => "User Interface"; [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { Children = new[] { new SettingsCheckbox { LabelText = "Parallax", - Bindable = config.GetBindable(GameSetting.MenuParallax) + Bindable = config.GetBindable(OsuSetting.MenuParallax) }, }; } diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs index 599f711f92..e988179a5e 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs @@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics protected override string Header => "Renderer"; [BackgroundDependencyLoader] - private void load(FrameworkConfigManager config, GameConfigManager gameConfig) + private void load(FrameworkConfigManager config, OsuConfigManager gameConfig) { // NOTE: Compatability mode omitted Children = new Drawable[] @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics new SettingsCheckbox { LabelText = "Show FPS", - Bindable = gameConfig.GetBindable(GameSetting.ShowFpsDisplay) + Bindable = gameConfig.GetBindable(OsuSetting.ShowFpsDisplay) }, }; } diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 8c6d4a8591..12c93a8605 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input private SensitivitySetting sensitivity; [BackgroundDependencyLoader] - private void load(GameConfigManager gameConfig, FrameworkConfigManager config) + private void load(OsuConfigManager gameConfig, FrameworkConfigManager config) { Children = new Drawable[] { @@ -46,12 +46,12 @@ namespace osu.Game.Overlays.Settings.Sections.Input new SettingsCheckbox { LabelText = "Disable mouse wheel during gameplay", - Bindable = gameConfig.GetBindable(GameSetting.MouseDisableWheel) + Bindable = gameConfig.GetBindable(OsuSetting.MouseDisableWheel) }, new SettingsCheckbox { LabelText = "Disable mouse buttons during gameplay", - Bindable = gameConfig.GetBindable(GameSetting.MouseDisableButtons) + Bindable = gameConfig.GetBindable(OsuSetting.MouseDisableButtons) }, }; diff --git a/osu.Game/Overlays/Settings/Sections/Online/WebSettings.cs b/osu.Game/Overlays/Settings/Sections/Online/WebSettings.cs index 5d633ade1b..a8b3e45a83 100644 --- a/osu.Game/Overlays/Settings/Sections/Online/WebSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Online/WebSettings.cs @@ -12,14 +12,14 @@ namespace osu.Game.Overlays.Settings.Sections.Online protected override string Header => "Web"; [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { Children = new Drawable[] { new SettingsCheckbox { LabelText = "Warn about opening external links", - Bindable = config.GetBindable(GameSetting.ExternalLinkWarning) + Bindable = config.GetBindable(OsuSetting.ExternalLinkWarning) }, }; } diff --git a/osu.Game/Overlays/Settings/Sections/SkinSection.cs b/osu.Game/Overlays/Settings/Sections/SkinSection.cs index ed8eb1e003..7361d671de 100644 --- a/osu.Game/Overlays/Settings/Sections/SkinSection.cs +++ b/osu.Game/Overlays/Settings/Sections/SkinSection.cs @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Settings.Sections private SkinManager skins; [BackgroundDependencyLoader] - private void load(GameConfigManager config, SkinManager skins) + private void load(OsuConfigManager config, SkinManager skins) { this.skins = skins; @@ -38,41 +38,41 @@ namespace osu.Game.Overlays.Settings.Sections new SettingsSlider { LabelText = "Menu cursor size", - Bindable = config.GetBindable(GameSetting.MenuCursorSize), + Bindable = config.GetBindable(OsuSetting.MenuCursorSize), KeyboardStep = 0.01f }, new SettingsSlider { LabelText = "Gameplay cursor size", - Bindable = config.GetBindable(GameSetting.GameplayCursorSize), + Bindable = config.GetBindable(OsuSetting.GameplayCursorSize), KeyboardStep = 0.01f }, new SettingsCheckbox { LabelText = "Adjust gameplay cursor size based on current beatmap", - Bindable = config.GetBindable(GameSetting.AutoCursorSize) + Bindable = config.GetBindable(OsuSetting.AutoCursorSize) }, new SettingsCheckbox { LabelText = "Beatmap skins", - Bindable = config.GetBindable(GameSetting.BeatmapSkins) + Bindable = config.GetBindable(OsuSetting.BeatmapSkins) }, new SettingsCheckbox { LabelText = "Beatmap hitsounds", - Bindable = config.GetBindable(GameSetting.BeatmapHitsounds) + Bindable = config.GetBindable(OsuSetting.BeatmapHitsounds) }, }; skins.ItemAdded += itemAdded; skins.ItemRemoved += itemRemoved; - config.BindWith(GameSetting.Skin, configBindable); + config.BindWith(OsuSetting.Skin, configBindable); skinDropdown.Bindable = dropdownBindable; skinDropdown.Items = skins.GetAllUsableSkins().ToArray(); - // Todo: This should not be necessary when GameConfigManager is databased + // Todo: This should not be necessary when OsuConfigManager is databased if (skinDropdown.Items.All(s => s.ID != configBindable.Value)) configBindable.Value = 0; diff --git a/osu.Game/Rulesets/Mods/IReadFromConfig.cs b/osu.Game/Rulesets/Mods/IReadFromConfig.cs index da8cf43407..d66fabce70 100644 --- a/osu.Game/Rulesets/Mods/IReadFromConfig.cs +++ b/osu.Game/Rulesets/Mods/IReadFromConfig.cs @@ -10,6 +10,6 @@ namespace osu.Game.Rulesets.Mods /// public interface IReadFromConfig { - void ReadFromConfig(GameConfigManager config); + void ReadFromConfig(OsuConfigManager config); } } diff --git a/osu.Game/Rulesets/Mods/ModHidden.cs b/osu.Game/Rulesets/Mods/ModHidden.cs index c8c9347bbd..465ead450c 100644 --- a/osu.Game/Rulesets/Mods/ModHidden.cs +++ b/osu.Game/Rulesets/Mods/ModHidden.cs @@ -20,9 +20,9 @@ namespace osu.Game.Rulesets.Mods protected Bindable IncreaseFirstObjectVisibility = new Bindable(); - public void ReadFromConfig(GameConfigManager config) + public void ReadFromConfig(OsuConfigManager config) { - IncreaseFirstObjectVisibility = config.GetBindable(GameSetting.IncreaseFirstObjectVisibility); + IncreaseFirstObjectVisibility = config.GetBindable(OsuSetting.IncreaseFirstObjectVisibility); } public virtual void ApplyToDrawableHitObjects(IEnumerable drawables) diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index a63947cd5f..0d020238aa 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -248,7 +248,7 @@ namespace osu.Game.Rulesets.UI } [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { KeyBindingInputManager.AddRange(new Drawable[] { @@ -291,7 +291,7 @@ namespace osu.Game.Rulesets.UI /// Applies the active mods to this RulesetContainer. /// /// - private void applyRulesetMods(IEnumerable mods, GameConfigManager config) + private void applyRulesetMods(IEnumerable mods, OsuConfigManager config) { if (mods == null) return; diff --git a/osu.Game/Rulesets/UI/RulesetInputManager.cs b/osu.Game/Rulesets/UI/RulesetInputManager.cs index f3c0699377..274a9475db 100644 --- a/osu.Game/Rulesets/UI/RulesetInputManager.cs +++ b/osu.Game/Rulesets/UI/RulesetInputManager.cs @@ -193,9 +193,9 @@ namespace osu.Game.Rulesets.UI private Bindable mouseDisabled; [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { - mouseDisabled = config.GetBindable(GameSetting.MouseDisableButtons); + mouseDisabled = config.GetBindable(OsuSetting.MouseDisableButtons); } protected override bool Handle(UIEvent e) diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs index 18505fc6dc..93a84ec14d 100644 --- a/osu.Game/Screens/Menu/Intro.cs +++ b/osu.Game/Screens/Menu/Intro.cs @@ -47,12 +47,12 @@ namespace osu.Game.Screens.Menu private WorkingBeatmap introBeatmap; [BackgroundDependencyLoader] - private void load(AudioManager audio, GameConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap) + private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game, BindableBeatmap beatmap) { this.beatmap.BindTo(beatmap); - menuVoice = config.GetBindable(GameSetting.MenuVoice); - menuMusic = config.GetBindable(GameSetting.MenuMusic); + menuVoice = config.GetBindable(OsuSetting.MenuVoice); + menuMusic = config.GetBindable(OsuSetting.MenuMusic); BeatmapSetInfo setInfo = null; diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 32bc1390ed..1b1862d587 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -101,9 +101,9 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader(true)] - private void load(GameConfigManager config, NotificationOverlay notificationOverlay) + private void load(OsuConfigManager config, NotificationOverlay notificationOverlay) { - showHud = config.GetBindable(GameSetting.ShowInterface); + showHud = config.GetBindable(OsuSetting.ShowInterface); showHud.ValueChanged += hudVisibility => visibilityContainer.FadeTo(hudVisibility ? 1 : 0, duration); showHud.TriggerChange(); diff --git a/osu.Game/Screens/Play/KeyCounterCollection.cs b/osu.Game/Screens/Play/KeyCounterCollection.cs index 992e3c30b1..f033a20226 100644 --- a/osu.Game/Screens/Play/KeyCounterCollection.cs +++ b/osu.Game/Screens/Play/KeyCounterCollection.cs @@ -49,9 +49,9 @@ namespace osu.Game.Screens.Play } [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { - config.BindWith(GameSetting.KeyOverlay, configVisibility); + config.BindWith(OsuSetting.KeyOverlay, configVisibility); Visible.BindValueChanged(_ => updateVisibility()); configVisibility.BindValueChanged(_ => updateVisibility(), true); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 099dab7949..54644b8d9c 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -92,7 +92,7 @@ namespace osu.Game.Screens.Play public bool LoadedBeatmapSuccessfully => RulesetContainer?.Objects.Any() == true; [BackgroundDependencyLoader] - private void load(AudioManager audio, APIAccess api, GameConfigManager config) + private void load(AudioManager audio, APIAccess api, OsuConfigManager config) { this.api = api; @@ -102,8 +102,8 @@ namespace osu.Game.Screens.Play sampleRestart = audio.Sample.Get(@"Gameplay/restart"); - mouseWheelDisabled = config.GetBindable(GameSetting.MouseDisableWheel); - userAudioOffset = config.GetBindable(GameSetting.AudioOffset); + mouseWheelDisabled = config.GetBindable(OsuSetting.MouseDisableWheel); + userAudioOffset = config.GetBindable(OsuSetting.AudioOffset); IBeatmap beatmap; @@ -164,7 +164,7 @@ namespace osu.Game.Screens.Play ScoreProcessor = RulesetContainer.CreateScoreProcessor(); if (!ScoreProcessor.Mode.Disabled) - config.BindWith(GameSetting.ScoreDisplayMode, ScoreProcessor.Mode); + config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode); Children = new Drawable[] { diff --git a/osu.Game/Screens/Play/PlayerSettings/DiscussionSettings.cs b/osu.Game/Screens/Play/PlayerSettings/DiscussionSettings.cs index 98ae457dbd..5963352e5b 100644 --- a/osu.Game/Screens/Play/PlayerSettings/DiscussionSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/DiscussionSettings.cs @@ -13,14 +13,14 @@ namespace osu.Game.Screens.Play.PlayerSettings protected override string Title => @"discussions"; [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { Children = new Drawable[] { new PlayerCheckbox { LabelText = "Show floating comments", - Bindable = config.GetBindable(GameSetting.FloatingComments) + Bindable = config.GetBindable(OsuSetting.FloatingComments) }, new FocusedTextBox { diff --git a/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs b/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs index 16737a53ee..826be792bd 100644 --- a/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/InputSettings.cs @@ -25,6 +25,6 @@ namespace osu.Game.Screens.Play.PlayerSettings } [BackgroundDependencyLoader] - private void load(GameConfigManager config) => mouseButtonsCheckbox.Bindable = config.GetBindable(GameSetting.MouseDisableButtons); + private void load(OsuConfigManager config) => mouseButtonsCheckbox.Bindable = config.GetBindable(OsuSetting.MouseDisableButtons); } } diff --git a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs index b2842957e0..aec42eb024 100644 --- a/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs +++ b/osu.Game/Screens/Play/PlayerSettings/VisualSettings.cs @@ -43,13 +43,13 @@ namespace osu.Game.Screens.Play.PlayerSettings } [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { - dimSliderBar.Bindable = config.GetBindable(GameSetting.DimLevel); - blurSliderBar.Bindable = config.GetBindable(GameSetting.BlurLevel); - showStoryboardToggle.Bindable = config.GetBindable(GameSetting.ShowStoryboard); - beatmapSkinsToggle.Bindable = config.GetBindable(GameSetting.BeatmapSkins); - beatmapHitsoundsToggle.Bindable = config.GetBindable(GameSetting.BeatmapHitsounds); + dimSliderBar.Bindable = config.GetBindable(OsuSetting.DimLevel); + blurSliderBar.Bindable = config.GetBindable(OsuSetting.BlurLevel); + showStoryboardToggle.Bindable = config.GetBindable(OsuSetting.ShowStoryboard); + beatmapSkinsToggle.Bindable = config.GetBindable(OsuSetting.BeatmapSkins); + beatmapHitsoundsToggle.Bindable = config.GetBindable(OsuSetting.BeatmapHitsounds); } } } diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 09827a9a2c..1c127dbdef 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -33,11 +33,11 @@ namespace osu.Game.Screens.Play #endregion [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { - DimLevel = config.GetBindable(GameSetting.DimLevel); - BlurLevel = config.GetBindable(GameSetting.BlurLevel); - ShowStoryboard = config.GetBindable(GameSetting.ShowStoryboard); + DimLevel = config.GetBindable(OsuSetting.DimLevel); + BlurLevel = config.GetBindable(OsuSetting.BlurLevel); + ShowStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); } protected override void OnEntering(Screen last) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index 086e801496..1670bf4de8 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -125,10 +125,10 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader(permitNulls: true)] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { - config.BindWith(GameSetting.RandomSelectAlgorithm, RandomAlgorithm); - config.BindWith(GameSetting.SongSelectRightMouseScroll, RightClickScrollingEnabled); + config.BindWith(OsuSetting.RandomSelectAlgorithm, RandomAlgorithm); + config.BindWith(OsuSetting.SongSelectRightMouseScroll, RightClickScrollingEnabled); RightClickScrollingEnabled.ValueChanged += v => RightMouseScrollbar = v; RightClickScrollingEnabled.TriggerChange(); diff --git a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs index 1b943e432c..002633e8b9 100644 --- a/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs +++ b/osu.Game/Screens/Select/BeatmapDetailAreaTabControl.cs @@ -31,11 +31,11 @@ namespace osu.Game.Screens.Select } [BackgroundDependencyLoader] - private void load(OsuColour colour, GameConfigManager config) + private void load(OsuColour colour, OsuConfigManager config) { modsCheckbox.AccentColour = tabs.AccentColour = colour.YellowLight; - selectedTab = config.GetBindable(GameSetting.BeatmapDetailTab); + selectedTab = config.GetBindable(OsuSetting.BeatmapDetailTab); tabs.Current.BindTo(selectedTab); tabs.Current.TriggerChange(); diff --git a/osu.Game/Screens/Select/FilterControl.cs b/osu.Game/Screens/Select/FilterControl.cs index 2fd0794767..42f6606218 100644 --- a/osu.Game/Screens/Select/FilterControl.cs +++ b/osu.Game/Screens/Select/FilterControl.cs @@ -173,11 +173,11 @@ namespace osu.Game.Screens.Select public readonly Box Background; [BackgroundDependencyLoader(permitNulls: true)] - private void load(OsuColour colours, IBindable parentRuleset, GameConfigManager config) + private void load(OsuColour colours, IBindable parentRuleset, OsuConfigManager config) { sortTabs.AccentColour = colours.GreenLight; - showConverted = config.GetBindable(GameSetting.ShowConvertedBeatmaps); + showConverted = config.GetBindable(OsuSetting.ShowConvertedBeatmaps); showConverted.ValueChanged += val => updateCriteria(); ruleset.BindTo(parentRuleset); diff --git a/osu.Game/Skinning/LocalSkinOverrideContainer.cs b/osu.Game/Skinning/LocalSkinOverrideContainer.cs index 9f736375a9..8c172ffbcc 100644 --- a/osu.Game/Skinning/LocalSkinOverrideContainer.cs +++ b/osu.Game/Skinning/LocalSkinOverrideContainer.cs @@ -74,10 +74,10 @@ namespace osu.Game.Skinning } [BackgroundDependencyLoader] - private void load(GameConfigManager config) + private void load(OsuConfigManager config) { - config.BindWith(GameSetting.BeatmapSkins, beatmapSkins); - config.BindWith(GameSetting.BeatmapHitsounds, beatmapHitsounds); + config.BindWith(OsuSetting.BeatmapSkins, beatmapSkins); + config.BindWith(OsuSetting.BeatmapHitsounds, beatmapHitsounds); } protected override void LoadComplete() From 4a916b2dee6c92a02dba9a3f95ef8838190eb2a5 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 25 Jan 2019 11:17:48 +0100 Subject: [PATCH 015/185] replace license headers with new ones --- .../Configuration/OsuRulesetConfigManager.cs | 4 ++-- osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs | 4 ++-- osu.Game/Configuration/OsuConfigManager.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs index d931fb0eff..f6edd062e9 100644 --- a/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.cs +++ b/osu.Game.Rulesets.Osu/Configuration/OsuRulesetConfigManager.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.Game.Configuration; using osu.Game.Rulesets.Configuration; diff --git a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs index b4c873cf20..ce3432c73d 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuSettingsSubsection.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.Framework.Graphics; diff --git a/osu.Game/Configuration/OsuConfigManager.cs b/osu.Game/Configuration/OsuConfigManager.cs index aed56d79bf..0704460bfe 100644 --- a/osu.Game/Configuration/OsuConfigManager.cs +++ b/osu.Game/Configuration/OsuConfigManager.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.Configuration; using osu.Framework.Configuration.Tracking; From 77763fde8b64b466a6e1a1481c69d8ccee2ca746 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 25 Jan 2019 11:22:05 +0100 Subject: [PATCH 016/185] revert accidentally renamed variables --- .../Objects/Drawables/DrawableSlider.cs | 6 +++--- osu.Game/Graphics/Containers/ScalingContainer.cs | 4 ++-- osu.Game/Overlays/OnScreenDisplay.cs | 4 ++-- .../Settings/Sections/Graphics/LayoutSettings.cs | 16 ++++++++-------- .../Sections/Graphics/RendererSettings.cs | 4 ++-- .../Settings/Sections/Input/MouseSettings.cs | 6 +++--- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index b107fcc028..6bcf6aaf5e 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -93,10 +93,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } [BackgroundDependencyLoader] - private void load(OsuRulesetConfigManager rulesetConfig) + private void load(OsuRulesetConfigManager config) { - rulesetConfig.BindWith(OsuRulesetSetting.SnakingInSliders, Body.SnakingIn); - rulesetConfig.BindWith(OsuRulesetSetting.SnakingOutSliders, Body.SnakingOut); + config.BindWith(OsuRulesetSetting.SnakingInSliders, Body.SnakingIn); + config.BindWith(OsuRulesetSetting.SnakingOutSliders, Body.SnakingOut); positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); scaleBindable.BindValueChanged(v => diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index 4973cb0608..a20c17cc8e 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -65,11 +65,11 @@ namespace osu.Game.Graphics.Containers } [BackgroundDependencyLoader] - private void load(OsuConfigManager gameConfig) + private void load(OsuConfigManager osuConfig) { if (applyUIScale) { - uiScale = gameConfig.GetBindable(OsuSetting.UIScale); + uiScale = osuConfig.GetBindable(OsuSetting.UIScale); uiScale.BindValueChanged(scaleChanged, true); } } diff --git a/osu.Game/Overlays/OnScreenDisplay.cs b/osu.Game/Overlays/OnScreenDisplay.cs index becf70b03b..42031ee07e 100644 --- a/osu.Game/Overlays/OnScreenDisplay.cs +++ b/osu.Game/Overlays/OnScreenDisplay.cs @@ -117,10 +117,10 @@ namespace osu.Game.Overlays } [BackgroundDependencyLoader] - private void load(FrameworkConfigManager frameworkConfig, OsuConfigManager gameConfig) + private void load(FrameworkConfigManager frameworkConfig, OsuConfigManager osuConfig) { BeginTracking(this, frameworkConfig); - BeginTracking(this, gameConfig); + BeginTracking(this, osuConfig); } private readonly Dictionary<(object, IConfigManager), TrackedSettings> trackedConfigManagers = new Dictionary<(object, IConfigManager), TrackedSettings>(); diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs index 43309990a1..9c5ef32251 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/LayoutSettings.cs @@ -38,16 +38,16 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics private const int transition_duration = 400; [BackgroundDependencyLoader] - private void load(FrameworkConfigManager config, OsuConfigManager gameConfig, OsuGameBase game) + private void load(FrameworkConfigManager config, OsuConfigManager osuConfig, OsuGameBase game) { this.game = game; - scalingMode = gameConfig.GetBindable(OsuSetting.Scaling); + scalingMode = osuConfig.GetBindable(OsuSetting.Scaling); sizeFullscreen = config.GetBindable(FrameworkSetting.SizeFullscreen); - scalingSizeX = gameConfig.GetBindable(OsuSetting.ScalingSizeX); - scalingSizeY = gameConfig.GetBindable(OsuSetting.ScalingSizeY); - scalingPositionX = gameConfig.GetBindable(OsuSetting.ScalingPositionX); - scalingPositionY = gameConfig.GetBindable(OsuSetting.ScalingPositionY); + scalingSizeX = osuConfig.GetBindable(OsuSetting.ScalingSizeX); + scalingSizeY = osuConfig.GetBindable(OsuSetting.ScalingSizeY); + scalingPositionX = osuConfig.GetBindable(OsuSetting.ScalingPositionX); + scalingPositionY = osuConfig.GetBindable(OsuSetting.ScalingPositionY); Container resolutionSettingsContainer; @@ -67,13 +67,13 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics { LabelText = "UI Scaling", TransferValueOnCommit = true, - Bindable = gameConfig.GetBindable(OsuSetting.UIScale), + Bindable = osuConfig.GetBindable(OsuSetting.UIScale), KeyboardStep = 0.01f }, new SettingsEnumDropdown { LabelText = "Screen Scaling", - Bindable = gameConfig.GetBindable(OsuSetting.Scaling), + Bindable = osuConfig.GetBindable(OsuSetting.Scaling), }, scalingSettings = new FillFlowContainer> { diff --git a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs index e988179a5e..7317076c54 100644 --- a/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Graphics/RendererSettings.cs @@ -13,7 +13,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics protected override string Header => "Renderer"; [BackgroundDependencyLoader] - private void load(FrameworkConfigManager config, OsuConfigManager gameConfig) + private void load(FrameworkConfigManager config, OsuConfigManager osuConfig) { // NOTE: Compatability mode omitted Children = new Drawable[] @@ -27,7 +27,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics new SettingsCheckbox { LabelText = "Show FPS", - Bindable = gameConfig.GetBindable(OsuSetting.ShowFpsDisplay) + Bindable = osuConfig.GetBindable(OsuSetting.ShowFpsDisplay) }, }; } diff --git a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs index 12c93a8605..4f53b0a8a6 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/MouseSettings.cs @@ -19,7 +19,7 @@ namespace osu.Game.Overlays.Settings.Sections.Input private SensitivitySetting sensitivity; [BackgroundDependencyLoader] - private void load(OsuConfigManager gameConfig, FrameworkConfigManager config) + private void load(OsuConfigManager osuConfig, FrameworkConfigManager config) { Children = new Drawable[] { @@ -46,12 +46,12 @@ namespace osu.Game.Overlays.Settings.Sections.Input new SettingsCheckbox { LabelText = "Disable mouse wheel during gameplay", - Bindable = gameConfig.GetBindable(OsuSetting.MouseDisableWheel) + Bindable = osuConfig.GetBindable(OsuSetting.MouseDisableWheel) }, new SettingsCheckbox { LabelText = "Disable mouse buttons during gameplay", - Bindable = gameConfig.GetBindable(OsuSetting.MouseDisableButtons) + Bindable = osuConfig.GetBindable(OsuSetting.MouseDisableButtons) }, }; From 8955d5de044e4ed5039608fff87b2aa08b5bb25e Mon Sep 17 00:00:00 2001 From: ekrctb Date: Tue, 29 Jan 2019 15:25:27 +0900 Subject: [PATCH 017/185] 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 e2a312a663da3044544ca4d1a1d6fce21bab8938 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 14 Feb 2019 17:47:53 +0900 Subject: [PATCH 018/185] 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 a09e0790e1815b8ddd4ab38af20d319aa56b31ea Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 14 Feb 2019 18:07:28 +0900 Subject: [PATCH 019/185] 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 020/185] 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 66de451b537fee5b965cbc6506e396edce4af747 Mon Sep 17 00:00:00 2001 From: Poyo Date: Thu, 14 Feb 2019 02:19:41 -0800 Subject: [PATCH 021/185] Update difficulty color bracket thresholds --- .../Beatmaps/Drawables/DifficultyColouredContainer.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs index b025b5985c..89c43cc4df 100644 --- a/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs +++ b/osu.Game/Beatmaps/Drawables/DifficultyColouredContainer.cs @@ -48,11 +48,11 @@ namespace osu.Game.Beatmaps.Drawables var rating = beatmap.StarDifficulty; - if (rating < 1.5) return DifficultyRating.Easy; - if (rating < 2.25) return DifficultyRating.Normal; - if (rating < 3.75) return DifficultyRating.Hard; - if (rating < 5.25) return DifficultyRating.Insane; - if (rating < 6.75) return DifficultyRating.Expert; + if (rating < 2.0) return DifficultyRating.Easy; + if (rating < 2.7) return DifficultyRating.Normal; + if (rating < 4.0) return DifficultyRating.Hard; + if (rating < 5.3) return DifficultyRating.Insane; + if (rating < 6.5) return DifficultyRating.Expert; return DifficultyRating.ExpertPlus; } From 6da9f94ae3dd9404a3c2fb8c93dd205055185174 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 15 Feb 2019 16:17:01 +0900 Subject: [PATCH 022/185] 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 ad9dae975dc3e98fef2084f997791383a3c128a9 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 15 Feb 2019 16:38:27 +0900 Subject: [PATCH 023/185] 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 024/185] 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 025/185] 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 026/185] 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 0a265c6d35ece031f0a4680b1896731b47cac026 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Feb 2019 11:54:25 +0900 Subject: [PATCH 027/185] 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 028/185] 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 f241d67e5f79e8fea111bbf936215d7d67093804 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 18 Feb 2019 15:23:03 +0900 Subject: [PATCH 029/185] 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 030/185] 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 031/185] 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 032/185] 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 033/185] 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 034/185] 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 035/185] 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 036/185] 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 2e375a918656886726b457cddd31c80f8deec720 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 19 Feb 2019 19:44:26 +0900 Subject: [PATCH 037/185] 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 038/185] 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 1bd1b6b0997ad3a9851cbb7fbbc4c5c56d2cfeab Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Feb 2019 16:53:57 +0900 Subject: [PATCH 039/185] 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 040/185] 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 041/185] 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 042/185] 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 043/185] 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 ad5e81f0cdb273c8a6ffd2d9d879339bfeb89cc5 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 21 Feb 2019 15:24:26 +0900 Subject: [PATCH 044/185] 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 045/185] 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 046/185] 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 047/185] 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 94bc552282a950ec7f9ec79de72149e3c2c59d22 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Feb 2019 11:41:28 +0900 Subject: [PATCH 048/185] 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 65cdac60c3aa926dc0f0c91cd2459a548db1a7ec Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Feb 2019 14:43:05 +0900 Subject: [PATCH 049/185] 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 050/185] 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 263972a048590262c5708d29b382d385823459bf Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Feb 2019 17:00:00 +0900 Subject: [PATCH 051/185] 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 6bf831b96f2f558dc24ef3484d8486ff5a22d80a Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Feb 2019 17:15:05 +0900 Subject: [PATCH 052/185] 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 a4162a69fb89e7713c65692bb968aadadd1f2620 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Feb 2019 18:01:50 +0900 Subject: [PATCH 053/185] 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 76de39a3444c3c59c376fb95f40a365e34396445 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Feb 2019 20:34:51 +0900 Subject: [PATCH 054/185] 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 055/185] 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 f8d18285a8314633dabfdeaf543cfb41caa793e7 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Sat, 23 Feb 2019 14:59:54 +0900 Subject: [PATCH 056/185] 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 057/185] 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 809ab86ed048d79b14695f3074e2d71fc4251328 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Sat, 23 Feb 2019 17:04:02 +0900 Subject: [PATCH 058/185] 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 f4acd6e48f916749c0df9d8e9a0033fb523cdc68 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Sun, 24 Feb 2019 18:10:59 +0900 Subject: [PATCH 059/185] 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 060/185] 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 af4606f3d20309e07a7d4412062b5fcb8618ec09 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 25 Feb 2019 12:35:01 +0900 Subject: [PATCH 061/185] 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 062/185] 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 063/185] 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 064/185] 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 065/185] 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 066/185] 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 d750023c5201ce1fc787fd62112e8ae7746e0a2a Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 25 Feb 2019 22:05:49 +0900 Subject: [PATCH 067/185] 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 068/185] 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 c680d636949521f33b8dc2b134af2cdda1e54253 Mon Sep 17 00:00:00 2001 From: jorolf Date: Mon, 25 Feb 2019 23:44:43 +0100 Subject: [PATCH 069/185] Don't show the supporter text if the user already has supporter status --- osu.Game/Screens/Menu/Disclaimer.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index c0ff37cc0b..48f15852ba 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -10,6 +10,7 @@ using osu.Framework.Graphics.Sprites; using osu.Framework.Screens; using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Online.API; using osuTK; using osuTK.Graphics; using osu.Game.Overlays; @@ -39,7 +40,7 @@ namespace osu.Game.Screens.Menu } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, APIAccess api) { InternalChildren = new Drawable[] { @@ -107,6 +108,12 @@ namespace osu.Game.Screens.Menu t.Origin = Anchor.Centre; }).First()); + api.LocalUser.BindValueChanged(user => + { + if (user.IsSupporter) + textFlow.RemoveRange(supporterDrawables); + }, true); + iconColour = colours.Yellow; } From 796044ee7d3dabf1206947cd1c7a2c9b0c02eb8c Mon Sep 17 00:00:00 2001 From: jorolf Date: Mon, 25 Feb 2019 23:53:44 +0100 Subject: [PATCH 070/185] *I should've rechecked the code after the master merge* --- osu.Game/Screens/Menu/Disclaimer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index ccf49d7bd2..09f71da4bc 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -98,7 +98,7 @@ namespace osu.Game.Screens.Menu api.LocalUser.BindValueChanged(user => { - if (user.IsSupporter) + if (user.NewValue.IsSupporter) textFlow.RemoveRange(supporterDrawables); }, true); From 14e427fed76a284cce4a9bbc6a93e5053c192e93 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Feb 2019 09:54:28 +0900 Subject: [PATCH 071/185] 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 c58d305fc67540ddd44faefb0d80b327dba871db Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Feb 2019 09:56:22 +0900 Subject: [PATCH 072/185] 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 073/185] 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 074/185] 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 60ecb99dfb9326759cdac72564d523c7f478454d Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 26 Feb 2019 17:31:21 +0900 Subject: [PATCH 075/185] 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 076/185] 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 077/185] 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 078/185] 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 4c10185f5b5a2fbd22bb35e34539491279970401 Mon Sep 17 00:00:00 2001 From: jorolf Date: Tue, 26 Feb 2019 15:26:00 +0100 Subject: [PATCH 079/185] Fade out text instead of removing it immediately --- osu.Game/Screens/Menu/Disclaimer.cs | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 09f71da4bc..ea6abd260a 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Screens; @@ -14,6 +15,7 @@ using osu.Game.Online.API; using osuTK; using osuTK.Graphics; using osu.Game.Overlays; +using osu.Game.Users; namespace osu.Game.Screens.Menu { @@ -34,13 +36,16 @@ namespace osu.Game.Screens.Menu private const float icon_y = -85; + [Resolved] + private APIAccess api { get; set; } + public Disclaimer() { ValidForResume = false; } [BackgroundDependencyLoader] - private void load(OsuColour colours, APIAccess api) + private void load(OsuColour colours) { InternalChildren = new Drawable[] { @@ -96,12 +101,6 @@ namespace osu.Game.Screens.Menu t.Origin = Anchor.Centre; }).First()); - api.LocalUser.BindValueChanged(user => - { - if (user.NewValue.IsSupporter) - textFlow.RemoveRange(supporterDrawables); - }, true); - iconColour = colours.Yellow; } @@ -109,6 +108,8 @@ namespace osu.Game.Screens.Menu { base.LoadComplete(); LoadComponentAsync(intro = new Intro()); + + api.LocalUser.BindValueChanged(userChanged, true); } public override void OnEntering(IScreen last) @@ -134,5 +135,17 @@ namespace osu.Game.Screens.Menu heart.FlashColour(Color4.White, 750, Easing.OutQuint).Loop(); } + + public override void OnSuspending(IScreen next) + { + base.OnSuspending(next); + + api.LocalUser.ValueChanged -= userChanged; + } + + private void userChanged(ValueChangedEvent user) + { + if (user.NewValue.IsSupporter) supporterDrawables.ForEach(d => d.FadeOut(200, Easing.OutQuint).Expire()); + } } } From 5b4319a80f3d35d3be052231acc95b257725b7e0 Mon Sep 17 00:00:00 2001 From: Joehu Date: Tue, 26 Feb 2019 21:01:28 -0800 Subject: [PATCH 080/185] 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 081/185] 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 082/185] 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 083/185] 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 084/185] 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 085/185] 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 086/185] 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 087/185] 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 088/185] 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 089/185] 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 090/185] 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 091/185] 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 092/185] 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 093/185] 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 094/185] 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 095/185] 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 096/185] 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 097/185] 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 098/185] 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 099/185] 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 100/185] 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 101/185] 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 102/185] 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 103/185] 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 104/185] 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 105/185] 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 106/185] 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 107/185] 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 108/185] 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 109/185] 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 110/185] 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 111/185] 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 112/185] 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 113/185] 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 114/185] 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 115/185] 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 116/185] 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 117/185] 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 118/185] 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 119/185] 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 120/185] 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 121/185] 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 122/185] 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 123/185] 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 124/185] 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 125/185] 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 126/185] 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 127/185] 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 128/185] 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 129/185] 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 130/185] 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 131/185] 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 132/185] 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 133/185] 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 134/185] 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 135/185] 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 136/185] 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 137/185] 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 138/185] 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 139/185] 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 140/185] 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 141/185] 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 142/185] 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 f4a6612d483e05a1cfa4fa0eeeb8885f85469705 Mon Sep 17 00:00:00 2001 From: Joehu Date: Thu, 28 Feb 2019 15:43:04 -0800 Subject: [PATCH 143/185] Fade out taskbar tooltip after clicking --- osu.Game/Overlays/Toolbar/ToolbarButton.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Overlays/Toolbar/ToolbarButton.cs b/osu.Game/Overlays/Toolbar/ToolbarButton.cs index 4d8fbb99ac..855c7ad823 100644 --- a/osu.Game/Overlays/Toolbar/ToolbarButton.cs +++ b/osu.Game/Overlays/Toolbar/ToolbarButton.cs @@ -139,6 +139,7 @@ namespace osu.Game.Overlays.Toolbar protected override bool OnClick(ClickEvent e) { HoverBackground.FlashColour(Color4.White.Opacity(100), 500, Easing.OutQuint); + tooltipContainer.FadeOut(100); return base.OnClick(e); } From 67928ac1fe6e5dc170e1893e1d96e438e91830cf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 1 Mar 2019 09:49:11 +0900 Subject: [PATCH 144/185] 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 145/185] 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 146/185] 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 147/185] 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 148/185] 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 149/185] 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 150/185] 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 151/185] 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 152/185] 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 153/185] 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 154/185] 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 155/185] 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 156/185] 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 157/185] 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 158/185] 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 159/185] 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 160/185] 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 161/185] 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 162/185] 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 163/185] 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 164/185] 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 165/185] 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 166/185] 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 167/185] 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 168/185] 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 169/185] 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()); } } From 7151fe06dc9672532589e0bfad0b91f0fcd46263 Mon Sep 17 00:00:00 2001 From: Joehu Date: Fri, 1 Mar 2019 19:24:28 -0800 Subject: [PATCH 170/185] Normalize repo readme format --- README.md | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 8cfc2ffebf..abddb1faa1 100644 --- a/README.md +++ b/README.md @@ -1,22 +1,24 @@ -# osu! [![Build status](https://ci.appveyor.com/api/projects/status/u2p01nx7l6og8buh?svg=true)](https://ci.appveyor.com/project/peppy/osu) [![CodeFactor](https://www.codefactor.io/repository/github/ppy/osu/badge)](https://www.codefactor.io/repository/github/ppy/osu) [![dev chat](https://discordapp.com/api/guilds/188630481301012481/widget.png?style=shield)](https://discord.gg/ppy) +# osu! + +[![Build status](https://ci.appveyor.com/api/projects/status/u2p01nx7l6og8buh?svg=true)](https://ci.appveyor.com/project/peppy/osu) [![CodeFactor](https://www.codefactor.io/repository/github/ppy/osu/badge)](https://www.codefactor.io/repository/github/ppy/osu) [![dev chat](https://discordapp.com/api/guilds/188630481301012481/widget.png?style=shield)](https://discord.gg/ppy) Rhythm is just a *click* away. The future of [osu!](https://osu.ppy.sh) and the beginning of an open era! Commonly known by the codename "osu!lazer". Pew pew. -# Status +## Status This project is still heavily under development, but is in a state where users are encouraged to try it out and keep it installed alongside the stable osu! client. It will continue to evolve over the coming months and hopefully bring some new unique features to the table. We are accepting bug reports (please report with as much detail as possible). Feature requests are welcome as long as you read and understand the contribution guidelines listed below. -# Requirements +## Requirements - A desktop platform with the [.NET Core SDK 2.2](https://www.microsoft.com/net/learn/get-started) or higher installed. - When working with the codebase, we recommend using an IDE with intellisense and syntax highlighting, such as [Visual Studio 2017+](https://visualstudio.microsoft.com/vs/), [Jetbrains Rider](https://www.jetbrains.com/rider/) or [Visual Studio Code](https://code.visualstudio.com/). - Note that there are **[additional requirements for Windows 7 and Windows 8.1](https://docs.microsoft.com/en-us/dotnet/core/windows-prerequisites?tabs=netcore2x)** which you may need to manually install if your operating system is not up-to-date. -# Running osu! +## Running osu! -## Releases +### Releases If you are not interested in developing the game, please head over to the [releases](https://github.com/ppy/osu/releases) to download a precompiled build with automatic updating enabled. @@ -26,7 +28,7 @@ If you are not interested in developing the game, please head over to the [relea If your platform is not listed above, there is still a chance you can manually build it by following the instructions below. -## Downloading the source code +### Downloading the source code Clone the repository **including submodules**: @@ -41,7 +43,7 @@ To update the source code to the latest commit, run the following command inside git pull ``` -## Building +### Building Build configurations for the recommended IDEs (listed above) are included. You should use the provided Build/Run functionality of your IDE to get things going. When testing or building new components, it's highly encouraged you use the `VisualTests` project/configuration. More information on this provided below. @@ -57,7 +59,7 @@ If you are not interested in debugging osu!, you can add `-c Release` to gain pe If the build fails, try to restore nuget packages with `dotnet restore`. -### A note for Linux users +#### A note for Linux users On Linux, the environment variable `LD_LIBRARY_PATH` must point to the build directory, located at `osu.Desktop/bin/Debug/$NETCORE_VERSION`. @@ -69,15 +71,15 @@ For example, you can run osu! with the following command: LD_LIBRARY_PATH="$(pwd)/osu.Desktop/bin/Debug/netcoreapp2.2" dotnet run --project osu.Desktop ``` -## Testing with resource/framework modifications +### Testing with resource/framework modifications Sometimes it may be necessary to cross-test changes in [osu-resources](https://github.com/ppy/osu-resources) or [osu-framework](https://github.com/ppy/osu-framework). This can be achieved by running some commands as documented on the [osu-resources](https://github.com/ppy/osu-resources/wiki/Testing-local-resources-checkout-with-other-projects) and [osu-framework](https://github.com/ppy/osu-framework/wiki/Testing-local-framework-checkout-with-other-projects) wiki pages. -## Code analysis +### Code analysis Code analysis can be run with `powershell ./build.ps1` or `build.sh`. This is currently only supported under windows due to [resharper cli shortcomings](https://youtrack.jetbrains.com/issue/RSRP-410004). Alternatively, you can install resharper or use rider to get inline support in your IDE of choice. -# Contributing +## Contributing We welcome all contributions, but keep in mind that we already have a lot of the UI designed. If you wish to work on something with the intention on having it included in the official distribution, please open an issue for discussion and we will give you what you need from a design perspective to proceed. If you want to make *changes* to the design, we recommend you open an issue with your intentions before spending too much time, to ensure no effort is wasted. @@ -87,7 +89,7 @@ Contributions can be made via pull requests to this repository. We hope to credi Note that while we already have certain standards in place, nothing is set in stone. If you have an issue with the way code is structured; with any libraries we are using; with any processes involved with contributing, *please* bring it up. I welcome all feedback so we can make contributing to this project as pain-free as possible. -# Licence +## Licence The osu! client code and framework are licensed under the [MIT licence](https://opensource.org/licenses/MIT). Please see [the licence file](LICENCE) for more information. [tl;dr](https://tldrlegal.com/license/mit-license) you can do whatever you want as long as you include the original copyright and license notice in any copy of the software/source. From 83a02d32f77a9bb88efc1778abfecfd5b069591e Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Sat, 2 Mar 2019 13:25:59 +0900 Subject: [PATCH 171/185] Fix a few incorrect fonts --- osu.Game/Overlays/Chat/ChatLine.cs | 2 +- osu.Game/Screens/Menu/Disclaimer.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index a679f33e3a..55f3bfd260 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -88,7 +88,7 @@ namespace osu.Game.Overlays.Chat Drawable effectedUsername = username = new OsuSpriteText { Colour = hasBackground ? customUsernameColour : username_colours[message.Sender.Id % username_colours.Length], - Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Bold, italics: true) + Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.SemiBold, italics: true) }; if (hasBackground) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 8c1cfdcda1..23a9cb2120 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -70,7 +70,7 @@ namespace osu.Game.Screens.Menu 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); + Action format = t => t.Font = OsuFont.GetFont(size: 15, weight: FontWeight.SemiBold); textFlow.AddParagraph("Detailed bug reports are welcomed via github issues.", format); textFlow.NewParagraph(); From 268ea6a836159de56093eaafe602abc0a2f0ecbe Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Sat, 2 Mar 2019 13:28:16 +0900 Subject: [PATCH 172/185] Wrong line --- osu.Game/Overlays/Chat/ChatLine.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Overlays/Chat/ChatLine.cs b/osu.Game/Overlays/Chat/ChatLine.cs index 55f3bfd260..908ec5f026 100644 --- a/osu.Game/Overlays/Chat/ChatLine.cs +++ b/osu.Game/Overlays/Chat/ChatLine.cs @@ -88,7 +88,7 @@ namespace osu.Game.Overlays.Chat Drawable effectedUsername = username = new OsuSpriteText { Colour = hasBackground ? customUsernameColour : username_colours[message.Sender.Id % username_colours.Length], - Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.SemiBold, italics: true) + Font = OsuFont.GetFont(size: TextSize, weight: FontWeight.Bold, italics: true) }; if (hasBackground) @@ -137,7 +137,7 @@ namespace osu.Game.Overlays.Chat { Anchor = Anchor.CentreLeft, Origin = Anchor.CentreLeft, - Font = OsuFont.GetFont(size: TextSize * 0.75f, weight: FontWeight.Bold, fixedWidth: true) + Font = OsuFont.GetFont(size: TextSize * 0.75f, weight: FontWeight.SemiBold, fixedWidth: true) }, new MessageSender(message.Sender) { From 5487b011d674202b0425899ec88809e8a8d64e72 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 2 Mar 2019 14:34:56 +0900 Subject: [PATCH 173/185] Fix some inspections rider isn't able to deal with automatically --- .../Visual/TestCaseBeatmapScoresContainer.cs | 25 ++++++++----------- .../Components/Timeline/TimelineArea.cs | 6 +++-- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs b/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs index 6ad11ae6c4..bb55c0b1e8 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs +++ b/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs @@ -23,9 +23,6 @@ namespace osu.Game.Tests.Visual [System.ComponentModel.Description("in BeatmapOverlay")] public class TestCaseBeatmapScoresContainer : OsuTestCase { - private readonly IEnumerable scores; - private readonly IEnumerable anotherScores; - private readonly APIScoreInfo topScoreInfo; private readonly Box background; public TestCaseBeatmapScoresContainer() @@ -47,15 +44,7 @@ namespace osu.Game.Tests.Visual } }; - AddStep("scores pack 1", () => scoresContainer.Scores = scores); - AddStep("scores pack 2", () => scoresContainer.Scores = anotherScores); - AddStep("only top score", () => scoresContainer.Scores = new[] { topScoreInfo }); - AddStep("remove scores", () => scoresContainer.Scores = null); - AddStep("resize to big", () => container.ResizeWidthTo(1, 300)); - AddStep("resize to normal", () => container.ResizeWidthTo(0.8f, 300)); - AddStep("online scores", () => scoresContainer.Beatmap = new BeatmapInfo { OnlineBeatmapID = 75, Ruleset = new OsuRuleset().RulesetInfo }); - - scores = new[] + IEnumerable scores = new[] { new APIScoreInfo { @@ -168,7 +157,7 @@ namespace osu.Game.Tests.Visual s.Statistics.Add(HitResult.Meh, RNG.Next(2000)); } - anotherScores = new[] + IEnumerable anotherScores = new[] { new APIScoreInfo { @@ -280,7 +269,7 @@ namespace osu.Game.Tests.Visual s.Statistics.Add(HitResult.Meh, RNG.Next(2000)); } - topScoreInfo = new APIScoreInfo + var topScoreInfo = new APIScoreInfo { User = new User { @@ -305,6 +294,14 @@ namespace osu.Game.Tests.Visual topScoreInfo.Statistics.Add(HitResult.Great, RNG.Next(2000)); topScoreInfo.Statistics.Add(HitResult.Good, RNG.Next(2000)); topScoreInfo.Statistics.Add(HitResult.Meh, RNG.Next(2000)); + + AddStep("scores pack 1", () => scoresContainer.Scores = scores); + AddStep("scores pack 2", () => scoresContainer.Scores = anotherScores); + AddStep("only top score", () => scoresContainer.Scores = new[] { topScoreInfo }); + AddStep("remove scores", () => scoresContainer.Scores = null); + AddStep("resize to big", () => container.ResizeWidthTo(1, 300)); + AddStep("resize to normal", () => container.ResizeWidthTo(0.8f, 300)); + AddStep("online scores", () => scoresContainer.Beatmap = new BeatmapInfo { OnlineBeatmapID = 75, Ruleset = new OsuRuleset().RulesetInfo }); } [BackgroundDependencyLoader] diff --git a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs index 42657ef3f7..3b24925f2c 100644 --- a/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs +++ b/osu.Game/Screens/Edit/Compose/Components/Timeline/TimelineArea.cs @@ -91,7 +91,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline RelativeSizeAxes = Axes.Y, Height = 0.5f, Icon = FontAwesome.fa_search_plus, - Action = () => timeline.Zoom++ + Action = () => changeZoom(1) }, new TimelineButton { @@ -100,7 +100,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline RelativeSizeAxes = Axes.Y, Height = 0.5f, Icon = FontAwesome.fa_search_minus, - Action = () => timeline.Zoom-- + Action = () => changeZoom(-1) }, } } @@ -124,5 +124,7 @@ namespace osu.Game.Screens.Edit.Compose.Components.Timeline timeline.WaveformVisible.BindTo(waveformCheckbox.Current); } + + private void changeZoom(float change) => timeline.Zoom += change; } } From b7126b3efb2824da40ef53673ec262a01f348f18 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 2 Mar 2019 14:48:05 +0900 Subject: [PATCH 174/185] Fix mod select overlay dimming itself --- .../Graphics/Containers/OsuFocusedOverlayContainer.cs | 8 +++++++- osu.Game/Overlays/Mods/ModSelectOverlay.cs | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs index 8e47bf2e99..c6ee91f961 100644 --- a/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs +++ b/osu.Game/Graphics/Containers/OsuFocusedOverlayContainer.cs @@ -24,6 +24,12 @@ namespace osu.Game.Graphics.Containers protected override bool BlockNonPositionalInput => true; + /// + /// Temporary to allow for overlays in the main screen content to not dim theirselves. + /// Should be eventually replaced by dimming which is aware of the target dim container (traverse parent for certain interface type?). + /// + protected virtual bool DimMainContent => true; + [Resolved(CanBeNull = true)] private OsuGame osuGame { get; set; } @@ -95,7 +101,7 @@ namespace osu.Game.Graphics.Containers if (OverlayActivationMode.Value != OverlayActivation.Disabled) { if (PlaySamplesOnStateChange) samplePopIn?.Play(); - if (BlockScreenWideMouse) osuGame?.AddBlockingOverlay(this); + if (BlockScreenWideMouse && DimMainContent) osuGame?.AddBlockingOverlay(this); } else State = Visibility.Hidden; diff --git a/osu.Game/Overlays/Mods/ModSelectOverlay.cs b/osu.Game/Overlays/Mods/ModSelectOverlay.cs index 24faf36ef8..aa41723ca6 100644 --- a/osu.Game/Overlays/Mods/ModSelectOverlay.cs +++ b/osu.Game/Overlays/Mods/ModSelectOverlay.cs @@ -38,6 +38,8 @@ namespace osu.Game.Overlays.Mods protected override bool BlockNonPositionalInput => false; + protected override bool DimMainContent => false; + protected readonly FillFlowContainer ModSectionsContainer; protected readonly Bindable> SelectedMods = new Bindable>(new Mod[] { }); From 73ba91bbad2dd77e19fbb017a03e5f55bd3624ce Mon Sep 17 00:00:00 2001 From: HoLLy Date: Sat, 2 Mar 2019 14:05:56 +0100 Subject: [PATCH 175/185] Add failing test case --- .../TestCaseHyperDash.cs | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs index 0851fbed87..5df8f2c2c1 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs @@ -1,9 +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; using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Objects; +using osu.Game.Screens.Play; namespace osu.Game.Rulesets.Catch.Tests { @@ -11,19 +13,34 @@ namespace osu.Game.Rulesets.Catch.Tests public class TestCaseHyperDash : Game.Tests.Visual.TestCasePlayer { public TestCaseHyperDash() - : base(new CatchRuleset()) - { - } + : base(new CatchRuleset()) { } protected override IBeatmap CreateBeatmap(Ruleset ruleset) { - var beatmap = new Beatmap { BeatmapInfo = { Ruleset = ruleset.RulesetInfo } }; + var beatmap = new Beatmap + { + BeatmapInfo = + { + Ruleset = ruleset.RulesetInfo, + BaseDifficulty = new BeatmapDifficulty { CircleSize = 3.6f } + } + }; + + // Should produce a hperdash + beatmap.HitObjects.Add(new Fruit { StartTime = 816, X = 308 / 512f, NewCombo = true }); + beatmap.HitObjects.Add(new Fruit { StartTime = 1008, X = 56 / 512f, }); for (int i = 0; i < 512; i++) if (i % 5 < 3) - beatmap.HitObjects.Add(new Fruit { X = i % 10 < 5 ? 0.02f : 0.98f, StartTime = i * 100, NewCombo = i % 8 == 0 }); + beatmap.HitObjects.Add(new Fruit { X = i % 10 < 5 ? 0.02f : 0.98f, StartTime = 2000 + i * 100, NewCombo = i % 8 == 0 }); return beatmap; } + + protected override void AddCheckSteps(Func player) + { + base.AddCheckSteps(player); + AddAssert("First note is hyperdash", () => Beatmap.Value.Beatmap.HitObjects[0] is Fruit f && f.HyperDash); + } } } From 5ff47924ab9d0f97124a9c1030e105e80f05b183 Mon Sep 17 00:00:00 2001 From: HoLLy Date: Sat, 2 Mar 2019 14:06:53 +0100 Subject: [PATCH 176/185] Add missing grace time in hyperdash calculation --- osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs index 5f1e0b97da..fac08cd0e1 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs @@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps CatchHitObject nextObject = objectWithDroplets[i + 1]; int thisDirection = nextObject.X > currentObject.X ? 1 : -1; - double timeToNext = nextObject.StartTime - currentObject.StartTime; + double timeToNext = nextObject.StartTime - currentObject.StartTime - 1000f / 60f / 4; // 4 frames of grace time, taken from osu-stable double distanceToNext = Math.Abs(nextObject.X - currentObject.X) - (lastDirection == thisDirection ? lastExcess : halfCatcherWidth); float distanceToHyper = (float)(timeToNext * CatcherArea.Catcher.BASE_SPEED - distanceToNext); if (distanceToHyper < 0) From e8d568470dd21ecc2b8b72ad2dd1f378444953ee Mon Sep 17 00:00:00 2001 From: jorolf Date: Sat, 2 Mar 2019 19:13:38 +0100 Subject: [PATCH 177/185] use a bindable instead --- osu.Game/Screens/Menu/Disclaimer.cs | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index a4736e8c60..b8b372fa24 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -36,8 +36,7 @@ namespace osu.Game.Screens.Menu private const float icon_y = -85; - [Resolved] - private APIAccess api { get; set; } + private readonly Bindable currentUser = new Bindable(); public Disclaimer() { @@ -45,7 +44,7 @@ namespace osu.Game.Screens.Menu } [BackgroundDependencyLoader] - private void load(OsuColour colours) + private void load(OsuColour colours, APIAccess api) { InternalChildren = new Drawable[] { @@ -102,14 +101,19 @@ namespace osu.Game.Screens.Menu }).First()); iconColour = colours.Yellow; + + currentUser.BindTo(api.LocalUser); + currentUser.BindValueChanged(e => + { + if (e.NewValue.IsSupporter) + supporterDrawables.ForEach(d => d.FadeOut(200, Easing.OutQuint).Expire()); + }, true); } protected override void LoadComplete() { base.LoadComplete(); LoadComponentAsync(intro = new Intro()); - - api.LocalUser.BindValueChanged(userChanged, true); } public override void OnEntering(IScreen last) @@ -140,12 +144,7 @@ namespace osu.Game.Screens.Menu { base.OnSuspending(next); - api.LocalUser.ValueChanged -= userChanged; - } - - private void userChanged(ValueChangedEvent user) - { - if (user.NewValue.IsSupporter) supporterDrawables.ForEach(d => d.FadeOut(200, Easing.OutQuint).Expire()); + currentUser.UnbindAll(); } } } From 1ea4781188c8614684650bd8afa6504435320f3c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 3 Mar 2019 13:50:36 +0900 Subject: [PATCH 178/185] Fix code styling --- osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs index 5df8f2c2c1..7451986a8b 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs @@ -13,7 +13,9 @@ namespace osu.Game.Rulesets.Catch.Tests public class TestCaseHyperDash : Game.Tests.Visual.TestCasePlayer { public TestCaseHyperDash() - : base(new CatchRuleset()) { } + : base(new CatchRuleset()) + { + } protected override IBeatmap CreateBeatmap(Ruleset ruleset) { From 6ffa139ea8ee7dcbc33a667885c29335d2a0e3d0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 3 Mar 2019 20:02:56 +0900 Subject: [PATCH 179/185] Adjust transition length slightly --- osu.Game/Screens/Menu/Disclaimer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index b8b372fa24..35a1e18097 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -106,7 +106,7 @@ namespace osu.Game.Screens.Menu currentUser.BindValueChanged(e => { if (e.NewValue.IsSupporter) - supporterDrawables.ForEach(d => d.FadeOut(200, Easing.OutQuint).Expire()); + supporterDrawables.ForEach(d => d.FadeOut(500, Easing.OutQuint).Expire()); }, true); } From 08e153208d2340119c54cb59224db9547e14993b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 3 Mar 2019 20:03:22 +0900 Subject: [PATCH 180/185] Unbinds are automatic --- osu.Game/Screens/Menu/Disclaimer.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/osu.Game/Screens/Menu/Disclaimer.cs b/osu.Game/Screens/Menu/Disclaimer.cs index 35a1e18097..89f4f92092 100644 --- a/osu.Game/Screens/Menu/Disclaimer.cs +++ b/osu.Game/Screens/Menu/Disclaimer.cs @@ -139,12 +139,5 @@ namespace osu.Game.Screens.Menu heart.FlashColour(Color4.White, 750, Easing.OutQuint).Loop(); } - - public override void OnSuspending(IScreen next) - { - base.OnSuspending(next); - - currentUser.UnbindAll(); - } } } From 679d30d08a6fe0ced3ed0914d9e11388bd5fd897 Mon Sep 17 00:00:00 2001 From: HoLLy Date: Sun, 3 Mar 2019 11:21:39 +0000 Subject: [PATCH 181/185] Fix comment mentioning 4 frames instead of 1/4 --- osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs index fac08cd0e1..78b5a510b2 100644 --- a/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs +++ b/osu.Game.Rulesets.Catch/Beatmaps/CatchBeatmapProcessor.cs @@ -100,7 +100,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps CatchHitObject nextObject = objectWithDroplets[i + 1]; int thisDirection = nextObject.X > currentObject.X ? 1 : -1; - double timeToNext = nextObject.StartTime - currentObject.StartTime - 1000f / 60f / 4; // 4 frames of grace time, taken from osu-stable + double timeToNext = nextObject.StartTime - currentObject.StartTime - 1000f / 60f / 4; // 1/4th of a frame of grace time, taken from osu-stable double distanceToNext = Math.Abs(nextObject.X - currentObject.X) - (lastDirection == thisDirection ? lastExcess : halfCatcherWidth); float distanceToHyper = (float)(timeToNext * CatcherArea.Catcher.BASE_SPEED - distanceToNext); if (distanceToHyper < 0) From b076ac95f047612a5296ed65f5f24bf712f1976a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Mar 2019 13:02:43 +0900 Subject: [PATCH 182/185] Enforce max consecutive blank lines --- osu.sln.DotSettings | 2 ++ 1 file changed, 2 insertions(+) diff --git a/osu.sln.DotSettings b/osu.sln.DotSettings index 5363d6dddf..3c6a6dd2a9 100644 --- a/osu.sln.DotSettings +++ b/osu.sln.DotSettings @@ -230,6 +230,8 @@ True NEXT_LINE NEXT_LINE + 1 + 1 True NEVER NEVER From 3f197935d70e9a0042b89d1d44381cbe306783c2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 4 Mar 2019 14:03:59 +0900 Subject: [PATCH 183/185] Fix remaining case --- osu.Game/Graphics/UserInterface/RollingCounter.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Graphics/UserInterface/RollingCounter.cs b/osu.Game/Graphics/UserInterface/RollingCounter.cs index 47e12f5f15..cd244ed7e6 100644 --- a/osu.Game/Graphics/UserInterface/RollingCounter.cs +++ b/osu.Game/Graphics/UserInterface/RollingCounter.cs @@ -59,7 +59,6 @@ namespace osu.Game.Graphics.UserInterface public abstract void Increment(T amount); - public float TextSize { get => DisplayedCountSpriteText.Font.Size; From 5bb0511f0a857b9adbd6228ef8e472b5d0e5f1f2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 5 Mar 2019 13:16:41 +0900 Subject: [PATCH 184/185] Fix SquareGraph not correctly filling columns when loaded with a non-zero time --- osu.Game/Screens/Play/SquareGraph.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/osu.Game/Screens/Play/SquareGraph.cs b/osu.Game/Screens/Play/SquareGraph.cs index 95ac35baa7..d10034d552 100644 --- a/osu.Game/Screens/Play/SquareGraph.cs +++ b/osu.Game/Screens/Play/SquareGraph.cs @@ -242,7 +242,11 @@ namespace osu.Game.Screens.Play // Reverse drawableRows so when iterating through them they start at the bottom drawableRows.Reverse(); + } + protected override void LoadComplete() + { + base.LoadComplete(); fillActive(); } From 0322bd88120aba791daf21d208ee29fdc4b77ba6 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Tue, 5 Mar 2019 14:40:27 +0900 Subject: [PATCH 185/185] Make config nullable, removing testcase code --- osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs | 12 ------------ .../TestCaseSliderSelectionBlueprint.cs | 12 ------------ .../Objects/Drawables/DrawableSlider.cs | 9 ++++++--- 3 files changed, 6 insertions(+), 27 deletions(-) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs index d216d88c0d..35e8f3e17e 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSlider.cs @@ -16,14 +16,12 @@ using osuTK.Graphics; using osu.Game.Rulesets.Mods; using System.Linq; using NUnit.Framework; -using osu.Framework.Allocation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Rulesets.Judgements; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Types; -using osu.Game.Rulesets.Osu.Configuration; using osu.Game.Rulesets.Osu.Objects.Drawables.Pieces; namespace osu.Game.Rulesets.Osu.Tests @@ -42,16 +40,6 @@ namespace osu.Game.Rulesets.Osu.Tests typeof(DrawableOsuHitObject) }; - protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) - { - var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); - - var configCache = dependencies.Get(); - dependencies.CacheAs((OsuRulesetConfigManager)configCache.GetConfigFor(new OsuRuleset())); - - return dependencies; - } - private readonly Container content; protected override Container Content => content; diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs index 4279925db5..a7386ba48b 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseSliderSelectionBlueprint.cs @@ -3,13 +3,11 @@ using System; using System.Collections.Generic; -using osu.Framework.Allocation; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; using osu.Game.Rulesets.Objects.Types; -using osu.Game.Rulesets.Osu.Configuration; using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders; using osu.Game.Rulesets.Osu.Edit.Blueprints.Sliders.Components; using osu.Game.Rulesets.Osu.Objects; @@ -31,16 +29,6 @@ namespace osu.Game.Rulesets.Osu.Tests typeof(PathControlPointPiece) }; - protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) - { - var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); - - var configCache = dependencies.Get(); - dependencies.CacheAs((OsuRulesetConfigManager)configCache.GetConfigFor(new OsuRuleset())); - - return dependencies; - } - private readonly DrawableSlider drawableObject; public TestCaseSliderSelectionBlueprint() diff --git a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs index f9aa1c6b54..ff74954552 100644 --- a/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs +++ b/osu.Game.Rulesets.Osu/Objects/Drawables/DrawableSlider.cs @@ -33,6 +33,9 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables private readonly IBindable scaleBindable = new Bindable(); private readonly IBindable pathBindable = new Bindable(); + [Resolved(CanBeNull = true)] + private OsuRulesetConfigManager config { get; set; } + public DrawableSlider(Slider s) : base(s) { @@ -94,10 +97,10 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables } [BackgroundDependencyLoader] - private void load(OsuRulesetConfigManager config) + private void load() { - config.BindWith(OsuRulesetSetting.SnakingInSliders, Body.SnakingIn); - config.BindWith(OsuRulesetSetting.SnakingOutSliders, Body.SnakingOut); + config?.BindWith(OsuRulesetSetting.SnakingInSliders, Body.SnakingIn); + config?.BindWith(OsuRulesetSetting.SnakingOutSliders, Body.SnakingOut); positionBindable.BindValueChanged(_ => Position = HitObject.StackedPosition); scaleBindable.BindValueChanged(scale =>