mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 06:42:54 +08:00
Show error message in popover
This commit is contained in:
parent
6851e0000d
commit
e3c56f9ebd
@ -87,10 +87,10 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
||||
|
||||
currentJoinRoomRequest.Failure += exception =>
|
||||
{
|
||||
// provide error output if the operation wasn't canceled and the error doesn't stem from an invalid password
|
||||
if (!(exception is OperationCanceledException) && !((APIException)exception).Message.Equals("Invalid room password", StringComparison.Ordinal))
|
||||
Logger.Log($"Failed to join room: {exception}", level: LogLevel.Important);
|
||||
onError?.Invoke(exception.ToString());
|
||||
if (exception is OperationCanceledException)
|
||||
return;
|
||||
|
||||
onError?.Invoke(exception.Message);
|
||||
};
|
||||
|
||||
api.Queue(currentJoinRoomRequest);
|
||||
|
@ -14,7 +14,9 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.UserInterface;
|
||||
using osu.Framework.Input.Bindings;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Graphics.UserInterfaceV2;
|
||||
using osu.Game.Input.Bindings;
|
||||
@ -189,9 +191,10 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
||||
private OsuPasswordTextBox passwordTextbox;
|
||||
private TriangleButton joinButton;
|
||||
private ShakeContainer shakeContainer;
|
||||
private OsuSpriteText errorText;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
Child = shakeContainer = new ShakeContainer
|
||||
{
|
||||
@ -201,19 +204,32 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
||||
{
|
||||
Spacing = new Vector2(5),
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Direction = FillDirection.Vertical,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
passwordTextbox = new OsuPasswordTextBox
|
||||
new FillFlowContainer
|
||||
{
|
||||
Width = 200,
|
||||
PlaceholderText = "password",
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(5),
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
passwordTextbox = new OsuPasswordTextBox
|
||||
{
|
||||
Width = 200,
|
||||
PlaceholderText = "password",
|
||||
},
|
||||
joinButton = new TriangleButton
|
||||
{
|
||||
Width = 80,
|
||||
Text = "Join Room",
|
||||
}
|
||||
}
|
||||
},
|
||||
joinButton = new TriangleButton
|
||||
errorText = new OsuSpriteText
|
||||
{
|
||||
Width = 80,
|
||||
Text = "Join Room",
|
||||
}
|
||||
Colour = colours.Red,
|
||||
},
|
||||
}
|
||||
}
|
||||
};
|
||||
@ -225,6 +241,9 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
|
||||
{
|
||||
passwordTextbox.Text = string.Empty;
|
||||
|
||||
errorText.Text = error;
|
||||
errorText.FadeOutFromOne(1000, Easing.In);
|
||||
|
||||
shakeContainer.Shake();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user