diff --git a/osu.Android.props b/osu.Android.props
index 4614c2b9b7..5a0e48c19e 100644
--- a/osu.Android.props
+++ b/osu.Android.props
@@ -51,8 +51,8 @@
-
-
+
+
diff --git a/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs b/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs
index c2df9e5e09..0e80f8f699 100644
--- a/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs
+++ b/osu.Game.Tests/Editing/TestSceneHitObjectComposerDistanceSnapping.cs
@@ -206,7 +206,7 @@ namespace osu.Game.Tests.Editing
}
private void assertSnapDistance(float expectedDistance, HitObject hitObject = null)
- => AddAssert($"distance is {expectedDistance}", () => composer.GetBeatSnapDistanceAt(hitObject ?? new HitObject()) == expectedDistance);
+ => AddAssert($"distance is {expectedDistance}", () => composer.GetBeatSnapDistanceAt(hitObject ?? new HitObject()), () => Is.EqualTo(expectedDistance));
private void assertDurationToDistance(double duration, float expectedDistance)
=> AddAssert($"duration = {duration} -> distance = {expectedDistance}", () => composer.DurationToDistance(new HitObject(), duration) == expectedDistance);
diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs
index 3be6371f28..96ba802a5f 100644
--- a/osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs
+++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorClock.cs
@@ -59,7 +59,7 @@ namespace osu.Game.Tests.Visual.Editing
{
AddStep("reset clock", () => Clock.Seek(0));
- AddStep("start clock", Clock.Start);
+ AddStep("start clock", () => Clock.Start());
AddAssert("clock running", () => Clock.IsRunning);
AddStep("seek near end", () => Clock.Seek(Clock.TrackLength - 250));
@@ -67,7 +67,7 @@ namespace osu.Game.Tests.Visual.Editing
AddAssert("clock stopped at end", () => Clock.CurrentTime == Clock.TrackLength);
- AddStep("start clock again", Clock.Start);
+ AddStep("start clock again", () => Clock.Start());
AddAssert("clock looped to start", () => Clock.IsRunning && Clock.CurrentTime < 500);
}
@@ -76,20 +76,20 @@ namespace osu.Game.Tests.Visual.Editing
{
AddStep("reset clock", () => Clock.Seek(0));
- AddStep("stop clock", Clock.Stop);
+ AddStep("stop clock", () => Clock.Stop());
AddAssert("clock stopped", () => !Clock.IsRunning);
AddStep("seek exactly to end", () => Clock.Seek(Clock.TrackLength));
AddAssert("clock stopped at end", () => Clock.CurrentTime == Clock.TrackLength);
- AddStep("start clock again", Clock.Start);
+ AddStep("start clock again", () => Clock.Start());
AddAssert("clock looped to start", () => Clock.IsRunning && Clock.CurrentTime < 500);
}
[Test]
public void TestClampWhenSeekOutsideBeatmapBounds()
{
- AddStep("stop clock", Clock.Stop);
+ AddStep("stop clock", () => Clock.Stop());
AddStep("seek before start time", () => Clock.Seek(-1000));
AddAssert("time is clamped to 0", () => Clock.CurrentTime == 0);
diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorSeekSnapping.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorSeekSnapping.cs
index c8ca273db5..d24baa6f63 100644
--- a/osu.Game.Tests/Visual/Editing/TestSceneEditorSeekSnapping.cs
+++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorSeekSnapping.cs
@@ -60,17 +60,17 @@ namespace osu.Game.Tests.Visual.Editing
// Forwards
AddStep("Seek(0)", () => Clock.Seek(0));
- AddAssert("Time = 0", () => Clock.CurrentTime == 0);
+ checkTime(0);
AddStep("Seek(33)", () => Clock.Seek(33));
- AddAssert("Time = 33", () => Clock.CurrentTime == 33);
+ checkTime(33);
AddStep("Seek(89)", () => Clock.Seek(89));
- AddAssert("Time = 89", () => Clock.CurrentTime == 89);
+ checkTime(89);
// Backwards
AddStep("Seek(25)", () => Clock.Seek(25));
- AddAssert("Time = 25", () => Clock.CurrentTime == 25);
+ checkTime(25);
AddStep("Seek(0)", () => Clock.Seek(0));
- AddAssert("Time = 0", () => Clock.CurrentTime == 0);
+ checkTime(0);
}
///
@@ -83,19 +83,19 @@ namespace osu.Game.Tests.Visual.Editing
reset();
AddStep("Seek(0), Snap", () => Clock.SeekSnapped(0));
- AddAssert("Time = 0", () => Clock.CurrentTime == 0);
+ checkTime(0);
AddStep("Seek(50), Snap", () => Clock.SeekSnapped(50));
- AddAssert("Time = 50", () => Clock.CurrentTime == 50);
+ checkTime(50);
AddStep("Seek(100), Snap", () => Clock.SeekSnapped(100));
- AddAssert("Time = 100", () => Clock.CurrentTime == 100);
+ checkTime(100);
AddStep("Seek(175), Snap", () => Clock.SeekSnapped(175));
- AddAssert("Time = 175", () => Clock.CurrentTime == 175);
+ checkTime(175);
AddStep("Seek(350), Snap", () => Clock.SeekSnapped(350));
- AddAssert("Time = 350", () => Clock.CurrentTime == 350);
+ checkTime(350);
AddStep("Seek(400), Snap", () => Clock.SeekSnapped(400));
- AddAssert("Time = 400", () => Clock.CurrentTime == 400);
+ checkTime(400);
AddStep("Seek(450), Snap", () => Clock.SeekSnapped(450));
- AddAssert("Time = 450", () => Clock.CurrentTime == 450);
+ checkTime(450);
}
///
@@ -108,17 +108,17 @@ namespace osu.Game.Tests.Visual.Editing
reset();
AddStep("Seek(24), Snap", () => Clock.SeekSnapped(24));
- AddAssert("Time = 0", () => Clock.CurrentTime == 0);
+ checkTime(0);
AddStep("Seek(26), Snap", () => Clock.SeekSnapped(26));
- AddAssert("Time = 50", () => Clock.CurrentTime == 50);
+ checkTime(50);
AddStep("Seek(150), Snap", () => Clock.SeekSnapped(150));
- AddAssert("Time = 100", () => Clock.CurrentTime == 100);
+ checkTime(100);
AddStep("Seek(170), Snap", () => Clock.SeekSnapped(170));
- AddAssert("Time = 175", () => Clock.CurrentTime == 175);
+ checkTime(175);
AddStep("Seek(274), Snap", () => Clock.SeekSnapped(274));
- AddAssert("Time = 175", () => Clock.CurrentTime == 175);
+ checkTime(175);
AddStep("Seek(276), Snap", () => Clock.SeekSnapped(276));
- AddAssert("Time = 350", () => Clock.CurrentTime == 350);
+ checkTime(350);
}
///
@@ -130,15 +130,15 @@ namespace osu.Game.Tests.Visual.Editing
reset();
AddStep("SeekForward", () => Clock.SeekForward());
- AddAssert("Time = 50", () => Clock.CurrentTime == 50);
+ checkTime(50);
AddStep("SeekForward", () => Clock.SeekForward());
- AddAssert("Time = 100", () => Clock.CurrentTime == 100);
+ checkTime(100);
AddStep("SeekForward", () => Clock.SeekForward());
- AddAssert("Time = 200", () => Clock.CurrentTime == 200);
+ checkTime(200);
AddStep("SeekForward", () => Clock.SeekForward());
- AddAssert("Time = 400", () => Clock.CurrentTime == 400);
+ checkTime(400);
AddStep("SeekForward", () => Clock.SeekForward());
- AddAssert("Time = 450", () => Clock.CurrentTime == 450);
+ checkTime(450);
}
///
@@ -150,17 +150,17 @@ namespace osu.Game.Tests.Visual.Editing
reset();
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
- AddAssert("Time = 50", () => Clock.CurrentTime == 50);
+ checkTime(50);
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
- AddAssert("Time = 100", () => Clock.CurrentTime == 100);
+ checkTime(100);
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
- AddAssert("Time = 175", () => Clock.CurrentTime == 175);
+ checkTime(175);
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
- AddAssert("Time = 350", () => Clock.CurrentTime == 350);
+ checkTime(350);
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
- AddAssert("Time = 400", () => Clock.CurrentTime == 400);
+ checkTime(400);
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
- AddAssert("Time = 450", () => Clock.CurrentTime == 450);
+ checkTime(450);
}
///
@@ -174,28 +174,28 @@ namespace osu.Game.Tests.Visual.Editing
AddStep("Seek(49)", () => Clock.Seek(49));
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
- AddAssert("Time = 50", () => Clock.CurrentTime == 50);
+ checkTime(50);
AddStep("Seek(49.999)", () => Clock.Seek(49.999));
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
- AddAssert("Time = 100", () => Clock.CurrentTime == 100);
+ checkTime(100);
AddStep("Seek(99)", () => Clock.Seek(99));
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
- AddAssert("Time = 100", () => Clock.CurrentTime == 100);
+ checkTime(100);
AddStep("Seek(99.999)", () => Clock.Seek(99.999));
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
- AddAssert("Time = 100", () => Clock.CurrentTime == 150);
+ checkTime(150);
AddStep("Seek(174)", () => Clock.Seek(174));
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
- AddAssert("Time = 175", () => Clock.CurrentTime == 175);
+ checkTime(175);
AddStep("Seek(349)", () => Clock.Seek(349));
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
- AddAssert("Time = 350", () => Clock.CurrentTime == 350);
+ checkTime(350);
AddStep("Seek(399)", () => Clock.Seek(399));
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
- AddAssert("Time = 400", () => Clock.CurrentTime == 400);
+ checkTime(400);
AddStep("Seek(449)", () => Clock.Seek(449));
AddStep("SeekForward, Snap", () => Clock.SeekForward(true));
- AddAssert("Time = 450", () => Clock.CurrentTime == 450);
+ checkTime(450);
}
///
@@ -208,15 +208,15 @@ namespace osu.Game.Tests.Visual.Editing
AddStep("Seek(450)", () => Clock.Seek(450));
AddStep("SeekBackward", () => Clock.SeekBackward());
- AddAssert("Time = 400", () => Clock.CurrentTime == 400);
+ checkTime(400);
AddStep("SeekBackward", () => Clock.SeekBackward());
- AddAssert("Time = 350", () => Clock.CurrentTime == 350);
+ checkTime(350);
AddStep("SeekBackward", () => Clock.SeekBackward());
- AddAssert("Time = 150", () => Clock.CurrentTime == 150);
+ checkTime(150);
AddStep("SeekBackward", () => Clock.SeekBackward());
- AddAssert("Time = 50", () => Clock.CurrentTime == 50);
+ checkTime(50);
AddStep("SeekBackward", () => Clock.SeekBackward());
- AddAssert("Time = 0", () => Clock.CurrentTime == 0);
+ checkTime(0);
}
///
@@ -229,17 +229,17 @@ namespace osu.Game.Tests.Visual.Editing
AddStep("Seek(450)", () => Clock.Seek(450));
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
- AddAssert("Time = 400", () => Clock.CurrentTime == 400);
+ checkTime(400);
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
- AddAssert("Time = 350", () => Clock.CurrentTime == 350);
+ checkTime(350);
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
- AddAssert("Time = 175", () => Clock.CurrentTime == 175);
+ checkTime(175);
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
- AddAssert("Time = 100", () => Clock.CurrentTime == 100);
+ checkTime(100);
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
- AddAssert("Time = 50", () => Clock.CurrentTime == 50);
+ checkTime(50);
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
- AddAssert("Time = 0", () => Clock.CurrentTime == 0);
+ checkTime(0);
}
///
@@ -253,16 +253,16 @@ namespace osu.Game.Tests.Visual.Editing
AddStep("Seek(451)", () => Clock.Seek(451));
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
- AddAssert("Time = 450", () => Clock.CurrentTime == 450);
+ checkTime(450);
AddStep("Seek(450.999)", () => Clock.Seek(450.999));
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
- AddAssert("Time = 450", () => Clock.CurrentTime == 450);
+ checkTime(450);
AddStep("Seek(401)", () => Clock.Seek(401));
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
- AddAssert("Time = 400", () => Clock.CurrentTime == 400);
+ checkTime(400);
AddStep("Seek(401.999)", () => Clock.Seek(401.999));
AddStep("SeekBackward, Snap", () => Clock.SeekBackward(true));
- AddAssert("Time = 400", () => Clock.CurrentTime == 400);
+ checkTime(400);
}
///
@@ -297,9 +297,11 @@ namespace osu.Game.Tests.Visual.Editing
AddAssert("Time < lastTime", () => Clock.CurrentTime < lastTime);
}
- AddAssert("Time = 0", () => Clock.CurrentTime == 0);
+ checkTime(0);
}
+ private void checkTime(double expectedTime) => AddAssert($"Current time is {expectedTime}", () => Clock.CurrentTime, () => Is.EqualTo(expectedTime));
+
private void reset()
{
AddStep("Reset", () => Clock.Seek(0));
diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs
index 6f248f1247..924396ce03 100644
--- a/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs
+++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs
@@ -4,7 +4,6 @@
#nullable disable
using NUnit.Framework;
-using osu.Framework.Utils;
using osu.Game.Beatmaps;
using osu.Game.Beatmaps.ControlPoints;
using osu.Game.Rulesets;
@@ -120,7 +119,7 @@ namespace osu.Game.Tests.Visual.Editing
private void pressAndCheckTime(Key key, double expectedTime)
{
AddStep($"press {key}", () => InputManager.Key(key));
- AddUntilStep($"time is {expectedTime}", () => Precision.AlmostEquals(expectedTime, EditorClock.CurrentTime, 1));
+ AddUntilStep($"time is {expectedTime}", () => EditorClock.CurrentTime, () => Is.EqualTo(expectedTime).Within(1));
}
}
}
diff --git a/osu.Game.Tests/Visual/Menus/TestSceneToolbarUserButton.cs b/osu.Game.Tests/Visual/Menus/TestSceneToolbarUserButton.cs
new file mode 100644
index 0000000000..2901501b30
--- /dev/null
+++ b/osu.Game.Tests/Visual/Menus/TestSceneToolbarUserButton.cs
@@ -0,0 +1,87 @@
+// 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;
+using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics.Shapes;
+using osu.Game.Online.API;
+using osu.Game.Overlays.Toolbar;
+using osuTK;
+using osuTK.Graphics;
+
+namespace osu.Game.Tests.Visual.Menus
+{
+ [TestFixture]
+ public class TestSceneToolbarUserButton : OsuManualInputManagerTestScene
+ {
+ public TestSceneToolbarUserButton()
+ {
+ Container mainContainer;
+
+ Children = new Drawable[]
+ {
+ mainContainer = new Container
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ RelativeSizeAxes = Axes.X,
+ Height = Toolbar.HEIGHT,
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ Colour = Color4.Black,
+ RelativeSizeAxes = Axes.Both,
+ },
+ new FillFlowContainer
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ RelativeSizeAxes = Axes.Y,
+ AutoSizeAxes = Axes.X,
+ Direction = FillDirection.Horizontal,
+ Children = new Drawable[]
+ {
+ new Box
+ {
+ Colour = Color4.DarkRed,
+ RelativeSizeAxes = Axes.Y,
+ Width = 2,
+ },
+ new ToolbarUserButton(),
+ new Box
+ {
+ Colour = Color4.DarkRed,
+ RelativeSizeAxes = Axes.Y,
+ Width = 2,
+ },
+ }
+ },
+ }
+ },
+ };
+
+ AddSliderStep("scale", 0.5, 4, 1, scale => mainContainer.Scale = new Vector2((float)scale));
+ }
+
+ [Test]
+ public void TestLoginLogout()
+ {
+ AddStep("Log out", () => ((DummyAPIAccess)API).Logout());
+ AddStep("Log in", () => ((DummyAPIAccess)API).Login("wang", "jang"));
+ }
+
+ [Test]
+ public void TestStates()
+ {
+ AddStep("Log in", () => ((DummyAPIAccess)API).Login("wang", "jang"));
+
+ foreach (var state in Enum.GetValues())
+ {
+ AddStep($"Change state to {state}", () => ((DummyAPIAccess)API).SetState(state));
+ }
+ }
+ }
+}
diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs
index d626426e6d..706d493fd6 100644
--- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs
+++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorScreen.cs
@@ -432,8 +432,8 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
var user = playingUsers.Single(u => u.UserID == userId);
- OnlinePlayDependencies.MultiplayerClient.RemoveUser(user.User.AsNonNull());
SpectatorClient.SendEndPlay(userId);
+ OnlinePlayDependencies.MultiplayerClient.RemoveUser(user.User.AsNonNull());
playingUsers.Remove(user);
});
diff --git a/osu.Game/Graphics/UserInterface/LoadingLayer.cs b/osu.Game/Graphics/UserInterface/LoadingLayer.cs
index b3655eaab4..9f6177c226 100644
--- a/osu.Game/Graphics/UserInterface/LoadingLayer.cs
+++ b/osu.Game/Graphics/UserInterface/LoadingLayer.cs
@@ -20,6 +20,8 @@ namespace osu.Game.Graphics.UserInterface
///
public class LoadingLayer : LoadingSpinner
{
+ private readonly bool blockInput;
+
[CanBeNull]
protected Box BackgroundDimLayer { get; }
@@ -28,9 +30,11 @@ namespace osu.Game.Graphics.UserInterface
///
/// Whether the full background area should be dimmed while loading.
/// Whether the spinner should have a surrounding black box for visibility.
- public LoadingLayer(bool dimBackground = false, bool withBox = true)
+ /// Whether to block input of components behind the loading layer.
+ public LoadingLayer(bool dimBackground = false, bool withBox = true, bool blockInput = true)
: base(withBox)
{
+ this.blockInput = blockInput;
RelativeSizeAxes = Axes.Both;
Size = new Vector2(1);
@@ -52,6 +56,9 @@ namespace osu.Game.Graphics.UserInterface
protected override bool Handle(UIEvent e)
{
+ if (!blockInput)
+ return false;
+
switch (e)
{
// blocking scroll can cause weird behaviour when this layer is used within a ScrollContainer.
@@ -83,7 +90,7 @@ namespace osu.Game.Graphics.UserInterface
{
base.Update();
- MainContents.Size = new Vector2(Math.Clamp(Math.Min(DrawWidth, DrawHeight) * 0.25f, 30, 100));
+ MainContents.Size = new Vector2(Math.Clamp(Math.Min(DrawWidth, DrawHeight) * 0.25f, 20, 100));
}
}
}
diff --git a/osu.Game/Localisation/ToolbarStrings.cs b/osu.Game/Localisation/ToolbarStrings.cs
new file mode 100644
index 0000000000..6dc8a1e50c
--- /dev/null
+++ b/osu.Game/Localisation/ToolbarStrings.cs
@@ -0,0 +1,24 @@
+// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
+// See the LICENCE file in the repository root for full licence text.
+
+using osu.Framework.Localisation;
+
+namespace osu.Game.Localisation
+{
+ public static class ToolbarStrings
+ {
+ private const string prefix = @"osu.Game.Resources.Localisation.Toolbar";
+
+ ///
+ /// "Connection interrupted, will try to reconnect..."
+ ///
+ public static LocalisableString AttemptingToReconnect => new TranslatableString(getKey(@"attempting_to_reconnect"), @"Connection interrupted, will try to reconnect...");
+
+ ///
+ /// "Connecting..."
+ ///
+ public static LocalisableString Connecting => new TranslatableString(getKey(@"connecting"), @"Connecting...");
+
+ private static string getKey(string key) => $@"{prefix}:{key}";
+ }
+}
diff --git a/osu.Game/Online/Multiplayer/MultiplayerClient.cs b/osu.Game/Online/Multiplayer/MultiplayerClient.cs
index 603bd10c38..04b87c19da 100644
--- a/osu.Game/Online/Multiplayer/MultiplayerClient.cs
+++ b/osu.Game/Online/Multiplayer/MultiplayerClient.cs
@@ -196,6 +196,9 @@ namespace osu.Game.Online.Multiplayer
APIRoom.Playlist.AddRange(joinedRoom.Playlist.Select(createPlaylistItem));
APIRoom.CurrentPlaylistItem.Value = APIRoom.Playlist.Single(item => item.ID == joinedRoom.Settings.PlaylistItemId);
+ // The server will null out the end date upon the host joining the room, but the null value is never communicated to the client.
+ APIRoom.EndDate.Value = null;
+
Debug.Assert(LocalUser != null);
addUserToAPIRoom(LocalUser);
diff --git a/osu.Game/Overlays/Login/LoginPanel.cs b/osu.Game/Overlays/Login/LoginPanel.cs
index 1d8926b991..32a7fca1a6 100644
--- a/osu.Game/Overlays/Login/LoginPanel.cs
+++ b/osu.Game/Overlays/Login/LoginPanel.cs
@@ -13,6 +13,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface;
+using osu.Game.Localisation;
using osu.Game.Online.API;
using osu.Game.Users;
using osuTK;
@@ -109,7 +110,7 @@ namespace osu.Game.Overlays.Login
Origin = Anchor.TopCentre,
TextAnchor = Anchor.TopCentre,
AutoSizeAxes = Axes.Both,
- Text = state.NewValue == APIState.Failing ? "Connection is failing, will attempt to reconnect... " : "Attempting to connect... ",
+ Text = state.NewValue == APIState.Failing ? ToolbarStrings.AttemptingToReconnect : ToolbarStrings.Connecting,
Margin = new MarginPadding { Top = 10, Bottom = 10 },
},
};
diff --git a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs
index a93ba17c5b..4ebd19a1f7 100644
--- a/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs
+++ b/osu.Game/Overlays/Toolbar/ToolbarUserButton.cs
@@ -1,17 +1,19 @@
// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
-#nullable disable
-
+using System;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
+using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Effects;
+using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics;
+using osu.Game.Graphics.UserInterface;
+using osu.Game.Localisation;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests.Responses;
-using osu.Game.Resources.Localisation.Web;
using osu.Game.Users.Drawables;
using osuTK;
using osuTK.Graphics;
@@ -20,59 +22,103 @@ namespace osu.Game.Overlays.Toolbar
{
public class ToolbarUserButton : ToolbarOverlayToggleButton
{
- private readonly UpdateableAvatar avatar;
+ private UpdateableAvatar avatar = null!;
- [Resolved]
- private IAPIProvider api { get; set; }
+ private IBindable localUser = null!;
- private readonly IBindable apiState = new Bindable();
+ private LoadingSpinner spinner = null!;
+
+ private SpriteIcon failingIcon = null!;
+
+ private IBindable apiState = null!;
public ToolbarUserButton()
{
AutoSizeAxes = Axes.X;
+ }
- DrawableText.Font = OsuFont.GetFont(italics: true);
-
+ [BackgroundDependencyLoader]
+ private void load(OsuColour colours, IAPIProvider api, LoginOverlay? login)
+ {
Add(new OpaqueBackground { Depth = 1 });
- Flow.Add(avatar = new UpdateableAvatar(isInteractive: false)
+ Flow.Add(new Container
{
Masking = true,
+ CornerRadius = 4,
Size = new Vector2(32),
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
- CornerRadius = 4,
EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Shadow,
Radius = 4,
Colour = Color4.Black.Opacity(0.1f),
+ },
+ Children = new Drawable[]
+ {
+ avatar = new UpdateableAvatar(isInteractive: false)
+ {
+ RelativeSizeAxes = Axes.Both,
+ },
+ spinner = new LoadingLayer(dimBackground: true, withBox: false, blockInput: false)
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ RelativeSizeAxes = Axes.Both,
+ },
+ failingIcon = new SpriteIcon
+ {
+ Anchor = Anchor.Centre,
+ Origin = Anchor.Centre,
+ Alpha = 0,
+ Size = new Vector2(0.3f),
+ Icon = FontAwesome.Solid.ExclamationTriangle,
+ RelativeSizeAxes = Axes.Both,
+ Colour = colours.YellowLight,
+ },
}
});
- }
- [BackgroundDependencyLoader(true)]
- private void load(LoginOverlay login)
- {
- apiState.BindTo(api.State);
+ apiState = api.State.GetBoundCopy();
apiState.BindValueChanged(onlineStateChanged, true);
+ localUser = api.LocalUser.GetBoundCopy();
+ localUser.BindValueChanged(userChanged, true);
+
StateContainer = login;
}
+ private void userChanged(ValueChangedEvent user) => Schedule(() =>
+ {
+ Text = user.NewValue.Username;
+ avatar.User = user.NewValue;
+ });
+
private void onlineStateChanged(ValueChangedEvent state) => Schedule(() =>
{
+ failingIcon.FadeTo(state.NewValue == APIState.Failing ? 1 : 0, 200, Easing.OutQuint);
+
switch (state.NewValue)
{
- default:
- Text = UsersStrings.AnonymousUsername;
- avatar.User = new APIUser();
+ case APIState.Connecting:
+ TooltipText = ToolbarStrings.Connecting;
+ spinner.Show();
break;
- case APIState.Online:
- Text = api.LocalUser.Value.Username;
- avatar.User = api.LocalUser.Value;
+ case APIState.Failing:
+ TooltipText = ToolbarStrings.AttemptingToReconnect;
+ spinner.Show();
break;
+
+ case APIState.Offline:
+ case APIState.Online:
+ TooltipText = string.Empty;
+ spinner.Hide();
+ break;
+
+ default:
+ throw new ArgumentOutOfRangeException();
}
});
}
diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs
index 8270bb3b6f..5cd9e0ddf9 100644
--- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs
+++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs
@@ -231,6 +231,12 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
if (state.State == SpectatedUserState.Passed || state.State == SpectatedUserState.Failed)
return;
+ // we could also potentially receive EndGameplay with "Playing" state, at which point we can only early-return and hope it's a passing player.
+ // todo: this shouldn't exist, but it's here as a hotfix for an issue with multi-spectator screen not proceeding to results screen.
+ // see: https://github.com/ppy/osu/issues/19593
+ if (state.State == SpectatedUserState.Playing)
+ return;
+
RemoveUser(userId);
var instance = instances.Single(i => i.UserId == userId);
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index b371aa3618..ada0cce8f7 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -36,8 +36,8 @@
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
+
+
diff --git a/osu.iOS.props b/osu.iOS.props
index bab652bbee..f789d97976 100644
--- a/osu.iOS.props
+++ b/osu.iOS.props
@@ -61,8 +61,8 @@
-
-
+
+
@@ -84,7 +84,7 @@
-
+