2020-12-18 23:15:41 +08:00
|
|
|
// 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.Logging;
|
|
|
|
using osu.Framework.Screens;
|
2020-12-20 16:42:23 +08:00
|
|
|
using osu.Game.Screens.Multi.Components;
|
2020-12-18 23:15:41 +08:00
|
|
|
using osu.Game.Screens.Multi.Lounge;
|
|
|
|
using osu.Game.Screens.Multi.Match;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Multi.Timeshift
|
|
|
|
{
|
|
|
|
public class TimeshiftMultiplayer : Multiplayer
|
|
|
|
{
|
|
|
|
protected override void UpdatePollingRate(bool isIdle)
|
|
|
|
{
|
|
|
|
var timeshiftManager = (TimeshiftRoomManager)RoomManager;
|
|
|
|
|
|
|
|
if (!this.IsCurrentScreen())
|
|
|
|
{
|
|
|
|
timeshiftManager.TimeBetweenListingPolls.Value = 0;
|
|
|
|
timeshiftManager.TimeBetweenSelectionPolls.Value = 0;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch (CurrentSubScreen)
|
|
|
|
{
|
|
|
|
case LoungeSubScreen _:
|
|
|
|
timeshiftManager.TimeBetweenListingPolls.Value = isIdle ? 120000 : 15000;
|
|
|
|
timeshiftManager.TimeBetweenSelectionPolls.Value = isIdle ? 120000 : 15000;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MatchSubScreen _:
|
|
|
|
timeshiftManager.TimeBetweenListingPolls.Value = 0;
|
|
|
|
timeshiftManager.TimeBetweenSelectionPolls.Value = isIdle ? 30000 : 5000;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
timeshiftManager.TimeBetweenListingPolls.Value = 0;
|
|
|
|
timeshiftManager.TimeBetweenSelectionPolls.Value = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Logger.Log($"Polling adjusted (listing: {timeshiftManager.TimeBetweenListingPolls.Value}, selection: {timeshiftManager.TimeBetweenSelectionPolls.Value})");
|
|
|
|
}
|
|
|
|
|
2020-12-20 16:42:23 +08:00
|
|
|
protected override RoomManager CreateRoomManager() => new TimeshiftRoomManager();
|
2020-12-18 23:15:41 +08:00
|
|
|
}
|
|
|
|
}
|