Merge branch 'master' into catch-explode-effect

This commit is contained in:
Dan Balasescu 2020-02-21 20:07:00 +09:00 committed by GitHub
commit 110f7e896e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
35 changed files with 328 additions and 310 deletions

View File

@ -54,6 +54,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.221.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.218.0" />
<PackageReference Include="ppy.osu.Framework.Android" Version="2020.221.0" />
</ItemGroup>
</Project>

View File

@ -35,7 +35,7 @@ public void TestOnlineStateVisibility()
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 @@ public void TestOfflineStateVisibility()
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 @@ public void TestConnectingStateVisibility()
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 @@ public void TestFailingStateVisibility()
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;

View File

@ -8,7 +8,6 @@
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.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 @@ public class TestSceneRankingsTables : OsuTestScene
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 @@ public TestSceneRankingsTables()
RelativeSizeAxes = Axes.Both,
Width = 0.8f,
},
loading = new DimmedLoadingLayer(),
loading = new LoadingLayer(),
};
}

View File

@ -12,8 +12,8 @@
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 @@ public class TestSceneUserRequest : OsuTestScene
private readonly Bindable<User> user = new Bindable<User>();
private GetUserRequest request;
private readonly DimmedLoadingLayer loading;
private readonly LoadingLayer loading;
public TestSceneUserRequest()
{
@ -40,10 +40,7 @@ public TestSceneUserRequest()
{
User = { BindTarget = user }
},
loading = new DimmedLoadingLayer
{
Alpha = 0
}
loading = new LoadingLayer()
}
});
}

View File

@ -1,6 +1,8 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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 @@
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<Type> 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 @@ public void SetUp() => Schedule(() =>
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 @@ public void ShowHide()
}
[Test]
public void ContentRestoreOnDispose()
public void TestContentRestoreOnDispose()
{
AddAssert("not visible", () => !overlay.IsPresent);
@ -78,9 +84,23 @@ public void ContentRestoreOnDispose()
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());
}
}
}

View File

@ -8,12 +8,12 @@
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 @@ public TestSceneLoadingAnimation()
Colour = Color4.Black,
RelativeSizeAxes = Axes.Both
},
loading = new LoadingAnimation()
loading = new LoadingSpinner()
});
loading.Show();
@ -34,7 +34,7 @@ public TestSceneLoadingAnimation()
Colour = Color4.White,
RelativeSizeAxes = Axes.Both
},
loading = new LoadingAnimation()
loading = new LoadingSpinner(true)
});
loading.Show();
@ -46,14 +46,14 @@ public TestSceneLoadingAnimation()
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);

View File

@ -1,58 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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);
}
}
}

View File

@ -1,64 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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
{
/// <summary>
/// A loading spinner.
/// </summary>
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);
}
}

View File

@ -40,14 +40,14 @@ public Vector2 LoadingAnimationSize
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,

View File

@ -0,0 +1,81 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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
{
/// <summary>
/// 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.
/// </summary>
public class LoadingLayer : LoadingSpinner
{
private readonly Drawable dimTarget;
/// <summary>
/// Constuct a new loading spinner.
/// </summary>
/// <param name="dimTarget">An optional target to dim when displayed.</param>
/// <param name="withBox">Whether the spinner should have a surrounding black box for visibility.</param>
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);
}
}
}
}

View File

@ -0,0 +1,106 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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
{
/// <summary>
/// A loading spinner.
/// </summary>
public class LoadingSpinner : VisibilityContainer
{
private readonly SpriteIcon spinner;
protected Container MainContents;
protected const float TRANSITION_DURATION = 500;
private const float spin_duration = 900;
/// <summary>
/// Constuct a new loading spinner.
/// </summary>
/// <param name="withBox">Whether the spinner should have a surrounding black box for visibility.</param>
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();
}
}
}

View File

@ -1,88 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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
{
/// <summary>
/// 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.
/// </summary>
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);
}
}
}
}

View File

