Add models for users and rooms

This commit is contained in:
Dean Herbert 2020-12-07 18:50:02 +09:00
parent f4ccbbd092
commit 8ebdb5723b
3 changed files with 43 additions and 0 deletions

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
namespace osu.Game.Online.RealtimeMultiplayer
{
@ -11,5 +12,13 @@ namespace osu.Game.Online.RealtimeMultiplayer
public long RoomID { get; set; }
public MultiplayerRoomState State { get; set; }
public IReadOnlyList<MultiplayerRoomUser> Users => users;
private List<MultiplayerRoomUser> users = new List<MultiplayerRoomUser>();
public void Join(int user) => users.Add(new MultiplayerRoomUser(user));
public void Leave(int user) => users.RemoveAll(u => u.UserID == user);
}
}

View File

@ -0,0 +1,21 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using osu.Game.Users;
namespace osu.Game.Online.RealtimeMultiplayer
{
public class MultiplayerRoomUser
{
public MultiplayerRoomUser(in int userId)
{
UserID = userId;
}
public long UserID { get; set; }
public MultiplayerUserState State { get; set; }
public User User { get; set; }
}
}

View File

@ -0,0 +1,13 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
namespace osu.Game.Online.RealtimeMultiplayer
{
public enum MultiplayerUserState
{
Watching,
Ready,
Playing,
Results,
}
}