From 07bb278ec0e85acfd534074241c0a0ede785296b Mon Sep 17 00:00:00 2001 From: Scotsoo Date: Sun, 27 Jan 2019 18:19:20 +0000 Subject: [PATCH 001/107] Considering GlobalActions in GameplatMenuOverlay --- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 21 +++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index 2c984e6135..f0eb3f49b5 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -39,6 +39,12 @@ namespace osu.Game.Screens.Play /// protected virtual Action BackAction => () => InternalButtons.Children.Last().Click(); + /// + /// Action that is invoked when is triggered. + /// + protected Action SelectAction => () => InternalButtons.Children.FirstOrDefault(f => f.Selected)?.Click(); + + public abstract string Header { get; } public abstract string Description { get; } @@ -235,6 +241,12 @@ namespace osu.Game.Screens.Play return true; } + if (action == GlobalAction.Select) + { + SelectAction.Invoke(); + return true; + } + return false; } @@ -289,15 +301,6 @@ namespace osu.Game.Screens.Play Selected.Value = true; return base.OnMouseMove(e); } - - protected override bool OnKeyDown(KeyDownEvent e) - { - if (e.Repeat || e.Key != Key.Enter || !Selected) - return false; - - Click(); - return true; - } } } } From 29c02fbaa7ad4e399d522072c1bd048d5b89891b Mon Sep 17 00:00:00 2001 From: Scotsoo Date: Sun, 27 Jan 2019 18:27:11 +0000 Subject: [PATCH 002/107] Remove redundant space --- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index f0eb3f49b5..19afdb42e9 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -44,7 +44,6 @@ namespace osu.Game.Screens.Play /// protected Action SelectAction => () => InternalButtons.Children.FirstOrDefault(f => f.Selected)?.Click(); - public abstract string Header { get; } public abstract string Description { get; } From c00636d328d99452d5012ee61e221972f4b36da6 Mon Sep 17 00:00:00 2001 From: Scotsoo Date: Sun, 27 Jan 2019 19:09:30 +0000 Subject: [PATCH 003/107] Removing whitespace --- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index 19afdb42e9..e9c58ce3a2 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -43,7 +43,6 @@ namespace osu.Game.Screens.Play /// Action that is invoked when is triggered. /// protected Action SelectAction => () => InternalButtons.Children.FirstOrDefault(f => f.Selected)?.Click(); - public abstract string Header { get; } public abstract string Description { get; } From 2df57c3a2963c646e55d3b8268b2254fc3e49862 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 11 Mar 2019 11:08:04 +0900 Subject: [PATCH 004/107] Give Multiplayer its own background stack --- osu.Game/Screens/Multi/Multiplayer.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index dd01ae4160..513b949b35 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -50,6 +50,9 @@ namespace osu.Game.Screens.Multi [Cached(Type = typeof(IRoomManager))] private RoomManager roomManager; + [Cached] + private BackgroundScreenStack backgroundScreenStack; + [Resolved] private OsuGameBase game { get; set; } @@ -95,7 +98,11 @@ namespace osu.Game.Screens.Multi { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = Header.HEIGHT }, - Child = screenStack = new ScreenStack(loungeSubScreen = new LoungeSubScreen()) { RelativeSizeAxes = Axes.Both } + Children = new[] + { + backgroundScreenStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both }, + screenStack = new ScreenStack(loungeSubScreen = new LoungeSubScreen()) { RelativeSizeAxes = Axes.Both }, + } }, new Header(screenStack), createButton = new HeaderButton From 0b64af5e0211b10a1db88d7c4bd37cdcb44095cc Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 11 Mar 2019 16:51:43 +0900 Subject: [PATCH 005/107] Put multiplayer background inside a parallax container --- osu.Game/Screens/Multi/Multiplayer.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index 513b949b35..ee7244b0cd 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -38,6 +38,7 @@ namespace osu.Game.Screens.Multi private readonly OsuButton createButton; private readonly LoungeSubScreen loungeSubScreen; private readonly ScreenStack screenStack; + private ParallaxContainer backgroundParallax; private readonly IBindable isIdle = new BindableBool(); @@ -98,9 +99,13 @@ namespace osu.Game.Screens.Multi { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = Header.HEIGHT }, - Children = new[] + Children = new CompositeDrawable[] { - backgroundScreenStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both }, + backgroundParallax = new ParallaxContainer + { + RelativeSizeAxes = Axes.Both, + Child = backgroundScreenStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both }, + }, screenStack = new ScreenStack(loungeSubScreen = new LoungeSubScreen()) { RelativeSizeAxes = Axes.Both }, } }, From aeae6143c18999a97c2ab32ee9179181f81bea25 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 11 Mar 2019 17:47:03 +0900 Subject: [PATCH 006/107] Remove unnecessary variable --- osu.Game/Screens/Multi/Multiplayer.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index ee7244b0cd..123ef7b1f7 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -38,7 +38,6 @@ namespace osu.Game.Screens.Multi private readonly OsuButton createButton; private readonly LoungeSubScreen loungeSubScreen; private readonly ScreenStack screenStack; - private ParallaxContainer backgroundParallax; private readonly IBindable isIdle = new BindableBool(); @@ -101,7 +100,7 @@ namespace osu.Game.Screens.Multi Padding = new MarginPadding { Top = Header.HEIGHT }, Children = new CompositeDrawable[] { - backgroundParallax = new ParallaxContainer + new ParallaxContainer { RelativeSizeAxes = Axes.Both, Child = backgroundScreenStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both }, From 6a1e60009999f23cfc0f19338d0c7d38bf97a8bd Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 11 Mar 2019 19:48:07 +0900 Subject: [PATCH 007/107] Create new OsuScreenStack for use in Multiplayer --- osu.Game/Screens/Multi/Multiplayer.cs | 10 +--------- osu.Game/Screens/OsuScreenStack.cs | 28 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 9 deletions(-) create mode 100644 osu.Game/Screens/OsuScreenStack.cs diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index 123ef7b1f7..db5372a027 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -50,9 +50,6 @@ namespace osu.Game.Screens.Multi [Cached(Type = typeof(IRoomManager))] private RoomManager roomManager; - [Cached] - private BackgroundScreenStack backgroundScreenStack; - [Resolved] private OsuGameBase game { get; set; } @@ -100,12 +97,7 @@ namespace osu.Game.Screens.Multi Padding = new MarginPadding { Top = Header.HEIGHT }, Children = new CompositeDrawable[] { - new ParallaxContainer - { - RelativeSizeAxes = Axes.Both, - Child = backgroundScreenStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both }, - }, - screenStack = new ScreenStack(loungeSubScreen = new LoungeSubScreen()) { RelativeSizeAxes = Axes.Both }, + screenStack = new OsuScreenStack(loungeSubScreen = new LoungeSubScreen()) { RelativeSizeAxes = Axes.Both }, } }, new Header(screenStack), diff --git a/osu.Game/Screens/OsuScreenStack.cs b/osu.Game/Screens/OsuScreenStack.cs new file mode 100644 index 0000000000..4d92a41dc7 --- /dev/null +++ b/osu.Game/Screens/OsuScreenStack.cs @@ -0,0 +1,28 @@ +// 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; +using osu.Framework.Screens; +using osu.Game.Graphics.Containers; +using osu.Game.Screens.Multi.Lounge; + +namespace osu.Game.Screens +{ + public class OsuScreenStack : ScreenStack + { + [Cached] + private BackgroundScreenStack backgroundScreenStack; + + public OsuScreenStack(IScreen baseScreen) + : base(baseScreen) + { + backgroundScreenStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both }; + InternalChild = new ParallaxContainer + { + RelativeSizeAxes = Axes.Both, + Child = backgroundScreenStack, + }; + } + } +} From 63b9fa58ef410ba0018692a68cd0f89ca6957d6e Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 11 Mar 2019 19:52:28 +0900 Subject: [PATCH 008/107] Cleanup --- osu.Game/Screens/Multi/Multiplayer.cs | 5 +---- osu.Game/Screens/OsuScreenStack.cs | 1 - 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/osu.Game/Screens/Multi/Multiplayer.cs b/osu.Game/Screens/Multi/Multiplayer.cs index db5372a027..37f4322d85 100644 --- a/osu.Game/Screens/Multi/Multiplayer.cs +++ b/osu.Game/Screens/Multi/Multiplayer.cs @@ -95,10 +95,7 @@ namespace osu.Game.Screens.Multi { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Top = Header.HEIGHT }, - Children = new CompositeDrawable[] - { - screenStack = new OsuScreenStack(loungeSubScreen = new LoungeSubScreen()) { RelativeSizeAxes = Axes.Both }, - } + Child = screenStack = new OsuScreenStack(loungeSubScreen = new LoungeSubScreen()) { RelativeSizeAxes = Axes.Both } }, new Header(screenStack), createButton = new HeaderButton diff --git a/osu.Game/Screens/OsuScreenStack.cs b/osu.Game/Screens/OsuScreenStack.cs index 4d92a41dc7..da3211a210 100644 --- a/osu.Game/Screens/OsuScreenStack.cs +++ b/osu.Game/Screens/OsuScreenStack.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Screens; using osu.Game.Graphics.Containers; -using osu.Game.Screens.Multi.Lounge; namespace osu.Game.Screens { From e3567a55074de50602bce615d5ab0a9b45412e29 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 12 Mar 2019 16:03:25 +0900 Subject: [PATCH 009/107] Make OsuGame use OsuScreenStack too --- osu.Game/OsuGame.cs | 29 +++++++++-------------------- osu.Game/Screens/OsuScreenStack.cs | 25 ++++++++++++++++++++++--- 2 files changed, 31 insertions(+), 23 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index cf231f19ce..dc83f1f9d6 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -87,11 +87,7 @@ namespace osu.Game public readonly Bindable OverlayActivationMode = new Bindable(); - private BackgroundScreenStack backgroundStack; - - private ParallaxContainer backgroundParallax; - - private ScreenStack screenStack; + private readonly OsuScreenStack screenStack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }; private VolumeOverlay volume; private OnScreenDisplay onscreenDisplay; private OsuLogo osuLogo; @@ -390,12 +386,7 @@ namespace osu.Game RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - backgroundParallax = new ParallaxContainer - { - RelativeSizeAxes = Axes.Both, - Child = backgroundStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both }, - }, - screenStack = new ScreenStack { RelativeSizeAxes = Axes.Both }, + screenStack, logoContainer = new Container { RelativeSizeAxes = Axes.Both }, } }, @@ -407,17 +398,17 @@ namespace osu.Game idleTracker = new GameIdleTracker(6000) }); - dependencies.Cache(backgroundStack); - screenStack.ScreenPushed += screenPushed; screenStack.ScreenExited += screenExited; - loadComponentSingleFile(osuLogo, logoContainer.Add); - - loadComponentSingleFile(new Loader + loadComponentSingleFile(osuLogo, logo => { - RelativeSizeAxes = Axes.Both - }, screenStack.Push); + logoContainer.Add(logo); + screenStack.Push(new Loader + { + RelativeSizeAxes = Axes.Both + }); + }); loadComponentSingleFile(Toolbar = new Toolbar { @@ -777,8 +768,6 @@ namespace osu.Game if (newScreen is IOsuScreen newOsuScreen) { - backgroundParallax.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * newOsuScreen.BackgroundParallaxAmount; - OverlayActivationMode.Value = newOsuScreen.InitialOverlayActivationMode; if (newOsuScreen.HideOverlaysOnEnter) diff --git a/osu.Game/Screens/OsuScreenStack.cs b/osu.Game/Screens/OsuScreenStack.cs index da3211a210..d6d6272e0e 100644 --- a/osu.Game/Screens/OsuScreenStack.cs +++ b/osu.Game/Screens/OsuScreenStack.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.Graphics; using osu.Framework.Screens; using osu.Game.Graphics.Containers; @@ -13,15 +14,33 @@ namespace osu.Game.Screens [Cached] private BackgroundScreenStack backgroundScreenStack; + private ParallaxContainer parallaxContainer; + + public OsuScreenStack() + { + initializeStack(); + } + public OsuScreenStack(IScreen baseScreen) : base(baseScreen) { - backgroundScreenStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both }; - InternalChild = new ParallaxContainer + initializeStack(); + } + + private void initializeStack() + { + InternalChild = parallaxContainer = new ParallaxContainer { RelativeSizeAxes = Axes.Both, - Child = backgroundScreenStack, + Child = backgroundScreenStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both }, }; + + ScreenPushed += setParallax; + } + + private void setParallax(IScreen prev, IScreen next) + { + parallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * ((IOsuScreen)next).BackgroundParallaxAmount; } } } From 921c4ce2424abd53dcd08daf5b25de54e5087219 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 12 Mar 2019 16:33:35 +0900 Subject: [PATCH 010/107] Make tests use new OsuScreenStack --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 21 +++---------------- osu.Game.Tests/Visual/TestCaseMultiHeader.cs | 2 +- osu.Game.Tests/Visual/TestCasePlayerLoader.cs | 8 ++----- .../Visual/TestCaseScreenBreadcrumbControl.cs | 4 ++-- osu.Game/Tests/OsuTestBrowser.cs | 1 + osu.Game/Tests/Visual/ScreenTestCase.cs | 8 ++----- 6 files changed, 11 insertions(+), 33 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 5484824c5b..7d486fc56c 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -9,7 +9,6 @@ using NUnit.Framework; using osu.Framework.Allocation; 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; @@ -54,7 +53,7 @@ namespace osu.Game.Tests.Visual private BeatmapManager manager; private RulesetStore rulesets; - private ScreenStackCacheContainer screenStackContainer; + private OsuScreenStack screenStack; [BackgroundDependencyLoader] private void load(GameHost host) @@ -85,8 +84,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()); + Child = screenStack = new OsuScreenStack() { RelativeSizeAxes = Axes.Both }; + screenStack.Push(songSelect = new DummySongSelect()); }); } @@ -354,20 +353,6 @@ 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; diff --git a/osu.Game.Tests/Visual/TestCaseMultiHeader.cs b/osu.Game.Tests/Visual/TestCaseMultiHeader.cs index f7802e2d08..d7d8073a33 100644 --- a/osu.Game.Tests/Visual/TestCaseMultiHeader.cs +++ b/osu.Game.Tests/Visual/TestCaseMultiHeader.cs @@ -16,7 +16,7 @@ namespace osu.Game.Tests.Visual { int index = 0; - ScreenStack screenStack = new ScreenStack(new TestMultiplayerSubScreen(index)) { RelativeSizeAxes = Axes.Both }; + OsuScreenStack screenStack = new OsuScreenStack(new TestMultiplayerSubScreen(index)) { RelativeSizeAxes = Axes.Both }; Children = new Drawable[] { diff --git a/osu.Game.Tests/Visual/TestCasePlayerLoader.cs b/osu.Game.Tests/Visual/TestCasePlayerLoader.cs index 244f553e97..0e6a237325 100644 --- a/osu.Game.Tests/Visual/TestCasePlayerLoader.cs +++ b/osu.Game.Tests/Visual/TestCasePlayerLoader.cs @@ -14,15 +14,11 @@ namespace osu.Game.Tests.Visual public class TestCasePlayerLoader : ManualInputManagerTestCase { private PlayerLoader loader; - private readonly ScreenStack stack; - - [Cached] - private BackgroundScreenStack backgroundStack; + private readonly OsuScreenStack stack; public TestCasePlayerLoader() { - InputManager.Add(backgroundStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both }); - InputManager.Add(stack = new ScreenStack { RelativeSizeAxes = Axes.Both }); + InputManager.Add(stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }); } [BackgroundDependencyLoader] diff --git a/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs b/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs index 204f4a493d..697d2405ba 100644 --- a/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs +++ b/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs @@ -19,14 +19,14 @@ namespace osu.Game.Tests.Visual public class TestCaseScreenBreadcrumbControl : OsuTestCase { private readonly ScreenBreadcrumbControl breadcrumbs; - private readonly ScreenStack screenStack; + private readonly OsuScreenStack screenStack; public TestCaseScreenBreadcrumbControl() { OsuSpriteText titleText; IScreen startScreen = new TestScreenOne(); - screenStack = new ScreenStack(startScreen) { RelativeSizeAxes = Axes.Both }; + screenStack = new OsuScreenStack(startScreen) { RelativeSizeAxes = Axes.Both }; Children = new Drawable[] { diff --git a/osu.Game/Tests/OsuTestBrowser.cs b/osu.Game/Tests/OsuTestBrowser.cs index 71b0b02fa6..7af925f7ee 100644 --- a/osu.Game/Tests/OsuTestBrowser.cs +++ b/osu.Game/Tests/OsuTestBrowser.cs @@ -6,6 +6,7 @@ using osu.Framework.Platform; using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Graphics; +using osu.Game.Screens; using osu.Game.Screens.Backgrounds; namespace osu.Game.Tests diff --git a/osu.Game/Tests/Visual/ScreenTestCase.cs b/osu.Game/Tests/Visual/ScreenTestCase.cs index 79c57ad9f4..dd8aed8af3 100644 --- a/osu.Game/Tests/Visual/ScreenTestCase.cs +++ b/osu.Game/Tests/Visual/ScreenTestCase.cs @@ -13,17 +13,13 @@ namespace osu.Game.Tests.Visual /// public abstract class ScreenTestCase : OsuTestCase { - private readonly ScreenStack stack; - - [Cached] - private BackgroundScreenStack backgroundStack; + private readonly OsuScreenStack stack; protected ScreenTestCase() { Children = new Drawable[] { - backgroundStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both }, - stack = new ScreenStack { RelativeSizeAxes = Axes.Both } + stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both } }; } From 9368081b99bf214d620a88c17ddde8b8e1e00372 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 12 Mar 2019 17:33:16 +0900 Subject: [PATCH 011/107] Fix TestCasePlayer --- osu.Game/OsuGame.cs | 4 +++- osu.Game/Tests/Visual/TestCasePlayer.cs | 12 ++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index dc83f1f9d6..ad2980d818 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -87,7 +87,7 @@ namespace osu.Game public readonly Bindable OverlayActivationMode = new Bindable(); - private readonly OsuScreenStack screenStack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }; + private OsuScreenStack screenStack; private VolumeOverlay volume; private OnScreenDisplay onscreenDisplay; private OsuLogo osuLogo; @@ -199,6 +199,8 @@ namespace osu.Game LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust); IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true); + + screenStack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }; } private ExternalLinkOpener externalLinkOpener; diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs index 5ff798c40d..1c4e147def 100644 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ b/osu.Game/Tests/Visual/TestCasePlayer.cs @@ -108,17 +108,13 @@ namespace osu.Game.Tests.Visual Player?.Exit(); - var player = CreatePlayer(r); + var p = Player = CreatePlayer(r); - playerWeakReferences.Add(player); + playerWeakReferences.Add(p); - LoadComponentAsync(player, p => - { - Player = p; - LoadScreen(p); - }); + LoadScreen(Player); - return player; + return p; } protected virtual Player CreatePlayer(Ruleset ruleset) => new Player From e6a55cd6744e289addd6b86943e6c83ef6080bce Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 12 Mar 2019 17:45:16 +0900 Subject: [PATCH 012/107] Fix TestCaseEditor as well --- osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs | 2 +- osu.Game/Screens/OsuScreenStack.cs | 1 - osu.Game/Tests/OsuTestBrowser.cs | 1 - osu.Game/Tests/Visual/EditorTestCase.cs | 2 +- osu.Game/Tests/Visual/ScreenTestCase.cs | 2 -- 5 files changed, 2 insertions(+), 6 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 7d486fc56c..3ede48c49c 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -84,7 +84,7 @@ namespace osu.Game.Tests.Visual manager.Delete(manager.GetAllUsableBeatmapSets()); var temp = TestResources.GetTestBeatmapForImport(); manager.Import(temp); - Child = screenStack = new OsuScreenStack() { RelativeSizeAxes = Axes.Both }; + Child = screenStack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }; screenStack.Push(songSelect = new DummySongSelect()); }); } diff --git a/osu.Game/Screens/OsuScreenStack.cs b/osu.Game/Screens/OsuScreenStack.cs index d6d6272e0e..2eea7bebbb 100644 --- a/osu.Game/Screens/OsuScreenStack.cs +++ b/osu.Game/Screens/OsuScreenStack.cs @@ -2,7 +2,6 @@ // See the LICENCE file in the repository root for full licence text. using osu.Framework.Allocation; -using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Screens; using osu.Game.Graphics.Containers; diff --git a/osu.Game/Tests/OsuTestBrowser.cs b/osu.Game/Tests/OsuTestBrowser.cs index 7af925f7ee..71b0b02fa6 100644 --- a/osu.Game/Tests/OsuTestBrowser.cs +++ b/osu.Game/Tests/OsuTestBrowser.cs @@ -6,7 +6,6 @@ using osu.Framework.Platform; using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Graphics; -using osu.Game.Screens; using osu.Game.Screens.Backgrounds; namespace osu.Game.Tests diff --git a/osu.Game/Tests/Visual/EditorTestCase.cs b/osu.Game/Tests/Visual/EditorTestCase.cs index 67a1cb6de3..96e70e018e 100644 --- a/osu.Game/Tests/Visual/EditorTestCase.cs +++ b/osu.Game/Tests/Visual/EditorTestCase.cs @@ -26,7 +26,7 @@ namespace osu.Game.Tests.Visual { Beatmap.Value = new TestWorkingBeatmap(ruleset.RulesetInfo, null); - LoadComponentAsync(new Editor(), LoadScreen); + LoadScreen(new Editor()); } } } diff --git a/osu.Game/Tests/Visual/ScreenTestCase.cs b/osu.Game/Tests/Visual/ScreenTestCase.cs index dd8aed8af3..a8286f6d7b 100644 --- a/osu.Game/Tests/Visual/ScreenTestCase.cs +++ b/osu.Game/Tests/Visual/ScreenTestCase.cs @@ -1,9 +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.Allocation; using osu.Framework.Graphics; -using osu.Framework.Screens; using osu.Game.Screens; namespace osu.Game.Tests.Visual From 2e1b274fdaab12a51d19ec5022efe9542d1a6f86 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 12 Mar 2019 17:59:11 +0900 Subject: [PATCH 013/107] No need for player var --- osu.Game/Tests/Visual/TestCasePlayer.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs index 1c4e147def..cae6478232 100644 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ b/osu.Game/Tests/Visual/TestCasePlayer.cs @@ -108,13 +108,13 @@ namespace osu.Game.Tests.Visual Player?.Exit(); - var p = Player = CreatePlayer(r); + Player = CreatePlayer(r); - playerWeakReferences.Add(p); + playerWeakReferences.Add(Player); LoadScreen(Player); - return p; + return Player; } protected virtual Player CreatePlayer(Ruleset ruleset) => new Player From de6d8fc6378b77b27c2c99702bfd88fd639e0788 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 13 Mar 2019 16:47:03 +0900 Subject: [PATCH 014/107] Move user blurring into VIsualSettingsContainer --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 90 ++++++++++--------- ...ontainer.cs => VisualSettingsContainer.cs} | 48 ++++++---- .../Backgrounds/BackgroundScreenBeatmap.cs | 9 +- osu.Game/Screens/Play/Player.cs | 10 +-- osu.Game/Screens/Play/PlayerLoader.cs | 31 ++++--- .../Play/ScreenWithBeatmapBackground.cs | 37 -------- osu.Game/Screens/Ranking/Results.cs | 6 +- osu.Game/Screens/Select/SongSelect.cs | 4 +- 8 files changed, 107 insertions(+), 128 deletions(-) rename osu.Game/Graphics/Containers/{UserDimContainer.cs => VisualSettingsContainer.cs} (53%) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 5484824c5b..03078abd3a 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -43,13 +43,13 @@ namespace osu.Game.Tests.Visual typeof(ScreenWithBeatmapBackground), typeof(PlayerLoader), typeof(Player), - typeof(UserDimContainer), + typeof(VisualSettingsContainer), typeof(OsuScreen) }; private DummySongSelect songSelect; - private DimAccessiblePlayerLoader playerLoader; - private DimAccessiblePlayer player; + private TestPlayerLoader playerLoader; + private TestPlayer player; private DatabaseContextFactory factory; private BeatmapManager manager; private RulesetStore rulesets; @@ -91,13 +91,13 @@ namespace osu.Game.Tests.Visual } /// - /// Check if properly triggers background dim previews when a user hovers over the visual settings panel. + /// Check if properly triggers the visual settings preview when a user hovers over the visual settings panel. /// [Test] public void PlayerLoaderSettingsHoverTest() { setupUserSettings(); - AddStep("Start player loader", () => songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer()))); + AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer()))); AddUntilStep(() => playerLoader?.IsLoaded ?? false, "Wait for Player Loader to load"); AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent()); AddStep("Trigger background preview", () => @@ -106,16 +106,16 @@ namespace osu.Game.Tests.Visual InputManager.MoveMouseTo(playerLoader.VisualSettingsPos); }); waitForDim(); - AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); + AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied()); AddStep("Stop background preview", () => InputManager.MoveMouseTo(playerLoader.ScreenPos)); waitForDim(); - AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); + AddAssert("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.IsUserBlurDisabled()); } /// /// 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. + /// The OnHover of PlayerLoader will trigger, which could potentially cause visual settings to be unapplied unless checked for in PlayerLoader. + /// We need to check that in this scenario, the dim and blur is still properly applied after entering player. /// [Test] public void PlayerLoaderTransitionTest() @@ -124,7 +124,7 @@ namespace osu.Game.Tests.Visual AddStep("Trigger hover event", () => playerLoader.TriggerOnHover()); AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent()); waitForDim(); - AddAssert("Screen is dimmed and unblurred", () => songSelect.IsBackgroundDimmed() && songSelect.IsBackgroundUnblurred()); + AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied()); } /// @@ -165,24 +165,24 @@ namespace osu.Game.Tests.Visual } /// - /// Check if the is properly accepting user dim changes at all. + /// Check if the is properly accepting user-defined visual changes at all. /// [Test] public void DisableUserDimTest() { performFullSetup(); waitForDim(); - AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); + AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied()); AddStep("EnableUserDim disabled", () => songSelect.DimEnabled.Value = false); waitForDim(); - AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); + AddAssert("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.IsUserBlurDisabled()); AddStep("EnableUserDim enabled", () => songSelect.DimEnabled.Value = true); waitForDim(); - AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); + AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied()); } /// - /// Check if the fade container retains dim when pausing + /// Check if the visual settings container retains dim and blur when pausing /// [Test] public void PauseTest() @@ -190,14 +190,14 @@ namespace osu.Game.Tests.Visual performFullSetup(true); AddStep("Pause", () => player.CurrentPausableGameplayContainer.Pause()); waitForDim(); - AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); + AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied()); AddStep("Unpause", () => player.CurrentPausableGameplayContainer.Resume()); waitForDim(); - AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); + AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied()); } /// - /// Check if the fade container removes user dim when suspending for + /// Check if the visual settings container removes user dim when suspending for /// [Test] public void TransitionTest() @@ -205,11 +205,12 @@ namespace osu.Game.Tests.Visual performFullSetup(); AddStep("Transition to Results", () => player.Push(new FadeAccessibleResults(new ScoreInfo { User = new User { Username = "osu!" } }))); waitForDim(); - AddAssert("Screen is undimmed and is original background", () => songSelect.IsBackgroundUndimmed() && songSelect.IsBackgroundCurrent()); + AddAssert("Screen is undimmed, original background retained", () => + songSelect.IsBackgroundUndimmed() && songSelect.IsBackgroundCurrent() && songSelect.IsUserBlurDisabled()); } /// - /// Check if background gets undimmed when leaving for + /// Check if background gets undimmed and unblurred when leaving for /// [Test] public void TransitionOutTest() @@ -217,7 +218,7 @@ namespace osu.Game.Tests.Visual performFullSetup(); AddStep("Exit to song select", () => player.Exit()); waitForDim(); - AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed()); + AddAssert("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.IsUserBlurDisabled()); } private void waitForDim() => AddWaitStep(5, "Wait for dim"); @@ -243,7 +244,7 @@ namespace osu.Game.Tests.Visual AddStep("Start player loader", () => { - songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer + songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer { AllowPause = allowPause, Ready = true, @@ -261,7 +262,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; + songSelect.BlurLevel.Value = 0.4f; }); } @@ -270,7 +271,7 @@ namespace osu.Game.Tests.Visual protected override BackgroundScreen CreateBackground() { FadeAccessibleBackground background = new FadeAccessibleBackground(Beatmap.Value); - DimEnabled.BindTo(background.EnableUserDim); + DimEnabled.BindTo(background.EnableVisualSettings); return background; } @@ -289,10 +290,12 @@ namespace osu.Game.Tests.Visual 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 IsUserBlurApplied() => ((FadeAccessibleBackground)Background).CurrentBlur == new Vector2((float)BlurLevel.Value * 25); + + public bool IsUserBlurDisabled() => ((FadeAccessibleBackground)Background).CurrentBlur == new Vector2(0); + public bool IsBackgroundInvisible() => ((FadeAccessibleBackground)Background).CurrentAlpha == 0; public bool IsBackgroundVisible() => ((FadeAccessibleBackground)Background).CurrentAlpha == 1; @@ -314,23 +317,23 @@ namespace osu.Game.Tests.Visual protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value); } - private class DimAccessiblePlayer : Player + private class TestPlayer : Player { protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value); - protected override UserDimContainer CreateStoryboardContainer() + protected override VisualSettingsContainer CreateStoryboardContainer() { - return new TestUserDimContainer(true) + return new TestVisualSettingsContainer(true) { RelativeSizeAxes = Axes.Both, Alpha = 1, - EnableUserDim = { Value = true } + EnableVisualSettings = { Value = true } }; } public PausableGameplayContainer CurrentPausableGameplayContainer => PausableGameplayContainer; - public UserDimContainer CurrentStoryboardContainer => StoryboardContainer; + public VisualSettingsContainer CurrentStoryboardContainer => StoryboardContainer; // Whether or not the player should be allowed to load. public bool Ready; @@ -339,9 +342,9 @@ 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 IsStoryboardVisible() => ((TestVisualSettingsContainer)CurrentStoryboardContainer).CurrentAlpha == 1; - public bool IsStoryboardInvisible() => ((TestUserDimContainer)CurrentStoryboardContainer).CurrentAlpha <= 1; + public bool IsStoryboardInvisible() => ((TestVisualSettingsContainer)CurrentStoryboardContainer).CurrentAlpha <= 1; [BackgroundDependencyLoader] private void load(OsuConfigManager config) @@ -368,12 +371,12 @@ namespace osu.Game.Tests.Visual } } - private class DimAccessiblePlayerLoader : PlayerLoader + private class TestPlayerLoader : PlayerLoader { public VisualSettings VisualSettingsPos => VisualSettings; public BackgroundScreen ScreenPos => Background; - public DimAccessiblePlayerLoader(Player player) + public TestPlayerLoader(Player player) : base(() => player) { } @@ -385,14 +388,15 @@ namespace osu.Game.Tests.Visual private class FadeAccessibleBackground : BackgroundScreenBeatmap { - protected override UserDimContainer CreateFadeContainer() => fadeContainer = new TestUserDimContainer { RelativeSizeAxes = Axes.Both }; + protected override VisualSettingsContainer CreateFadeContainer() => fadeContainer = new TestVisualSettingsContainer { RelativeSizeAxes = Axes.Both }; public Color4 CurrentColour => fadeContainer.CurrentColour; + public float CurrentAlpha => fadeContainer.CurrentAlpha; - public Vector2 CurrentBlur => Background.BlurSigma; + public Vector2 CurrentBlur => fadeContainer.CurrentBlur; - private TestUserDimContainer fadeContainer; + private TestVisualSettingsContainer fadeContainer; public FadeAccessibleBackground(WorkingBeatmap beatmap) : base(beatmap) @@ -400,12 +404,14 @@ namespace osu.Game.Tests.Visual } } - private class TestUserDimContainer : UserDimContainer + private class TestVisualSettingsContainer : VisualSettingsContainer { - public Color4 CurrentColour => DimContainer.Colour; - public float CurrentAlpha => DimContainer.Alpha; + public Color4 CurrentColour => LocalContainer.Colour; + public float CurrentAlpha => LocalContainer.Alpha; - public TestUserDimContainer(bool isStoryboard = false) + public Vector2 CurrentBlur => LocalContainer.BlurSigma; + + public TestVisualSettingsContainer(bool isStoryboard = false) : base(isStoryboard) { } diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/VisualSettingsContainer.cs similarity index 53% rename from osu.Game/Graphics/Containers/UserDimContainer.cs rename to osu.Game/Graphics/Containers/VisualSettingsContainer.cs index 4c8928e122..cd81fa98ea 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/VisualSettingsContainer.cs @@ -6,83 +6,93 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Configuration; +using osuTK; using osuTK.Graphics; namespace osu.Game.Graphics.Containers { /// - /// A container that applies user-configured dim levels to its contents. + /// A container that applies user-configured visual settings to its contents. /// This container specifies behavior that applies to both Storyboards and Backgrounds. /// - public class UserDimContainer : Container + public class VisualSettingsContainer : Container { private const float background_fade_duration = 800; private Bindable dimLevel { get; set; } + private Bindable blurLevel { get; set; } + private Bindable showStoryboard { get; set; } /// /// Whether or not user-configured dim levels should be applied to the container. /// - public readonly Bindable EnableUserDim = new Bindable(); + public readonly Bindable EnableVisualSettings = new Bindable(); /// /// Whether or not the storyboard loaded should completely hide the background behind it. /// public readonly Bindable StoryboardReplacesBackground = new Bindable(); - protected Container DimContainer { get; } + protected BufferedContainer LocalContainer { get; } - protected override Container Content => DimContainer; + protected override Container Content => LocalContainer; private readonly bool isStoryboard; + private Vector2 returnBlur; + /// - /// Creates a new . + /// Creates a new . /// - /// Whether or not this instance of UserDimContainer contains a storyboard. + /// Whether or not this instance 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 . + /// and can cause backgrounds to become hidden via . Storyboards are also currently unable to be blurred. /// /// - public UserDimContainer(bool isStoryboard = false) + public VisualSettingsContainer(bool isStoryboard = false) { this.isStoryboard = isStoryboard; - AddInternal(DimContainer = new Container { RelativeSizeAxes = Axes.Both }); + AddInternal(LocalContainer = new BufferedContainer { RelativeSizeAxes = Axes.Both }); } [BackgroundDependencyLoader] private void load(OsuConfigManager config) { dimLevel = config.GetBindable(OsuSetting.DimLevel); + blurLevel = config.GetBindable(OsuSetting.BlurLevel); showStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); - EnableUserDim.ValueChanged += _ => updateBackgroundDim(); - dimLevel.ValueChanged += _ => updateBackgroundDim(); - showStoryboard.ValueChanged += _ => updateBackgroundDim(); - StoryboardReplacesBackground.ValueChanged += _ => updateBackgroundDim(); + EnableVisualSettings.ValueChanged += _ => updateVisuals(); + dimLevel.ValueChanged += _ => updateVisuals(); + blurLevel.ValueChanged += _ => updateVisuals(); + showStoryboard.ValueChanged += _ => updateVisuals(); + StoryboardReplacesBackground.ValueChanged += _ => updateVisuals(); } protected override void LoadComplete() { base.LoadComplete(); - updateBackgroundDim(); + updateVisuals(); } - private void updateBackgroundDim() + private void updateVisuals() { if (isStoryboard) { - DimContainer.FadeTo(!showStoryboard.Value || dimLevel.Value == 1 ? 0 : 1, background_fade_duration, Easing.OutQuint); + LocalContainer.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); + LocalContainer.FadeTo(showStoryboard.Value && StoryboardReplacesBackground.Value ? 0 : 1, background_fade_duration, Easing.OutQuint); + + // Only blur if this container contains a background + LocalContainer.BlurTo(EnableVisualSettings.Value ? new Vector2((float)blurLevel.Value * 25) : new Vector2(0), background_fade_duration, Easing.OutQuint); } - DimContainer.FadeColour(EnableUserDim.Value ? OsuColour.Gray(1 - (float)dimLevel.Value) : Color4.White, background_fade_duration, Easing.OutQuint); + LocalContainer.FadeColour(EnableVisualSettings.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 13d1ff39ef..ee393fc13e 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 osuTK; namespace osu.Game.Screens.Backgrounds { @@ -18,13 +19,13 @@ namespace osu.Game.Screens.Backgrounds /// /// Whether or not user dim settings should be applied to this Background. /// - public readonly Bindable EnableUserDim = new Bindable(); + public readonly Bindable EnableVisualSettings = new Bindable(); public readonly Bindable StoryboardReplacesBackground = new Bindable(); - private readonly UserDimContainer fadeContainer; + private readonly VisualSettingsContainer fadeContainer; - protected virtual UserDimContainer CreateFadeContainer() => new UserDimContainer { RelativeSizeAxes = Axes.Both }; + protected virtual VisualSettingsContainer CreateFadeContainer() => new VisualSettingsContainer { RelativeSizeAxes = Axes.Both }; public virtual WorkingBeatmap Beatmap { @@ -62,7 +63,7 @@ namespace osu.Game.Screens.Backgrounds { Beatmap = beatmap; InternalChild = fadeContainer = CreateFadeContainer(); - fadeContainer.EnableUserDim.BindTo(EnableUserDim); + fadeContainer.EnableVisualSettings.BindTo(EnableVisualSettings); } public override bool Equals(BackgroundScreen other) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index ced0a43679..98429589ca 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -71,13 +71,13 @@ namespace osu.Game.Screens.Play private FailOverlay failOverlay; private DrawableStoryboard storyboard; - protected UserDimContainer StoryboardContainer { get; private set; } + protected VisualSettingsContainer StoryboardContainer { get; private set; } - protected virtual UserDimContainer CreateStoryboardContainer() => new UserDimContainer(true) + protected virtual VisualSettingsContainer CreateStoryboardContainer() => new VisualSettingsContainer(true) { RelativeSizeAxes = Axes.Both, Alpha = 1, - EnableUserDim = { Value = true } + EnableVisualSettings = { Value = true } }; public bool LoadedBeatmapSuccessfully => RulesetContainer?.Objects.Any() == true; @@ -318,7 +318,7 @@ namespace osu.Game.Screens.Play if (enabled.NewValue) initializeStoryboard(true); }; - Background.EnableUserDim.Value = true; + Background.EnableVisualSettings.Value = true; Background.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground); StoryboardContainer.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground); @@ -365,7 +365,7 @@ namespace osu.Game.Screens.Play float fadeOutDuration = instant ? 0 : 250; this.FadeOut(fadeOutDuration); - Background.EnableUserDim.Value = false; + Background.EnableVisualSettings.Value = false; storyboardReplacesBackground.Value = false; } diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 269baad955..e45421ce4a 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -26,8 +26,9 @@ namespace osu.Game.Screens.Play { public class PlayerLoader : ScreenWithBeatmapBackground { + protected static readonly Vector2 BACKGROUND_BLUR = new Vector2(15); + private readonly Func createPlayer; - private static readonly Vector2 background_blur = new Vector2(15); private Player player; @@ -118,12 +119,16 @@ namespace osu.Game.Screens.Play private void contentIn() { + Background?.BlurTo(BACKGROUND_BLUR, 800, Easing.OutQuint); + content.ScaleTo(1, 650, Easing.OutQuint); content.FadeInFromZero(400); } private void contentOut() { + Background?.BlurTo(new Vector2(0), 800, Easing.OutQuint); + content.ScaleTo(0.7f, 300, Easing.InQuint); content.FadeOut(250); } @@ -133,6 +138,7 @@ namespace osu.Game.Screens.Play base.OnEntering(last); content.ScaleTo(0.7f); + Background?.FadeColour(Color4.White, 800, Easing.OutQuint); contentIn(); @@ -158,11 +164,10 @@ namespace osu.Game.Screens.Play protected override bool OnHover(HoverEvent e) { - // restore our screen defaults if (this.IsCurrentScreen()) { - InitializeBackgroundElements(); - Background.EnableUserDim.Value = false; + Background.BlurTo(BACKGROUND_BLUR, 800, Easing.OutQuint); + Background.EnableVisualSettings.Value = false; } return base.OnHover(e); @@ -172,22 +177,16 @@ namespace osu.Game.Screens.Play { if (GetContainingInputManager()?.HoveredDrawables.Contains(VisualSettings) == true) { - // 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; + if (this.IsCurrentScreen() && Background != null) + { + Background.BlurTo(new Vector2(0), 800, Easing.OutQuint); + Background.EnableVisualSettings.Value = true; + } } base.OnHoverLost(e); } - protected override void InitializeBackgroundElements() - { - Background?.FadeColour(Color4.White, BACKGROUND_FADE_DURATION, Easing.OutQuint); - Background?.BlurTo(background_blur, BACKGROUND_FADE_DURATION, Easing.OutQuint); - } - private void pushWhenLoaded() { if (!this.IsCurrentScreen()) return; @@ -250,7 +249,7 @@ namespace osu.Game.Screens.Play this.FadeOut(150); cancelLoad(); - Background.EnableUserDim.Value = false; + Background.EnableVisualSettings.Value = false; return base.OnExiting(next); } diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 328aa1d18e..2ffa1c3da9 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -17,49 +17,12 @@ namespace osu.Game.Screens.Play protected new BackgroundScreenBeatmap Background => (BackgroundScreenBeatmap)base.Background; - protected const float BACKGROUND_FADE_DURATION = 800; - - #region User Settings - - protected Bindable BlurLevel; protected Bindable ShowStoryboard; - #endregion - [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - BlurLevel = config.GetBindable(OsuSetting.BlurLevel); ShowStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); } - - public override void OnEntering(IScreen last) - { - base.OnEntering(last); - BlurLevel.ValueChanged += _ => UpdateBackgroundElements(); - InitializeBackgroundElements(); - } - - public override void OnResuming(IScreen last) - { - base.OnResuming(last); - InitializeBackgroundElements(); - } - - /// - /// Called once on entering screen. By Default, performs a full call. - /// - protected virtual void InitializeBackgroundElements() => UpdateBackgroundElements(); - - /// - /// Called when background elements require updates, usually due to a user changing a setting. - /// - /// - protected virtual void UpdateBackgroundElements() - { - if (!this.IsCurrentScreen()) return; - - Background?.BlurTo(new Vector2((float)BlurLevel.Value * 25), BACKGROUND_FADE_DURATION, Easing.OutQuint); - } } } diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index 47ac472b9e..eb3ce66547 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -24,6 +24,8 @@ namespace osu.Game.Screens.Ranking { public abstract class Results : OsuScreen { + protected static readonly Vector2 BACKGROUND_BLUR = new Vector2(20); + private Container circleOuterBackground; private Container circleOuter; private Container circleInner; @@ -38,8 +40,6 @@ namespace osu.Game.Screens.Ranking private Container currentPage; - private static readonly Vector2 background_blur = new Vector2(20); - protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value); private const float overscan = 1.3f; @@ -58,7 +58,7 @@ namespace osu.Game.Screens.Ranking public override void OnEntering(IScreen last) { base.OnEntering(last); - (Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 2500, Easing.OutQuint); + (Background as BackgroundScreenBeatmap)?.BlurTo(BACKGROUND_BLUR, 2500, Easing.OutQuint); Background.ScaleTo(1.1f, transition_time, Easing.OutQuint); allCircles.ForEach(c => diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 5d4ead69d6..d10e6994d5 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -37,8 +37,8 @@ namespace osu.Game.Screens.Select { public abstract class SongSelect : OsuScreen { + protected static readonly Vector2 BACKGROUND_BLUR = new Vector2(20); private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 245); - private static readonly Vector2 background_blur = new Vector2(20); private const float left_area_padding = 20; public readonly FilterControl FilterControl; @@ -556,7 +556,7 @@ namespace osu.Game.Screens.Select if (Background is BackgroundScreenBeatmap backgroundModeBeatmap) { backgroundModeBeatmap.Beatmap = beatmap; - backgroundModeBeatmap.BlurTo(background_blur, 750, Easing.OutQuint); + backgroundModeBeatmap.BlurTo(BACKGROUND_BLUR, 750, Easing.OutQuint); backgroundModeBeatmap.FadeColour(Color4.White, 250); } From 8714902349998aa4ce4985133abedd51a98caa8a Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 14 Mar 2019 14:02:46 +0900 Subject: [PATCH 015/107] Handle all blurring directly from background --- .../Containers/VisualSettingsContainer.cs | 41 +++++++++++++------ .../Backgrounds/BackgroundScreenBeatmap.cs | 5 ++- osu.Game/Screens/Play/PlayerLoader.cs | 14 ++++--- osu.Game/Screens/Ranking/Results.cs | 4 +- osu.Game/Screens/Select/SongSelect.cs | 5 ++- 5 files changed, 46 insertions(+), 23 deletions(-) diff --git a/osu.Game/Graphics/Containers/VisualSettingsContainer.cs b/osu.Game/Graphics/Containers/VisualSettingsContainer.cs index cd81fa98ea..3d9e340d5f 100644 --- a/osu.Game/Graphics/Containers/VisualSettingsContainer.cs +++ b/osu.Game/Graphics/Containers/VisualSettingsContainer.cs @@ -1,11 +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; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Logging; +using osu.Game.Beatmaps; using osu.Game.Configuration; +using osu.Game.Graphics.Backgrounds; +using osu.Game.Screens.Backgrounds; using osuTK; using osuTK.Graphics; @@ -19,6 +24,8 @@ namespace osu.Game.Graphics.Containers { private const float background_fade_duration = 800; + public Action ContentLoadComplete = () => { }; + private Bindable dimLevel { get; set; } private Bindable blurLevel { get; set; } @@ -35,13 +42,13 @@ namespace osu.Game.Graphics.Containers /// public readonly Bindable StoryboardReplacesBackground = new Bindable(); - protected BufferedContainer LocalContainer { get; } + protected Container LocalContainer { get; } protected override Container Content => LocalContainer; private readonly bool isStoryboard; - private Vector2 returnBlur; + public Bindable AddedBlur = new Bindable(); /// /// Creates a new . @@ -55,7 +62,7 @@ namespace osu.Game.Graphics.Containers public VisualSettingsContainer(bool isStoryboard = false) { this.isStoryboard = isStoryboard; - AddInternal(LocalContainer = new BufferedContainer { RelativeSizeAxes = Axes.Both }); + AddInternal(LocalContainer = new Container { RelativeSizeAxes = Axes.Both }); } [BackgroundDependencyLoader] @@ -64,20 +71,21 @@ namespace osu.Game.Graphics.Containers dimLevel = config.GetBindable(OsuSetting.DimLevel); blurLevel = config.GetBindable(OsuSetting.BlurLevel); showStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); - EnableVisualSettings.ValueChanged += _ => updateVisuals(); - dimLevel.ValueChanged += _ => updateVisuals(); - blurLevel.ValueChanged += _ => updateVisuals(); - showStoryboard.ValueChanged += _ => updateVisuals(); - StoryboardReplacesBackground.ValueChanged += _ => updateVisuals(); + EnableVisualSettings.ValueChanged += _ => UpdateVisuals(); + dimLevel.ValueChanged += _ => UpdateVisuals(); + blurLevel.ValueChanged += _ => UpdateVisuals(); + showStoryboard.ValueChanged += _ => UpdateVisuals(); + StoryboardReplacesBackground.ValueChanged += _ => UpdateVisuals(); + AddedBlur.ValueChanged += _ => UpdateVisuals(); } protected override void LoadComplete() { base.LoadComplete(); - updateVisuals(); + UpdateVisuals(); } - private void updateVisuals() + public void UpdateVisuals() { if (isStoryboard) { @@ -88,8 +96,17 @@ namespace osu.Game.Graphics.Containers // The background needs to be hidden in the case of it being replaced by the storyboard LocalContainer.FadeTo(showStoryboard.Value && StoryboardReplacesBackground.Value ? 0 : 1, background_fade_duration, Easing.OutQuint); - // Only blur if this container contains a background - LocalContainer.BlurTo(EnableVisualSettings.Value ? new Vector2((float)blurLevel.Value * 25) : new Vector2(0), background_fade_duration, Easing.OutQuint); + foreach (Drawable c in LocalContainer) + { + // Only blur if this container contains a background + // We can't blur the container like we did with the dim because buffered containers add considerable draw overhead. + // As a result, this blurs the background directly. + ((Background)c)?.BlurTo(EnableVisualSettings.Value + ? new Vector2(AddedBlur.Value + (float)blurLevel.Value * 25) + : new Vector2(AddedBlur.Value), background_fade_duration, Easing.OutQuint); + + Logger.Log("Enable visual settings: " + EnableVisualSettings.Value + " Added blur is: " + AddedBlur.Value); + } } LocalContainer.FadeColour(EnableVisualSettings.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 ee393fc13e..3670ac7663 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 osuTK; namespace osu.Game.Screens.Backgrounds { @@ -23,6 +22,8 @@ namespace osu.Game.Screens.Backgrounds public readonly Bindable StoryboardReplacesBackground = new Bindable(); + public readonly Bindable AddedBlur = new Bindable(); + private readonly VisualSettingsContainer fadeContainer; protected virtual VisualSettingsContainer CreateFadeContainer() => new VisualSettingsContainer { RelativeSizeAxes = Axes.Both }; @@ -52,6 +53,7 @@ namespace osu.Game.Screens.Backgrounds b.Depth = newDepth; fadeContainer.Add(Background = b); + fadeContainer.UpdateVisuals(); Background.BlurSigma = BlurTarget; StoryboardReplacesBackground.BindTo(fadeContainer.StoryboardReplacesBackground); })); @@ -64,6 +66,7 @@ namespace osu.Game.Screens.Backgrounds Beatmap = beatmap; InternalChild = fadeContainer = CreateFadeContainer(); fadeContainer.EnableVisualSettings.BindTo(EnableVisualSettings); + fadeContainer.AddedBlur.BindTo(AddedBlur); } public override bool Equals(BackgroundScreen other) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index e45421ce4a..6eee681e67 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -26,7 +26,7 @@ namespace osu.Game.Screens.Play { public class PlayerLoader : ScreenWithBeatmapBackground { - protected static readonly Vector2 BACKGROUND_BLUR = new Vector2(15); + private const float background_blur = 15; private readonly Func createPlayer; @@ -119,7 +119,7 @@ namespace osu.Game.Screens.Play private void contentIn() { - Background?.BlurTo(BACKGROUND_BLUR, 800, Easing.OutQuint); + Background.AddedBlur.Value = background_blur; content.ScaleTo(1, 650, Easing.OutQuint); content.FadeInFromZero(400); @@ -127,7 +127,7 @@ namespace osu.Game.Screens.Play private void contentOut() { - Background?.BlurTo(new Vector2(0), 800, Easing.OutQuint); + Background.AddedBlur.Value = 0; content.ScaleTo(0.7f, 300, Easing.InQuint); content.FadeOut(250); @@ -166,7 +166,7 @@ namespace osu.Game.Screens.Play { if (this.IsCurrentScreen()) { - Background.BlurTo(BACKGROUND_BLUR, 800, Easing.OutQuint); + Background.AddedBlur.Value = background_blur; Background.EnableVisualSettings.Value = false; } @@ -179,7 +179,7 @@ namespace osu.Game.Screens.Play { if (this.IsCurrentScreen() && Background != null) { - Background.BlurTo(new Vector2(0), 800, Easing.OutQuint); + Background.AddedBlur.Value = 0; Background.EnableVisualSettings.Value = true; } } @@ -239,6 +239,8 @@ namespace osu.Game.Screens.Play public override void OnSuspending(IScreen next) { + Background.EnableVisualSettings.Value = true; + base.OnSuspending(next); cancelLoad(); } @@ -249,7 +251,7 @@ namespace osu.Game.Screens.Play this.FadeOut(150); cancelLoad(); - Background.EnableVisualSettings.Value = false; + Background.EnableVisualSettings.Value = true; return base.OnExiting(next); } diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index eb3ce66547..a30534a5d3 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Ranking { public abstract class Results : OsuScreen { - protected static readonly Vector2 BACKGROUND_BLUR = new Vector2(20); + private const float background_blur = 20; private Container circleOuterBackground; private Container circleOuter; @@ -58,7 +58,7 @@ namespace osu.Game.Screens.Ranking public override void OnEntering(IScreen last) { base.OnEntering(last); - (Background as BackgroundScreenBeatmap)?.BlurTo(BACKGROUND_BLUR, 2500, Easing.OutQuint); + ((BackgroundScreenBeatmap)Background).AddedBlur.Value = background_blur; Background.ScaleTo(1.1f, transition_time, Easing.OutQuint); allCircles.ForEach(c => diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index d10e6994d5..22e4b2ffa2 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -37,8 +37,8 @@ namespace osu.Game.Screens.Select { public abstract class SongSelect : OsuScreen { - protected static readonly Vector2 BACKGROUND_BLUR = new Vector2(20); private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 245); + private const float background_blur = 20; private const float left_area_padding = 20; public readonly FilterControl FilterControl; @@ -556,8 +556,9 @@ namespace osu.Game.Screens.Select if (Background is BackgroundScreenBeatmap backgroundModeBeatmap) { backgroundModeBeatmap.Beatmap = beatmap; - backgroundModeBeatmap.BlurTo(BACKGROUND_BLUR, 750, Easing.OutQuint); + backgroundModeBeatmap.AddedBlur.Value = background_blur; backgroundModeBeatmap.FadeColour(Color4.White, 250); + Logger.Log("blur updated!"); } beatmapInfoWedge.Beatmap = beatmap; From 8cdfb1fd610bed0896cce606178a0854887370fe Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 14 Mar 2019 16:09:17 +0900 Subject: [PATCH 016/107] Remove BlurrableBackgroundScreen, rework tests --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 21 ++++++++++------- .../Containers/VisualSettingsContainer.cs | 16 ++++++++----- osu.Game/Screens/BackgroundScreen.cs | 3 +++ .../Backgrounds/BackgroundScreenBeatmap.cs | 4 ++-- .../Backgrounds/BackgroundScreenCustom.cs | 2 +- .../Backgrounds/BackgroundScreenDefault.cs | 2 +- osu.Game/Screens/BlurrableBackgroundScreen.cs | 23 ------------------- osu.Game/Screens/Play/PlayerLoader.cs | 10 ++++---- osu.Game/Screens/Ranking/Results.cs | 4 ++-- osu.Game/Screens/Select/SongSelect.cs | 4 ++-- 10 files changed, 40 insertions(+), 49 deletions(-) delete mode 100644 osu.Game/Screens/BlurrableBackgroundScreen.cs diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 03078abd3a..efaa752283 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -109,7 +109,7 @@ namespace osu.Game.Tests.Visual AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied()); AddStep("Stop background preview", () => InputManager.MoveMouseTo(playerLoader.ScreenPos)); waitForDim(); - AddAssert("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.IsUserBlurDisabled()); + AddAssert("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && playerLoader.IsBlurCorrect()); } /// @@ -203,10 +203,11 @@ namespace osu.Game.Tests.Visual public void TransitionTest() { performFullSetup(); - AddStep("Transition to Results", () => player.Push(new FadeAccessibleResults(new ScoreInfo { User = new User { Username = "osu!" } }))); + var results = new FadeAccessibleResults(new ScoreInfo { User = new User { Username = "osu!" } }); + AddStep("Transition to Results", () => player.Push(results)); waitForDim(); - AddAssert("Screen is undimmed, original background retained", () => - songSelect.IsBackgroundUndimmed() && songSelect.IsBackgroundCurrent() && songSelect.IsUserBlurDisabled()); + AddAssert("Screen is undimmed, original background retained", () => + songSelect.IsBackgroundUndimmed() && songSelect.IsBackgroundCurrent() && results.IsBlurCorrect()); } /// @@ -218,7 +219,7 @@ namespace osu.Game.Tests.Visual performFullSetup(); AddStep("Exit to song select", () => player.Exit()); waitForDim(); - AddAssert("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.IsUserBlurDisabled()); + AddAssert("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.IsBlurCorrect()); } private void waitForDim() => AddWaitStep(5, "Wait for dim"); @@ -300,6 +301,8 @@ namespace osu.Game.Tests.Visual public bool IsBackgroundVisible() => ((FadeAccessibleBackground)Background).CurrentAlpha == 1; + public bool IsBlurCorrect() => ((FadeAccessibleBackground)Background).CurrentBlur == new Vector2(BACKGROUND_BLUR); + /// /// Make sure every time a screen gets pushed, the background doesn't get replaced /// @@ -315,6 +318,8 @@ namespace osu.Game.Tests.Visual } protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value); + + public bool IsBlurCorrect() => ((FadeAccessibleBackground)Background).CurrentBlur == new Vector2(BACKGROUND_BLUR); } private class TestPlayer : Player @@ -383,6 +388,8 @@ namespace osu.Game.Tests.Visual public void TriggerOnHover() => OnHover(new HoverEvent(new InputState())); + public bool IsBlurCorrect() => ((FadeAccessibleBackground)Background).CurrentBlur == new Vector2(BACKGROUND_BLUR); + protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value); } @@ -394,7 +401,7 @@ namespace osu.Game.Tests.Visual public float CurrentAlpha => fadeContainer.CurrentAlpha; - public Vector2 CurrentBlur => fadeContainer.CurrentBlur; + public Vector2 CurrentBlur => Background.BlurSigma; private TestVisualSettingsContainer fadeContainer; @@ -409,8 +416,6 @@ namespace osu.Game.Tests.Visual public Color4 CurrentColour => LocalContainer.Colour; public float CurrentAlpha => LocalContainer.Alpha; - public Vector2 CurrentBlur => LocalContainer.BlurSigma; - public TestVisualSettingsContainer(bool isStoryboard = false) : base(isStoryboard) { diff --git a/osu.Game/Graphics/Containers/VisualSettingsContainer.cs b/osu.Game/Graphics/Containers/VisualSettingsContainer.cs index 3d9e340d5f..c45b130044 100644 --- a/osu.Game/Graphics/Containers/VisualSettingsContainer.cs +++ b/osu.Game/Graphics/Containers/VisualSettingsContainer.cs @@ -24,8 +24,6 @@ namespace osu.Game.Graphics.Containers { private const float background_fade_duration = 800; - public Action ContentLoadComplete = () => { }; - private Bindable dimLevel { get; set; } private Bindable blurLevel { get; set; } @@ -50,6 +48,10 @@ namespace osu.Game.Graphics.Containers public Bindable AddedBlur = new Bindable(); + public Vector2 BlurTarget => EnableVisualSettings.Value + ? new Vector2(AddedBlur.Value + (float)blurLevel.Value * 25) + : new Vector2(AddedBlur.Value); + /// /// Creates a new . /// @@ -71,7 +73,11 @@ namespace osu.Game.Graphics.Containers dimLevel = config.GetBindable(OsuSetting.DimLevel); blurLevel = config.GetBindable(OsuSetting.BlurLevel); showStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); - EnableVisualSettings.ValueChanged += _ => UpdateVisuals(); + EnableVisualSettings.ValueChanged += _ => + { + Logger.Log("Oh fuck"); + UpdateVisuals(); + }; dimLevel.ValueChanged += _ => UpdateVisuals(); blurLevel.ValueChanged += _ => UpdateVisuals(); showStoryboard.ValueChanged += _ => UpdateVisuals(); @@ -101,9 +107,7 @@ namespace osu.Game.Graphics.Containers // Only blur if this container contains a background // We can't blur the container like we did with the dim because buffered containers add considerable draw overhead. // As a result, this blurs the background directly. - ((Background)c)?.BlurTo(EnableVisualSettings.Value - ? new Vector2(AddedBlur.Value + (float)blurLevel.Value * 25) - : new Vector2(AddedBlur.Value), background_fade_duration, Easing.OutQuint); + ((Background)c)?.BlurTo(BlurTarget, background_fade_duration, Easing.OutQuint); Logger.Log("Enable visual settings: " + EnableVisualSettings.Value + " Added blur is: " + AddedBlur.Value); } diff --git a/osu.Game/Screens/BackgroundScreen.cs b/osu.Game/Screens/BackgroundScreen.cs index bbe162cf7c..7eca192a6b 100644 --- a/osu.Game/Screens/BackgroundScreen.cs +++ b/osu.Game/Screens/BackgroundScreen.cs @@ -5,12 +5,15 @@ using System; using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Input.Events; +using osu.Game.Graphics.Backgrounds; using osuTK; namespace osu.Game.Screens { public abstract class BackgroundScreen : Screen, IEquatable { + protected Background Background; + protected BackgroundScreen() { Anchor = Anchor.Centre; diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 3670ac7663..3e3315d03a 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -11,7 +11,7 @@ using osu.Game.Graphics.Containers; namespace osu.Game.Screens.Backgrounds { - public class BackgroundScreenBeatmap : BlurrableBackgroundScreen + public class BackgroundScreenBeatmap : BackgroundScreen { private WorkingBeatmap beatmap; @@ -54,7 +54,7 @@ namespace osu.Game.Screens.Backgrounds b.Depth = newDepth; fadeContainer.Add(Background = b); fadeContainer.UpdateVisuals(); - Background.BlurSigma = BlurTarget; + Background.BlurSigma = fadeContainer.BlurTarget; StoryboardReplacesBackground.BindTo(fadeContainer.StoryboardReplacesBackground); })); }); diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs index 0cb41bc562..538f347737 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs @@ -12,7 +12,7 @@ namespace osu.Game.Screens.Backgrounds public BackgroundScreenCustom(string textureName) { this.textureName = textureName; - AddInternal(new Background(textureName)); + AddInternal(Background = new Background(textureName)); } public override bool Equals(BackgroundScreen other) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 87a6b5d591..73590b3318 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -13,7 +13,7 @@ using osu.Game.Users; namespace osu.Game.Screens.Backgrounds { - public class BackgroundScreenDefault : BlurrableBackgroundScreen + public class BackgroundScreenDefault : BackgroundScreen { private int currentDisplay; private const int background_count = 5; diff --git a/osu.Game/Screens/BlurrableBackgroundScreen.cs b/osu.Game/Screens/BlurrableBackgroundScreen.cs deleted file mode 100644 index d19e699acb..0000000000 --- a/osu.Game/Screens/BlurrableBackgroundScreen.cs +++ /dev/null @@ -1,23 +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.Graphics; -using osu.Framework.Graphics.Transforms; -using osu.Game.Graphics.Backgrounds; -using osuTK; - -namespace osu.Game.Screens -{ - public abstract class BlurrableBackgroundScreen : BackgroundScreen - { - protected Background Background; - - protected Vector2 BlurTarget; - - public TransformSequence BlurTo(Vector2 sigma, double duration, Easing easing = Easing.None) - { - BlurTarget = sigma; - return Background?.BlurTo(BlurTarget, duration, easing); - } - } -} diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 6eee681e67..4200a7390d 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -26,7 +26,7 @@ namespace osu.Game.Screens.Play { public class PlayerLoader : ScreenWithBeatmapBackground { - private const float background_blur = 15; + protected const float BACKGROUND_BLUR = 15; private readonly Func createPlayer; @@ -119,7 +119,8 @@ namespace osu.Game.Screens.Play private void contentIn() { - Background.AddedBlur.Value = background_blur; + Background.AddedBlur.Value = BACKGROUND_BLUR; + Background.EnableVisualSettings.Value = false; content.ScaleTo(1, 650, Easing.OutQuint); content.FadeInFromZero(400); @@ -128,6 +129,7 @@ namespace osu.Game.Screens.Play private void contentOut() { Background.AddedBlur.Value = 0; + Background.EnableVisualSettings.Value = true; content.ScaleTo(0.7f, 300, Easing.InQuint); content.FadeOut(250); @@ -166,7 +168,7 @@ namespace osu.Game.Screens.Play { if (this.IsCurrentScreen()) { - Background.AddedBlur.Value = background_blur; + Background.AddedBlur.Value = BACKGROUND_BLUR; Background.EnableVisualSettings.Value = false; } @@ -251,7 +253,7 @@ namespace osu.Game.Screens.Play this.FadeOut(150); cancelLoad(); - Background.EnableVisualSettings.Value = true; + Background.EnableVisualSettings.Value = false; return base.OnExiting(next); } diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index a30534a5d3..bd8daa6b03 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -24,7 +24,7 @@ namespace osu.Game.Screens.Ranking { public abstract class Results : OsuScreen { - private const float background_blur = 20; + protected const float BACKGROUND_BLUR = 20; private Container circleOuterBackground; private Container circleOuter; @@ -58,7 +58,7 @@ namespace osu.Game.Screens.Ranking public override void OnEntering(IScreen last) { base.OnEntering(last); - ((BackgroundScreenBeatmap)Background).AddedBlur.Value = background_blur; + ((BackgroundScreenBeatmap)Background).AddedBlur.Value = BACKGROUND_BLUR; Background.ScaleTo(1.1f, transition_time, Easing.OutQuint); allCircles.ForEach(c => diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 22e4b2ffa2..6551c70de3 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -38,7 +38,7 @@ namespace osu.Game.Screens.Select public abstract class SongSelect : OsuScreen { private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 245); - private const float background_blur = 20; + protected const float BACKGROUND_BLUR = 20; private const float left_area_padding = 20; public readonly FilterControl FilterControl; @@ -556,7 +556,7 @@ namespace osu.Game.Screens.Select if (Background is BackgroundScreenBeatmap backgroundModeBeatmap) { backgroundModeBeatmap.Beatmap = beatmap; - backgroundModeBeatmap.AddedBlur.Value = background_blur; + backgroundModeBeatmap.AddedBlur.Value = BACKGROUND_BLUR; backgroundModeBeatmap.FadeColour(Color4.White, 250); Logger.Log("blur updated!"); } From 8fc90bb9a03247b3c4ca77a6bde37639fefa716a Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 14 Mar 2019 16:26:34 +0900 Subject: [PATCH 017/107] Remove unused usings --- osu.Game/Graphics/Containers/VisualSettingsContainer.cs | 3 --- osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs | 3 --- 2 files changed, 6 deletions(-) diff --git a/osu.Game/Graphics/Containers/VisualSettingsContainer.cs b/osu.Game/Graphics/Containers/VisualSettingsContainer.cs index c45b130044..ebbd975231 100644 --- a/osu.Game/Graphics/Containers/VisualSettingsContainer.cs +++ b/osu.Game/Graphics/Containers/VisualSettingsContainer.cs @@ -1,16 +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; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Logging; -using osu.Game.Beatmaps; using osu.Game.Configuration; using osu.Game.Graphics.Backgrounds; -using osu.Game.Screens.Backgrounds; using osuTK; using osuTK.Graphics; diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 2ffa1c3da9..174e39f3cb 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -3,11 +3,8 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Screens; using osu.Game.Configuration; using osu.Game.Screens.Backgrounds; -using osuTK; namespace osu.Game.Screens.Play { From 3208f1dde8b2ac139edbe6a350d70343e8d1bfcf Mon Sep 17 00:00:00 2001 From: David Zhao Date: Thu, 14 Mar 2019 16:40:25 +0900 Subject: [PATCH 018/107] Fix potential transitiontest failure on local unit tests --- 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 efaa752283..2eb479b505 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -205,6 +205,7 @@ namespace osu.Game.Tests.Visual performFullSetup(); var results = new FadeAccessibleResults(new ScoreInfo { User = new User { Username = "osu!" } }); AddStep("Transition to Results", () => player.Push(results)); + AddUntilStep(results.IsCurrentScreen, "Wait for results is current"); waitForDim(); AddAssert("Screen is undimmed, original background retained", () => songSelect.IsBackgroundUndimmed() && songSelect.IsBackgroundCurrent() && results.IsBlurCorrect()); From eac7672c6b964acf2972539bc99e8e402b848155 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 18 Mar 2019 14:03:54 +0900 Subject: [PATCH 019/107] Clean up debug logging --- osu.Game/Graphics/Containers/VisualSettingsContainer.cs | 8 +------- osu.Game/Screens/Select/SongSelect.cs | 1 - 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/osu.Game/Graphics/Containers/VisualSettingsContainer.cs b/osu.Game/Graphics/Containers/VisualSettingsContainer.cs index ebbd975231..edc8d4394a 100644 --- a/osu.Game/Graphics/Containers/VisualSettingsContainer.cs +++ b/osu.Game/Graphics/Containers/VisualSettingsContainer.cs @@ -70,11 +70,7 @@ namespace osu.Game.Graphics.Containers dimLevel = config.GetBindable(OsuSetting.DimLevel); blurLevel = config.GetBindable(OsuSetting.BlurLevel); showStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); - EnableVisualSettings.ValueChanged += _ => - { - Logger.Log("Oh fuck"); - UpdateVisuals(); - }; + EnableVisualSettings.ValueChanged += _ => UpdateVisuals(); dimLevel.ValueChanged += _ => UpdateVisuals(); blurLevel.ValueChanged += _ => UpdateVisuals(); showStoryboard.ValueChanged += _ => UpdateVisuals(); @@ -105,8 +101,6 @@ namespace osu.Game.Graphics.Containers // We can't blur the container like we did with the dim because buffered containers add considerable draw overhead. // As a result, this blurs the background directly. ((Background)c)?.BlurTo(BlurTarget, background_fade_duration, Easing.OutQuint); - - Logger.Log("Enable visual settings: " + EnableVisualSettings.Value + " Added blur is: " + AddedBlur.Value); } } diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 6551c70de3..385c4e0a0d 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -558,7 +558,6 @@ namespace osu.Game.Screens.Select backgroundModeBeatmap.Beatmap = beatmap; backgroundModeBeatmap.AddedBlur.Value = BACKGROUND_BLUR; backgroundModeBeatmap.FadeColour(Color4.White, 250); - Logger.Log("blur updated!"); } beatmapInfoWedge.Beatmap = beatmap; From 0024a0bdb2974864a4c5c892c497ef5185787790 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Mon, 18 Mar 2019 14:35:03 +0900 Subject: [PATCH 020/107] Remove unused using --- osu.Game/Graphics/Containers/VisualSettingsContainer.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/VisualSettingsContainer.cs b/osu.Game/Graphics/Containers/VisualSettingsContainer.cs index edc8d4394a..1ed4f0e23e 100644 --- a/osu.Game/Graphics/Containers/VisualSettingsContainer.cs +++ b/osu.Game/Graphics/Containers/VisualSettingsContainer.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osu.Framework.Logging; using osu.Game.Configuration; using osu.Game.Graphics.Backgrounds; using osuTK; From 8df47bc23edd9c63c8c008c55f4247c1ae402009 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Mar 2019 16:39:34 +0900 Subject: [PATCH 021/107] Increase flexibility of player test cases --- .../TestCaseAutoJuiceStream.cs | 2 +- .../TestCaseBananaShower.cs | 3 +- .../TestCaseCatchPlayer.cs | 3 +- .../TestCaseCatchStacker.cs | 3 +- .../TestCaseHyperDash.cs | 20 +-- .../TestCaseHitCircleLongCombo.cs | 3 +- .../TestCaseOsuPlayer.cs | 3 +- osu.Game.Tests/Visual/TestCaseAllPlayers.cs | 12 -- osu.Game.Tests/Visual/TestCaseAutoplay.cs | 10 +- .../Visual/TestCasePlayerReferenceLeaking.cs | 56 ++++++++ osu.Game.Tests/Visual/TestCaseReplay.cs | 10 +- osu.Game/Tests/Visual/AllPlayersTestCase.cs | 94 +++++++++++++ osu.Game/Tests/Visual/PlayerTestCase.cs | 60 ++++++++ osu.Game/Tests/Visual/TestCasePlayer.cs | 131 ------------------ 14 files changed, 239 insertions(+), 171 deletions(-) delete mode 100644 osu.Game.Tests/Visual/TestCaseAllPlayers.cs create mode 100644 osu.Game.Tests/Visual/TestCasePlayerReferenceLeaking.cs create mode 100644 osu.Game/Tests/Visual/AllPlayersTestCase.cs create mode 100644 osu.Game/Tests/Visual/PlayerTestCase.cs delete mode 100644 osu.Game/Tests/Visual/TestCasePlayer.cs diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs index 9319fb3dfb..fbb2db33b0 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestCaseAutoJuiceStream.cs @@ -13,7 +13,7 @@ using osuTK; namespace osu.Game.Rulesets.Catch.Tests { - public class TestCaseAutoJuiceStream : TestCasePlayer + public class TestCaseAutoJuiceStream : PlayerTestCase { public TestCaseAutoJuiceStream() : base(new CatchRuleset()) diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseBananaShower.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseBananaShower.cs index 9e1c44ba40..1bae55102f 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestCaseBananaShower.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestCaseBananaShower.cs @@ -8,11 +8,12 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Objects; using osu.Game.Rulesets.Catch.Objects.Drawable; using osu.Game.Rulesets.Catch.UI; +using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Catch.Tests { [TestFixture] - public class TestCaseBananaShower : Game.Tests.Visual.TestCasePlayer + public class TestCaseBananaShower : PlayerTestCase { public override IReadOnlyList RequiredTypes => new[] { diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseCatchPlayer.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseCatchPlayer.cs index 8f9dd73b80..5b242d05d7 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestCaseCatchPlayer.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestCaseCatchPlayer.cs @@ -2,11 +2,12 @@ // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; +using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Catch.Tests { [TestFixture] - public class TestCaseCatchPlayer : Game.Tests.Visual.TestCasePlayer + public class TestCaseCatchPlayer : PlayerTestCase { public TestCaseCatchPlayer() : base(new CatchRuleset()) diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseCatchStacker.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseCatchStacker.cs index 1e3d60d968..5a16a23a4e 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestCaseCatchStacker.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestCaseCatchStacker.cs @@ -4,11 +4,12 @@ using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Catch.Objects; +using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Catch.Tests { [TestFixture] - public class TestCaseCatchStacker : Game.Tests.Visual.TestCasePlayer + public class TestCaseCatchStacker : PlayerTestCase { public TestCaseCatchStacker() : base(new CatchRuleset()) diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs index 7451986a8b..a7e7f0ab14 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestCaseHyperDash.cs @@ -1,22 +1,28 @@ // 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.Beatmaps; using osu.Game.Rulesets.Catch.Objects; -using osu.Game.Screens.Play; +using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Catch.Tests { [TestFixture] - public class TestCaseHyperDash : Game.Tests.Visual.TestCasePlayer + public class TestCaseHyperDash : PlayerTestCase { public TestCaseHyperDash() : base(new CatchRuleset()) { } + [BackgroundDependencyLoader] + private void load() + { + AddAssert("First note is hyperdash", () => Beatmap.Value.Beatmap.HitObjects[0] is Fruit f && f.HyperDash); + } + protected override IBeatmap CreateBeatmap(Ruleset ruleset) { var beatmap = new Beatmap @@ -28,7 +34,7 @@ namespace osu.Game.Rulesets.Catch.Tests } }; - // Should produce a hperdash + // Should produce a hyper-dash beatmap.HitObjects.Add(new Fruit { StartTime = 816, X = 308 / 512f, NewCombo = true }); beatmap.HitObjects.Add(new Fruit { StartTime = 1008, X = 56 / 512f, }); @@ -38,11 +44,5 @@ namespace osu.Game.Rulesets.Catch.Tests 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); - } } } diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleLongCombo.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleLongCombo.cs index f5fe36b56a..8d097ff1c1 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleLongCombo.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseHitCircleLongCombo.cs @@ -4,12 +4,13 @@ using NUnit.Framework; using osu.Game.Beatmaps; using osu.Game.Rulesets.Osu.Objects; +using osu.Game.Tests.Visual; using osuTK; namespace osu.Game.Rulesets.Osu.Tests { [TestFixture] - public class TestCaseHitCircleLongCombo : Game.Tests.Visual.TestCasePlayer + public class TestCaseHitCircleLongCombo : PlayerTestCase { public TestCaseHitCircleLongCombo() : base(new OsuRuleset()) diff --git a/osu.Game.Rulesets.Osu.Tests/TestCaseOsuPlayer.cs b/osu.Game.Rulesets.Osu.Tests/TestCaseOsuPlayer.cs index 9f13c19390..720c3c66fe 100644 --- a/osu.Game.Rulesets.Osu.Tests/TestCaseOsuPlayer.cs +++ b/osu.Game.Rulesets.Osu.Tests/TestCaseOsuPlayer.cs @@ -2,11 +2,12 @@ // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; +using osu.Game.Tests.Visual; namespace osu.Game.Rulesets.Osu.Tests { [TestFixture] - public class TestCaseOsuPlayer : Game.Tests.Visual.TestCasePlayer + public class TestCaseOsuPlayer : PlayerTestCase { public TestCaseOsuPlayer() : base(new OsuRuleset()) diff --git a/osu.Game.Tests/Visual/TestCaseAllPlayers.cs b/osu.Game.Tests/Visual/TestCaseAllPlayers.cs deleted file mode 100644 index a5decaa9fb..0000000000 --- a/osu.Game.Tests/Visual/TestCaseAllPlayers.cs +++ /dev/null @@ -1,12 +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 NUnit.Framework; - -namespace osu.Game.Tests.Visual -{ - [TestFixture] - public class TestCaseAllPlayers : TestCasePlayer - { - } -} diff --git a/osu.Game.Tests/Visual/TestCaseAutoplay.cs b/osu.Game.Tests/Visual/TestCaseAutoplay.cs index 61339a6af8..c25088f8a4 100644 --- a/osu.Game.Tests/Visual/TestCaseAutoplay.cs +++ b/osu.Game.Tests/Visual/TestCaseAutoplay.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.ComponentModel; using System.Linq; using osu.Game.Rulesets; @@ -11,7 +10,7 @@ using osu.Game.Screens.Play; namespace osu.Game.Tests.Visual { [Description("Player instantiated with an autoplay mod.")] - public class TestCaseAutoplay : TestCasePlayer + public class TestCaseAutoplay : AllPlayersTestCase { protected override Player CreatePlayer(Ruleset ruleset) { @@ -24,11 +23,10 @@ namespace osu.Game.Tests.Visual }; } - protected override void AddCheckSteps(Func player) + protected override void AddCheckSteps() { - base.AddCheckSteps(player); - AddUntilStep(() => ((ScoreAccessiblePlayer)player()).ScoreProcessor.TotalScore.Value > 0, "score above zero"); - AddUntilStep(() => ((ScoreAccessiblePlayer)player()).HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 0), "key counter counted keys"); + AddUntilStep(() => ((ScoreAccessiblePlayer)Player).ScoreProcessor.TotalScore.Value > 0, "score above zero"); + AddUntilStep(() => ((ScoreAccessiblePlayer)Player).HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 0), "key counter counted keys"); } private class ScoreAccessiblePlayer : Player diff --git a/osu.Game.Tests/Visual/TestCasePlayerReferenceLeaking.cs b/osu.Game.Tests/Visual/TestCasePlayerReferenceLeaking.cs new file mode 100644 index 0000000000..04fb863f18 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCasePlayerReferenceLeaking.cs @@ -0,0 +1,56 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Lists; +using osu.Framework.Timing; +using osu.Game.Beatmaps; +using osu.Game.Rulesets; +using osu.Game.Screens.Play; + +namespace osu.Game.Tests.Visual +{ + public class TestCasePlayerReferenceLeaking : AllPlayersTestCase + { + private readonly WeakList workingWeakReferences = new WeakList(); + + private readonly WeakList playerWeakReferences = new WeakList(); + + protected override void AddCheckSteps() + { + AddUntilStep(() => + { + GC.Collect(); + GC.WaitForPendingFinalizers(); + int count = 0; + + workingWeakReferences.ForEachAlive(_ => count++); + return count == 1; + }, "no leaked beatmaps"); + + AddUntilStep(() => + { + GC.Collect(); + GC.WaitForPendingFinalizers(); + int count = 0; + + playerWeakReferences.ForEachAlive(_ => count++); + return count == 1; + }, "no leaked players"); + } + + protected override WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, IFrameBasedClock clock) + { + var working = base.CreateWorkingBeatmap(beatmap, clock); + workingWeakReferences.Add(working); + return working; + } + + protected override Player CreatePlayer(Ruleset ruleset) + { + var player = base.CreatePlayer(ruleset); + playerWeakReferences.Add(player); + return player; + } + } +} diff --git a/osu.Game.Tests/Visual/TestCaseReplay.cs b/osu.Game.Tests/Visual/TestCaseReplay.cs index c34190d567..93a20b9425 100644 --- a/osu.Game.Tests/Visual/TestCaseReplay.cs +++ b/osu.Game.Tests/Visual/TestCaseReplay.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.ComponentModel; using System.Linq; using osu.Game.Rulesets; @@ -12,7 +11,7 @@ using osu.Game.Screens.Play; namespace osu.Game.Tests.Visual { [Description("Player instantiated with a replay.")] - public class TestCaseReplay : TestCasePlayer + public class TestCaseReplay : AllPlayersTestCase { protected override Player CreatePlayer(Ruleset ruleset) { @@ -21,11 +20,10 @@ namespace osu.Game.Tests.Visual return new ScoreAccessibleReplayPlayer(ruleset.GetAutoplayMod().CreateReplayScore(beatmap)); } - protected override void AddCheckSteps(Func player) + protected override void AddCheckSteps() { - base.AddCheckSteps(player); - AddUntilStep(() => ((ScoreAccessibleReplayPlayer)player()).ScoreProcessor.TotalScore.Value > 0, "score above zero"); - AddUntilStep(() => ((ScoreAccessibleReplayPlayer)player()).HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 0), "key counter counted keys"); + AddUntilStep(() => ((ScoreAccessibleReplayPlayer)Player).ScoreProcessor.TotalScore.Value > 0, "score above zero"); + AddUntilStep(() => ((ScoreAccessibleReplayPlayer)Player).HUDOverlay.KeyCounter.Children.Any(kc => kc.CountPresses > 0), "key counter counted keys"); } private class ScoreAccessibleReplayPlayer : ReplayPlayer diff --git a/osu.Game/Tests/Visual/AllPlayersTestCase.cs b/osu.Game/Tests/Visual/AllPlayersTestCase.cs new file mode 100644 index 0000000000..507848730f --- /dev/null +++ b/osu.Game/Tests/Visual/AllPlayersTestCase.cs @@ -0,0 +1,94 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Screens; +using osu.Framework.Timing; +using osu.Game.Beatmaps; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; +using osu.Game.Screens.Play; +using osu.Game.Tests.Beatmaps; +using osuTK.Graphics; + +namespace osu.Game.Tests.Visual +{ + /// + /// A base class which runs test for all available rulesets. + /// Steps to be run for each ruleset should be added via . + /// + public abstract class AllPlayersTestCase : RateAdjustedBeatmapTestCase + { + protected Player Player; + + [BackgroundDependencyLoader] + private void load(RulesetStore rulesets) + { + Add(new Box + { + RelativeSizeAxes = Framework.Graphics.Axes.Both, + Colour = Color4.Black, + Depth = int.MaxValue + }); + + foreach (var r in rulesets.AvailableRulesets) + { + Player p = null; + AddStep(r.Name, () => p = loadPlayerFor(r)); + AddUntilStep(() => + { + if (p?.IsLoaded == true) + { + p = null; + return true; + } + + return false; + }, "player loaded"); + + AddCheckSteps(); + } + } + + protected abstract void AddCheckSteps(); + + protected virtual IBeatmap CreateBeatmap(Ruleset ruleset) => new TestBeatmap(ruleset.RulesetInfo); + + protected virtual WorkingBeatmap CreateWorkingBeatmap(IBeatmap beatmap, IFrameBasedClock clock) => + new TestWorkingBeatmap(beatmap, Clock); + + private Player loadPlayerFor(RulesetInfo ri) + { + Ruleset.Value = ri; + var r = ri.CreateInstance(); + + var beatmap = CreateBeatmap(r); + var working = CreateWorkingBeatmap(beatmap, Clock); + + Beatmap.Value = working; + Beatmap.Value.Mods.Value = new[] { r.GetAllMods().First(m => m is ModNoFail) }; + + Player?.Exit(); + Player = null; + + var player = CreatePlayer(r); + + LoadComponentAsync(player, p => + { + Player = p; + LoadScreen(p); + }); + + return player; + } + + protected virtual Player CreatePlayer(Ruleset ruleset) => new Player + { + AllowPause = false, + AllowLeadIn = false, + AllowResults = false, + }; + } +} diff --git a/osu.Game/Tests/Visual/PlayerTestCase.cs b/osu.Game/Tests/Visual/PlayerTestCase.cs new file mode 100644 index 0000000000..cdf53a362b --- /dev/null +++ b/osu.Game/Tests/Visual/PlayerTestCase.cs @@ -0,0 +1,60 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System.Linq; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Shapes; +using osu.Game.Beatmaps; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Mods; +using osu.Game.Screens.Play; +using osu.Game.Tests.Beatmaps; +using osuTK.Graphics; + +namespace osu.Game.Tests.Visual +{ + public abstract class PlayerTestCase : RateAdjustedBeatmapTestCase + { + private readonly Ruleset ruleset; + + protected Player Player; + + protected PlayerTestCase(Ruleset ruleset) + { + this.ruleset = ruleset; + + Add(new Box + { + RelativeSizeAxes = Axes.Both, + Colour = Color4.Black, + Depth = int.MaxValue + }); + + AddStep(ruleset.RulesetInfo.Name, loadPlayer); + AddUntilStep(() => Player.IsLoaded, "player loaded"); + } + + protected virtual IBeatmap CreateBeatmap(Ruleset ruleset) => new TestBeatmap(ruleset.RulesetInfo); + + private void loadPlayer() + { + var beatmap = CreateBeatmap(ruleset); + + Beatmap.Value = new TestWorkingBeatmap(beatmap, Clock); + Beatmap.Value.Mods.Value = new[] { ruleset.GetAllMods().First(m => m is ModNoFail) }; + + LoadComponentAsync(Player = CreatePlayer(ruleset), p => + { + Player = p; + LoadScreen(p); + }); + } + + protected virtual Player CreatePlayer(Ruleset ruleset) => new Player + { + AllowPause = false, + AllowLeadIn = false, + AllowResults = false, + }; + } +} diff --git a/osu.Game/Tests/Visual/TestCasePlayer.cs b/osu.Game/Tests/Visual/TestCasePlayer.cs deleted file mode 100644 index 5ff798c40d..0000000000 --- a/osu.Game/Tests/Visual/TestCasePlayer.cs +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Linq; -using osu.Framework.Allocation; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Lists; -using osu.Framework.Screens; -using osu.Game.Beatmaps; -using osu.Game.Rulesets; -using osu.Game.Rulesets.Mods; -using osu.Game.Screens.Play; -using osu.Game.Tests.Beatmaps; -using osuTK.Graphics; - -namespace osu.Game.Tests.Visual -{ - public abstract class TestCasePlayer : RateAdjustedBeatmapTestCase - { - private readonly Ruleset ruleset; - - protected Player Player; - - protected TestCasePlayer(Ruleset ruleset) - { - this.ruleset = ruleset; - } - - protected TestCasePlayer() - { - } - - [BackgroundDependencyLoader] - private void load(RulesetStore rulesets) - { - Add(new Box - { - RelativeSizeAxes = Framework.Graphics.Axes.Both, - Colour = Color4.Black, - Depth = int.MaxValue - }); - - if (ruleset != null) - { - Player p = null; - AddStep(ruleset.RulesetInfo.Name, () => p = loadPlayerFor(ruleset)); - AddCheckSteps(() => p); - } - else - { - foreach (var r in rulesets.AvailableRulesets) - { - Player p = null; - AddStep(r.Name, () => p = loadPlayerFor(r)); - AddCheckSteps(() => p); - - AddUntilStep(() => - { - p = null; - - GC.Collect(); - GC.WaitForPendingFinalizers(); - int count = 0; - - workingWeakReferences.ForEachAlive(_ => count++); - return count == 1; - }, "no leaked beatmaps"); - - AddUntilStep(() => - { - GC.Collect(); - GC.WaitForPendingFinalizers(); - int count = 0; - - playerWeakReferences.ForEachAlive(_ => count++); - return count == 1; - }, "no leaked players"); - } - } - } - - protected virtual void AddCheckSteps(Func player) - { - AddUntilStep(() => player().IsLoaded, "player loaded"); - } - - protected virtual IBeatmap CreateBeatmap(Ruleset ruleset) => new TestBeatmap(ruleset.RulesetInfo); - - private readonly WeakList workingWeakReferences = new WeakList(); - private readonly WeakList playerWeakReferences = new WeakList(); - - private Player loadPlayerFor(RulesetInfo ri) - { - Ruleset.Value = ri; - return loadPlayerFor(ri.CreateInstance()); - } - - private Player loadPlayerFor(Ruleset r) - { - var beatmap = CreateBeatmap(r); - var working = new TestWorkingBeatmap(beatmap, Clock); - - workingWeakReferences.Add(working); - - Beatmap.Value = working; - Beatmap.Value.Mods.Value = new[] { r.GetAllMods().First(m => m is ModNoFail) }; - - Player?.Exit(); - - var player = CreatePlayer(r); - - playerWeakReferences.Add(player); - - LoadComponentAsync(player, p => - { - Player = p; - LoadScreen(p); - }); - - return player; - } - - protected virtual Player CreatePlayer(Ruleset ruleset) => new Player - { - AllowPause = false, - AllowLeadIn = false, - AllowResults = false, - }; - } -} From a81461ba1222a4ba232591fab088c9b3a34a110b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Mar 2019 19:43:55 +0900 Subject: [PATCH 022/107] Add ability to test without nofail enabled --- osu.Game/Tests/Visual/PlayerTestCase.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Tests/Visual/PlayerTestCase.cs b/osu.Game/Tests/Visual/PlayerTestCase.cs index cdf53a362b..4833d0ba0f 100644 --- a/osu.Game/Tests/Visual/PlayerTestCase.cs +++ b/osu.Game/Tests/Visual/PlayerTestCase.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 System.Linq; @@ -36,12 +36,16 @@ namespace osu.Game.Tests.Visual protected virtual IBeatmap CreateBeatmap(Ruleset ruleset) => new TestBeatmap(ruleset.RulesetInfo); + protected virtual bool AllowFail => false; + private void loadPlayer() { var beatmap = CreateBeatmap(ruleset); Beatmap.Value = new TestWorkingBeatmap(beatmap, Clock); - Beatmap.Value.Mods.Value = new[] { ruleset.GetAllMods().First(m => m is ModNoFail) }; + + if (!AllowFail) + Beatmap.Value.Mods.Value = new[] { ruleset.GetAllMods().First(m => m is ModNoFail) }; LoadComponentAsync(Player = CreatePlayer(ruleset), p => { From 15dd132c92e13ee2fb41f723a270d65a441d8d89 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Mar 2019 19:44:14 +0900 Subject: [PATCH 023/107] Use SetUpSteps attribute --- osu.Game/Tests/Visual/PlayerTestCase.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/osu.Game/Tests/Visual/PlayerTestCase.cs b/osu.Game/Tests/Visual/PlayerTestCase.cs index 4833d0ba0f..ad01d82281 100644 --- a/osu.Game/Tests/Visual/PlayerTestCase.cs +++ b/osu.Game/Tests/Visual/PlayerTestCase.cs @@ -1,9 +1,10 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. using System.Linq; using osu.Framework.Graphics; using osu.Framework.Graphics.Shapes; +using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Rulesets; using osu.Game.Rulesets.Mods; @@ -29,7 +30,11 @@ namespace osu.Game.Tests.Visual Colour = Color4.Black, Depth = int.MaxValue }); + } + [SetUpSteps] + public void SetUpSteps() + { AddStep(ruleset.RulesetInfo.Name, loadPlayer); AddUntilStep(() => Player.IsLoaded, "player loaded"); } From 465c95e952cceb7ff62b496861728b6d81e4b5b1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 16 Mar 2019 14:20:10 +0900 Subject: [PATCH 024/107] Refactor pause logic so GameplayClockContainer is in control --- .../Screens/Play/GameplayClockContainer.cs | 7 ++++- .../Screens/Play/PausableGameplayContainer.cs | 26 ++++++++---------- osu.Game/Screens/Play/Player.cs | 27 +++++++++++-------- 3 files changed, 33 insertions(+), 27 deletions(-) diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs index 3c2cec1d94..1e4c9aba92 100644 --- a/osu.Game/Screens/Play/GameplayClockContainer.cs +++ b/osu.Game/Screens/Play/GameplayClockContainer.cs @@ -118,11 +118,16 @@ namespace osu.Game.Screens.Play // This accounts for the audio clock source potentially taking time to enter a completely stopped state adjustableClock.Seek(adjustableClock.CurrentTime); adjustableClock.Start(); + IsPaused.Value = false; } public void Seek(double time) => adjustableClock.Seek(time); - public void Stop() => adjustableClock.Stop(); + public void Stop() + { + adjustableClock.Stop(); + IsPaused.Value = true; + } public void ResetLocalAdjustments() { diff --git a/osu.Game/Screens/Play/PausableGameplayContainer.cs b/osu.Game/Screens/Play/PausableGameplayContainer.cs index 99f0083b55..6363b92a8f 100644 --- a/osu.Game/Screens/Play/PausableGameplayContainer.cs +++ b/osu.Game/Screens/Play/PausableGameplayContainer.cs @@ -41,8 +41,8 @@ namespace osu.Game.Screens.Play public Action OnRetry; public Action OnQuit; - public Action Stop; - public Action Start; + public Action RequestPause; + public Action RequestResume; /// /// Creates a new . @@ -70,15 +70,12 @@ namespace osu.Game.Screens.Play }; } - public void Pause(bool force = false) => Schedule(() => // Scheduled to ensure a stable position in execution order, no matter how it was called. + public void Pause() => Schedule(() => // Scheduled to ensure a stable position in execution order, no matter how it was called. { - if (!CanPause && !force) return; - - if (IsPaused.Value) return; + if (!CanPause) return; // stop the seekable clock (stops the audio eventually) - Stop?.Invoke(); - IsPaused.Value = true; + RequestPause?.Invoke(); pauseOverlay.Show(); @@ -89,14 +86,13 @@ namespace osu.Game.Screens.Play { if (!IsPaused.Value) return; - IsResuming = false; - lastPauseActionTime = Time.Current; - - IsPaused.Value = false; - - Start?.Invoke(); - pauseOverlay.Hide(); + + RequestResume?.Invoke(() => + { + IsResuming = false; + lastPauseActionTime = Time.Current; + }); } private OsuGameBase game; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b11c5e51c9..7637cfe869 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -111,10 +111,14 @@ namespace osu.Game.Screens.Play Retries = RestartCount, OnRetry = restart, OnQuit = performUserRequestedExit, - Start = gameplayClockContainer.Start, - Stop = gameplayClockContainer.Stop, + RequestResume = completion => + { + gameplayClockContainer.Start(); + completion(); + }, + RequestPause = gameplayClockContainer.Stop, IsPaused = { BindTarget = gameplayClockContainer.IsPaused }, - CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded.Value, + CheckCanPause = () => CanPause, Children = new[] { StoryboardContainer = CreateStoryboardContainer(), @@ -337,6 +341,9 @@ namespace osu.Game.Screens.Play base.OnSuspending(next); } + public bool CanPause => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded.Value + && (PausableGameplayContainer?.IsPaused.Value == false || PausableGameplayContainer?.IsResuming == true); + public override bool OnExiting(IScreen next) { if (onCompletionEvent != null) @@ -346,18 +353,16 @@ namespace osu.Game.Screens.Play return true; } - if ((!AllowPause || HasFailed || !ValidForResume || PausableGameplayContainer?.IsPaused.Value != false || RulesetContainer?.HasReplayLoaded.Value != false) && (!PausableGameplayContainer?.IsResuming ?? true)) + if (LoadedBeatmapSuccessfully && CanPause) { - gameplayClockContainer.ResetLocalAdjustments(); - - fadeOut(); - return base.OnExiting(next); + PausableGameplayContainer?.Pause(); + return true; } - if (LoadedBeatmapSuccessfully) - PausableGameplayContainer?.Pause(); + gameplayClockContainer.ResetLocalAdjustments(); - return true; + fadeOut(); + return base.OnExiting(next); } private void fadeOut(bool instant = false) From bcaff9f7b47efdc3c0087609daef32e48110e1ab Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Mar 2019 00:46:15 +0900 Subject: [PATCH 025/107] Add basic pause tests --- osu.Game.Tests/Visual/TestCasePause.cs | 47 +++++++++++++++++++ .../Screens/Play/GameplayClockContainer.cs | 6 +-- osu.Game/Screens/Play/Player.cs | 26 +++++----- 3 files changed, 63 insertions(+), 16 deletions(-) create mode 100644 osu.Game.Tests/Visual/TestCasePause.cs diff --git a/osu.Game.Tests/Visual/TestCasePause.cs b/osu.Game.Tests/Visual/TestCasePause.cs new file mode 100644 index 0000000000..6966eb3de9 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCasePause.cs @@ -0,0 +1,47 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Game.Rulesets; +using osu.Game.Rulesets.Osu; +using osu.Game.Rulesets.Scoring; +using osu.Game.Screens.Play; + +namespace osu.Game.Tests.Visual +{ + public class TestCasePause : TestCasePlayer + { + public TestCasePause() + : base(new OsuRuleset()) + { + } + + protected override Player CreatePlayer(Ruleset ruleset) => new PausePlayer(); + + protected override void AddCheckSteps(Func player) + { + PausePlayer pausable() => (PausePlayer)player(); + + base.AddCheckSteps(player); + //AddUntilStep(() => pausable().ScoreProcessor.TotalScore.Value > 0, "score above zero"); + + AddStep("pause", () => pausable().PausableGameplayContainer.Pause()); + AddAssert("clock stopped", () => !pausable().GameplayClockContainer.GameplayClock.IsRunning); + + AddStep("resume", () => pausable().PausableGameplayContainer.Resume()); + AddUntilStep(() => pausable().GameplayClockContainer.GameplayClock.IsRunning, "clock started"); + + AddStep("pause too soon", () => pausable().PausableGameplayContainer.Pause()); + AddAssert("clock not stopped", () => pausable().GameplayClockContainer.GameplayClock.IsRunning); + } + + private class PausePlayer : Player + { + public new PausableGameplayContainer PausableGameplayContainer => base.PausableGameplayContainer; + + public new GameplayClockContainer GameplayClockContainer => base.GameplayClockContainer; + + public new ScoreProcessor ScoreProcessor => base.ScoreProcessor; + } + } +} diff --git a/osu.Game/Screens/Play/GameplayClockContainer.cs b/osu.Game/Screens/Play/GameplayClockContainer.cs index 1e4c9aba92..deac5e02bf 100644 --- a/osu.Game/Screens/Play/GameplayClockContainer.cs +++ b/osu.Game/Screens/Play/GameplayClockContainer.cs @@ -18,7 +18,7 @@ using osu.Game.Rulesets.Mods; namespace osu.Game.Screens.Play { /// - /// Encapsulates gameplay timing logic and provides a for children. + /// Encapsulates gameplay timing logic and provides a for children. /// public class GameplayClockContainer : Container { @@ -48,7 +48,7 @@ namespace osu.Game.Screens.Play /// The final clock which is exposed to underlying components. /// [Cached] - private readonly GameplayClock gameplayClock; + public readonly GameplayClock GameplayClock; private Bindable userAudioOffset; @@ -78,7 +78,7 @@ namespace osu.Game.Screens.Play offsetClock = new FramedOffsetClock(platformOffsetClock); // the clock to be exposed via DI to children. - gameplayClock = new GameplayClock(offsetClock); + GameplayClock = new GameplayClock(offsetClock); } [BackgroundDependencyLoader] diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 7637cfe869..3d60a44c85 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -82,7 +82,7 @@ namespace osu.Game.Screens.Play public bool LoadedBeatmapSuccessfully => RulesetContainer?.Objects.Any() == true; - private GameplayClockContainer gameplayClockContainer; + protected GameplayClockContainer GameplayClockContainer { get; private set; } [BackgroundDependencyLoader] private void load(AudioManager audio, IAPIProvider api, OsuConfigManager config) @@ -102,9 +102,9 @@ namespace osu.Game.Screens.Play if (!ScoreProcessor.Mode.Disabled) config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode); - InternalChild = gameplayClockContainer = new GameplayClockContainer(working, AllowLeadIn, RulesetContainer.GameplayStartTime); + InternalChild = GameplayClockContainer = new GameplayClockContainer(working, AllowLeadIn, RulesetContainer.GameplayStartTime); - gameplayClockContainer.Children = new Drawable[] + GameplayClockContainer.Children = new Drawable[] { PausableGameplayContainer = new PausableGameplayContainer { @@ -113,11 +113,11 @@ namespace osu.Game.Screens.Play OnQuit = performUserRequestedExit, RequestResume = completion => { - gameplayClockContainer.Start(); + GameplayClockContainer.Start(); completion(); }, - RequestPause = gameplayClockContainer.Stop, - IsPaused = { BindTarget = gameplayClockContainer.IsPaused }, + RequestPause = GameplayClockContainer.Stop, + IsPaused = { BindTarget = GameplayClockContainer.IsPaused }, CheckCanPause = () => CanPause, Children = new[] { @@ -141,15 +141,15 @@ namespace osu.Game.Screens.Play HUDOverlay = new HUDOverlay(ScoreProcessor, RulesetContainer, working) { HoldToQuit = { Action = performUserRequestedExit }, - PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = gameplayClockContainer.UserPlaybackRate } } }, + PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = GameplayClockContainer.UserPlaybackRate } } }, KeyCounter = { Visible = { BindTarget = RulesetContainer.HasReplayLoaded } }, - RequestSeek = gameplayClockContainer.Seek, + RequestSeek = GameplayClockContainer.Seek, Anchor = Anchor.Centre, Origin = Anchor.Centre }, new SkipOverlay(RulesetContainer.GameplayStartTime) { - RequestSeek = gameplayClockContainer.Seek + RequestSeek = GameplayClockContainer.Seek }, } }, @@ -171,7 +171,7 @@ namespace osu.Game.Screens.Play }; // bind clock into components that require it - RulesetContainer.IsPaused.BindTo(gameplayClockContainer.IsPaused); + RulesetContainer.IsPaused.BindTo(GameplayClockContainer.IsPaused); if (ShowStoryboard.Value) initializeStoryboard(false); @@ -295,7 +295,7 @@ namespace osu.Game.Screens.Play if (Beatmap.Value.Mods.Value.OfType().Any(m => !m.AllowFail)) return false; - gameplayClockContainer.Stop(); + GameplayClockContainer.Stop(); HasFailed = true; failOverlay.Retries = RestartCount; @@ -329,7 +329,7 @@ namespace osu.Game.Screens.Play storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable; - gameplayClockContainer.Restart(); + GameplayClockContainer.Restart(); PausableGameplayContainer.Alpha = 0; PausableGameplayContainer.FadeIn(750, Easing.OutQuint); @@ -359,7 +359,7 @@ namespace osu.Game.Screens.Play return true; } - gameplayClockContainer.ResetLocalAdjustments(); + GameplayClockContainer.ResetLocalAdjustments(); fadeOut(); return base.OnExiting(next); From f13003c53b7957cf76be0042a85f7d99512349cb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Mar 2019 11:12:47 +0900 Subject: [PATCH 026/107] Simplify and localise storyboard logic in Player.cs --- osu.Game/Screens/Play/Player.cs | 48 ++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 3d60a44c85..0e8bedefb0 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.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 System; @@ -70,9 +70,32 @@ namespace osu.Game.Screens.Play protected HUDOverlay HUDOverlay { get; private set; } private FailOverlay failOverlay; + #region Storyboard + private DrawableStoryboard storyboard; protected UserDimContainer StoryboardContainer { get; private set; } + private void initializeStoryboard(bool asyncLoad) + { + if (StoryboardContainer == null || storyboard != null) + return; + + if (!ShowStoryboard.Value) + return; + + var beatmap = Beatmap.Value; + + storyboard = beatmap.Storyboard.CreateDrawable(); + storyboard.Masking = true; + + if (asyncLoad) + LoadComponentAsync(storyboard, StoryboardContainer.Add); + else + StoryboardContainer.Add(storyboard); + } + + #endregion + protected virtual UserDimContainer CreateStoryboardContainer() => new UserDimContainer(true) { RelativeSizeAxes = Axes.Both, @@ -173,7 +196,7 @@ namespace osu.Game.Screens.Play // bind clock into components that require it RulesetContainer.IsPaused.BindTo(GameplayClockContainer.IsPaused); - if (ShowStoryboard.Value) + // load storyboard as part of player's load if we can initializeStoryboard(false); // Bind ScoreProcessor to ourselves @@ -317,10 +340,7 @@ namespace osu.Game.Screens.Play .Delay(250) .FadeIn(250); - ShowStoryboard.ValueChanged += enabled => - { - if (enabled.NewValue) initializeStoryboard(true); - }; + ShowStoryboard.ValueChanged += _ => initializeStoryboard(true); Background.EnableUserDim.Value = true; @@ -376,22 +396,6 @@ namespace osu.Game.Screens.Play protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !PausableGameplayContainer.IsPaused.Value; - private void initializeStoryboard(bool asyncLoad) - { - if (StoryboardContainer == null || storyboard != null) - return; - - var beatmap = Beatmap.Value; - - storyboard = beatmap.Storyboard.CreateDrawable(); - storyboard.Masking = true; - - if (asyncLoad) - LoadComponentAsync(storyboard, StoryboardContainer.Add); - else - StoryboardContainer.Add(storyboard); - } - protected virtual Results CreateResults(ScoreInfo score) => new SoloResults(score); } } From 536b5e0dab579ec7e55ee09d08397f30cfcb13b9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Mar 2019 11:48:11 +0900 Subject: [PATCH 027/107] Remove PausableGameplayContainer --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 6 +- .../Visual/TestCaseGameplayMenuOverlay.cs | 6 +- osu.Game.Tests/Visual/TestCasePause.cs | 28 ++- .../Screens/Play/PausableGameplayContainer.cs | 133 ------------ osu.Game/Screens/Play/PauseOverlay.cs | 29 +++ osu.Game/Screens/Play/Player.cs | 190 ++++++++++++------ 6 files changed, 183 insertions(+), 209 deletions(-) delete mode 100644 osu.Game/Screens/Play/PausableGameplayContainer.cs create mode 100644 osu.Game/Screens/Play/PauseOverlay.cs diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 5484824c5b..d62ae07f6a 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -188,10 +188,10 @@ namespace osu.Game.Tests.Visual public void PauseTest() { performFullSetup(true); - AddStep("Pause", () => player.CurrentPausableGameplayContainer.Pause()); + AddStep("Pause", () => player.Pause()); waitForDim(); AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); - AddStep("Unpause", () => player.CurrentPausableGameplayContainer.Resume()); + AddStep("Unpause", () => player.Resume()); waitForDim(); AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed()); } @@ -328,8 +328,6 @@ namespace osu.Game.Tests.Visual }; } - public PausableGameplayContainer CurrentPausableGameplayContainer => PausableGameplayContainer; - public UserDimContainer CurrentStoryboardContainer => StoryboardContainer; // Whether or not the player should be allowed to load. diff --git a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs index 93a059d214..c5ad57fec9 100644 --- a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs @@ -17,15 +17,15 @@ namespace osu.Game.Tests.Visual [Description("player pause/fail screens")] public class TestCaseGameplayMenuOverlay : ManualInputManagerTestCase { - public override IReadOnlyList RequiredTypes => new[] { typeof(FailOverlay), typeof(PausableGameplayContainer) }; + public override IReadOnlyList RequiredTypes => new[] { typeof(FailOverlay), typeof(PauseOverlay) }; private FailOverlay failOverlay; - private PausableGameplayContainer.PauseOverlay pauseOverlay; + private PauseOverlay pauseOverlay; [BackgroundDependencyLoader] private void load() { - Add(pauseOverlay = new PausableGameplayContainer.PauseOverlay + Add(pauseOverlay = new PauseOverlay { OnResume = () => Logger.Log(@"Resume"), OnRetry = () => Logger.Log(@"Retry"), diff --git a/osu.Game.Tests/Visual/TestCasePause.cs b/osu.Game.Tests/Visual/TestCasePause.cs index 6966eb3de9..622a12da81 100644 --- a/osu.Game.Tests/Visual/TestCasePause.cs +++ b/osu.Game.Tests/Visual/TestCasePause.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using osu.Framework.Graphics.Containers; using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Scoring; @@ -16,6 +17,8 @@ namespace osu.Game.Tests.Visual { } + protected override bool AllowFail => true; + protected override Player CreatePlayer(Ruleset ruleset) => new PausePlayer(); protected override void AddCheckSteps(Func player) @@ -25,23 +28,36 @@ namespace osu.Game.Tests.Visual base.AddCheckSteps(player); //AddUntilStep(() => pausable().ScoreProcessor.TotalScore.Value > 0, "score above zero"); - AddStep("pause", () => pausable().PausableGameplayContainer.Pause()); + AddStep("pause", () => pausable().Pause()); AddAssert("clock stopped", () => !pausable().GameplayClockContainer.GameplayClock.IsRunning); + AddAssert("pause overlay shown", () => pausable().PauseOverlayVisible); - AddStep("resume", () => pausable().PausableGameplayContainer.Resume()); - AddUntilStep(() => pausable().GameplayClockContainer.GameplayClock.IsRunning, "clock started"); + AddStep("resume", () => pausable().Resume()); + AddAssert("pause overlay hidden", () => !pausable().PauseOverlayVisible); - AddStep("pause too soon", () => pausable().PausableGameplayContainer.Pause()); + AddStep("pause too soon", () => pausable().Pause()); AddAssert("clock not stopped", () => pausable().GameplayClockContainer.GameplayClock.IsRunning); + AddAssert("pause overlay hidden", () => !pausable().PauseOverlayVisible); + + AddUntilStep(() => pausable().HasFailed, "wait for fail"); + + AddAssert("fail overlay shown", () => pausable().FailOverlayVisible); + + AddStep("try to pause", () => pausable().Pause()); + + AddAssert("pause overlay hidden", () => !pausable().PauseOverlayVisible); + AddAssert("fail overlay still shown", () => pausable().FailOverlayVisible); } private class PausePlayer : Player { - public new PausableGameplayContainer PausableGameplayContainer => base.PausableGameplayContainer; - public new GameplayClockContainer GameplayClockContainer => base.GameplayClockContainer; public new ScoreProcessor ScoreProcessor => base.ScoreProcessor; + + public bool FailOverlayVisible => FailOverlay.State == Visibility.Visible; + + public bool PauseOverlayVisible => PauseOverlay.State == Visibility.Visible; } } } diff --git a/osu.Game/Screens/Play/PausableGameplayContainer.cs b/osu.Game/Screens/Play/PausableGameplayContainer.cs deleted file mode 100644 index 6363b92a8f..0000000000 --- a/osu.Game/Screens/Play/PausableGameplayContainer.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using System; -using System.Linq; -using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Graphics; -using osuTK.Graphics; - -namespace osu.Game.Screens.Play -{ - /// - /// A container which handles pausing children, displaying an overlay blocking its children during paused state. - /// - public class PausableGameplayContainer : Container - { - public readonly BindableBool IsPaused = new BindableBool(); - - public Func CheckCanPause; - - private const double pause_cooldown = 1000; - private double lastPauseActionTime; - - private readonly PauseOverlay pauseOverlay; - - private readonly Container content; - - protected override Container Content => content; - - public int Retries - { - set => pauseOverlay.Retries = value; - } - - public bool CanPause => (CheckCanPause?.Invoke() ?? true) && Time.Current >= lastPauseActionTime + pause_cooldown; - public bool IsResuming { get; private set; } - - public Action OnRetry; - public Action OnQuit; - - public Action RequestPause; - public Action RequestResume; - - /// - /// Creates a new . - /// - public PausableGameplayContainer() - { - RelativeSizeAxes = Axes.Both; - - InternalChildren = new[] - { - content = new Container - { - RelativeSizeAxes = Axes.Both - }, - pauseOverlay = new PauseOverlay - { - OnResume = () => - { - IsResuming = true; - this.Delay(400).Schedule(Resume); - }, - OnRetry = () => OnRetry(), - OnQuit = () => OnQuit(), - } - }; - } - - public void Pause() => Schedule(() => // Scheduled to ensure a stable position in execution order, no matter how it was called. - { - if (!CanPause) return; - - // stop the seekable clock (stops the audio eventually) - RequestPause?.Invoke(); - - pauseOverlay.Show(); - - lastPauseActionTime = Time.Current; - }); - - public void Resume() - { - if (!IsPaused.Value) return; - - pauseOverlay.Hide(); - - RequestResume?.Invoke(() => - { - IsResuming = false; - lastPauseActionTime = Time.Current; - }); - } - - private OsuGameBase game; - - [BackgroundDependencyLoader] - private void load(OsuGameBase game) - { - this.game = game; - } - - protected override void Update() - { - // eagerly pause when we lose window focus (if we are locally playing). - if (!game.IsActive.Value && CanPause) - Pause(); - - base.Update(); - } - - public class PauseOverlay : GameplayMenuOverlay - { - public Action OnResume; - - public override string Header => "paused"; - public override string Description => "you're not going to do what i think you're going to do, are ya?"; - - protected override Action BackAction => () => InternalButtons.Children.First().Click(); - - [BackgroundDependencyLoader] - private void load(OsuColour colours) - { - AddButton("Continue", colours.Green, () => OnResume?.Invoke()); - AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke()); - AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke()); - } - } - } -} diff --git a/osu.Game/Screens/Play/PauseOverlay.cs b/osu.Game/Screens/Play/PauseOverlay.cs new file mode 100644 index 0000000000..6cc6027a03 --- /dev/null +++ b/osu.Game/Screens/Play/PauseOverlay.cs @@ -0,0 +1,29 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using System.Linq; +using osu.Framework.Allocation; +using osu.Game.Graphics; +using osuTK.Graphics; + +namespace osu.Game.Screens.Play +{ + public class PauseOverlay : GameplayMenuOverlay + { + public Action OnResume; + + public override string Header => "paused"; + public override string Description => "you're not going to do what i think you're going to do, are ya?"; + + protected override Action BackAction => () => InternalButtons.Children.First().Click(); + + [BackgroundDependencyLoader] + private void load(OsuColour colours) + { + AddButton("Continue", colours.Green, () => OnResume?.Invoke()); + AddButton("Retry", colours.YellowDark, () => OnRetry?.Invoke()); + AddButton("Quit", new Color4(170, 27, 39, 255), () => OnQuit?.Invoke()); + } + } +} diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 0e8bedefb0..018ff900ee 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.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 System; @@ -56,8 +56,6 @@ namespace osu.Game.Screens.Play [Resolved] private ScoreManager scoreManager { get; set; } - protected PausableGameplayContainer PausableGameplayContainer { get; private set; } - private RulesetInfo ruleset; private IAPIProvider api; @@ -68,7 +66,6 @@ namespace osu.Game.Screens.Play protected RulesetContainer RulesetContainer { get; private set; } protected HUDOverlay HUDOverlay { get; private set; } - private FailOverlay failOverlay; #region Storyboard @@ -127,57 +124,47 @@ namespace osu.Game.Screens.Play InternalChild = GameplayClockContainer = new GameplayClockContainer(working, AllowLeadIn, RulesetContainer.GameplayStartTime); - GameplayClockContainer.Children = new Drawable[] + GameplayClockContainer.Children = new[] { - PausableGameplayContainer = new PausableGameplayContainer + StoryboardContainer = CreateStoryboardContainer(), + new ScalingContainer(ScalingMode.Gameplay) { - Retries = RestartCount, - OnRetry = restart, - OnQuit = performUserRequestedExit, - RequestResume = completion => + Child = new LocalSkinOverrideContainer(working.Skin) { - GameplayClockContainer.Start(); - completion(); - }, - RequestPause = GameplayClockContainer.Stop, - IsPaused = { BindTarget = GameplayClockContainer.IsPaused }, - CheckCanPause = () => CanPause, - Children = new[] - { - StoryboardContainer = CreateStoryboardContainer(), - new ScalingContainer(ScalingMode.Gameplay) - { - Child = new LocalSkinOverrideContainer(working.Skin) - { - RelativeSizeAxes = Axes.Both, - Child = RulesetContainer - } - }, - new BreakOverlay(working.Beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Breaks = working.Beatmap.Breaks - }, - // display the cursor above some HUD elements. - RulesetContainer.Cursor?.CreateProxy() ?? new Container(), - HUDOverlay = new HUDOverlay(ScoreProcessor, RulesetContainer, working) - { - HoldToQuit = { Action = performUserRequestedExit }, - PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = GameplayClockContainer.UserPlaybackRate } } }, - KeyCounter = { Visible = { BindTarget = RulesetContainer.HasReplayLoaded } }, - RequestSeek = GameplayClockContainer.Seek, - Anchor = Anchor.Centre, - Origin = Anchor.Centre - }, - new SkipOverlay(RulesetContainer.GameplayStartTime) - { - RequestSeek = GameplayClockContainer.Seek - }, + RelativeSizeAxes = Axes.Both, + Child = RulesetContainer } }, - failOverlay = new FailOverlay + new BreakOverlay(working.Beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor) { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Breaks = working.Beatmap.Breaks + }, + // display the cursor above some HUD elements. + RulesetContainer.Cursor?.CreateProxy() ?? new Container(), + HUDOverlay = new HUDOverlay(ScoreProcessor, RulesetContainer, working) + { + HoldToQuit = { Action = performUserRequestedExit }, + PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = GameplayClockContainer.UserPlaybackRate } } }, + KeyCounter = { Visible = { BindTarget = RulesetContainer.HasReplayLoaded } }, + RequestSeek = GameplayClockContainer.Seek, + Anchor = Anchor.Centre, + Origin = Anchor.Centre + }, + new SkipOverlay(RulesetContainer.GameplayStartTime) + { + RequestSeek = GameplayClockContainer.Seek + }, + FailOverlay = new FailOverlay + { + OnRetry = restart, + OnQuit = performUserRequestedExit, + }, + PauseOverlay = new PauseOverlay + { + OnResume = Resume, + Retries = RestartCount, OnRetry = restart, OnQuit = performUserRequestedExit, }, @@ -197,7 +184,7 @@ namespace osu.Game.Screens.Play RulesetContainer.IsPaused.BindTo(GameplayClockContainer.IsPaused); // load storyboard as part of player's load if we can - initializeStoryboard(false); + initializeStoryboard(false); // Bind ScoreProcessor to ourselves ScoreProcessor.AllJudged += onCompletion; @@ -313,6 +300,14 @@ namespace osu.Game.Screens.Play return score; } + protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !GameplayClockContainer.IsPaused.Value; + + protected virtual Results CreateResults(ScoreInfo score) => new SoloResults(score); + + #region Fail Logic + + protected FailOverlay FailOverlay { get; private set; } + private bool onFail() { if (Beatmap.Value.Mods.Value.OfType().Any(m => !m.AllowFail)) @@ -321,11 +316,87 @@ namespace osu.Game.Screens.Play GameplayClockContainer.Stop(); HasFailed = true; - failOverlay.Retries = RestartCount; - failOverlay.Show(); + + // There is a chance that we could be in a paused state as the ruleset's internal clock (see FrameStabilityContainer) + // could process an extra frame after the GameplayClock is stopped. + // In such cases we want the fail state to precede a user triggered pause. + if (PauseOverlay.State == Visibility.Visible) + PauseOverlay.Hide(); + + FailOverlay.Retries = RestartCount; + FailOverlay.Show(); return true; } + #endregion + + #region Pause Logic + + public bool IsResuming { get; private set; } + + /// + /// The amount of gameplay time after which a second pause is allowed. + /// + private const double pause_cooldown = 1000; + + protected PauseOverlay PauseOverlay { get; private set; } + + private double? lastPauseActionTime; + + private bool canPause => + // must pass basic screen conditions (beatmap loaded, instance allows pause) + LoadedBeatmapSuccessfully && AllowPause && ValidForResume + // replays cannot be paused and exit immediately + && !RulesetContainer.HasReplayLoaded.Value + // cannot pause if we are already in a fail state + && !HasFailed + // cannot pause if already paused (and not in the process of resuming) + && (GameplayClockContainer.IsPaused.Value == false || IsResuming) + // cannot pause too soon after previous pause + && (!lastPauseActionTime.HasValue || GameplayClockContainer.GameplayClock.CurrentTime >= lastPauseActionTime + pause_cooldown); + + private bool canResume => + // cannot resume from a non-paused state + GameplayClockContainer.IsPaused.Value + // cannot resume if we are already in a fail state + && !HasFailed + // already resuming + && !IsResuming; + + protected override void Update() + { + base.Update(); + + // eagerly pause when we lose window focus (if we are locally playing). + if (!Game.IsActive.Value) + Pause(); + } + + public void Pause() + { + if (!canPause) return; + + GameplayClockContainer.Stop(); + PauseOverlay.Show(); + lastPauseActionTime = GameplayClockContainer.GameplayClock.CurrentTime; + } + + public void Resume() + { + if (!canResume) return; + + //todo: add resume request support to ruleset + IsResuming = true; + + GameplayClockContainer.Start(); + PauseOverlay.Hide(); + IsResuming = false; + } + + #endregion + + #region Screen Logic + public override void OnEntering(IScreen last) { base.OnEntering(last); @@ -350,9 +421,7 @@ namespace osu.Game.Screens.Play storyboardReplacesBackground.Value = Beatmap.Value.Storyboard.ReplacesBackground && Beatmap.Value.Storyboard.HasDrawable; GameplayClockContainer.Restart(); - - PausableGameplayContainer.Alpha = 0; - PausableGameplayContainer.FadeIn(750, Easing.OutQuint); + GameplayClockContainer.FadeInFromZero(750, Easing.OutQuint); } public override void OnSuspending(IScreen next) @@ -361,9 +430,6 @@ namespace osu.Game.Screens.Play base.OnSuspending(next); } - public bool CanPause => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded.Value - && (PausableGameplayContainer?.IsPaused.Value == false || PausableGameplayContainer?.IsResuming == true); - public override bool OnExiting(IScreen next) { if (onCompletionEvent != null) @@ -373,9 +439,9 @@ namespace osu.Game.Screens.Play return true; } - if (LoadedBeatmapSuccessfully && CanPause) + if (LoadedBeatmapSuccessfully && canPause) { - PausableGameplayContainer?.Pause(); + Pause(); return true; } @@ -394,8 +460,6 @@ namespace osu.Game.Screens.Play storyboardReplacesBackground.Value = false; } - protected override bool OnScroll(ScrollEvent e) => mouseWheelDisabled.Value && !PausableGameplayContainer.IsPaused.Value; - - protected virtual Results CreateResults(ScoreInfo score) => new SoloResults(score); + #endregion } } From 9433a977479792bc35b470ca8720e446df69c8cf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Mar 2019 14:40:53 +0900 Subject: [PATCH 028/107] Add resume requesting support and fix exit scenarios --- osu.Game/Rulesets/UI/RulesetContainer.cs | 7 ++++++ osu.Game/Screens/Play/Player.cs | 27 ++++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index d8813631dc..c522118962 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -130,6 +130,13 @@ namespace osu.Game.Rulesets.UI /// The input manager. public abstract PassThroughInputManager CreateInputManager(); + /// + /// Invoked when the interactive user requests resuming from a paused state. + /// Allows potentially delaying the resume process until an interaction is performed. + /// + /// The action to run when resuming is to be completed. + public void RequestResume(Action continueResume) => continueResume(); + protected virtual ReplayInputHandler CreateReplayInputHandler(Replay replay) => null; protected FrameStabilityContainer FrameStabilityContainer; diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 018ff900ee..b53ed8ae17 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -352,8 +352,10 @@ namespace osu.Game.Screens.Play && !HasFailed // cannot pause if already paused (and not in the process of resuming) && (GameplayClockContainer.IsPaused.Value == false || IsResuming) - // cannot pause too soon after previous pause - && (!lastPauseActionTime.HasValue || GameplayClockContainer.GameplayClock.CurrentTime >= lastPauseActionTime + pause_cooldown); + && (!pauseCooldownActive || IsResuming); + + private bool pauseCooldownActive => + lastPauseActionTime.HasValue && GameplayClockContainer.GameplayClock.CurrentTime < lastPauseActionTime + pause_cooldown; private bool canResume => // cannot resume from a non-paused state @@ -376,6 +378,7 @@ namespace osu.Game.Screens.Play { if (!canPause) return; + IsResuming = false; GameplayClockContainer.Stop(); PauseOverlay.Show(); lastPauseActionTime = GameplayClockContainer.GameplayClock.CurrentTime; @@ -385,12 +388,20 @@ namespace osu.Game.Screens.Play { if (!canResume) return; - //todo: add resume request support to ruleset IsResuming = true; - - GameplayClockContainer.Start(); PauseOverlay.Hide(); - IsResuming = false; + + // time-based conditions may allow instant resume. + if (GameplayClockContainer.GameplayClock.CurrentTime < Beatmap.Value.Beatmap.HitObjects.First().StartTime) + completeResume(); + else + RulesetContainer.RequestResume(completeResume); + + void completeResume() + { + GameplayClockContainer.Start(); + IsResuming = false; + } } #endregion @@ -445,6 +456,10 @@ namespace osu.Game.Screens.Play return true; } + if (pauseCooldownActive && !GameplayClockContainer.IsPaused.Value) + // still want to block if we are within the cooldown period and not already paused. + return true; + GameplayClockContainer.ResetLocalAdjustments(); fadeOut(); From 4f075f4740b8592a5d1c1426ca13cf1054da042b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Mar 2019 14:57:06 +0900 Subject: [PATCH 029/107] Add more comprehensive testing --- osu.Game.Tests/Visual/TestCasePause.cs | 13 ++++++++++++- osu.Game/Screens/Play/Player.cs | 8 ++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePause.cs b/osu.Game.Tests/Visual/TestCasePause.cs index 622a12da81..f658dbee16 100644 --- a/osu.Game.Tests/Visual/TestCasePause.cs +++ b/osu.Game.Tests/Visual/TestCasePause.cs @@ -3,6 +3,7 @@ using System; using osu.Framework.Graphics.Containers; +using osu.Framework.Screens; using osu.Game.Rulesets; using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Scoring; @@ -26,7 +27,6 @@ namespace osu.Game.Tests.Visual PausePlayer pausable() => (PausePlayer)player(); base.AddCheckSteps(player); - //AddUntilStep(() => pausable().ScoreProcessor.TotalScore.Value > 0, "score above zero"); AddStep("pause", () => pausable().Pause()); AddAssert("clock stopped", () => !pausable().GameplayClockContainer.GameplayClock.IsRunning); @@ -47,6 +47,17 @@ namespace osu.Game.Tests.Visual AddAssert("pause overlay hidden", () => !pausable().PauseOverlayVisible); AddAssert("fail overlay still shown", () => pausable().FailOverlayVisible); + + AddStep("restart", () => pausable().Restart()); + + AddUntilStep(() => + { + pausable().Pause(); + return pausable().PauseOverlayVisible; + }, "keep trying to pause"); + + AddStep("exit", () => pausable().Exit()); + AddUntilStep(() => !pausable().IsCurrentScreen(), "player exited"); } private class PausePlayer : Player diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b53ed8ae17..162350e088 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -158,14 +158,14 @@ namespace osu.Game.Screens.Play }, FailOverlay = new FailOverlay { - OnRetry = restart, + OnRetry = Restart, OnQuit = performUserRequestedExit, }, PauseOverlay = new PauseOverlay { OnResume = Resume, Retries = RestartCount, - OnRetry = restart, + OnRetry = Restart, OnQuit = performUserRequestedExit, }, new HotkeyRetryOverlay @@ -175,7 +175,7 @@ namespace osu.Game.Screens.Play if (!this.IsCurrentScreen()) return; fadeOut(true); - restart(); + Restart(); }, } }; @@ -246,7 +246,7 @@ namespace osu.Game.Screens.Play this.Exit(); } - private void restart() + public void Restart() { if (!this.IsCurrentScreen()) return; From f56e8d9bfe26b9d7ca85111d6489f5d884985892 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 18 Mar 2019 19:44:21 +0900 Subject: [PATCH 030/107] Make tests better --- osu.Game.Tests/Visual/TestCasePause.cs | 95 +++++++++++++++----------- 1 file changed, 54 insertions(+), 41 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePause.cs b/osu.Game.Tests/Visual/TestCasePause.cs index f658dbee16..f53177e86a 100644 --- a/osu.Game.Tests/Visual/TestCasePause.cs +++ b/osu.Game.Tests/Visual/TestCasePause.cs @@ -1,7 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; +using NUnit.Framework; using osu.Framework.Graphics.Containers; using osu.Framework.Screens; using osu.Game.Rulesets; @@ -11,56 +11,69 @@ using osu.Game.Screens.Play; namespace osu.Game.Tests.Visual { - public class TestCasePause : TestCasePlayer + public class TestCasePause : PlayerTestCase { + protected new PausePlayer Player => (PausePlayer)base.Player; + public TestCasePause() : base(new OsuRuleset()) { } + [Test] + public void TestPauseResume() + { + AddStep("pause", () => Player.Pause()); + AddAssert("clock stopped", () => !Player.GameplayClockContainer.GameplayClock.IsRunning); + AddAssert("pause overlay shown", () => Player.PauseOverlayVisible); + + AddStep("resume", () => Player.Resume()); + AddAssert("pause overlay hidden", () => !Player.PauseOverlayVisible); + } + + [Test] + public void TestPauseTooSoon() + { + AddStep("pause", () => Player.Pause()); + AddAssert("clock stopped", () => !Player.GameplayClockContainer.GameplayClock.IsRunning); + AddStep("resume", () => Player.Resume()); + AddAssert("clock started", () => Player.GameplayClockContainer.GameplayClock.IsRunning); + AddStep("pause too soon", () => Player.Pause()); + AddAssert("clock not stopped", () => Player.GameplayClockContainer.GameplayClock.IsRunning); + AddAssert("pause overlay hidden", () => !Player.PauseOverlayVisible); + } + + [Test] + public void TestPauseAfterFail() + { + AddUntilStep(() => Player.HasFailed, "wait for fail"); + + AddAssert("fail overlay shown", () => Player.FailOverlayVisible); + + AddStep("try to pause", () => Player.Pause()); + + AddAssert("pause overlay hidden", () => !Player.PauseOverlayVisible); + AddAssert("fail overlay still shown", () => Player.FailOverlayVisible); + } + + [Test] + public void TestExitFromPause() + { + AddUntilStep(() => + { + Player.Pause(); + return Player.PauseOverlayVisible; + }, "keep trying to pause"); + + AddStep("exit", () => Player.Exit()); + AddUntilStep(() => !Player.IsCurrentScreen(), "player exited"); + } + protected override bool AllowFail => true; protected override Player CreatePlayer(Ruleset ruleset) => new PausePlayer(); - protected override void AddCheckSteps(Func player) - { - PausePlayer pausable() => (PausePlayer)player(); - - base.AddCheckSteps(player); - - AddStep("pause", () => pausable().Pause()); - AddAssert("clock stopped", () => !pausable().GameplayClockContainer.GameplayClock.IsRunning); - AddAssert("pause overlay shown", () => pausable().PauseOverlayVisible); - - AddStep("resume", () => pausable().Resume()); - AddAssert("pause overlay hidden", () => !pausable().PauseOverlayVisible); - - AddStep("pause too soon", () => pausable().Pause()); - AddAssert("clock not stopped", () => pausable().GameplayClockContainer.GameplayClock.IsRunning); - AddAssert("pause overlay hidden", () => !pausable().PauseOverlayVisible); - - AddUntilStep(() => pausable().HasFailed, "wait for fail"); - - AddAssert("fail overlay shown", () => pausable().FailOverlayVisible); - - AddStep("try to pause", () => pausable().Pause()); - - AddAssert("pause overlay hidden", () => !pausable().PauseOverlayVisible); - AddAssert("fail overlay still shown", () => pausable().FailOverlayVisible); - - AddStep("restart", () => pausable().Restart()); - - AddUntilStep(() => - { - pausable().Pause(); - return pausable().PauseOverlayVisible; - }, "keep trying to pause"); - - AddStep("exit", () => pausable().Exit()); - AddUntilStep(() => !pausable().IsCurrentScreen(), "player exited"); - } - - private class PausePlayer : Player + protected class PausePlayer : Player { public new GameplayClockContainer GameplayClockContainer => base.GameplayClockContainer; From 27a92e017c99f6963604c24e0d85d457e24ec1ff Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 19 Mar 2019 13:06:14 +0900 Subject: [PATCH 031/107] rename back to UserDimContainer --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 26 +++++++++---------- ...ttingsContainer.cs => UserDimContainer.cs} | 20 +++++++------- .../Backgrounds/BackgroundScreenBeatmap.cs | 4 +-- osu.Game/Screens/Play/Player.cs | 4 +-- 4 files changed, 27 insertions(+), 27 deletions(-) rename osu.Game/Graphics/Containers/{VisualSettingsContainer.cs => UserDimContainer.cs} (80%) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 2eb479b505..4549f1663d 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -43,7 +43,7 @@ namespace osu.Game.Tests.Visual typeof(ScreenWithBeatmapBackground), typeof(PlayerLoader), typeof(Player), - typeof(VisualSettingsContainer), + typeof(UserDimContainer), typeof(OsuScreen) }; @@ -165,7 +165,7 @@ namespace osu.Game.Tests.Visual } /// - /// Check if the is properly accepting user-defined visual changes at all. + /// Check if the is properly accepting user-defined visual changes at all. /// [Test] public void DisableUserDimTest() @@ -327,9 +327,9 @@ namespace osu.Game.Tests.Visual { protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value); - protected override VisualSettingsContainer CreateStoryboardContainer() + protected override UserDimContainer CreateStoryboardContainer() { - return new TestVisualSettingsContainer(true) + return new TestUserDimContainer(true) { RelativeSizeAxes = Axes.Both, Alpha = 1, @@ -339,7 +339,7 @@ namespace osu.Game.Tests.Visual public PausableGameplayContainer CurrentPausableGameplayContainer => PausableGameplayContainer; - public VisualSettingsContainer CurrentStoryboardContainer => StoryboardContainer; + public UserDimContainer CurrentStoryboardContainer => StoryboardContainer; // Whether or not the player should be allowed to load. public bool Ready; @@ -348,9 +348,9 @@ namespace osu.Game.Tests.Visual public readonly Bindable ReplacesBackground = new Bindable(); public readonly Bindable IsPaused = new Bindable(); - public bool IsStoryboardVisible() => ((TestVisualSettingsContainer)CurrentStoryboardContainer).CurrentAlpha == 1; + public bool IsStoryboardVisible() => ((TestUserDimContainer)CurrentStoryboardContainer).CurrentAlpha == 1; - public bool IsStoryboardInvisible() => ((TestVisualSettingsContainer)CurrentStoryboardContainer).CurrentAlpha <= 1; + public bool IsStoryboardInvisible() => ((TestUserDimContainer)CurrentStoryboardContainer).CurrentAlpha <= 1; [BackgroundDependencyLoader] private void load(OsuConfigManager config) @@ -396,7 +396,7 @@ namespace osu.Game.Tests.Visual private class FadeAccessibleBackground : BackgroundScreenBeatmap { - protected override VisualSettingsContainer CreateFadeContainer() => fadeContainer = new TestVisualSettingsContainer { RelativeSizeAxes = Axes.Both }; + protected override UserDimContainer CreateFadeContainer() => fadeContainer = new TestUserDimContainer { RelativeSizeAxes = Axes.Both }; public Color4 CurrentColour => fadeContainer.CurrentColour; @@ -404,7 +404,7 @@ namespace osu.Game.Tests.Visual public Vector2 CurrentBlur => Background.BlurSigma; - private TestVisualSettingsContainer fadeContainer; + private TestUserDimContainer fadeContainer; public FadeAccessibleBackground(WorkingBeatmap beatmap) : base(beatmap) @@ -412,12 +412,12 @@ namespace osu.Game.Tests.Visual } } - private class TestVisualSettingsContainer : VisualSettingsContainer + private class TestUserDimContainer : UserDimContainer { - public Color4 CurrentColour => LocalContainer.Colour; - public float CurrentAlpha => LocalContainer.Alpha; + public Color4 CurrentColour => DimContainer.Colour; + public float CurrentAlpha => DimContainer.Alpha; - public TestVisualSettingsContainer(bool isStoryboard = false) + public TestUserDimContainer(bool isStoryboard = false) : base(isStoryboard) { } diff --git a/osu.Game/Graphics/Containers/VisualSettingsContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs similarity index 80% rename from osu.Game/Graphics/Containers/VisualSettingsContainer.cs rename to osu.Game/Graphics/Containers/UserDimContainer.cs index 1ed4f0e23e..68c9c89226 100644 --- a/osu.Game/Graphics/Containers/VisualSettingsContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -16,7 +16,7 @@ namespace osu.Game.Graphics.Containers /// A container that applies user-configured visual settings to its contents. /// This container specifies behavior that applies to both Storyboards and Backgrounds. /// - public class VisualSettingsContainer : Container + public class UserDimContainer : Container { private const float background_fade_duration = 800; @@ -36,9 +36,9 @@ namespace osu.Game.Graphics.Containers /// public readonly Bindable StoryboardReplacesBackground = new Bindable(); - protected Container LocalContainer { get; } + protected Container DimContainer { get; } - protected override Container Content => LocalContainer; + protected override Container Content => DimContainer; private readonly bool isStoryboard; @@ -49,7 +49,7 @@ namespace osu.Game.Graphics.Containers : new Vector2(AddedBlur.Value); /// - /// Creates a new . + /// Creates a new . /// /// Whether or not this instance contains a storyboard. /// @@ -57,10 +57,10 @@ namespace osu.Game.Graphics.Containers /// and can cause backgrounds to become hidden via . Storyboards are also currently unable to be blurred. /// /// - public VisualSettingsContainer(bool isStoryboard = false) + public UserDimContainer(bool isStoryboard = false) { this.isStoryboard = isStoryboard; - AddInternal(LocalContainer = new Container { RelativeSizeAxes = Axes.Both }); + AddInternal(DimContainer = new Container { RelativeSizeAxes = Axes.Both }); } [BackgroundDependencyLoader] @@ -87,14 +87,14 @@ namespace osu.Game.Graphics.Containers { if (isStoryboard) { - LocalContainer.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 - LocalContainer.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); - foreach (Drawable c in LocalContainer) + foreach (Drawable c in DimContainer) { // Only blur if this container contains a background // We can't blur the container like we did with the dim because buffered containers add considerable draw overhead. @@ -103,7 +103,7 @@ namespace osu.Game.Graphics.Containers } } - LocalContainer.FadeColour(EnableVisualSettings.Value ? OsuColour.Gray(1 - (float)dimLevel.Value) : Color4.White, background_fade_duration, Easing.OutQuint); + DimContainer.FadeColour(EnableVisualSettings.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 3e3315d03a..901d1aa2e5 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -24,9 +24,9 @@ namespace osu.Game.Screens.Backgrounds public readonly Bindable AddedBlur = new Bindable(); - private readonly VisualSettingsContainer fadeContainer; + private readonly UserDimContainer fadeContainer; - protected virtual VisualSettingsContainer CreateFadeContainer() => new VisualSettingsContainer { RelativeSizeAxes = Axes.Both }; + 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 77f69eb80e..042711d820 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -71,9 +71,9 @@ namespace osu.Game.Screens.Play private FailOverlay failOverlay; private DrawableStoryboard storyboard; - protected VisualSettingsContainer StoryboardContainer { get; private set; } + protected UserDimContainer StoryboardContainer { get; private set; } - protected virtual VisualSettingsContainer CreateStoryboardContainer() => new VisualSettingsContainer(true) + protected virtual UserDimContainer CreateStoryboardContainer() => new UserDimContainer(true) { RelativeSizeAxes = Axes.Both, Alpha = 1, From df37973e842028b9bb834599343ab4ff151958f5 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 19 Mar 2019 13:13:19 +0900 Subject: [PATCH 032/107] Move showstoryboard into player --- osu.Game/Screens/Play/Player.cs | 7 +++++-- osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs | 8 -------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 042711d820..12977aaae3 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -73,6 +73,8 @@ namespace osu.Game.Screens.Play private DrawableStoryboard storyboard; protected UserDimContainer StoryboardContainer { get; private set; } + private Bindable showStoryboard; + protected virtual UserDimContainer CreateStoryboardContainer() => new UserDimContainer(true) { RelativeSizeAxes = Axes.Both, @@ -97,6 +99,7 @@ namespace osu.Game.Screens.Play sampleRestart = audio.Sample.Get(@"Gameplay/restart"); mouseWheelDisabled = config.GetBindable(OsuSetting.MouseDisableWheel); + showStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); ScoreProcessor = RulesetContainer.CreateScoreProcessor(); if (!ScoreProcessor.Mode.Disabled) @@ -169,7 +172,7 @@ namespace osu.Game.Screens.Play // bind clock into components that require it RulesetContainer.IsPaused.BindTo(gameplayClockContainer.IsPaused); - if (ShowStoryboard.Value) + if (showStoryboard.Value) initializeStoryboard(false); // Bind ScoreProcessor to ourselves @@ -313,7 +316,7 @@ namespace osu.Game.Screens.Play .Delay(250) .FadeIn(250); - ShowStoryboard.ValueChanged += enabled => + showStoryboard.ValueChanged += enabled => { if (enabled.NewValue) initializeStoryboard(true); }; diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 174e39f3cb..9eda1be818 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -13,13 +13,5 @@ namespace osu.Game.Screens.Play protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value); protected new BackgroundScreenBeatmap Background => (BackgroundScreenBeatmap)base.Background; - - protected Bindable ShowStoryboard; - - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - ShowStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); - } } } From dc26e90a8dad211abce21888944145f9b8add92a Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 19 Mar 2019 13:16:06 +0900 Subject: [PATCH 033/107] Remove unused usings --- osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs index 9eda1be818..d7d2c97598 100644 --- a/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs +++ b/osu.Game/Screens/Play/ScreenWithBeatmapBackground.cs @@ -1,9 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Framework.Allocation; -using osu.Framework.Bindables; -using osu.Game.Configuration; using osu.Game.Screens.Backgrounds; namespace osu.Game.Screens.Play From 025a2661126a66335d0702a6b5bc5073182b48cf Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Mar 2019 17:02:03 +0900 Subject: [PATCH 034/107] 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 c56d50ae15..c02207702c 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 fedc20397d..2633da77b3 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From a8e20722866540391a71400e44e16bdae3ea24c3 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 19 Mar 2019 20:15:28 +0900 Subject: [PATCH 035/107] Make blurtarget private, improve documentation --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 2 +- .../Graphics/Containers/UserDimContainer.cs | 38 +++++++++++-------- .../Backgrounds/BackgroundScreenBeatmap.cs | 5 +-- osu.Game/Screens/Play/Player.cs | 2 +- 4 files changed, 26 insertions(+), 21 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 4549f1663d..756f16abc2 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -333,7 +333,7 @@ namespace osu.Game.Tests.Visual { RelativeSizeAxes = Axes.Both, Alpha = 1, - EnableVisualSettings = { Value = true } + EnableUserDim = { Value = true } }; } diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index 68c9c89226..3593394495 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -20,31 +20,37 @@ namespace osu.Game.Graphics.Containers { private const float background_fade_duration = 800; - private Bindable dimLevel { get; set; } - - private Bindable blurLevel { get; set; } - - private Bindable showStoryboard { get; set; } - /// /// Whether or not user-configured dim levels should be applied to the container. /// - public readonly Bindable EnableVisualSettings = new Bindable(); + public readonly Bindable EnableUserDim = new Bindable(); /// /// Whether or not the storyboard loaded should completely hide the background behind it. /// public readonly Bindable StoryboardReplacesBackground = new Bindable(); + /// + /// The amount of blur to be applied to the background in addition to user-specified blur. + /// + /// + /// Used in contexts where there can potentially be both user and screen-specified blurring occuring at the same time, such as in + /// + public Bindable AddedBlur = new Bindable(); + + private Bindable dimLevel { get; set; } + + private Bindable blurLevel { get; set; } + + private Bindable showStoryboard { get; set; } + protected Container DimContainer { get; } protected override Container Content => DimContainer; private readonly bool isStoryboard; - public Bindable AddedBlur = new Bindable(); - - public Vector2 BlurTarget => EnableVisualSettings.Value + private Vector2 blurTarget => EnableUserDim.Value ? new Vector2(AddedBlur.Value + (float)blurLevel.Value * 25) : new Vector2(AddedBlur.Value); @@ -69,7 +75,7 @@ namespace osu.Game.Graphics.Containers dimLevel = config.GetBindable(OsuSetting.DimLevel); blurLevel = config.GetBindable(OsuSetting.BlurLevel); showStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); - EnableVisualSettings.ValueChanged += _ => UpdateVisuals(); + EnableUserDim.ValueChanged += _ => UpdateVisuals(); dimLevel.ValueChanged += _ => UpdateVisuals(); blurLevel.ValueChanged += _ => UpdateVisuals(); showStoryboard.ValueChanged += _ => UpdateVisuals(); @@ -83,7 +89,7 @@ namespace osu.Game.Graphics.Containers UpdateVisuals(); } - public void UpdateVisuals() + public void UpdateVisuals(bool instant = false) { if (isStoryboard) { @@ -97,13 +103,13 @@ namespace osu.Game.Graphics.Containers foreach (Drawable c in DimContainer) { // Only blur if this container contains a background - // We can't blur the container like we did with the dim because buffered containers add considerable draw overhead. - // As a result, this blurs the background directly. - ((Background)c)?.BlurTo(BlurTarget, background_fade_duration, Easing.OutQuint); + // We can't blur the container like we did with the dim because buffered containers add considerable draw overhead. As a result, this blurs the background directly. + // We need to support instant blurring here in the case of SongSelect, where blurring shouldn't be from 0 every time the beatmap is changed. + ((Background)c)?.BlurTo(blurTarget, instant ? 0 : background_fade_duration, Easing.OutQuint); } } - DimContainer.FadeColour(EnableVisualSettings.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/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 901d1aa2e5..1baa711f86 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -53,8 +53,7 @@ namespace osu.Game.Screens.Backgrounds b.Depth = newDepth; fadeContainer.Add(Background = b); - fadeContainer.UpdateVisuals(); - Background.BlurSigma = fadeContainer.BlurTarget; + fadeContainer.UpdateVisuals(true); StoryboardReplacesBackground.BindTo(fadeContainer.StoryboardReplacesBackground); })); }); @@ -65,7 +64,7 @@ namespace osu.Game.Screens.Backgrounds { Beatmap = beatmap; InternalChild = fadeContainer = CreateFadeContainer(); - fadeContainer.EnableVisualSettings.BindTo(EnableVisualSettings); + fadeContainer.EnableUserDim.BindTo(EnableVisualSettings); fadeContainer.AddedBlur.BindTo(AddedBlur); } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 12977aaae3..fc24e55de2 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -79,7 +79,7 @@ namespace osu.Game.Screens.Play { RelativeSizeAxes = Axes.Both, Alpha = 1, - EnableVisualSettings = { Value = true } + EnableUserDim = { Value = true } }; public bool LoadedBeatmapSuccessfully => RulesetContainer?.Objects.Any() == true; From 68f28326a235438c987ba7141879cecfbcddd28b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Mar 2019 20:21:31 +0900 Subject: [PATCH 036/107] Refactor RulesetContainer for readability --- .../UI/CatchRulesetContainer.cs | 2 +- .../UI/ManiaRulesetContainer.cs | 2 +- .../UI/OsuRulesetContainer.cs | 2 +- .../UI/TaikoRulesetContainer.cs | 2 +- osu.Game/Rulesets/UI/RulesetContainer.cs | 313 +++++++++--------- osu.Game/Screens/Play/HUDOverlay.cs | 2 +- 6 files changed, 157 insertions(+), 166 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs b/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs index f421969449..8ee8ec258e 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs +++ b/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs @@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Catch.UI protected override Playfield CreatePlayfield() => new CatchPlayfield(Beatmap.BeatmapInfo.BaseDifficulty, GetVisualRepresentation); - public override PassThroughInputManager CreateInputManager() => new CatchInputManager(Ruleset.RulesetInfo); + protected override PassThroughInputManager CreateInputManager() => new CatchInputManager(Ruleset.RulesetInfo); public override DrawableHitObject GetVisualRepresentation(CatchHitObject h) { diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs index d8b7dc0381..03e262df5d 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs @@ -97,7 +97,7 @@ namespace osu.Game.Rulesets.Mania.UI public override int Variant => (int)(Beatmap.Stages.Count == 1 ? PlayfieldType.Single : PlayfieldType.Dual) + Beatmap.TotalColumns; - public override PassThroughInputManager CreateInputManager() => new ManiaInputManager(Ruleset.RulesetInfo, Variant); + protected override PassThroughInputManager CreateInputManager() => new ManiaInputManager(Ruleset.RulesetInfo, Variant); public override DrawableHitObject GetVisualRepresentation(ManiaHitObject h) { diff --git a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs index 81482a9a01..88f7155b47 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs @@ -30,7 +30,7 @@ namespace osu.Game.Rulesets.Osu.UI protected override Playfield CreatePlayfield() => new OsuPlayfield(); - public override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo); + protected override PassThroughInputManager CreateInputManager() => new OsuInputManager(Ruleset.RulesetInfo); public override DrawableHitObject GetVisualRepresentation(OsuHitObject h) { diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs index 7a73f4bd2a..40e147df2c 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs @@ -81,7 +81,7 @@ namespace osu.Game.Rulesets.Taiko.UI public override ScoreProcessor CreateScoreProcessor() => new TaikoScoreProcessor(this); - public override PassThroughInputManager CreateInputManager() => new TaikoInputManager(Ruleset.RulesetInfo); + protected override PassThroughInputManager CreateInputManager() => new TaikoInputManager(Ruleset.RulesetInfo); protected override Playfield CreatePlayfield() => new TaikoPlayfield(Beatmap.ControlPointInfo); diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/RulesetContainer.cs index d8813631dc..960e05f669 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/RulesetContainer.cs @@ -25,44 +25,32 @@ using osu.Game.Replays; using osu.Game.Rulesets.Configuration; using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; +using osu.Game.Screens.Play; namespace osu.Game.Rulesets.UI { /// - /// Base RulesetContainer. Doesn't hold objects. + /// RulesetContainer that applies conversion to Beatmaps. Does not contain a Playfield + /// and does not load drawable hit objects. /// - /// Should not be derived - derive instead. + /// Should not be derived - derive instead. /// /// - public abstract class RulesetContainer : Container, IProvideCursor + /// The type of HitObject contained by this RulesetContainer. + public abstract class RulesetContainer : RulesetContainer, IProvideCursor, ICanAttachKeyCounter + where TObject : HitObject { /// /// The selected variant. /// public virtual int Variant => 0; - /// - /// The input manager for this RulesetContainer. - /// - internal IHasReplayHandler ReplayInputManager => KeyBindingInputManager as IHasReplayHandler; - /// /// The key conversion input manager for this RulesetContainer. /// public PassThroughInputManager KeyBindingInputManager; - /// - /// Whether a replay is currently loaded. - /// - public readonly BindableBool HasReplayLoaded = new BindableBool(); - - public abstract IEnumerable Objects { get; } - - /// - /// The point in time at which gameplay starts, including any required lead-in for display purposes. - /// Defaults to two seconds before the first . Override as necessary. - /// - public virtual double GameplayStartTime => Objects.First().StartTime - 2000; + public override double GameplayStartTime => Objects.First().StartTime - 2000; private readonly Lazy playfield; @@ -76,25 +64,34 @@ namespace osu.Game.Rulesets.UI /// public Container Overlays { get; protected set; } - public CursorContainer Cursor => Playfield.Cursor; + public override CursorContainer Cursor => Playfield.Cursor; public bool ProvidingUserCursor => Playfield.Cursor != null && !HasReplayLoaded.Value; protected override bool OnHover(HoverEvent e) => true; // required for IProvideCursor - public readonly Ruleset Ruleset; - protected IRulesetConfigManager Config { get; private set; } private OnScreenDisplay onScreenDisplay; /// - /// A visual representation of a . + /// Creates a ruleset visualisation for the provided ruleset and beatmap. /// /// The ruleset being repesented. - protected RulesetContainer(Ruleset ruleset) + /// The beatmap to create the hit renderer for. + protected RulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap) + : base(ruleset) { - Ruleset = ruleset; + Debug.Assert(workingBeatmap != null, "RulesetContainer initialized with a null beatmap."); + + RelativeSizeAxes = Axes.Both; + + Beatmap = (Beatmap)workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo); + + mods = workingBeatmap.Mods.Value; + applyBeatmapMods(mods); + + KeyBindingInputManager = CreateInputManager(); playfield = new Lazy(CreatePlayfield); IsPaused.ValueChanged += paused => @@ -106,6 +103,63 @@ namespace osu.Game.Rulesets.UI }; } + public override void SetReplayScore(Score replayScore) + { + if (!(KeyBindingInputManager is IHasReplayHandler replayInputManager)) + throw new InvalidOperationException($"A {nameof(KeyBindingInputManager)} which supports replay loading is not available"); + + var handler = (ReplayScore = replayScore) != null ? CreateReplayInputHandler(replayScore.Replay) : null; + + replayInputManager.ReplayInputHandler = handler; + frameStabilityContainer.ReplayInputHandler = handler; + + HasReplayLoaded.Value = replayInputManager.ReplayInputHandler != null; + + if (replayInputManager.ReplayInputHandler != null) + replayInputManager.ReplayInputHandler.GamefieldToScreenSpace = Playfield.GamefieldToScreenSpace; + } + + /// + /// Creates and adds drawable representations of hit objects to the play field. + /// + private void loadObjects() + { + foreach (TObject h in Beatmap.HitObjects) + addRepresentation(h); + + Playfield.PostProcess(); + + foreach (var mod in mods.OfType()) + mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects); + } + + /// + /// Creates and adds the visual representation of a to this . + /// + /// The to add the visual representation for. + private void addRepresentation(TObject hitObject) + { + var drawableObject = GetVisualRepresentation(hitObject); + + if (drawableObject == null) + return; + + drawableObject.OnNewResult += (_, r) => OnNewResult?.Invoke(r); + drawableObject.OnRevertResult += (_, r) => OnRevertResult?.Invoke(r); + + Playfield.Add(drawableObject); + } + + /// + /// Creates a DrawableHitObject from a HitObject. + /// + /// The HitObject to make drawable. + /// The DrawableHitObject. + public abstract DrawableHitObject GetVisualRepresentation(TObject h); + + public void Attach(KeyCounterCollection keyCounter) => + (KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(keyCounter); + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); @@ -122,48 +176,15 @@ namespace osu.Game.Rulesets.UI return dependencies; } - public abstract ScoreProcessor CreateScoreProcessor(); - /// /// Creates a key conversion input manager. An exception will be thrown if a valid is not returned. /// /// The input manager. - public abstract PassThroughInputManager CreateInputManager(); + protected abstract PassThroughInputManager CreateInputManager(); protected virtual ReplayInputHandler CreateReplayInputHandler(Replay replay) => null; - protected FrameStabilityContainer FrameStabilityContainer; - - public Score ReplayScore { get; private set; } - - /// - /// Whether the game is paused. Used to block user input. - /// - public readonly BindableBool IsPaused = new BindableBool(); - - /// - /// Sets a replay to be used, overriding local input. - /// - /// The replay, null for local input. - public virtual void SetReplayScore(Score replayScore) - { - if (ReplayInputManager == null) - throw new InvalidOperationException($"A {nameof(KeyBindingInputManager)} which supports replay loading is not available"); - - ReplayScore = replayScore; - - var handler = replayScore != null ? CreateReplayInputHandler(replayScore.Replay) : null; - - ReplayInputManager.ReplayInputHandler = handler; - FrameStabilityContainer.ReplayInputHandler = handler; - - HasReplayLoaded.Value = ReplayInputManager.ReplayInputHandler != null; - } - - /// - /// Creates the cursor. May be null if the doesn't provide a custom cursor. - /// - protected virtual CursorContainer CreateCursor() => null; + private FrameStabilityContainer frameStabilityContainer; /// /// Creates a Playfield. @@ -171,29 +192,6 @@ namespace osu.Game.Rulesets.UI /// The Playfield. protected abstract Playfield CreatePlayfield(); - protected override void Dispose(bool isDisposing) - { - base.Dispose(isDisposing); - - if (Config != null) - { - onScreenDisplay?.StopTracking(this, Config); - Config = null; - } - } - } - - /// - /// RulesetContainer that applies conversion to Beatmaps. Does not contain a Playfield - /// and does not load drawable hit objects. - /// - /// Should not be derived - derive instead. - /// - /// - /// The type of HitObject contained by this RulesetContainer. - public abstract class RulesetContainer : RulesetContainer - where TObject : HitObject - { /// /// Invoked when a has been applied by a . /// @@ -205,69 +203,30 @@ namespace osu.Game.Rulesets.UI public event Action OnRevertResult; /// - /// The Beatmap + /// The beatmap. /// public Beatmap Beatmap; - /// - /// All the converted hit objects contained by this hit renderer. - /// public override IEnumerable Objects => Beatmap.HitObjects; /// /// The mods which are to be applied. /// - protected IEnumerable Mods; - - /// - /// The this was created with. - /// - protected readonly WorkingBeatmap WorkingBeatmap; + private readonly IEnumerable mods; public override ScoreProcessor CreateScoreProcessor() => new ScoreProcessor(this); - protected override Container Content => content; - private Container content; - - /// - /// Whether to assume the beatmap passed into this is for the current ruleset. - /// Creates a hit renderer for a beatmap. - /// - /// The ruleset being repesented. - /// The beatmap to create the hit renderer for. - protected RulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap) - : base(ruleset) - { - Debug.Assert(workingBeatmap != null, "RulesetContainer initialized with a null beatmap."); - - WorkingBeatmap = workingBeatmap; - // ReSharper disable once PossibleNullReferenceException - Mods = workingBeatmap.Mods.Value; - - RelativeSizeAxes = Axes.Both; - - Beatmap = (Beatmap)workingBeatmap.GetPlayableBeatmap(ruleset.RulesetInfo); - - KeyBindingInputManager = CreateInputManager(); - - applyBeatmapMods(Mods); - } - [BackgroundDependencyLoader] private void load(OsuConfigManager config) { KeyBindingInputManager.AddRange(new Drawable[] { - content = new Container - { - RelativeSizeAxes = Axes.Both, - }, Playfield }); InternalChildren = new Drawable[] { - FrameStabilityContainer = new FrameStabilityContainer + frameStabilityContainer = new FrameStabilityContainer { Child = KeyBindingInputManager, }, @@ -275,7 +234,7 @@ namespace osu.Game.Rulesets.UI }; // Apply mods - applyRulesetMods(Mods, config); + applyRulesetMods(mods, config); loadObjects(); } @@ -309,51 +268,83 @@ namespace osu.Game.Rulesets.UI mod.ReadFromConfig(config); } - public override void SetReplayScore(Score replayScore) + protected override void Dispose(bool isDisposing) { - base.SetReplayScore(replayScore); + base.Dispose(isDisposing); - if (ReplayInputManager?.ReplayInputHandler != null) - ReplayInputManager.ReplayInputHandler.GamefieldToScreenSpace = Playfield.GamefieldToScreenSpace; + if (Config != null) + { + onScreenDisplay?.StopTracking(this, Config); + Config = null; + } + } + } + + /// + /// Base RulesetContainer. Doesn't hold objects. + /// + /// Should not be derived - derive instead. + /// + /// + public abstract class RulesetContainer : CompositeDrawable + { + /// + /// Whether a replay is currently loaded. + /// + public readonly BindableBool HasReplayLoaded = new BindableBool(); + + /// + /// Whether the game is paused. Used to block user input. + /// + public readonly BindableBool IsPaused = new BindableBool(); + + /// + /// The associated ruleset. + /// + public readonly Ruleset Ruleset; + + /// + /// Creates a ruleset visualisation for the provided ruleset. + /// + /// The ruleset. + protected RulesetContainer(Ruleset ruleset) + { + Ruleset = ruleset; } /// - /// Creates and adds drawable representations of hit objects to the play field. + /// All the converted hit objects contained by this hit renderer. /// - private void loadObjects() - { - foreach (TObject h in Beatmap.HitObjects) - AddRepresentation(h); - - Playfield.PostProcess(); - - foreach (var mod in Mods.OfType()) - mod.ApplyToDrawableHitObjects(Playfield.HitObjectContainer.Objects); - } + public abstract IEnumerable Objects { get; } /// - /// Creates and adds the visual representation of a to this . + /// The point in time at which gameplay starts, including any required lead-in for display purposes. + /// Defaults to two seconds before the first . Override as necessary. /// - /// The to add the visual representation for. - internal void AddRepresentation(TObject hitObject) - { - var drawableObject = GetVisualRepresentation(hitObject); - - if (drawableObject == null) - return; - - drawableObject.OnNewResult += (_, r) => OnNewResult?.Invoke(r); - drawableObject.OnRevertResult += (_, r) => OnRevertResult?.Invoke(r); - - Playfield.Add(drawableObject); - } + public abstract double GameplayStartTime { get; } /// - /// Creates a DrawableHitObject from a HitObject. + /// The currently loaded replay. Usually null in the case of a local player. /// - /// The HitObject to make drawable. - /// The DrawableHitObject. - public abstract DrawableHitObject GetVisualRepresentation(TObject h); + public Score ReplayScore { get; protected set; } + + /// + /// The cursor being displayed by the . May be null if no cursor is provided. + /// + public abstract CursorContainer Cursor { get; } + + /// + /// Sets a replay to be used, overriding local input. + /// + /// The replay, null for local input. + public abstract void SetReplayScore(Score replayScore); + + /// + /// Create a for the associated ruleset and link with this + /// . + /// + /// A score processor. + public abstract ScoreProcessor CreateScoreProcessor(); } /// @@ -371,7 +362,7 @@ namespace osu.Game.Rulesets.UI protected new TPlayfield Playfield => (TPlayfield)base.Playfield; /// - /// Creates a hit renderer for a beatmap. + /// Creates a ruleset visualisation for the provided ruleset and beatmap. /// /// The ruleset being repesented. /// The beatmap to create the hit renderer for. diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 4fd0572c1a..1f6a72e726 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -145,7 +145,7 @@ namespace osu.Game.Screens.Play protected virtual void BindRulesetContainer(RulesetContainer rulesetContainer) { - (rulesetContainer.KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(KeyCounter); + (rulesetContainer as ICanAttachKeyCounter)?.Attach(KeyCounter); replayLoaded.BindTo(rulesetContainer.HasReplayLoaded); From 3af3baf5e61eca0475ddf5c085f0a7f9cbf82815 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Tue, 19 Mar 2019 20:22:21 +0900 Subject: [PATCH 037/107] Fix merge --- 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 8967e95782..263cfe0fc8 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -97,7 +97,7 @@ namespace osu.Game.Tests.Visual public void PlayerLoaderSettingsHoverTest() { setupUserSettings(); - AddStep("Start player loader", () => songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer()))); + AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer()))); AddUntilStep("Wait for Player Loader to load", () => playerLoader?.IsLoaded ?? false); AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent()); AddStep("Trigger background preview", () => @@ -205,7 +205,7 @@ namespace osu.Game.Tests.Visual performFullSetup(); var results = new FadeAccessibleResults(new ScoreInfo { User = new User { Username = "osu!" } }); AddStep("Transition to Results", () => player.Push(results)); - AddUntilStep(results.IsCurrentScreen, "Wait for results is current"); + AddUntilStep("Wait for results is current", results.IsCurrentScreen); waitForDim(); AddAssert("Screen is undimmed, original background retained", () => songSelect.IsBackgroundUndimmed() && songSelect.IsBackgroundCurrent() && results.IsBlurCorrect()); From baea7230bc581277d5d94302c7f0cc8f9ea925ab Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Mar 2019 23:44:15 +0900 Subject: [PATCH 038/107] Rename RulesetContainer to DrawableRuleset --- .../TestCaseBananaShower.cs | 2 +- osu.Game.Rulesets.Catch/CatchRuleset.cs | 2 +- .../Mods/CatchModFlashlight.cs | 6 +-- .../Scoring/CatchScoreProcessor.cs | 4 +- ...etContainer.cs => DrawableCatchRuleset.cs} | 4 +- ...ntainer.cs => DrawableManiaEditRuleset.cs} | 4 +- .../Edit/ManiaHitObjectComposer.cs | 14 +++---- osu.Game.Rulesets.Mania/ManiaRuleset.cs | 2 +- .../Scoring/ManiaScoreProcessor.cs | 4 +- ...etContainer.cs => DrawableManiaRuleset.cs} | 4 +- ...Container.cs => DrawableOsuEditRuleset.cs} | 4 +- .../Edit/OsuHitObjectComposer.cs | 4 +- osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs | 6 +-- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 6 +-- osu.Game.Rulesets.Osu/OsuRuleset.cs | 2 +- .../Scoring/OsuScoreProcessor.cs | 4 +- ...esetContainer.cs => DrawableOsuRuleset.cs} | 4 +- .../TestCaseTaikoPlayfield.cs | 32 +++++++------- .../Mods/TaikoModFlashlight.cs | 6 +-- .../Scoring/TaikoScoreProcessor.cs | 4 +- osu.Game.Rulesets.Taiko/TaikoRuleset.cs | 2 +- ...etContainer.cs => DrawableTaikoRuleset.cs} | 4 +- osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs | 2 +- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 2 +- osu.Game/Beatmaps/DummyWorkingBeatmap.cs | 2 +- .../Rulesets/Edit/EditRulesetContainer.cs | 32 +++++++------- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 32 +++++++------- .../Mods/IApplicableToRulesetContainer.cs | 10 ++--- osu.Game/Rulesets/Mods/ModAutoplay.cs | 4 +- osu.Game/Rulesets/Mods/ModFlashlight.cs | 8 ++-- osu.Game/Rulesets/Ruleset.cs | 2 +- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 10 ++--- ...RulesetContainer.cs => DrawableRuleset.cs} | 42 +++++++++---------- ...ntainer.cs => DrawableScrollingRuleset.cs} | 10 ++--- osu.Game/Screens/Edit/Editor.cs | 2 +- .../Screens/Multi/Components/ModeTypeInfo.cs | 10 ++--- osu.Game/Screens/Play/HUDOverlay.cs | 16 +++---- osu.Game/Screens/Play/Player.cs | 36 ++++++++-------- osu.Game/Screens/Play/ReplayPlayer.cs | 2 +- osu.Game/Screens/Play/SongProgress.cs | 4 +- 40 files changed, 175 insertions(+), 175 deletions(-) rename osu.Game.Rulesets.Catch/UI/{CatchRulesetContainer.cs => DrawableCatchRuleset.cs} (93%) rename osu.Game.Rulesets.Mania/Edit/{ManiaEditRulesetContainer.cs => DrawableManiaEditRuleset.cs} (83%) rename osu.Game.Rulesets.Mania/UI/{ManiaRulesetContainer.cs => DrawableManiaRuleset.cs} (96%) rename osu.Game.Rulesets.Osu/Edit/{OsuEditRulesetContainer.cs => DrawableOsuEditRuleset.cs} (82%) rename osu.Game.Rulesets.Osu/UI/{OsuRulesetContainer.cs => DrawableOsuRuleset.cs} (92%) rename osu.Game.Rulesets.Taiko/UI/{TaikoRulesetContainer.cs => DrawableTaikoRuleset.cs} (95%) rename osu.Game/Rulesets/UI/{RulesetContainer.cs => DrawableRuleset.cs} (89%) rename osu.Game/Rulesets/UI/Scrolling/{ScrollingRulesetContainer.cs => DrawableScrollingRuleset.cs} (92%) diff --git a/osu.Game.Rulesets.Catch.Tests/TestCaseBananaShower.cs b/osu.Game.Rulesets.Catch.Tests/TestCaseBananaShower.cs index 9e1c44ba40..83608f7e68 100644 --- a/osu.Game.Rulesets.Catch.Tests/TestCaseBananaShower.cs +++ b/osu.Game.Rulesets.Catch.Tests/TestCaseBananaShower.cs @@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Catch.Tests typeof(DrawableBananaShower), typeof(CatchRuleset), - typeof(CatchRulesetContainer), + typeof(DrawableCatchRuleset), }; public TestCaseBananaShower() diff --git a/osu.Game.Rulesets.Catch/CatchRuleset.cs b/osu.Game.Rulesets.Catch/CatchRuleset.cs index af8206d95a..5140135f80 100644 --- a/osu.Game.Rulesets.Catch/CatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/CatchRuleset.cs @@ -22,7 +22,7 @@ namespace osu.Game.Rulesets.Catch { public class CatchRuleset : Ruleset { - public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap) => new CatchRulesetContainer(this, beatmap); + public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap) => new DrawableCatchRuleset(this, beatmap); public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new CatchBeatmapConverter(beatmap); public override IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => new CatchBeatmapProcessor(beatmap); diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs index 82cda7df47..77f41affee 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs @@ -21,10 +21,10 @@ namespace osu.Game.Rulesets.Catch.Mods private CatchPlayfield playfield; - public override void ApplyToRulesetContainer(RulesetContainer rulesetContainer) + public override void ApplyToDrawableRuleset(DrawableRuleset rrawableRuleset) { - playfield = (CatchPlayfield)rulesetContainer.Playfield; - base.ApplyToRulesetContainer(rulesetContainer); + playfield = (CatchPlayfield)rrawableRuleset.Playfield; + base.ApplyToDrawableRuleset(rrawableRuleset); } private class CatchFlashlight : Flashlight diff --git a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs index e1fda1a7b3..05ee4fc52d 100644 --- a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs +++ b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs @@ -13,8 +13,8 @@ namespace osu.Game.Rulesets.Catch.Scoring { public class CatchScoreProcessor : ScoreProcessor { - public CatchScoreProcessor(RulesetContainer rulesetContainer) - : base(rulesetContainer) + public CatchScoreProcessor(DrawableRuleset rrawableRuleset) + : base(rrawableRuleset) { } diff --git a/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs b/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs similarity index 93% rename from osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs rename to osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs index 8ee8ec258e..63220e9379 100644 --- a/osu.Game.Rulesets.Catch/UI/CatchRulesetContainer.cs +++ b/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs @@ -17,13 +17,13 @@ using osu.Game.Rulesets.UI.Scrolling; namespace osu.Game.Rulesets.Catch.UI { - public class CatchRulesetContainer : ScrollingRulesetContainer + public class DrawableCatchRuleset : DrawableScrollingRuleset { protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Constant; protected override bool UserScrollSpeedAdjustment => false; - public CatchRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) + public DrawableCatchRuleset(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) { Direction.Value = ScrollingDirection.Down; diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs b/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditRuleset.cs similarity index 83% rename from osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs rename to osu.Game.Rulesets.Mania/Edit/DrawableManiaEditRuleset.cs index 89e531fd9f..acafaffee6 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/Edit/DrawableManiaEditRuleset.cs @@ -10,11 +10,11 @@ using osu.Game.Rulesets.UI.Scrolling; namespace osu.Game.Rulesets.Mania.Edit { - public class ManiaEditRulesetContainer : ManiaRulesetContainer + public class DrawableManiaEditRuleset : DrawableManiaRuleset { public new IScrollingInfo ScrollingInfo => base.ScrollingInfo; - public ManiaEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) + public DrawableManiaEditRuleset(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) { } diff --git a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs index 3dbbd132a6..56c9471462 100644 --- a/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs +++ b/osu.Game.Rulesets.Mania/Edit/ManiaHitObjectComposer.cs @@ -20,7 +20,7 @@ namespace osu.Game.Rulesets.Mania.Edit [Cached(Type = typeof(IManiaHitObjectComposer))] public class ManiaHitObjectComposer : HitObjectComposer, IManiaHitObjectComposer { - protected new ManiaEditRulesetContainer RulesetContainer { get; private set; } + protected new DrawableManiaEditRuleset DrawableRuleset { get; private set; } public ManiaHitObjectComposer(Ruleset ruleset) : base(ruleset) @@ -32,23 +32,23 @@ namespace osu.Game.Rulesets.Mania.Edit /// /// The screen-space position. /// The column which intersects with . - public Column ColumnAt(Vector2 screenSpacePosition) => RulesetContainer.GetColumnByPosition(screenSpacePosition); + public Column ColumnAt(Vector2 screenSpacePosition) => DrawableRuleset.GetColumnByPosition(screenSpacePosition); private DependencyContainer dependencies; protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) => dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); - public int TotalColumns => ((ManiaPlayfield)RulesetContainer.Playfield).TotalColumns; + public int TotalColumns => ((ManiaPlayfield)DrawableRuleset.Playfield).TotalColumns; - protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) + protected override DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap) { - RulesetContainer = new ManiaEditRulesetContainer(ruleset, beatmap); + DrawableRuleset = new DrawableManiaEditRuleset(ruleset, beatmap); // This is the earliest we can cache the scrolling info to ourselves, before masks are added to the hierarchy and inject it - dependencies.CacheAs(RulesetContainer.ScrollingInfo); + dependencies.CacheAs(DrawableRuleset.ScrollingInfo); - return RulesetContainer; + return DrawableRuleset; } protected override IReadOnlyList CompositionTools => new HitObjectCompositionTool[] diff --git a/osu.Game.Rulesets.Mania/ManiaRuleset.cs b/osu.Game.Rulesets.Mania/ManiaRuleset.cs index 2b6b7377ae..a4a10f1742 100644 --- a/osu.Game.Rulesets.Mania/ManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/ManiaRuleset.cs @@ -31,7 +31,7 @@ namespace osu.Game.Rulesets.Mania { public class ManiaRuleset : Ruleset { - public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap) => new ManiaRulesetContainer(this, beatmap); + public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap) => new DrawableManiaRuleset(this, beatmap); public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new ManiaBeatmapConverter(beatmap); public override PerformanceCalculator CreatePerformanceCalculator(WorkingBeatmap beatmap, ScoreInfo score) => new ManiaPerformanceCalculator(this, beatmap, score); diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index cf3d0734fb..018f257d8f 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -92,8 +92,8 @@ namespace osu.Game.Rulesets.Mania.Scoring { } - public ManiaScoreProcessor(RulesetContainer rulesetContainer) - : base(rulesetContainer) + public ManiaScoreProcessor(DrawableRuleset rrawableRuleset) + : base(rrawableRuleset) { } diff --git a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs similarity index 96% rename from osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs rename to osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs index 03e262df5d..5090dd491e 100644 --- a/osu.Game.Rulesets.Mania/UI/ManiaRulesetContainer.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs @@ -28,7 +28,7 @@ using osuTK; namespace osu.Game.Rulesets.Mania.UI { - public class ManiaRulesetContainer : ScrollingRulesetContainer + public class DrawableManiaRuleset : DrawableScrollingRuleset { public new ManiaBeatmap Beatmap => (ManiaBeatmap)base.Beatmap; @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Mania.UI private readonly Bindable configDirection = new Bindable(); - public ManiaRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) + public DrawableManiaRuleset(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) { // Generate the bar lines diff --git a/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs b/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditRuleset.cs similarity index 82% rename from osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs rename to osu.Game.Rulesets.Osu/Edit/DrawableOsuEditRuleset.cs index 7886a2393c..50b3eabcf4 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuEditRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditRuleset.cs @@ -8,9 +8,9 @@ using osuTK; namespace osu.Game.Rulesets.Osu.Edit { - public class OsuEditRulesetContainer : OsuRulesetContainer + public class DrawableOsuEditRuleset : DrawableOsuRuleset { - public OsuEditRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) + public DrawableOsuEditRuleset(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) { } diff --git a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs index 174321b8b9..dd3925e04f 100644 --- a/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs +++ b/osu.Game.Rulesets.Osu/Edit/OsuHitObjectComposer.cs @@ -26,8 +26,8 @@ namespace osu.Game.Rulesets.Osu.Edit { } - protected override RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) - => new OsuEditRulesetContainer(ruleset, beatmap); + protected override DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap) + => new DrawableOsuEditRuleset(ruleset, beatmap); protected override IReadOnlyList CompositionTools => new HitObjectCompositionTool[] { diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs b/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs index a203e23687..57536ec387 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs @@ -18,7 +18,7 @@ using osuTK.Graphics; namespace osu.Game.Rulesets.Osu.Mods { - public class OsuModBlinds : Mod, IApplicableToRulesetContainer, IApplicableToScoreProcessor + public class OsuModBlinds : Mod, IApplicableToDrawableRuleset, IApplicableToScoreProcessor { public override string Name => "Blinds"; public override string Description => "Play with blinds on your screen."; @@ -32,9 +32,9 @@ namespace osu.Game.Rulesets.Osu.Mods public override double ScoreMultiplier => 1.12; private DrawableOsuBlinds blinds; - public void ApplyToRulesetContainer(RulesetContainer rulesetContainer) + public void ApplyToDrawableRuleset(DrawableRuleset rrawableRuleset) { - rulesetContainer.Overlays.Add(blinds = new DrawableOsuBlinds(rulesetContainer.Playfield.HitObjectContainer, rulesetContainer.Beatmap)); + rrawableRuleset.Overlays.Add(blinds = new DrawableOsuBlinds(rrawableRuleset.Playfield.HitObjectContainer, rrawableRuleset.Beatmap)); } public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index efcab28310..a1c96fd44f 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -13,7 +13,7 @@ using static osu.Game.Input.Handlers.ReplayInputHandler; namespace osu.Game.Rulesets.Osu.Mods { - public class OsuModRelax : ModRelax, IApplicableFailOverride, IUpdatableByPlayfield, IApplicableToRulesetContainer + public class OsuModRelax : ModRelax, IApplicableFailOverride, IUpdatableByPlayfield, IApplicableToDrawableRuleset { public override string Description => @"You don't need to click. Give your clicking/tapping fingers a break from the heat of things."; public override Type[] IncompatibleMods => base.IncompatibleMods.Append(typeof(OsuModAutopilot)).ToArray(); @@ -79,10 +79,10 @@ namespace osu.Game.Rulesets.Osu.Mods state.Apply(osuInputManager.CurrentState, osuInputManager); } - public void ApplyToRulesetContainer(RulesetContainer rulesetContainer) + public void ApplyToDrawableRuleset(DrawableRuleset rrawableRuleset) { // grab the input manager for future use. - osuInputManager = (OsuInputManager)rulesetContainer.KeyBindingInputManager; + osuInputManager = (OsuInputManager)rrawableRuleset.KeyBindingInputManager; osuInputManager.AllowUserPresses = false; } } diff --git a/osu.Game.Rulesets.Osu/OsuRuleset.cs b/osu.Game.Rulesets.Osu/OsuRuleset.cs index d9c046a579..7d3aff7801 100644 --- a/osu.Game.Rulesets.Osu/OsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/OsuRuleset.cs @@ -29,7 +29,7 @@ namespace osu.Game.Rulesets.Osu { public class OsuRuleset : Ruleset { - public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap) => new OsuRulesetContainer(this, beatmap); + public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap) => new DrawableOsuRuleset(this, beatmap); public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new OsuBeatmapConverter(beatmap); public override IBeatmapProcessor CreateBeatmapProcessor(IBeatmap beatmap) => new OsuBeatmapProcessor(beatmap); diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index 4f97cc0da5..4186c515db 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -15,8 +15,8 @@ namespace osu.Game.Rulesets.Osu.Scoring { internal class OsuScoreProcessor : ScoreProcessor { - public OsuScoreProcessor(RulesetContainer rulesetContainer) - : base(rulesetContainer) + public OsuScoreProcessor(DrawableRuleset rrawableRuleset) + : base(rrawableRuleset) { } diff --git a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs b/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs similarity index 92% rename from osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs rename to osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs index 88f7155b47..d91ccdedd5 100644 --- a/osu.Game.Rulesets.Osu/UI/OsuRulesetContainer.cs +++ b/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs @@ -17,11 +17,11 @@ using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Osu.UI { - public class OsuRulesetContainer : RulesetContainer + public class DrawableOsuRuleset : DrawableRuleset { protected new OsuRulesetConfigManager Config => (OsuRulesetConfigManager)base.Config; - public OsuRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) + public DrawableOsuRuleset(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) { } diff --git a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs index 00e1b649d9..369cdd49d2 100644 --- a/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko.Tests/TestCaseTaikoPlayfield.cs @@ -33,7 +33,7 @@ namespace osu.Game.Rulesets.Taiko.Tests protected override double TimePerAction => default_duration * 2; private readonly Random rng = new Random(1337); - private TaikoRulesetContainer rulesetContainer; + private DrawableTaikoRuleset drawableRuleset; private Container playfieldContainer; [BackgroundDependencyLoader] @@ -86,7 +86,7 @@ namespace osu.Game.Rulesets.Taiko.Tests Origin = Anchor.Centre, RelativeSizeAxes = Axes.X, Height = 768, - Children = new[] { rulesetContainer = new TaikoRulesetContainer(new TaikoRuleset(), beatmap) } + Children = new[] { drawableRuleset = new DrawableTaikoRuleset(new TaikoRuleset(), beatmap) } }); } @@ -139,7 +139,7 @@ namespace osu.Game.Rulesets.Taiko.Tests var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) }; - ((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult }); + ((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult }); } private void addStrongHitJudgement(bool kiai) @@ -154,33 +154,33 @@ namespace osu.Game.Rulesets.Taiko.Tests var h = new DrawableTestHit(hit) { X = RNG.NextSingle(hitResult == HitResult.Good ? -0.1f : -0.05f, hitResult == HitResult.Good ? 0.1f : 0.05f) }; - ((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult }); - ((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(new TestStrongNestedHit(h), new JudgementResult(new TaikoStrongJudgement()) { Type = HitResult.Great }); + ((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(h, new JudgementResult(new TaikoJudgement()) { Type = hitResult }); + ((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new TestStrongNestedHit(h), new JudgementResult(new TaikoStrongJudgement()) { Type = HitResult.Great }); } private void addMissJudgement() { - ((TaikoPlayfield)rulesetContainer.Playfield).OnNewResult(new DrawableTestHit(new Hit()), new JudgementResult(new TaikoJudgement()) { Type = HitResult.Miss }); + ((TaikoPlayfield)drawableRuleset.Playfield).OnNewResult(new DrawableTestHit(new Hit()), new JudgementResult(new TaikoJudgement()) { Type = HitResult.Miss }); } private void addBarLine(bool major, double delay = scroll_time) { - BarLine bl = new BarLine { StartTime = rulesetContainer.Playfield.Time.Current + delay }; + BarLine bl = new BarLine { StartTime = drawableRuleset.Playfield.Time.Current + delay }; - rulesetContainer.Playfield.Add(major ? new DrawableBarLineMajor(bl) : new DrawableBarLine(bl)); + drawableRuleset.Playfield.Add(major ? new DrawableBarLineMajor(bl) : new DrawableBarLine(bl)); } private void addSwell(double duration = default_duration) { var swell = new Swell { - StartTime = rulesetContainer.Playfield.Time.Current + scroll_time, + StartTime = drawableRuleset.Playfield.Time.Current + scroll_time, Duration = duration, }; swell.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); - rulesetContainer.Playfield.Add(new DrawableSwell(swell)); + drawableRuleset.Playfield.Add(new DrawableSwell(swell)); } private void addDrumRoll(bool strong, double duration = default_duration) @@ -190,40 +190,40 @@ namespace osu.Game.Rulesets.Taiko.Tests var d = new DrumRoll { - StartTime = rulesetContainer.Playfield.Time.Current + scroll_time, + StartTime = drawableRuleset.Playfield.Time.Current + scroll_time, IsStrong = strong, Duration = duration, }; d.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); - rulesetContainer.Playfield.Add(new DrawableDrumRoll(d)); + drawableRuleset.Playfield.Add(new DrawableDrumRoll(d)); } private void addCentreHit(bool strong) { Hit h = new Hit { - StartTime = rulesetContainer.Playfield.Time.Current + scroll_time, + StartTime = drawableRuleset.Playfield.Time.Current + scroll_time, IsStrong = strong }; h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); - rulesetContainer.Playfield.Add(new DrawableCentreHit(h)); + drawableRuleset.Playfield.Add(new DrawableCentreHit(h)); } private void addRimHit(bool strong) { Hit h = new Hit { - StartTime = rulesetContainer.Playfield.Time.Current + scroll_time, + StartTime = drawableRuleset.Playfield.Time.Current + scroll_time, IsStrong = strong }; h.ApplyDefaults(new ControlPointInfo(), new BeatmapDifficulty()); - rulesetContainer.Playfield.Add(new DrawableRimHit(h)); + drawableRuleset.Playfield.Add(new DrawableRimHit(h)); } private class TestStrongNestedHit : DrawableStrongNestedHit diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs index b99ec57166..c6342f9c34 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs @@ -22,10 +22,10 @@ namespace osu.Game.Rulesets.Taiko.Mods private TaikoPlayfield playfield; - public override void ApplyToRulesetContainer(RulesetContainer rulesetContainer) + public override void ApplyToDrawableRuleset(DrawableRuleset rrawableRuleset) { - playfield = (TaikoPlayfield)rulesetContainer.Playfield; - base.ApplyToRulesetContainer(rulesetContainer); + playfield = (TaikoPlayfield)rrawableRuleset.Playfield; + base.ApplyToDrawableRuleset(rrawableRuleset); } private class TaikoFlashlight : Flashlight diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index 73cd9ba821..762e24326a 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -32,8 +32,8 @@ namespace osu.Game.Rulesets.Taiko.Scoring /// private double hpMissMultiplier; - public TaikoScoreProcessor(RulesetContainer rulesetContainer) - : base(rulesetContainer) + public TaikoScoreProcessor(DrawableRuleset rrawableRuleset) + : base(rrawableRuleset) { } diff --git a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs index 08a56488aa..3e94775eb6 100644 --- a/osu.Game.Rulesets.Taiko/TaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/TaikoRuleset.cs @@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Taiko { public class TaikoRuleset : Ruleset { - public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap) => new TaikoRulesetContainer(this, beatmap); + public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap) => new DrawableTaikoRuleset(this, beatmap); public override IBeatmapConverter CreateBeatmapConverter(IBeatmap beatmap) => new TaikoBeatmapConverter(beatmap); public override IEnumerable GetDefaultKeyBindings(int variant = 0) => new[] diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs similarity index 95% rename from osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs rename to osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs index 40e147df2c..54a54a54bd 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoRulesetContainer.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs @@ -20,13 +20,13 @@ using osu.Game.Rulesets.UI.Scrolling; namespace osu.Game.Rulesets.Taiko.UI { - public class TaikoRulesetContainer : ScrollingRulesetContainer + public class DrawableTaikoRuleset : DrawableScrollingRuleset { protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Overlapping; protected override bool UserScrollSpeedAdjustment => false; - public TaikoRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) + public DrawableTaikoRuleset(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) { Direction.Value = ScrollingDirection.Left; diff --git a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs index cb527adb98..35b941b52b 100644 --- a/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs +++ b/osu.Game.Rulesets.Taiko/UI/TaikoPlayfield.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Taiko.UI public class TaikoPlayfield : ScrollingPlayfield { /// - /// Default height of a when inside a . + /// Default height of a when inside a . /// public const float DEFAULT_HEIGHT = 178; diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 81aba9bee5..32b6195336 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -350,7 +350,7 @@ namespace osu.Game.Tests.Visual Thread.Sleep(1); StoryboardEnabled = config.GetBindable(OsuSetting.ShowStoryboard); ReplacesBackground.BindTo(Background.StoryboardReplacesBackground); - RulesetContainer.IsPaused.BindTo(IsPaused); + DrawableRuleset.IsPaused.BindTo(IsPaused); } } diff --git a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs index f9df025be8..73aa12a3db 100644 --- a/osu.Game/Beatmaps/DummyWorkingBeatmap.cs +++ b/osu.Game/Beatmaps/DummyWorkingBeatmap.cs @@ -52,7 +52,7 @@ namespace osu.Game.Beatmaps { public override IEnumerable GetModsFor(ModType type) => new Mod[] { }; - public override RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap) + public override DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap) { throw new NotImplementedException(); } diff --git a/osu.Game/Rulesets/Edit/EditRulesetContainer.cs b/osu.Game/Rulesets/Edit/EditRulesetContainer.cs index 8992be2da2..a454f72e11 100644 --- a/osu.Game/Rulesets/Edit/EditRulesetContainer.cs +++ b/osu.Game/Rulesets/Edit/EditRulesetContainer.cs @@ -11,14 +11,14 @@ using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Edit { - public abstract class EditRulesetContainer : CompositeDrawable + public abstract class EditDrawableRuleset : CompositeDrawable { /// - /// The contained by this . + /// The contained by this . /// public abstract Playfield Playfield { get; } - internal EditRulesetContainer() + internal EditDrawableRuleset() { RelativeSizeAxes = Axes.Both; } @@ -38,21 +38,21 @@ namespace osu.Game.Rulesets.Edit internal abstract DrawableHitObject Remove(HitObject hitObject); } - public class EditRulesetContainer : EditRulesetContainer + public class EditDrawableRuleset : EditDrawableRuleset where TObject : HitObject { - public override Playfield Playfield => rulesetContainer.Playfield; + public override Playfield Playfield => rrawableRuleset.Playfield; - private Ruleset ruleset => rulesetContainer.Ruleset; - private Beatmap beatmap => rulesetContainer.Beatmap; + private Ruleset ruleset => rrawableRuleset.Ruleset; + private Beatmap beatmap => rrawableRuleset.Beatmap; - private readonly RulesetContainer rulesetContainer; + private readonly DrawableRuleset rrawableRuleset; - public EditRulesetContainer(RulesetContainer rulesetContainer) + public EditDrawableRuleset(DrawableRuleset rrawableRuleset) { - this.rulesetContainer = rulesetContainer; + this.rrawableRuleset = rrawableRuleset; - InternalChild = rulesetContainer; + InternalChild = rrawableRuleset; Playfield.DisplayJudgements.Value = false; } @@ -73,10 +73,10 @@ namespace osu.Game.Rulesets.Edit processor?.PostProcess(); // Add visual representation - var drawableObject = rulesetContainer.GetVisualRepresentation(tObject); + var drawableObject = rrawableRuleset.GetVisualRepresentation(tObject); - rulesetContainer.Playfield.Add(drawableObject); - rulesetContainer.Playfield.PostProcess(); + rrawableRuleset.Playfield.Add(drawableObject); + rrawableRuleset.Playfield.PostProcess(); return drawableObject; } @@ -97,8 +97,8 @@ namespace osu.Game.Rulesets.Edit // Remove visual representation var drawableObject = Playfield.AllHitObjects.Single(d => d.HitObject == hitObject); - rulesetContainer.Playfield.Remove(drawableObject); - rulesetContainer.Playfield.PostProcess(); + rrawableRuleset.Playfield.Remove(drawableObject); + rrawableRuleset.Playfield.PostProcess(); return drawableObject; } diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index 025564e249..c95d6c3f0a 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Edit { public abstract class HitObjectComposer : CompositeDrawable { - public IEnumerable HitObjects => RulesetContainer.Playfield.AllHitObjects; + public IEnumerable HitObjects => DrawableRuleset.Playfield.AllHitObjects; protected readonly Ruleset Ruleset; @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Edit private readonly List layerContainers = new List(); - protected EditRulesetContainer RulesetContainer { get; private set; } + protected EditDrawableRuleset DrawableRuleset { get; private set; } private BlueprintContainer blueprintContainer; @@ -54,8 +54,8 @@ namespace osu.Game.Rulesets.Edit try { - RulesetContainer = CreateRulesetContainer(); - RulesetContainer.Clock = framedClock; + DrawableRuleset = CreateDrawableRuleset(); + DrawableRuleset.Clock = framedClock; } catch (Exception e) { @@ -97,7 +97,7 @@ namespace osu.Game.Rulesets.Edit Children = new Drawable[] { layerBelowRuleset, - RulesetContainer, + DrawableRuleset, layerAboveRuleset } } @@ -140,27 +140,27 @@ namespace osu.Game.Rulesets.Edit layerContainers.ForEach(l => { - l.Anchor = RulesetContainer.Playfield.Anchor; - l.Origin = RulesetContainer.Playfield.Origin; - l.Position = RulesetContainer.Playfield.Position; - l.Size = RulesetContainer.Playfield.Size; + l.Anchor = DrawableRuleset.Playfield.Anchor; + l.Origin = DrawableRuleset.Playfield.Origin; + l.Position = DrawableRuleset.Playfield.Position; + l.Size = DrawableRuleset.Playfield.Size; }); } /// /// Whether the user's cursor is currently in an area of the that is valid for placement. /// - public virtual bool CursorInPlacementArea => RulesetContainer.Playfield.ReceivePositionalInputAt(inputManager.CurrentState.Mouse.Position); + public virtual bool CursorInPlacementArea => DrawableRuleset.Playfield.ReceivePositionalInputAt(inputManager.CurrentState.Mouse.Position); /// /// Adds a to the and visualises it. /// /// The to add. - public void Add(HitObject hitObject) => blueprintContainer.AddBlueprintFor(RulesetContainer.Add(hitObject)); + public void Add(HitObject hitObject) => blueprintContainer.AddBlueprintFor(DrawableRuleset.Add(hitObject)); - public void Remove(HitObject hitObject) => blueprintContainer.RemoveBlueprintFor(RulesetContainer.Remove(hitObject)); + public void Remove(HitObject hitObject) => blueprintContainer.RemoveBlueprintFor(DrawableRuleset.Remove(hitObject)); - internal abstract EditRulesetContainer CreateRulesetContainer(); + internal abstract EditDrawableRuleset CreateDrawableRuleset(); protected abstract IReadOnlyList CompositionTools { get; } @@ -189,9 +189,9 @@ namespace osu.Game.Rulesets.Edit { } - internal override EditRulesetContainer CreateRulesetContainer() - => new EditRulesetContainer(CreateRulesetContainer(Ruleset, Beatmap.Value)); + internal override EditDrawableRuleset CreateDrawableRuleset() + => new EditDrawableRuleset(CreateDrawableRuleset(Ruleset, Beatmap.Value)); - protected abstract RulesetContainer CreateRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap); + protected abstract DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap); } } diff --git a/osu.Game/Rulesets/Mods/IApplicableToRulesetContainer.cs b/osu.Game/Rulesets/Mods/IApplicableToRulesetContainer.cs index addb96a4fe..ff00e4f31d 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToRulesetContainer.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToRulesetContainer.cs @@ -7,15 +7,15 @@ using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Mods { /// - /// An interface for s that can be applied to s. + /// An interface for s that can be applied to s. /// - public interface IApplicableToRulesetContainer : IApplicableMod + public interface IApplicableToDrawableRuleset : IApplicableMod where TObject : HitObject { /// - /// Applies this to a . + /// Applies this to a . /// - /// The to apply to. - void ApplyToRulesetContainer(RulesetContainer rulesetContainer); + /// The to apply to. + void ApplyToDrawableRuleset(DrawableRuleset rrawableRuleset); } } diff --git a/osu.Game/Rulesets/Mods/ModAutoplay.cs b/osu.Game/Rulesets/Mods/ModAutoplay.cs index 44c78f8436..dc60f38218 100644 --- a/osu.Game/Rulesets/Mods/ModAutoplay.cs +++ b/osu.Game/Rulesets/Mods/ModAutoplay.cs @@ -11,10 +11,10 @@ using osu.Game.Scoring; namespace osu.Game.Rulesets.Mods { - public abstract class ModAutoplay : ModAutoplay, IApplicableToRulesetContainer + public abstract class ModAutoplay : ModAutoplay, IApplicableToDrawableRuleset where T : HitObject { - public virtual void ApplyToRulesetContainer(RulesetContainer rulesetContainer) => rulesetContainer.SetReplayScore(CreateReplayScore(rulesetContainer.Beatmap)); + public virtual void ApplyToDrawableRuleset(DrawableRuleset rrawableRuleset) => rrawableRuleset.SetReplayScore(CreateReplayScore(rrawableRuleset.Beatmap)); } public abstract class ModAutoplay : Mod, IApplicableFailOverride diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index ab095f417a..8b861496af 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Mods } } - public abstract class ModFlashlight : ModFlashlight, IApplicableToRulesetContainer, IApplicableToScoreProcessor + public abstract class ModFlashlight : ModFlashlight, IApplicableToDrawableRuleset, IApplicableToScoreProcessor where T : HitObject { public const double FLASHLIGHT_FADE_DURATION = 800; @@ -45,15 +45,15 @@ namespace osu.Game.Rulesets.Mods Combo.BindTo(scoreProcessor.Combo); } - public virtual void ApplyToRulesetContainer(RulesetContainer rulesetContainer) + public virtual void ApplyToDrawableRuleset(DrawableRuleset rrawableRuleset) { var flashlight = CreateFlashlight(); flashlight.Combo = Combo; flashlight.RelativeSizeAxes = Axes.Both; flashlight.Colour = Color4.Black; - rulesetContainer.KeyBindingInputManager.Add(flashlight); + rrawableRuleset.KeyBindingInputManager.Add(flashlight); - flashlight.Breaks = rulesetContainer.Beatmap.Breaks; + flashlight.Breaks = rrawableRuleset.Beatmap.Breaks; } public abstract Flashlight CreateFlashlight(); diff --git a/osu.Game/Rulesets/Ruleset.cs b/osu.Game/Rulesets/Ruleset.cs index 70f15b99bd..feac49ca2c 100644 --- a/osu.Game/Rulesets/Ruleset.cs +++ b/osu.Game/Rulesets/Ruleset.cs @@ -55,7 +55,7 @@ namespace osu.Game.Rulesets /// The beatmap to create the hit renderer for. /// Unable to successfully load the beatmap to be usable with this ruleset. /// - public abstract RulesetContainer CreateRulesetContainerWith(WorkingBeatmap beatmap); + public abstract DrawableRuleset CreateDrawableRulesetWith(WorkingBeatmap beatmap); /// /// Creates a to convert a to one that is applicable for this . diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 63e1c93dd5..689512fd70 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -210,15 +210,15 @@ namespace osu.Game.Rulesets.Scoring { } - public ScoreProcessor(RulesetContainer rulesetContainer) + public ScoreProcessor(DrawableRuleset rrawableRuleset) { Debug.Assert(base_portion + combo_portion == 1.0); - rulesetContainer.OnNewResult += applyResult; - rulesetContainer.OnRevertResult += revertResult; + rrawableRuleset.OnNewResult += applyResult; + rrawableRuleset.OnRevertResult += revertResult; - ApplyBeatmap(rulesetContainer.Beatmap); - SimulateAutoplay(rulesetContainer.Beatmap); + ApplyBeatmap(rrawableRuleset.Beatmap); + SimulateAutoplay(rrawableRuleset.Beatmap); Reset(true); if (maxBaseScore == 0 || maxHighestCombo == 0) diff --git a/osu.Game/Rulesets/UI/RulesetContainer.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs similarity index 89% rename from osu.Game/Rulesets/UI/RulesetContainer.cs rename to osu.Game/Rulesets/UI/DrawableRuleset.cs index 960e05f669..9fc336ed3e 100644 --- a/osu.Game/Rulesets/UI/RulesetContainer.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -30,14 +30,14 @@ using osu.Game.Screens.Play; namespace osu.Game.Rulesets.UI { /// - /// RulesetContainer that applies conversion to Beatmaps. Does not contain a Playfield + /// DrawableRuleset that applies conversion to Beatmaps. Does not contain a Playfield /// and does not load drawable hit objects. /// - /// Should not be derived - derive instead. + /// Should not be derived - derive instead. /// /// - /// The type of HitObject contained by this RulesetContainer. - public abstract class RulesetContainer : RulesetContainer, IProvideCursor, ICanAttachKeyCounter + /// The type of HitObject contained by this DrawableRuleset. + public abstract class DrawableRuleset : DrawableRuleset, IProvideCursor, ICanAttachKeyCounter where TObject : HitObject { /// @@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.UI public virtual int Variant => 0; /// - /// The key conversion input manager for this RulesetContainer. + /// The key conversion input manager for this DrawableRuleset. /// public PassThroughInputManager KeyBindingInputManager; @@ -79,10 +79,10 @@ namespace osu.Game.Rulesets.UI /// /// The ruleset being repesented. /// The beatmap to create the hit renderer for. - protected RulesetContainer(Ruleset ruleset, WorkingBeatmap workingBeatmap) + protected DrawableRuleset(Ruleset ruleset, WorkingBeatmap workingBeatmap) : base(ruleset) { - Debug.Assert(workingBeatmap != null, "RulesetContainer initialized with a null beatmap."); + Debug.Assert(workingBeatmap != null, "DrawableRuleset initialized with a null beatmap."); RelativeSizeAxes = Axes.Both; @@ -134,7 +134,7 @@ namespace osu.Game.Rulesets.UI } /// - /// Creates and adds the visual representation of a to this . + /// Creates and adds the visual representation of a to this . /// /// The to add the visual representation for. private void addRepresentation(TObject hitObject) @@ -253,7 +253,7 @@ namespace osu.Game.Rulesets.UI } /// - /// Applies the active mods to this RulesetContainer. + /// Applies the active mods to this DrawableRuleset. /// /// private void applyRulesetMods(IEnumerable mods, OsuConfigManager config) @@ -261,8 +261,8 @@ namespace osu.Game.Rulesets.UI if (mods == null) return; - foreach (var mod in mods.OfType>()) - mod.ApplyToRulesetContainer(this); + foreach (var mod in mods.OfType>()) + mod.ApplyToDrawableRuleset(this); foreach (var mod in mods.OfType()) mod.ReadFromConfig(config); @@ -281,12 +281,12 @@ namespace osu.Game.Rulesets.UI } /// - /// Base RulesetContainer. Doesn't hold objects. + /// Base DrawableRuleset. Doesn't hold objects. /// - /// Should not be derived - derive instead. + /// Should not be derived - derive instead. /// /// - public abstract class RulesetContainer : CompositeDrawable + public abstract class DrawableRuleset : CompositeDrawable { /// /// Whether a replay is currently loaded. @@ -307,7 +307,7 @@ namespace osu.Game.Rulesets.UI /// Creates a ruleset visualisation for the provided ruleset. /// /// The ruleset. - protected RulesetContainer(Ruleset ruleset) + protected DrawableRuleset(Ruleset ruleset) { Ruleset = ruleset; } @@ -341,18 +341,18 @@ namespace osu.Game.Rulesets.UI /// /// Create a for the associated ruleset and link with this - /// . + /// . /// /// A score processor. public abstract ScoreProcessor CreateScoreProcessor(); } /// - /// A derivable RulesetContainer that manages the Playfield and HitObjects. + /// A derivable DrawableRuleset that manages the Playfield and HitObjects. /// - /// The type of Playfield contained by this RulesetContainer. - /// The type of HitObject contained by this RulesetContainer. - public abstract class RulesetContainer : RulesetContainer + /// The type of Playfield contained by this DrawableRuleset. + /// The type of HitObject contained by this DrawableRuleset. + public abstract class DrawableRuleset : DrawableRuleset where TObject : HitObject where TPlayfield : Playfield { @@ -366,7 +366,7 @@ namespace osu.Game.Rulesets.UI /// /// The ruleset being repesented. /// The beatmap to create the hit renderer for. - protected RulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) + protected DrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) { } diff --git a/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs b/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs similarity index 92% rename from osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs rename to osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs index 7a60e0b021..9d0fbf1e9e 100644 --- a/osu.Game/Rulesets/UI/Scrolling/ScrollingRulesetContainer.cs +++ b/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs @@ -20,10 +20,10 @@ using osu.Game.Rulesets.UI.Scrolling.Algorithms; namespace osu.Game.Rulesets.UI.Scrolling { /// - /// A type of that supports a . - /// s inside this will scroll within the playfield. + /// A type of that supports a . + /// s inside this will scroll within the playfield. /// - public abstract class ScrollingRulesetContainer : RulesetContainer, IKeyBindingHandler + public abstract class DrawableScrollingRuleset : DrawableRuleset, IKeyBindingHandler where TObject : HitObject where TPlayfield : ScrollingPlayfield { @@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.UI.Scrolling /// /// Provides the default s that adjust the scrolling rate of s - /// inside this . + /// inside this . /// /// private readonly SortedList controlPoints = new SortedList(Comparer.Default); @@ -80,7 +80,7 @@ namespace osu.Game.Rulesets.UI.Scrolling [Cached(Type = typeof(IScrollingInfo))] private readonly LocalScrollingInfo scrollingInfo; - protected ScrollingRulesetContainer(Ruleset ruleset, WorkingBeatmap beatmap) + protected DrawableScrollingRuleset(Ruleset ruleset, WorkingBeatmap beatmap) : base(ruleset, beatmap) { scrollingInfo = new LocalScrollingInfo(); diff --git a/osu.Game/Screens/Edit/Editor.cs b/osu.Game/Screens/Edit/Editor.cs index f2d2381d20..0ba1e74aca 100644 --- a/osu.Game/Screens/Edit/Editor.cs +++ b/osu.Game/Screens/Edit/Editor.cs @@ -55,7 +55,7 @@ namespace osu.Game.Screens.Edit { this.host = host; - // TODO: should probably be done at a RulesetContainer level to share logic with Player. + // TODO: should probably be done at a DrawableRuleset level to share logic with Player. var sourceClock = (IAdjustableClock)Beatmap.Value.Track ?? new StopwatchClock(); clock = new EditorClock(Beatmap.Value, beatDivisor) { IsCoupled = false }; clock.ChangeSource(sourceClock); diff --git a/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs b/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs index 8ab23a620b..6080458aec 100644 --- a/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs +++ b/osu.Game/Screens/Multi/Components/ModeTypeInfo.cs @@ -15,7 +15,7 @@ namespace osu.Game.Screens.Multi.Components private const float height = 30; private const float transition_duration = 100; - private Container rulesetContainer; + private Container drawableRuleset; public ModeTypeInfo() { @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Multi.Components LayoutDuration = 100, Children = new[] { - rulesetContainer = new Container + drawableRuleset = new Container { AutoSizeAxes = Axes.Both, }, @@ -55,11 +55,11 @@ namespace osu.Game.Screens.Multi.Components { if (item?.Beatmap != null) { - rulesetContainer.FadeIn(transition_duration); - rulesetContainer.Child = new DifficultyIcon(item.Beatmap, item.Ruleset) { Size = new Vector2(height) }; + drawableRuleset.FadeIn(transition_duration); + drawableRuleset.Child = new DifficultyIcon(item.Beatmap, item.Ruleset) { Size = new Vector2(height) }; } else - rulesetContainer.FadeOut(transition_duration); + drawableRuleset.FadeOut(transition_duration); } } } diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index 1f6a72e726..def9a97c7e 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -42,7 +42,7 @@ namespace osu.Game.Screens.Play public Action RequestSeek; - public HUDOverlay(ScoreProcessor scoreProcessor, RulesetContainer rulesetContainer, WorkingBeatmap working) + public HUDOverlay(ScoreProcessor scoreProcessor, DrawableRuleset drawableRuleset, WorkingBeatmap working) { RelativeSizeAxes = Axes.Both; @@ -90,10 +90,10 @@ namespace osu.Game.Screens.Play }; BindProcessor(scoreProcessor); - BindRulesetContainer(rulesetContainer); + BindDrawableRuleset(drawableRuleset); - Progress.Objects = rulesetContainer.Objects; - Progress.AllowSeeking = rulesetContainer.HasReplayLoaded.Value; + Progress.Objects = drawableRuleset.Objects; + Progress.AllowSeeking = drawableRuleset.HasReplayLoaded.Value; Progress.RequestSeek = time => RequestSeek(time); ModDisplay.Current.BindTo(working.Mods); @@ -143,13 +143,13 @@ namespace osu.Game.Screens.Play } } - protected virtual void BindRulesetContainer(RulesetContainer rulesetContainer) + protected virtual void BindDrawableRuleset(DrawableRuleset drawableRuleset) { - (rulesetContainer as ICanAttachKeyCounter)?.Attach(KeyCounter); + (drawableRuleset as ICanAttachKeyCounter)?.Attach(KeyCounter); - replayLoaded.BindTo(rulesetContainer.HasReplayLoaded); + replayLoaded.BindTo(drawableRuleset.HasReplayLoaded); - Progress.BindRulestContainer(rulesetContainer); + Progress.BindRulestContainer(drawableRuleset); } protected override bool OnKeyDown(KeyDownEvent e) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index b11c5e51c9..b814eed08c 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -65,7 +65,7 @@ namespace osu.Game.Screens.Play private SampleChannel sampleRestart; protected ScoreProcessor ScoreProcessor { get; private set; } - protected RulesetContainer RulesetContainer { get; private set; } + protected DrawableRuleset DrawableRuleset { get; private set; } protected HUDOverlay HUDOverlay { get; private set; } private FailOverlay failOverlay; @@ -80,7 +80,7 @@ namespace osu.Game.Screens.Play EnableUserDim = { Value = true } }; - public bool LoadedBeatmapSuccessfully => RulesetContainer?.Objects.Any() == true; + public bool LoadedBeatmapSuccessfully => DrawableRuleset?.Objects.Any() == true; private GameplayClockContainer gameplayClockContainer; @@ -98,11 +98,11 @@ namespace osu.Game.Screens.Play mouseWheelDisabled = config.GetBindable(OsuSetting.MouseDisableWheel); - ScoreProcessor = RulesetContainer.CreateScoreProcessor(); + ScoreProcessor = DrawableRuleset.CreateScoreProcessor(); if (!ScoreProcessor.Mode.Disabled) config.BindWith(OsuSetting.ScoreDisplayMode, ScoreProcessor.Mode); - InternalChild = gameplayClockContainer = new GameplayClockContainer(working, AllowLeadIn, RulesetContainer.GameplayStartTime); + InternalChild = gameplayClockContainer = new GameplayClockContainer(working, AllowLeadIn, DrawableRuleset.GameplayStartTime); gameplayClockContainer.Children = new Drawable[] { @@ -114,7 +114,7 @@ namespace osu.Game.Screens.Play Start = gameplayClockContainer.Start, Stop = gameplayClockContainer.Stop, IsPaused = { BindTarget = gameplayClockContainer.IsPaused }, - CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !RulesetContainer.HasReplayLoaded.Value, + CheckCanPause = () => AllowPause && ValidForResume && !HasFailed && !DrawableRuleset.HasReplayLoaded.Value, Children = new[] { StoryboardContainer = CreateStoryboardContainer(), @@ -123,7 +123,7 @@ namespace osu.Game.Screens.Play Child = new LocalSkinOverrideContainer(working.Skin) { RelativeSizeAxes = Axes.Both, - Child = RulesetContainer + Child = DrawableRuleset } }, new BreakOverlay(working.Beatmap.BeatmapInfo.LetterboxInBreaks, ScoreProcessor) @@ -133,17 +133,17 @@ namespace osu.Game.Screens.Play Breaks = working.Beatmap.Breaks }, // display the cursor above some HUD elements. - RulesetContainer.Cursor?.CreateProxy() ?? new Container(), - HUDOverlay = new HUDOverlay(ScoreProcessor, RulesetContainer, working) + DrawableRuleset.Cursor?.CreateProxy() ?? new Container(), + HUDOverlay = new HUDOverlay(ScoreProcessor, DrawableRuleset, working) { HoldToQuit = { Action = performUserRequestedExit }, PlayerSettingsOverlay = { PlaybackSettings = { UserPlaybackRate = { BindTarget = gameplayClockContainer.UserPlaybackRate } } }, - KeyCounter = { Visible = { BindTarget = RulesetContainer.HasReplayLoaded } }, + KeyCounter = { Visible = { BindTarget = DrawableRuleset.HasReplayLoaded } }, RequestSeek = gameplayClockContainer.Seek, Anchor = Anchor.Centre, Origin = Anchor.Centre }, - new SkipOverlay(RulesetContainer.GameplayStartTime) + new SkipOverlay(DrawableRuleset.GameplayStartTime) { RequestSeek = gameplayClockContainer.Seek }, @@ -167,7 +167,7 @@ namespace osu.Game.Screens.Play }; // bind clock into components that require it - RulesetContainer.IsPaused.BindTo(gameplayClockContainer.IsPaused); + DrawableRuleset.IsPaused.BindTo(gameplayClockContainer.IsPaused); if (ShowStoryboard.Value) initializeStoryboard(false); @@ -198,18 +198,18 @@ namespace osu.Game.Screens.Play try { - RulesetContainer = rulesetInstance.CreateRulesetContainerWith(working); + DrawableRuleset = rulesetInstance.CreateDrawableRulesetWith(working); } catch (BeatmapInvalidForRulesetException) { - // we may fail to create a RulesetContainer if the beatmap cannot be loaded with the user's preferred ruleset + // we may fail to create a DrawableRuleset if the beatmap cannot be loaded with the user's preferred ruleset // let's try again forcing the beatmap's ruleset. ruleset = beatmap.BeatmapInfo.Ruleset; rulesetInstance = ruleset.CreateInstance(); - RulesetContainer = rulesetInstance.CreateRulesetContainerWith(Beatmap.Value); + DrawableRuleset = rulesetInstance.CreateDrawableRulesetWith(Beatmap.Value); } - if (!RulesetContainer.Objects.Any()) + if (!DrawableRuleset.Objects.Any()) { Logger.Log("Beatmap contains no hit objects!", level: LogLevel.Error); return null; @@ -261,7 +261,7 @@ namespace osu.Game.Screens.Play if (!this.IsCurrentScreen()) return; var score = CreateScore(); - if (RulesetContainer.ReplayScore == null) + if (DrawableRuleset.ReplayScore == null) scoreManager.Import(score); this.Push(CreateResults(score)); @@ -273,7 +273,7 @@ namespace osu.Game.Screens.Play protected virtual ScoreInfo CreateScore() { - var score = RulesetContainer.ReplayScore?.ScoreInfo ?? new ScoreInfo + var score = DrawableRuleset.ReplayScore?.ScoreInfo ?? new ScoreInfo { Beatmap = Beatmap.Value.BeatmapInfo, Ruleset = ruleset, @@ -346,7 +346,7 @@ namespace osu.Game.Screens.Play return true; } - if ((!AllowPause || HasFailed || !ValidForResume || PausableGameplayContainer?.IsPaused.Value != false || RulesetContainer?.HasReplayLoaded.Value != false) && (!PausableGameplayContainer?.IsResuming ?? true)) + if ((!AllowPause || HasFailed || !ValidForResume || PausableGameplayContainer?.IsPaused.Value != false || DrawableRuleset?.HasReplayLoaded.Value != false) && (!PausableGameplayContainer?.IsResuming ?? true)) { gameplayClockContainer.ResetLocalAdjustments(); diff --git a/osu.Game/Screens/Play/ReplayPlayer.cs b/osu.Game/Screens/Play/ReplayPlayer.cs index 3190139378..949b08d98d 100644 --- a/osu.Game/Screens/Play/ReplayPlayer.cs +++ b/osu.Game/Screens/Play/ReplayPlayer.cs @@ -17,7 +17,7 @@ namespace osu.Game.Screens.Play protected override void LoadComplete() { base.LoadComplete(); - RulesetContainer?.SetReplayScore(score); + DrawableRuleset?.SetReplayScore(score); } protected override ScoreInfo CreateScore() => score.ScoreInfo; diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index e3d6ca16a7..e94652b795 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -109,9 +109,9 @@ namespace osu.Game.Screens.Play replayLoaded.TriggerChange(); } - public void BindRulestContainer(RulesetContainer rulesetContainer) + public void BindRulestContainer(DrawableRuleset drawableRuleset) { - replayLoaded.BindTo(rulesetContainer.HasReplayLoaded); + replayLoaded.BindTo(drawableRuleset.HasReplayLoaded); } private bool allowSeeking; From e0ab40b0821ba12670a7342962cc447c624c3be5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 19 Mar 2019 23:56:12 +0900 Subject: [PATCH 039/107] Rename missed files --- .../Edit/{EditRulesetContainer.cs => EditDrawableRuleset.cs} | 0 ...cableToRulesetContainer.cs => IApplicableToDrawableRuleset.cs} | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename osu.Game/Rulesets/Edit/{EditRulesetContainer.cs => EditDrawableRuleset.cs} (100%) rename osu.Game/Rulesets/Mods/{IApplicableToRulesetContainer.cs => IApplicableToDrawableRuleset.cs} (100%) diff --git a/osu.Game/Rulesets/Edit/EditRulesetContainer.cs b/osu.Game/Rulesets/Edit/EditDrawableRuleset.cs similarity index 100% rename from osu.Game/Rulesets/Edit/EditRulesetContainer.cs rename to osu.Game/Rulesets/Edit/EditDrawableRuleset.cs diff --git a/osu.Game/Rulesets/Mods/IApplicableToRulesetContainer.cs b/osu.Game/Rulesets/Mods/IApplicableToDrawableRuleset.cs similarity index 100% rename from osu.Game/Rulesets/Mods/IApplicableToRulesetContainer.cs rename to osu.Game/Rulesets/Mods/IApplicableToDrawableRuleset.cs From 3b7a76aa4eefaa713468224323d536eb25b6a9e8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Mar 2019 11:22:34 +0900 Subject: [PATCH 040/107] Fix typo --- .../Mods/CatchModFlashlight.cs | 6 ++--- .../Scoring/CatchScoreProcessor.cs | 4 ++-- .../Scoring/ManiaScoreProcessor.cs | 4 ++-- osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs | 4 ++-- osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs | 4 ++-- .../Scoring/OsuScoreProcessor.cs | 4 ++-- .../Mods/TaikoModFlashlight.cs | 6 ++--- .../Scoring/TaikoScoreProcessor.cs | 4 ++-- osu.Game/Rulesets/Edit/EditDrawableRuleset.cs | 24 +++++++++---------- .../Mods/IApplicableToDrawableRuleset.cs | 4 ++-- osu.Game/Rulesets/Mods/ModAutoplay.cs | 2 +- osu.Game/Rulesets/Mods/ModFlashlight.cs | 6 ++--- osu.Game/Rulesets/Scoring/ScoreProcessor.cs | 10 ++++---- 13 files changed, 41 insertions(+), 41 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs index 77f41affee..71268d899d 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModFlashlight.cs @@ -21,10 +21,10 @@ namespace osu.Game.Rulesets.Catch.Mods private CatchPlayfield playfield; - public override void ApplyToDrawableRuleset(DrawableRuleset rrawableRuleset) + public override void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) { - playfield = (CatchPlayfield)rrawableRuleset.Playfield; - base.ApplyToDrawableRuleset(rrawableRuleset); + playfield = (CatchPlayfield)drawableRuleset.Playfield; + base.ApplyToDrawableRuleset(drawableRuleset); } private class CatchFlashlight : Flashlight diff --git a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs index 05ee4fc52d..af614f95d0 100644 --- a/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs +++ b/osu.Game.Rulesets.Catch/Scoring/CatchScoreProcessor.cs @@ -13,8 +13,8 @@ namespace osu.Game.Rulesets.Catch.Scoring { public class CatchScoreProcessor : ScoreProcessor { - public CatchScoreProcessor(DrawableRuleset rrawableRuleset) - : base(rrawableRuleset) + public CatchScoreProcessor(DrawableRuleset drawableRuleset) + : base(drawableRuleset) { } diff --git a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs index 018f257d8f..5c914d8eac 100644 --- a/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs +++ b/osu.Game.Rulesets.Mania/Scoring/ManiaScoreProcessor.cs @@ -92,8 +92,8 @@ namespace osu.Game.Rulesets.Mania.Scoring { } - public ManiaScoreProcessor(DrawableRuleset rrawableRuleset) - : base(rrawableRuleset) + public ManiaScoreProcessor(DrawableRuleset drawableRuleset) + : base(drawableRuleset) { } diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs b/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs index 57536ec387..a1f4dfe1da 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModBlinds.cs @@ -32,9 +32,9 @@ namespace osu.Game.Rulesets.Osu.Mods public override double ScoreMultiplier => 1.12; private DrawableOsuBlinds blinds; - public void ApplyToDrawableRuleset(DrawableRuleset rrawableRuleset) + public void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) { - rrawableRuleset.Overlays.Add(blinds = new DrawableOsuBlinds(rrawableRuleset.Playfield.HitObjectContainer, rrawableRuleset.Beatmap)); + drawableRuleset.Overlays.Add(blinds = new DrawableOsuBlinds(drawableRuleset.Playfield.HitObjectContainer, drawableRuleset.Beatmap)); } public void ApplyToScoreProcessor(ScoreProcessor scoreProcessor) diff --git a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs index a1c96fd44f..ec23570f54 100644 --- a/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs +++ b/osu.Game.Rulesets.Osu/Mods/OsuModRelax.cs @@ -79,10 +79,10 @@ namespace osu.Game.Rulesets.Osu.Mods state.Apply(osuInputManager.CurrentState, osuInputManager); } - public void ApplyToDrawableRuleset(DrawableRuleset rrawableRuleset) + public void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) { // grab the input manager for future use. - osuInputManager = (OsuInputManager)rrawableRuleset.KeyBindingInputManager; + osuInputManager = (OsuInputManager)drawableRuleset.KeyBindingInputManager; osuInputManager.AllowUserPresses = false; } } diff --git a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs index 4186c515db..2c8bf11016 100644 --- a/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs +++ b/osu.Game.Rulesets.Osu/Scoring/OsuScoreProcessor.cs @@ -15,8 +15,8 @@ namespace osu.Game.Rulesets.Osu.Scoring { internal class OsuScoreProcessor : ScoreProcessor { - public OsuScoreProcessor(DrawableRuleset rrawableRuleset) - : base(rrawableRuleset) + public OsuScoreProcessor(DrawableRuleset drawableRuleset) + : base(drawableRuleset) { } diff --git a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs index c6342f9c34..b7db3307ad 100644 --- a/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs +++ b/osu.Game.Rulesets.Taiko/Mods/TaikoModFlashlight.cs @@ -22,10 +22,10 @@ namespace osu.Game.Rulesets.Taiko.Mods private TaikoPlayfield playfield; - public override void ApplyToDrawableRuleset(DrawableRuleset rrawableRuleset) + public override void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) { - playfield = (TaikoPlayfield)rrawableRuleset.Playfield; - base.ApplyToDrawableRuleset(rrawableRuleset); + playfield = (TaikoPlayfield)drawableRuleset.Playfield; + base.ApplyToDrawableRuleset(drawableRuleset); } private class TaikoFlashlight : Flashlight diff --git a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs index 762e24326a..442cca49f8 100644 --- a/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs +++ b/osu.Game.Rulesets.Taiko/Scoring/TaikoScoreProcessor.cs @@ -32,8 +32,8 @@ namespace osu.Game.Rulesets.Taiko.Scoring /// private double hpMissMultiplier; - public TaikoScoreProcessor(DrawableRuleset rrawableRuleset) - : base(rrawableRuleset) + public TaikoScoreProcessor(DrawableRuleset drawableRuleset) + : base(drawableRuleset) { } diff --git a/osu.Game/Rulesets/Edit/EditDrawableRuleset.cs b/osu.Game/Rulesets/Edit/EditDrawableRuleset.cs index a454f72e11..cfeb6eec9e 100644 --- a/osu.Game/Rulesets/Edit/EditDrawableRuleset.cs +++ b/osu.Game/Rulesets/Edit/EditDrawableRuleset.cs @@ -41,18 +41,18 @@ namespace osu.Game.Rulesets.Edit public class EditDrawableRuleset : EditDrawableRuleset where TObject : HitObject { - public override Playfield Playfield => rrawableRuleset.Playfield; + public override Playfield Playfield => drawableRuleset.Playfield; - private Ruleset ruleset => rrawableRuleset.Ruleset; - private Beatmap beatmap => rrawableRuleset.Beatmap; + private Ruleset ruleset => drawableRuleset.Ruleset; + private Beatmap beatmap => drawableRuleset.Beatmap; - private readonly DrawableRuleset rrawableRuleset; + private readonly DrawableRuleset drawableRuleset; - public EditDrawableRuleset(DrawableRuleset rrawableRuleset) + public EditDrawableRuleset(DrawableRuleset drawableRuleset) { - this.rrawableRuleset = rrawableRuleset; + this.drawableRuleset = drawableRuleset; - InternalChild = rrawableRuleset; + InternalChild = drawableRuleset; Playfield.DisplayJudgements.Value = false; } @@ -73,10 +73,10 @@ namespace osu.Game.Rulesets.Edit processor?.PostProcess(); // Add visual representation - var drawableObject = rrawableRuleset.GetVisualRepresentation(tObject); + var drawableObject = drawableRuleset.GetVisualRepresentation(tObject); - rrawableRuleset.Playfield.Add(drawableObject); - rrawableRuleset.Playfield.PostProcess(); + drawableRuleset.Playfield.Add(drawableObject); + drawableRuleset.Playfield.PostProcess(); return drawableObject; } @@ -97,8 +97,8 @@ namespace osu.Game.Rulesets.Edit // Remove visual representation var drawableObject = Playfield.AllHitObjects.Single(d => d.HitObject == hitObject); - rrawableRuleset.Playfield.Remove(drawableObject); - rrawableRuleset.Playfield.PostProcess(); + drawableRuleset.Playfield.Remove(drawableObject); + drawableRuleset.Playfield.PostProcess(); return drawableObject; } diff --git a/osu.Game/Rulesets/Mods/IApplicableToDrawableRuleset.cs b/osu.Game/Rulesets/Mods/IApplicableToDrawableRuleset.cs index ff00e4f31d..b012beb0c0 100644 --- a/osu.Game/Rulesets/Mods/IApplicableToDrawableRuleset.cs +++ b/osu.Game/Rulesets/Mods/IApplicableToDrawableRuleset.cs @@ -15,7 +15,7 @@ namespace osu.Game.Rulesets.Mods /// /// Applies this to a . /// - /// The to apply to. - void ApplyToDrawableRuleset(DrawableRuleset rrawableRuleset); + /// The to apply to. + void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset); } } diff --git a/osu.Game/Rulesets/Mods/ModAutoplay.cs b/osu.Game/Rulesets/Mods/ModAutoplay.cs index dc60f38218..1c76abbc4b 100644 --- a/osu.Game/Rulesets/Mods/ModAutoplay.cs +++ b/osu.Game/Rulesets/Mods/ModAutoplay.cs @@ -14,7 +14,7 @@ namespace osu.Game.Rulesets.Mods public abstract class ModAutoplay : ModAutoplay, IApplicableToDrawableRuleset where T : HitObject { - public virtual void ApplyToDrawableRuleset(DrawableRuleset rrawableRuleset) => rrawableRuleset.SetReplayScore(CreateReplayScore(rrawableRuleset.Beatmap)); + public virtual void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) => drawableRuleset.SetReplayScore(CreateReplayScore(drawableRuleset.Beatmap)); } public abstract class ModAutoplay : Mod, IApplicableFailOverride diff --git a/osu.Game/Rulesets/Mods/ModFlashlight.cs b/osu.Game/Rulesets/Mods/ModFlashlight.cs index 8b861496af..23e928d991 100644 --- a/osu.Game/Rulesets/Mods/ModFlashlight.cs +++ b/osu.Game/Rulesets/Mods/ModFlashlight.cs @@ -45,15 +45,15 @@ namespace osu.Game.Rulesets.Mods Combo.BindTo(scoreProcessor.Combo); } - public virtual void ApplyToDrawableRuleset(DrawableRuleset rrawableRuleset) + public virtual void ApplyToDrawableRuleset(DrawableRuleset drawableRuleset) { var flashlight = CreateFlashlight(); flashlight.Combo = Combo; flashlight.RelativeSizeAxes = Axes.Both; flashlight.Colour = Color4.Black; - rrawableRuleset.KeyBindingInputManager.Add(flashlight); + drawableRuleset.KeyBindingInputManager.Add(flashlight); - flashlight.Breaks = rrawableRuleset.Beatmap.Breaks; + flashlight.Breaks = drawableRuleset.Beatmap.Breaks; } public abstract Flashlight CreateFlashlight(); diff --git a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs index 689512fd70..0fddb19a6c 100644 --- a/osu.Game/Rulesets/Scoring/ScoreProcessor.cs +++ b/osu.Game/Rulesets/Scoring/ScoreProcessor.cs @@ -210,15 +210,15 @@ namespace osu.Game.Rulesets.Scoring { } - public ScoreProcessor(DrawableRuleset rrawableRuleset) + public ScoreProcessor(DrawableRuleset drawableRuleset) { Debug.Assert(base_portion + combo_portion == 1.0); - rrawableRuleset.OnNewResult += applyResult; - rrawableRuleset.OnRevertResult += revertResult; + drawableRuleset.OnNewResult += applyResult; + drawableRuleset.OnRevertResult += revertResult; - ApplyBeatmap(rrawableRuleset.Beatmap); - SimulateAutoplay(rrawableRuleset.Beatmap); + ApplyBeatmap(drawableRuleset.Beatmap); + SimulateAutoplay(drawableRuleset.Beatmap); Reset(true); if (maxBaseScore == 0 || maxHighestCombo == 0) From 7b6d882ce6508be56126c40ba5adc72d54723eee Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Mar 2019 11:29:16 +0900 Subject: [PATCH 041/107] Remove double-generic type --- .../UI/DrawableCatchRuleset.cs | 2 +- .../UI/DrawableManiaRuleset.cs | 4 ++- .../UI/DrawableOsuRuleset.cs | 2 +- .../UI/DrawableTaikoRuleset.cs | 2 +- osu.Game/Rulesets/UI/DrawableRuleset.cs | 28 ------------------- .../UI/Scrolling/DrawableScrollingRuleset.cs | 7 ++--- 6 files changed, 9 insertions(+), 36 deletions(-) diff --git a/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs b/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs index 63220e9379..406dc10eea 100644 --- a/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs +++ b/osu.Game.Rulesets.Catch/UI/DrawableCatchRuleset.cs @@ -17,7 +17,7 @@ using osu.Game.Rulesets.UI.Scrolling; namespace osu.Game.Rulesets.Catch.UI { - public class DrawableCatchRuleset : DrawableScrollingRuleset + public class DrawableCatchRuleset : DrawableScrollingRuleset { protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Constant; diff --git a/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs b/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs index 5090dd491e..a019401d5b 100644 --- a/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs +++ b/osu.Game.Rulesets.Mania/UI/DrawableManiaRuleset.cs @@ -28,8 +28,10 @@ using osuTK; namespace osu.Game.Rulesets.Mania.UI { - public class DrawableManiaRuleset : DrawableScrollingRuleset + public class DrawableManiaRuleset : DrawableScrollingRuleset { + protected new ManiaPlayfield Playfield => (ManiaPlayfield)base.Playfield; + public new ManiaBeatmap Beatmap => (ManiaBeatmap)base.Beatmap; public IEnumerable BarLines; diff --git a/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs b/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs index d91ccdedd5..b632e0fb05 100644 --- a/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs +++ b/osu.Game.Rulesets.Osu/UI/DrawableOsuRuleset.cs @@ -17,7 +17,7 @@ using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Osu.UI { - public class DrawableOsuRuleset : DrawableRuleset + public class DrawableOsuRuleset : DrawableRuleset { protected new OsuRulesetConfigManager Config => (OsuRulesetConfigManager)base.Config; diff --git a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs index 54a54a54bd..899b91863e 100644 --- a/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs +++ b/osu.Game.Rulesets.Taiko/UI/DrawableTaikoRuleset.cs @@ -20,7 +20,7 @@ using osu.Game.Rulesets.UI.Scrolling; namespace osu.Game.Rulesets.Taiko.UI { - public class DrawableTaikoRuleset : DrawableScrollingRuleset + public class DrawableTaikoRuleset : DrawableScrollingRuleset { protected override ScrollVisualisationMethod VisualisationMethod => ScrollVisualisationMethod.Overlapping; diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs index 9fc336ed3e..a33f75737b 100644 --- a/osu.Game/Rulesets/UI/DrawableRuleset.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -32,9 +32,6 @@ namespace osu.Game.Rulesets.UI /// /// DrawableRuleset that applies conversion to Beatmaps. Does not contain a Playfield /// and does not load drawable hit objects. - /// - /// Should not be derived - derive instead. - /// /// /// The type of HitObject contained by this DrawableRuleset. public abstract class DrawableRuleset : DrawableRuleset, IProvideCursor, ICanAttachKeyCounter @@ -347,31 +344,6 @@ namespace osu.Game.Rulesets.UI public abstract ScoreProcessor CreateScoreProcessor(); } - /// - /// A derivable DrawableRuleset that manages the Playfield and HitObjects. - /// - /// The type of Playfield contained by this DrawableRuleset. - /// The type of HitObject contained by this DrawableRuleset. - public abstract class DrawableRuleset : DrawableRuleset - where TObject : HitObject - where TPlayfield : Playfield - { - /// - /// The playfield. - /// - protected new TPlayfield Playfield => (TPlayfield)base.Playfield; - - /// - /// Creates a ruleset visualisation for the provided ruleset and beatmap. - /// - /// The ruleset being repesented. - /// The beatmap to create the hit renderer for. - protected DrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap) - : base(ruleset, beatmap) - { - } - } - public class BeatmapInvalidForRulesetException : ArgumentException { public BeatmapInvalidForRulesetException(string text) diff --git a/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs b/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs index 9d0fbf1e9e..9c2a06aef0 100644 --- a/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs +++ b/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs @@ -20,12 +20,11 @@ using osu.Game.Rulesets.UI.Scrolling.Algorithms; namespace osu.Game.Rulesets.UI.Scrolling { /// - /// A type of that supports a . - /// s inside this will scroll within the playfield. + /// A type of that supports a . + /// s inside this will scroll within the playfield. /// - public abstract class DrawableScrollingRuleset : DrawableRuleset, IKeyBindingHandler + public abstract class DrawableScrollingRuleset : DrawableRuleset, IKeyBindingHandler where TObject : HitObject - where TPlayfield : ScrollingPlayfield { /// /// The default span of time visible by the length of the scrolling axes. From 45b8bfcfd35777498be373c10683937637ea8ee9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Mar 2019 11:31:03 +0900 Subject: [PATCH 042/107] Better protect not-generic DrawableRuleset --- osu.Game/Rulesets/UI/DrawableRuleset.cs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs index a33f75737b..77723ba765 100644 --- a/osu.Game/Rulesets/UI/DrawableRuleset.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -30,8 +30,7 @@ using osu.Game.Screens.Play; namespace osu.Game.Rulesets.UI { /// - /// DrawableRuleset that applies conversion to Beatmaps. Does not contain a Playfield - /// and does not load drawable hit objects. + /// Displays an interactive ruleset gameplay instance. /// /// The type of HitObject contained by this DrawableRuleset. public abstract class DrawableRuleset : DrawableRuleset, IProvideCursor, ICanAttachKeyCounter @@ -278,10 +277,11 @@ namespace osu.Game.Rulesets.UI } /// - /// Base DrawableRuleset. Doesn't hold objects. - /// - /// Should not be derived - derive instead. - /// + /// Displays an interactive ruleset gameplay instance. + /// + /// This type is required only for adding non-generic type to the draw hierarchy. + /// Once IDrawable is a thing, this can also become an interface. + /// /// public abstract class DrawableRuleset : CompositeDrawable { @@ -295,7 +295,7 @@ namespace osu.Game.Rulesets.UI /// public readonly BindableBool IsPaused = new BindableBool(); - /// + /// ~ /// The associated ruleset. /// public readonly Ruleset Ruleset; @@ -304,7 +304,7 @@ namespace osu.Game.Rulesets.UI /// Creates a ruleset visualisation for the provided ruleset. /// /// The ruleset. - protected DrawableRuleset(Ruleset ruleset) + internal DrawableRuleset(Ruleset ruleset) { Ruleset = ruleset; } From 936c3e1ed937e4641a76f733b4ff9b476eac52be Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Mar 2019 11:34:06 +0900 Subject: [PATCH 043/107] Add safety type check to DrawableScrollingRuleset --- .../Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs b/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs index 9c2a06aef0..3b368652f2 100644 --- a/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs +++ b/osu.Game/Rulesets/UI/Scrolling/DrawableScrollingRuleset.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using System.Collections.Generic; using System.Linq; using osu.Framework.Allocation; @@ -69,7 +70,7 @@ namespace osu.Game.Rulesets.UI.Scrolling /// /// Provides the default s that adjust the scrolling rate of s - /// inside this . + /// inside this . /// /// private readonly SortedList controlPoints = new SortedList(Comparer.Default); @@ -166,6 +167,14 @@ namespace osu.Game.Rulesets.UI.Scrolling return false; } + protected override void LoadComplete() + { + base.LoadComplete(); + + if (!(Playfield is ScrollingPlayfield)) + throw new ArgumentException($"{nameof(Playfield)} must be a {nameof(ScrollingPlayfield)} when using {nameof(DrawableScrollingRuleset)}."); + } + public bool OnReleased(GlobalAction action) => false; private class LocalScrollingInfo : IScrollingInfo From 003e36862f4425bb1c197ce968ed5082aab467d2 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 20 Mar 2019 12:06:14 +0900 Subject: [PATCH 044/107] Fix JuiceStreams not affecting lastPosition/lastStartTime --- osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs b/osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs index 275c9a500c..cd71bc2e17 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs @@ -20,6 +20,13 @@ namespace osu.Game.Rulesets.Catch.Mods public void ApplyToHitObject(HitObject hitObject) { + if (hitObject is JuiceStream stream) + { + lastPosition = stream.EndX; + lastStartTime = stream.EndTime; + return; + } + if (!(hitObject is Fruit)) return; From 8f0440d14cb593dfaa4ab8d10151a0506e5aa2ff Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 20 Mar 2019 12:06:37 +0900 Subject: [PATCH 045/107] Ensure RNG max value cannot go below min value --- osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs b/osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs index cd71bc2e17..060e51e31d 100644 --- a/osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs +++ b/osu.Game.Rulesets.Catch/Mods/CatchModHardRock.cs @@ -77,7 +77,7 @@ namespace osu.Game.Rulesets.Catch.Mods private void applyRandomOffset(ref float position, double maxOffset) { bool right = RNG.NextBool(); - float rand = Math.Min(20, (float)RNG.NextDouble(0, maxOffset)) / CatchPlayfield.BASE_WIDTH; + float rand = Math.Min(20, (float)RNG.NextDouble(0, Math.Max(0, maxOffset))) / CatchPlayfield.BASE_WIDTH; if (right) { From 65112348041cffc6df4c625c65c914bc03a669f7 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 20 Mar 2019 13:53:22 +0900 Subject: [PATCH 046/107] Fix catch spinners not being allowed for conversion --- osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs index 41281e805e..0089d1eb88 100644 --- a/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs +++ b/osu.Game/Rulesets/Objects/Legacy/Catch/ConvertSpinner.cs @@ -8,12 +8,14 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch /// /// Legacy osu!catch Spinner-type, used for parsing Beatmaps. /// - internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasCombo + internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasXPosition, IHasCombo { public double EndTime { get; set; } public double Duration => EndTime - StartTime; + public float X => 256; // Required for CatchBeatmapConverter + public bool NewCombo { get; set; } public int ComboOffset { get; set; } From 15637f9c4a9ef0d3bdc1af745223b4523464779b Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Mar 2019 14:17:35 +0900 Subject: [PATCH 047/107] Rework instant blur logic such that updateVisuals doesn't need to be public --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 2 +- .../Graphics/Containers/UserDimContainer.cs | 47 ++++++++++++------- osu.Game/Screens/BackgroundScreen.cs | 3 -- .../Backgrounds/BackgroundScreenBeatmap.cs | 15 ++++-- .../Backgrounds/BackgroundScreenCustom.cs | 2 +- .../Backgrounds/BackgroundScreenDefault.cs | 8 ++-- osu.Game/Screens/Play/Player.cs | 5 +- osu.Game/Screens/Play/PlayerLoader.cs | 22 ++++----- osu.Game/Screens/Ranking/Results.cs | 2 +- osu.Game/Screens/Select/SongSelect.cs | 2 +- 10 files changed, 61 insertions(+), 47 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 263cfe0fc8..084bb6a02e 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -273,7 +273,7 @@ namespace osu.Game.Tests.Visual protected override BackgroundScreen CreateBackground() { FadeAccessibleBackground background = new FadeAccessibleBackground(Beatmap.Value); - DimEnabled.BindTo(background.EnableVisualSettings); + DimEnabled.BindTo(background.EnableUserDim); return background; } diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index 3593394495..d68f607dcd 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -36,7 +37,7 @@ namespace osu.Game.Graphics.Containers /// /// Used in contexts where there can potentially be both user and screen-specified blurring occuring at the same time, such as in /// - public Bindable AddedBlur = new Bindable(); + public readonly Bindable BlurAmount = new Bindable(); private Bindable dimLevel { get; set; } @@ -51,8 +52,10 @@ namespace osu.Game.Graphics.Containers private readonly bool isStoryboard; private Vector2 blurTarget => EnableUserDim.Value - ? new Vector2(AddedBlur.Value + (float)blurLevel.Value * 25) - : new Vector2(AddedBlur.Value); + ? new Vector2(BlurAmount.Value + (float)blurLevel.Value * 25) + : new Vector2(BlurAmount.Value); + + private Background background => DimContainer.Children.OfType().FirstOrDefault(); /// /// Creates a new . @@ -69,27 +72,38 @@ namespace osu.Game.Graphics.Containers AddInternal(DimContainer = new Container { RelativeSizeAxes = Axes.Both }); } + /// + /// Set the blur of the background in this UserDimContainer to our blur target instantly. + /// + /// + /// We need to support instant blurring here in the case of changing beatmap backgrounds, where blurring shouldn't be from 0 every time the beatmap is changed. + /// + public void ApplyInstantBlur() + { + background?.BlurTo(blurTarget, 0, Easing.OutQuint); + } + [BackgroundDependencyLoader] private void load(OsuConfigManager config) { dimLevel = config.GetBindable(OsuSetting.DimLevel); blurLevel = config.GetBindable(OsuSetting.BlurLevel); showStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); - EnableUserDim.ValueChanged += _ => UpdateVisuals(); - dimLevel.ValueChanged += _ => UpdateVisuals(); - blurLevel.ValueChanged += _ => UpdateVisuals(); - showStoryboard.ValueChanged += _ => UpdateVisuals(); - StoryboardReplacesBackground.ValueChanged += _ => UpdateVisuals(); - AddedBlur.ValueChanged += _ => UpdateVisuals(); + EnableUserDim.ValueChanged += _ => updateVisuals(); + dimLevel.ValueChanged += _ => updateVisuals(); + blurLevel.ValueChanged += _ => updateVisuals(); + showStoryboard.ValueChanged += _ => updateVisuals(); + StoryboardReplacesBackground.ValueChanged += _ => updateVisuals(); + BlurAmount.ValueChanged += _ => updateVisuals(); } protected override void LoadComplete() { base.LoadComplete(); - UpdateVisuals(); + updateVisuals(); } - public void UpdateVisuals(bool instant = false) + private void updateVisuals() { if (isStoryboard) { @@ -100,13 +114,10 @@ namespace osu.Game.Graphics.Containers // 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); - foreach (Drawable c in DimContainer) - { - // Only blur if this container contains a background - // We can't blur the container like we did with the dim because buffered containers add considerable draw overhead. As a result, this blurs the background directly. - // We need to support instant blurring here in the case of SongSelect, where blurring shouldn't be from 0 every time the beatmap is changed. - ((Background)c)?.BlurTo(blurTarget, instant ? 0 : background_fade_duration, Easing.OutQuint); - } + // Only blur if this container contains a background + // We can't blur the container like we did with the dim because buffered containers add considerable draw overhead. + // As a result, this blurs the background directly. + background?.BlurTo(blurTarget, 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/BackgroundScreen.cs b/osu.Game/Screens/BackgroundScreen.cs index 7eca192a6b..bbe162cf7c 100644 --- a/osu.Game/Screens/BackgroundScreen.cs +++ b/osu.Game/Screens/BackgroundScreen.cs @@ -5,15 +5,12 @@ using System; using osu.Framework.Screens; using osu.Framework.Graphics; using osu.Framework.Input.Events; -using osu.Game.Graphics.Backgrounds; using osuTK; namespace osu.Game.Screens { public abstract class BackgroundScreen : Screen, IEquatable { - protected Background Background; - protected BackgroundScreen() { Anchor = Anchor.Centre; diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 1baa711f86..5f86fe8d20 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -13,16 +13,21 @@ namespace osu.Game.Screens.Backgrounds { public class BackgroundScreenBeatmap : BackgroundScreen { + protected Background Background; + private WorkingBeatmap beatmap; /// /// Whether or not user dim settings should be applied to this Background. /// - public readonly Bindable EnableVisualSettings = new Bindable(); + public readonly Bindable EnableUserDim = new Bindable(); public readonly Bindable StoryboardReplacesBackground = new Bindable(); - public readonly Bindable AddedBlur = new Bindable(); + /// + /// The amount of blur to be applied in addition to user-specified blur. + /// + public readonly Bindable BlurAmount = new Bindable(); private readonly UserDimContainer fadeContainer; @@ -53,7 +58,7 @@ namespace osu.Game.Screens.Backgrounds b.Depth = newDepth; fadeContainer.Add(Background = b); - fadeContainer.UpdateVisuals(true); + fadeContainer.ApplyInstantBlur(); StoryboardReplacesBackground.BindTo(fadeContainer.StoryboardReplacesBackground); })); }); @@ -64,8 +69,8 @@ namespace osu.Game.Screens.Backgrounds { Beatmap = beatmap; InternalChild = fadeContainer = CreateFadeContainer(); - fadeContainer.EnableUserDim.BindTo(EnableVisualSettings); - fadeContainer.AddedBlur.BindTo(AddedBlur); + fadeContainer.EnableUserDim.BindTo(EnableUserDim); + fadeContainer.BlurAmount.BindTo(BlurAmount); } public override bool Equals(BackgroundScreen other) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs index 538f347737..0cb41bc562 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenCustom.cs @@ -12,7 +12,7 @@ namespace osu.Game.Screens.Backgrounds public BackgroundScreenCustom(string textureName) { this.textureName = textureName; - AddInternal(Background = new Background(textureName)); + AddInternal(new Background(textureName)); } public override bool Equals(BackgroundScreen other) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 73590b3318..3aeb2f9923 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -15,6 +15,8 @@ namespace osu.Game.Screens.Backgrounds { public class BackgroundScreenDefault : BackgroundScreen { + private Background background; + private int currentDisplay; private const int background_count = 5; @@ -39,10 +41,10 @@ namespace osu.Game.Screens.Backgrounds private void display(Background newBackground) { - Background?.FadeOut(800, Easing.InOutSine); - Background?.Expire(); + background?.FadeOut(800, Easing.InOutSine); + background?.Expire(); - AddInternal(Background = newBackground); + AddInternal(background = newBackground); currentDisplay++; } diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index fc24e55de2..1ce8bf559d 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -321,7 +321,8 @@ namespace osu.Game.Screens.Play if (enabled.NewValue) initializeStoryboard(true); }; - Background.EnableVisualSettings.Value = true; + Background.EnableUserDim.Value = true; + Background.BlurAmount.Value = 0; Background.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground); StoryboardContainer.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground); @@ -368,7 +369,7 @@ namespace osu.Game.Screens.Play float fadeOutDuration = instant ? 0 : 250; this.FadeOut(fadeOutDuration); - Background.EnableVisualSettings.Value = false; + Background.EnableUserDim.Value = false; storyboardReplacesBackground.Value = false; } diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 4200a7390d..86156e292c 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -119,18 +119,12 @@ namespace osu.Game.Screens.Play private void contentIn() { - Background.AddedBlur.Value = BACKGROUND_BLUR; - Background.EnableVisualSettings.Value = false; - content.ScaleTo(1, 650, Easing.OutQuint); content.FadeInFromZero(400); } private void contentOut() { - Background.AddedBlur.Value = 0; - Background.EnableVisualSettings.Value = true; - content.ScaleTo(0.7f, 300, Easing.InQuint); content.FadeOut(250); } @@ -166,10 +160,12 @@ namespace osu.Game.Screens.Play protected override bool OnHover(HoverEvent e) { + // Acts as an "on hover lost" trigger for the visual settings panel. + // Returns background dim and blur to the values specified by PlayerLoader. if (this.IsCurrentScreen()) { - Background.AddedBlur.Value = BACKGROUND_BLUR; - Background.EnableVisualSettings.Value = false; + Background.BlurAmount.Value = BACKGROUND_BLUR; + Background.EnableUserDim.Value = false; } return base.OnHover(e); @@ -177,12 +173,14 @@ namespace osu.Game.Screens.Play protected override void OnHoverLost(HoverLostEvent e) { + // Acts as an "on hover" trigger for the visual settings panel. + // Preview user-defined background dim and blur when hovered on the visual settings panel. if (GetContainingInputManager()?.HoveredDrawables.Contains(VisualSettings) == true) { if (this.IsCurrentScreen() && Background != null) { - Background.AddedBlur.Value = 0; - Background.EnableVisualSettings.Value = true; + Background.BlurAmount.Value = 0; + Background.EnableUserDim.Value = true; } } @@ -241,7 +239,7 @@ namespace osu.Game.Screens.Play public override void OnSuspending(IScreen next) { - Background.EnableVisualSettings.Value = true; + Background.EnableUserDim.Value = true; base.OnSuspending(next); cancelLoad(); @@ -253,7 +251,7 @@ namespace osu.Game.Screens.Play this.FadeOut(150); cancelLoad(); - Background.EnableVisualSettings.Value = false; + Background.EnableUserDim.Value = false; return base.OnExiting(next); } diff --git a/osu.Game/Screens/Ranking/Results.cs b/osu.Game/Screens/Ranking/Results.cs index bd8daa6b03..dafb4c0aad 100644 --- a/osu.Game/Screens/Ranking/Results.cs +++ b/osu.Game/Screens/Ranking/Results.cs @@ -58,7 +58,7 @@ namespace osu.Game.Screens.Ranking public override void OnEntering(IScreen last) { base.OnEntering(last); - ((BackgroundScreenBeatmap)Background).AddedBlur.Value = BACKGROUND_BLUR; + ((BackgroundScreenBeatmap)Background).BlurAmount.Value = BACKGROUND_BLUR; Background.ScaleTo(1.1f, transition_time, Easing.OutQuint); allCircles.ForEach(c => diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 385c4e0a0d..9985f984a0 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -556,7 +556,7 @@ namespace osu.Game.Screens.Select if (Background is BackgroundScreenBeatmap backgroundModeBeatmap) { backgroundModeBeatmap.Beatmap = beatmap; - backgroundModeBeatmap.AddedBlur.Value = BACKGROUND_BLUR; + backgroundModeBeatmap.BlurAmount.Value = BACKGROUND_BLUR; backgroundModeBeatmap.FadeColour(Color4.White, 250); } From 996464468342286adcf37246787a64eff2683481 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Mar 2019 14:37:32 +0900 Subject: [PATCH 048/107] Fix merge --- osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 18d6fcc317..8b04b545f5 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -39,6 +39,7 @@ namespace osu.Game.Screens.Backgrounds Beatmap = beatmap; InternalChild = fadeContainer = CreateFadeContainer(); fadeContainer.EnableUserDim.BindTo(EnableUserDim); + fadeContainer.BlurAmount.BindTo(BlurAmount); } [BackgroundDependencyLoader] From 5f288650bfc5d92569d71d4b4f31edc0b67ff4bd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Mar 2019 14:49:33 +0900 Subject: [PATCH 049/107] Fix misses/typos --- .../{EditDrawableRuleset.cs => DrawableEditRuleset.cs} | 10 +++++----- osu.Game/Rulesets/Edit/HitObjectComposer.cs | 8 ++++---- osu.Game/Screens/Play/HUDOverlay.cs | 2 +- osu.Game/Screens/Play/SongProgress.cs | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) rename osu.Game/Rulesets/Edit/{EditDrawableRuleset.cs => DrawableEditRuleset.cs} (93%) diff --git a/osu.Game/Rulesets/Edit/EditDrawableRuleset.cs b/osu.Game/Rulesets/Edit/DrawableEditRuleset.cs similarity index 93% rename from osu.Game/Rulesets/Edit/EditDrawableRuleset.cs rename to osu.Game/Rulesets/Edit/DrawableEditRuleset.cs index cfeb6eec9e..76a2e7af12 100644 --- a/osu.Game/Rulesets/Edit/EditDrawableRuleset.cs +++ b/osu.Game/Rulesets/Edit/DrawableEditRuleset.cs @@ -11,14 +11,14 @@ using osu.Game.Rulesets.UI; namespace osu.Game.Rulesets.Edit { - public abstract class EditDrawableRuleset : CompositeDrawable + public abstract class DrawableEditRuleset : CompositeDrawable { /// - /// The contained by this . + /// The contained by this . /// public abstract Playfield Playfield { get; } - internal EditDrawableRuleset() + internal DrawableEditRuleset() { RelativeSizeAxes = Axes.Both; } @@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Edit internal abstract DrawableHitObject Remove(HitObject hitObject); } - public class EditDrawableRuleset : EditDrawableRuleset + public class DrawableEditRuleset : DrawableEditRuleset where TObject : HitObject { public override Playfield Playfield => drawableRuleset.Playfield; @@ -48,7 +48,7 @@ namespace osu.Game.Rulesets.Edit private readonly DrawableRuleset drawableRuleset; - public EditDrawableRuleset(DrawableRuleset drawableRuleset) + public DrawableEditRuleset(DrawableRuleset drawableRuleset) { this.drawableRuleset = drawableRuleset; diff --git a/osu.Game/Rulesets/Edit/HitObjectComposer.cs b/osu.Game/Rulesets/Edit/HitObjectComposer.cs index c95d6c3f0a..45bf9b8be7 100644 --- a/osu.Game/Rulesets/Edit/HitObjectComposer.cs +++ b/osu.Game/Rulesets/Edit/HitObjectComposer.cs @@ -34,7 +34,7 @@ namespace osu.Game.Rulesets.Edit private readonly List layerContainers = new List(); - protected EditDrawableRuleset DrawableRuleset { get; private set; } + protected DrawableEditRuleset DrawableRuleset { get; private set; } private BlueprintContainer blueprintContainer; @@ -160,7 +160,7 @@ namespace osu.Game.Rulesets.Edit public void Remove(HitObject hitObject) => blueprintContainer.RemoveBlueprintFor(DrawableRuleset.Remove(hitObject)); - internal abstract EditDrawableRuleset CreateDrawableRuleset(); + internal abstract DrawableEditRuleset CreateDrawableRuleset(); protected abstract IReadOnlyList CompositionTools { get; } @@ -189,8 +189,8 @@ namespace osu.Game.Rulesets.Edit { } - internal override EditDrawableRuleset CreateDrawableRuleset() - => new EditDrawableRuleset(CreateDrawableRuleset(Ruleset, Beatmap.Value)); + internal override DrawableEditRuleset CreateDrawableRuleset() + => new DrawableEditRuleset(CreateDrawableRuleset(Ruleset, Beatmap.Value)); protected abstract DrawableRuleset CreateDrawableRuleset(Ruleset ruleset, WorkingBeatmap beatmap); } diff --git a/osu.Game/Screens/Play/HUDOverlay.cs b/osu.Game/Screens/Play/HUDOverlay.cs index def9a97c7e..285e6eab23 100644 --- a/osu.Game/Screens/Play/HUDOverlay.cs +++ b/osu.Game/Screens/Play/HUDOverlay.cs @@ -149,7 +149,7 @@ namespace osu.Game.Screens.Play replayLoaded.BindTo(drawableRuleset.HasReplayLoaded); - Progress.BindRulestContainer(drawableRuleset); + Progress.BindDrawableRuleset(drawableRuleset); } protected override bool OnKeyDown(KeyDownEvent e) diff --git a/osu.Game/Screens/Play/SongProgress.cs b/osu.Game/Screens/Play/SongProgress.cs index e94652b795..94b25e04a3 100644 --- a/osu.Game/Screens/Play/SongProgress.cs +++ b/osu.Game/Screens/Play/SongProgress.cs @@ -109,7 +109,7 @@ namespace osu.Game.Screens.Play replayLoaded.TriggerChange(); } - public void BindRulestContainer(DrawableRuleset drawableRuleset) + public void BindDrawableRuleset(DrawableRuleset drawableRuleset) { replayLoaded.BindTo(drawableRuleset.HasReplayLoaded); } From c186629b8a2971ba08be2dfd5cb4e55701d83dbb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Mar 2019 14:55:38 +0900 Subject: [PATCH 050/107] Reorder class --- osu.Game/Rulesets/UI/DrawableRuleset.cs | 157 ++++++++++++------------ 1 file changed, 80 insertions(+), 77 deletions(-) diff --git a/osu.Game/Rulesets/UI/DrawableRuleset.cs b/osu.Game/Rulesets/UI/DrawableRuleset.cs index 77723ba765..abf0fb2696 100644 --- a/osu.Game/Rulesets/UI/DrawableRuleset.cs +++ b/osu.Game/Rulesets/UI/DrawableRuleset.cs @@ -58,22 +58,40 @@ namespace osu.Game.Rulesets.UI /// /// Place to put drawables above hit objects but below UI. /// - public Container Overlays { get; protected set; } + public Container Overlays { get; private set; } - public override CursorContainer Cursor => Playfield.Cursor; + /// + /// Invoked when a has been applied by a . + /// + public event Action OnNewResult; - public bool ProvidingUserCursor => Playfield.Cursor != null && !HasReplayLoaded.Value; + /// + /// Invoked when a is being reverted by a . + /// + public event Action OnRevertResult; - protected override bool OnHover(HoverEvent e) => true; // required for IProvideCursor + /// + /// The beatmap. + /// + public Beatmap Beatmap; + + public override IEnumerable Objects => Beatmap.HitObjects; protected IRulesetConfigManager Config { get; private set; } + /// + /// The mods which are to be applied. + /// + private readonly IEnumerable mods; + + private FrameStabilityContainer frameStabilityContainer; + private OnScreenDisplay onScreenDisplay; /// /// Creates a ruleset visualisation for the provided ruleset and beatmap. /// - /// The ruleset being repesented. + /// The ruleset being represented. /// The beatmap to create the hit renderer for. protected DrawableRuleset(Ruleset ruleset, WorkingBeatmap workingBeatmap) : base(ruleset) @@ -99,20 +117,42 @@ namespace osu.Game.Rulesets.UI }; } - public override void SetReplayScore(Score replayScore) + protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) { - if (!(KeyBindingInputManager is IHasReplayHandler replayInputManager)) - throw new InvalidOperationException($"A {nameof(KeyBindingInputManager)} which supports replay loading is not available"); + var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); - var handler = (ReplayScore = replayScore) != null ? CreateReplayInputHandler(replayScore.Replay) : null; + onScreenDisplay = dependencies.Get(); - replayInputManager.ReplayInputHandler = handler; - frameStabilityContainer.ReplayInputHandler = handler; + Config = dependencies.Get().GetConfigFor(Ruleset); + if (Config != null) + { + dependencies.Cache(Config); + onScreenDisplay?.BeginTracking(this, Config); + } - HasReplayLoaded.Value = replayInputManager.ReplayInputHandler != null; + return dependencies; + } - if (replayInputManager.ReplayInputHandler != null) - replayInputManager.ReplayInputHandler.GamefieldToScreenSpace = Playfield.GamefieldToScreenSpace; + [BackgroundDependencyLoader] + private void load(OsuConfigManager config) + { + KeyBindingInputManager.AddRange(new Drawable[] + { + Playfield + }); + + InternalChildren = new Drawable[] + { + frameStabilityContainer = new FrameStabilityContainer + { + Child = KeyBindingInputManager, + }, + Overlays = new Container { RelativeSizeAxes = Axes.Both } + }; + + applyRulesetMods(mods, config); + + loadObjects(); } /// @@ -146,6 +186,22 @@ namespace osu.Game.Rulesets.UI Playfield.Add(drawableObject); } + public override void SetReplayScore(Score replayScore) + { + if (!(KeyBindingInputManager is IHasReplayHandler replayInputManager)) + throw new InvalidOperationException($"A {nameof(KeyBindingInputManager)} which supports replay loading is not available"); + + var handler = (ReplayScore = replayScore) != null ? CreateReplayInputHandler(replayScore.Replay) : null; + + replayInputManager.ReplayInputHandler = handler; + frameStabilityContainer.ReplayInputHandler = handler; + + HasReplayLoaded.Value = replayInputManager.ReplayInputHandler != null; + + if (replayInputManager.ReplayInputHandler != null) + replayInputManager.ReplayInputHandler.GamefieldToScreenSpace = Playfield.GamefieldToScreenSpace; + } + /// /// Creates a DrawableHitObject from a HitObject. /// @@ -156,22 +212,6 @@ namespace osu.Game.Rulesets.UI public void Attach(KeyCounterCollection keyCounter) => (KeyBindingInputManager as ICanAttachKeyCounter)?.Attach(keyCounter); - protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) - { - var dependencies = new DependencyContainer(base.CreateChildDependencies(parent)); - - onScreenDisplay = dependencies.Get(); - - Config = dependencies.Get().GetConfigFor(Ruleset); - if (Config != null) - { - dependencies.Cache(Config); - onScreenDisplay?.BeginTracking(this, Config); - } - - return dependencies; - } - /// /// Creates a key conversion input manager. An exception will be thrown if a valid is not returned. /// @@ -180,61 +220,14 @@ namespace osu.Game.Rulesets.UI protected virtual ReplayInputHandler CreateReplayInputHandler(Replay replay) => null; - private FrameStabilityContainer frameStabilityContainer; - /// /// Creates a Playfield. /// /// The Playfield. protected abstract Playfield CreatePlayfield(); - /// - /// Invoked when a has been applied by a . - /// - public event Action OnNewResult; - - /// - /// Invoked when a is being reverted by a . - /// - public event Action OnRevertResult; - - /// - /// The beatmap. - /// - public Beatmap Beatmap; - - public override IEnumerable Objects => Beatmap.HitObjects; - - /// - /// The mods which are to be applied. - /// - private readonly IEnumerable mods; - public override ScoreProcessor CreateScoreProcessor() => new ScoreProcessor(this); - [BackgroundDependencyLoader] - private void load(OsuConfigManager config) - { - KeyBindingInputManager.AddRange(new Drawable[] - { - Playfield - }); - - InternalChildren = new Drawable[] - { - frameStabilityContainer = new FrameStabilityContainer - { - Child = KeyBindingInputManager, - }, - Overlays = new Container { RelativeSizeAxes = Axes.Both } - }; - - // Apply mods - applyRulesetMods(mods, config); - - loadObjects(); - } - /// /// Applies the active mods to the Beatmap. /// @@ -264,6 +257,16 @@ namespace osu.Game.Rulesets.UI mod.ReadFromConfig(config); } + #region IProvideCursor + + protected override bool OnHover(HoverEvent e) => true; // required for IProvideCursor + + public override CursorContainer Cursor => Playfield.Cursor; + + public bool ProvidingUserCursor => Playfield.Cursor != null && !HasReplayLoaded.Value; + + #endregion + protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); From 86658e357bae27c4c9559227c135301a85d50319 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Mar 2019 14:55:52 +0900 Subject: [PATCH 051/107] Override add instead --- .../Graphics/Containers/UserDimContainer.cs | 22 ++++++++----------- .../Backgrounds/BackgroundScreenBeatmap.cs | 1 - 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index d68f607dcd..22b0175a94 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -55,8 +55,6 @@ namespace osu.Game.Graphics.Containers ? new Vector2(BlurAmount.Value + (float)blurLevel.Value * 25) : new Vector2(BlurAmount.Value); - private Background background => DimContainer.Children.OfType().FirstOrDefault(); - /// /// Creates a new . /// @@ -72,15 +70,13 @@ namespace osu.Game.Graphics.Containers AddInternal(DimContainer = new Container { RelativeSizeAxes = Axes.Both }); } - /// - /// Set the blur of the background in this UserDimContainer to our blur target instantly. - /// - /// - /// We need to support instant blurring here in the case of changing beatmap backgrounds, where blurring shouldn't be from 0 every time the beatmap is changed. - /// - public void ApplyInstantBlur() + public override void Add(Drawable drawable) { - background?.BlurTo(blurTarget, 0, Easing.OutQuint); + // We need to blur instantly here in the case of changing beatmap backgrounds, where blurring shouldn't be from 0 every time the beatmap is changed. + if (drawable is Background b) + b.BlurTo(blurTarget, 0, Easing.OutQuint); + + base.Add(drawable); } [BackgroundDependencyLoader] @@ -114,10 +110,10 @@ namespace osu.Game.Graphics.Containers // 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); - // Only blur if this container contains a background + // This only works if the background is a direct child of DimContainer. // We can't blur the container like we did with the dim because buffered containers add considerable draw overhead. - // As a result, this blurs the background directly. - background?.BlurTo(blurTarget, background_fade_duration, Easing.OutQuint); + // As a result, this blurs the background directly via the direct children of DimContainer. + DimContainer.Children.OfType().FirstOrDefault()?.BlurTo(blurTarget, 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 8b04b545f5..111cc9d2c1 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -86,7 +86,6 @@ namespace osu.Game.Screens.Backgrounds b.Depth = newDepth; fadeContainer.Add(Background = b); - fadeContainer.ApplyInstantBlur(); StoryboardReplacesBackground.BindTo(fadeContainer.StoryboardReplacesBackground); } From 2467ece0205dc2b4827269c370892556bddd1ec9 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Mar 2019 14:58:32 +0900 Subject: [PATCH 052/107] store a field --- osu.Game/Graphics/Containers/UserDimContainer.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index 22b0175a94..61129b43af 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Linq; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -55,6 +54,8 @@ namespace osu.Game.Graphics.Containers ? new Vector2(BlurAmount.Value + (float)blurLevel.Value * 25) : new Vector2(BlurAmount.Value); + private Background background; + /// /// Creates a new . /// @@ -74,7 +75,10 @@ namespace osu.Game.Graphics.Containers { // We need to blur instantly here in the case of changing beatmap backgrounds, where blurring shouldn't be from 0 every time the beatmap is changed. if (drawable is Background b) + { + background = b; b.BlurTo(blurTarget, 0, Easing.OutQuint); + } base.Add(drawable); } @@ -113,7 +117,7 @@ namespace osu.Game.Graphics.Containers // This only works if the background is a direct child of DimContainer. // We can't blur the container like we did with the dim because buffered containers add considerable draw overhead. // As a result, this blurs the background directly via the direct children of DimContainer. - DimContainer.Children.OfType().FirstOrDefault()?.BlurTo(blurTarget, background_fade_duration, Easing.OutQuint); + background?.BlurTo(blurTarget, background_fade_duration, Easing.OutQuint); } DimContainer.FadeColour(EnableUserDim.Value ? OsuColour.Gray(1 - (float)dimLevel.Value) : Color4.White, background_fade_duration, Easing.OutQuint); From f670e4664dd8f1dafd4fa1e38093b17f5106ba90 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Mar 2019 15:06:07 +0900 Subject: [PATCH 053/107] Amend comment --- 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 61129b43af..beb9653b71 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -73,7 +73,7 @@ namespace osu.Game.Graphics.Containers public override void Add(Drawable drawable) { - // We need to blur instantly here in the case of changing beatmap backgrounds, where blurring shouldn't be from 0 every time the beatmap is changed. + // Make sure we're already at the correct blur target when a background is added to the container. if (drawable is Background b) { background = b; From 1086688e0ad8505efeee32c74a1a6221a7b18d29 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Mar 2019 15:13:59 +0900 Subject: [PATCH 054/107] Fix variable hiding --- .../Screens/Backgrounds/BackgroundScreenDefault.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs index 7697b9959e..7092ac0c4a 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenDefault.cs @@ -58,16 +58,16 @@ namespace osu.Game.Screens.Backgrounds private Background createBackground() { - Background background; + Background newBackground; if (user.Value?.IsSupporter ?? false) - background = new SkinnedBackground(skin.Value, backgroundName); + newBackground = new SkinnedBackground(skin.Value, backgroundName); else - background = new Background(backgroundName); + newBackground = new Background(backgroundName); - background.Depth = currentDisplay; + newBackground.Depth = currentDisplay; - return background; + return newBackground; } private class SkinnedBackground : Background From 6df275c83a4692a63205a84eb54bd8232e79da2d Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Thu, 14 Mar 2019 23:39:45 +0900 Subject: [PATCH 055/107] Use fresh mods for each difficulty calculation iteration --- osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs | 6 ++++-- osu.Game/Rulesets/Mods/Mod.cs | 5 +++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index db8bdde6bb..f31cce3c5f 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -37,6 +37,8 @@ namespace osu.Game.Rulesets.Difficulty /// A structure describing the difficulty of the beatmap. public DifficultyAttributes Calculate(params Mod[] mods) { + mods = mods.Select(m => m.CreateCopy()).ToArray(); + beatmap.Mods.Value = mods; IBeatmap playableBeatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo); @@ -55,9 +57,9 @@ namespace osu.Game.Rulesets.Difficulty foreach (var combination in CreateDifficultyAdjustmentModCombinations()) { if (combination is MultiMod multi) - yield return Calculate(multi.Mods); + yield return Calculate(multi.Mods.Select(m => m.CreateCopy()).ToArray()); else - yield return Calculate(combination); + yield return Calculate(combination.CreateCopy()); } } diff --git a/osu.Game/Rulesets/Mods/Mod.cs b/osu.Game/Rulesets/Mods/Mod.cs index 705c5c4ef6..1f9907caa7 100644 --- a/osu.Game/Rulesets/Mods/Mod.cs +++ b/osu.Game/Rulesets/Mods/Mod.cs @@ -65,5 +65,10 @@ namespace osu.Game.Rulesets.Mods /// [JsonIgnore] public virtual Type[] IncompatibleMods => new Type[] { }; + + /// + /// Creates a copy of this initialised to a default state. + /// + public virtual Mod CreateCopy() => (Mod)Activator.CreateInstance(GetType()); } } From c510385aa815cb69b57b4c2873709002bd45f57a Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Wed, 20 Mar 2019 16:46:16 +0900 Subject: [PATCH 056/107] Remove unnecessary allocations --- osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs index f31cce3c5f..aad55f8a38 100644 --- a/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs +++ b/osu.Game/Rulesets/Difficulty/DifficultyCalculator.cs @@ -57,9 +57,9 @@ namespace osu.Game.Rulesets.Difficulty foreach (var combination in CreateDifficultyAdjustmentModCombinations()) { if (combination is MultiMod multi) - yield return Calculate(multi.Mods.Select(m => m.CreateCopy()).ToArray()); + yield return Calculate(multi.Mods); else - yield return Calculate(combination.CreateCopy()); + yield return Calculate(combination); } } From e9034c8a30bbd4b0b412f04d9a1d055b804bf7e6 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Mar 2019 16:50:47 +0900 Subject: [PATCH 057/107] Move blurring logic into Update instead --- osu.Game/Screens/Play/PlayerLoader.cs | 56 ++++++++++++--------------- 1 file changed, 25 insertions(+), 31 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 86156e292c..a2d433107b 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -2,13 +2,11 @@ // See the LICENCE file in the repository root for full licence text. using System; -using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; -using osu.Framework.Input.Events; using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Framework.Threading; @@ -41,6 +39,8 @@ namespace osu.Game.Screens.Play public override bool DisallowExternalBeatmapRulesetChanges => true; + public override bool HandlePositionalInput => true; + private Task loadTask; public PlayerLoader(Func createPlayer) @@ -158,35 +158,6 @@ namespace osu.Game.Screens.Play private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && GetContainingInputManager()?.DraggedDrawable == null; - protected override bool OnHover(HoverEvent e) - { - // Acts as an "on hover lost" trigger for the visual settings panel. - // Returns background dim and blur to the values specified by PlayerLoader. - if (this.IsCurrentScreen()) - { - Background.BlurAmount.Value = BACKGROUND_BLUR; - Background.EnableUserDim.Value = false; - } - - return base.OnHover(e); - } - - protected override void OnHoverLost(HoverLostEvent e) - { - // Acts as an "on hover" trigger for the visual settings panel. - // Preview user-defined background dim and blur when hovered on the visual settings panel. - if (GetContainingInputManager()?.HoveredDrawables.Contains(VisualSettings) == true) - { - if (this.IsCurrentScreen() && Background != null) - { - Background.BlurAmount.Value = 0; - Background.EnableUserDim.Value = true; - } - } - - base.OnHoverLost(e); - } - private void pushWhenLoaded() { if (!this.IsCurrentScreen()) return; @@ -267,6 +238,29 @@ namespace osu.Game.Screens.Play } } + protected override void Update() + { + base.Update(); + + if (!this.IsCurrentScreen()) + return; + + if (Background.BlurAmount.Value != 0 && VisualSettings.IsHovered) + { + // Acts as an "on hover" trigger for the visual settings panel. + // Preview user-defined background dim and blur when hovered on the visual settings panel. + Background.EnableUserDim.Value = true; + Background.BlurAmount.Value = 0; + } + else if (Background.BlurAmount.Value != BACKGROUND_BLUR && !VisualSettings.IsHovered) + { + // Acts as an "on hover lost" trigger for the visual settings panel. + // Returns background dim and blur to the values specified by PlayerLoader. + Background.EnableUserDim.Value = false; + Background.BlurAmount.Value = BACKGROUND_BLUR; + } + } + private class BeatmapMetadataDisplay : Container { private class MetadataLine : Container From a5916f995eb2e9814ef2faa02d11cfc7e8293fa1 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Mar 2019 16:54:42 +0900 Subject: [PATCH 058/107] Use the previous conditional instead --- osu.Game/Screens/Play/PlayerLoader.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index a2d433107b..68335f96ce 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -2,6 +2,7 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Linq; using System.Threading.Tasks; using osu.Framework.Allocation; using osu.Framework.Graphics; @@ -245,14 +246,14 @@ namespace osu.Game.Screens.Play if (!this.IsCurrentScreen()) return; - if (Background.BlurAmount.Value != 0 && VisualSettings.IsHovered) + if (GetContainingInputManager()?.HoveredDrawables.Contains(VisualSettings) == true) { // Acts as an "on hover" trigger for the visual settings panel. // Preview user-defined background dim and blur when hovered on the visual settings panel. Background.EnableUserDim.Value = true; Background.BlurAmount.Value = 0; } - else if (Background.BlurAmount.Value != BACKGROUND_BLUR && !VisualSettings.IsHovered) + else { // Acts as an "on hover lost" trigger for the visual settings panel. // Returns background dim and blur to the values specified by PlayerLoader. From fbfef844de0e7ba250a08fee75a1780fd7605e84 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Mar 2019 17:18:42 +0900 Subject: [PATCH 059/107] Add test case for resuming PlayerLoader --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 20 +++++++++++++++++++ osu.Game/Screens/Play/PlayerLoader.cs | 2 -- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 084bb6a02e..193bc9fb08 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -223,6 +223,26 @@ namespace osu.Game.Tests.Visual AddAssert("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.IsBlurCorrect()); } + /// + /// Check if hovering on the visual settings dialogue after resuming from player still previews the background dim. + /// + [Test] + public void ResumeFromPlayerTest() + { + performFullSetup(); + AddStep("Move mouse to Visual Settings", () => InputManager.MoveMouseTo(playerLoader.VisualSettingsPos)); + AddStep("Resume PlayerLoader", () => + { + player.ValidForResume = false; + player.RestartRequested?.Invoke(); + player.Exit(); + }); + waitForDim(); + AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied()); + AddStep("Move mouse to center of screen", () => InputManager.MoveMouseTo(playerLoader.ScreenPos)); + AddAssert("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && playerLoader.IsBlurCorrect()); + } + private void waitForDim() => AddWaitStep("Wait for dim", 5); private void createFakeStoryboard() => AddStep("Create storyboard", () => diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 68335f96ce..92ff57b799 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -211,8 +211,6 @@ namespace osu.Game.Screens.Play public override void OnSuspending(IScreen next) { - Background.EnableUserDim.Value = true; - base.OnSuspending(next); cancelLoad(); } From b5e8eb2a4a55a27f431c73bba5c549283d9e55df Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Mar 2019 17:31:06 +0900 Subject: [PATCH 060/107] Wait for dim --- 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 193bc9fb08..5f5d84af42 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -240,6 +240,7 @@ namespace osu.Game.Tests.Visual waitForDim(); AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied()); AddStep("Move mouse to center of screen", () => InputManager.MoveMouseTo(playerLoader.ScreenPos)); + waitForDim(); AddAssert("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && playerLoader.IsBlurCorrect()); } From 7254b765b0e5e768473a3b0baf662cc1510c7d4f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Mar 2019 19:26:24 +0900 Subject: [PATCH 061/107] Fix gameplay cursor showing in editor --- osu.Game.Rulesets.Osu/Edit/DrawableOsuEditRuleset.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditRuleset.cs b/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditRuleset.cs index 50b3eabcf4..1a6e78d918 100644 --- a/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditRuleset.cs +++ b/osu.Game.Rulesets.Osu/Edit/DrawableOsuEditRuleset.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.Graphics.Cursor; using osu.Game.Beatmaps; using osu.Game.Rulesets.Osu.UI; using osu.Game.Rulesets.UI; @@ -19,10 +20,7 @@ namespace osu.Game.Rulesets.Osu.Edit private class OsuPlayfieldNoCursor : OsuPlayfield { - public OsuPlayfieldNoCursor() - { - Cursor?.Expire(); - } + protected override CursorContainer CreateCursor() => null; } } } From 9013afe41243aaee9e13e6646661e3821fc50d02 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Mar 2019 19:35:40 +0900 Subject: [PATCH 062/107] Query for input manager once --- osu.Game/Screens/Play/PlayerLoader.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 92ff57b799..da51e25b4e 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -8,6 +8,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; +using osu.Framework.Input; using osu.Framework.Localisation; using osu.Framework.Screens; using osu.Framework.Threading; @@ -44,6 +45,8 @@ namespace osu.Game.Screens.Play private Task loadTask; + private InputManager inputManager; + public PlayerLoader(Func createPlayer) { this.createPlayer = createPlayer; @@ -203,6 +206,12 @@ namespace osu.Game.Screens.Play } } + protected override void LoadComplete() + { + inputManager = GetContainingInputManager(); + base.LoadComplete(); + } + private void cancelLoad() { pushDebounce?.Cancel(); @@ -244,7 +253,7 @@ namespace osu.Game.Screens.Play if (!this.IsCurrentScreen()) return; - if (GetContainingInputManager()?.HoveredDrawables.Contains(VisualSettings) == true) + if (inputManager.HoveredDrawables.Contains(VisualSettings)) { // Acts as an "on hover" trigger for the visual settings panel. // Preview user-defined background dim and blur when hovered on the visual settings panel. From 18de9e51c51c4f5b83e8a11cada9288b6e0af09b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Mar 2019 19:38:53 +0900 Subject: [PATCH 063/107] Formatting and naming improvements --- .../Graphics/Containers/UserDimContainer.cs | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index beb9653b71..c790d6777d 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -38,9 +38,9 @@ namespace osu.Game.Graphics.Containers /// public readonly Bindable BlurAmount = new Bindable(); - private Bindable dimLevel { get; set; } + private Bindable userDimLevel { get; set; } - private Bindable blurLevel { get; set; } + private Bindable userBlurLevel { get; set; } private Bindable showStoryboard { get; set; } @@ -51,7 +51,7 @@ namespace osu.Game.Graphics.Containers private readonly bool isStoryboard; private Vector2 blurTarget => EnableUserDim.Value - ? new Vector2(BlurAmount.Value + (float)blurLevel.Value * 25) + ? new Vector2(BlurAmount.Value + (float)userBlurLevel.Value * 25) : new Vector2(BlurAmount.Value); private Background background; @@ -77,7 +77,7 @@ namespace osu.Game.Graphics.Containers if (drawable is Background b) { background = b; - b.BlurTo(blurTarget, 0, Easing.OutQuint); + background.BlurTo(blurTarget, 0, Easing.OutQuint); } base.Add(drawable); @@ -86,12 +86,13 @@ namespace osu.Game.Graphics.Containers [BackgroundDependencyLoader] private void load(OsuConfigManager config) { - dimLevel = config.GetBindable(OsuSetting.DimLevel); - blurLevel = config.GetBindable(OsuSetting.BlurLevel); + userDimLevel = config.GetBindable(OsuSetting.DimLevel); + userBlurLevel = config.GetBindable(OsuSetting.BlurLevel); showStoryboard = config.GetBindable(OsuSetting.ShowStoryboard); + EnableUserDim.ValueChanged += _ => updateVisuals(); - dimLevel.ValueChanged += _ => updateVisuals(); - blurLevel.ValueChanged += _ => updateVisuals(); + userDimLevel.ValueChanged += _ => updateVisuals(); + userBlurLevel.ValueChanged += _ => updateVisuals(); showStoryboard.ValueChanged += _ => updateVisuals(); StoryboardReplacesBackground.ValueChanged += _ => updateVisuals(); BlurAmount.ValueChanged += _ => updateVisuals(); @@ -107,7 +108,7 @@ 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 || userDimLevel.Value == 1 ? 0 : 1, background_fade_duration, Easing.OutQuint); } else { @@ -120,7 +121,7 @@ namespace osu.Game.Graphics.Containers background?.BlurTo(blurTarget, 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)userDimLevel.Value) : Color4.White, background_fade_duration, Easing.OutQuint); } } } From cda5bc28c8a0104ceb845f22a47b79e28633bb88 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Mar 2019 19:41:20 +0900 Subject: [PATCH 064/107] Add proper comment --- osu.Game/Screens/Play/PlayerLoader.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index da51e25b4e..50816a873f 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -253,16 +253,16 @@ namespace osu.Game.Screens.Play if (!this.IsCurrentScreen()) return; + // We need to perform this check here rather than in OnHover as any number of children of VisualSettings + // may also be handling the hover events. if (inputManager.HoveredDrawables.Contains(VisualSettings)) { - // Acts as an "on hover" trigger for the visual settings panel. // Preview user-defined background dim and blur when hovered on the visual settings panel. Background.EnableUserDim.Value = true; Background.BlurAmount.Value = 0; } else { - // Acts as an "on hover lost" trigger for the visual settings panel. // Returns background dim and blur to the values specified by PlayerLoader. Background.EnableUserDim.Value = false; Background.BlurAmount.Value = BACKGROUND_BLUR; From 8543e8c36f5416aab16b0ad9a4b2fc008d4ecbd6 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Mar 2019 19:42:39 +0900 Subject: [PATCH 065/107] Put loadcomplete next to other protected overrides --- osu.Game/Screens/Play/PlayerLoader.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index da51e25b4e..ed8adc0e5f 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -157,6 +157,12 @@ namespace osu.Game.Screens.Play logo.Delay(resuming ? 0 : 500).MoveToOffset(new Vector2(0, -0.24f), 500, Easing.InOutExpo); } + protected override void LoadComplete() + { + inputManager = GetContainingInputManager(); + base.LoadComplete(); + } + private ScheduledDelegate pushDebounce; protected VisualSettings VisualSettings; @@ -206,12 +212,6 @@ namespace osu.Game.Screens.Play } } - protected override void LoadComplete() - { - inputManager = GetContainingInputManager(); - base.LoadComplete(); - } - private void cancelLoad() { pushDebounce?.Cancel(); From 01f795b0464757dec7e2f7edd57fc8c7025bd24f Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Mar 2019 19:45:04 +0900 Subject: [PATCH 066/107] Make restart public rather than reimplementing --- osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs | 7 +------ osu.Game/Screens/Play/Player.cs | 8 ++++---- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 5f5d84af42..6f7d465cfe 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -231,12 +231,7 @@ namespace osu.Game.Tests.Visual { performFullSetup(); AddStep("Move mouse to Visual Settings", () => InputManager.MoveMouseTo(playerLoader.VisualSettingsPos)); - AddStep("Resume PlayerLoader", () => - { - player.ValidForResume = false; - player.RestartRequested?.Invoke(); - player.Exit(); - }); + AddStep("Resume PlayerLoader", () => player.Restart()); waitForDim(); AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied()); AddStep("Move mouse to center of screen", () => InputManager.MoveMouseTo(playerLoader.ScreenPos)); diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 1ce8bf559d..7071841722 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -112,7 +112,7 @@ namespace osu.Game.Screens.Play PausableGameplayContainer = new PausableGameplayContainer { Retries = RestartCount, - OnRetry = restart, + OnRetry = Restart, OnQuit = performUserRequestedExit, Start = gameplayClockContainer.Start, Stop = gameplayClockContainer.Stop, @@ -154,7 +154,7 @@ namespace osu.Game.Screens.Play }, failOverlay = new FailOverlay { - OnRetry = restart, + OnRetry = Restart, OnQuit = performUserRequestedExit, }, new HotkeyRetryOverlay @@ -164,7 +164,7 @@ namespace osu.Game.Screens.Play if (!this.IsCurrentScreen()) return; fadeOut(true); - restart(); + Restart(); }, } }; @@ -235,7 +235,7 @@ namespace osu.Game.Screens.Play this.Exit(); } - private void restart() + public void Restart() { if (!this.IsCurrentScreen()) return; From 2ff7aa6c2e448d36800ea6584b7256b79eee8c2a Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Mar 2019 19:49:37 +0900 Subject: [PATCH 067/107] Remove handle positional input --- osu.Game/Screens/Play/PlayerLoader.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 7163e95816..902764faa5 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -41,8 +41,6 @@ namespace osu.Game.Screens.Play public override bool DisallowExternalBeatmapRulesetChanges => true; - public override bool HandlePositionalInput => true; - private Task loadTask; private InputManager inputManager; From 2e9d823af47cb247c7b320729f38100afa6ca0f4 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 20 Mar 2019 19:59:54 +0900 Subject: [PATCH 068/107] Add comment regarding HandlePositionalInput --- osu.Game/Screens/Play/PlayerLoader.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 902764faa5..299fc2d299 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -164,6 +164,9 @@ namespace osu.Game.Screens.Play private ScheduledDelegate pushDebounce; protected VisualSettings VisualSettings; + // HandlePositionalInput is being set to true here because IsHovered will not update unless we do so. + public override bool HandlePositionalInput => true; + private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && GetContainingInputManager()?.DraggedDrawable == null; private void pushWhenLoaded() From 8865d539923efcb1be11d3e141593f9fd87b28cd Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Mar 2019 20:04:07 +0900 Subject: [PATCH 069/107] Reword comment --- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 299fc2d299..9eebce4888 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -164,7 +164,7 @@ namespace osu.Game.Screens.Play private ScheduledDelegate pushDebounce; protected VisualSettings VisualSettings; - // HandlePositionalInput is being set to true here because IsHovered will not update unless we do so. + // required for IsHovered usage in readyForPush public override bool HandlePositionalInput => true; private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && GetContainingInputManager()?.DraggedDrawable == null; From ba89bfee0c195e5368545ee85a5f2b7da4f02422 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Mar 2019 20:12:46 +0900 Subject: [PATCH 070/107] Define explicit method to add background Also cleans up some redundant/misplaced comments. --- .../Graphics/Containers/UserDimContainer.cs | 27 ++++++++++++------- .../Backgrounds/BackgroundScreenBeatmap.cs | 2 +- osu.Game/Screens/Play/PlayerLoader.cs | 2 +- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index c790d6777d..18a45dd0cd 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -50,12 +51,13 @@ namespace osu.Game.Graphics.Containers private readonly bool isStoryboard; + /// + /// As an optimisation, we add the two blur portions to be applied rather than actually applying two separate blurs. + /// private Vector2 blurTarget => EnableUserDim.Value ? new Vector2(BlurAmount.Value + (float)userBlurLevel.Value * 25) : new Vector2(BlurAmount.Value); - private Background background; - /// /// Creates a new . /// @@ -71,14 +73,22 @@ namespace osu.Game.Graphics.Containers AddInternal(DimContainer = new Container { RelativeSizeAxes = Axes.Both }); } - public override void Add(Drawable drawable) + private Background background; + + public Background Background { - // Make sure we're already at the correct blur target when a background is added to the container. - if (drawable is Background b) + get => background; + set { - background = b; + background = value; background.BlurTo(blurTarget, 0, Easing.OutQuint); } + } + + public override void Add(Drawable drawable) + { + if (drawable is Background) + throw new InvalidOperationException($"Use {nameof(Background)} to set a background."); base.Add(drawable); } @@ -115,10 +125,7 @@ namespace osu.Game.Graphics.Containers // 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); - // This only works if the background is a direct child of DimContainer. - // We can't blur the container like we did with the dim because buffered containers add considerable draw overhead. - // As a result, this blurs the background directly via the direct children of DimContainer. - background?.BlurTo(blurTarget, background_fade_duration, Easing.OutQuint); + Background?.BlurTo(blurTarget, background_fade_duration, Easing.OutQuint); } DimContainer.FadeColour(EnableUserDim.Value ? OsuColour.Gray(1 - (float)userDimLevel.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 111cc9d2c1..6df418753c 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -85,7 +85,7 @@ namespace osu.Game.Screens.Backgrounds } b.Depth = newDepth; - fadeContainer.Add(Background = b); + fadeContainer.Background = Background = b; StoryboardReplacesBackground.BindTo(fadeContainer.StoryboardReplacesBackground); } diff --git a/osu.Game/Screens/Play/PlayerLoader.cs b/osu.Game/Screens/Play/PlayerLoader.cs index 9eebce4888..e9ee5d3fa8 100644 --- a/osu.Game/Screens/Play/PlayerLoader.cs +++ b/osu.Game/Screens/Play/PlayerLoader.cs @@ -164,7 +164,7 @@ namespace osu.Game.Screens.Play private ScheduledDelegate pushDebounce; protected VisualSettings VisualSettings; - // required for IsHovered usage in readyForPush + // Hhere because IsHovered will not update unless we do so. public override bool HandlePositionalInput => true; private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && GetContainingInputManager()?.DraggedDrawable == null; From 298c98871d663d8f1d3ed3ad65c65c67b079f56b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Mar 2019 20:18:08 +0900 Subject: [PATCH 071/107] Actually add the background --- 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 18a45dd0cd..b078f40420 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -80,7 +80,7 @@ namespace osu.Game.Graphics.Containers get => background; set { - background = value; + base.Add(background = value); background.BlurTo(blurTarget, 0, Easing.OutQuint); } } From 6a7ab6a0010fd9534d92b17735280750d82c57d4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Mar 2019 20:47:25 +0900 Subject: [PATCH 072/107] Do less import work in [SetUp] step --- .../Visual/TestCaseBackgroundScreenBeatmap.cs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index 6f7d465cfe..8636e7721e 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -74,21 +74,17 @@ namespace osu.Game.Tests.Visual Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, null, host, Beatmap.Default)); Dependencies.Cache(new OsuConfigManager(LocalStorage)); + manager.Import(TestResources.GetTestBeatmapForImport()); + Beatmap.SetDefault(); } [SetUp] - public virtual void SetUp() + public virtual void SetUp() => Schedule(() => { - Schedule(() => - { - manager.Delete(manager.GetAllUsableBeatmapSets()); - var temp = TestResources.GetTestBeatmapForImport(); - manager.Import(temp); - Child = screenStackContainer = new ScreenStackCacheContainer { RelativeSizeAxes = Axes.Both }; - screenStackContainer.ScreenStack.Push(songSelect = new DummySongSelect()); - }); - } + Child = screenStackContainer = new ScreenStackCacheContainer { RelativeSizeAxes = Axes.Both }; + screenStackContainer.ScreenStack.Push(songSelect = new DummySongSelect()); + }); /// /// Check if properly triggers the visual settings preview when a user hovers over the visual settings panel. From c555019692ec11fb24fa7e5258b819b69716ffe4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 20 Mar 2019 22:50:50 +0900 Subject: [PATCH 073/107] 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 c02207702c..d8561770fd 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 2633da77b3..3dcb647cd2 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From b17c5c0bb317e67dacfa35e74827f6c8591601a6 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Mar 2019 16:11:44 +0900 Subject: [PATCH 074/107] Add more tests for exitability --- osu.Game.Tests/Visual/TestCasePause.cs | 31 +++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCasePause.cs b/osu.Game.Tests/Visual/TestCasePause.cs index 834b5e8ef1..8fcf6164a4 100644 --- a/osu.Game.Tests/Visual/TestCasePause.cs +++ b/osu.Game.Tests/Visual/TestCasePause.cs @@ -43,17 +43,40 @@ namespace osu.Game.Tests.Visual AddAssert("pause overlay hidden", () => !Player.PauseOverlayVisible); } + [Test] + public void TestExitTooSoon() + { + AddStep("pause", () => Player.Pause()); + AddAssert("clock stopped", () => !Player.GameplayClockContainer.GameplayClock.IsRunning); + AddStep("resume", () => Player.Resume()); + AddAssert("clock started", () => Player.GameplayClockContainer.GameplayClock.IsRunning); + AddStep("pause too soon", () => Player.Exit()); + AddAssert("clock not stopped", () => Player.GameplayClockContainer.GameplayClock.IsRunning); + AddAssert("pause overlay hidden", () => !Player.PauseOverlayVisible); + AddAssert("not exited", () => Player.IsCurrentScreen()); + } + [Test] public void TestPauseAfterFail() { AddUntilStep("wait for fail", () => Player.HasFailed); - AddAssert("fail overlay shown", () => Player.FailOverlayVisible); AddStep("try to pause", () => Player.Pause()); AddAssert("pause overlay hidden", () => !Player.PauseOverlayVisible); AddAssert("fail overlay still shown", () => Player.FailOverlayVisible); + + confirmExit(); + } + + [Test] + public void TestExitFromGameplay() + { + AddStep("exit", () => Player.Exit()); + AddUntilStep("wait for pause", () => Player.PauseOverlayVisible); + + confirmExit(); } [Test] @@ -65,6 +88,12 @@ namespace osu.Game.Tests.Visual return Player.PauseOverlayVisible; }); + confirmExit(); + } + + private void confirmExit() + { + AddUntilStep("player not exited", () => Player.IsCurrentScreen()); AddStep("exit", () => Player.Exit()); AddUntilStep("player exited", () => !Player.IsCurrentScreen()); } From aa1dfdd6631572a21aa9c20c02a3e6a064c235a8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Mar 2019 16:33:34 +0900 Subject: [PATCH 075/107] Extract logic shared between tests --- osu.Game.Tests/Visual/TestCasePause.cs | 102 +++++++++++++++++-------- 1 file changed, 69 insertions(+), 33 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCasePause.cs b/osu.Game.Tests/Visual/TestCasePause.cs index 8fcf6164a4..d5d2cebbab 100644 --- a/osu.Game.Tests/Visual/TestCasePause.cs +++ b/osu.Game.Tests/Visual/TestCasePause.cs @@ -23,36 +23,34 @@ namespace osu.Game.Tests.Visual [Test] public void TestPauseResume() { - AddStep("pause", () => Player.Pause()); - AddAssert("clock stopped", () => !Player.GameplayClockContainer.GameplayClock.IsRunning); - AddAssert("pause overlay shown", () => Player.PauseOverlayVisible); - - AddStep("resume", () => Player.Resume()); - AddAssert("pause overlay hidden", () => !Player.PauseOverlayVisible); + pauseAndConfirm(); + resumeAndConfirm(); } [Test] public void TestPauseTooSoon() { - AddStep("pause", () => Player.Pause()); - AddAssert("clock stopped", () => !Player.GameplayClockContainer.GameplayClock.IsRunning); - AddStep("resume", () => Player.Resume()); - AddAssert("clock started", () => Player.GameplayClockContainer.GameplayClock.IsRunning); - AddStep("pause too soon", () => Player.Pause()); - AddAssert("clock not stopped", () => Player.GameplayClockContainer.GameplayClock.IsRunning); - AddAssert("pause overlay hidden", () => !Player.PauseOverlayVisible); + pauseAndConfirm(); + resumeAndConfirm(); + + pause(); + + confirmClockRunning(true); + confirmPauseOverlayShown(false); } [Test] public void TestExitTooSoon() { - AddStep("pause", () => Player.Pause()); - AddAssert("clock stopped", () => !Player.GameplayClockContainer.GameplayClock.IsRunning); - AddStep("resume", () => Player.Resume()); - AddAssert("clock started", () => Player.GameplayClockContainer.GameplayClock.IsRunning); - AddStep("pause too soon", () => Player.Exit()); - AddAssert("clock not stopped", () => Player.GameplayClockContainer.GameplayClock.IsRunning); - AddAssert("pause overlay hidden", () => !Player.PauseOverlayVisible); + pauseAndConfirm(); + + resume(); + + AddStep("exit too soon", () => Player.Exit()); + + confirmClockRunning(true); + confirmPauseOverlayShown(false); + AddAssert("not exited", () => Player.IsCurrentScreen()); } @@ -62,42 +60,80 @@ namespace osu.Game.Tests.Visual AddUntilStep("wait for fail", () => Player.HasFailed); AddAssert("fail overlay shown", () => Player.FailOverlayVisible); - AddStep("try to pause", () => Player.Pause()); + confirmClockRunning(false); + + pause(); + + confirmClockRunning(false); + confirmPauseOverlayShown(false); - AddAssert("pause overlay hidden", () => !Player.PauseOverlayVisible); AddAssert("fail overlay still shown", () => Player.FailOverlayVisible); - confirmExit(); + exitAndConfirm(); } [Test] public void TestExitFromGameplay() { AddStep("exit", () => Player.Exit()); - AddUntilStep("wait for pause", () => Player.PauseOverlayVisible); - confirmExit(); + confirmPaused(); + + exitAndConfirm(); } [Test] public void TestExitFromPause() { - AddUntilStep("keep trying to pause", () => - { - Player.Pause(); - return Player.PauseOverlayVisible; - }); - - confirmExit(); + pauseAndConfirm(); + exitAndConfirm(); } - private void confirmExit() + private void pauseAndConfirm() + { + pause(); + confirmPaused(); + } + + private void resumeAndConfirm() + { + resume(); + confirmResumed(); + } + + private void exitAndConfirm() { AddUntilStep("player not exited", () => Player.IsCurrentScreen()); AddStep("exit", () => Player.Exit()); + confirmExited(); + } + + private void confirmPaused() + { + confirmClockRunning(false); + AddAssert("pause overlay shown", () => Player.PauseOverlayVisible); + } + + private void confirmResumed() + { + confirmClockRunning(true); + confirmPauseOverlayShown(false); + } + + private void confirmExited() + { AddUntilStep("player exited", () => !Player.IsCurrentScreen()); } + private void pause() => AddStep("pause", () => Player.Pause()); + private void resume() => AddStep("resume", () => Player.Resume()); + + private void confirmPauseOverlayShown(bool isShown) => + AddAssert("pause overlay " + (isShown ? "shown" : "hidden"), () => Player.PauseOverlayVisible == isShown); + + private void confirmClockRunning(bool isRunning) => + AddAssert("clock " + (isRunning ? "running" : "stopped"), () => Player.GameplayClockContainer.GameplayClock.IsRunning == isRunning); + protected override bool AllowFail => true; protected override Player CreatePlayer(Ruleset ruleset) => new PausePlayer(); From e2503888a416a7187af1cf8aceca69a3291a3596 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Mar 2019 20:51:06 +0900 Subject: [PATCH 076/107] Expose carousel's loaded flag --- osu.Game/Screens/Select/BeatmapCarousel.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index bfd1d3d236..7b9559f5b4 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -55,9 +55,9 @@ namespace osu.Game.Screens.Select public override bool HandlePositionalInput => AllowSelection; /// - /// Used to avoid firing null selections before the initial beatmaps have been loaded via . + /// Whether carousel items have completed asynchronously loaded. /// - private bool initialLoadComplete; + public bool BeatmapSetsLoaded { get; private set; } private IEnumerable beatmapSets => root.Children.OfType(); @@ -90,7 +90,7 @@ namespace osu.Game.Screens.Select Schedule(() => { BeatmapSetsChanged?.Invoke(); - initialLoadComplete = true; + BeatmapSetsLoaded = true; }); })); } @@ -593,7 +593,7 @@ namespace osu.Game.Screens.Select currentY += DrawHeight / 2; scrollableContent.Height = currentY; - if (initialLoadComplete && (selectedBeatmapSet == null || selectedBeatmap == null || selectedBeatmapSet.State.Value != CarouselItemState.Selected)) + if (BeatmapSetsLoaded && (selectedBeatmapSet == null || selectedBeatmap == null || selectedBeatmapSet.State.Value != CarouselItemState.Selected)) { selectedBeatmapSet = null; SelectionChanged?.Invoke(null); From 96dba6a20d8d831a5d741c6d7ff4e4fd1852c945 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Mar 2019 20:51:21 +0900 Subject: [PATCH 077/107] Move nested method to bottom of class --- osu.Game/Screens/Select/SongSelect.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index a86d0beb39..3f56d38a1b 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -373,6 +373,13 @@ namespace osu.Game.Screens.Select var beatmap = beatmapNoDebounce; var ruleset = rulesetNoDebounce; + selectionChangedDebounce?.Cancel(); + + if (beatmap == null) + run(); + else + selectionChangedDebounce = Scheduler.AddDelayed(run, 200); + void run() { Logger.Log($"updating selection with beatmap:{beatmap?.ID.ToString() ?? "null"} ruleset:{ruleset?.ID.ToString() ?? "null"}"); @@ -417,13 +424,6 @@ namespace osu.Game.Screens.Select if (this.IsCurrentScreen()) ensurePlayingSelected(preview); UpdateBeatmap(Beatmap.Value); } - - selectionChangedDebounce?.Cancel(); - - if (beatmap == null) - run(); - else - selectionChangedDebounce = Scheduler.AddDelayed(run, 200); } private void triggerRandom() From 4789aa81cb7f1e12fe8aadc0c2d5028a5c36769c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Mar 2019 20:52:15 +0900 Subject: [PATCH 078/107] Add an explicit flag for tracking song select's bindable binding Not required (this change does not affect logic) but improves clarity. --- osu.Game/Screens/Select/SongSelect.cs | 33 +++++++++++++++++---------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index 3f56d38a1b..cc79cc5961 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -593,18 +593,7 @@ namespace osu.Game.Screens.Select private void carouselBeatmapsLoaded() { - if (rulesetNoDebounce == null) - { - // manual binding to parent ruleset to allow for delayed load in the incoming direction. - rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value; - Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue); - - decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue; - decoupledRuleset.DisabledChanged += r => Ruleset.Disabled = r; - - Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true); - Beatmap.BindValueChanged(workingBeatmapChanged); - } + bindBindables(); if (!Beatmap.IsDefault && Beatmap.Value.BeatmapSetInfo?.DeletePending == false && Beatmap.Value.BeatmapSetInfo?.Protected == false && Carousel.SelectBeatmap(Beatmap.Value.BeatmapInfo, false)) @@ -618,6 +607,26 @@ namespace osu.Game.Screens.Select } } + private bool boundLocalBindables; + + private void bindBindables() + { + if (boundLocalBindables) + return; + + // manual binding to parent ruleset to allow for delayed load in the incoming direction. + rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value; + Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue); + + decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue; + decoupledRuleset.DisabledChanged += r => Ruleset.Disabled = r; + + Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true); + Beatmap.BindValueChanged(workingBeatmapChanged); + + boundLocalBindables = true; + } + private void delete(BeatmapSetInfo beatmap) { if (beatmap == null || beatmap.ID <= 0) return; From a10e43410a994f54d1c58edcc122c6d433502050 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Mar 2019 20:52:34 +0900 Subject: [PATCH 079/107] Fix song select potentially starting play before the carousel (and bindables) have been initialised --- osu.Game/Screens/Select/SongSelect.cs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs index cc79cc5961..8758df5151 100644 --- a/osu.Game/Screens/Select/SongSelect.cs +++ b/osu.Game/Screens/Select/SongSelect.cs @@ -300,6 +300,10 @@ namespace osu.Game.Screens.Select /// Whether to trigger . public void FinaliseSelection(BeatmapInfo beatmap = null, bool performStartAction = true) { + // This is very important as we have not yet bound to screen-level bindables before the carousel load is completed. + if (!Carousel.BeatmapSetsLoaded) + return; + // if we have a pending filter operation, we want to run it now. // it could change selection (ie. if the ruleset has been changed). Carousel.FlushPendingFilterOperations(); @@ -610,19 +614,19 @@ namespace osu.Game.Screens.Select private bool boundLocalBindables; private void bindBindables() - { + { if (boundLocalBindables) return; - // manual binding to parent ruleset to allow for delayed load in the incoming direction. - rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value; - Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue); + // manual binding to parent ruleset to allow for delayed load in the incoming direction. + rulesetNoDebounce = decoupledRuleset.Value = Ruleset.Value; + Ruleset.ValueChanged += r => updateSelectedRuleset(r.NewValue); - decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue; - decoupledRuleset.DisabledChanged += r => Ruleset.Disabled = r; + decoupledRuleset.ValueChanged += r => Ruleset.Value = r.NewValue; + decoupledRuleset.DisabledChanged += r => Ruleset.Disabled = r; - Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true); - Beatmap.BindValueChanged(workingBeatmapChanged); + Beatmap.BindDisabledChanged(disabled => Carousel.AllowSelection = !disabled, true); + Beatmap.BindValueChanged(workingBeatmapChanged); boundLocalBindables = true; } From 37010f97d72249080df05fc5e2fe19f395bb7bc4 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 21 Mar 2019 21:02:45 +0900 Subject: [PATCH 080/107] Fix random select crashing Closes #3383. --- osu.Game/Screens/Select/BeatmapCarousel.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/osu.Game/Screens/Select/BeatmapCarousel.cs b/osu.Game/Screens/Select/BeatmapCarousel.cs index bfd1d3d236..95c89e3852 100644 --- a/osu.Game/Screens/Select/BeatmapCarousel.cs +++ b/osu.Game/Screens/Select/BeatmapCarousel.cs @@ -327,6 +327,9 @@ namespace osu.Game.Screens.Select private void select(CarouselItem item) { + if (!AllowSelection) + return; + if (item == null) return; item.State.Value = CarouselItemState.Selected; From d6f17a5ecda21ea6b640561e0912d5bee01b10a8 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Mar 2019 02:41:21 +0900 Subject: [PATCH 081/107] Bring nuget packages up to date --- osu.Desktop/osu.Desktop.csproj | 4 ++-- .../osu.Game.Rulesets.Catch.Tests.csproj | 4 ++-- .../osu.Game.Rulesets.Mania.Tests.csproj | 4 ++-- .../osu.Game.Rulesets.Osu.Tests.csproj | 4 ++-- .../osu.Game.Rulesets.Taiko.Tests.csproj | 4 ++-- osu.Game.Tests/osu.Game.Tests.csproj | 4 ++-- osu.Game/osu.Game.csproj | 8 ++++---- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/osu.Desktop/osu.Desktop.csproj b/osu.Desktop/osu.Desktop.csproj index 874f73da6d..66db439c82 100644 --- a/osu.Desktop/osu.Desktop.csproj +++ b/osu.Desktop/osu.Desktop.csproj @@ -27,8 +27,8 @@ - - + + diff --git a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj index feab3ed81c..3f8b3bf086 100644 --- a/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj +++ b/osu.Game.Rulesets.Catch.Tests/osu.Game.Rulesets.Catch.Tests.csproj @@ -2,9 +2,9 @@ - + - + diff --git a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj index e26d2433f9..fd17285a38 100644 --- a/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj +++ b/osu.Game.Rulesets.Mania.Tests/osu.Game.Rulesets.Mania.Tests.csproj @@ -2,9 +2,9 @@ - + - + diff --git a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj index 273d29c3de..8c31db9a7d 100644 --- a/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj +++ b/osu.Game.Rulesets.Osu.Tests/osu.Game.Rulesets.Osu.Tests.csproj @@ -2,9 +2,9 @@ - + - + diff --git a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj index fade054382..72ce6c947b 100644 --- a/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj +++ b/osu.Game.Rulesets.Taiko.Tests/osu.Game.Rulesets.Taiko.Tests.csproj @@ -2,9 +2,9 @@ - + - + diff --git a/osu.Game.Tests/osu.Game.Tests.csproj b/osu.Game.Tests/osu.Game.Tests.csproj index b22c1aed99..938e1ae0f8 100644 --- a/osu.Game.Tests/osu.Game.Tests.csproj +++ b/osu.Game.Tests/osu.Game.Tests.csproj @@ -3,9 +3,9 @@ - + - + diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index d8561770fd..dd69faad56 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -11,13 +11,13 @@ - - - + + + - + From dc004910d702e9d0e2794bc1d3fb2b7f296c0847 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Mar 2019 11:55:35 +0900 Subject: [PATCH 082/107] Fix AccountCreationOverlay tests and better complete dummy api's behaviour --- .../Visual/TestCaseAccountCreationOverlay.cs | 30 +++++++++++-- osu.Game.Tests/Visual/TestCaseDisclaimer.cs | 2 + osu.Game/Online/API/DummyAPIAccess.cs | 45 ++++++++++++++++--- 3 files changed, 68 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseAccountCreationOverlay.cs b/osu.Game.Tests/Visual/TestCaseAccountCreationOverlay.cs index 543a43b439..24380645d1 100644 --- a/osu.Game.Tests/Visual/TestCaseAccountCreationOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseAccountCreationOverlay.cs @@ -3,9 +3,13 @@ using System; using System.Collections.Generic; +using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Game.Online.API; using osu.Game.Overlays; using osu.Game.Overlays.AccountCreation; +using osu.Game.Users; namespace osu.Game.Tests.Visual { @@ -21,12 +25,32 @@ namespace osu.Game.Tests.Visual typeof(AccountCreationScreen), }; + [Cached(typeof(IAPIProvider))] + private DummyAPIAccess api = new DummyAPIAccess(); + public TestCaseAccountCreationOverlay() { - var accountCreation = new AccountCreationOverlay(); - Child = accountCreation; + Container userPanelArea; + AccountCreationOverlay accountCreation; - accountCreation.State = Visibility.Visible; + Children = new Drawable[] + { + api, + accountCreation = new AccountCreationOverlay(), + userPanelArea = new Container + { + Padding = new MarginPadding(10), + AutoSizeAxes = Axes.Both, + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + }, + }; + + api.Logout(); + api.LocalUser.BindValueChanged(user => { userPanelArea.Child = new UserPanel(user.NewValue) { Width = 200 }; }, true); + + AddStep("show", () => accountCreation.State = Visibility.Visible); + AddStep("logout", () => api.Logout()); } } } diff --git a/osu.Game.Tests/Visual/TestCaseDisclaimer.cs b/osu.Game.Tests/Visual/TestCaseDisclaimer.cs index f08a2a54ca..8bba16e4b4 100644 --- a/osu.Game.Tests/Visual/TestCaseDisclaimer.cs +++ b/osu.Game.Tests/Visual/TestCaseDisclaimer.cs @@ -16,6 +16,8 @@ namespace osu.Game.Tests.Visual [BackgroundDependencyLoader] private void load() { + Add(api); + AddStep("load disclaimer", () => LoadScreen(new Disclaimer())); AddStep("toggle support", () => diff --git a/osu.Game/Online/API/DummyAPIAccess.cs b/osu.Game/Online/API/DummyAPIAccess.cs index 0cb49951f7..4d530a698e 100644 --- a/osu.Game/Online/API/DummyAPIAccess.cs +++ b/osu.Game/Online/API/DummyAPIAccess.cs @@ -1,12 +1,15 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Collections.Generic; +using System.Threading; using osu.Framework.Bindables; +using osu.Framework.Graphics; using osu.Game.Users; namespace osu.Game.Online.API { - public class DummyAPIAccess : IAPIProvider + public class DummyAPIAccess : Component, IAPIProvider { public Bindable LocalUser { get; } = new Bindable(new User { @@ -20,7 +23,29 @@ namespace osu.Game.Online.API public string Endpoint => "http://localhost"; - public APIState State => LocalUser.Value.Id == 1 ? APIState.Offline : APIState.Online; + private APIState state = APIState.Online; + + private readonly List components = new List(); + + public APIState State + { + get => state; + private set + { + APIState oldState = state; + APIState newState = value; + + state = value; + + if (oldState != newState) + { + Scheduler.Add(delegate + { + components.ForEach(c => c.APIStateChanged(this, newState)); + }); + } + } + } public virtual void Queue(APIRequest request) { @@ -28,28 +53,36 @@ namespace osu.Game.Online.API public void Register(IOnlineComponent component) { - // todo: add support + Scheduler.Add(delegate { components.Add(component); }); + component.APIStateChanged(this, state); } public void Unregister(IOnlineComponent component) { - // todo: add support + Scheduler.Add(delegate { components.Remove(component); }); } public void Login(string username, string password) { LocalUser.Value = new User { - Username = @"Dummy", + Username = username, Id = 1001, }; + + State = APIState.Online; } public void Logout() { LocalUser.Value = new GuestUser(); + State = APIState.Offline; } - public RegistrationRequest.RegistrationRequestErrors CreateAccount(string email, string username, string password) => null; + public RegistrationRequest.RegistrationRequestErrors CreateAccount(string email, string username, string password) + { + Thread.Sleep(200); + return null; + } } } From dcae86e39a0d9b4058d6f77a2cdc9c05bb3c922e Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Mar 2019 14:10:38 +0900 Subject: [PATCH 083/107] Add a new test for OsuScreenStack, fix parallax --- .../Visual/TestCaseOsuScreenStack.cs | 45 +++++++++++++++++++ osu.Game/OsuGame.cs | 2 + osu.Game/Screens/OsuScreenStack.cs | 8 +++- osu.Game/Tests/Visual/AllPlayersTestCase.cs | 10 ++--- osu.Game/Tests/Visual/PlayerTestCase.cs | 7 +-- 5 files changed, 59 insertions(+), 13 deletions(-) create mode 100644 osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs diff --git a/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs b/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs new file mode 100644 index 0000000000..c3a9e94448 --- /dev/null +++ b/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs @@ -0,0 +1,45 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using NUnit.Framework; +using osu.Framework.Graphics; +using osu.Framework.Screens; +using osu.Framework.Testing; +using osu.Game.Graphics.Containers; +using osu.Game.Screens; +using osu.Game.Screens.Play; + +namespace osu.Game.Tests.Visual +{ + [TestFixture] + public class TestCaseOsuScreenStack : OsuTestCase + { + private TestScreen baseScreen; + private TestOsuScreenStack stack; + + [SetUpSteps] + public void Setup() + { + AddStep("Create new screen stack", () => { Child = stack = new TestOsuScreenStack { RelativeSizeAxes = Axes.Both }; }); + AddStep("Push new base screen", () => stack.Push(baseScreen = new TestScreen())); + } + + [Test] + public void ParallaxAssignmentTest() + { + AddStep("Push new screen to base screen", () => baseScreen.Push(new TestScreen())); + AddAssert("Parallax is correct", () => stack.IsParallaxSet); + AddStep("Exit from new screen", () => { baseScreen.MakeCurrent(); }); + AddAssert("Parallax is correct", () => stack.IsParallaxSet); + } + + private class TestScreen : ScreenWithBeatmapBackground + { + } + + private class TestOsuScreenStack : OsuScreenStack + { + public bool IsParallaxSet => ParallaxAmount == ((TestScreen)CurrentScreen).BackgroundParallaxAmount * ParallaxContainer.DEFAULT_PARALLAX_AMOUNT; + } + } +} diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index ad2980d818..079a0d5bb6 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -406,6 +406,8 @@ namespace osu.Game loadComponentSingleFile(osuLogo, logo => { logoContainer.Add(logo); + + // Loader has to be created synchronously in order for DI to be successful for its background screen stack. screenStack.Push(new Loader { RelativeSizeAxes = Axes.Both diff --git a/osu.Game/Screens/OsuScreenStack.cs b/osu.Game/Screens/OsuScreenStack.cs index 2eea7bebbb..1c929470d1 100644 --- a/osu.Game/Screens/OsuScreenStack.cs +++ b/osu.Game/Screens/OsuScreenStack.cs @@ -15,6 +15,8 @@ namespace osu.Game.Screens private ParallaxContainer parallaxContainer; + protected float ParallaxAmount => parallaxContainer.ParallaxAmount; + public OsuScreenStack() { initializeStack(); @@ -35,11 +37,15 @@ namespace osu.Game.Screens }; ScreenPushed += setParallax; + ScreenExited += setParallax; } private void setParallax(IScreen prev, IScreen next) { - parallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * ((IOsuScreen)next).BackgroundParallaxAmount; + if (next != null) + { + parallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * ((IOsuScreen)next).BackgroundParallaxAmount; + } } } } diff --git a/osu.Game/Tests/Visual/AllPlayersTestCase.cs b/osu.Game/Tests/Visual/AllPlayersTestCase.cs index 507848730f..03bd7b218a 100644 --- a/osu.Game/Tests/Visual/AllPlayersTestCase.cs +++ b/osu.Game/Tests/Visual/AllPlayersTestCase.cs @@ -73,15 +73,11 @@ namespace osu.Game.Tests.Visual Player?.Exit(); Player = null; - var player = CreatePlayer(r); + Player = CreatePlayer(r); - LoadComponentAsync(player, p => - { - Player = p; - LoadScreen(p); - }); + LoadScreen(Player); - return player; + return Player; } protected virtual Player CreatePlayer(Ruleset ruleset) => new Player diff --git a/osu.Game/Tests/Visual/PlayerTestCase.cs b/osu.Game/Tests/Visual/PlayerTestCase.cs index ad01d82281..50cb839ed9 100644 --- a/osu.Game/Tests/Visual/PlayerTestCase.cs +++ b/osu.Game/Tests/Visual/PlayerTestCase.cs @@ -52,11 +52,8 @@ namespace osu.Game.Tests.Visual if (!AllowFail) Beatmap.Value.Mods.Value = new[] { ruleset.GetAllMods().First(m => m is ModNoFail) }; - LoadComponentAsync(Player = CreatePlayer(ruleset), p => - { - Player = p; - LoadScreen(p); - }); + Player = CreatePlayer(ruleset); + LoadScreen(Player); } protected virtual Player CreatePlayer(Ruleset ruleset) => new Player From 860999ad29eaa138d8e3125740abe085cbc3cd41 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Fri, 22 Mar 2019 14:20:53 +0900 Subject: [PATCH 084/107] Cleanup --- osu.Game/Online/API/DummyAPIAccess.cs | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/osu.Game/Online/API/DummyAPIAccess.cs b/osu.Game/Online/API/DummyAPIAccess.cs index 4d530a698e..99fde10309 100644 --- a/osu.Game/Online/API/DummyAPIAccess.cs +++ b/osu.Game/Online/API/DummyAPIAccess.cs @@ -32,18 +32,12 @@ namespace osu.Game.Online.API get => state; private set { - APIState oldState = state; - APIState newState = value; + if (state == value) + return; state = value; - if (oldState != newState) - { - Scheduler.Add(delegate - { - components.ForEach(c => c.APIStateChanged(this, newState)); - }); - } + Scheduler.Add(() => components.ForEach(c => c.APIStateChanged(this, value))); } } From 59d0996c8d90501981e3a6752604e5810c5bab52 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Mar 2019 14:31:54 +0900 Subject: [PATCH 085/107] Cleanup other instance of same function --- osu.Game/Online/API/APIAccess.cs | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/osu.Game/Online/API/APIAccess.cs b/osu.Game/Online/API/APIAccess.cs index 3d861e44bf..c5f6ef41c2 100644 --- a/osu.Game/Online/API/APIAccess.cs +++ b/osu.Game/Online/API/APIAccess.cs @@ -266,20 +266,18 @@ namespace osu.Game.Online.API get => state; private set { - APIState oldState = state; - APIState newState = value; + if (state == value) + return; + APIState oldState = state; state = value; - if (oldState != newState) + log.Add($@"We just went {state}!"); + Scheduler.Add(delegate { - log.Add($@"We just went {newState}!"); - Scheduler.Add(delegate - { - components.ForEach(c => c.APIStateChanged(this, newState)); - OnStateChange?.Invoke(oldState, newState); - }); - } + components.ForEach(c => c.APIStateChanged(this, state)); + OnStateChange?.Invoke(oldState, state); + }); } } From 5b8fd6822e671c6fceb08ec46f18b3c270cf9d24 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Mar 2019 14:39:20 +0900 Subject: [PATCH 086/107] Move storyboard logic region down --- osu.Game/Screens/Play/Player.cs | 70 ++++++++++++++++----------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/osu.Game/Screens/Play/Player.cs b/osu.Game/Screens/Play/Player.cs index 88467aa7f5..70899d42bc 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -67,41 +67,6 @@ namespace osu.Game.Screens.Play protected HUDOverlay HUDOverlay { get; private set; } - #region Storyboard - - private DrawableStoryboard storyboard; - protected UserDimContainer StoryboardContainer { get; private set; } - - private void initializeStoryboard(bool asyncLoad) - { - if (StoryboardContainer == null || storyboard != null) - return; - - if (!showStoryboard.Value) - return; - - var beatmap = Beatmap.Value; - - storyboard = beatmap.Storyboard.CreateDrawable(); - storyboard.Masking = true; - - if (asyncLoad) - LoadComponentAsync(storyboard, StoryboardContainer.Add); - else - StoryboardContainer.Add(storyboard); - } - - #endregion - - private Bindable showStoryboard; - - protected virtual UserDimContainer CreateStoryboardContainer() => new UserDimContainer(true) - { - RelativeSizeAxes = Axes.Both, - Alpha = 1, - EnableUserDim = { Value = true } - }; - public bool LoadedBeatmapSuccessfully => DrawableRuleset?.Objects.Any() == true; protected GameplayClockContainer GameplayClockContainer { get; private set; } @@ -307,6 +272,41 @@ namespace osu.Game.Screens.Play protected virtual Results CreateResults(ScoreInfo score) => new SoloResults(score); + #region Storyboard + + private DrawableStoryboard storyboard; + protected UserDimContainer StoryboardContainer { get; private set; } + + protected virtual UserDimContainer CreateStoryboardContainer() => new UserDimContainer(true) + { + RelativeSizeAxes = Axes.Both, + Alpha = 1, + EnableUserDim = { Value = true } + }; + + private Bindable showStoryboard; + + private void initializeStoryboard(bool asyncLoad) + { + if (StoryboardContainer == null || storyboard != null) + return; + + if (!showStoryboard.Value) + return; + + var beatmap = Beatmap.Value; + + storyboard = beatmap.Storyboard.CreateDrawable(); + storyboard.Masking = true; + + if (asyncLoad) + LoadComponentAsync(storyboard, StoryboardContainer.Add); + else + StoryboardContainer.Add(storyboard); + } + + #endregion + #region Fail Logic protected FailOverlay FailOverlay { get; private set; } From 9e6cdd7bd50d0975293e9a9613b0841fda9adea3 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Mar 2019 14:42:51 +0900 Subject: [PATCH 087/107] Combine conditionals and clarify comment --- 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 70899d42bc..7b1cdd21a6 100644 --- a/osu.Game/Screens/Play/Player.cs +++ b/osu.Game/Screens/Play/Player.cs @@ -353,9 +353,8 @@ namespace osu.Game.Screens.Play && !DrawableRuleset.HasReplayLoaded.Value // cannot pause if we are already in a fail state && !HasFailed - // cannot pause if already paused (and not in the process of resuming) - && (GameplayClockContainer.IsPaused.Value == false || IsResuming) - && (!pauseCooldownActive || IsResuming); + // cannot pause if already paused (or in a cooldown state) unless we are in a resuming state. + && (IsResuming || (GameplayClockContainer.IsPaused.Value == false && !pauseCooldownActive)); private bool pauseCooldownActive => lastPauseActionTime.HasValue && GameplayClockContainer.GameplayClock.CurrentTime < lastPauseActionTime + pause_cooldown; @@ -454,7 +453,7 @@ namespace osu.Game.Screens.Play return true; } - if (LoadedBeatmapSuccessfully && canPause) + if (canPause) { Pause(); return true; From 9a466d97ede2d44095df61c468455861f8b20104 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Mar 2019 15:08:47 +0900 Subject: [PATCH 088/107] Add texts to make test more visually confirmable, add no parallax screen. --- .../Visual/TestCaseOsuScreenStack.cs | 35 +++++++++++++++++-- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs b/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs index c3a9e94448..2b37eae4e4 100644 --- a/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs +++ b/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs @@ -2,32 +2,35 @@ // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Sprites; using osu.Framework.Screens; using osu.Framework.Testing; using osu.Game.Graphics.Containers; using osu.Game.Screens; using osu.Game.Screens.Play; +using osuTK.Graphics; namespace osu.Game.Tests.Visual { [TestFixture] public class TestCaseOsuScreenStack : OsuTestCase { - private TestScreen baseScreen; + private NoParallaxTestScreen baseScreen; private TestOsuScreenStack stack; [SetUpSteps] public void Setup() { AddStep("Create new screen stack", () => { Child = stack = new TestOsuScreenStack { RelativeSizeAxes = Axes.Both }; }); - AddStep("Push new base screen", () => stack.Push(baseScreen = new TestScreen())); + AddStep("Push new base screen", () => stack.Push(baseScreen = new NoParallaxTestScreen("THIS IS SCREEN 1. THIS SCREEN SHOULD HAVE NO PARALLAX."))); } [Test] public void ParallaxAssignmentTest() { - AddStep("Push new screen to base screen", () => baseScreen.Push(new TestScreen())); + AddStep("Push new screen to base screen", () => baseScreen.Push(new TestScreen("THIS IS SCREEN 2. THIS SCREEN SHOULD HAVE PARALLAX."))); AddAssert("Parallax is correct", () => stack.IsParallaxSet); AddStep("Exit from new screen", () => { baseScreen.MakeCurrent(); }); AddAssert("Parallax is correct", () => stack.IsParallaxSet); @@ -35,6 +38,32 @@ namespace osu.Game.Tests.Visual private class TestScreen : ScreenWithBeatmapBackground { + private readonly string screenText; + + public TestScreen(string screenText) + { + this.screenText = screenText; + } + + [BackgroundDependencyLoader] + private void load() + { + AddInternal(new SpriteText + { + Text = screenText, + Colour = Color4.White + }); + } + } + + private class NoParallaxTestScreen : TestScreen + { + public NoParallaxTestScreen(string screenText) + : base(screenText) + { + } + + public override float BackgroundParallaxAmount => 0.0f; } private class TestOsuScreenStack : OsuScreenStack From 8fb4de101f3ee6867ca125c3831ea842b7130c0a Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Mar 2019 15:20:06 +0900 Subject: [PATCH 089/107] Wait for screen current --- osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs b/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs index 2b37eae4e4..51d6c50643 100644 --- a/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs +++ b/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs @@ -18,6 +18,7 @@ namespace osu.Game.Tests.Visual public class TestCaseOsuScreenStack : OsuTestCase { private NoParallaxTestScreen baseScreen; + private TestScreen newScreen; private TestOsuScreenStack stack; [SetUpSteps] @@ -25,14 +26,17 @@ namespace osu.Game.Tests.Visual { AddStep("Create new screen stack", () => { Child = stack = new TestOsuScreenStack { RelativeSizeAxes = Axes.Both }; }); AddStep("Push new base screen", () => stack.Push(baseScreen = new NoParallaxTestScreen("THIS IS SCREEN 1. THIS SCREEN SHOULD HAVE NO PARALLAX."))); + AddUntilStep("Wait for Screen 1 to be current", baseScreen.IsCurrentScreen); } [Test] public void ParallaxAssignmentTest() { - AddStep("Push new screen to base screen", () => baseScreen.Push(new TestScreen("THIS IS SCREEN 2. THIS SCREEN SHOULD HAVE PARALLAX."))); + AddStep("Push new screen to base screen", () => baseScreen.Push(newScreen = new TestScreen("THIS IS SCREEN 2. THIS SCREEN SHOULD HAVE PARALLAX."))); + AddUntilStep("Wait for Screen 2 to be current", newScreen.IsCurrentScreen); AddAssert("Parallax is correct", () => stack.IsParallaxSet); AddStep("Exit from new screen", () => { baseScreen.MakeCurrent(); }); + AddUntilStep("Wait for Screen 1 to be current", baseScreen.IsCurrentScreen); AddAssert("Parallax is correct", () => stack.IsParallaxSet); } From c43b1afa305d1b017c0e02437d4ed422500a118e Mon Sep 17 00:00:00 2001 From: David Zhao Date: Fri, 22 Mar 2019 15:23:18 +0900 Subject: [PATCH 090/107] Use is loaded instead --- osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs b/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs index 51d6c50643..bbf8dc5b01 100644 --- a/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs +++ b/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs @@ -26,17 +26,16 @@ namespace osu.Game.Tests.Visual { AddStep("Create new screen stack", () => { Child = stack = new TestOsuScreenStack { RelativeSizeAxes = Axes.Both }; }); AddStep("Push new base screen", () => stack.Push(baseScreen = new NoParallaxTestScreen("THIS IS SCREEN 1. THIS SCREEN SHOULD HAVE NO PARALLAX."))); - AddUntilStep("Wait for Screen 1 to be current", baseScreen.IsCurrentScreen); + AddUntilStep("Wait for Screen 1 to be current", () => baseScreen.IsLoaded); } [Test] public void ParallaxAssignmentTest() { AddStep("Push new screen to base screen", () => baseScreen.Push(newScreen = new TestScreen("THIS IS SCREEN 2. THIS SCREEN SHOULD HAVE PARALLAX."))); - AddUntilStep("Wait for Screen 2 to be current", newScreen.IsCurrentScreen); + AddUntilStep("Wait for Screen 2 to be current", () => newScreen.IsLoaded); AddAssert("Parallax is correct", () => stack.IsParallaxSet); AddStep("Exit from new screen", () => { baseScreen.MakeCurrent(); }); - AddUntilStep("Wait for Screen 1 to be current", baseScreen.IsCurrentScreen); AddAssert("Parallax is correct", () => stack.IsParallaxSet); } From 670c25d5e861232d25267385b80a2e5a45950233 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 22 Mar 2019 16:03:08 +0900 Subject: [PATCH 091/107] Refactor test --- .../Visual/TestCaseOsuScreenStack.cs | 31 +++++++++++-------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs b/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs index bbf8dc5b01..0831228681 100644 --- a/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs +++ b/osu.Game.Tests/Visual/TestCaseOsuScreenStack.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Screens; using osu.Framework.Testing; -using osu.Game.Graphics.Containers; using osu.Game.Screens; using osu.Game.Screens.Play; using osuTK.Graphics; @@ -17,26 +16,30 @@ namespace osu.Game.Tests.Visual [TestFixture] public class TestCaseOsuScreenStack : OsuTestCase { - private NoParallaxTestScreen baseScreen; - private TestScreen newScreen; private TestOsuScreenStack stack; [SetUpSteps] - public void Setup() + public void SetUpSteps() { AddStep("Create new screen stack", () => { Child = stack = new TestOsuScreenStack { RelativeSizeAxes = Axes.Both }; }); - AddStep("Push new base screen", () => stack.Push(baseScreen = new NoParallaxTestScreen("THIS IS SCREEN 1. THIS SCREEN SHOULD HAVE NO PARALLAX."))); - AddUntilStep("Wait for Screen 1 to be current", () => baseScreen.IsLoaded); } [Test] public void ParallaxAssignmentTest() { - AddStep("Push new screen to base screen", () => baseScreen.Push(newScreen = new TestScreen("THIS IS SCREEN 2. THIS SCREEN SHOULD HAVE PARALLAX."))); - AddUntilStep("Wait for Screen 2 to be current", () => newScreen.IsLoaded); - AddAssert("Parallax is correct", () => stack.IsParallaxSet); - AddStep("Exit from new screen", () => { baseScreen.MakeCurrent(); }); - AddAssert("Parallax is correct", () => stack.IsParallaxSet); + NoParallaxTestScreen noParallaxScreen = null; + TestScreen parallaxScreen = null; + + AddStep("Push no parallax", () => stack.Push(noParallaxScreen = new NoParallaxTestScreen("NO PARALLAX"))); + AddUntilStep("Wait for current", () => noParallaxScreen.IsLoaded); + AddAssert("Parallax is off", () => stack.ParallaxAmount == 0); + + AddStep("Push parallax", () => noParallaxScreen.Push(parallaxScreen = new TestScreen("PARALLAX"))); + AddUntilStep("Wait for current", () => parallaxScreen.IsLoaded); + AddAssert("Parallax is on", () => stack.ParallaxAmount > 0); + + AddStep("Exit from new screen", () => { noParallaxScreen.MakeCurrent(); }); + AddAssert("Parallax is off", () => stack.ParallaxAmount == 0); } private class TestScreen : ScreenWithBeatmapBackground @@ -54,7 +57,9 @@ namespace osu.Game.Tests.Visual AddInternal(new SpriteText { Text = screenText, - Colour = Color4.White + Colour = Color4.White, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, }); } } @@ -71,7 +76,7 @@ namespace osu.Game.Tests.Visual private class TestOsuScreenStack : OsuScreenStack { - public bool IsParallaxSet => ParallaxAmount == ((TestScreen)CurrentScreen).BackgroundParallaxAmount * ParallaxContainer.DEFAULT_PARALLAX_AMOUNT; + public new float ParallaxAmount => base.ParallaxAmount; } } } From 97675f6495d2c5e9641a214226bee4dffe4f523a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 23 Mar 2019 00:55:31 +0900 Subject: [PATCH 092/107] 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 dd69faad56..71324ea0f0 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 3dcb647cd2..02099a59bb 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -105,8 +105,8 @@ - - + + From 9a11a08acc9f94f55f5c9b3f3ff1695bd395db4b Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sat, 23 Mar 2019 01:44:05 +0900 Subject: [PATCH 093/107] Update textbox usages --- .../Graphics/UserInterface/FocusedTextBox.cs | 6 +++--- osu.Game/Graphics/UserInterface/OsuTextBox.cs | 8 +++----- .../Chat/Selection/ChannelSelectionOverlay.cs | 8 ++++++-- osu.Game/Overlays/Music/FilterControl.cs | 11 ++++++----- .../SearchableListFilterControl.cs | 10 +++++++--- .../Match/Components/MatchSettingsOverlay.cs | 16 ++++++++++++---- 6 files changed, 37 insertions(+), 22 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs index 73c9c0dd0e..f873db0dcb 100644 --- a/osu.Game/Graphics/UserInterface/FocusedTextBox.cs +++ b/osu.Game/Graphics/UserInterface/FocusedTextBox.cs @@ -16,9 +16,6 @@ namespace osu.Game.Graphics.UserInterface /// public class FocusedTextBox : OsuTextBox { - protected override Color4 BackgroundUnfocused => new Color4(10, 10, 10, 255); - protected override Color4 BackgroundFocused => new Color4(10, 10, 10, 255); - public Action Exit; private bool focus; @@ -47,6 +44,9 @@ namespace osu.Game.Graphics.UserInterface private void load(GameHost host) { this.host = host; + + BackgroundUnfocused = new Color4(10, 10, 10, 255); + BackgroundFocused = new Color4(10, 10, 10, 255); } // We may not be focused yet, but we need to handle keyboard input to be able to request focus diff --git a/osu.Game/Graphics/UserInterface/OsuTextBox.cs b/osu.Game/Graphics/UserInterface/OsuTextBox.cs index 21cdfbf5af..ebe38db60a 100644 --- a/osu.Game/Graphics/UserInterface/OsuTextBox.cs +++ b/osu.Game/Graphics/UserInterface/OsuTextBox.cs @@ -16,10 +16,6 @@ namespace osu.Game.Graphics.UserInterface { public class OsuTextBox : TextBox, IKeyBindingHandler { - protected override Color4 BackgroundUnfocused => Color4.Black.Opacity(0.5f); - protected override Color4 BackgroundFocused => OsuColour.Gray(0.3f).Opacity(0.8f); - protected override Color4 BackgroundCommit => BorderColour; - protected override float LeftRightPadding => 10; protected override SpriteText CreatePlaceholder() => new OsuSpriteText @@ -41,7 +37,9 @@ namespace osu.Game.Graphics.UserInterface [BackgroundDependencyLoader] private void load(OsuColour colour) { - BorderColour = colour.Yellow; + BackgroundUnfocused = Color4.Black.Opacity(0.5f); + BackgroundFocused = OsuColour.Gray(0.3f).Opacity(0.8f); + BackgroundCommit = BorderColour = colour.Yellow; } protected override void OnFocus(FocusEvent e) diff --git a/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs b/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs index feb47b9e8e..71e9e4bdf3 100644 --- a/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs +++ b/osu.Game/Overlays/Chat/Selection/ChannelSelectionOverlay.cs @@ -190,8 +190,12 @@ namespace osu.Game.Overlays.Chat.Selection private class HeaderSearchTextBox : SearchTextBox { - protected override Color4 BackgroundFocused => Color4.Black.Opacity(0.2f); - protected override Color4 BackgroundUnfocused => Color4.Black.Opacity(0.2f); + [BackgroundDependencyLoader] + private void load() + { + BackgroundFocused = Color4.Black.Opacity(0.2f); + BackgroundUnfocused = Color4.Black.Opacity(0.2f); + } } } } diff --git a/osu.Game/Overlays/Music/FilterControl.cs b/osu.Game/Overlays/Music/FilterControl.cs index 6bceade271..99017579a2 100644 --- a/osu.Game/Overlays/Music/FilterControl.cs +++ b/osu.Game/Overlays/Music/FilterControl.cs @@ -6,8 +6,8 @@ using osu.Framework.Graphics.Containers; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; using osuTK; -using osuTK.Graphics; using System; +using osu.Framework.Allocation; using osu.Framework.Bindables; namespace osu.Game.Overlays.Music @@ -53,15 +53,16 @@ namespace osu.Game.Overlays.Music public class FilterTextBox : SearchTextBox { - protected override Color4 BackgroundUnfocused => OsuColour.Gray(0.06f); - protected override Color4 BackgroundFocused => OsuColour.Gray(0.12f); - protected override bool AllowCommit => true; - public FilterTextBox() + [BackgroundDependencyLoader] + private void load() { Masking = true; CornerRadius = 5; + + BackgroundUnfocused = OsuColour.Gray(0.06f); + BackgroundFocused = OsuColour.Gray(0.12f); } } } diff --git a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs index 478e3d4c95..b0a8a0e77d 100644 --- a/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs +++ b/osu.Game/Overlays/SearchableList/SearchableListFilterControl.cs @@ -127,10 +127,14 @@ namespace osu.Game.Overlays.SearchableList private class FilterSearchTextBox : SearchTextBox { - protected override Color4 BackgroundUnfocused => OsuColour.Gray(0.06f); - protected override Color4 BackgroundFocused => OsuColour.Gray(0.12f); - protected override bool AllowCommit => true; + + [BackgroundDependencyLoader] + private void load() + { + BackgroundUnfocused = OsuColour.Gray(0.06f); + BackgroundFocused = OsuColour.Gray(0.12f); + } } } } diff --git a/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs b/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs index b310e62d7c..586a986111 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs @@ -316,8 +316,12 @@ namespace osu.Game.Screens.Multi.Match.Components private class SettingsTextBox : OsuTextBox { - protected override Color4 BackgroundUnfocused => Color4.Black; - protected override Color4 BackgroundFocused => Color4.Black; + [BackgroundDependencyLoader] + private void load() + { + BackgroundUnfocused = Color4.Black; + BackgroundFocused = Color4.Black; + } } private class SettingsNumberTextBox : SettingsTextBox @@ -327,8 +331,12 @@ namespace osu.Game.Screens.Multi.Match.Components private class SettingsPasswordTextBox : OsuPasswordTextBox { - protected override Color4 BackgroundUnfocused => Color4.Black; - protected override Color4 BackgroundFocused => Color4.Black; + [BackgroundDependencyLoader] + private void load() + { + BackgroundUnfocused = Color4.Black; + BackgroundFocused = Color4.Black; + } } private class SectionContainer : FillFlowContainer
From 0d721042356dbe0a1794344500187413e0e20a4a Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Mar 2019 12:03:06 +0900 Subject: [PATCH 094/107] Refactor for formatting sanity --- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 28 ++++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index dbab8bb479..c3b9d93ef0 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -38,13 +38,15 @@ namespace osu.Game.Screens.Play /// /// Action that is invoked when is triggered. /// - protected virtual Action BackAction => () => InternalButtons.Children.Last().Click(); + protected virtual Action BackAction => () => InternalButtons.Children.LastOrDefault()?.Click(); /// /// Action that is invoked when is triggered. /// - protected Action SelectAction => () => InternalButtons.Children.FirstOrDefault(f => f.Selected)?.Click(); + protected virtual Action SelectAction => () => InternalButtons.Children.FirstOrDefault(f => f.Selected.Value)?.Click(); + public abstract string Header { get; } + public abstract string Description { get; } protected internal FillFlowContainer InternalButtons; @@ -233,22 +235,20 @@ namespace osu.Game.Screens.Play public bool OnPressed(GlobalAction action) { - if (action == GlobalAction.Back) + switch (action) { - BackAction.Invoke(); - return true; + case GlobalAction.Back: + BackAction.Invoke(); + return true; + case GlobalAction.Select: + SelectAction.Invoke(); + return true; + default: + return false; } - - if (action == GlobalAction.Select) - { - SelectAction.Invoke(); - return true; - } - - return false; } - public bool OnReleased(GlobalAction action) => action == GlobalAction.Back; + public bool OnReleased(GlobalAction action) => false; private void buttonSelectionChanged(DialogButton button, bool isSelected) { From 1e0027e4f2163be6ae3bd7b29b8b573072fb9513 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Mar 2019 12:09:18 +0900 Subject: [PATCH 095/107] Fix test --- .../Visual/TestCaseGameplayMenuOverlay.cs | 56 ++++++++++++------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs index c5ad57fec9..0a240186d2 100644 --- a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs +++ b/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs @@ -7,8 +7,10 @@ using System.ComponentModel; using System.Linq; using osuTK.Input; using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Logging; +using osu.Game.Input.Bindings; using osu.Game.Screens.Play; using osuTK; @@ -22,21 +24,29 @@ namespace osu.Game.Tests.Visual private FailOverlay failOverlay; private PauseOverlay pauseOverlay; - [BackgroundDependencyLoader] - private void load() - { - Add(pauseOverlay = new PauseOverlay - { - OnResume = () => Logger.Log(@"Resume"), - OnRetry = () => Logger.Log(@"Retry"), - OnQuit = () => Logger.Log(@"Quit"), - }); + private GlobalActionContainer globalActionContainer; - Add(failOverlay = new FailOverlay + [BackgroundDependencyLoader] + private void load(OsuGameBase game) + { + Child = globalActionContainer = new GlobalActionContainer(game) { - OnRetry = () => Logger.Log(@"Retry"), - OnQuit = () => Logger.Log(@"Quit"), - }); + Children = new Drawable[] + { + pauseOverlay = new PauseOverlay + { + OnResume = () => Logger.Log(@"Resume"), + OnRetry = () => Logger.Log(@"Retry"), + OnQuit = () => Logger.Log(@"Quit"), + }, + failOverlay = new FailOverlay + + { + OnRetry = () => Logger.Log(@"Retry"), + OnQuit = () => Logger.Log(@"Quit"), + } + } + }; var retryCount = 0; @@ -79,12 +89,6 @@ namespace osu.Game.Tests.Visual AddAssert("Overlay state is reset", () => !failOverlay.Buttons.Any(b => b.Selected.Value)); } - private void press(Key key) - { - InputManager.PressKey(key); - InputManager.ReleaseKey(key); - } - /// /// Tests that pressing enter after an overlay shows doesn't trigger an event because a selection hasn't occurred. /// @@ -92,7 +96,7 @@ namespace osu.Game.Tests.Visual { AddStep("Show overlay", () => pauseOverlay.Show()); - AddStep("Press enter", () => press(Key.Enter)); + AddStep("Press select", () => press(GlobalAction.Select)); AddAssert("Overlay still open", () => pauseOverlay.State == Visibility.Visible); AddStep("Hide overlay", () => pauseOverlay.Hide()); @@ -270,5 +274,17 @@ namespace osu.Game.Tests.Visual }); AddAssert("Overlay is closed", () => pauseOverlay.State == Visibility.Hidden); } + + private void press(Key key) + { + InputManager.PressKey(key); + InputManager.ReleaseKey(key); + } + + private void press(GlobalAction action) + { + globalActionContainer.TriggerPressed(action); + globalActionContainer.TriggerReleased(action); + } } } From 11b474e1949ea71367681c3ccfa8b1c3daad88c2 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Sun, 24 Mar 2019 12:19:09 +0900 Subject: [PATCH 096/107] Handle released for safety --- osu.Game/Screens/Play/GameplayMenuOverlay.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/GameplayMenuOverlay.cs b/osu.Game/Screens/Play/GameplayMenuOverlay.cs index c3b9d93ef0..2fac8de799 100644 --- a/osu.Game/Screens/Play/GameplayMenuOverlay.cs +++ b/osu.Game/Screens/Play/GameplayMenuOverlay.cs @@ -243,12 +243,22 @@ namespace osu.Game.Screens.Play case GlobalAction.Select: SelectAction.Invoke(); return true; - default: - return false; } + + return false; } - public bool OnReleased(GlobalAction action) => false; + public bool OnReleased(GlobalAction action) + { + switch (action) + { + case GlobalAction.Back: + case GlobalAction.Select: + return true; + } + + return false; + } private void buttonSelectionChanged(DialogButton button, bool isSelected) { From 5169f7a43ca627acda15cf171ae41ea2430b761e Mon Sep 17 00:00:00 2001 From: David Zhao Date: Sun, 24 Mar 2019 16:21:43 +0900 Subject: [PATCH 097/107] Change default for null screen parallax, apply reviews --- osu.Game/OsuGame.cs | 6 ++---- osu.Game/Screens/OsuScreenStack.cs | 5 +---- osu.Game/Tests/Visual/ScreenTestCase.cs | 5 +---- 3 files changed, 4 insertions(+), 12 deletions(-) diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 079a0d5bb6..7277990987 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -199,8 +199,6 @@ namespace osu.Game LocalConfig.BindWith(OsuSetting.VolumeInactive, inactiveVolumeAdjust); IsActive.BindValueChanged(active => updateActiveState(active.NewValue), true); - - screenStack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }; } private ExternalLinkOpener externalLinkOpener; @@ -388,7 +386,7 @@ namespace osu.Game RelativeSizeAxes = Axes.Both, Children = new Drawable[] { - screenStack, + screenStack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }, logoContainer = new Container { RelativeSizeAxes = Axes.Both }, } }, @@ -407,7 +405,7 @@ namespace osu.Game { logoContainer.Add(logo); - // Loader has to be created synchronously in order for DI to be successful for its background screen stack. + // Loader has to be created after the logo has finished loading as Loader performs logo transformations on entering. screenStack.Push(new Loader { RelativeSizeAxes = Axes.Both diff --git a/osu.Game/Screens/OsuScreenStack.cs b/osu.Game/Screens/OsuScreenStack.cs index 1c929470d1..02e5919cdd 100644 --- a/osu.Game/Screens/OsuScreenStack.cs +++ b/osu.Game/Screens/OsuScreenStack.cs @@ -42,10 +42,7 @@ namespace osu.Game.Screens private void setParallax(IScreen prev, IScreen next) { - if (next != null) - { - parallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * ((IOsuScreen)next).BackgroundParallaxAmount; - } + parallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * ((IOsuScreen)next)?.BackgroundParallaxAmount ?? 1.0f; } } } diff --git a/osu.Game/Tests/Visual/ScreenTestCase.cs b/osu.Game/Tests/Visual/ScreenTestCase.cs index a8286f6d7b..eec60d01c5 100644 --- a/osu.Game/Tests/Visual/ScreenTestCase.cs +++ b/osu.Game/Tests/Visual/ScreenTestCase.cs @@ -15,10 +15,7 @@ namespace osu.Game.Tests.Visual protected ScreenTestCase() { - Children = new Drawable[] - { - stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both } - }; + Child = stack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }; } protected void LoadScreen(OsuScreen screen) From a1c5eda05b45b7b9ae07ef2927482105e3c636bc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Mar 2019 01:02:36 +0900 Subject: [PATCH 098/107] Add grouping of visual tests --- .../TestCaseBackgroundScreenBeatmap.cs | 2 +- .../{ => Components}/TestCaseIdleTracker.cs | 2 +- .../TestCasePollingComponent.cs | 2 +- .../TestCasePreviewTrackManager.cs | 2 +- .../TestCaseBeatDivisorControl.cs | 2 +- .../{ => Editor}/TestCaseEditorCompose.cs | 2 +- .../TestCaseEditorComposeRadioButtons.cs | 2 +- .../TestCaseEditorComposeTimeline.cs | 4 ++-- .../{ => Editor}/TestCaseEditorMenuBar.cs | 2 +- .../TestCaseEditorSeekSnapping.cs | 2 +- .../TestCaseEditorSummaryTimeline.cs | 6 ++--- .../{ => Editor}/TestCaseHitObjectComposer.cs | 4 ++-- .../{ => Editor}/TestCasePlaybackControl.cs | 2 +- .../{ => Editor}/TestCaseWaveContainer.cs | 2 +- .../Visual/{ => Editor}/TestCaseWaveform.cs | 6 ++--- .../TestCaseZoomableScrollContainer.cs | 2 +- .../Visual/{ => Gameplay}/TestCaseAutoplay.cs | 2 +- .../{ => Gameplay}/TestCaseBreakOverlay.cs | 4 ++-- .../TestCaseGameplayMenuOverlay.cs | 4 ++-- .../TestCaseHoldForMenuButton.cs | 2 +- .../{ => Gameplay}/TestCaseKeyCounter.cs | 2 +- .../{ => Gameplay}/TestCaseMedalOverlay.cs | 2 +- .../Visual/{ => Gameplay}/TestCasePause.cs | 2 +- .../{ => Gameplay}/TestCasePlayerLoader.cs | 2 +- .../TestCasePlayerReferenceLeaking.cs | 2 +- .../Visual/{ => Gameplay}/TestCaseReplay.cs | 2 +- .../TestCaseReplaySettingsOverlay.cs | 2 +- .../Visual/{ => Gameplay}/TestCaseResults.cs | 2 +- .../{ => Gameplay}/TestCaseScoreCounter.cs | 2 +- .../TestCaseScrollingHitObjects.cs | 4 ++-- .../{ => Gameplay}/TestCaseSkinReloadable.cs | 2 +- .../{ => Gameplay}/TestCaseSkipOverlay.cs | 2 +- .../{ => Gameplay}/TestCaseSongProgress.cs | 2 +- .../{ => Gameplay}/TestCaseStoryboard.cs | 2 +- .../Visual/{ => Menus}/TestCaseDisclaimer.cs | 2 +- .../{ => Menus}/TestCaseIntroSequence.cs | 4 ++-- .../{ => Menus}/TestCaseLoaderAnimation.cs | 2 +- .../Visual/{ => Menus}/TestCaseToolbar.cs | 2 +- .../TestCaseLoungeRoomsContainer.cs | 2 +- .../{ => Multiplayer}/TestCaseMatchHeader.cs | 2 +- .../TestCaseMatchHostInfo.cs | 2 +- .../{ => Multiplayer}/TestCaseMatchInfo.cs | 2 +- .../TestCaseMatchLeaderboard.cs | 2 +- .../TestCaseMatchParticipants.cs | 2 +- .../{ => Multiplayer}/TestCaseMatchResults.cs | 2 +- .../TestCaseMatchSettingsOverlay.cs | 2 +- .../{ => Multiplayer}/TestCaseMultiHeader.cs | 2 +- .../{ => Multiplayer}/TestCaseMultiScreen.cs | 7 +++--- .../{ => Multiplayer}/TestCaseRoomStatus.cs | 2 +- .../TestCaseAccountCreationOverlay.cs | 2 +- .../{ => Online}/TestCaseBadgeContainer.cs | 2 +- .../{ => Online}/TestCaseBeatmapSetOverlay.cs | 2 +- .../{ => Online}/TestCaseChannelTabControl.cs | 2 +- .../{ => Online}/TestCaseChatDisplay.cs | 2 +- .../Visual/{ => Online}/TestCaseChatLink.cs | 18 +++++++-------- .../Visual/{ => Online}/TestCaseDirect.cs | 2 +- .../{ => Online}/TestCaseDirectPanel.cs | 2 +- .../TestCaseExternalLinkButton.cs | 2 +- .../Visual/{ => Online}/TestCaseGraph.cs | 2 +- .../{ => Online}/TestCaseHistoricalSection.cs | 2 +- .../Visual/{ => Online}/TestCaseRankGraph.cs | 10 ++++----- .../Visual/{ => Online}/TestCaseSocial.cs | 2 +- .../TestCaseStandAloneChatDisplay.cs | 2 +- .../Visual/{ => Online}/TestCaseUserPanel.cs | 2 +- .../{ => Online}/TestCaseUserProfile.cs | 2 +- .../TestCaseUserProfileRecentSection.cs | 10 ++++----- .../Visual/{ => Online}/TestCaseUserRanks.cs | 8 +++---- .../TestCaseKeyConfiguration.cs | 2 +- .../Visual/{ => Settings}/TestCaseSettings.cs | 2 +- .../TestCaseBeatmapCarousel.cs | 2 +- .../TestCaseBeatmapDetailArea.cs | 2 +- .../TestCaseBeatmapDetails.cs | 2 +- .../TestCaseBeatmapInfoWedge.cs | 4 ++-- .../TestCaseBeatmapOptionsOverlay.cs | 2 +- .../TestCaseBeatmapScoresContainer.cs | 14 ++++++------ .../{ => SongSelect}/TestCaseLeaderboard.cs | 12 +++++----- .../TestCasePlaySongSelect.cs | 4 ++-- .../{ => Tournament}/TestCaseDrawings.cs | 2 +- .../TestCaseBeatSyncedContainer.cs | 6 ++--- .../TestCaseBreadcrumbs.cs | 2 +- .../TestCaseButtonSystem.cs | 2 +- .../TestCaseContextMenu.cs | 4 ++-- .../{ => UserInterface}/TestCaseCursors.cs | 2 +- .../TestCaseDialogOverlay.cs | 2 +- .../TestCaseDrawableDate.cs | 2 +- .../TestCaseHoldToConfirmOverlay.cs | 2 +- .../{ => UserInterface}/TestCaseIconButton.cs | 6 ++--- .../TestCaseLabelledTextBox.cs | 6 ++--- .../TestCaseLoadingAnimation.cs | 2 +- .../{ => UserInterface}/TestCaseMods.cs | 22 +++++++++---------- .../TestCaseMusicController.cs | 2 +- .../TestCaseNotificationOverlay.cs | 2 +- .../TestCaseOnScreenDisplay.cs | 2 +- .../TestCaseParallaxContainer.cs | 2 +- .../TestCasePopupDialog.cs | 2 +- .../TestCaseScreenBreadcrumbControl.cs | 2 +- .../{ => UserInterface}/TestCaseTabControl.cs | 2 +- .../TestCaseTextAwesome.cs | 2 +- .../TestCaseTwoLayerButton.cs | 2 +- ...stCaseUpdateableBeatmapBackgroundSprite.cs | 2 +- .../TestCaseVolumePieces.cs | 2 +- 101 files changed, 162 insertions(+), 163 deletions(-) rename osu.Game.Tests/Visual/{ => Background}/TestCaseBackgroundScreenBeatmap.cs (99%) rename osu.Game.Tests/Visual/{ => Components}/TestCaseIdleTracker.cs (99%) rename osu.Game.Tests/Visual/{ => Components}/TestCasePollingComponent.cs (99%) rename osu.Game.Tests/Visual/{ => Components}/TestCasePreviewTrackManager.cs (99%) rename osu.Game.Tests/Visual/{ => Editor}/TestCaseBeatDivisorControl.cs (95%) rename osu.Game.Tests/Visual/{ => Editor}/TestCaseEditorCompose.cs (95%) rename osu.Game.Tests/Visual/{ => Editor}/TestCaseEditorComposeRadioButtons.cs (97%) rename osu.Game.Tests/Visual/{ => Editor}/TestCaseEditorComposeTimeline.cs (99%) rename osu.Game.Tests/Visual/{ => Editor}/TestCaseEditorMenuBar.cs (99%) rename osu.Game.Tests/Visual/{ => Editor}/TestCaseEditorSeekSnapping.cs (99%) rename osu.Game.Tests/Visual/{ => Editor}/TestCaseEditorSummaryTimeline.cs (96%) rename osu.Game.Tests/Visual/{ => Editor}/TestCaseHitObjectComposer.cs (98%) rename osu.Game.Tests/Visual/{ => Editor}/TestCasePlaybackControl.cs (96%) rename osu.Game.Tests/Visual/{ => Editor}/TestCaseWaveContainer.cs (97%) rename osu.Game.Tests/Visual/{ => Editor}/TestCaseWaveform.cs (98%) rename osu.Game.Tests/Visual/{ => Editor}/TestCaseZoomableScrollContainer.cs (99%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCaseAutoplay.cs (97%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCaseBreakOverlay.cs (98%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCaseGameplayMenuOverlay.cs (99%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCaseHoldForMenuButton.cs (97%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCaseKeyCounter.cs (98%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCaseMedalOverlay.cs (95%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCasePause.cs (99%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCasePlayerLoader.cs (98%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCasePlayerReferenceLeaking.cs (97%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCaseReplay.cs (97%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCaseReplaySettingsOverlay.cs (97%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCaseResults.cs (97%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCaseScoreCounter.cs (98%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCaseScrollingHitObjects.cs (99%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCaseSkinReloadable.cs (99%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCaseSkipOverlay.cs (91%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCaseSongProgress.cs (98%) rename osu.Game.Tests/Visual/{ => Gameplay}/TestCaseStoryboard.cs (98%) rename osu.Game.Tests/Visual/{ => Menus}/TestCaseDisclaimer.cs (96%) rename osu.Game.Tests/Visual/{ => Menus}/TestCaseIntroSequence.cs (97%) rename osu.Game.Tests/Visual/{ => Menus}/TestCaseLoaderAnimation.cs (99%) rename osu.Game.Tests/Visual/{ => Menus}/TestCaseToolbar.cs (97%) rename osu.Game.Tests/Visual/{ => Multiplayer}/TestCaseLoungeRoomsContainer.cs (98%) rename osu.Game.Tests/Visual/{ => Multiplayer}/TestCaseMatchHeader.cs (97%) rename osu.Game.Tests/Visual/{ => Multiplayer}/TestCaseMatchHostInfo.cs (95%) rename osu.Game.Tests/Visual/{ => Multiplayer}/TestCaseMatchInfo.cs (98%) rename osu.Game.Tests/Visual/{ => Multiplayer}/TestCaseMatchLeaderboard.cs (97%) rename osu.Game.Tests/Visual/{ => Multiplayer}/TestCaseMatchParticipants.cs (97%) rename osu.Game.Tests/Visual/{ => Multiplayer}/TestCaseMatchResults.cs (98%) rename osu.Game.Tests/Visual/{ => Multiplayer}/TestCaseMatchSettingsOverlay.cs (99%) rename osu.Game.Tests/Visual/{ => Multiplayer}/TestCaseMultiHeader.cs (96%) rename osu.Game.Tests/Visual/{ => Multiplayer}/TestCaseMultiScreen.cs (79%) rename osu.Game.Tests/Visual/{ => Multiplayer}/TestCaseRoomStatus.cs (97%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseAccountCreationOverlay.cs (97%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseBadgeContainer.cs (98%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseBeatmapSetOverlay.cs (99%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseChannelTabControl.cs (99%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseChatDisplay.cs (97%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseChatLink.cs (99%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseDirect.cs (99%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseDirectPanel.cs (97%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseExternalLinkButton.cs (94%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseGraph.cs (97%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseHistoricalSection.cs (97%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseRankGraph.cs (98%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseSocial.cs (98%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseStandAloneChatDisplay.cs (98%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseUserPanel.cs (98%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseUserProfile.cs (99%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseUserProfileRecentSection.cs (99%) rename osu.Game.Tests/Visual/{ => Online}/TestCaseUserRanks.cs (97%) rename osu.Game.Tests/Visual/{ => Settings}/TestCaseKeyConfiguration.cs (93%) rename osu.Game.Tests/Visual/{ => Settings}/TestCaseSettings.cs (95%) rename osu.Game.Tests/Visual/{ => SongSelect}/TestCaseBeatmapCarousel.cs (99%) rename osu.Game.Tests/Visual/{ => SongSelect}/TestCaseBeatmapDetailArea.cs (99%) rename osu.Game.Tests/Visual/{ => SongSelect}/TestCaseBeatmapDetails.cs (99%) rename osu.Game.Tests/Visual/{ => SongSelect}/TestCaseBeatmapInfoWedge.cs (99%) rename osu.Game.Tests/Visual/{ => SongSelect}/TestCaseBeatmapOptionsOverlay.cs (96%) rename osu.Game.Tests/Visual/{ => SongSelect}/TestCaseBeatmapScoresContainer.cs (99%) rename osu.Game.Tests/Visual/{ => SongSelect}/TestCaseLeaderboard.cs (99%) rename osu.Game.Tests/Visual/{ => SongSelect}/TestCasePlaySongSelect.cs (99%) rename osu.Game.Tests/Visual/{ => Tournament}/TestCaseDrawings.cs (98%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseBeatSyncedContainer.cs (99%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseBreadcrumbs.cs (96%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseButtonSystem.cs (96%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseContextMenu.cs (98%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseCursors.cs (99%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseDialogOverlay.cs (98%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseDrawableDate.cs (98%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseHoldToConfirmOverlay.cs (97%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseIconButton.cs (98%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseLabelledTextBox.cs (96%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseLoadingAnimation.cs (97%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseMods.cs (99%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseMusicController.cs (95%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseNotificationOverlay.cs (99%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseOnScreenDisplay.cs (98%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseParallaxContainer.cs (96%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCasePopupDialog.cs (96%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseScreenBreadcrumbControl.cs (99%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseTabControl.cs (96%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseTextAwesome.cs (97%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseTwoLayerButton.cs (90%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseUpdateableBeatmapBackgroundSprite.cs (98%) rename osu.Game.Tests/Visual/{ => UserInterface}/TestCaseVolumePieces.cs (96%) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs rename to osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs index ba3a02a843..e05fb2b306 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs @@ -33,7 +33,7 @@ using osu.Game.Users; using osuTK; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Background { [TestFixture] public class TestCaseBackgroundScreenBeatmap : ManualInputManagerTestCase diff --git a/osu.Game.Tests/Visual/TestCaseIdleTracker.cs b/osu.Game.Tests/Visual/Components/TestCaseIdleTracker.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseIdleTracker.cs rename to osu.Game.Tests/Visual/Components/TestCaseIdleTracker.cs index a7a1831ba7..bf59c116bb 100644 --- a/osu.Game.Tests/Visual/TestCaseIdleTracker.cs +++ b/osu.Game.Tests/Visual/Components/TestCaseIdleTracker.cs @@ -9,7 +9,7 @@ using osu.Game.Input; using osuTK; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Components { [TestFixture] public class TestCaseIdleTracker : ManualInputManagerTestCase diff --git a/osu.Game.Tests/Visual/TestCasePollingComponent.cs b/osu.Game.Tests/Visual/Components/TestCasePollingComponent.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCasePollingComponent.cs rename to osu.Game.Tests/Visual/Components/TestCasePollingComponent.cs index 63f4f88948..6582145f6e 100644 --- a/osu.Game.Tests/Visual/TestCasePollingComponent.cs +++ b/osu.Game.Tests/Visual/Components/TestCasePollingComponent.cs @@ -13,7 +13,7 @@ using osu.Game.Online; using osuTK; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Components { public class TestCasePollingComponent : OsuTestCase { diff --git a/osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs b/osu.Game.Tests/Visual/Components/TestCasePreviewTrackManager.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs rename to osu.Game.Tests/Visual/Components/TestCasePreviewTrackManager.cs index 87a1fb0faf..4b6ae696fe 100644 --- a/osu.Game.Tests/Visual/TestCasePreviewTrackManager.cs +++ b/osu.Game.Tests/Visual/Components/TestCasePreviewTrackManager.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics.Containers; using osu.Game.Audio; using osu.Game.Beatmaps; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Components { public class TestCasePreviewTrackManager : OsuTestCase, IPreviewTrackOwner { diff --git a/osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs b/osu.Game.Tests/Visual/Editor/TestCaseBeatDivisorControl.cs similarity index 95% rename from osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs rename to osu.Game.Tests/Visual/Editor/TestCaseBeatDivisorControl.cs index daf71a6447..e822e01110 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatDivisorControl.cs +++ b/osu.Game.Tests/Visual/Editor/TestCaseBeatDivisorControl.cs @@ -9,7 +9,7 @@ using osu.Game.Screens.Edit; using osu.Game.Screens.Edit.Compose.Components; using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Editor { public class TestCaseBeatDivisorControl : OsuTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseEditorCompose.cs b/osu.Game.Tests/Visual/Editor/TestCaseEditorCompose.cs similarity index 95% rename from osu.Game.Tests/Visual/TestCaseEditorCompose.cs rename to osu.Game.Tests/Visual/Editor/TestCaseEditorCompose.cs index a52454d684..aa7c7f5cb3 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorCompose.cs +++ b/osu.Game.Tests/Visual/Editor/TestCaseEditorCompose.cs @@ -9,7 +9,7 @@ using osu.Game.Rulesets.Osu; using osu.Game.Screens.Edit.Compose; using osu.Game.Tests.Beatmaps; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Editor { [TestFixture] public class TestCaseEditorCompose : EditorClockTestCase diff --git a/osu.Game.Tests/Visual/TestCaseEditorComposeRadioButtons.cs b/osu.Game.Tests/Visual/Editor/TestCaseEditorComposeRadioButtons.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseEditorComposeRadioButtons.cs rename to osu.Game.Tests/Visual/Editor/TestCaseEditorComposeRadioButtons.cs index 5a4ac77372..499db1b69f 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorComposeRadioButtons.cs +++ b/osu.Game.Tests/Visual/Editor/TestCaseEditorComposeRadioButtons.cs @@ -7,7 +7,7 @@ using NUnit.Framework; using osu.Framework.Graphics; using osu.Game.Screens.Edit.Components.RadioButtons; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Editor { [TestFixture] public class TestCaseEditorComposeRadioButtons : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs b/osu.Game.Tests/Visual/Editor/TestCaseEditorComposeTimeline.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs rename to osu.Game.Tests/Visual/Editor/TestCaseEditorComposeTimeline.cs index 9ae9b55546..d7712293c3 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorComposeTimeline.cs +++ b/osu.Game.Tests/Visual/Editor/TestCaseEditorComposeTimeline.cs @@ -6,7 +6,6 @@ using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Bindables; -using osuTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -14,9 +13,10 @@ using osu.Framework.Graphics.UserInterface; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Screens.Edit.Compose.Components.Timeline; +using osuTK; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Editor { [TestFixture] public class TestCaseEditorComposeTimeline : EditorClockTestCase diff --git a/osu.Game.Tests/Visual/TestCaseEditorMenuBar.cs b/osu.Game.Tests/Visual/Editor/TestCaseEditorMenuBar.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseEditorMenuBar.cs rename to osu.Game.Tests/Visual/Editor/TestCaseEditorMenuBar.cs index 2abbf7cb80..b012d4b52d 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorMenuBar.cs +++ b/osu.Game.Tests/Visual/Editor/TestCaseEditorMenuBar.cs @@ -10,7 +10,7 @@ using osu.Framework.Graphics.UserInterface; using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Edit.Components.Menus; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Editor { [TestFixture] public class TestCaseEditorMenuBar : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseEditorSeekSnapping.cs b/osu.Game.Tests/Visual/Editor/TestCaseEditorSeekSnapping.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseEditorSeekSnapping.cs rename to osu.Game.Tests/Visual/Editor/TestCaseEditorSeekSnapping.cs index 0ec87e6f52..9daba54b58 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorSeekSnapping.cs +++ b/osu.Game.Tests/Visual/Editor/TestCaseEditorSeekSnapping.cs @@ -14,7 +14,7 @@ using osu.Game.Tests.Beatmaps; using osuTK; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Editor { [TestFixture] public class TestCaseEditorSeekSnapping : EditorClockTestCase diff --git a/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs b/osu.Game.Tests/Visual/Editor/TestCaseEditorSummaryTimeline.cs similarity index 96% rename from osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs rename to osu.Game.Tests/Visual/Editor/TestCaseEditorSummaryTimeline.cs index 305924958b..99d6385804 100644 --- a/osu.Game.Tests/Visual/TestCaseEditorSummaryTimeline.cs +++ b/osu.Game.Tests/Visual/Editor/TestCaseEditorSummaryTimeline.cs @@ -6,12 +6,12 @@ using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osuTK; -using osu.Game.Screens.Edit.Components.Timelines.Summary; using osu.Game.Rulesets.Osu; +using osu.Game.Screens.Edit.Components.Timelines.Summary; using osu.Game.Tests.Beatmaps; +using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Editor { [TestFixture] public class TestCaseEditorSummaryTimeline : EditorClockTestCase diff --git a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs b/osu.Game.Tests/Visual/Editor/TestCaseHitObjectComposer.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs rename to osu.Game.Tests/Visual/Editor/TestCaseHitObjectComposer.cs index 988c0459d4..be335fb71f 100644 --- a/osu.Game.Tests/Visual/TestCaseHitObjectComposer.cs +++ b/osu.Game.Tests/Visual/Editor/TestCaseHitObjectComposer.cs @@ -7,7 +7,6 @@ using JetBrains.Annotations; using NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Timing; -using osuTK; using osu.Game.Beatmaps; using osu.Game.Rulesets.Edit; using osu.Game.Rulesets.Objects; @@ -20,8 +19,9 @@ using osu.Game.Rulesets.Osu.Objects; using osu.Game.Screens.Edit.Compose; using osu.Game.Screens.Edit.Compose.Components; using osu.Game.Tests.Beatmaps; +using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Editor { [TestFixture] [Cached(Type = typeof(IPlacementHandler))] diff --git a/osu.Game.Tests/Visual/TestCasePlaybackControl.cs b/osu.Game.Tests/Visual/Editor/TestCasePlaybackControl.cs similarity index 96% rename from osu.Game.Tests/Visual/TestCasePlaybackControl.cs rename to osu.Game.Tests/Visual/Editor/TestCasePlaybackControl.cs index abcff24c67..7d9b43251e 100644 --- a/osu.Game.Tests/Visual/TestCasePlaybackControl.cs +++ b/osu.Game.Tests/Visual/Editor/TestCasePlaybackControl.cs @@ -10,7 +10,7 @@ using osu.Game.Screens.Edit.Components; using osu.Game.Tests.Beatmaps; using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Editor { [TestFixture] public class TestCasePlaybackControl : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseWaveContainer.cs b/osu.Game.Tests/Visual/Editor/TestCaseWaveContainer.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseWaveContainer.cs rename to osu.Game.Tests/Visual/Editor/TestCaseWaveContainer.cs index 07a282a1a7..e87304ded6 100644 --- a/osu.Game.Tests/Visual/TestCaseWaveContainer.cs +++ b/osu.Game.Tests/Visual/Editor/TestCaseWaveContainer.cs @@ -12,7 +12,7 @@ using osu.Game.Graphics.Sprites; using osuTK; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Editor { [TestFixture] public class TestCaseWaveContainer : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseWaveform.cs b/osu.Game.Tests/Visual/Editor/TestCaseWaveform.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseWaveform.cs rename to osu.Game.Tests/Visual/Editor/TestCaseWaveform.cs index 9330070392..c35e8741c1 100644 --- a/osu.Game.Tests/Visual/TestCaseWaveform.cs +++ b/osu.Game.Tests/Visual/Editor/TestCaseWaveform.cs @@ -2,16 +2,16 @@ // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; -using osuTK; -using osuTK.Graphics; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Audio; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Sprites; +using osuTK; +using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Editor { [TestFixture] public class TestCaseWaveform : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseZoomableScrollContainer.cs b/osu.Game.Tests/Visual/Editor/TestCaseZoomableScrollContainer.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseZoomableScrollContainer.cs rename to osu.Game.Tests/Visual/Editor/TestCaseZoomableScrollContainer.cs index c3e8e4e05f..e2cf1ef28a 100644 --- a/osu.Game.Tests/Visual/TestCaseZoomableScrollContainer.cs +++ b/osu.Game.Tests/Visual/Editor/TestCaseZoomableScrollContainer.cs @@ -14,7 +14,7 @@ using osu.Game.Screens.Edit.Compose.Components.Timeline; using osuTK; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Editor { public class TestCaseZoomableScrollContainer : ManualInputManagerTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseAutoplay.cs b/osu.Game.Tests/Visual/Gameplay/TestCaseAutoplay.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseAutoplay.cs rename to osu.Game.Tests/Visual/Gameplay/TestCaseAutoplay.cs index 4d6a0ae7b8..2b0254f232 100644 --- a/osu.Game.Tests/Visual/TestCaseAutoplay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCaseAutoplay.cs @@ -7,7 +7,7 @@ using osu.Game.Rulesets; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { [Description("Player instantiated with an autoplay mod.")] public class TestCaseAutoplay : AllPlayersTestCase diff --git a/osu.Game.Tests/Visual/TestCaseBreakOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestCaseBreakOverlay.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseBreakOverlay.cs rename to osu.Game.Tests/Visual/Gameplay/TestCaseBreakOverlay.cs index f45d3c98ca..dda8005f70 100644 --- a/osu.Game.Tests/Visual/TestCaseBreakOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCaseBreakOverlay.cs @@ -1,12 +1,12 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osu.Game.Beatmaps.Timing; using System.Collections.Generic; using NUnit.Framework; +using osu.Game.Beatmaps.Timing; using osu.Game.Screens.Play; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { [TestFixture] public class TestCaseBreakOverlay : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestCaseGameplayMenuOverlay.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs rename to osu.Game.Tests/Visual/Gameplay/TestCaseGameplayMenuOverlay.cs index 0a240186d2..8e43bf6d3a 100644 --- a/osu.Game.Tests/Visual/TestCaseGameplayMenuOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCaseGameplayMenuOverlay.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; -using osuTK.Input; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -13,8 +12,9 @@ using osu.Framework.Logging; using osu.Game.Input.Bindings; using osu.Game.Screens.Play; using osuTK; +using osuTK.Input; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { [Description("player pause/fail screens")] public class TestCaseGameplayMenuOverlay : ManualInputManagerTestCase diff --git a/osu.Game.Tests/Visual/TestCaseHoldForMenuButton.cs b/osu.Game.Tests/Visual/Gameplay/TestCaseHoldForMenuButton.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseHoldForMenuButton.cs rename to osu.Game.Tests/Visual/Gameplay/TestCaseHoldForMenuButton.cs index a4fadbd3db..14e9c7cdb6 100644 --- a/osu.Game.Tests/Visual/TestCaseHoldForMenuButton.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCaseHoldForMenuButton.cs @@ -10,7 +10,7 @@ using osu.Game.Screens.Play.HUD; using osuTK; using osuTK.Input; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { [Description("'Hold to Quit' UI element")] public class TestCaseHoldForMenuButton : ManualInputManagerTestCase diff --git a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs b/osu.Game.Tests/Visual/Gameplay/TestCaseKeyCounter.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseKeyCounter.cs rename to osu.Game.Tests/Visual/Gameplay/TestCaseKeyCounter.cs index 52caffc29f..f616ffe4ed 100644 --- a/osu.Game.Tests/Visual/TestCaseKeyCounter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCaseKeyCounter.cs @@ -11,7 +11,7 @@ using osu.Framework.Timing; using osu.Game.Screens.Play; using osuTK.Input; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { [TestFixture] public class TestCaseKeyCounter : ManualInputManagerTestCase diff --git a/osu.Game.Tests/Visual/TestCaseMedalOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestCaseMedalOverlay.cs similarity index 95% rename from osu.Game.Tests/Visual/TestCaseMedalOverlay.cs rename to osu.Game.Tests/Visual/Gameplay/TestCaseMedalOverlay.cs index c7c85fc412..dd686c36e6 100644 --- a/osu.Game.Tests/Visual/TestCaseMedalOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCaseMedalOverlay.cs @@ -8,7 +8,7 @@ using osu.Game.Overlays; using osu.Game.Overlays.MedalSplash; using osu.Game.Users; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { [TestFixture] public class TestCaseMedalOverlay : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCasePause.cs b/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCasePause.cs rename to osu.Game.Tests/Visual/Gameplay/TestCasePause.cs index d5d2cebbab..1ed61c9fe1 100644 --- a/osu.Game.Tests/Visual/TestCasePause.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCasePause.cs @@ -9,7 +9,7 @@ using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Scoring; using osu.Game.Screens.Play; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { public class TestCasePause : PlayerTestCase { diff --git a/osu.Game.Tests/Visual/TestCasePlayerLoader.cs b/osu.Game.Tests/Visual/Gameplay/TestCasePlayerLoader.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCasePlayerLoader.cs rename to osu.Game.Tests/Visual/Gameplay/TestCasePlayerLoader.cs index 2bc416f7f4..bcedcb10a6 100644 --- a/osu.Game.Tests/Visual/TestCasePlayerLoader.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCasePlayerLoader.cs @@ -9,7 +9,7 @@ using osu.Game.Beatmaps; using osu.Game.Screens; using osu.Game.Screens.Play; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { public class TestCasePlayerLoader : ManualInputManagerTestCase { diff --git a/osu.Game.Tests/Visual/TestCasePlayerReferenceLeaking.cs b/osu.Game.Tests/Visual/Gameplay/TestCasePlayerReferenceLeaking.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCasePlayerReferenceLeaking.cs rename to osu.Game.Tests/Visual/Gameplay/TestCasePlayerReferenceLeaking.cs index 3e009ae080..5937d489f2 100644 --- a/osu.Game.Tests/Visual/TestCasePlayerReferenceLeaking.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCasePlayerReferenceLeaking.cs @@ -8,7 +8,7 @@ using osu.Game.Beatmaps; using osu.Game.Rulesets; using osu.Game.Screens.Play; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { public class TestCasePlayerReferenceLeaking : AllPlayersTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseReplay.cs b/osu.Game.Tests/Visual/Gameplay/TestCaseReplay.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseReplay.cs rename to osu.Game.Tests/Visual/Gameplay/TestCaseReplay.cs index 3a7e2352f8..b98ce96fbb 100644 --- a/osu.Game.Tests/Visual/TestCaseReplay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCaseReplay.cs @@ -8,7 +8,7 @@ using osu.Game.Rulesets.Scoring; using osu.Game.Scoring; using osu.Game.Screens.Play; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { [Description("Player instantiated with a replay.")] public class TestCaseReplay : AllPlayersTestCase diff --git a/osu.Game.Tests/Visual/TestCaseReplaySettingsOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestCaseReplaySettingsOverlay.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseReplaySettingsOverlay.cs rename to osu.Game.Tests/Visual/Gameplay/TestCaseReplaySettingsOverlay.cs index af71efb9e7..2fdfda0d80 100644 --- a/osu.Game.Tests/Visual/TestCaseReplaySettingsOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCaseReplaySettingsOverlay.cs @@ -7,7 +7,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.PlayerSettings; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { [TestFixture] public class TestCaseReplaySettingsOverlay : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseResults.cs b/osu.Game.Tests/Visual/Gameplay/TestCaseResults.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseResults.cs rename to osu.Game.Tests/Visual/Gameplay/TestCaseResults.cs index c2880c1ea2..d9da45f39a 100644 --- a/osu.Game.Tests/Visual/TestCaseResults.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCaseResults.cs @@ -13,7 +13,7 @@ using osu.Game.Screens.Ranking; using osu.Game.Screens.Ranking.Pages; using osu.Game.Users; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { [TestFixture] public class TestCaseResults : ScreenTestCase diff --git a/osu.Game.Tests/Visual/TestCaseScoreCounter.cs b/osu.Game.Tests/Visual/Gameplay/TestCaseScoreCounter.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseScoreCounter.cs rename to osu.Game.Tests/Visual/Gameplay/TestCaseScoreCounter.cs index 3519ea67a6..3dd5c99e45 100644 --- a/osu.Game.Tests/Visual/TestCaseScoreCounter.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCaseScoreCounter.cs @@ -9,7 +9,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Play.HUD; using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { [TestFixture] public class TestCaseScoreCounter : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs b/osu.Game.Tests/Visual/Gameplay/TestCaseScrollingHitObjects.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs rename to osu.Game.Tests/Visual/Gameplay/TestCaseScrollingHitObjects.cs index 5ebb9b270f..a1cec1e18f 100644 --- a/osu.Game.Tests/Visual/TestCaseScrollingHitObjects.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCaseScrollingHitObjects.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Extensions.IEnumerableExtensions; -using osuTK; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -15,8 +14,9 @@ using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Timing; using osu.Game.Rulesets.UI; using osu.Game.Rulesets.UI.Scrolling; +using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { [TestFixture] public class TestCaseScrollingHitObjects : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseSkinReloadable.cs b/osu.Game.Tests/Visual/Gameplay/TestCaseSkinReloadable.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseSkinReloadable.cs rename to osu.Game.Tests/Visual/Gameplay/TestCaseSkinReloadable.cs index 94f01e9d32..a9fbf35d37 100644 --- a/osu.Game.Tests/Visual/TestCaseSkinReloadable.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCaseSkinReloadable.cs @@ -13,7 +13,7 @@ using osu.Game.Graphics; using osu.Game.Skinning; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { public class TestCaseSkinReloadable : OsuTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseSkipOverlay.cs b/osu.Game.Tests/Visual/Gameplay/TestCaseSkipOverlay.cs similarity index 91% rename from osu.Game.Tests/Visual/TestCaseSkipOverlay.cs rename to osu.Game.Tests/Visual/Gameplay/TestCaseSkipOverlay.cs index b51ba9c563..b46d79ac04 100644 --- a/osu.Game.Tests/Visual/TestCaseSkipOverlay.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCaseSkipOverlay.cs @@ -4,7 +4,7 @@ using NUnit.Framework; using osu.Game.Screens.Play; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { [TestFixture] public class TestCaseSkipOverlay : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseSongProgress.cs b/osu.Game.Tests/Visual/Gameplay/TestCaseSongProgress.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseSongProgress.cs rename to osu.Game.Tests/Visual/Gameplay/TestCaseSongProgress.cs index 511272a5ae..e17dcef19c 100644 --- a/osu.Game.Tests/Visual/TestCaseSongProgress.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCaseSongProgress.cs @@ -10,7 +10,7 @@ using osu.Framework.Timing; using osu.Game.Rulesets.Objects; using osu.Game.Screens.Play; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { [TestFixture] public class TestCaseSongProgress : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseStoryboard.cs b/osu.Game.Tests/Visual/Gameplay/TestCaseStoryboard.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseStoryboard.cs rename to osu.Game.Tests/Visual/Gameplay/TestCaseStoryboard.cs index c4b41e40f4..651683a671 100644 --- a/osu.Game.Tests/Visual/TestCaseStoryboard.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestCaseStoryboard.cs @@ -13,7 +13,7 @@ using osu.Game.Overlays; using osu.Game.Storyboards.Drawables; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Gameplay { [TestFixture] public class TestCaseStoryboard : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseDisclaimer.cs b/osu.Game.Tests/Visual/Menus/TestCaseDisclaimer.cs similarity index 96% rename from osu.Game.Tests/Visual/TestCaseDisclaimer.cs rename to osu.Game.Tests/Visual/Menus/TestCaseDisclaimer.cs index 8bba16e4b4..68a1ceec16 100644 --- a/osu.Game.Tests/Visual/TestCaseDisclaimer.cs +++ b/osu.Game.Tests/Visual/Menus/TestCaseDisclaimer.cs @@ -6,7 +6,7 @@ using osu.Game.Online.API; using osu.Game.Screens.Menu; using osu.Game.Users; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Menus { public class TestCaseDisclaimer : ScreenTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseIntroSequence.cs b/osu.Game.Tests/Visual/Menus/TestCaseIntroSequence.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseIntroSequence.cs rename to osu.Game.Tests/Visual/Menus/TestCaseIntroSequence.cs index 0e57a76167..0b924e56f5 100644 --- a/osu.Game.Tests/Visual/TestCaseIntroSequence.cs +++ b/osu.Game.Tests/Visual/Menus/TestCaseIntroSequence.cs @@ -4,14 +4,14 @@ using System; using System.Collections.Generic; using NUnit.Framework; -using osuTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.Timing; using osu.Game.Screens.Menu; +using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Menus { [TestFixture] public class TestCaseIntroSequence : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseLoaderAnimation.cs b/osu.Game.Tests/Visual/Menus/TestCaseLoaderAnimation.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseLoaderAnimation.cs rename to osu.Game.Tests/Visual/Menus/TestCaseLoaderAnimation.cs index 3803764194..899f9d431b 100644 --- a/osu.Game.Tests/Visual/TestCaseLoaderAnimation.cs +++ b/osu.Game.Tests/Visual/Menus/TestCaseLoaderAnimation.cs @@ -9,7 +9,7 @@ using osu.Game.Screens; using osu.Game.Screens.Menu; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Menus { [TestFixture] public class TestCaseLoaderAnimation : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseToolbar.cs b/osu.Game.Tests/Visual/Menus/TestCaseToolbar.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseToolbar.cs rename to osu.Game.Tests/Visual/Menus/TestCaseToolbar.cs index cb5f33911b..4da17f9944 100644 --- a/osu.Game.Tests/Visual/TestCaseToolbar.cs +++ b/osu.Game.Tests/Visual/Menus/TestCaseToolbar.cs @@ -8,7 +8,7 @@ using NUnit.Framework; using osu.Framework.Graphics.Containers; using osu.Game.Overlays.Toolbar; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Menus { [TestFixture] public class TestCaseToolbar : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseLoungeRoomsContainer.cs b/osu.Game.Tests/Visual/Multiplayer/TestCaseLoungeRoomsContainer.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseLoungeRoomsContainer.cs rename to osu.Game.Tests/Visual/Multiplayer/TestCaseLoungeRoomsContainer.cs index 13bc5e24d9..34de61cb5b 100644 --- a/osu.Game.Tests/Visual/TestCaseLoungeRoomsContainer.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestCaseLoungeRoomsContainer.cs @@ -14,7 +14,7 @@ using osu.Game.Screens.Multi.Lounge.Components; using osu.Game.Users; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Multiplayer { public class TestCaseLoungeRoomsContainer : MultiplayerTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseMatchHeader.cs b/osu.Game.Tests/Visual/Multiplayer/TestCaseMatchHeader.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseMatchHeader.cs rename to osu.Game.Tests/Visual/Multiplayer/TestCaseMatchHeader.cs index 296e5f24ac..81cb90c7cd 100644 --- a/osu.Game.Tests/Visual/TestCaseMatchHeader.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestCaseMatchHeader.cs @@ -10,7 +10,7 @@ using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Screens.Multi.Match.Components; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Multiplayer { public class TestCaseMatchHeader : MultiplayerTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseMatchHostInfo.cs b/osu.Game.Tests/Visual/Multiplayer/TestCaseMatchHostInfo.cs similarity index 95% rename from osu.Game.Tests/Visual/TestCaseMatchHostInfo.cs rename to osu.Game.Tests/Visual/Multiplayer/TestCaseMatchHostInfo.cs index 45092c5b93..d2dc417100 100644 --- a/osu.Game.Tests/Visual/TestCaseMatchHostInfo.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestCaseMatchHostInfo.cs @@ -8,7 +8,7 @@ using osu.Framework.Graphics; using osu.Game.Screens.Multi.Match.Components; using osu.Game.Users; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Multiplayer { public class TestCaseMatchHostInfo : OsuTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseMatchInfo.cs b/osu.Game.Tests/Visual/Multiplayer/TestCaseMatchInfo.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseMatchInfo.cs rename to osu.Game.Tests/Visual/Multiplayer/TestCaseMatchInfo.cs index 901c4f1644..6b04b71da4 100644 --- a/osu.Game.Tests/Visual/TestCaseMatchInfo.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestCaseMatchInfo.cs @@ -11,7 +11,7 @@ using osu.Game.Online.Multiplayer.RoomStatuses; using osu.Game.Rulesets; using osu.Game.Screens.Multi.Match.Components; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Multiplayer { [TestFixture] public class TestCaseMatchInfo : MultiplayerTestCase diff --git a/osu.Game.Tests/Visual/TestCaseMatchLeaderboard.cs b/osu.Game.Tests/Visual/Multiplayer/TestCaseMatchLeaderboard.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseMatchLeaderboard.cs rename to osu.Game.Tests/Visual/Multiplayer/TestCaseMatchLeaderboard.cs index 484a212a38..8ec323dbc3 100644 --- a/osu.Game.Tests/Visual/TestCaseMatchLeaderboard.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestCaseMatchLeaderboard.cs @@ -10,7 +10,7 @@ using osu.Game.Screens.Multi.Match.Components; using osu.Game.Users; using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Multiplayer { public class TestCaseMatchLeaderboard : MultiplayerTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseMatchParticipants.cs b/osu.Game.Tests/Visual/Multiplayer/TestCaseMatchParticipants.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseMatchParticipants.cs rename to osu.Game.Tests/Visual/Multiplayer/TestCaseMatchParticipants.cs index 716523c23c..5382726516 100644 --- a/osu.Game.Tests/Visual/TestCaseMatchParticipants.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestCaseMatchParticipants.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics; using osu.Game.Screens.Multi.Match.Components; using osu.Game.Users; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Multiplayer { [TestFixture] public class TestCaseMatchParticipants : MultiplayerTestCase diff --git a/osu.Game.Tests/Visual/TestCaseMatchResults.cs b/osu.Game.Tests/Visual/Multiplayer/TestCaseMatchResults.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseMatchResults.cs rename to osu.Game.Tests/Visual/Multiplayer/TestCaseMatchResults.cs index 582c035e82..69606c9ba7 100644 --- a/osu.Game.Tests/Visual/TestCaseMatchResults.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestCaseMatchResults.cs @@ -16,7 +16,7 @@ using osu.Game.Screens.Multi.Ranking.Types; using osu.Game.Screens.Ranking; using osu.Game.Users; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Multiplayer { public class TestCaseMatchResults : MultiplayerTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs b/osu.Game.Tests/Visual/Multiplayer/TestCaseMatchSettingsOverlay.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs rename to osu.Game.Tests/Visual/Multiplayer/TestCaseMatchSettingsOverlay.cs index 11c7d3ef70..51854800e3 100644 --- a/osu.Game.Tests/Visual/TestCaseMatchSettingsOverlay.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestCaseMatchSettingsOverlay.cs @@ -15,7 +15,7 @@ using osu.Game.Online.Multiplayer; using osu.Game.Screens.Multi; using osu.Game.Screens.Multi.Match.Components; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Multiplayer { public class TestCaseMatchSettingsOverlay : MultiplayerTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseMultiHeader.cs b/osu.Game.Tests/Visual/Multiplayer/TestCaseMultiHeader.cs similarity index 96% rename from osu.Game.Tests/Visual/TestCaseMultiHeader.cs rename to osu.Game.Tests/Visual/Multiplayer/TestCaseMultiHeader.cs index f7802e2d08..b74c303726 100644 --- a/osu.Game.Tests/Visual/TestCaseMultiHeader.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestCaseMultiHeader.cs @@ -7,7 +7,7 @@ using osu.Framework.Screens; using osu.Game.Screens; using osu.Game.Screens.Multi; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Multiplayer { [TestFixture] public class TestCaseMultiHeader : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseMultiScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestCaseMultiScreen.cs similarity index 79% rename from osu.Game.Tests/Visual/TestCaseMultiScreen.cs rename to osu.Game.Tests/Visual/Multiplayer/TestCaseMultiScreen.cs index 804e3c5b1f..ef381efd67 100644 --- a/osu.Game.Tests/Visual/TestCaseMultiScreen.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestCaseMultiScreen.cs @@ -4,25 +4,24 @@ using System; using System.Collections.Generic; using NUnit.Framework; -using osu.Game.Screens.Multi; using osu.Game.Screens.Multi.Lounge; using osu.Game.Screens.Multi.Lounge.Components; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Multiplayer { [TestFixture] public class TestCaseMultiScreen : ScreenTestCase { public override IReadOnlyList RequiredTypes => new[] { - typeof(Multiplayer), + typeof(Screens.Multi.Multiplayer), typeof(LoungeSubScreen), typeof(FilterControl) }; public TestCaseMultiScreen() { - Multiplayer multi = new Multiplayer(); + Screens.Multi.Multiplayer multi = new Screens.Multi.Multiplayer(); AddStep(@"show", () => LoadScreen(multi)); } diff --git a/osu.Game.Tests/Visual/TestCaseRoomStatus.cs b/osu.Game.Tests/Visual/Multiplayer/TestCaseRoomStatus.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseRoomStatus.cs rename to osu.Game.Tests/Visual/Multiplayer/TestCaseRoomStatus.cs index 7d175c3c49..a7c7d41ed4 100644 --- a/osu.Game.Tests/Visual/TestCaseRoomStatus.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestCaseRoomStatus.cs @@ -9,7 +9,7 @@ using osu.Game.Online.Multiplayer; using osu.Game.Online.Multiplayer.RoomStatuses; using osu.Game.Screens.Multi.Lounge.Components; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Multiplayer { public class TestCaseRoomStatus : OsuTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseAccountCreationOverlay.cs b/osu.Game.Tests/Visual/Online/TestCaseAccountCreationOverlay.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseAccountCreationOverlay.cs rename to osu.Game.Tests/Visual/Online/TestCaseAccountCreationOverlay.cs index 24380645d1..5cdb90b61f 100644 --- a/osu.Game.Tests/Visual/TestCaseAccountCreationOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseAccountCreationOverlay.cs @@ -11,7 +11,7 @@ using osu.Game.Overlays; using osu.Game.Overlays.AccountCreation; using osu.Game.Users; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { public class TestCaseAccountCreationOverlay : OsuTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseBadgeContainer.cs b/osu.Game.Tests/Visual/Online/TestCaseBadgeContainer.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseBadgeContainer.cs rename to osu.Game.Tests/Visual/Online/TestCaseBadgeContainer.cs index 892c87653d..631cb190d2 100644 --- a/osu.Game.Tests/Visual/TestCaseBadgeContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseBadgeContainer.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics; using osu.Game.Overlays.Profile.Header; using osu.Game.Users; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { [TestFixture] public class TestCaseBadgeContainer : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapSetOverlay.cs b/osu.Game.Tests/Visual/Online/TestCaseBeatmapSetOverlay.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseBeatmapSetOverlay.cs rename to osu.Game.Tests/Visual/Online/TestCaseBeatmapSetOverlay.cs index b98014b866..e2985623fc 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapSetOverlay.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseBeatmapSetOverlay.cs @@ -14,7 +14,7 @@ using osu.Game.Overlays.BeatmapSet.Scores; using osu.Game.Rulesets; using osu.Game.Users; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { [TestFixture] public class TestCaseBeatmapSetOverlay : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseChannelTabControl.cs b/osu.Game.Tests/Visual/Online/TestCaseChannelTabControl.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseChannelTabControl.cs rename to osu.Game.Tests/Visual/Online/TestCaseChannelTabControl.cs index e90b5f5372..fdc3d5394f 100644 --- a/osu.Game.Tests/Visual/TestCaseChannelTabControl.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseChannelTabControl.cs @@ -15,7 +15,7 @@ using osu.Game.Overlays.Chat.Tabs; using osu.Game.Users; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { public class TestCaseChannelTabControl : OsuTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseChatDisplay.cs b/osu.Game.Tests/Visual/Online/TestCaseChatDisplay.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseChatDisplay.cs rename to osu.Game.Tests/Visual/Online/TestCaseChatDisplay.cs index 57e4850f84..6e20165c1b 100644 --- a/osu.Game.Tests/Visual/TestCaseChatDisplay.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseChatDisplay.cs @@ -12,7 +12,7 @@ using osu.Game.Overlays; using osu.Game.Overlays.Chat; using osu.Game.Overlays.Chat.Tabs; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { [Description("Testing chat api and overlay")] public class TestCaseChatDisplay : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseChatLink.cs b/osu.Game.Tests/Visual/Online/TestCaseChatLink.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseChatLink.cs rename to osu.Game.Tests/Visual/Online/TestCaseChatLink.cs index ecab64ccf3..8843f136a1 100644 --- a/osu.Game.Tests/Visual/TestCaseChatLink.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseChatLink.cs @@ -1,24 +1,24 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using osuTK.Graphics; -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Game.Graphics; -using osu.Game.Online.Chat; -using osu.Game.Overlays.Chat; -using osu.Game.Users; using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; +using osu.Framework.Allocation; using osu.Framework.Bindables; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; +using osu.Game.Online.Chat; using osu.Game.Overlays; +using osu.Game.Overlays.Chat; +using osu.Game.Users; +using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { [TestFixture] public class TestCaseChatLink : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseDirect.cs b/osu.Game.Tests/Visual/Online/TestCaseDirect.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseDirect.cs rename to osu.Game.Tests/Visual/Online/TestCaseDirect.cs index 24ac38c128..ff57104d8a 100644 --- a/osu.Game.Tests/Visual/TestCaseDirect.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseDirect.cs @@ -8,7 +8,7 @@ using osu.Game.Beatmaps; using osu.Game.Overlays; using osu.Game.Rulesets; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { [TestFixture] public class TestCaseDirect : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseDirectPanel.cs b/osu.Game.Tests/Visual/Online/TestCaseDirectPanel.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseDirectPanel.cs rename to osu.Game.Tests/Visual/Online/TestCaseDirectPanel.cs index beb88ac56c..fbda531792 100644 --- a/osu.Game.Tests/Visual/TestCaseDirectPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseDirectPanel.cs @@ -11,7 +11,7 @@ using osu.Game.Rulesets.Osu; using osu.Game.Tests.Beatmaps; using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { public class TestCaseDirectPanel : OsuTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseExternalLinkButton.cs b/osu.Game.Tests/Visual/Online/TestCaseExternalLinkButton.cs similarity index 94% rename from osu.Game.Tests/Visual/TestCaseExternalLinkButton.cs rename to osu.Game.Tests/Visual/Online/TestCaseExternalLinkButton.cs index 6f807e96f1..a73cbd86d0 100644 --- a/osu.Game.Tests/Visual/TestCaseExternalLinkButton.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseExternalLinkButton.cs @@ -6,7 +6,7 @@ using System.Collections.Generic; using osu.Game.Graphics.UserInterface; using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { public class TestCaseExternalLinkButton : OsuTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseGraph.cs b/osu.Game.Tests/Visual/Online/TestCaseGraph.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseGraph.cs rename to osu.Game.Tests/Visual/Online/TestCaseGraph.cs index 6a5865b752..77e850fc92 100644 --- a/osu.Game.Tests/Visual/TestCaseGraph.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseGraph.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics; using osu.Game.Graphics.UserInterface; using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { [TestFixture] public class TestCaseGraph : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseHistoricalSection.cs b/osu.Game.Tests/Visual/Online/TestCaseHistoricalSection.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseHistoricalSection.cs rename to osu.Game.Tests/Visual/Online/TestCaseHistoricalSection.cs index 60e6148c49..92aa9320c8 100644 --- a/osu.Game.Tests/Visual/TestCaseHistoricalSection.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseHistoricalSection.cs @@ -12,7 +12,7 @@ using osu.Game.Overlays.Profile.Sections; using osu.Game.Overlays.Profile.Sections.Historical; using osu.Game.Users; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { [TestFixture] public class TestCaseHistoricalSection : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseRankGraph.cs b/osu.Game.Tests/Visual/Online/TestCaseRankGraph.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseRankGraph.cs rename to osu.Game.Tests/Visual/Online/TestCaseRankGraph.cs index f41033c0be..dff018bf91 100644 --- a/osu.Game.Tests/Visual/TestCaseRankGraph.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseRankGraph.cs @@ -1,19 +1,19 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using System.Collections.Generic; +using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using osuTK; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; -using System.Collections.Generic; -using System; -using NUnit.Framework; using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Profile.Header; using osu.Game.Users; +using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { [TestFixture] public class TestCaseRankGraph : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseSocial.cs b/osu.Game.Tests/Visual/Online/TestCaseSocial.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseSocial.cs rename to osu.Game.Tests/Visual/Online/TestCaseSocial.cs index d621bc600d..48325713df 100644 --- a/osu.Game.Tests/Visual/TestCaseSocial.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseSocial.cs @@ -8,7 +8,7 @@ using osu.Game.Overlays; using osu.Game.Overlays.Social; using osu.Game.Users; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { [TestFixture] public class TestCaseSocial : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseStandAloneChatDisplay.cs b/osu.Game.Tests/Visual/Online/TestCaseStandAloneChatDisplay.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseStandAloneChatDisplay.cs rename to osu.Game.Tests/Visual/Online/TestCaseStandAloneChatDisplay.cs index 65ae70168e..4c4b3b2612 100644 --- a/osu.Game.Tests/Visual/TestCaseStandAloneChatDisplay.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseStandAloneChatDisplay.cs @@ -7,7 +7,7 @@ using osu.Game.Online.Chat; using osu.Game.Users; using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { public class TestCaseStandAloneChatDisplay : OsuTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseUserPanel.cs b/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseUserPanel.cs rename to osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs index 8caa608d5e..b2877f7bd7 100644 --- a/osu.Game.Tests/Visual/TestCaseUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseUserPanel.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Game.Users; using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { [TestFixture] public class TestCaseUserPanel : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseUserProfile.cs b/osu.Game.Tests/Visual/Online/TestCaseUserProfile.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseUserProfile.cs rename to osu.Game.Tests/Visual/Online/TestCaseUserProfile.cs index aa0bd37449..5b86de28f9 100644 --- a/osu.Game.Tests/Visual/TestCaseUserProfile.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseUserProfile.cs @@ -13,7 +13,7 @@ using osu.Game.Overlays.Profile; using osu.Game.Overlays.Profile.Header; using osu.Game.Users; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { [TestFixture] public class TestCaseUserProfile : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseUserProfileRecentSection.cs b/osu.Game.Tests/Visual/Online/TestCaseUserProfileRecentSection.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseUserProfileRecentSection.cs rename to osu.Game.Tests/Visual/Online/TestCaseUserProfileRecentSection.cs index da50653831..6b29ed1e85 100644 --- a/osu.Game.Tests/Visual/TestCaseUserProfileRecentSection.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseUserProfileRecentSection.cs @@ -1,20 +1,20 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using System.Collections.Generic; +using System.Linq; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Online.API.Requests; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.Profile.Sections; using osu.Game.Overlays.Profile.Sections.Recent; -using System; -using System.Collections.Generic; -using System.Linq; -using osu.Game.Online.API.Requests.Responses; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { [TestFixture] public class TestCaseUserProfileRecentSection : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseUserRanks.cs b/osu.Game.Tests/Visual/Online/TestCaseUserRanks.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseUserRanks.cs rename to osu.Game.Tests/Visual/Online/TestCaseUserRanks.cs index 96638ef703..64257f8877 100644 --- a/osu.Game.Tests/Visual/TestCaseUserRanks.cs +++ b/osu.Game.Tests/Visual/Online/TestCaseUserRanks.cs @@ -1,6 +1,9 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using System.Collections.Generic; +using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; @@ -8,11 +11,8 @@ using osu.Game.Graphics; using osu.Game.Overlays.Profile.Sections; using osu.Game.Overlays.Profile.Sections.Ranks; using osu.Game.Users; -using System; -using System.Collections.Generic; -using NUnit.Framework; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Online { [TestFixture] public class TestCaseUserRanks : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseKeyConfiguration.cs b/osu.Game.Tests/Visual/Settings/TestCaseKeyConfiguration.cs similarity index 93% rename from osu.Game.Tests/Visual/TestCaseKeyConfiguration.cs rename to osu.Game.Tests/Visual/Settings/TestCaseKeyConfiguration.cs index cd299be1e9..ce179c21ba 100644 --- a/osu.Game.Tests/Visual/TestCaseKeyConfiguration.cs +++ b/osu.Game.Tests/Visual/Settings/TestCaseKeyConfiguration.cs @@ -4,7 +4,7 @@ using NUnit.Framework; using osu.Game.Overlays; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Settings { [TestFixture] public class TestCaseKeyConfiguration : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseSettings.cs b/osu.Game.Tests/Visual/Settings/TestCaseSettings.cs similarity index 95% rename from osu.Game.Tests/Visual/TestCaseSettings.cs rename to osu.Game.Tests/Visual/Settings/TestCaseSettings.cs index 67f32a8335..e846d5c020 100644 --- a/osu.Game.Tests/Visual/TestCaseSettings.cs +++ b/osu.Game.Tests/Visual/Settings/TestCaseSettings.cs @@ -6,7 +6,7 @@ using osu.Framework.Allocation; using osu.Framework.Graphics.Containers; using osu.Game.Overlays; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Settings { [TestFixture] public class TestCaseSettings : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapCarousel.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs rename to osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapCarousel.cs index 956d84618c..1500605896 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapCarousel.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapCarousel.cs @@ -17,7 +17,7 @@ using osu.Game.Screens.Select; using osu.Game.Screens.Select.Carousel; using osu.Game.Screens.Select.Filter; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.SongSelect { [TestFixture] public class TestCaseBeatmapCarousel : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapDetailArea.cs b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapDetailArea.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseBeatmapDetailArea.cs rename to osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapDetailArea.cs index 6cc3982f9c..722a63f2b0 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapDetailArea.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapDetailArea.cs @@ -10,7 +10,7 @@ using osu.Game.Beatmaps; using osu.Game.Screens.Select; using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.SongSelect { [TestFixture] [System.ComponentModel.Description("PlaySongSelect leaderboard/details area")] diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapDetails.cs b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapDetails.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseBeatmapDetails.cs rename to osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapDetails.cs index 84af6453f5..37987b8884 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapDetails.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapDetails.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Screens.Select; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.SongSelect { [Description("PlaySongSelect beatmap details")] public class TestCaseBeatmapDetails : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapInfoWedge.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs rename to osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapInfoWedge.cs index 0d77ac666b..f3e44bd808 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapInfoWedge.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapInfoWedge.cs @@ -5,7 +5,6 @@ using System.Collections.Generic; using System.Linq; using JetBrains.Annotations; using NUnit.Framework; -using osuTK; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -20,8 +19,9 @@ using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Taiko; using osu.Game.Screens.Select; using osu.Game.Tests.Beatmaps; +using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.SongSelect { [TestFixture] public class TestCaseBeatmapInfoWedge : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapOptionsOverlay.cs b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapOptionsOverlay.cs similarity index 96% rename from osu.Game.Tests/Visual/TestCaseBeatmapOptionsOverlay.cs rename to osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapOptionsOverlay.cs index fdab57193b..49038dc2cf 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapOptionsOverlay.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapOptionsOverlay.cs @@ -7,7 +7,7 @@ using osu.Game.Screens.Select.Options; using osuTK.Graphics; using osuTK.Input; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.SongSelect { [Description("bottom beatmap details")] public class TestCaseBeatmapOptionsOverlay : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs rename to osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs index bb55c0b1e8..c7970b6ebb 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatmapScoresContainer.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestCaseBeatmapScoresContainer.cs @@ -1,24 +1,24 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Collections.Generic; using osu.Framework.Allocation; using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Framework.MathUtils; +using osu.Game.Beatmaps; using osu.Game.Graphics; +using osu.Game.Online.API.Requests.Responses; using osu.Game.Overlays.BeatmapSet.Scores; using osu.Game.Rulesets.Mods; +using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Scoring; -using osu.Game.Users; -using System.Collections.Generic; -using osu.Framework.Graphics.Containers; -using osu.Game.Beatmaps; -using osu.Game.Online.API.Requests.Responses; -using osu.Game.Rulesets.Osu; using osu.Game.Scoring; +using osu.Game.Users; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.SongSelect { [System.ComponentModel.Description("in BeatmapOverlay")] public class TestCaseBeatmapScoresContainer : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseLeaderboard.cs b/osu.Game.Tests/Visual/SongSelect/TestCaseLeaderboard.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseLeaderboard.cs rename to osu.Game.Tests/Visual/SongSelect/TestCaseLeaderboard.cs index eb1a2c0249..13ae6f228a 100644 --- a/osu.Game.Tests/Visual/TestCaseLeaderboard.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestCaseLeaderboard.cs @@ -4,18 +4,18 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using osu.Framework.Graphics; -using osu.Game.Screens.Select.Leaderboards; -using osu.Game.Users; -using osu.Framework.Allocation; -using osuTK; using System.Linq; +using osu.Framework.Allocation; +using osu.Framework.Graphics; using osu.Game.Beatmaps; using osu.Game.Online.Leaderboards; using osu.Game.Rulesets; using osu.Game.Scoring; +using osu.Game.Screens.Select.Leaderboards; +using osu.Game.Users; +using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.SongSelect { [Description("PlaySongSelect leaderboard")] public class TestCaseLeaderboard : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs b/osu.Game.Tests/Visual/SongSelect/TestCasePlaySongSelect.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCasePlaySongSelect.cs rename to osu.Game.Tests/Visual/SongSelect/TestCasePlaySongSelect.cs index 4a2cf24c6d..d5bc452d75 100644 --- a/osu.Game.Tests/Visual/TestCasePlaySongSelect.cs +++ b/osu.Game.Tests/Visual/SongSelect/TestCasePlaySongSelect.cs @@ -23,7 +23,7 @@ using osu.Game.Screens.Select; using osu.Game.Screens.Select.Carousel; using osu.Game.Screens.Select.Filter; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.SongSelect { [TestFixture] public class TestCasePlaySongSelect : ScreenTestCase @@ -41,7 +41,7 @@ namespace osu.Game.Tests.Visual public override IReadOnlyList RequiredTypes => new[] { - typeof(SongSelect), + typeof(Screens.Select.SongSelect), typeof(BeatmapCarousel), typeof(CarouselItem), diff --git a/osu.Game.Tests/Visual/TestCaseDrawings.cs b/osu.Game.Tests/Visual/Tournament/TestCaseDrawings.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseDrawings.cs rename to osu.Game.Tests/Visual/Tournament/TestCaseDrawings.cs index aad135b71f..9453d0a5b2 100644 --- a/osu.Game.Tests/Visual/TestCaseDrawings.cs +++ b/osu.Game.Tests/Visual/Tournament/TestCaseDrawings.cs @@ -6,7 +6,7 @@ using System.ComponentModel; using osu.Game.Screens.Tournament; using osu.Game.Screens.Tournament.Teams; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.Tournament { [Description("for tournament use")] public class TestCaseDrawings : ScreenTestCase diff --git a/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseBeatSyncedContainer.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseBeatSyncedContainer.cs index 2fd8d467f6..dcd194e050 100644 --- a/osu.Game.Tests/Visual/TestCaseBeatSyncedContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseBeatSyncedContainer.cs @@ -8,16 +8,16 @@ using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Lists; using osu.Framework.Timing; using osu.Game.Beatmaps.ControlPoints; +using osu.Game.Graphics; using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Overlays; using osuTK.Graphics; -using osu.Framework.Lists; -using osu.Game.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestCaseBeatSyncedContainer : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseBreadcrumbs.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseBreadcrumbs.cs similarity index 96% rename from osu.Game.Tests/Visual/TestCaseBreadcrumbs.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseBreadcrumbs.cs index 98ab884ead..5e09e0a5b9 100644 --- a/osu.Game.Tests/Visual/TestCaseBreadcrumbs.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseBreadcrumbs.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Graphics.UserInterface; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestCaseBreadcrumbs : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseButtonSystem.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseButtonSystem.cs similarity index 96% rename from osu.Game.Tests/Visual/TestCaseButtonSystem.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseButtonSystem.cs index 8ea2ab9dde..261e87ff07 100644 --- a/osu.Game.Tests/Visual/TestCaseButtonSystem.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseButtonSystem.cs @@ -11,7 +11,7 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Screens.Menu; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestCaseButtonSystem : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseContextMenu.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseContextMenu.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseContextMenu.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseContextMenu.cs index 5cbe97e21d..71cde787f9 100644 --- a/osu.Game.Tests/Visual/TestCaseContextMenu.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseContextMenu.cs @@ -7,12 +7,12 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.UserInterface; +using osu.Game.Graphics.Cursor; using osu.Game.Graphics.UserInterface; using osuTK; using osuTK.Graphics; -using osu.Game.Graphics.Cursor; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestCaseContextMenu : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseCursors.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseCursors.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseCursors.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseCursors.cs index 7d38a76c7d..5f45d9ba4d 100644 --- a/osu.Game.Tests/Visual/TestCaseCursors.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseCursors.cs @@ -14,7 +14,7 @@ using osu.Game.Graphics.Sprites; using osuTK; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestCaseCursors : ManualInputManagerTestCase diff --git a/osu.Game.Tests/Visual/TestCaseDialogOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseDialogOverlay.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseDialogOverlay.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseDialogOverlay.cs index e832793fc2..6b32f711e9 100644 --- a/osu.Game.Tests/Visual/TestCaseDialogOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseDialogOverlay.cs @@ -6,7 +6,7 @@ using osu.Game.Graphics; using osu.Game.Overlays; using osu.Game.Overlays.Dialog; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestCaseDialogOverlay : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseDrawableDate.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseDrawableDate.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseDrawableDate.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseDrawableDate.cs index 8d2182dd78..e8662ce965 100644 --- a/osu.Game.Tests/Visual/TestCaseDrawableDate.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseDrawableDate.cs @@ -9,7 +9,7 @@ using osu.Game.Graphics; using osuTK; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { public class TestCaseDrawableDate : OsuTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseHoldToConfirmOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseHoldToConfirmOverlay.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseHoldToConfirmOverlay.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseHoldToConfirmOverlay.cs index c9a7e9c39f..38dc4a11dc 100644 --- a/osu.Game.Tests/Visual/TestCaseHoldToConfirmOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseHoldToConfirmOverlay.cs @@ -8,7 +8,7 @@ using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Screens.Menu; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { public class TestCaseHoldToConfirmOverlay : OsuTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseIconButton.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseIconButton.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseIconButton.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseIconButton.cs index 63e10b6ecc..2898d1a1cc 100644 --- a/osu.Game.Tests/Visual/TestCaseIconButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseIconButton.cs @@ -2,16 +2,16 @@ // See the LICENCE file in the repository root for full licence text. using NUnit.Framework; -using osuTK; -using osuTK.Graphics; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; +using osuTK; +using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestCaseIconButton : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseLabelledTextBox.cs similarity index 96% rename from osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseLabelledTextBox.cs index 4b424f9875..781dfbdcc1 100644 --- a/osu.Game.Tests/Visual/TestCaseLabelledTextBox.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseLabelledTextBox.cs @@ -1,15 +1,15 @@ // 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 NUnit.Framework; using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; -using System; -using System.Collections.Generic; using osu.Game.Screens.Edit.Setup.Components.LabelledComponents; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestCaseLabelledTextBox : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseLoadingAnimation.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseLoadingAnimation.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseLoadingAnimation.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseLoadingAnimation.cs index f5dc1d449a..43f6f0e4db 100644 --- a/osu.Game.Tests/Visual/TestCaseLoadingAnimation.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseLoadingAnimation.cs @@ -7,7 +7,7 @@ using osu.Framework.Testing; using osu.Game.Graphics.UserInterface; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { public class TestCaseLoadingAnimation : GridTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseMods.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseMods.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseMods.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseMods.cs index cb7e783bee..aab44f7d92 100644 --- a/osu.Game.Tests/Visual/TestCaseMods.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseMods.cs @@ -2,26 +2,26 @@ // See the LICENCE file in the repository root for full licence text. using System; +using System.Collections.Generic; +using System.Linq; +using NUnit.Framework; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; +using osu.Game.Graphics.Sprites; +using osu.Game.Graphics.UserInterface; using osu.Game.Overlays.Mods; +using osu.Game.Overlays.Mods.Sections; using osu.Game.Rulesets; -using osu.Game.Screens.Play.HUD; -using osuTK; +using osu.Game.Rulesets.Mania.Mods; using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Osu.Mods; -using System.Linq; -using System.Collections.Generic; -using NUnit.Framework; -using osu.Framework.Bindables; -using osu.Game.Graphics.UserInterface; -using osu.Game.Graphics.Sprites; -using osu.Game.Overlays.Mods.Sections; -using osu.Game.Rulesets.Mania.Mods; using osu.Game.Rulesets.UI; +using osu.Game.Screens.Play.HUD; +using osuTK; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { [Description("mod select and icon display")] public class TestCaseMods : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseMusicController.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseMusicController.cs similarity index 95% rename from osu.Game.Tests/Visual/TestCaseMusicController.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseMusicController.cs index b4a1c11b1a..644c7eb4fc 100644 --- a/osu.Game.Tests/Visual/TestCaseMusicController.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseMusicController.cs @@ -7,7 +7,7 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Timing; using osu.Game.Overlays; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestCaseMusicController : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseNotificationOverlay.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseNotificationOverlay.cs index 9e70df91b6..4819597d22 100644 --- a/osu.Game.Tests/Visual/TestCaseNotificationOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseNotificationOverlay.cs @@ -12,7 +12,7 @@ using osu.Framework.MathUtils; using osu.Game.Overlays; using osu.Game.Overlays.Notifications; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestCaseNotificationOverlay : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseOnScreenDisplay.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseOnScreenDisplay.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseOnScreenDisplay.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseOnScreenDisplay.cs index 8b5ae0b208..7ad42cb926 100644 --- a/osu.Game.Tests/Visual/TestCaseOnScreenDisplay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseOnScreenDisplay.cs @@ -8,7 +8,7 @@ using osu.Framework.Configuration.Tracking; using osu.Framework.Graphics; using osu.Game.Overlays; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestCaseOnScreenDisplay : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseParallaxContainer.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseParallaxContainer.cs similarity index 96% rename from osu.Game.Tests/Visual/TestCaseParallaxContainer.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseParallaxContainer.cs index 41b029d69e..5de4c3f41f 100644 --- a/osu.Game.Tests/Visual/TestCaseParallaxContainer.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseParallaxContainer.cs @@ -6,7 +6,7 @@ using osu.Framework.Screens; using osu.Game.Graphics.Containers; using osu.Game.Screens.Backgrounds; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { public class TestCaseParallaxContainer : OsuTestCase { diff --git a/osu.Game.Tests/Visual/TestCasePopupDialog.cs b/osu.Game.Tests/Visual/UserInterface/TestCasePopupDialog.cs similarity index 96% rename from osu.Game.Tests/Visual/TestCasePopupDialog.cs rename to osu.Game.Tests/Visual/UserInterface/TestCasePopupDialog.cs index 51b5c41e0d..490903a906 100644 --- a/osu.Game.Tests/Visual/TestCasePopupDialog.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCasePopupDialog.cs @@ -6,7 +6,7 @@ using osu.Framework.Graphics; using osu.Game.Graphics; using osu.Game.Overlays.Dialog; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestCasePopupDialog : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseScreenBreadcrumbControl.cs similarity index 99% rename from osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseScreenBreadcrumbControl.cs index dad684689e..b4b24ae4df 100644 --- a/osu.Game.Tests/Visual/TestCaseScreenBreadcrumbControl.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseScreenBreadcrumbControl.cs @@ -13,7 +13,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Screens; using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestCaseScreenBreadcrumbControl : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseTabControl.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseTabControl.cs similarity index 96% rename from osu.Game.Tests/Visual/TestCaseTabControl.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseTabControl.cs index ebf8f3bb30..480dc73dde 100644 --- a/osu.Game.Tests/Visual/TestCaseTabControl.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseTabControl.cs @@ -8,7 +8,7 @@ using osu.Game.Graphics.UserInterface; using osu.Game.Screens.Select.Filter; using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { [Description("SongSelect filter control")] public class TestCaseTabControl : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseTextAwesome.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseTextAwesome.cs similarity index 97% rename from osu.Game.Tests/Visual/TestCaseTextAwesome.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseTextAwesome.cs index 6ab9a46e8d..40179387e2 100644 --- a/osu.Game.Tests/Visual/TestCaseTextAwesome.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseTextAwesome.cs @@ -9,7 +9,7 @@ using osu.Framework.Graphics.Cursor; using osu.Game.Graphics; using osuTK; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { [TestFixture] public class TestCaseTextAwesome : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseTwoLayerButton.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseTwoLayerButton.cs similarity index 90% rename from osu.Game.Tests/Visual/TestCaseTwoLayerButton.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseTwoLayerButton.cs index 9141aaa580..8d3cc7a0f2 100644 --- a/osu.Game.Tests/Visual/TestCaseTwoLayerButton.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseTwoLayerButton.cs @@ -4,7 +4,7 @@ using System.ComponentModel; using osu.Game.Graphics.UserInterface; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { [Description("mostly back button")] public class TestCaseTwoLayerButton : OsuTestCase diff --git a/osu.Game.Tests/Visual/TestCaseUpdateableBeatmapBackgroundSprite.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseUpdateableBeatmapBackgroundSprite.cs similarity index 98% rename from osu.Game.Tests/Visual/TestCaseUpdateableBeatmapBackgroundSprite.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseUpdateableBeatmapBackgroundSprite.cs index 0981b482a1..74114b2e53 100644 --- a/osu.Game.Tests/Visual/TestCaseUpdateableBeatmapBackgroundSprite.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseUpdateableBeatmapBackgroundSprite.cs @@ -12,7 +12,7 @@ using osu.Game.Online.API.Requests; using osu.Game.Rulesets; using osu.Game.Tests.Beatmaps.IO; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { public class TestCaseUpdateableBeatmapBackgroundSprite : OsuTestCase { diff --git a/osu.Game.Tests/Visual/TestCaseVolumePieces.cs b/osu.Game.Tests/Visual/UserInterface/TestCaseVolumePieces.cs similarity index 96% rename from osu.Game.Tests/Visual/TestCaseVolumePieces.cs rename to osu.Game.Tests/Visual/UserInterface/TestCaseVolumePieces.cs index 6dee047ae6..3ad1c922e4 100644 --- a/osu.Game.Tests/Visual/TestCaseVolumePieces.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestCaseVolumePieces.cs @@ -8,7 +8,7 @@ using osu.Game.Overlays.Volume; using osuTK; using osuTK.Graphics; -namespace osu.Game.Tests.Visual +namespace osu.Game.Tests.Visual.UserInterface { public class TestCaseVolumePieces : OsuTestCase { From 01ce8f161e0d8001c3255b7ed611f419ff357f6a Mon Sep 17 00:00:00 2001 From: LeNitrous Date: Mon, 25 Mar 2019 05:49:57 +0800 Subject: [PATCH 099/107] make scaling container background use BackgroundScreenStack with BackgroundScreenDefault --- osu.Game/Graphics/Containers/ScalingContainer.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index 51f068d920..7cbcb2d880 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -6,7 +6,8 @@ using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Configuration; -using osu.Game.Graphics.Backgrounds; +using osu.Game.Screens; +using osu.Game.Screens.Backgrounds; using osuTK; namespace osu.Game.Graphics.Containers @@ -32,7 +33,7 @@ namespace osu.Game.Graphics.Containers private readonly Container sizableContainer; - private Drawable backgroundLayer; + private BackgroundScreenStack backgroundLayer; /// /// Create a new instance. @@ -118,7 +119,7 @@ namespace osu.Game.Graphics.Containers if (requiresBackgroundVisible) { if (backgroundLayer == null) - LoadComponentAsync(backgroundLayer = new Background("Menu/menu-background-1") + LoadComponentAsync(backgroundLayer = new BackgroundScreenStack() { Colour = OsuColour.Gray(0.1f), Alpha = 0, @@ -126,6 +127,7 @@ namespace osu.Game.Graphics.Containers }, d => { AddInternal(d); + d.Push(new BackgroundScreenDefault()); d.FadeTo(requiresBackgroundVisible ? 1 : 0, 4000, Easing.OutQuint); }); else From fee260fa032fbe9f8b98cd6756005f09a3191ccc Mon Sep 17 00:00:00 2001 From: LeNitrous Date: Mon, 25 Mar 2019 06:05:57 +0800 Subject: [PATCH 100/107] remove empty argument list --- osu.Game/Graphics/Containers/ScalingContainer.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index 7cbcb2d880..72a7ca56c4 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -119,7 +119,7 @@ namespace osu.Game.Graphics.Containers if (requiresBackgroundVisible) { if (backgroundLayer == null) - LoadComponentAsync(backgroundLayer = new BackgroundScreenStack() + LoadComponentAsync(backgroundLayer = new BackgroundScreenStack { Colour = OsuColour.Gray(0.1f), Alpha = 0, From 371166955e14141045f1931436b86cd79e4ca9c1 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Mar 2019 12:39:40 +0900 Subject: [PATCH 101/107] Apply a few minor refactors --- osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs | 8 ++++---- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 2 ++ osu.Game/Screens/OsuScreenStack.cs | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs index e891e98066..146fb9ab69 100644 --- a/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/TestCaseBackgroundScreenBeatmap.cs @@ -53,8 +53,6 @@ namespace osu.Game.Tests.Visual private BeatmapManager manager; private RulesetStore rulesets; - private OsuScreenStack screenStack; - [BackgroundDependencyLoader] private void load(GameHost host) { @@ -81,8 +79,10 @@ namespace osu.Game.Tests.Visual [SetUp] public virtual void SetUp() => Schedule(() => { - Child = screenStack = new OsuScreenStack { RelativeSizeAxes = Axes.Both }; - screenStack.Push(songSelect = new DummySongSelect()); + Child = new OsuScreenStack(songSelect = new DummySongSelect()) + { + RelativeSizeAxes = Axes.Both + }; }); /// diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index e1e76f109d..a7cfbd3300 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -120,6 +120,8 @@ namespace osu.Game.Rulesets.Objects.Drawables } } + protected override void ClearInternal(bool disposeChildren = true) => throw new InvalidOperationException($"Should never clear a {nameof(DrawableHitObject)}"); + protected override void LoadComplete() { base.LoadComplete(); diff --git a/osu.Game/Screens/OsuScreenStack.cs b/osu.Game/Screens/OsuScreenStack.cs index 02e5919cdd..0844e32d46 100644 --- a/osu.Game/Screens/OsuScreenStack.cs +++ b/osu.Game/Screens/OsuScreenStack.cs @@ -36,11 +36,11 @@ namespace osu.Game.Screens Child = backgroundScreenStack = new BackgroundScreenStack { RelativeSizeAxes = Axes.Both }, }; - ScreenPushed += setParallax; - ScreenExited += setParallax; + ScreenPushed += onScreenChange; + ScreenExited += onScreenChange; } - private void setParallax(IScreen prev, IScreen next) + private void onScreenChange(IScreen prev, IScreen next) { parallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * ((IOsuScreen)next)?.BackgroundParallaxAmount ?? 1.0f; } From e705eb586da8e6705dc1ea6377019da940ac99de Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Mar 2019 12:51:54 +0900 Subject: [PATCH 102/107] Revert unintentional change --- osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs index a7cfbd3300..e1e76f109d 100644 --- a/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs +++ b/osu.Game/Rulesets/Objects/Drawables/DrawableHitObject.cs @@ -120,8 +120,6 @@ namespace osu.Game.Rulesets.Objects.Drawables } } - protected override void ClearInternal(bool disposeChildren = true) => throw new InvalidOperationException($"Should never clear a {nameof(DrawableHitObject)}"); - protected override void LoadComplete() { base.LoadComplete(); From cd1b171df791bd4e59f585c5607ff18f85e20c65 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Mar 2019 13:28:51 +0900 Subject: [PATCH 103/107] Refactor async load logic (not required due to stack presence) --- .../Graphics/Containers/ScalingContainer.cs | 32 ++++++++++++------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index 72a7ca56c4..2cc62d9a48 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -5,6 +5,7 @@ using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; +using osu.Framework.Screens; using osu.Game.Configuration; using osu.Game.Screens; using osu.Game.Screens.Backgrounds; @@ -33,7 +34,7 @@ namespace osu.Game.Graphics.Containers private readonly Container sizableContainer; - private BackgroundScreenStack backgroundLayer; + private BackgroundScreenStack backgroundStack; /// /// Create a new instance. @@ -113,28 +114,29 @@ namespace osu.Game.Graphics.Containers private void updateSize() { + const float fade_time = 500; + if (targetMode == ScalingMode.Everything) { // the top level scaling container manages the background to be displayed while scaling. if (requiresBackgroundVisible) { - if (backgroundLayer == null) - LoadComponentAsync(backgroundLayer = new BackgroundScreenStack + if (backgroundStack == null) + { + AddInternal(backgroundStack = new BackgroundScreenStack { Colour = OsuColour.Gray(0.1f), Alpha = 0, Depth = float.MaxValue - }, d => - { - AddInternal(d); - d.Push(new BackgroundScreenDefault()); - d.FadeTo(requiresBackgroundVisible ? 1 : 0, 4000, Easing.OutQuint); }); - else - backgroundLayer.FadeIn(500); + + backgroundStack.Push(new ScalignBackgroundScreen()); + } + + backgroundStack.FadeIn(fade_time); } else - backgroundLayer?.FadeOut(500); + backgroundStack?.FadeOut(fade_time); } bool scaling = targetMode == null || scalingMode.Value == targetMode; @@ -150,6 +152,14 @@ namespace osu.Game.Graphics.Containers sizableContainer.ResizeTo(targetSize, 500, Easing.OutQuart).OnComplete(_ => { sizableContainer.Masking = requiresMasking; }); } + private class ScalignBackgroundScreen : BackgroundScreenDefault + { + public override void OnEntering(IScreen last) + { + this.FadeInFromZero(4000, Easing.OutQuint); + } + } + private class AlwaysInputContainer : Container { public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => true; From 5b83e97e9dbb060706b8f78b42168be26dac8111 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 25 Mar 2019 13:38:50 +0900 Subject: [PATCH 104/107] Fix typo --- osu.Game/Graphics/Containers/ScalingContainer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game/Graphics/Containers/ScalingContainer.cs b/osu.Game/Graphics/Containers/ScalingContainer.cs index 2cc62d9a48..8f07c3a656 100644 --- a/osu.Game/Graphics/Containers/ScalingContainer.cs +++ b/osu.Game/Graphics/Containers/ScalingContainer.cs @@ -130,7 +130,7 @@ namespace osu.Game.Graphics.Containers Depth = float.MaxValue }); - backgroundStack.Push(new ScalignBackgroundScreen()); + backgroundStack.Push(new ScalingBackgroundScreen()); } backgroundStack.FadeIn(fade_time); @@ -152,7 +152,7 @@ namespace osu.Game.Graphics.Containers sizableContainer.ResizeTo(targetSize, 500, Easing.OutQuart).OnComplete(_ => { sizableContainer.Masking = requiresMasking; }); } - private class ScalignBackgroundScreen : BackgroundScreenDefault + private class ScalingBackgroundScreen : BackgroundScreenDefault { public override void OnEntering(IScreen last) { From 83076e32c7f79d1e8f4d6337cb881a7d208f5aeb Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 26 Mar 2019 16:17:37 +0900 Subject: [PATCH 105/107] Fix TestWorkingBeatmap not running for times below zero --- osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs index 90b5178169..78f9103a74 100644 --- a/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs +++ b/osu.Game/Tests/Beatmaps/TestWorkingBeatmap.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics.Textures; using osu.Framework.Timing; using osu.Game.Beatmaps; using osu.Game.Rulesets; -using osuTK; namespace osu.Game.Tests.Beatmaps { @@ -68,7 +67,7 @@ namespace osu.Game.Tests.Beatmaps public override bool Seek(double seek) { - offset = MathHelper.Clamp(seek, 0, Length); + offset = Math.Min(seek, Length); lastReferenceTime = null; return true; } From be62cd9d72c30b2db6ac8252ccd2940b4bbaa2a4 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 27 Mar 2019 14:33:50 +0900 Subject: [PATCH 106/107] Fix TestCaseBackgroundsScreenBeatmap --- .../TestCaseBackgroundScreenBeatmap.cs | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs index e56156752b..94c659424c 100644 --- a/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs @@ -92,7 +92,7 @@ namespace osu.Game.Tests.Visual.Background public void PlayerLoaderSettingsHoverTest() { setupUserSettings(); - AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer()))); + AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer { Ready = false }))); AddUntilStep("Wait for Player Loader to load", () => playerLoader?.IsLoaded ?? false); AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent()); AddStep("Trigger background preview", () => @@ -255,14 +255,7 @@ namespace osu.Game.Tests.Visual.Background { setupUserSettings(); - AddStep("Start player loader", () => - { - songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer - { - AllowPause = allowPause, - Ready = true, - })); - }); + AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer { AllowPause = allowPause, }))); AddUntilStep("Wait for Player Loader to load", () => playerLoader.IsLoaded); AddStep("Move mouse to center of screen", () => InputManager.MoveMouseTo(playerLoader.ScreenPos)); AddUntilStep("Wait for player to load", () => player.IsLoaded); @@ -351,7 +344,7 @@ namespace osu.Game.Tests.Visual.Background public UserDimContainer CurrentStoryboardContainer => StoryboardContainer; // Whether or not the player should be allowed to load. - public bool Ready; + public bool Ready = true; public Bindable StoryboardEnabled; public readonly Bindable ReplacesBackground = new Bindable(); @@ -362,10 +355,11 @@ namespace osu.Game.Tests.Visual.Background public bool IsStoryboardInvisible() => ((TestUserDimContainer)CurrentStoryboardContainer).CurrentAlpha <= 1; [BackgroundDependencyLoader] - private void load(OsuConfigManager config) + private void load(OsuConfigManager config, CancellationToken token) { - while (!Ready) + while (!Ready && !token.IsCancellationRequested) Thread.Sleep(1); + StoryboardEnabled = config.GetBindable(OsuSetting.ShowStoryboard); ReplacesBackground.BindTo(Background.StoryboardReplacesBackground); DrawableRuleset.IsPaused.BindTo(IsPaused); From 2c059efbab66a0641f93f7e46f931002ab438ec6 Mon Sep 17 00:00:00 2001 From: David Zhao Date: Wed, 27 Mar 2019 17:34:58 +0900 Subject: [PATCH 107/107] Rename to BlockLoad --- .../Visual/Background/TestCaseBackgroundScreenBeatmap.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs b/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs index 94c659424c..420a52c6b7 100644 --- a/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs +++ b/osu.Game.Tests/Visual/Background/TestCaseBackgroundScreenBeatmap.cs @@ -92,7 +92,7 @@ namespace osu.Game.Tests.Visual.Background public void PlayerLoaderSettingsHoverTest() { setupUserSettings(); - AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer { Ready = false }))); + AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer { BlockLoad = true }))); AddUntilStep("Wait for Player Loader to load", () => playerLoader?.IsLoaded ?? false); AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent()); AddStep("Trigger background preview", () => @@ -344,7 +344,7 @@ namespace osu.Game.Tests.Visual.Background public UserDimContainer CurrentStoryboardContainer => StoryboardContainer; // Whether or not the player should be allowed to load. - public bool Ready = true; + public bool BlockLoad; public Bindable StoryboardEnabled; public readonly Bindable ReplacesBackground = new Bindable(); @@ -357,7 +357,7 @@ namespace osu.Game.Tests.Visual.Background [BackgroundDependencyLoader] private void load(OsuConfigManager config, CancellationToken token) { - while (!Ready && !token.IsCancellationRequested) + while (BlockLoad && !token.IsCancellationRequested) Thread.Sleep(1); StoryboardEnabled = config.GetBindable(OsuSetting.ShowStoryboard);