@ -30,7 +30,7 @@ public abstract class Leaderboard<TScope, TScoreInfo> : Container, IOnlineCompon
private FillFlowContainer<LeaderboardScore> scrollFlow;
private readonly LoadingAnimation loading;
private readonly LoadingSpinner loading;
private ScheduledDelegate showScoresDelegate;
private CancellationTokenSource showScoresCancellationSource;
@ -202,7 +202,7 @@ protected Leaderboard()
}
},
},
loading = new LoadingAnimation(),
loading = new LoadingSpinner(),
placeholderContainer = new Container
{
RelativeSizeAxes = Axes.Both

View File

@ -16,7 +16,7 @@ namespace osu.Game.Online
/// </summary>
public abstract class OnlineViewContainer : Container, IOnlineComponent
{
protected LoadingAnimation LoadingAnimation { get; private set; }
protected LoadingSpinner LoadingSpinner { get; private set; }
protected override Container<Drawable> Content { get; } = new Container { RelativeSizeAxes = Axes.Both };
@ -41,7 +41,7 @@ private void load()
{
Content,
placeholder = new LoginPlaceholder(placeholderMessage),
LoadingAnimation = new LoadingAnimation
LoadingSpinner = new LoadingSpinner
{
Alpha = 0,
}
@ -63,19 +63,19 @@ public virtual void APIStateChanged(IAPIProvider api, APIState state)
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;
}

View File

@ -598,6 +598,7 @@ protected override void LoadComplete()
//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 @@ protected override void LoadComplete()
}
// 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)
{

View File

@ -40,7 +40,7 @@ public class ScreenEntry : AccountCreationScreen
private IEnumerable<Drawable> characterCheckText;
private OsuTextBox[] textboxes;
private ProcessingOverlay processingOverlay;
private LoadingLayer loadingLayer;
[Resolved]
private GameHost host { get; set; }
@ -124,7 +124,7 @@ private void load(OsuColour colours)
},
},
},
processingOverlay = new ProcessingOverlay(mainContent)
loadingLayer = new LoadingLayer(mainContent)
};
textboxes = new[] { usernameTextBox, emailTextBox, passwordTextBox };
@ -144,7 +144,7 @@ private void load(OsuColour colours)
public override void OnEntering(IScreen last)
{
base.OnEntering(last);
processingOverlay.Hide();
loadingLayer.Hide();
if (host?.OnScreenKeyboardOverlapsGameWindow != true)
focusNextTextbox();
@ -162,7 +162,7 @@ private void performRegistration()
emailAddressDescription.ClearErrors();
passwordDescription.ClearErrors();
processingOverlay.Show();
loadingLayer.Show();
Task.Run(() =>
{
@ -195,7 +195,7 @@ private void performRegistration()
}
registerShake.Shake();
processingOverlay.Hide();
loadingLayer.Hide();
return;
}

View File

@ -5,7 +5,6 @@
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 @@ public class FavouriteButton : HeaderButton, IHasTooltip
private readonly BindableBool favourited = new BindableBool();
private PostBeatmapFavouriteRequest request;
private DimmedLoadingLayer loading;
private LoadingLayer loading;
private readonly Bindable<User> localUser = new Bindable<User>();
@ -54,14 +53,11 @@ private void load(IAPIProvider api, NotificationOverlay notifications)
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);

View File

@ -1,4 +1,4 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System.Linq;
@ -45,7 +45,7 @@ public class Header : BeatmapDownloadTrackingComposite
private readonly FavouriteButton favouriteButton;
private readonly FillFlowContainer fadeContent;
private readonly LoadingAnimation loading;
private readonly LoadingSpinner loading;
private readonly BeatmapSetHeader beatmapSetHeader;
[Cached(typeof(IBindable<RulesetInfo>))]
@ -179,7 +179,7 @@ public Header()
},
}
},
loading = new LoadingAnimation
loading = new LoadingSpinner
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,

View File

@ -5,7 +5,6 @@
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.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 @@ public class ScoresContainer : CompositeDrawable
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 @@ public ScoresContainer()
}
}
},
new Container
{
RelativeSizeAxes = Axes.Both,
Masking = true,
CornerRadius = 5,
Child = loading = new DimmedLoadingLayer(iconScale: 0.8f)
{
Alpha = 0,
},
}
loading = new LoadingLayer()
}
}
}

View File

