| | 1 | | using Decentraland.Common; |
| | 2 | | using System; |
| | 3 | | using Google.Protobuf.Collections; |
| | 4 | |
|
| | 5 | | namespace DCL.ECSComponents |
| | 6 | | { |
| | 7 | | public static class PBAvatarShape_Defaults |
| | 8 | | { |
| | 9 | | private const string avatarDefaultBodyShape = "urn:decentraland:off-chain:base-avatars:BaseFemale"; |
| | 10 | |
|
| 0 | 11 | | private static readonly Color3 neutralColor = new Color3() |
| | 12 | | { |
| | 13 | | R = 0.6f, G = 0.462f, B = 0.356f |
| | 14 | | }; |
| | 15 | |
|
| 0 | 16 | | private static readonly Color3 hairDefaultColor = new Color3() |
| | 17 | | { |
| | 18 | | R = 0.283f, G = 0.142f, B = 0f |
| | 19 | | }; |
| | 20 | |
|
| 0 | 21 | | private static readonly RepeatedField<string> defaultWearables = new RepeatedField<string>() |
| | 22 | | { |
| | 23 | | "urn:decentraland:off-chain:base-avatars:f_eyes_00", |
| | 24 | | "urn:decentraland:off-chain:base-avatars:f_eyebrows_00", |
| | 25 | | "urn:decentraland:off-chain:base-avatars:f_mouth_00", |
| | 26 | | "urn:decentraland:off-chain:base-avatars:standard_hair", |
| | 27 | | "urn:decentraland:off-chain:base-avatars:f_simple_yellow_tshirt", |
| | 28 | | "urn:decentraland:off-chain:base-avatars:f_brown_trousers", |
| | 29 | | "urn:decentraland:off-chain:base-avatars:bun_shoes" |
| | 30 | | }; |
| | 31 | |
|
| | 32 | | public static long GetExpressionTriggerTimestamp(this PBAvatarShape self) |
| | 33 | | { |
| 0 | 34 | | return self.HasExpressionTriggerTimestamp ? self.ExpressionTriggerTimestamp : DateTime.Now.ToFileTimeUtc(); |
| | 35 | | } |
| | 36 | |
|
| | 37 | | public static string GetBodyShape(this PBAvatarShape self) |
| | 38 | | { |
| 0 | 39 | | return self.HasBodyShape ? self.BodyShape : avatarDefaultBodyShape; |
| | 40 | | } |
| | 41 | |
|
| | 42 | | public static Color3 GetEyeColor(this PBAvatarShape self) |
| | 43 | | { |
| 0 | 44 | | return self.EyeColor ?? new Color3(neutralColor); |
| | 45 | | } |
| | 46 | |
|
| | 47 | | public static Color3 GetHairColor(this PBAvatarShape self) |
| | 48 | | { |
| 0 | 49 | | return self.HairColor ?? new Color3(hairDefaultColor); |
| | 50 | | } |
| | 51 | |
|
| | 52 | | public static Color3 GetSkinColor(this PBAvatarShape self) |
| | 53 | | { |
| 0 | 54 | | return self.SkinColor ?? new Color3(neutralColor); |
| | 55 | | } |
| | 56 | |
|
| | 57 | | public static string GetName(this PBAvatarShape self) |
| | 58 | | { |
| 0 | 59 | | return self.HasName ? self.Name : "NPC"; |
| | 60 | | } |
| | 61 | |
|
| | 62 | | public static RepeatedField<string> GetWereables(this PBAvatarShape self) |
| | 63 | | { |
| 0 | 64 | | return self.Wearables.Count != 0 ? self.Wearables : defaultWearables; |
| | 65 | | } |
| | 66 | | } |
| | 67 | | } |