mirror of
https://github.com/osukey/osukey.git
synced 2025-05-09 07:37:22 +09:00
Pass room into SelectionPollingComponent
This commit is contained in:
parent
c31af96f1d
commit
3a1154c00e
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay.Components
|
namespace osu.Game.Screens.OnlinePlay.Components
|
||||||
@ -13,20 +12,14 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public class SelectionPollingComponent : RoomPollingComponent
|
public class SelectionPollingComponent : RoomPollingComponent
|
||||||
{
|
{
|
||||||
[Resolved]
|
|
||||||
private Bindable<Room> selectedRoom { get; set; }
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private IRoomManager roomManager { get; set; }
|
private IRoomManager roomManager { get; set; }
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
private readonly Room room;
|
||||||
private void load()
|
|
||||||
|
public SelectionPollingComponent(Room room)
|
||||||
{
|
{
|
||||||
selectedRoom.BindValueChanged(_ =>
|
this.room = room;
|
||||||
{
|
|
||||||
if (IsLoaded)
|
|
||||||
PollImmediately();
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private GetRoomRequest pollReq;
|
private GetRoomRequest pollReq;
|
||||||
@ -36,13 +29,13 @@ namespace osu.Game.Screens.OnlinePlay.Components
|
|||||||
if (!API.IsLoggedIn)
|
if (!API.IsLoggedIn)
|
||||||
return base.Poll();
|
return base.Poll();
|
||||||
|
|
||||||
if (selectedRoom.Value?.RoomID.Value == null)
|
if (room.RoomID.Value == null)
|
||||||
return base.Poll();
|
return base.Poll();
|
||||||
|
|
||||||
var tcs = new TaskCompletionSource<bool>();
|
var tcs = new TaskCompletionSource<bool>();
|
||||||
|
|
||||||
pollReq?.Cancel();
|
pollReq?.Cancel();
|
||||||
pollReq = new GetRoomRequest(selectedRoom.Value.RoomID.Value.Value);
|
pollReq = new GetRoomRequest(room.RoomID.Value.Value);
|
||||||
|
|
||||||
pollReq.Success += result =>
|
pollReq.Success += result =>
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user