/
User.cs
46 lines (37 loc) · 1.08 KB
/
User.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
using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace ARWServer_UnityApi
{
public class User
{
public string name;
public int id;
public bool isMe;
public Room lastJoinedRoom;
private List<UserVariable> userVariables;
public User(){
}
public User (SpecialEventParam e){
this.name = e.GetString ("userName");
this.id = e.GetInt ("userId");
this.isMe = bool.Parse (e.GetString ("isMe"));
this.lastJoinedRoom = null;
this.userVariables = new List<UserVariable>();
string userVariables = e.GetString("userVariables");
string[] userVars = userVariables.Split('§');
foreach(string userVar in userVars){
string[] variableParts = userVar.Split('½');
if( variableParts.Length == 2){
this.userVariables.Add(new UserVariable(variableParts[0], variableParts[1]));
}
}
UserManager.allUserInGame.Add (this);
}
public UserVariable GetUserVariables(string key){
UserVariable currentVariable = this.userVariables.Where(a=>a.key == key).FirstOrDefault();
return currentVariable;
}
}
}