Move notification to stateful client so it is only shown to the user from one location

This commit is contained in:
Dean Herbert 2020-12-23 16:19:03 +09:00
parent a1d42dc4a0
commit 569c4092ef
2 changed files with 6 additions and 5 deletions

View File

@ -11,6 +11,7 @@
using osu.Framework.Bindables;
using osu.Framework.Extensions.ObjectExtensions;
using osu.Framework.Graphics;
using osu.Framework.Logging;
using osu.Game.Beatmaps;
using osu.Game.Database;
using osu.Game.Online.API;
@ -81,7 +82,10 @@ protected StatefulMultiplayerClient()
{
// clean up local room state on server disconnect.
if (!connected.NewValue)
{
Logger.Log("Connection to multiplayer server was lost.", LoggingTarget.Runtime, LogLevel.Important);
LeaveRoom();
}
});
}

View File

@ -7,7 +7,6 @@
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Logging;
using osu.Framework.Screens;
using osu.Game.Online.Multiplayer;
using osu.Game.Online.RealtimeMultiplayer;
@ -18,6 +17,7 @@
using osu.Game.Screens.Multi.RealtimeMultiplayer.Participants;
using osu.Game.Screens.Play;
using osu.Game.Users;
using ParticipantsList = osu.Game.Screens.Multi.RealtimeMultiplayer.Participants.ParticipantsList;
namespace osu.Game.Screens.Multi.RealtimeMultiplayer
{
@ -106,7 +106,7 @@ private void load()
new Drawable[] { new ParticipantsListHeader() },
new Drawable[]
{
new Participants.ParticipantsList
new ParticipantsList
{
RelativeSizeAxes = Axes.Both
},
@ -182,10 +182,7 @@ protected override void LoadComplete()
isConnected.BindValueChanged(connected =>
{
if (!connected.NewValue)
{
Logger.Log("Connection to multiplayer server was lost.", LoggingTarget.Runtime, LogLevel.Important);
Schedule(this.Exit);
}
}, true);
}