@ -37,7 +37,7 @@ public class ChatOverlay : OsuFocusedOverlayContainer
private readonly List<DrawableChannel> loadedChannels = new List<DrawableChannel>();
private LoadingAnimation loading;
private LoadingSpinner loading;
private FocusedTextBox textbox;
@ -146,7 +146,7 @@ private void load(OsuConfigManager config, OsuColour colours)
}
}
},
loading = new LoadingAnimation(),
loading = new LoadingSpinner(),
}
},
tabsArea = new TabsArea

View File

@ -42,7 +42,7 @@ public BeatmapSetInfo BeatmapSet
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 @@ private bool loading
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 @@ public PlayButton(BeatmapSetInfo setInfo = null)
RelativeSizeAxes = Axes.Both,
Icon = FontAwesome.Solid.Play,
},
loadingAnimation = new LoadingAnimation
loadingSpinner = new LoadingSpinner
{
Size = new Vector2(15),
},

View File

@ -27,6 +27,8 @@ public class RankingsOverlayHeader : TabControlOverlayHeader<RankingsScope>
protected override Drawable CreateContent() => countryFilter = new CountryFilter();
protected override Drawable CreateBackground() => new OverlayHeaderBackground(@"Headers/rankings");
private class RankingsTitle : ScreenTitle
{
public readonly Bindable<RankingsScope> Scope = new Bindable<RankingsScope>();

View File

@ -37,7 +37,7 @@ public class SpotlightsLayout : CompositeDrawable
private SpotlightSelector selector;
private Container content;
private DimmedLoadingLayer loading;
private LoadingLayer loading;
[BackgroundDependencyLoader]
private void load()
@ -67,7 +67,7 @@ private void load()
AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Vertical = 10 }
},
loading = new DimmedLoadingLayer()
loading = new LoadingLayer(content)
}
}
}

View File

@ -9,9 +9,9 @@
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 @@ public class RankingsOverlay : FullscreenOverlay
protected Bindable<RankingsScope> Scope => header.Current;
private Bindable<RulesetInfo> 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 @@ public RankingsOverlay()
RelativeSizeAxes = Axes.X,
Margin = new MarginPadding { Bottom = 10 }
},
loading = new DimmedLoadingLayer(),
loading = new LoadingLayer(contentContainer),
}
}
}
@ -92,10 +90,15 @@ private void load()
background.Colour = ColourProvider.Background5;
}
[Resolved]
private Bindable<RulesetInfo> 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 @@ protected override void LoadComplete()
Scheduler.AddOnce(loadNewContent);
});
Scheduler.AddOnce(loadNewContent);
}
public void ShowCountry(Country requested)

View File

@ -95,7 +95,7 @@ public void APIStateChanged(IAPIProvider api, APIState state) => Schedule(() =>
Children = new Drawable[]
{
new LoadingAnimation
new LoadingSpinner
{
State = { Value = Visibility.Visible },
Anchor = Anchor.TopCentre,

View File

@ -24,7 +24,7 @@ namespace osu.Game.Overlays
{
public class SocialOverlay : SearchableListOverlay<SocialTab, SocialSortCriteria, SortDirection>
{
private readonly LoadingAnimation loading;
private readonly LoadingSpinner loading;
private FillFlowContainer<SocialPanel> panels;
protected override Color4 BackgroundColour => OsuColour.FromHex(@"60284b");
@ -54,7 +54,7 @@ public User[] Users
public SocialOverlay()
: base(OverlayColourScheme.Pink)
{
Add(loading = new LoadingAnimation());
Add(loading = new LoadingSpinner());
Filter.Search.Current.ValueChanged += text =>
{

View File

@ -70,6 +70,7 @@ private void load(OsuGame osuGame, Bindable<RulesetInfo> parentRuleset)
Children = new Drawable[]
{
new ToolbarChangelogButton(),
new ToolbarRankingsButton(),
new ToolbarDirectButton(),
new ToolbarChatButton(),
new ToolbarSocialButton(),

View File

@ -0,0 +1,22 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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;
}
}
}

View File

@ -23,7 +23,7 @@ public class LoungeSubScreen : MultiplayerSubScreen
protected readonly FilterControl Filter;
private readonly Container content;
private readonly ProcessingOverlay processingOverlay;
private readonly LoadingLayer loadingLayer;
[Resolved]
private Bindable<Room> currentRoom { get; set; }
@ -58,7 +58,7 @@ public LoungeSubScreen()
Child = new RoomsContainer { JoinRequested = joinRequested }
},
},
processingOverlay = new ProcessingOverlay(searchContainer),
loadingLayer = new LoadingLayer(searchContainer),
}
},
new RoomInspector
@ -126,12 +126,12 @@ public override void OnSuspending(IScreen next)
private void joinRequested(Room room)
{
processingOverlay.Show();
loadingLayer.Show();
RoomManager?.JoinRoom(room, r =>
{
Open(room);
processingOverlay.Hide();
}, _ => processingOverlay.Hide());
loadingLayer.Hide();
}, _ => loadingLayer.Hide());
}
/// <summary>

