< Summary

Class:DCL.DataStore
Assembly:DataStore
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/DataStore/DataStore.cs
Covered lines:51
Uncovered lines:0
Coverable lines:51
Total lines:112
Line coverage:100% (51 of 51)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
DataStore()0%110100%
Clear()0%110100%
DataStore()0%110100%
DataStore_BuilderInWorld()0%110100%
DataStore_Quests()0%110100%
DataStore_HUDs()0%110100%
LoadingHUD()0%110100%
DataStore_Player()0%110100%
DataStore_AvatarsLOD()0%110100%
DataStore_VirtualAudioMixer()0%110100%
DataStore_Screen()0%110100%
DataStore_WSCommunication()0%110100%

File(s)

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

#LineLine coverage
 1using UnityEngine;
 2using Variables.RealmsInfo;
 3
 4namespace DCL
 5{
 6    public enum AppMode
 7    {
 8        DEFAULT,
 9        BUILDER_IN_WORLD_EDITION
 10    }
 11
 12    public class DataStore
 13    {
 114        private static DataStore instance = new DataStore();
 22415        public static DataStore i { get => instance; }
 7016        public static void Clear() => instance = new DataStore();
 17
 7118        public readonly CurrentRealmVariable playerRealm = new CurrentRealmVariable();
 7119        public readonly RealmsVariable realmsInfo = new RealmsVariable();
 7120        public readonly DebugConfig debugConfig = new DebugConfig();
 7121        public readonly BaseVariable<bool> isSignUpFlow = new BaseVariable<bool>();
 7122        public readonly BaseDictionary<string, WearableItem> wearables = new BaseDictionary<string, WearableItem>();
 7123        public readonly DataStore_BuilderInWorld builderInWorld = new DataStore_BuilderInWorld();
 7124        public readonly DataStore_Quests Quests = new DataStore_Quests();
 7125        public readonly DataStore_HUDs HUDs = new DataStore_HUDs();
 7126        public readonly BaseVariable<bool> isPlayerRendererLoaded = new BaseVariable<bool>();
 7127        public readonly BaseVariable<AppMode> appMode = new BaseVariable<AppMode>();
 7128        public readonly DataStore_Player player = new DataStore_Player();
 7129        public readonly BaseVariable<NFTPromptModel> onOpenNFTPrompt = new BaseVariable<NFTPromptModel>();
 7130        public readonly DataStore_AvatarsLOD avatarsLOD = new DataStore_AvatarsLOD();
 7131        public readonly DataStore_VirtualAudioMixer virtualAudioMixer = new DataStore_VirtualAudioMixer();
 7132        public readonly DataStore_Screen screen = new DataStore_Screen();
 7133        public readonly DataStore_WSCommunication wsCommunication = new DataStore_WSCommunication();
 34
 35        public class DataStore_BuilderInWorld
 36        {
 7137            public readonly BaseDictionary<string, CatalogItem> catalogItemDict = new BaseDictionary<string, CatalogItem
 7138            public readonly BaseDictionary<string, CatalogItem> currentSceneCatalogItemDict = new BaseDictionary<string,
 7139            public readonly BaseDictionary<string, CatalogItemPack> catalogItemPackDict = new BaseDictionary<string, Cat
 7140            public readonly BaseVariable<PublishSceneResultPayload> unpublishSceneResult = new BaseVariable<PublishScene
 7141            public readonly BaseVariable<bool> showTaskBar = new BaseVariable<bool>();
 7142            public readonly BaseVariable<LandWithAccess[]> landsWithAccess = new BaseVariable<LandWithAccess[]>();
 43        }
 44
 45        public class DataStore_Quests
 46        {
 7147            public readonly BaseDictionary<string, QuestModel> quests = new BaseDictionary<string, QuestModel>();
 7148            public readonly BaseCollection<string> pinnedQuests = new BaseCollection<string>();
 49        }
 50
 51        public class DataStore_HUDs
 52        {
 7153            public readonly BaseVariable<bool> questsPanelVisible = new BaseVariable<bool>(false);
 7154            public readonly BaseVariable<bool> builderProjectsPanelVisible = new BaseVariable<bool>(false);
 7155            public readonly BaseVariable<bool> signupVisible = new BaseVariable<bool>(false);
 7156            public readonly LoadingHUD loadingHUD = new LoadingHUD();
 57
 58            public class LoadingHUD
 59            {
 7160                public readonly BaseVariable<bool> visible = new BaseVariable<bool>(false);
 7161                public readonly BaseVariable<string> message = new BaseVariable<string>(null);
 7162                public readonly BaseVariable<float> percentage = new BaseVariable<float>(0);
 7163                public readonly BaseVariable<bool> showWalletPrompt = new BaseVariable<bool>(false);
 7164                public readonly BaseVariable<bool> showTips = new BaseVariable<bool>(false);
 65            }
 66        }
 67
 68        public class DataStore_Player
 69        {
 70            // NOTE: set when character is teleported (DCLCharacterController - Teleport)
 7171            public readonly BaseVariable<Vector3> lastTeleportPosition = new BaseVariable<Vector3>(Vector3.zero);
 7172            public readonly BaseDictionary<string, Player> otherPlayers = new BaseDictionary<string, Player>();
 73        }
 74
 75        public class DataStore_AvatarsLOD
 76        {
 77            public const int DEFAULT_MAX_AVATAR = 50;
 78            public const int DEFAULT_MAX_IMPOSTORS = 70;
 79
 7180            public readonly BaseVariable<float> simpleAvatarDistance = new BaseVariable<float>(15f);
 7181            public readonly BaseVariable<float> LODDistance = new BaseVariable<float>(30f);
 7182            public readonly BaseVariable<int> maxAvatars = new BaseVariable<int>(DEFAULT_MAX_AVATAR);
 7183            public readonly BaseVariable<int> maxImpostors = new BaseVariable<int>(DEFAULT_MAX_IMPOSTORS);
 84        }
 85
 86        /// <summary>
 87        /// An "audio mixer" that handles muting/fading when entering special states like Avatar Editor, Tutorial, Build
 88        /// </summary>
 89        public class DataStore_VirtualAudioMixer
 90        {
 7191            public readonly BaseVariable<float> musicVolume = new BaseVariable<float>(1f);
 7192            public readonly BaseVariable<float> sceneSFXVolume = new BaseVariable<float>(1f);
 7193            public readonly BaseVariable<float> voiceChatVolume = new BaseVariable<float>(1f);
 7194            public readonly BaseVariable<float> uiSFXVolume = new BaseVariable<float>(1f);
 7195            public readonly BaseVariable<float> avatarSFXVolume = new BaseVariable<float>(1f);
 96        }
 97
 98        public class DataStore_Screen
 99        {
 71100            public readonly BaseVariable<Vector2Int> size = new BaseVariable<Vector2Int>(Vector2Int.zero);
 101        }
 102
 103        public class DataStore_WSCommunication
 104        {
 105            [System.NonSerialized]
 71106            public string url = "ws://localhost:5000/";
 107
 71108            public readonly BaseVariable<bool> communicationEstablished = new BaseVariable<bool>();
 71109            public readonly BaseVariable<bool> communicationReady = new BaseVariable<bool>();
 110        }
 111    }
 112}