mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 03:22:55 +08: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>
|
||||
{
|
||||
private readonly int roomId;
|
||||
public readonly 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.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests;
|
||||
@ -52,7 +53,23 @@ namespace osu.Game.Tests.Visual.RealtimeMultiplayer
|
||||
break;
|
||||
|
||||
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;
|
||||
|
||||
case GetBeatmapSetRequest getBeatmapSetRequest:
|
||||
|
Loading…
Reference in New Issue
Block a user