Implement RoomManager and RoomsContainer

Reduces logic from LoungeScreen
This commit is contained in:
smoogipoo
2018-12-11 19:07:40 +09:00
parent 1ac615b490
commit 497f431366
10 changed files with 229 additions and 189 deletions

View File

@ -0,0 +1,32 @@
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Configuration;
using osu.Framework.Graphics;
using osu.Game.Online.API;
using osu.Game.Online.Multiplayer;
namespace osu.Game.Screens.Multi
{
public class RoomManager : Component
{
public IBindableCollection<Room> Rooms => rooms;
private readonly BindableCollection<Room> rooms = new BindableCollection<Room>();
public readonly Bindable<Room> Current = new Bindable<Room>();
[Resolved]
private APIAccess api { get; set; }
public void CreateRoom(Room room)
{
room.Host.Value = api.LocalUser;
// Todo: Perform API request
room.Created.Value = true;
rooms.Add(room);
}
}
}