mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 16:27:26 +08:00
Add models for users and rooms
This commit is contained in:
parent
f4ccbbd092
commit
8ebdb5723b
@ -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);
|
||||
}
|
||||
}
|
||||
|
21
osu.Game/Online/RealtimeMultiplayer/MultiplayerRoomUser.cs
Normal file
21
osu.Game/Online/RealtimeMultiplayer/MultiplayerRoomUser.cs
Normal 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; }
|
||||
}
|
||||
}
|
13
osu.Game/Online/RealtimeMultiplayer/MultiplayerUserState.cs
Normal file
13
osu.Game/Online/RealtimeMultiplayer/MultiplayerUserState.cs
Normal 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,
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user