< Summary

Class:HUDFactory
Assembly:HUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/HUDFactory.cs
Covered lines:60
Uncovered lines:0
Coverable lines:60
Total lines:193
Line coverage:100% (60 of 60)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
CreateHUD(...)0%30300100%
Dispose()0%110100%
Initialize()0%110100%

File(s)

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

#LineLine coverage
 1using DCL;
 2using DCL.Browser;
 3using DCL.Chat;
 4using DCL.Chat.Channels;
 5using DCL.Chat.HUD;
 6using DCL.HelpAndSupportHUD;
 7using DCL.Huds.QuestsPanel;
 8using DCL.Huds.QuestsTracker;
 9using DCL.SettingsCommon;
 10using DCL.SettingsPanelHUD;
 11using SignupHUD;
 12using SocialFeaturesAnalytics;
 13using UnityEngine;
 14
 15public class HUDFactory : IHUDFactory
 16{
 17    public virtual IHUD CreateHUD(HUDElementID hudElementId)
 18    {
 2819        IHUD hudElement = null;
 20        switch (hudElementId)
 21        {
 22            case HUDElementID.NONE:
 23                break;
 24            case HUDElementID.MINIMAP:
 125                hudElement = new MinimapHUDController(MinimapMetadataController.i, new WebInterfaceHomeLocationControlle
 126                break;
 27            case HUDElementID.PROFILE_HUD:
 128                hudElement = new ProfileHUDController(new UserProfileWebInterfaceBridge());
 129                break;
 30            case HUDElementID.NOTIFICATION:
 131                hudElement = new NotificationHUDController();
 132                break;
 33            case HUDElementID.AVATAR_EDITOR:
 134                hudElement = new AvatarEditorHUDController(DataStore.i.featureFlags,
 35                    Environment.i.platform.serviceProviders.analytics);
 136                break;
 37            case HUDElementID.SETTINGS_PANEL:
 138                hudElement = new SettingsPanelHUDController();
 139                break;
 40            case HUDElementID.PLAYER_INFO_CARD:
 141                hudElement = new PlayerInfoCardHUDController(
 42                    FriendsController.i,
 43                    Resources.Load<StringVariable>("CurrentPlayerInfoCardId"),
 44                    new UserProfileWebInterfaceBridge(),
 45                    new WearablesCatalogControllerBridge(),
 46                    new SocialAnalytics(
 47                        Environment.i.platform.serviceProviders.analytics,
 48                        new UserProfileWebInterfaceBridge()),
 49                    ProfanityFilterSharedInstances.regexFilter,
 50                    DataStore.i,
 51                    CommonScriptableObjects.playerInfoCardVisibleState);
 152                break;
 53            case HUDElementID.AIRDROPPING:
 154                hudElement = new AirdroppingHUDController();
 155                break;
 56            case HUDElementID.TERMS_OF_SERVICE:
 157                hudElement = new TermsOfServiceHUDController();
 158                break;
 59            case HUDElementID.FRIENDS:
 160                hudElement = new FriendsHUDController(DataStore.i,
 61                    FriendsController.i,
 62                    new UserProfileWebInterfaceBridge(),
 63                    new SocialAnalytics(
 64                        Environment.i.platform.serviceProviders.analytics,
 65                        new UserProfileWebInterfaceBridge()),
 66                    ChatController.i,
 67                    SceneReferences.i.mouseCatcher);
 168                break;
 69            case HUDElementID.WORLD_CHAT_WINDOW:
 170                hudElement = new WorldChatWindowController(
 71                    new UserProfileWebInterfaceBridge(),
 72                    FriendsController.i,
 73                    ChatController.i,
 74                    DataStore.i,
 75                    SceneReferences.i.mouseCatcher,
 76                    new SocialAnalytics(
 77                        Environment.i.platform.serviceProviders.analytics,
 78                        new UserProfileWebInterfaceBridge()),
 79                    Environment.i.serviceLocator.Get<IChannelsFeatureFlagService>(),
 80                    new WebInterfaceBrowserBridge());
 181                break;
 82            case HUDElementID.PRIVATE_CHAT_WINDOW:
 183                hudElement = new PrivateChatWindowController(
 84                    DataStore.i,
 85                    new UserProfileWebInterfaceBridge(),
 86                    ChatController.i,
 87                    FriendsController.i,
 88                    new SocialAnalytics(
 89                        Environment.i.platform.serviceProviders.analytics,
 90                        new UserProfileWebInterfaceBridge()),
 91                    SceneReferences.i.mouseCatcher,
 92                    Resources.Load<InputAction_Trigger>("ToggleWorldChat"));
 193                break;
 94            case HUDElementID.PUBLIC_CHAT:
 195                hudElement = new PublicChatWindowController(
 96                    ChatController.i,
 97                    new UserProfileWebInterfaceBridge(),
 98                    DataStore.i,
 99                    ProfanityFilterSharedInstances.regexFilter,
 100                    SceneReferences.i.mouseCatcher,
 101                    Resources.Load<InputAction_Trigger>("ToggleWorldChat"));
 1102                break;
 103            case HUDElementID.CHANNELS_CHAT:
 1104                hudElement = new ChatChannelHUDController(
 105                    DataStore.i,
 106                    new UserProfileWebInterfaceBridge(),
 107                    ChatController.i,
 108                    SceneReferences.i.mouseCatcher,
 109                    Resources.Load<InputAction_Trigger>("ToggleWorldChat"),
 110                    new SocialAnalytics(
 111                        Environment.i.platform.serviceProviders.analytics,
 112                        new UserProfileWebInterfaceBridge()),
 113                    ProfanityFilterSharedInstances.regexFilter);
 1114                break;
 115            case HUDElementID.CHANNELS_SEARCH:
 1116                hudElement = new SearchChannelsWindowController(
 117                    ChatController.i,
 118                    SceneReferences.i.mouseCatcher,
 119                    DataStore.i,
 120                    new SocialAnalytics(
 121                        Environment.i.platform.serviceProviders.analytics,
 122                        new UserProfileWebInterfaceBridge()),
 123                    new UserProfileWebInterfaceBridge(),
 124                    Environment.i.serviceLocator.Get<IChannelsFeatureFlagService>());
 1125                break;
 126            case HUDElementID.CHANNELS_CREATE:
 1127                hudElement = new CreateChannelWindowController(ChatController.i, DataStore.i);
 1128                break;
 129            case HUDElementID.CHANNELS_LEAVE_CONFIRMATION:
 1130                hudElement = new LeaveChannelConfirmationWindowController(ChatController.i);
 1131                break;
 132            case HUDElementID.TASKBAR:
 1133                hudElement = new TaskbarHUDController(ChatController.i, FriendsController.i);
 1134                break;
 135            case HUDElementID.OPEN_EXTERNAL_URL_PROMPT:
 1136                hudElement = new ExternalUrlPromptHUDController();
 1137                break;
 138            case HUDElementID.NFT_INFO_DIALOG:
 1139                hudElement = new NFTPromptHUDController();
 1140                break;
 141            case HUDElementID.TELEPORT_DIALOG:
 1142                hudElement = new TeleportPromptHUDController();
 1143                break;
 144            case HUDElementID.CONTROLS_HUD:
 1145                hudElement = new ControlsHUDController();
 1146                break;
 147            case HUDElementID.HELP_AND_SUPPORT_HUD:
 1148                hudElement = new HelpAndSupportHUDController();
 1149                break;
 150            case HUDElementID.USERS_AROUND_LIST_HUD:
 1151                hudElement = new VoiceChatWindowController(
 152                    new UserProfileWebInterfaceBridge(),
 153                    FriendsController.i,
 154                    new SocialAnalytics(
 155                        Environment.i.platform.serviceProviders.analytics,
 156                        new UserProfileWebInterfaceBridge()),
 157                    DataStore.i,
 158                    Settings.i,
 159                    SceneReferences.i.mouseCatcher);
 1160                break;
 161            case HUDElementID.GRAPHIC_CARD_WARNING:
 1162                hudElement = new GraphicCardWarningHUDController();
 1163                break;
 164            case HUDElementID.BUILDER_IN_WORLD_MAIN:
 165                break;
 166            case HUDElementID.QUESTS_PANEL:
 1167                hudElement = new QuestsPanelHUDController();
 1168                break;
 169            case HUDElementID.QUESTS_TRACKER:
 1170                hudElement = new QuestsTrackerHUDController();
 1171                break;
 172            case HUDElementID.SIGNUP:
 1173                var analytics = Environment.i.platform.serviceProviders.analytics;
 1174                hudElement = new SignupHUDController(analytics);
 1175                break;
 176            case HUDElementID.BUILDER_PROJECTS_PANEL:
 177                break;
 178            case HUDElementID.LOADING:
 1179                hudElement = new LoadingHUDController();
 180                break;
 181        }
 182
 28183        return hudElement;
 184    }
 185
 186    public void Dispose()
 187    {
 667188    }
 189
 190    public void Initialize()
 191    {
 667192    }
 193}