< Summary

Class:SectionSceneGeneralSettingsView
Assembly:BuilderProjectsPanel
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/BuilderProjectsPanel/Scripts/Views/MenuSections/SectionSceneGeneralSettingsView.cs
Covered lines:16
Uncovered lines:10
Coverable lines:26
Total lines:71
Line coverage:61.5% (16 of 26)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
SetParent(...)0%2100%
SetActive(...)0%2100%
SetName(...)0%110100%
SetDescription(...)0%110100%
SetConfigurationActive(...)0%110100%
SetPermissionsActive(...)0%110100%
SetAllowVoiceChat(...)0%110100%
SetAllowTriggerEmotes(...)0%110100%
SetAllowMovePlayer(...)0%110100%
SetMatureContent(...)0%110100%
GetName()0%2100%
GetDescription()0%2100%
GetAllowVoiceChat()0%2100%
GetAllowTriggerEmotes()0%2100%
GetAllowMovePlayer()0%2100%
GetMatureContent()0%2100%
Awake()0%110100%

File(s)

/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/BuilderProjectsPanel/Scripts/Views/MenuSections/SectionSceneGeneralSettingsView.cs

#LineLine coverage
 1using System;
 2using DCL.Helpers;
 3using TMPro;
 4using UnityEngine;
 5using UnityEngine.UI;
 6
 7internal class SectionSceneGeneralSettingsView : MonoBehaviour
 8{
 9    public event Action OnApplyChanges;
 10
 11    [SerializeField] internal TMP_InputField nameInputField;
 12    [SerializeField] internal TMP_InputField descriptionInputField;
 13    [SerializeField] internal TMP_Text nameCharCount;
 14    [SerializeField] internal TMP_Text descriptionCharCount;
 15    [SerializeField] internal GameObject configurationContainer;
 16    [SerializeField] internal GameObject permissionsContainer;
 17    [SerializeField] internal Toggle toggleVoiceChat;
 18    [SerializeField] internal Toggle toggleEmotes;
 19    [SerializeField] internal Toggle toggleMatureContent;
 20    [SerializeField] internal Toggle toggleMovePlayer;
 21    [SerializeField] internal Button applyButton;
 22
 23    public void SetParent(Transform parent)
 24    {
 025        transform.SetParent(parent);
 026        transform.ResetLocalTRS();
 027    }
 28
 029    public void SetActive(bool active) { gameObject.SetActive(active); }
 30
 631    public void SetName(string sceneName) { nameInputField.text = sceneName; }
 32
 633    public void SetDescription(string sceneDescription) { descriptionInputField.text = sceneDescription; }
 34
 635    public void SetConfigurationActive(bool active) { configurationContainer.SetActive(active); }
 36
 637    public void SetPermissionsActive(bool active) { permissionsContainer.SetActive(active); }
 38
 439    public void SetAllowVoiceChat(bool allow) { toggleVoiceChat.isOn = allow; }
 40
 441    public void SetAllowTriggerEmotes(bool allow) { toggleEmotes.isOn = allow; }
 42
 443    public void SetAllowMovePlayer(bool allow) { toggleMovePlayer.isOn = allow; }
 44
 445    public void SetMatureContent(bool mature) { toggleMatureContent.isOn = mature; }
 46
 047    public string GetName() { return nameInputField.text; }
 48
 049    public string GetDescription() { return descriptionInputField.text; }
 50
 051    public bool GetAllowVoiceChat() { return toggleVoiceChat.isOn; }
 52
 053    public bool GetAllowTriggerEmotes() { return toggleEmotes.isOn; }
 54
 055    public bool GetAllowMovePlayer() { return toggleMovePlayer.isOn; }
 56
 057    public bool GetMatureContent() { return toggleMatureContent.isOn; }
 58
 59    private void Awake()
 60    {
 361        nameInputField.onValueChanged.AddListener(value =>
 62        {
 363            nameCharCount.text = $"{value.Length}/{nameInputField.characterLimit}";
 364        });
 365        descriptionInputField.onValueChanged.AddListener(value =>
 66        {
 367            descriptionCharCount.text = $"{value.Length}/{descriptionInputField.characterLimit}";
 368        });
 369        applyButton.onClick.AddListener(() => OnApplyChanges?.Invoke());
 370    }
 71}