< 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:292
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 notificationEvent;
 90    public static AudioEvent notification => CommonScriptableObjects.GetOrLoad(ref notificationEvent, "ScriptableObjects
 91
 92    private static AudioEvent sliderValueChangeEvent;
 93    public static AudioEvent sliderValueChange => CommonScriptableObjects.GetOrLoad(ref sliderValueChangeEvent, "Scripta
 94
 95    private static AudioEvent inputFieldFocusEvent;
 96    public static AudioEvent inputFieldFocus => CommonScriptableObjects.GetOrLoad(ref inputFieldFocusEvent, "ScriptableO
 97
 98    private static AudioEvent inputFieldUnfocusEvent;
 99    public static AudioEvent inputFieldUnfocus => CommonScriptableObjects.GetOrLoad(ref inputFieldUnfocusEvent, "Scripta
 100
 101    private static AudioEvent UIHideEvent;
 102    public static AudioEvent UIHide => CommonScriptableObjects.GetOrLoad(ref UIHideEvent, "ScriptableObjects/AudioEvents
 103
 104    private static AudioEvent UIShowEvent;
 105    public static AudioEvent UIShow => CommonScriptableObjects.GetOrLoad(ref UIShowEvent, "ScriptableObjects/AudioEvents
 106
 107    private static AudioEvent tooltipPopupEvent;
 108    public static AudioEvent tooltipPopup => CommonScriptableObjects.GetOrLoad(ref tooltipPopupEvent, "ScriptableObjects
 109
 110    public static void UnloadAll()
 111    {
 112        Resources.UnloadAsset(builderEnterEvent);
 113        Resources.UnloadAsset(builderReadyEvent);
 114        Resources.UnloadAsset(cameraFadeInEvent);
 115        Resources.UnloadAsset(cameraFadeOutEvent);
 116        Resources.UnloadAsset(buttonHoverEvent);
 117        Resources.UnloadAsset(buttonClickEvent);
 118        Resources.UnloadAsset(buttonReleaseEvent);
 119        Resources.UnloadAsset(cancelEvent);
 120        Resources.UnloadAsset(confirmEvent);
 121        Resources.UnloadAsset(dialogOpenEvent);
 122        Resources.UnloadAsset(dialogCloseEvent);
 123        Resources.UnloadAsset(enableEvent);
 124        Resources.UnloadAsset(errorEvent);
 125        Resources.UnloadAsset(disableEvent);
 126        Resources.UnloadAsset(fadeInEvent);
 127        Resources.UnloadAsset(fadeOutEvent);
 128        Resources.UnloadAsset(listItemAppearEvent);
 129        Resources.UnloadAsset(chatReceiveGlobalEvent);
 130        Resources.UnloadAsset(chatReceivePrivateEvent);
 131        Resources.UnloadAsset(chatSendEvent);
 132        Resources.UnloadAsset(notificationEvent);
 133        Resources.UnloadAsset(sliderValueChangeEvent);
 134        Resources.UnloadAsset(inputFieldFocusEvent);
 135        Resources.UnloadAsset(inputFieldUnfocusEvent);
 136        Resources.UnloadAsset(UIHideEvent);
 137        Resources.UnloadAsset(UIShowEvent);
 138        Resources.UnloadAsset(tooltipPopupEvent);
 139    }
 140}
 141
 142public static class CommonScriptableObjects
 143{
 144    private static Vector3Variable playerUnityPositionValue;
 13252145    public static Vector3Variable playerUnityPosition => GetOrLoad(ref playerUnityPositionValue, "ScriptableObjects/Play
 146
 147    private static Vector3Variable playerUnityEulerAnglesValue;
 600148    public static Vector3Variable playerUnityEulerAngles => GetOrLoad(ref playerUnityEulerAnglesValue, "ScriptableObject
 149
 150    private static Vector3Variable worldOffsetValue;
 20755151    public static Vector3Variable worldOffset => GetOrLoad(ref worldOffsetValue, "ScriptableObjects/WorldOffset");
 152
 153    private static Vector2IntVariable playerCoordsValue;
 6140154    public static Vector2IntVariable playerCoords => GetOrLoad(ref playerCoordsValue, "ScriptableObjects/PlayerCoords");
 155
 156    private static BooleanVariable playerIsOnMovingPlatformValue;
 1186157    public static BooleanVariable playerIsOnMovingPlatform => GetOrLoad(ref playerIsOnMovingPlatformValue, "ScriptableOb
 158
 159    private static QuaternionVariable movingPlatformRotationDeltaValue;
 18160    public static QuaternionVariable movingPlatformRotationDelta => GetOrLoad(ref movingPlatformRotationDeltaValue, "Scr
 161
 162    private static StringVariable sceneIDValue;
 1739163    public static StringVariable sceneID => GetOrLoad(ref sceneIDValue, "ScriptableObjects/SceneID");
 164
 165    private static FloatVariable minimapZoomValue;
 11166    public static FloatVariable minimapZoom => GetOrLoad(ref minimapZoomValue, "ScriptableObjects/MinimapZoom");
 167
 168    private static Vector3NullableVariable characterForwardValue;
 10980169    public static Vector3NullableVariable characterForward => GetOrLoad(ref characterForwardValue, "ScriptableObjects/Ch
 170
 171    private static Vector3Variable cameraForwardValue;
 23583172    public static Vector3Variable cameraForward => GetOrLoad(ref cameraForwardValue, "ScriptableObjects/CameraForward");
 173
 174    private static Vector3Variable cameraPositionValue;
 12439175    public static Vector3Variable cameraPosition => GetOrLoad(ref cameraPositionValue, "ScriptableObjects/CameraPosition
 176
 177    private static Vector3Variable cameraRightValue;
 5402178    public static Vector3Variable cameraRight => GetOrLoad(ref cameraRightValue, "ScriptableObjects/CameraRight");
 179
 180    private static BooleanVariable cameraIsBlendingValue;
 5327181    public static BooleanVariable cameraIsBlending => GetOrLoad(ref cameraIsBlendingValue, "ScriptableObjects/CameraIsBl
 182
 183    private static BooleanVariable cameraBlockedValue;
 1192184    public static BooleanVariable cameraBlocked => GetOrLoad(ref cameraBlockedValue, "ScriptableObjects/CameraBlocked");
 185
 186    private static BooleanVariable playerInfoCardVisibleStateValue;
 969187    public static BooleanVariable playerInfoCardVisibleState => GetOrLoad(ref playerInfoCardVisibleStateValue, "Scriptab
 188
 189    private static BooleanVariable forcePerformanceMeterValue;
 0190    public static BooleanVariable forcePerformanceMeter => GetOrLoad(ref forcePerformanceMeterValue, "ScriptableObjects/
 191
 43646192    public static RendererState rendererState => GetOrLoad(ref rendererStateValue, "ScriptableObjects/RendererState");
 193    private static RendererState rendererStateValue;
 194
 53195    public static BooleanVariable focusState => GetOrLoad(ref focusStateValue, "ScriptableObjects/FocusState");
 196    private static BooleanVariable focusStateValue;
 197
 198    private static ReadMessagesDictionary lastReadChatMessagesDictionary;
 0199    public static ReadMessagesDictionary lastReadChatMessages => GetOrLoad(ref lastReadChatMessagesDictionary, "Scriptab
 200
 201    private static LongVariable lastReadChatMessagesValue;
 0202    public static LongVariable lastReadWorldChatMessages => GetOrLoad(ref lastReadChatMessagesValue, "ScriptableObjects/
 203
 204    private static BooleanVariable allUIHiddenValue;
 52379205    public static BooleanVariable allUIHidden => GetOrLoad(ref allUIHiddenValue, "ScriptableObjects/AllUIHidden");
 206
 207    private static BooleanVariable builderInWorldNotNecessaryUIVisibilityStatusValue;
 70208    public static BooleanVariable builderInWorldNotNecessaryUIVisibilityStatus => GetOrLoad(ref builderInWorldNotNecessa
 209
 210    private static LatestOpenChatsList latestOpenChatsValue;
 0211    public static LatestOpenChatsList latestOpenChats => GetOrLoad(ref latestOpenChatsValue, "ScriptableObjects/LatestOp
 212
 213    private static CameraMode cameraModeValue;
 10133214    public static CameraMode cameraMode => GetOrLoad(ref cameraModeValue, "ScriptableObjects/CameraMode");
 215
 216    private static BooleanVariable cameraModeInputLockedValue;
 5371217    public static BooleanVariable cameraModeInputLocked => GetOrLoad(ref cameraModeInputLockedValue, "ScriptableObjects/
 218
 219    private static BooleanVariable isProfileHUDOpenValue;
 2220    public static BooleanVariable isProfileHUDOpen => GetOrLoad(ref isProfileHUDOpenValue, "ScriptableObjects/IsProfileH
 221
 222    private static BooleanVariable isFullscreenHUDOpenValue;
 1979223    public static BooleanVariable isFullscreenHUDOpen => GetOrLoad(ref isFullscreenHUDOpenValue, "ScriptableObjects/IsAv
 224
 225    private static BooleanVariable isLoadingHUDOpenValue;
 1201226    public static BooleanVariable isLoadingHUDOpen => GetOrLoad(ref isLoadingHUDOpenValue, "ScriptableObjects/IsLoadingH
 227
 228    private static BooleanVariable isTaskbarHUDInitializedValue;
 7229    public static BooleanVariable isTaskbarHUDInitialized => GetOrLoad(ref isTaskbarHUDInitializedValue, "ScriptableObje
 230
 231    private static BooleanVariable tutorialActiveValue;
 2232    public static BooleanVariable tutorialActive => GetOrLoad(ref tutorialActiveValue, "ScriptableObjects/TutorialActive
 233
 234    private static BooleanVariable featureKeyTriggersBlockedValue;
 0235    public static BooleanVariable featureKeyTriggersBlocked => GetOrLoad(ref featureKeyTriggersBlockedValue, "Scriptable
 236
 237    private static BooleanVariable userMovementKeysBlockedValue;
 0238    public static BooleanVariable userMovementKeysBlocked => GetOrLoad(ref userMovementKeysBlockedValue, "ScriptableObje
 239
 240    private static BooleanVariable emailPromptActiveValue;
 0241    public static BooleanVariable emailPromptActive => GetOrLoad(ref emailPromptActiveValue, "ScriptableObjects/EmailPro
 242
 243    private static BooleanVariable voiceChatDisabledValue;
 184244    public static BooleanVariable voiceChatDisabled => GetOrLoad(ref voiceChatDisabledValue, "ScriptableObjects/VoiceCha
 245
 246    public static T GetOrLoad<T>(ref T variable, string path) where T : Object
 247    {
 219214248        if (variable == null)
 249        {
 10853250            variable = Resources.Load<T>(path);
 251        }
 252
 219214253        return variable;
 254    }
 255
 256    public static void UnloadAll()
 257    {
 640258        Resources.UnloadAsset(playerUnityPositionValue);
 640259        Resources.UnloadAsset(playerUnityEulerAnglesValue);
 640260        Resources.UnloadAsset(worldOffsetValue);
 640261        Resources.UnloadAsset(playerCoordsValue);
 640262        Resources.UnloadAsset(playerIsOnMovingPlatformValue);
 640263        Resources.UnloadAsset(movingPlatformRotationDeltaValue);
 640264        Resources.UnloadAsset(sceneIDValue);
 640265        Resources.UnloadAsset(minimapZoomValue);
 640266        Resources.UnloadAsset(characterForwardValue);
 640267        Resources.UnloadAsset(cameraForwardValue);
 640268        Resources.UnloadAsset(cameraPositionValue);
 640269        Resources.UnloadAsset(cameraRightValue);
 640270        Resources.UnloadAsset(cameraIsBlendingValue);
 640271        Resources.UnloadAsset(cameraBlockedValue);
 640272        Resources.UnloadAsset(playerInfoCardVisibleStateValue);
 640273        Resources.UnloadAsset(forcePerformanceMeterValue);
 640274        Resources.UnloadAsset(rendererStateValue);
 640275        Resources.UnloadAsset(focusStateValue);
 640276        Resources.UnloadAsset(lastReadChatMessagesDictionary);
 640277        Resources.UnloadAsset(lastReadChatMessagesValue);
 640278        Resources.UnloadAsset(allUIHiddenValue);
 640279        Resources.UnloadAsset(builderInWorldNotNecessaryUIVisibilityStatusValue);
 640280        Resources.UnloadAsset(latestOpenChatsValue);
 640281        Resources.UnloadAsset(cameraModeValue);
 640282        Resources.UnloadAsset(cameraModeInputLockedValue);
 640283        Resources.UnloadAsset(isProfileHUDOpenValue);
 640284        Resources.UnloadAsset(isFullscreenHUDOpenValue);
 640285        Resources.UnloadAsset(isTaskbarHUDInitializedValue);
 640286        Resources.UnloadAsset(tutorialActiveValue);
 640287        Resources.UnloadAsset(featureKeyTriggersBlockedValue);
 640288        Resources.UnloadAsset(userMovementKeysBlockedValue);
 640289        Resources.UnloadAsset(emailPromptActiveValue);
 640290        Resources.UnloadAsset(voiceChatDisabledValue);
 640291    }
 292}