< Summary

Class:DCL.ECSComponents.PBAvatarShape_Defaults
Assembly:DCL.ECSComponents.Defaults
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/Defaults/PBAvatarShape_Defaults.cs
Covered lines:10
Uncovered lines:0
Coverable lines:10
Total lines:67
Line coverage:100% (10 of 10)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
PBAvatarShape_Defaults()0%110100%
GetExpressionTriggerTimestamp(...)0%220100%
GetBodyShape(...)0%220100%
GetEyeColor(...)0%220100%
GetHairColor(...)0%220100%
GetSkinColor(...)0%220100%
GetName(...)0%220100%
GetWereables(...)0%220100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/DCLPlugins/ECS7/ECSComponents/Defaults/PBAvatarShape_Defaults.cs

#LineLine coverage
 1using Decentraland.Common;
 2using System;
 3using Google.Protobuf.Collections;
 4
 5namespace DCL.ECSComponents
 6{
 7    public static class PBAvatarShape_Defaults
 8    {
 9        private const string avatarDefaultBodyShape = "urn:decentraland:off-chain:base-avatars:BaseFemale";
 10
 111        private static readonly Color3 neutralColor = new Color3()
 12        {
 13            R = 0.6f, G = 0.462f, B = 0.356f
 14        };
 15
 116        private static readonly Color3 hairDefaultColor = new Color3()
 17        {
 18            R = 0.283f, G = 0.142f, B = 0f
 19        };
 20
 121        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        {
 434            return self.HasExpressionTriggerTimestamp ? self.ExpressionTriggerTimestamp : DateTime.Now.ToFileTimeUtc();
 35        }
 36
 37        public static string GetBodyShape(this PBAvatarShape self)
 38        {
 1639            return self.HasBodyShape ? self.BodyShape : avatarDefaultBodyShape;
 40        }
 41
 42        public static Color3 GetEyeColor(this PBAvatarShape self)
 43        {
 444            return self.EyeColor ?? new Color3(neutralColor);
 45        }
 46
 47        public static Color3 GetHairColor(this PBAvatarShape self)
 48        {
 449            return self.HairColor ?? new Color3(hairDefaultColor);
 50        }
 51
 52        public static Color3 GetSkinColor(this PBAvatarShape self)
 53        {
 1254            return self.SkinColor ?? new Color3(neutralColor);
 55        }
 56
 57        public static string GetName(this PBAvatarShape self)
 58        {
 3259            return self.HasName ? self.Name : "NPC";
 60        }
 61
 62        public static RepeatedField<string> GetWereables(this PBAvatarShape self)
 63        {
 1264            return self.Wearables.Count != 0 ? self.Wearables : defaultWearables;
 65        }
 66    }
 67}