mirror of
https://github.com/osukey/osukey.git
synced 2025-06-25 05:07:59 +09:00
Merge branch 'master' into fix-error-spam-on-disconnection
This commit is contained in:
commit
3920dac8af
@ -143,7 +143,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
RoomManager =
|
RoomManager =
|
||||||
{
|
{
|
||||||
TimeBetweenListingPolls = { Value = 1 },
|
TimeBetweenListingPolls = { Value = 1 },
|
||||||
TimeBetweenSelectionPolls = { Value = 1 }
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -42,8 +42,6 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public MultiplayerRoomUser? Host { get; set; }
|
public MultiplayerRoomUser? Host { get; set; }
|
||||||
|
|
||||||
private object writeLock = new object();
|
|
||||||
|
|
||||||
[JsonConstructor]
|
[JsonConstructor]
|
||||||
public MultiplayerRoom(in long roomId)
|
public MultiplayerRoom(in long roomId)
|
||||||
{
|
{
|
||||||
|
@ -156,11 +156,11 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
private void onMultiplayer()
|
private void onMultiplayer()
|
||||||
{
|
{
|
||||||
if (!api.IsLoggedIn)
|
if (api.State.Value != APIState.Online)
|
||||||
{
|
{
|
||||||
notifications?.Post(new SimpleNotification
|
notifications?.Post(new SimpleNotification
|
||||||
{
|
{
|
||||||
Text = "You gotta be logged in to multi 'yo!",
|
Text = "You gotta be online to multi 'yo!",
|
||||||
Icon = FontAwesome.Solid.Globe,
|
Icon = FontAwesome.Solid.Globe,
|
||||||
Activated = () =>
|
Activated = () =>
|
||||||
{
|
{
|
||||||
@ -177,11 +177,11 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
private void onPlaylists()
|
private void onPlaylists()
|
||||||
{
|
{
|
||||||
if (!api.IsLoggedIn)
|
if (api.State.Value != APIState.Online)
|
||||||
{
|
{
|
||||||
notifications?.Post(new SimpleNotification
|
notifications?.Post(new SimpleNotification
|
||||||
{
|
{
|
||||||
Text = "You gotta be logged in to multi 'yo!",
|
Text = "You gotta be online to view playlists 'yo!",
|
||||||
Icon = FontAwesome.Solid.Globe,
|
Icon = FontAwesome.Solid.Globe,
|
||||||
Activated = () =>
|
Activated = () =>
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
if (!this.IsCurrentScreen())
|
if (!this.IsCurrentScreen())
|
||||||
{
|
{
|
||||||
multiplayerRoomManager.TimeBetweenListingPolls.Value = 0;
|
multiplayerRoomManager.TimeBetweenListingPolls.Value = 0;
|
||||||
multiplayerRoomManager.TimeBetweenSelectionPolls.Value = 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -41,18 +40,16 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
{
|
{
|
||||||
case LoungeSubScreen _:
|
case LoungeSubScreen _:
|
||||||
multiplayerRoomManager.TimeBetweenListingPolls.Value = isIdle ? 120000 : 15000;
|
multiplayerRoomManager.TimeBetweenListingPolls.Value = isIdle ? 120000 : 15000;
|
||||||
multiplayerRoomManager.TimeBetweenSelectionPolls.Value = isIdle ? 120000 : 15000;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Don't poll inside the match or anywhere else.
|
// Don't poll inside the match or anywhere else.
|
||||||
default:
|
default:
|
||||||
multiplayerRoomManager.TimeBetweenListingPolls.Value = 0;
|
multiplayerRoomManager.TimeBetweenListingPolls.Value = 0;
|
||||||
multiplayerRoomManager.TimeBetweenSelectionPolls.Value = 0;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Logger.Log($"Polling adjusted (listing: {multiplayerRoomManager.TimeBetweenListingPolls.Value}, selection: {multiplayerRoomManager.TimeBetweenSelectionPolls.Value})");
|
Logger.Log($"Polling adjusted (listing: {multiplayerRoomManager.TimeBetweenListingPolls.Value})");
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Room CreateNewRoom()
|
protected override Room CreateNewRoom()
|
||||||
|
@ -23,7 +23,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
private StatefulMultiplayerClient multiplayerClient { get; set; }
|
private StatefulMultiplayerClient multiplayerClient { get; set; }
|
||||||
|
|
||||||
public readonly Bindable<double> TimeBetweenListingPolls = new Bindable<double>();
|
public readonly Bindable<double> TimeBetweenListingPolls = new Bindable<double>();
|
||||||
public readonly Bindable<double> TimeBetweenSelectionPolls = new Bindable<double>();
|
|
||||||
private readonly IBindable<bool> isConnected = new Bindable<bool>();
|
private readonly IBindable<bool> isConnected = new Bindable<bool>();
|
||||||
private readonly Bindable<bool> allowPolling = new Bindable<bool>();
|
private readonly Bindable<bool> allowPolling = new Bindable<bool>();
|
||||||
|
|
||||||
@ -119,11 +119,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
TimeBetweenPolls = { BindTarget = TimeBetweenListingPolls },
|
TimeBetweenPolls = { BindTarget = TimeBetweenListingPolls },
|
||||||
AllowPolling = { BindTarget = allowPolling }
|
AllowPolling = { BindTarget = allowPolling }
|
||||||
},
|
},
|
||||||
new MultiplayerSelectionPollingComponent
|
|
||||||
{
|
|
||||||
TimeBetweenPolls = { BindTarget = TimeBetweenSelectionPolls },
|
|
||||||
AllowPolling = { BindTarget = allowPolling }
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
private class MultiplayerListingPollingComponent : ListingPollingComponent
|
private class MultiplayerListingPollingComponent : ListingPollingComponent
|
||||||
@ -146,26 +141,5 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
|
|
||||||
protected override Task Poll() => !AllowPolling.Value ? Task.CompletedTask : base.Poll();
|
protected override Task Poll() => !AllowPolling.Value ? Task.CompletedTask : base.Poll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MultiplayerSelectionPollingComponent : SelectionPollingComponent
|
|
||||||
{
|
|
||||||
public readonly IBindable<bool> AllowPolling = new Bindable<bool>();
|
|
||||||
|
|
||||||
protected override void LoadComplete()
|
|
||||||
{
|
|
||||||
base.LoadComplete();
|
|
||||||
|
|
||||||
AllowPolling.BindValueChanged(allowPolling =>
|
|
||||||
{
|
|
||||||
if (!allowPolling.NewValue)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (IsLoaded)
|
|
||||||
PollImmediately();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override Task Poll() => !AllowPolling.Value ? Task.CompletedTask : base.Poll();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Colour;
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Game.Beatmaps.Drawables;
|
using osu.Game.Beatmaps.Drawables;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
@ -165,7 +166,10 @@ namespace osu.Game.Screens.OnlinePlay
|
|||||||
private void onlineStateChanged(ValueChangedEvent<APIState> state) => Schedule(() =>
|
private void onlineStateChanged(ValueChangedEvent<APIState> state) => Schedule(() =>
|
||||||
{
|
{
|
||||||
if (state.NewValue != APIState.Online)
|
if (state.NewValue != APIState.Online)
|
||||||
|
{
|
||||||
|
Logger.Log("API connection was lost, can't continue with online play", LoggingTarget.Network, LogLevel.Important);
|
||||||
Schedule(forcefullyExit);
|
Schedule(forcefullyExit);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user