mirror of
https://github.com/osukey/osukey.git
synced 2025-07-03 01:09:57 +09:00
Implement RoomManager and RoomsContainer
Reduces logic from LoungeScreen
This commit is contained in:
32
osu.Game/Screens/Multi/RoomManager.cs
Normal file
32
osu.Game/Screens/Multi/RoomManager.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user