-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathParticipantInformation.cs
52 lines (45 loc) · 1.2 KB
/
ParticipantInformation.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
// Author: Fabrizio Spadaro
// License Copyright 2018 (c)Fabrizio Spadaro
// https://twitter.com/F_adaro
// https://github.com/fabriziospadaro
using System.Collections;
using UnityEngine;
public class ParticipantInformation{
public string Username;
public string ParticipantID;
public Texture2D Avatar;
public bool IsLocal;
public ParticipantInformation(string user, bool local){
Username = user;
IsLocal = local;
Avatar = null;
}
public void MarkAsLocal(){
IsLocal = true;
}
public void MarkAsRemote(){
IsLocal = false;
}
public void SetID(string id){
ParticipantID = id;
}
public void RequestAvatar(){
if (!Avatar){
while (!Social.localUser.image){
Debug.Log("Loading User Image..");
//wait a bit
}
Avatar = Social.localUser.image;
Debug.Log("User image Loaded");
}
}
public Sprite GetAvatarSprite(){
return Sprite.Create(Avatar, new Rect(0, 0, Avatar.width, Avatar.height), Vector2.one / 2f);
}
public void Reset(){
Username = "";
IsLocal = false;
Avatar = null;
ParticipantID = "";
}
}