-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathPublicRoom.cs
56 lines (41 loc) · 1.6 KB
/
PublicRoom.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
using System;
using System.Collections.Generic;
namespace WSNet2
{
/// <summary>
/// 検索結果で得られる公開部屋情報
/// </summary>
public class PublicRoom
{
/// <summary>RoomID</summary>
public string Id => info.id;
/// <summary>検索可能</summary>
public bool Visible => info.visible;
/// <summary>入室可能</summary>
public bool Joinable => info.joinable;
/// <summary>観戦可能</summary>
public bool Watchable => info.watchable;
/// <summary>部屋番号</summary>
public int Number => info.number;
/// <summary>検索グループ</summary>
public uint SearchGroup => info.searchGroup;
/// <summary>最大人数</summary>
public uint MaxPlayers => info.maxPlayers;
/// <summary>プレイヤー人数</summary>
public uint PlayerCount => info.players;
/// <summary>観戦人数</summary>
public uint WatcherCount => info.watchers;
/// <summary>ルームの公開プロパティ</summary>
public IReadOnlyDictionary<string, object> PublicProps => publicProps;
public DateTime Created { get; private set; }
protected RoomInfo info;
protected Dictionary<string, object> publicProps;
public PublicRoom(RoomInfo roomInfo)
{
info = roomInfo;
var reader = WSNet2Serializer.NewReader(roomInfo.publicProps);
publicProps = reader.ReadDict();
Created = DateTimeOffset.FromUnixTimeSeconds(roomInfo.created).DateTime;
}
}
}