< Summary

Class:HUDBridge
Assembly:HUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/HUDBridge.cs
Covered lines:0
Uncovered lines:36
Coverable lines:36
Total lines:99
Line coverage:0% (0 of 36)
Covered branches:0
Total branches:0
Covered methods:0
Total methods:13
Method coverage:0% (0 of 13)

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
Awake()0%2100%
OnDestroy()0%2100%
ConfigureHUDElement(...)0%2100%
TriggerSelfUserExpression(...)0%2100%
ShowTermsOfServices(...)0%6200%
SetPlayerTalking(...)0%6200%
SetVoiceChatEnabledByScene(...)0%6200%
SetUserTalking(...)0%6200%
SetUsersMuted(...)0%6200%
RequestTeleport(...)0%2100%
UpdateBalanceOfMANA(...)0%6200%
ShowAvatarEditorInSignUp()0%2100%
SetSignupFlow()0%6200%

File(s)

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

#LineLine coverage
 1using Cysharp.Threading.Tasks;
 2using DCL;
 3using JetBrains.Annotations;
 4using System;
 5using System.Threading;
 6using UnityEngine;
 7
 8public class HUDBridge : MonoBehaviour
 9{
 10    private CancellationTokenSource cancellationTokenSource;
 11
 12    private void Awake()
 13    {
 014        cancellationTokenSource = new CancellationTokenSource();
 015    }
 16
 17    private void OnDestroy()
 18    {
 019        cancellationTokenSource.Cancel();
 020        cancellationTokenSource.Dispose();
 021    }
 22
 23#region MessagesFromKernel
 24
 25    [System.Serializable]
 26    class ConfigureHUDElementMessage
 27    {
 28        public HUDElementID hudElementId;
 29        public HUDConfiguration configuration;
 30        public string extraPayload;
 31    }
 32
 33    [UsedImplicitly]
 34    public void ConfigureHUDElement(string payload)
 35    {
 036        ConfigureHUDElementMessage message = JsonUtility.FromJson<ConfigureHUDElementMessage>(payload);
 37
 038        HUDElementID id = message.hudElementId;
 039        HUDConfiguration configuration = message.configuration;
 040        string extraPayload = message.extraPayload;
 41
 042        HUDController.i.ConfigureHUDElement(id, configuration, cancellationTokenSource.Token, extraPayload).Forget();
 043    }
 44
 045    public void TriggerSelfUserExpression(string id) { UserProfile.GetOwnUserProfile().SetAvatarExpression(id, UserProfi
 46
 47    public void ShowTermsOfServices(string payload)
 48    {
 049        var model = JsonUtility.FromJson<TermsOfServiceHUDController.Model>(payload);
 050        HUDController.i.termsOfServiceHud?.ShowTermsOfService(model);
 051    }
 52
 053    public void SetPlayerTalking(string talking) { HUDController.i.voiceChatHud?.SetVoiceChatRecording("true".Equals(tal
 54
 55    public void SetVoiceChatEnabledByScene(int enabledPayload)
 56    {
 057        bool isEnabled = enabledPayload != 0;
 058        HUDController.i.voiceChatHud?.SetVoiceChatEnabledByScene(isEnabled);
 059    }
 60
 61    public void SetUserTalking(string payload)
 62    {
 063        var model = JsonUtility.FromJson<UserTalkingModel>(payload);
 064        HUDController.i.voiceChatHud?.SetUserRecording(model.userId, model.talking);
 065    }
 66
 67    public void SetUsersMuted(string payload)
 68    {
 069        var model = JsonUtility.FromJson<UserMutedModel>(payload);
 070        HUDController.i.voiceChatHud?.SetUsersMuted(model.usersId, model.muted);
 071    }
 72
 073    public void RequestTeleport(string teleportDataJson) { DataStore.i.world.requestTeleportData.Set(teleportDataJson, t
 74
 75    public void UpdateBalanceOfMANA(string balance)
 76    {
 077        HUDController.i.profileHud?.SetManaBalance(balance);
 078        DataStore.i.wallet.currentEthereumManaBalance.Set(Convert.ToDouble(balance));
 079    }
 80
 81    [Obsolete("Old kernel might be using this call")]
 82    public void ShowAvatarEditorInSignUp()
 83    {
 084        SetSignupFlow();
 085    }
 86
 87    public void SetSignupFlow()
 88    {
 089        if (DataStore.i.featureFlags.flags.Get().IsFeatureEnabled("seamless_login_variant:enabled"))
 090            DataStore.i.HUDs.tosPopupVisible.Set(true, true);
 91        else
 92        {
 093            DataStore.i.common.isSignUpFlow.Set(true);
 094            DataStore.i.HUDs.avatarEditorVisible.Set(true, true);
 95        }
 096    }
 97
 98    #endregion
 99}