< Summary

Class:RenderProfileBridge
Assembly:RenderProfileBridge
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/RenderProfileBridge/RenderProfileBridge.cs
Covered lines:1
Uncovered lines:10
Coverable lines:11
Total lines:62
Line coverage:9% (1 of 11)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%110100%
SetRenderProfile(...)0%2100%
SetRenderProfile(...)0%6200%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/RenderProfileBridge/RenderProfileBridge.cs

#LineLine coverage
 1using System;
 2using System.Collections;
 3using System.Collections.Generic;
 4using DCL;
 5using UnityEngine;
 6
 7/// <summary>
 8/// This bridge is used for toggling the current RenderProfile from kernel
 9/// </summary>
 10public class RenderProfileBridge : MonoBehaviour
 11{
 12    public enum ID
 13    {
 14        DEFAULT,
 15        HALLOWEEN,
 16        XMAS,
 17        NIGHT
 18    }
 19
 20    [System.Serializable]
 21    public class Model
 22    {
 23        public ID id;
 24    }
 25
 026    public static RenderProfileBridge i { get; private set; }
 27
 24628    public void Awake() { i = this; }
 29
 30    /// <summary>
 31    /// Called from kernel. Toggles the current WorldRenderProfile used by explorer.
 32    /// </summary>
 33    /// <param name="json">Model in json format</param>
 34    public void SetRenderProfile(string json)
 35    {
 036        ID id = JsonUtility.FromJson<Model>(json).id;
 037        SetRenderProfile(id);
 038    }
 39
 40    /// <summary>
 41    /// Toggles the current WorldRenderProfile used by explorer.
 42    /// </summary>
 43    /// <param name="id">Which profile by id</param>
 44    public void SetRenderProfile(ID id)
 45    {
 46        RenderProfileWorld newProfile;
 47        switch (id)
 48        {
 49            default:
 050                newProfile = RenderProfileManifest.i.defaultProfile;
 051                break;
 52            case ID.HALLOWEEN:
 53            case ID.XMAS:
 54            case ID.NIGHT:
 055                newProfile = RenderProfileManifest.i.nightProfile;
 56                break;
 57        }
 58
 059        RenderProfileManifest.i.currentProfile = newProfile;
 060        RenderProfileManifest.i.currentProfile.Apply();
 061    }
 62}