-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathPlayer.cs
41 lines (37 loc) · 1010 Bytes
/
Player.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
using System;
using System.Collections.Generic;
namespace WSNet2
{
/// <summary>
/// Room内にいるPlayer
/// </summary>
public class Player
{
/// <summary>ID</summary>
public string Id { get; private set; }
/// <summary>カスタムプロパティ</summary>
/// <remarks>
/// <para>
/// 値はシリアライズ可能なものに限る
/// </para>
/// </remarks>
public Dictionary<string, object> Props;
/// <summary>
/// コンストラクタ
/// </summary>
public Player(ClientInfo info)
{
Id = info.Id;
var reader = WSNet2Serializer.NewReader(info.Props);
Props = reader.ReadDict();
}
/// <summary>
/// コンストラクタ
/// </summary>
public Player(string id, Dictionary<string, object> props)
{
Id = id;
Props = props;
}
}
}