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