< 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:66
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 System;
 2using Google.Protobuf.Collections;
 3
 4namespace DCL.ECSComponents
 5{
 6    public static class PBAvatarShape_Defaults
 7    {
 8        private const string avatarDefaultBodyShape = "urn:decentraland:off-chain:base-avatars:BaseFemale";
 9
 110        private static readonly Color3 neutralColor = new Color3()
 11        {
 12            R = 0.6f, G = 0.462f, B = 0.356f
 13        };
 14
 115        private static readonly Color3 hairDefaultColor = new Color3()
 16        {
 17            R = 0.283f, G = 0.142f, B = 0f
 18        };
 19
 120        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        {
 433            return self.HasExpressionTriggerTimestamp ? self.ExpressionTriggerTimestamp : DateTime.Now.ToFileTimeUtc();
 34        }
 35
 36        public static string GetBodyShape(this PBAvatarShape self)
 37        {
 1638            return self.HasBodyShape ? self.BodyShape : avatarDefaultBodyShape;
 39        }
 40
 41        public static Color3 GetEyeColor(this PBAvatarShape self)
 42        {
 443            return self.EyeColor ?? new Color3(neutralColor);
 44        }
 45
 46        public static Color3 GetHairColor(this PBAvatarShape self)
 47        {
 448            return self.HairColor ?? new Color3(hairDefaultColor);
 49        }
 50
 51        public static Color3 GetSkinColor(this PBAvatarShape self)
 52        {
 1253            return self.SkinColor ?? new Color3(neutralColor);
 54        }
 55
 56        public static string GetName(this PBAvatarShape self)
 57        {
 2858            return self.HasName ? self.Name : "NPC";
 59        }
 60
 61        public static RepeatedField<string> GetWereables(this PBAvatarShape self)
 62        {
 1263            return self.Wearables.Count != 0 ? self.Wearables : defaultWearables;
 64        }
 65    }
 66}