< Summary

Class:CommonScriptableObjects
Assembly:ScriptableObjects
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/ScriptableObject/CommonScriptableObjects.cs
Covered lines:64
Uncovered lines:7
Coverable lines:71
Total lines:302
Line coverage:90.1% (64 of 71)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
GetOrLoad[T](...)0%220100%
UnloadAll()0%110100%

File(s)

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

#LineLine coverage
 1using DCL.CameraTool;
 2using UnityEngine;
 3
 4public static class NotificationScriptableObjects
 5{
 6    private static FloatVariable newApprovedFriendsValue;
 7    public static FloatVariable newApprovedFriends => CommonScriptableObjects.GetOrLoad(ref newApprovedFriendsValue, "Sc
 8
 9    private static FloatVariable pendingChatMessagesValue;
 10    public static FloatVariable pendingChatMessages => CommonScriptableObjects.GetOrLoad(ref pendingChatMessagesValue, "
 11
 12    private static FloatVariable pendingFriendRequestsValue;
 13    public static FloatVariable pendingFriendRequests => CommonScriptableObjects.GetOrLoad(ref pendingFriendRequestsValu
 14
 15    public static void UnloadAll()
 16    {
 17        Resources.UnloadAsset(newApprovedFriendsValue);
 18        Resources.UnloadAsset(pendingChatMessagesValue);
 19        Resources.UnloadAsset(pendingFriendRequestsValue);
 20    }
 21}
 22
 23public static class AudioScriptableObjects
 24{
 25    // Builder
 26
 27    private static AudioEvent builderEnterEvent;
 28    public static AudioEvent builderEnter => CommonScriptableObjects.GetOrLoad(ref builderEnterEvent, "ScriptableObjects
 29
 30    private static AudioEvent builderReadyEvent;
 31    public static AudioEvent builderReady => CommonScriptableObjects.GetOrLoad(ref builderReadyEvent, "ScriptableObjects
 32
 33    // Common UI
 34
 35    private static AudioEvent cameraFadeInEvent;
 36    public static AudioEvent cameraFadeIn => CommonScriptableObjects.GetOrLoad(ref cameraFadeInEvent, "ScriptableObjects
 37
 38    private static AudioEvent cameraFadeOutEvent;
 39    public static AudioEvent cameraFadeOut => CommonScriptableObjects.GetOrLoad(ref cameraFadeOutEvent, "ScriptableObjec
 40
 41    private static AudioEvent buttonHoverEvent;
 42    public static AudioEvent buttonHover => CommonScriptableObjects.GetOrLoad(ref buttonHoverEvent, "ScriptableObjects/A
 43
 44    private static AudioEvent buttonClickEvent;
 45    public static AudioEvent buttonClick => CommonScriptableObjects.GetOrLoad(ref buttonClickEvent, "ScriptableObjects/A
 46
 47    private static AudioEvent buttonReleaseEvent;
 48    public static AudioEvent buttonRelease => CommonScriptableObjects.GetOrLoad(ref buttonReleaseEvent, "ScriptableObjec
 49
 50    private static AudioEvent cancelEvent;
 51    public static AudioEvent cancel => CommonScriptableObjects.GetOrLoad(ref cancelEvent, "ScriptableObjects/AudioEvents
 52
 53    private static AudioEvent confirmEvent;
 54    public static AudioEvent confirm => CommonScriptableObjects.GetOrLoad(ref confirmEvent, "ScriptableObjects/AudioEven
 55
 56    private static AudioEvent dialogOpenEvent;
 57    public static AudioEvent dialogOpen => CommonScriptableObjects.GetOrLoad(ref dialogOpenEvent, "ScriptableObjects/Aud
 58
 59    private static AudioEvent dialogCloseEvent;
 60    public static AudioEvent dialogClose => CommonScriptableObjects.GetOrLoad(ref dialogCloseEvent, "ScriptableObjects/A
 61
 62    private static AudioEvent enableEvent;
 63    public static AudioEvent enable => CommonScriptableObjects.GetOrLoad(ref enableEvent, "ScriptableObjects/AudioEvents
 64
 65    private static AudioEvent errorEvent;
 66    public static AudioEvent error => CommonScriptableObjects.GetOrLoad(ref errorEvent, "ScriptableObjects/AudioEvents/H
 67
 68    private static AudioEvent disableEvent;
 69    public static AudioEvent disable => CommonScriptableObjects.GetOrLoad(ref disableEvent, "ScriptableObjects/AudioEven
 70
 71    private static AudioEvent fadeInEvent;
 72    public static AudioEvent fadeIn => CommonScriptableObjects.GetOrLoad(ref fadeInEvent, "ScriptableObjects/AudioEvents
 73
 74    private static AudioEvent fadeOutEvent;
 75    public static AudioEvent fadeOut => CommonScriptableObjects.GetOrLoad(ref fadeOutEvent, "ScriptableObjects/AudioEven
 76
 77    private static AudioEvent_WithPitchIncrement listItemAppearEvent;
 78    public static AudioEvent_WithPitchIncrement listItemAppear => CommonScriptableObjects.GetOrLoad(ref listItemAppearEv
 79
 80    private static AudioEvent chatReceiveGlobalEvent;
 81    public static AudioEvent chatReceiveGlobal => CommonScriptableObjects.GetOrLoad(ref chatReceiveGlobalEvent, "Scripta
 82
 83    private static AudioEvent chatReceivePrivateEvent;
 84    public static AudioEvent chatReceivePrivate => CommonScriptableObjects.GetOrLoad(ref chatReceivePrivateEvent, "Scrip
 85
 86    private static AudioEvent chatSendEvent;
 87    public static AudioEvent chatSend => CommonScriptableObjects.GetOrLoad(ref chatSendEvent, "ScriptableObjects/AudioEv
 88
 89    private static AudioEvent joinChannelEvent;
 90    public static AudioEvent joinChannel => CommonScriptableObjects.GetOrLoad(ref joinChannelEvent, "ScriptableObjects/A
 91
 92    private static AudioEvent leaveChannelEvent;
 93    public static AudioEvent leaveChannel => CommonScriptableObjects.GetOrLoad(ref leaveChannelEvent, "ScriptableObjects
 94
 95    private static AudioEvent notificationEvent;
 96    public static AudioEvent notification => CommonScriptableObjects.GetOrLoad(ref notificationEvent, "ScriptableObjects
 97
 98    private static AudioEvent sliderValueChangeEvent;
 99    public static AudioEvent sliderValueChange => CommonScriptableObjects.GetOrLoad(ref sliderValueChangeEvent, "Scripta
 100
 101    private static AudioEvent inputFieldFocusEvent;
 102    public static AudioEvent inputFieldFocus => CommonScriptableObjects.GetOrLoad(ref inputFieldFocusEvent, "ScriptableO
 103
 104    private static AudioEvent inputFieldUnfocusEvent;
 105    public static AudioEvent inputFieldUnfocus => CommonScriptableObjects.GetOrLoad(ref inputFieldUnfocusEvent, "Scripta
 106
 107    private static AudioEvent UIHideEvent;
 108    public static AudioEvent UIHide => CommonScriptableObjects.GetOrLoad(ref UIHideEvent, "ScriptableObjects/AudioEvents
 109
 110    private static AudioEvent UIShowEvent;
 111    public static AudioEvent UIShow => CommonScriptableObjects.GetOrLoad(ref UIShowEvent, "ScriptableObjects/AudioEvents
 112
 113    private static AudioEvent tooltipPopupEvent;
 114    public static AudioEvent tooltipPopup => CommonScriptableObjects.GetOrLoad(ref tooltipPopupEvent, "ScriptableObjects
 115
 116    public static void UnloadAll()
 117    {
 118        Resources.UnloadAsset(builderEnterEvent);
 119        Resources.UnloadAsset(builderReadyEvent);
 120        Resources.UnloadAsset(cameraFadeInEvent);
 121        Resources.UnloadAsset(cameraFadeOutEvent);
 122        Resources.UnloadAsset(buttonHoverEvent);
 123        Resources.UnloadAsset(buttonClickEvent);
 124        Resources.UnloadAsset(buttonReleaseEvent);
 125        Resources.UnloadAsset(cancelEvent);
 126        Resources.UnloadAsset(confirmEvent);
 127        Resources.UnloadAsset(dialogOpenEvent);
 128        Resources.UnloadAsset(dialogCloseEvent);
 129        Resources.UnloadAsset(enableEvent);
 130        Resources.UnloadAsset(errorEvent);
 131        Resources.UnloadAsset(disableEvent);
 132        Resources.UnloadAsset(fadeInEvent);
 133        Resources.UnloadAsset(fadeOutEvent);
 134        Resources.UnloadAsset(listItemAppearEvent);
 135        Resources.UnloadAsset(chatReceiveGlobalEvent);
 136        Resources.UnloadAsset(chatReceivePrivateEvent);
 137        Resources.UnloadAsset(chatSendEvent);
 138        Resources.UnloadAsset(joinChannelEvent);
 139        Resources.UnloadAsset(leaveChannelEvent);
 140        Resources.UnloadAsset(notificationEvent);
 141        Resources.UnloadAsset(sliderValueChangeEvent);
 142        Resources.UnloadAsset(inputFieldFocusEvent);
 143        Resources.UnloadAsset(inputFieldUnfocusEvent);
 144        Resources.UnloadAsset(UIHideEvent);
 145        Resources.UnloadAsset(UIShowEvent);
 146        Resources.UnloadAsset(tooltipPopupEvent);
 147    }
 148}
 149
 150public static class CommonScriptableObjects
 151{
 152    private static Vector3Variable playerUnityPositionValue;
 46528153    public static Vector3Variable playerUnityPosition => GetOrLoad(ref playerUnityPositionValue, "ScriptableObjects/Play
 154
 155    private static Vector3Variable playerUnityEulerAnglesValue;
 484156    public static Vector3Variable playerUnityEulerAngles => GetOrLoad(ref playerUnityEulerAnglesValue, "ScriptableObject
 157
 158    private static Vector3Variable worldOffsetValue;
 42894159    public static Vector3Variable worldOffset => GetOrLoad(ref worldOffsetValue, "ScriptableObjects/WorldOffset");
 160
 161    private static Vector2IntVariable playerCoordsValue;
 18217162    public static Vector2IntVariable playerCoords => GetOrLoad(ref playerCoordsValue, "ScriptableObjects/PlayerCoords");
 163
 164    private static BooleanVariable playerIsOnMovingPlatformValue;
 948165    public static BooleanVariable playerIsOnMovingPlatform => GetOrLoad(ref playerIsOnMovingPlatformValue, "ScriptableOb
 166
 167    private static QuaternionVariable movingPlatformRotationDeltaValue;
 15168    public static QuaternionVariable movingPlatformRotationDelta => GetOrLoad(ref movingPlatformRotationDeltaValue, "Scr
 169
 170    // private static StringVariable sceneIDValue;
 171    // public static StringVariable sceneID => GetOrLoad(ref sceneIDValue, "ScriptableObjects/SceneID");
 172    private static IntVariable sceneNumbervalue;
 1503173    public static IntVariable sceneNumber => GetOrLoad(ref sceneNumbervalue, "ScriptableObjects/SceneNumber");
 174
 175    private static FloatVariable minimapZoomValue;
 11176    public static FloatVariable minimapZoom => GetOrLoad(ref minimapZoomValue, "ScriptableObjects/MinimapZoom");
 177
 178    private static Vector3NullableVariable characterForwardValue;
 34520179    public static Vector3NullableVariable characterForward => GetOrLoad(ref characterForwardValue, "ScriptableObjects/Ch
 180
 181    private static Vector3Variable cameraForwardValue;
 80285182    public static Vector3Variable cameraForward => GetOrLoad(ref cameraForwardValue, "ScriptableObjects/CameraForward");
 183
 184    private static Vector3Variable cameraPositionValue;
 103963185    public static Vector3Variable cameraPosition => GetOrLoad(ref cameraPositionValue, "ScriptableObjects/CameraPosition
 186
 187    private static Vector3Variable cameraRightValue;
 17281188    public static Vector3Variable cameraRight => GetOrLoad(ref cameraRightValue, "ScriptableObjects/CameraRight");
 189
 190    private static BooleanVariable cameraIsBlendingValue;
 17203191    public static BooleanVariable cameraIsBlending => GetOrLoad(ref cameraIsBlendingValue, "ScriptableObjects/CameraIsBl
 192
 193    private static BooleanVariable cameraBlockedValue;
 954194    public static BooleanVariable cameraBlocked => GetOrLoad(ref cameraBlockedValue, "ScriptableObjects/CameraBlocked");
 195
 196    private static BooleanVariable playerInfoCardVisibleStateValue;
 799197    public static BooleanVariable playerInfoCardVisibleState => GetOrLoad(ref playerInfoCardVisibleStateValue, "Scriptab
 198
 199    private static BooleanVariable forcePerformanceMeterValue;
 0200    public static BooleanVariable forcePerformanceMeter => GetOrLoad(ref forcePerformanceMeterValue, "ScriptableObjects/
 201
 152121202    public static RendererState rendererState => GetOrLoad(ref rendererStateValue, "ScriptableObjects/RendererState");
 203    private static RendererState rendererStateValue;
 204
 33205    public static BooleanVariable focusState => GetOrLoad(ref focusStateValue, "ScriptableObjects/FocusState");
 206    private static BooleanVariable focusStateValue;
 207
 208    private static ReadMessagesDictionary lastReadChatMessagesDictionary;
 0209    public static ReadMessagesDictionary lastReadChatMessages => GetOrLoad(ref lastReadChatMessagesDictionary, "Scriptab
 210
 211    private static LongVariable lastReadChatMessagesValue;
 0212    public static LongVariable lastReadWorldChatMessages => GetOrLoad(ref lastReadChatMessagesValue, "ScriptableObjects/
 213
 214    private static BooleanVariable allUIHiddenValue;
 335817215    public static BooleanVariable allUIHidden => GetOrLoad(ref allUIHiddenValue, "ScriptableObjects/AllUIHidden");
 216
 217    private static BooleanVariable builderInWorldNotNecessaryUIVisibilityStatusValue;
 56218    public static BooleanVariable builderInWorldNotNecessaryUIVisibilityStatus => GetOrLoad(ref builderInWorldNotNecessa
 219
 220    private static LatestOpenChatsList latestOpenChatsValue;
 0221    public static LatestOpenChatsList latestOpenChats => GetOrLoad(ref latestOpenChatsValue, "ScriptableObjects/LatestOp
 222
 223    private static CameraMode cameraModeValue;
 21041224    public static CameraMode cameraMode => GetOrLoad(ref cameraModeValue, "ScriptableObjects/CameraMode");
 225
 226    private static BooleanVariable cameraModeInputLockedValue;
 17250227    public static BooleanVariable cameraModeInputLocked => GetOrLoad(ref cameraModeInputLockedValue, "ScriptableObjects/
 228
 229    private static BooleanVariable isProfileHUDOpenValue;
 2230    public static BooleanVariable isProfileHUDOpen => GetOrLoad(ref isProfileHUDOpenValue, "ScriptableObjects/IsProfileH
 231
 232    private static BooleanVariable isFullscreenHUDOpenValue;
 1601233    public static BooleanVariable isFullscreenHUDOpen => GetOrLoad(ref isFullscreenHUDOpenValue, "ScriptableObjects/IsAv
 234
 235    private static BooleanVariable isLoadingHUDOpenValue;
 974236    public static BooleanVariable isLoadingHUDOpen => GetOrLoad(ref isLoadingHUDOpenValue, "ScriptableObjects/IsLoadingH
 237
 238    private static BooleanVariable isTaskbarHUDInitializedValue;
 7239    public static BooleanVariable isTaskbarHUDInitialized => GetOrLoad(ref isTaskbarHUDInitializedValue, "ScriptableObje
 240
 241    private static BooleanVariable tutorialActiveValue;
 2242    public static BooleanVariable tutorialActive => GetOrLoad(ref tutorialActiveValue, "ScriptableObjects/TutorialActive
 243
 244    private static BooleanVariable featureKeyTriggersBlockedValue;
 0245    public static BooleanVariable featureKeyTriggersBlocked => GetOrLoad(ref featureKeyTriggersBlockedValue, "Scriptable
 246
 247    private static BooleanVariable userMovementKeysBlockedValue;
 0248    public static BooleanVariable userMovementKeysBlocked => GetOrLoad(ref userMovementKeysBlockedValue, "ScriptableObje
 249
 250    private static BooleanVariable emailPromptActiveValue;
 0251    public static BooleanVariable emailPromptActive => GetOrLoad(ref emailPromptActiveValue, "ScriptableObjects/EmailPro
 252
 253    private static BooleanVariable voiceChatDisabledValue;
 477254    public static BooleanVariable voiceChatDisabled => GetOrLoad(ref voiceChatDisabledValue, "ScriptableObjects/VoiceCha
 255
 256    public static T GetOrLoad<T>(ref T variable, string path) where T : Object
 257    {
 895579258        if (variable == null)
 259        {
 8808260            variable = Resources.Load<T>(path);
 261        }
 262
 895579263        return variable;
 264    }
 265
 266    public static void UnloadAll()
 267    {
 523268        Resources.UnloadAsset(playerUnityPositionValue);
 523269        Resources.UnloadAsset(playerUnityEulerAnglesValue);
 523270        Resources.UnloadAsset(worldOffsetValue);
 523271        Resources.UnloadAsset(playerCoordsValue);
 523272        Resources.UnloadAsset(playerIsOnMovingPlatformValue);
 523273        Resources.UnloadAsset(movingPlatformRotationDeltaValue);
 523274        Resources.UnloadAsset(sceneNumbervalue);
 523275        Resources.UnloadAsset(minimapZoomValue);
 523276        Resources.UnloadAsset(characterForwardValue);
 523277        Resources.UnloadAsset(cameraForwardValue);
 523278        Resources.UnloadAsset(cameraPositionValue);
 523279        Resources.UnloadAsset(cameraRightValue);
 523280        Resources.UnloadAsset(cameraIsBlendingValue);
 523281        Resources.UnloadAsset(cameraBlockedValue);
 523282        Resources.UnloadAsset(playerInfoCardVisibleStateValue);
 523283        Resources.UnloadAsset(forcePerformanceMeterValue);
 523284        Resources.UnloadAsset(rendererStateValue);
 523285        Resources.UnloadAsset(focusStateValue);
 523286        Resources.UnloadAsset(lastReadChatMessagesDictionary);
 523287        Resources.UnloadAsset(lastReadChatMessagesValue);
 523288        Resources.UnloadAsset(allUIHiddenValue);
 523289        Resources.UnloadAsset(builderInWorldNotNecessaryUIVisibilityStatusValue);
 523290        Resources.UnloadAsset(latestOpenChatsValue);
 523291        Resources.UnloadAsset(cameraModeValue);
 523292        Resources.UnloadAsset(cameraModeInputLockedValue);
 523293        Resources.UnloadAsset(isProfileHUDOpenValue);
 523294        Resources.UnloadAsset(isFullscreenHUDOpenValue);
 523295        Resources.UnloadAsset(isTaskbarHUDInitializedValue);
 523296        Resources.UnloadAsset(tutorialActiveValue);
 523297        Resources.UnloadAsset(featureKeyTriggersBlockedValue);
 523298        Resources.UnloadAsset(userMovementKeysBlockedValue);
 523299        Resources.UnloadAsset(emailPromptActiveValue);
 523300        Resources.UnloadAsset(voiceChatDisabledValue);
 523301    }
 302}