| | 1 | | using DCL.Helpers; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using System.Linq; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | [System.Serializable] |
| | 7 | | public class AvatarModel : BaseModel |
| | 8 | | { |
| | 9 | | public string id; |
| | 10 | | public string name; |
| | 11 | | public string bodyShape; |
| | 12 | | public Color skinColor; |
| | 13 | | public Color hairColor; |
| | 14 | | public Color eyeColor; |
| 2380 | 15 | | public List<string> wearables = new List<string>(); |
| | 16 | | public string expressionTriggerId = null; |
| 2380 | 17 | | public long expressionTriggerTimestamp = -1; |
| | 18 | | public string stickerTriggerId = null; |
| 2380 | 19 | | public long stickerTriggerTimestamp = -1; |
| | 20 | | public bool talking = false; |
| | 21 | |
|
| | 22 | | public bool HaveSameWearablesAndColors(AvatarModel other) |
| | 23 | | { |
| 123 | 24 | | if (other == null) |
| 0 | 25 | | return false; |
| | 26 | |
|
| 123 | 27 | | bool wearablesAreEqual = wearables.All(other.wearables.Contains) && wearables.Count == other.wearables.Count; |
| | 28 | |
|
| 123 | 29 | | return bodyShape == other.bodyShape && |
| | 30 | | skinColor == other.skinColor && |
| | 31 | | hairColor == other.hairColor && |
| | 32 | | eyeColor == other.eyeColor && |
| | 33 | | wearablesAreEqual; |
| | 34 | | } |
| | 35 | |
|
| | 36 | | public bool HaveSameExpressions(AvatarModel other) |
| | 37 | | { |
| 0 | 38 | | return expressionTriggerId == other.expressionTriggerId && |
| | 39 | | expressionTriggerTimestamp == other.expressionTriggerTimestamp && |
| | 40 | | stickerTriggerTimestamp == other.stickerTriggerTimestamp; |
| | 41 | | } |
| | 42 | |
|
| | 43 | | public bool Equals(AvatarModel other) |
| | 44 | | { |
| 0 | 45 | | bool wearablesAreEqual = wearables.All(other.wearables.Contains) && wearables.Count == other.wearables.Count; |
| | 46 | |
|
| 0 | 47 | | return id == other.id && |
| | 48 | | name == other.name && |
| | 49 | | bodyShape == other.bodyShape && |
| | 50 | | skinColor == other.skinColor && |
| | 51 | | hairColor == other.hairColor && |
| | 52 | | eyeColor == other.eyeColor && |
| | 53 | | expressionTriggerId == other.expressionTriggerId && |
| | 54 | | expressionTriggerTimestamp == other.expressionTriggerTimestamp && |
| | 55 | | stickerTriggerTimestamp == other.stickerTriggerTimestamp && |
| | 56 | | wearablesAreEqual; |
| | 57 | | } |
| | 58 | |
|
| | 59 | | public void CopyFrom(AvatarModel other) |
| | 60 | | { |
| 311 | 61 | | if (other == null) |
| 156 | 62 | | return; |
| | 63 | |
|
| 155 | 64 | | id = other.id; |
| 155 | 65 | | name = other.name; |
| 155 | 66 | | bodyShape = other.bodyShape; |
| 155 | 67 | | skinColor = other.skinColor; |
| 155 | 68 | | hairColor = other.hairColor; |
| 155 | 69 | | eyeColor = other.eyeColor; |
| 155 | 70 | | expressionTriggerId = other.expressionTriggerId; |
| 155 | 71 | | expressionTriggerTimestamp = other.expressionTriggerTimestamp; |
| 155 | 72 | | stickerTriggerId = other.stickerTriggerId; |
| 155 | 73 | | stickerTriggerTimestamp = other.stickerTriggerTimestamp; |
| 155 | 74 | | wearables = new List<string>(other.wearables); |
| 155 | 75 | | } |
| | 76 | |
|
| 2 | 77 | | public override BaseModel GetDataFromJSON(string json) { return Utils.SafeFromJson<AvatarModel>(json); } |
| | 78 | | } |