< Summary

Class:DCL.Components.AvatarAttachComponent
Assembly:AvatarAttach
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/AvatarAttach/AvatarAttachComponent.cs
Covered lines:0
Uncovered lines:18
Coverable lines:18
Total lines:63
Line coverage:0% (0 of 18)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetDataFromJSON(...)0%2100%
get_scene()0%2100%
get_entity()0%2100%
get_componentName()0%2100%
AvatarAttachComponent()0%2100%
Initialize(...)0%2100%
IsValid()0%2100%
GetModel()0%2100%
GetClassId()0%2100%
UpdateFromJSON(...)0%2100%
UpdateFromModel(...)0%2100%
DCL-Components-IComponent-ApplyChanges()0%6200%
RaiseOnAppliedChanges()0%2100%
GetTransform()0%6200%
Cleanup()0%2100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Components/AvatarAttach/AvatarAttachComponent.cs

#LineLine coverage
 1using System;
 2using System.Collections;
 3using DCL.Controllers;
 4using DCL.Helpers;
 5using DCL.Models;
 6using UnityEngine;
 7
 8namespace DCL.Components
 9{
 10    public class AvatarAttachComponent : IEntityComponent
 11    {
 12        [Serializable]
 13        public class Model : BaseModel
 14        {
 15            public string avatarId = null;
 16            public int anchorPointId = 0;
 17
 18            public override BaseModel GetDataFromJSON(string json)
 19            {
 020                return Utils.SafeFromJson<Model>(json);
 21            }
 22        }
 23
 024        IParcelScene IComponent.scene => handler.scene;
 025        IDCLEntity IEntityComponent.entity => handler.entity;
 26
 027        string IComponent.componentName => "AvatarAttach";
 28
 029        private readonly AvatarAttachHandler handler = new AvatarAttachHandler();
 30
 31        void IEntityComponent.Initialize(IParcelScene scene, IDCLEntity entity)
 32        {
 033            handler.Initialize(scene, entity, Environment.i.platform.updateEventHandler);
 034        }
 35
 036        bool IComponent.IsValid() => true;
 37
 038        BaseModel IComponent.GetModel() => handler.model;
 39
 040        int IComponent.GetClassId() => (int)CLASS_ID_COMPONENT.AVATAR_ATTACH;
 41
 42        void IComponent.UpdateFromJSON(string json)
 43        {
 044            handler.OnModelUpdated(json);
 045        }
 46
 47        void IComponent.UpdateFromModel(BaseModel newModel)
 48        {
 049            handler.OnModelUpdated(newModel as Model);
 050        }
 51
 52        IEnumerator IComponent.ApplyChanges(BaseModel newModel)
 53        {
 054            yield break;
 55        }
 56
 057        void IComponent.RaiseOnAppliedChanges() { }
 58
 059        Transform IMonoBehaviour.GetTransform() => handler.entity?.gameObject.transform;
 60
 061        void ICleanable.Cleanup() => handler.Dispose();
 62    }
 63}