| | 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; |
| 1720 | 15 | | public List<string> wearables = new List<string>(); |
| | 16 | | public string expressionTriggerId = null; |
| 1720 | 17 | | public long expressionTriggerTimestamp = -1; |
| | 18 | | public string stickerTriggerId = null; |
| 1720 | 19 | | public long stickerTriggerTimestamp = -1; |
| | 20 | | public bool talking = false; |
| | 21 | |
|
| | 22 | | public bool HaveSameWearablesAndColors(AvatarModel other) |
| | 23 | | { |
| 31 | 24 | | bool wearablesAreEqual = wearables.All(other.wearables.Contains) && wearables.Count == other.wearables.Count; |
| | 25 | |
|
| 31 | 26 | | return bodyShape == other.bodyShape && |
| | 27 | | skinColor == other.skinColor && |
| | 28 | | hairColor == other.hairColor && |
| | 29 | | eyeColor == other.eyeColor && |
| | 30 | | wearablesAreEqual; |
| | 31 | | } |
| | 32 | |
|
| | 33 | | public bool HaveSameExpressions(AvatarModel other) |
| | 34 | | { |
| 31 | 35 | | return expressionTriggerId == other.expressionTriggerId && |
| | 36 | | expressionTriggerTimestamp == other.expressionTriggerTimestamp && |
| | 37 | | stickerTriggerTimestamp == other.stickerTriggerTimestamp; |
| | 38 | | } |
| | 39 | |
|
| | 40 | |
|
| | 41 | | public bool Equals(AvatarModel other) |
| | 42 | | { |
| 90 | 43 | | bool wearablesAreEqual = wearables.All(other.wearables.Contains) && wearables.Count == other.wearables.Count; |
| | 44 | |
|
| 90 | 45 | | return id == other.id && |
| | 46 | | name == other.name && |
| | 47 | | bodyShape == other.bodyShape && |
| | 48 | | skinColor == other.skinColor && |
| | 49 | | hairColor == other.hairColor && |
| | 50 | | eyeColor == other.eyeColor && |
| | 51 | | expressionTriggerId == other.expressionTriggerId && |
| | 52 | | expressionTriggerTimestamp == other.expressionTriggerTimestamp && |
| | 53 | | stickerTriggerTimestamp == other.stickerTriggerTimestamp && |
| | 54 | | wearablesAreEqual; |
| | 55 | | } |
| | 56 | |
|
| | 57 | | public void CopyFrom(AvatarModel other) |
| | 58 | | { |
| 257 | 59 | | if (other == null) |
| 103 | 60 | | return; |
| | 61 | |
|
| 154 | 62 | | id = other.id; |
| 154 | 63 | | name = other.name; |
| 154 | 64 | | bodyShape = other.bodyShape; |
| 154 | 65 | | skinColor = other.skinColor; |
| 154 | 66 | | hairColor = other.hairColor; |
| 154 | 67 | | eyeColor = other.eyeColor; |
| 154 | 68 | | expressionTriggerId = other.expressionTriggerId; |
| 154 | 69 | | expressionTriggerTimestamp = other.expressionTriggerTimestamp; |
| 154 | 70 | | stickerTriggerId = other.stickerTriggerId; |
| 154 | 71 | | stickerTriggerTimestamp = other.stickerTriggerTimestamp; |
| 154 | 72 | | wearables = new List<string>(other.wearables); |
| 154 | 73 | | } |
| | 74 | |
|
| 2 | 75 | | public override BaseModel GetDataFromJSON(string json) { return Utils.SafeFromJson<AvatarModel>(json); } |
| | 76 | | } |