View File

@ -67,7 +67,7 @@ protected class MatchSettings : MultiplayerComposite
public OsuSpriteText ErrorText;
private OsuSpriteText typeLabel;
private ProcessingOverlay processingOverlay;
private LoadingLayer loadingLayer;
private DrawableRoomPlaylist playlist;
[Resolved(CanBeNull = true)]
@ -307,7 +307,7 @@ private void load(OsuColour colours)
},
}
},
processingOverlay = new ProcessingOverlay(dimContent)
loadingLayer = new LoadingLayer(dimContent)
};
TypePicker.Current.BindValueChanged(type => typeLabel.Text = type.NewValue?.Name ?? string.Empty, true);
@ -346,19 +346,19 @@ private void apply()
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();
}
}

View File

@ -53,7 +53,7 @@ public MetadataLine(string left, string right)
private readonly WorkingBeatmap beatmap;
private readonly Bindable<IReadOnlyList<Mod>> mods;
private readonly Drawable facade;
private LoadingAnimation loading;
private LoadingSpinner loading;
private Sprite backgroundSprite;
public IBindable<IReadOnlyList<Mod>> Mods => mods;
@ -138,7 +138,7 @@ private void load()
Anchor = Anchor.Centre,
FillMode = FillMode.Fill,
},
loading = new LoadingAnimation { Scale = new Vector2(1.3f) }
loading = new LoadingSpinner { Scale = new Vector2(1.3f) }
}
},
new OsuSpriteText

View File

@ -7,7 +7,6 @@
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.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 @@ public class BeatmapDetails : Container
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 @@ public BeatmapInfo Beatmap
public BeatmapDetails()
{
Container content;
Children = new Drawable[]
{
new Box
@ -70,7 +72,7 @@ public BeatmapDetails()
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 @@ public BeatmapDetails()
},
},
},
loading = new DimmedLoadingLayer(),
loading = new LoadingLayer(content),
};
}

View File

@ -78,6 +78,10 @@ private string getBestUrl(GitHubRelease release)
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"));

View File

@ -23,7 +23,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.221.0" />
<PackageReference Include="ppy.osu.Framework" Version="2020.218.0" />
<PackageReference Include="ppy.osu.Framework" Version="2020.221.0" />
<PackageReference Include="Sentry" Version="2.0.3" />
<PackageReference Include="SharpCompress" Version="0.24.0" />
<PackageReference Include="NUnit" Version="3.12.0" />

View File

@ -74,7 +74,7 @@
</ItemGroup>
<ItemGroup Label="Package References">
<PackageReference Include="ppy.osu.Game.Resources" Version="2020.221.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.218.0" />
<PackageReference Include="ppy.osu.Framework.iOS" Version="2020.221.0" />
</ItemGroup>
<!-- Xamarin.iOS does not automatically handle transitive dependencies from NuGet packages. -->
<ItemGroup Label="Transitive Dependencies">
@ -82,7 +82,7 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="2.2.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.6" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="ppy.osu.Framework" Version="2020.218.0" />
<PackageReference Include="ppy.osu.Framework" Version="2020.221.0" />
<PackageReference Include="SharpCompress" Version="0.24.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
<PackageReference Include="SharpRaven" Version="2.4.0" />