| | 1 | | using System; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using System.Linq; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | [Serializable] |
| | 7 | | public class AvatarModelDTO |
| | 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; |
| 0 | 15 | | public List<string> wearables = new List<string>(); |
| 0 | 16 | | public List<string> forceRender = new List<string>(); |
| | 17 | |
|
| 0 | 18 | | public List<AvatarModel.AvatarEmoteEntry> emotes = new List<AvatarModel.AvatarEmoteEntry>(); |
| | 19 | |
|
| | 20 | | public string expressionTriggerId = null; |
| 0 | 21 | | public long expressionTriggerTimestamp = -1; |
| | 22 | | public bool talking = false; |
| | 23 | |
|
| | 24 | | public AvatarModel ToAvatarModel() |
| | 25 | | { |
| 0 | 26 | | AvatarModel avatarModel = new AvatarModel |
| | 27 | | { |
| | 28 | | id = this.id, |
| | 29 | | name = this.name, |
| | 30 | | bodyShape = this.bodyShape, |
| | 31 | | skinColor = this.skinColor, |
| | 32 | | hairColor = this.hairColor, |
| | 33 | | eyeColor = this.eyeColor, |
| | 34 | | wearables = this.wearables, |
| | 35 | | forceRender = new HashSet<string>(this.forceRender), |
| | 36 | | emotes = this.emotes, |
| | 37 | | expressionTriggerId = this.expressionTriggerId, |
| | 38 | | expressionTriggerTimestamp = this.expressionTriggerTimestamp, |
| | 39 | | talking = this.talking, |
| | 40 | | }; |
| | 41 | |
|
| 0 | 42 | | return avatarModel; |
| | 43 | | } |
| | 44 | |
|
| | 45 | | public static AvatarModelDTO FromAvatarModel(AvatarModel model) |
| | 46 | | { |
| 0 | 47 | | AvatarModelDTO avatarModelDto = new AvatarModelDTO |
| | 48 | | { |
| | 49 | | id = model.id, |
| | 50 | | name = model.name, |
| | 51 | | bodyShape = model.bodyShape, |
| | 52 | | skinColor = model.skinColor, |
| | 53 | | hairColor = model.hairColor, |
| | 54 | | eyeColor = model.eyeColor, |
| | 55 | | wearables = model.wearables, |
| | 56 | | forceRender = model.forceRender.ToList(), |
| | 57 | | emotes = model.emotes, |
| | 58 | | expressionTriggerId = model.expressionTriggerId, |
| | 59 | | expressionTriggerTimestamp = model.expressionTriggerTimestamp, |
| | 60 | | talking = model.talking, |
| | 61 | | }; |
| | 62 | |
|
| 0 | 63 | | return avatarModelDto; |
| | 64 | | } |
| | 65 | | } |