1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-20 07:32:55 +08:00
osu-lazer/osu.Game/Screens/OnlinePlay/Playlists/Playlists.cs

63 lines
2.4 KiB
C#
Raw Normal View History

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;
using osu.Game.Graphics.UserInterface;
2020-12-25 12:38:11 +08:00
using osu.Game.Online.Rooms;
using osu.Game.Screens.OnlinePlay.Components;
using osu.Game.Screens.OnlinePlay.Lounge;
using osu.Game.Screens.OnlinePlay.Match;
2020-12-18 23:15:41 +08:00
namespace osu.Game.Screens.OnlinePlay.Playlists
2020-12-18 23:15:41 +08:00
{
public class Playlists : OnlinePlayScreen
2020-12-18 23:15:41 +08:00
{
protected override void UpdatePollingRate(bool isIdle)
{
2020-12-25 12:11:21 +08:00
var playlistsManager = (PlaylistsRoomManager)RoomManager;
2020-12-18 23:15:41 +08:00
if (!this.IsCurrentScreen())
{
2020-12-25 12:11:21 +08:00
playlistsManager.TimeBetweenListingPolls.Value = 0;
playlistsManager.TimeBetweenSelectionPolls.Value = 0;
2020-12-18 23:15:41 +08:00
}
else
{
switch (CurrentSubScreen)
{
case LoungeSubScreen _:
2020-12-25 12:11:21 +08:00
playlistsManager.TimeBetweenListingPolls.Value = isIdle ? 120000 : 15000;
playlistsManager.TimeBetweenSelectionPolls.Value = isIdle ? 120000 : 15000;
2020-12-18 23:15:41 +08:00
break;
case RoomSubScreen _:
2020-12-25 12:11:21 +08:00
playlistsManager.TimeBetweenListingPolls.Value = 0;
playlistsManager.TimeBetweenSelectionPolls.Value = isIdle ? 30000 : 5000;
2020-12-18 23:15:41 +08:00
break;
default:
2020-12-25 12:11:21 +08:00
playlistsManager.TimeBetweenListingPolls.Value = 0;
playlistsManager.TimeBetweenSelectionPolls.Value = 0;
2020-12-18 23:15:41 +08:00
break;
}
}
2020-12-25 12:11:21 +08:00
Logger.Log($"Polling adjusted (listing: {playlistsManager.TimeBetweenListingPolls.Value}, selection: {playlistsManager.TimeBetweenSelectionPolls.Value})");
2020-12-18 23:15:41 +08:00
}
protected override Room CreateNewRoom()
{
return new Room { Name = { Value = $"{API.LocalUser}'s awesome playlist" } };
}
protected override string ScreenTitle => "Playlists";
2020-12-25 12:11:21 +08:00
protected override RoomManager CreateRoomManager() => new PlaylistsRoomManager();
2020-12-20 22:36:56 +08:00
2020-12-25 12:11:21 +08:00
protected override LoungeSubScreen CreateLounge() => new PlaylistsLoungeSubScreen();
2020-12-25 12:11:21 +08:00
protected override OsuButton CreateNewMultiplayerGameButton() => new CreatePlaylistsRoomButton();
2020-12-18 23:15:41 +08:00
}
}