diff --git a/osu.Android.props b/osu.Android.props index 1774ea0bb4..939d179b1d 100644 --- a/osu.Android.props +++ b/osu.Android.props @@ -54,6 +54,6 @@ - + diff --git a/osu.Game.Tests/Visual/Online/TestSceneOnlineViewContainer.cs b/osu.Game.Tests/Visual/Online/TestSceneOnlineViewContainer.cs index 3c2735ca56..9591d53b24 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneOnlineViewContainer.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneOnlineViewContainer.cs @@ -35,7 +35,7 @@ namespace osu.Game.Tests.Visual.Online AddStep("set status to online", () => ((DummyAPIAccess)API).State = APIState.Online); AddUntilStep("children are visible", () => onlineView.ViewTarget.IsPresent); - AddUntilStep("loading animation is not visible", () => !onlineView.LoadingAnimation.IsPresent); + AddUntilStep("loading animation is not visible", () => !onlineView.LoadingSpinner.IsPresent); } [Test] @@ -44,7 +44,7 @@ namespace osu.Game.Tests.Visual.Online AddStep("set status to offline", () => ((DummyAPIAccess)API).State = APIState.Offline); AddUntilStep("children are not visible", () => !onlineView.ViewTarget.IsPresent); - AddUntilStep("loading animation is not visible", () => !onlineView.LoadingAnimation.IsPresent); + AddUntilStep("loading animation is not visible", () => !onlineView.LoadingSpinner.IsPresent); } [Test] @@ -53,7 +53,7 @@ namespace osu.Game.Tests.Visual.Online AddStep("set status to connecting", () => ((DummyAPIAccess)API).State = APIState.Connecting); AddUntilStep("children are not visible", () => !onlineView.ViewTarget.IsPresent); - AddUntilStep("loading animation is visible", () => onlineView.LoadingAnimation.IsPresent); + AddUntilStep("loading animation is visible", () => onlineView.LoadingSpinner.IsPresent); } [Test] @@ -62,12 +62,12 @@ namespace osu.Game.Tests.Visual.Online AddStep("set status to failing", () => ((DummyAPIAccess)API).State = APIState.Failing); AddUntilStep("children are not visible", () => !onlineView.ViewTarget.IsPresent); - AddUntilStep("loading animation is visible", () => onlineView.LoadingAnimation.IsPresent); + AddUntilStep("loading animation is visible", () => onlineView.LoadingSpinner.IsPresent); } private class TestOnlineViewContainer : OnlineViewContainer { - public new LoadingAnimation LoadingAnimation => base.LoadingAnimation; + public new LoadingSpinner LoadingSpinner => base.LoadingSpinner; public CompositeDrawable ViewTarget => base.Content; diff --git a/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs b/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs index 656402e713..8542a5e46e 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneRankingsTables.cs @@ -8,7 +8,6 @@ using osu.Game.Overlays.Rankings.Tables; using osu.Framework.Graphics; using osu.Game.Online.API.Requests; using osu.Game.Rulesets; -using osu.Game.Graphics.UserInterface; using System.Threading; using osu.Game.Online.API; using osu.Game.Rulesets.Osu; @@ -16,6 +15,7 @@ using osu.Game.Rulesets.Mania; using osu.Game.Rulesets.Taiko; using osu.Game.Rulesets.Catch; using osu.Framework.Allocation; +using osu.Game.Graphics.UserInterface; using osu.Game.Overlays; namespace osu.Game.Tests.Visual.Online @@ -41,7 +41,7 @@ namespace osu.Game.Tests.Visual.Online private readonly OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Green); private readonly BasicScrollContainer scrollFlow; - private readonly DimmedLoadingLayer loading; + private readonly LoadingLayer loading; private CancellationTokenSource cancellationToken; private APIRequest request; @@ -56,7 +56,7 @@ namespace osu.Game.Tests.Visual.Online RelativeSizeAxes = Axes.Both, Width = 0.8f, }, - loading = new DimmedLoadingLayer(), + loading = new LoadingLayer(), }; } diff --git a/osu.Game.Tests/Visual/Online/TestSceneUserRequest.cs b/osu.Game.Tests/Visual/Online/TestSceneUserRequest.cs index 0f41247571..15cfd3ee54 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneUserRequest.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneUserRequest.cs @@ -12,8 +12,8 @@ using osu.Game.Rulesets.Mania; using osu.Game.Users; using osu.Framework.Graphics; using osu.Game.Graphics.Sprites; -using osu.Game.Rulesets.Taiko; using osu.Game.Graphics.UserInterface; +using osu.Game.Rulesets.Taiko; namespace osu.Game.Tests.Visual.Online { @@ -25,7 +25,7 @@ namespace osu.Game.Tests.Visual.Online private readonly Bindable user = new Bindable(); private GetUserRequest request; - private readonly DimmedLoadingLayer loading; + private readonly LoadingLayer loading; public TestSceneUserRequest() { @@ -40,10 +40,7 @@ namespace osu.Game.Tests.Visual.Online { User = { BindTarget = user } }, - loading = new DimmedLoadingLayer - { - Alpha = 0 - } + loading = new LoadingLayer() } }); } diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneProcessingOverlay.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingLayer.cs similarity index 76% rename from osu.Game.Tests/Visual/UserInterface/TestSceneProcessingOverlay.cs rename to osu.Game.Tests/Visual/UserInterface/TestSceneLoadingLayer.cs index 2424078e5a..7e9654715b 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneProcessingOverlay.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingLayer.cs @@ -1,6 +1,8 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using System.Collections.Generic; using NUnit.Framework; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; @@ -12,17 +14,21 @@ using osuTK.Graphics; namespace osu.Game.Tests.Visual.UserInterface { - public class TestSceneProcessingOverlay : OsuTestScene + public class TestSceneLoadingLayer : OsuTestScene { private Drawable dimContent; - private ProcessingOverlay overlay; + private LoadingLayer overlay; + + public override IReadOnlyList RequiredTypes => new[] { typeof(LoadingSpinner) }; + + private Container content; [SetUp] public void SetUp() => Schedule(() => { Children = new[] { - new Container + content = new Container { Size = new Vector2(300), Anchor = Anchor.Centre, @@ -49,14 +55,14 @@ namespace osu.Game.Tests.Visual.UserInterface new TriangleButton { Text = "puush me", Width = 200, Action = () => { } }, } }, - overlay = new ProcessingOverlay(dimContent), + overlay = new LoadingLayer(dimContent), } }, }; }); [Test] - public void ShowHide() + public void TestShowHide() { AddAssert("not visible", () => !overlay.IsPresent); @@ -70,7 +76,7 @@ namespace osu.Game.Tests.Visual.UserInterface } [Test] - public void ContentRestoreOnDispose() + public void TestContentRestoreOnDispose() { AddAssert("not visible", () => !overlay.IsPresent); @@ -78,9 +84,23 @@ namespace osu.Game.Tests.Visual.UserInterface AddUntilStep("wait for content dim", () => dimContent.Colour != Color4.White); - AddStep("hide", () => overlay.Expire()); + AddStep("expire", () => overlay.Expire()); AddUntilStep("wait for content restore", () => dimContent.Colour == Color4.White); } + + [Test] + public void TestLargeArea() + { + AddStep("show", () => + { + content.RelativeSizeAxes = Axes.Both; + content.Size = new Vector2(1); + + overlay.Show(); + }); + + AddStep("hide", () => overlay.Hide()); + } } } diff --git a/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingAnimation.cs b/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingSpinner.cs similarity index 79% rename from osu.Game.Tests/Visual/UserInterface/TestSceneLoadingAnimation.cs rename to osu.Game.Tests/Visual/UserInterface/TestSceneLoadingSpinner.cs index b0233d35f9..47f5bdfe17 100644 --- a/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingAnimation.cs +++ b/osu.Game.Tests/Visual/UserInterface/TestSceneLoadingSpinner.cs @@ -8,12 +8,12 @@ using osuTK.Graphics; namespace osu.Game.Tests.Visual.UserInterface { - public class TestSceneLoadingAnimation : OsuGridTestScene + public class TestSceneLoadingSpinner : OsuGridTestScene { - public TestSceneLoadingAnimation() + public TestSceneLoadingSpinner() : base(2, 2) { - LoadingAnimation loading; + LoadingSpinner loading; Cell(0).AddRange(new Drawable[] { @@ -22,7 +22,7 @@ namespace osu.Game.Tests.Visual.UserInterface Colour = Color4.Black, RelativeSizeAxes = Axes.Both }, - loading = new LoadingAnimation() + loading = new LoadingSpinner() }); loading.Show(); @@ -34,7 +34,7 @@ namespace osu.Game.Tests.Visual.UserInterface Colour = Color4.White, RelativeSizeAxes = Axes.Both }, - loading = new LoadingAnimation() + loading = new LoadingSpinner(true) }); loading.Show(); @@ -46,14 +46,14 @@ namespace osu.Game.Tests.Visual.UserInterface Colour = Color4.Gray, RelativeSizeAxes = Axes.Both }, - loading = new LoadingAnimation() + loading = new LoadingSpinner() }); loading.Show(); Cell(3).AddRange(new Drawable[] { - loading = new LoadingAnimation() + loading = new LoadingSpinner() }); Scheduler.AddDelayed(() => loading.ToggleVisibility(), 200, true); diff --git a/osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs b/osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs deleted file mode 100644 index bdc3cd4c49..0000000000 --- a/osu.Game/Graphics/UserInterface/DimmedLoadingLayer.cs +++ /dev/null @@ -1,58 +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 osuTK.Graphics; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Extensions.Color4Extensions; -using osuTK; -using osu.Framework.Input.Events; - -namespace osu.Game.Graphics.UserInterface -{ - public class DimmedLoadingLayer : OverlayContainer - { - private const float transition_duration = 250; - - private readonly LoadingAnimation loading; - - public DimmedLoadingLayer(float dimAmount = 0.5f, float iconScale = 1f) - { - RelativeSizeAxes = Axes.Both; - Children = new Drawable[] - { - new Box - { - RelativeSizeAxes = Axes.Both, - Colour = Color4.Black.Opacity(dimAmount), - }, - loading = new LoadingAnimation { Scale = new Vector2(iconScale) }, - }; - } - - protected override void PopIn() - { - this.FadeIn(transition_duration, Easing.OutQuint); - loading.Show(); - } - - protected override void PopOut() - { - this.FadeOut(transition_duration, Easing.OutQuint); - loading.Hide(); - } - - protected override bool Handle(UIEvent e) - { - switch (e) - { - // blocking scroll can cause weird behaviour when this layer is used within a ScrollContainer. - case ScrollEvent _: - return false; - } - - return base.Handle(e); - } - } -} diff --git a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs b/osu.Game/Graphics/UserInterface/LoadingAnimation.cs deleted file mode 100644 index 5a8a0da135..0000000000 --- a/osu.Game/Graphics/UserInterface/LoadingAnimation.cs +++ /dev/null @@ -1,64 +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.Containers; -using osu.Framework.Graphics.Sprites; -using osuTK; -using osuTK.Graphics; - -namespace osu.Game.Graphics.UserInterface -{ - /// - /// A loading spinner. - /// - public class LoadingAnimation : VisibilityContainer - { - private readonly SpriteIcon spinner; - private readonly SpriteIcon spinnerShadow; - - private const float spin_duration = 600; - private const float transition_duration = 200; - - public LoadingAnimation() - { - Size = new Vector2(20); - - Anchor = Anchor.Centre; - Origin = Anchor.Centre; - - Children = new Drawable[] - { - spinnerShadow = new SpriteIcon - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Position = new Vector2(1, 1), - Colour = Color4.Black, - Alpha = 0.4f, - Icon = FontAwesome.Solid.CircleNotch - }, - spinner = new SpriteIcon - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - Icon = FontAwesome.Solid.CircleNotch - } - }; - } - - protected override void LoadComplete() - { - base.LoadComplete(); - - spinner.Spin(spin_duration, RotationDirection.Clockwise); - spinnerShadow.Spin(spin_duration, RotationDirection.Clockwise); - } - - protected override void PopIn() => this.FadeIn(transition_duration * 2, Easing.OutQuint); - - protected override void PopOut() => this.FadeOut(transition_duration, Easing.OutQuint); - } -} diff --git a/osu.Game/Graphics/UserInterface/LoadingButton.cs b/osu.Game/Graphics/UserInterface/LoadingButton.cs index 49ec18ce8e..81dc023d7e 100644 --- a/osu.Game/Graphics/UserInterface/LoadingButton.cs +++ b/osu.Game/Graphics/UserInterface/LoadingButton.cs @@ -40,14 +40,14 @@ namespace osu.Game.Graphics.UserInterface set => loading.Size = value; } - private readonly LoadingAnimation loading; + private readonly LoadingSpinner loading; protected LoadingButton() { AddRange(new[] { CreateContent(), - loading = new LoadingAnimation + loading = new LoadingSpinner { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Graphics/UserInterface/LoadingLayer.cs b/osu.Game/Graphics/UserInterface/LoadingLayer.cs new file mode 100644 index 0000000000..25a62acaba --- /dev/null +++ b/osu.Game/Graphics/UserInterface/LoadingLayer.cs @@ -0,0 +1,81 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using System; +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Input.Events; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Graphics.UserInterface +{ + /// + /// A layer that will show a loading spinner and completely block input to an area. + /// Also optionally dims target elements. + /// Useful for disabling all elements in a form and showing we are waiting on a response, for instance. + /// + public class LoadingLayer : LoadingSpinner + { + private readonly Drawable dimTarget; + + /// + /// Constuct a new loading spinner. + /// + /// An optional target to dim when displayed. + /// Whether the spinner should have a surrounding black box for visibility. + public LoadingLayer(Drawable dimTarget = null, bool withBox = true) + : base(withBox) + { + RelativeSizeAxes = Axes.Both; + Size = new Vector2(1); + + this.dimTarget = dimTarget; + + MainContents.RelativeSizeAxes = Axes.None; + } + + public override bool HandleNonPositionalInput => false; + + protected override bool Handle(UIEvent e) + { + switch (e) + { + // blocking scroll can cause weird behaviour when this layer is used within a ScrollContainer. + case ScrollEvent _: + return false; + } + + return true; + } + + protected override void PopIn() + { + dimTarget?.FadeColour(OsuColour.Gray(0.5f), TRANSITION_DURATION, Easing.OutQuint); + base.PopIn(); + } + + protected override void PopOut() + { + dimTarget?.FadeColour(Color4.White, TRANSITION_DURATION, Easing.OutQuint); + base.PopOut(); + } + + protected override void Update() + { + base.Update(); + MainContents.Size = new Vector2(Math.Min(100, Math.Min(DrawWidth, DrawHeight) * 0.25f)); + } + + protected override void Dispose(bool isDisposing) + { + base.Dispose(isDisposing); + + if (State.Value == Visibility.Visible) + { + // ensure we don't leave the target in a bad state. + dimTarget?.FadeColour(Color4.White, TRANSITION_DURATION, Easing.OutQuint); + } + } + } +} diff --git a/osu.Game/Graphics/UserInterface/LoadingSpinner.cs b/osu.Game/Graphics/UserInterface/LoadingSpinner.cs new file mode 100644 index 0000000000..b5a235f9d8 --- /dev/null +++ b/osu.Game/Graphics/UserInterface/LoadingSpinner.cs @@ -0,0 +1,106 @@ +// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. +// See the LICENCE file in the repository root for full licence text. + +using osu.Framework.Graphics; +using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Shapes; +using osu.Framework.Graphics.Sprites; +using osuTK; +using osuTK.Graphics; + +namespace osu.Game.Graphics.UserInterface +{ + /// + /// A loading spinner. + /// + public class LoadingSpinner : VisibilityContainer + { + private readonly SpriteIcon spinner; + + protected Container MainContents; + + protected const float TRANSITION_DURATION = 500; + + private const float spin_duration = 900; + + /// + /// Constuct a new loading spinner. + /// + /// Whether the spinner should have a surrounding black box for visibility. + public LoadingSpinner(bool withBox = false) + { + Size = new Vector2(60); + + Anchor = Anchor.Centre; + Origin = Anchor.Centre; + + Child = MainContents = new Container + { + RelativeSizeAxes = Axes.Both, + Masking = true, + CornerRadius = 20, + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Children = new Drawable[] + { + new Box + { + Colour = Color4.Black, + RelativeSizeAxes = Axes.Both, + Alpha = withBox ? 0.7f : 0 + }, + spinner = new SpriteIcon + { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + Scale = new Vector2(withBox ? 0.6f : 1), + RelativeSizeAxes = Axes.Both, + Icon = FontAwesome.Solid.CircleNotch + } + } + }; + } + + protected override void LoadComplete() + { + base.LoadComplete(); + + rotate(); + } + + protected override void Update() + { + base.Update(); + + MainContents.CornerRadius = MainContents.DrawWidth / 4; + } + + protected override void PopIn() + { + if (Alpha < 0.5f) + // reset animation if the user can't see us. + rotate(); + + MainContents.ScaleTo(1, TRANSITION_DURATION, Easing.OutQuint); + this.FadeIn(TRANSITION_DURATION * 2, Easing.OutQuint); + } + + protected override void PopOut() + { + MainContents.ScaleTo(0.8f, TRANSITION_DURATION / 2, Easing.In); + this.FadeOut(TRANSITION_DURATION, Easing.OutQuint); + } + + private void rotate() + { + spinner.Spin(spin_duration * 4, RotationDirection.Clockwise); + + MainContents.RotateTo(0).Then() + .RotateTo(90, spin_duration, Easing.InOutQuart).Then() + .RotateTo(180, spin_duration, Easing.InOutQuart).Then() + .RotateTo(270, spin_duration, Easing.InOutQuart).Then() + .RotateTo(360, spin_duration, Easing.InOutQuart).Then() + .Loop(); + } + } +} diff --git a/osu.Game/Graphics/UserInterface/ProcessingOverlay.cs b/osu.Game/Graphics/UserInterface/ProcessingOverlay.cs deleted file mode 100644 index c65801a82e..0000000000 --- a/osu.Game/Graphics/UserInterface/ProcessingOverlay.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. -// See the LICENCE file in the repository root for full licence text. - -using osu.Framework.Allocation; -using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.Shapes; -using osu.Framework.Input.Events; -using osuTK; -using osuTK.Graphics; - -namespace osu.Game.Graphics.UserInterface -{ - /// - /// An overlay that will show a loading overlay and completely block input to an area. - /// Also optionally dims target elements. - /// Useful for disabling all elements in a form and showing we are waiting on a response, for instance. - /// - public class ProcessingOverlay : VisibilityContainer - { - private readonly Drawable dimTarget; - - private Container loadingBox; - - private const float transition_duration = 600; - - public ProcessingOverlay(Drawable dimTarget = null) - { - this.dimTarget = dimTarget; - RelativeSizeAxes = Axes.Both; - } - - [BackgroundDependencyLoader] - private void load() - { - InternalChildren = new Drawable[] - { - loadingBox = new Container - { - Size = new Vector2(80), - Scale = new Vector2(0.8f), - Masking = true, - CornerRadius = 15, - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - Children = new Drawable[] - { - new Box - { - Colour = Color4.Black, - RelativeSizeAxes = Axes.Both, - }, - new LoadingAnimation { State = { Value = Visibility.Visible } } - } - }, - }; - } - - protected override bool Handle(UIEvent e) => true; - - protected override void PopIn() - { - this.FadeIn(transition_duration, Easing.OutQuint); - loadingBox.ScaleTo(1, transition_duration, Easing.OutElastic); - - dimTarget?.FadeColour(OsuColour.Gray(0.5f), transition_duration, Easing.OutQuint); - } - - protected override void PopOut() - { - this.FadeOut(transition_duration, Easing.OutQuint); - loadingBox.ScaleTo(0.8f, transition_duration / 2, Easing.In); - - dimTarget?.FadeColour(Color4.White, transition_duration, Easing.OutQuint); - } - - protected override void Dispose(bool isDisposing) - { - base.Dispose(isDisposing); - - if (State.Value == Visibility.Visible) - { - // ensure we don't leave the target in a bad state. - dimTarget?.FadeColour(Color4.White, transition_duration, Easing.OutQuint); - } - } - } -} diff --git a/osu.Game/Online/Leaderboards/Leaderboard.cs b/osu.Game/Online/Leaderboards/Leaderboard.cs index 71859d3aeb..e2a817aaff 100644 --- a/osu.Game/Online/Leaderboards/Leaderboard.cs +++ b/osu.Game/Online/Leaderboards/Leaderboard.cs @@ -30,7 +30,7 @@ namespace osu.Game.Online.Leaderboards private FillFlowContainer scrollFlow; - private readonly LoadingAnimation loading; + private readonly LoadingSpinner loading; private ScheduledDelegate showScoresDelegate; private CancellationTokenSource showScoresCancellationSource; @@ -202,7 +202,7 @@ namespace osu.Game.Online.Leaderboards } }, }, - loading = new LoadingAnimation(), + loading = new LoadingSpinner(), placeholderContainer = new Container { RelativeSizeAxes = Axes.Both diff --git a/osu.Game/Online/OnlineViewContainer.cs b/osu.Game/Online/OnlineViewContainer.cs index 689c1c0afb..b52e3d9e3c 100644 --- a/osu.Game/Online/OnlineViewContainer.cs +++ b/osu.Game/Online/OnlineViewContainer.cs @@ -16,7 +16,7 @@ namespace osu.Game.Online /// public abstract class OnlineViewContainer : Container, IOnlineComponent { - protected LoadingAnimation LoadingAnimation { get; private set; } + protected LoadingSpinner LoadingSpinner { get; private set; } protected override Container Content { get; } = new Container { RelativeSizeAxes = Axes.Both }; @@ -41,7 +41,7 @@ namespace osu.Game.Online { Content, placeholder = new LoginPlaceholder(placeholderMessage), - LoadingAnimation = new LoadingAnimation + LoadingSpinner = new LoadingSpinner { Alpha = 0, } @@ -63,19 +63,19 @@ namespace osu.Game.Online PopContentOut(Content); placeholder.ScaleTo(0.8f).Then().ScaleTo(1, 3 * transform_duration, Easing.OutQuint); placeholder.FadeInFromZero(2 * transform_duration, Easing.OutQuint); - LoadingAnimation.Hide(); + LoadingSpinner.Hide(); break; case APIState.Online: PopContentIn(Content); placeholder.FadeOut(transform_duration / 2, Easing.OutQuint); - LoadingAnimation.Hide(); + LoadingSpinner.Hide(); break; case APIState.Failing: case APIState.Connecting: PopContentOut(Content); - LoadingAnimation.Show(); + LoadingSpinner.Show(); placeholder.FadeOut(transform_duration / 2, Easing.OutQuint); break; } diff --git a/osu.Game/OsuGame.cs b/osu.Game/OsuGame.cs index 100730d40d..a73d5b57c4 100644 --- a/osu.Game/OsuGame.cs +++ b/osu.Game/OsuGame.cs @@ -598,6 +598,7 @@ namespace osu.Game //overlay elements loadComponentSingleFile(direct = new DirectOverlay(), overlayContent.Add, true); loadComponentSingleFile(social = new SocialOverlay(), overlayContent.Add, true); + var rankingsOverlay = loadComponentSingleFile(new RankingsOverlay(), overlayContent.Add, true); loadComponentSingleFile(channelManager = new ChannelManager(), AddInternal, true); loadComponentSingleFile(chatOverlay = new ChatOverlay(), overlayContent.Add, true); loadComponentSingleFile(Settings = new SettingsOverlay { GetToolbarHeight = () => ToolbarOffset }, leftFloatingOverlayContent.Add, true); @@ -654,7 +655,7 @@ namespace osu.Game } // ensure only one of these overlays are open at once. - var singleDisplayOverlays = new OverlayContainer[] { chatOverlay, social, direct, changelogOverlay }; + var singleDisplayOverlays = new OverlayContainer[] { chatOverlay, social, direct, changelogOverlay, rankingsOverlay }; foreach (var overlay in singleDisplayOverlays) { diff --git a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs index 454fce0261..2576900db8 100644 --- a/osu.Game/Overlays/AccountCreation/ScreenEntry.cs +++ b/osu.Game/Overlays/AccountCreation/ScreenEntry.cs @@ -40,7 +40,7 @@ namespace osu.Game.Overlays.AccountCreation private IEnumerable characterCheckText; private OsuTextBox[] textboxes; - private ProcessingOverlay processingOverlay; + private LoadingLayer loadingLayer; [Resolved] private GameHost host { get; set; } @@ -124,7 +124,7 @@ namespace osu.Game.Overlays.AccountCreation }, }, }, - processingOverlay = new ProcessingOverlay(mainContent) + loadingLayer = new LoadingLayer(mainContent) }; textboxes = new[] { usernameTextBox, emailTextBox, passwordTextBox }; @@ -144,7 +144,7 @@ namespace osu.Game.Overlays.AccountCreation public override void OnEntering(IScreen last) { base.OnEntering(last); - processingOverlay.Hide(); + loadingLayer.Hide(); if (host?.OnScreenKeyboardOverlapsGameWindow != true) focusNextTextbox(); @@ -162,7 +162,7 @@ namespace osu.Game.Overlays.AccountCreation emailAddressDescription.ClearErrors(); passwordDescription.ClearErrors(); - processingOverlay.Show(); + loadingLayer.Show(); Task.Run(() => { @@ -195,7 +195,7 @@ namespace osu.Game.Overlays.AccountCreation } registerShake.Shake(); - processingOverlay.Hide(); + loadingLayer.Hide(); return; } diff --git a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs index af0987d183..742b1055b2 100644 --- a/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs +++ b/osu.Game/Overlays/BeatmapSet/Buttons/FavouriteButton.cs @@ -5,7 +5,6 @@ using System.Diagnostics; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; -using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; @@ -25,7 +24,7 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons private readonly BindableBool favourited = new BindableBool(); private PostBeatmapFavouriteRequest request; - private DimmedLoadingLayer loading; + private LoadingLayer loading; private readonly Bindable localUser = new Bindable(); @@ -54,14 +53,11 @@ namespace osu.Game.Overlays.BeatmapSet.Buttons Size = new Vector2(18), Shadow = false, }, - loading = new DimmedLoadingLayer(0.8f, 0.5f), + loading = new LoadingLayer(icon, false), }); Action = () => { - if (loading.State.Value == Visibility.Visible) - return; - // guaranteed by disabled state above. Debug.Assert(BeatmapSet.Value.OnlineBeatmapSetID != null); diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs index c1e9ce2008..29c259b7f8 100644 --- a/osu.Game/Overlays/BeatmapSet/Header.cs +++ b/osu.Game/Overlays/BeatmapSet/Header.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; @@ -45,7 +45,7 @@ namespace osu.Game.Overlays.BeatmapSet private readonly FavouriteButton favouriteButton; private readonly FillFlowContainer fadeContent; - private readonly LoadingAnimation loading; + private readonly LoadingSpinner loading; private readonly BeatmapSetHeader beatmapSetHeader; [Cached(typeof(IBindable))] @@ -179,7 +179,7 @@ namespace osu.Game.Overlays.BeatmapSet }, } }, - loading = new LoadingAnimation + loading = new LoadingSpinner { Anchor = Anchor.Centre, Origin = Anchor.Centre, diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index 92ff3c3125..e831c8ce42 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -5,7 +5,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; -using osu.Game.Graphics.UserInterface; using osuTK; using System.Linq; using osu.Game.Online.API.Requests.Responses; @@ -13,6 +12,7 @@ using osu.Game.Beatmaps; using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Framework.Bindables; +using osu.Game.Graphics.UserInterface; using osu.Game.Rulesets; using osu.Game.Screens.Select.Leaderboards; using osu.Game.Users; @@ -31,7 +31,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores private readonly Box background; private readonly ScoreTable scoreTable; private readonly FillFlowContainer topScoresContainer; - private readonly DimmedLoadingLayer loading; + private readonly LoadingLayer loading; private readonly LeaderboardModSelector modSelector; private readonly NoScoresPlaceholder noScoresPlaceholder; private readonly FillFlowContainer content; @@ -160,16 +160,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores } } }, - new Container - { - RelativeSizeAxes = Axes.Both, - Masking = true, - CornerRadius = 5, - Child = loading = new DimmedLoadingLayer(iconScale: 0.8f) - { - Alpha = 0, - }, - } + loading = new LoadingLayer() } } } diff --git a/osu.Game/Overlays/ChatOverlay.cs b/osu.Game/Overlays/ChatOverlay.cs index bdc241a437..34afc3c431 100644 --- a/osu.Game/Overlays/ChatOverlay.cs +++ b/osu.Game/Overlays/ChatOverlay.cs @@ -37,7 +37,7 @@ namespace osu.Game.Overlays private readonly List loadedChannels = new List(); - private LoadingAnimation loading; + private LoadingSpinner loading; private FocusedTextBox textbox; @@ -146,7 +146,7 @@ namespace osu.Game.Overlays } } }, - loading = new LoadingAnimation(), + loading = new LoadingSpinner(), } }, tabsArea = new TabsArea diff --git a/osu.Game/Overlays/Direct/PlayButton.cs b/osu.Game/Overlays/Direct/PlayButton.cs index 10abe15177..d9f335b6a7 100644 --- a/osu.Game/Overlays/Direct/PlayButton.cs +++ b/osu.Game/Overlays/Direct/PlayButton.cs @@ -42,7 +42,7 @@ namespace osu.Game.Overlays.Direct private Color4 hoverColour; private readonly SpriteIcon icon; - private readonly LoadingAnimation loadingAnimation; + private readonly LoadingSpinner loadingSpinner; private const float transition_duration = 500; @@ -53,12 +53,12 @@ namespace osu.Game.Overlays.Direct if (value) { icon.FadeTo(0.5f, transition_duration, Easing.OutQuint); - loadingAnimation.Show(); + loadingSpinner.Show(); } else { icon.FadeTo(1, transition_duration, Easing.OutQuint); - loadingAnimation.Hide(); + loadingSpinner.Hide(); } } } @@ -76,7 +76,7 @@ namespace osu.Game.Overlays.Direct RelativeSizeAxes = Axes.Both, Icon = FontAwesome.Solid.Play, }, - loadingAnimation = new LoadingAnimation + loadingSpinner = new LoadingSpinner { Size = new Vector2(15), }, diff --git a/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs b/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs index a89360bd3c..99325aa1da 100644 --- a/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs +++ b/osu.Game/Overlays/Rankings/RankingsOverlayHeader.cs @@ -27,6 +27,8 @@ namespace osu.Game.Overlays.Rankings protected override Drawable CreateContent() => countryFilter = new CountryFilter(); + protected override Drawable CreateBackground() => new OverlayHeaderBackground(@"Headers/rankings"); + private class RankingsTitle : ScreenTitle { public readonly Bindable Scope = new Bindable(); diff --git a/osu.Game/Overlays/Rankings/SpotlightsLayout.cs b/osu.Game/Overlays/Rankings/SpotlightsLayout.cs index e609fa1487..6f06eecd6e 100644 --- a/osu.Game/Overlays/Rankings/SpotlightsLayout.cs +++ b/osu.Game/Overlays/Rankings/SpotlightsLayout.cs @@ -37,7 +37,7 @@ namespace osu.Game.Overlays.Rankings private SpotlightSelector selector; private Container content; - private DimmedLoadingLayer loading; + private LoadingLayer loading; [BackgroundDependencyLoader] private void load() @@ -67,7 +67,7 @@ namespace osu.Game.Overlays.Rankings AutoSizeAxes = Axes.Y, Margin = new MarginPadding { Vertical = 10 } }, - loading = new DimmedLoadingLayer() + loading = new LoadingLayer(content) } } } diff --git a/osu.Game/Overlays/RankingsOverlay.cs b/osu.Game/Overlays/RankingsOverlay.cs index 2c5ea61315..3304c6ebec 100644 --- a/osu.Game/Overlays/RankingsOverlay.cs +++ b/osu.Game/Overlays/RankingsOverlay.cs @@ -9,9 +9,9 @@ using osu.Framework.Graphics.Shapes; using osu.Game.Overlays.Rankings; using osu.Game.Users; using osu.Game.Rulesets; -using osu.Game.Graphics.UserInterface; using osu.Game.Online.API; using System.Threading; +using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests; using osu.Game.Overlays.Rankings.Tables; @@ -23,11 +23,9 @@ namespace osu.Game.Overlays protected Bindable Scope => header.Current; - private Bindable ruleset => header.Ruleset; - private readonly BasicScrollContainer scrollFlow; private readonly Container contentContainer; - private readonly DimmedLoadingLayer loading; + private readonly LoadingLayer loading; private readonly Box background; private readonly RankingsOverlayHeader header; @@ -77,7 +75,7 @@ namespace osu.Game.Overlays RelativeSizeAxes = Axes.X, Margin = new MarginPadding { Bottom = 10 } }, - loading = new DimmedLoadingLayer(), + loading = new LoadingLayer(contentContainer), } } } @@ -92,10 +90,15 @@ namespace osu.Game.Overlays background.Colour = ColourProvider.Background5; } + [Resolved] + private Bindable ruleset { get; set; } + protected override void LoadComplete() { base.LoadComplete(); + header.Ruleset.BindTo(ruleset); + Country.BindValueChanged(_ => { // if a country is requested, force performance scope. @@ -121,6 +124,8 @@ namespace osu.Game.Overlays Scheduler.AddOnce(loadNewContent); }); + + Scheduler.AddOnce(loadNewContent); } public void ShowCountry(Country requested) diff --git a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs index c55183772b..bf0e073350 100644 --- a/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs +++ b/osu.Game/Overlays/Settings/Sections/General/LoginSettings.cs @@ -95,7 +95,7 @@ namespace osu.Game.Overlays.Settings.Sections.General Children = new Drawable[] { - new LoadingAnimation + new LoadingSpinner { State = { Value = Visibility.Visible }, Anchor = Anchor.TopCentre, diff --git a/osu.Game/Overlays/SocialOverlay.cs b/osu.Game/Overlays/SocialOverlay.cs index 9a523bc1bc..54c978738d 100644 --- a/osu.Game/Overlays/SocialOverlay.cs +++ b/osu.Game/Overlays/SocialOverlay.cs @@ -24,7 +24,7 @@ namespace osu.Game.Overlays { public class SocialOverlay : SearchableListOverlay { - private readonly LoadingAnimation loading; + private readonly LoadingSpinner loading; private FillFlowContainer panels; protected override Color4 BackgroundColour => OsuColour.FromHex(@"60284b"); @@ -54,7 +54,7 @@ namespace osu.Game.Overlays public SocialOverlay() : base(OverlayColourScheme.Pink) { - Add(loading = new LoadingAnimation()); + Add(loading = new LoadingSpinner()); Filter.Search.Current.ValueChanged += text => { diff --git a/osu.Game/Overlays/Toolbar/Toolbar.cs b/osu.Game/Overlays/Toolbar/Toolbar.cs index b044bc4de0..897587d198 100644 --- a/osu.Game/Overlays/Toolbar/Toolbar.cs +++ b/osu.Game/Overlays/Toolbar/Toolbar.cs @@ -70,6 +70,7 @@ namespace osu.Game.Overlays.Toolbar Children = new Drawable[] { new ToolbarChangelogButton(), + new ToolbarRankingsButton(), new ToolbarDirectButton(), new ToolbarChatButton(), new ToolbarSocialButton(), diff --git a/osu.Game/Overlays/Toolbar/ToolbarRankingsButton.cs b/osu.Game/Overlays/Toolbar/ToolbarRankingsButton.cs new file mode 100644 index 0000000000..cbd097696d --- /dev/null +++ b/osu.Game/Overlays/Toolbar/ToolbarRankingsButton.cs @@ -0,0 +1,22 @@ +// 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.Sprites; + +namespace osu.Game.Overlays.Toolbar +{ + public class ToolbarRankingsButton : ToolbarOverlayToggleButton + { + public ToolbarRankingsButton() + { + SetIcon(FontAwesome.Regular.ChartBar); + } + + [BackgroundDependencyLoader(true)] + private void load(RankingsOverlay rankings) + { + StateContainer = rankings; + } + } +} diff --git a/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs b/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs index 58e4548ee2..e2e5b1b549 100644 --- a/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs +++ b/osu.Game/Screens/Multi/Lounge/LoungeSubScreen.cs @@ -23,7 +23,7 @@ namespace osu.Game.Screens.Multi.Lounge protected readonly FilterControl Filter; private readonly Container content; - private readonly ProcessingOverlay processingOverlay; + private readonly LoadingLayer loadingLayer; [Resolved] private Bindable currentRoom { get; set; } @@ -58,7 +58,7 @@ namespace osu.Game.Screens.Multi.Lounge Child = new RoomsContainer { JoinRequested = joinRequested } }, }, - processingOverlay = new ProcessingOverlay(searchContainer), + loadingLayer = new LoadingLayer(searchContainer), } }, new RoomInspector @@ -126,12 +126,12 @@ namespace osu.Game.Screens.Multi.Lounge private void joinRequested(Room room) { - processingOverlay.Show(); + loadingLayer.Show(); RoomManager?.JoinRoom(room, r => { Open(room); - processingOverlay.Hide(); - }, _ => processingOverlay.Hide()); + loadingLayer.Hide(); + }, _ => loadingLayer.Hide()); } /// diff --git a/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs b/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs index 8c005a2647..115ac5037a 100644 --- a/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs +++ b/osu.Game/Screens/Multi/Match/Components/MatchSettingsOverlay.cs @@ -67,7 +67,7 @@ namespace osu.Game.Screens.Multi.Match.Components public OsuSpriteText ErrorText; private OsuSpriteText typeLabel; - private ProcessingOverlay processingOverlay; + private LoadingLayer loadingLayer; private DrawableRoomPlaylist playlist; [Resolved(CanBeNull = true)] @@ -307,7 +307,7 @@ namespace osu.Game.Screens.Multi.Match.Components }, } }, - processingOverlay = new ProcessingOverlay(dimContent) + loadingLayer = new LoadingLayer(dimContent) }; TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue?.Name ?? string.Empty, true); @@ -346,19 +346,19 @@ namespace osu.Game.Screens.Multi.Match.Components manager?.CreateRoom(currentRoom.Value, onSuccess, onError); - processingOverlay.Show(); + loadingLayer.Show(); } private void hideError() => ErrorText.FadeOut(50); - private void onSuccess(Room room) => processingOverlay.Hide(); + private void onSuccess(Room room) => loadingLayer.Hide(); private void onError(string text) { ErrorText.Text = text; ErrorText.FadeIn(50); - processingOverlay.Hide(); + loadingLayer.Hide(); } } diff --git a/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs b/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs index 074341226e..77ee52f23e 100644 --- a/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs +++ b/osu.Game/Screens/Play/BeatmapMetadataDisplay.cs @@ -53,7 +53,7 @@ namespace osu.Game.Screens.Play private readonly WorkingBeatmap beatmap; private readonly Bindable> mods; private readonly Drawable facade; - private LoadingAnimation loading; + private LoadingSpinner loading; private Sprite backgroundSprite; public IBindable> Mods => mods; @@ -138,7 +138,7 @@ namespace osu.Game.Screens.Play Anchor = Anchor.Centre, FillMode = FillMode.Fill, }, - loading = new LoadingAnimation { Scale = new Vector2(1.3f) } + loading = new LoadingSpinner { Scale = new Vector2(1.3f) } } }, new OsuSpriteText diff --git a/osu.Game/Screens/Select/BeatmapDetails.cs b/osu.Game/Screens/Select/BeatmapDetails.cs index 85b892336a..aebb8e9d87 100644 --- a/osu.Game/Screens/Select/BeatmapDetails.cs +++ b/osu.Game/Screens/Select/BeatmapDetails.cs @@ -7,7 +7,6 @@ using osu.Framework.Allocation; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Game.Graphics.Sprites; -using osu.Game.Graphics.UserInterface; using System.Linq; using osu.Game.Online.API; using osu.Framework.Threading; @@ -17,6 +16,7 @@ using osu.Game.Screens.Select.Details; using osu.Game.Beatmaps; using osu.Game.Graphics; using osu.Game.Graphics.Containers; +using osu.Game.Graphics.UserInterface; using osu.Game.Online.API.Requests; using osu.Game.Rulesets; @@ -35,7 +35,7 @@ namespace osu.Game.Screens.Select private readonly MetadataSection description, source, tags; private readonly Container failRetryContainer; private readonly FailRetryGraph failRetryGraph; - private readonly DimmedLoadingLayer loading; + private readonly LoadingLayer loading; [Resolved] private IAPIProvider api { get; set; } @@ -63,6 +63,8 @@ namespace osu.Game.Screens.Select public BeatmapDetails() { + Container content; + Children = new Drawable[] { new Box @@ -70,7 +72,7 @@ namespace osu.Game.Screens.Select RelativeSizeAxes = Axes.Both, Colour = Color4.Black.Opacity(0.5f), }, - new Container + content = new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Horizontal = spacing }, @@ -157,7 +159,7 @@ namespace osu.Game.Screens.Select }, }, }, - loading = new DimmedLoadingLayer(), + loading = new LoadingLayer(content), }; } diff --git a/osu.Game/Updater/SimpleUpdateManager.cs b/osu.Game/Updater/SimpleUpdateManager.cs index e490ac14e9..1e8a96444f 100644 --- a/osu.Game/Updater/SimpleUpdateManager.cs +++ b/osu.Game/Updater/SimpleUpdateManager.cs @@ -78,6 +78,10 @@ namespace osu.Game.Updater bestAsset = release.Assets?.Find(f => f.Name.EndsWith(".app.zip")); break; + case RuntimeInfo.Platform.Linux: + bestAsset = release.Assets?.Find(f => f.Name.EndsWith(".AppImage")); + break; + case RuntimeInfo.Platform.Android: // on our testing device this causes the download to magically disappear. //bestAsset = release.Assets?.Find(f => f.Name.EndsWith(".apk")); diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index c034fb6567..24ee25c4de 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -23,7 +23,7 @@ - + diff --git a/osu.iOS.props b/osu.iOS.props index 7f99338c6e..3743138c1a 100644 --- a/osu.iOS.props +++ b/osu.iOS.props @@ -74,7 +74,7 @@ - + @@ -82,7 +82,7 @@ - +