mirror of
https://github.com/osukey/osukey.git
synced 2025-05-31 10:27:26 +09:00
Add handling for GetRoomRequest()
This commit is contained in:
parent
c6da680c80
commit
2fc5561b7e
@ -7,13 +7,13 @@ namespace osu.Game.Online.Multiplayer
|
|||||||
{
|
{
|
||||||
public class GetRoomRequest : APIRequest<Room>
|
public class GetRoomRequest : APIRequest<Room>
|
||||||
{
|
{
|
||||||
private readonly int roomId;
|
public readonly int RoomId;
|
||||||
|
|
||||||
public GetRoomRequest(int roomId)
|
public GetRoomRequest(int roomId)
|
||||||
{
|
{
|
||||||
this.roomId = roomId;
|
RoomId = roomId;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override string Target => $"rooms/{roomId}";
|
protected override string Target => $"rooms/{RoomId}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
@ -52,7 +53,23 @@ namespace osu.Game.Tests.Visual.RealtimeMultiplayer
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case GetRoomsRequest getRoomsRequest:
|
case GetRoomsRequest getRoomsRequest:
|
||||||
getRoomsRequest.TriggerSuccess(rooms);
|
var roomsWithoutParticipants = new List<Room>();
|
||||||
|
|
||||||
|
foreach (var r in rooms)
|
||||||
|
{
|
||||||
|
var newRoom = new Room();
|
||||||
|
|
||||||
|
newRoom.CopyFrom(r);
|
||||||
|
newRoom.RecentParticipants.Clear();
|
||||||
|
|
||||||
|
roomsWithoutParticipants.Add(newRoom);
|
||||||
|
}
|
||||||
|
|
||||||
|
getRoomsRequest.TriggerSuccess(roomsWithoutParticipants);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GetRoomRequest getRoomRequest:
|
||||||
|
getRoomRequest.TriggerSuccess(rooms.Single(r => r.RoomID.Value == getRoomRequest.RoomId));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GetBeatmapSetRequest getBeatmapSetRequest:
|
case GetBeatmapSetRequest getBeatmapSetRequest:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user