< Summary

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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
CreateHUD(...)0%29290100%
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 AvatarSystem;
 2using DCL;
 3using DCL.Browser;
 4using DCL.Chat;
 5using DCL.Chat.HUD;
 6using DCL.HelpAndSupportHUD;
 7using DCL.Huds.QuestsPanel;
 8using DCL.Huds.QuestsTracker;
 9using DCL.ProfanityFiltering;
 10using DCL.SettingsCommon;
 11using DCL.SettingsPanelHUD;
 12using DCL.Social.Chat;
 13using DCL.Social.Friends;
 14using DCl.Social.Passports;
 15using DCL.Social.Passports;
 16using SignupHUD;
 17using SocialFeaturesAnalytics;
 18using UnityEngine;
 19using DCLServices.Lambdas.NamesService;
 20using DCLServices.Lambdas.LandsService;
 21
 22public class HUDFactory : IHUDFactory
 23{
 24    private readonly DataStoreRef<DataStore_LoadingScreen> dataStoreLoadingScreen;
 25
 26    public virtual IHUD CreateHUD(HUDElementID hudElementId)
 27    {
 2728        IHUD hudElement = null;
 29        switch (hudElementId)
 30        {
 31            case HUDElementID.NONE:
 32                break;
 33            case HUDElementID.MINIMAP:
 134                hudElement = new MinimapHUDController(MinimapMetadataController.i, new WebInterfaceHomeLocationControlle
 135                break;
 36            case HUDElementID.PROFILE_HUD:
 137                hudElement = new ProfileHUDController(new UserProfileWebInterfaceBridge(),
 38                    new SocialAnalytics(
 39                        Environment.i.platform.serviceProviders.analytics,
 40                        new UserProfileWebInterfaceBridge()));
 141                break;
 42            case HUDElementID.NOTIFICATION:
 143                hudElement = new NotificationHUDController();
 144                break;
 45            case HUDElementID.AVATAR_EDITOR:
 146                hudElement = new AvatarEditorHUDController(DataStore.i.featureFlags,
 47                    Environment.i.platform.serviceProviders.analytics);
 148                break;
 49            case HUDElementID.SETTINGS_PANEL:
 150                hudElement = new SettingsPanelHUDController();
 151                break;
 52            case HUDElementID.AIRDROPPING:
 153                hudElement = new AirdroppingHUDController();
 154                break;
 55            case HUDElementID.TERMS_OF_SERVICE:
 156                hudElement = new TermsOfServiceHUDController();
 157                break;
 58            case HUDElementID.FRIENDS:
 159                hudElement = new FriendsHUDController(DataStore.i,
 60                    FriendsController.i,
 61                    new UserProfileWebInterfaceBridge(),
 62                    new SocialAnalytics(
 63                        Environment.i.platform.serviceProviders.analytics,
 64                        new UserProfileWebInterfaceBridge()),
 65                    ChatController.i,
 66                    SceneReferences.i.mouseCatcher);
 167                break;
 68            case HUDElementID.WORLD_CHAT_WINDOW:
 169                hudElement = new WorldChatWindowController(
 70                    new UserProfileWebInterfaceBridge(),
 71                    FriendsController.i,
 72                    ChatController.i,
 73                    DataStore.i,
 74                    SceneReferences.i.mouseCatcher,
 75                    new SocialAnalytics(
 76                        Environment.i.platform.serviceProviders.analytics,
 77                        new UserProfileWebInterfaceBridge()),
 78                    Environment.i.serviceLocator.Get<IChannelsFeatureFlagService>(),
 79                    new WebInterfaceBrowserBridge(),
 80                    CommonScriptableObjects.rendererState);
 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                    Environment.i.serviceLocator.Get<IProfanityFilter>(),
 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                    Environment.i.serviceLocator.Get<IProfanityFilter>());
 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                    Environment.i.serviceLocator.Get<IChannelsFeatureFlagService>());
 1124                break;
 125            case HUDElementID.CHANNELS_CREATE:
 1126                hudElement = new CreateChannelWindowController(ChatController.i, DataStore.i);
 1127                break;
 128            case HUDElementID.CHANNELS_LEAVE_CONFIRMATION:
 1129                hudElement = new LeaveChannelConfirmationWindowController(ChatController.i);
 1130                break;
 131            case HUDElementID.TASKBAR:
 1132                hudElement = new TaskbarHUDController(ChatController.i, FriendsController.i);
 1133                break;
 134            case HUDElementID.OPEN_EXTERNAL_URL_PROMPT:
 1135                hudElement = new ExternalUrlPromptHUDController();
 1136                break;
 137            case HUDElementID.NFT_INFO_DIALOG:
 1138                hudElement = new NFTPromptHUDController();
 1139                break;
 140            case HUDElementID.TELEPORT_DIALOG:
 1141                hudElement = new TeleportPromptHUDController();
 1142                break;
 143            case HUDElementID.CONTROLS_HUD:
 1144                hudElement = new ControlsHUDController();
 1145                break;
 146            case HUDElementID.HELP_AND_SUPPORT_HUD:
 1147                hudElement = new HelpAndSupportHUDController();
 1148                break;
 149            case HUDElementID.USERS_AROUND_LIST_HUD:
 1150                hudElement = new VoiceChatWindowController(
 151                    new UserProfileWebInterfaceBridge(),
 152                    FriendsController.i,
 153                    new SocialAnalytics(
 154                        Environment.i.platform.serviceProviders.analytics,
 155                        new UserProfileWebInterfaceBridge()),
 156                    DataStore.i,
 157                    Settings.i,
 158                    SceneReferences.i.mouseCatcher);
 1159                break;
 160            case HUDElementID.GRAPHIC_CARD_WARNING:
 1161                hudElement = new GraphicCardWarningHUDController();
 1162                break;
 163            case HUDElementID.BUILDER_IN_WORLD_MAIN:
 164                break;
 165            case HUDElementID.QUESTS_PANEL:
 1166                hudElement = new QuestsPanelHUDController();
 1167                break;
 168            case HUDElementID.QUESTS_TRACKER:
 1169                hudElement = new QuestsTrackerHUDController();
 1170                break;
 171            case HUDElementID.SIGNUP:
 1172                var analytics = Environment.i.platform.serviceProviders.analytics;
 1173                hudElement = new SignupHUDController(analytics, dataStoreLoadingScreen.Ref);
 1174                break;
 175            case HUDElementID.BUILDER_PROJECTS_PANEL:
 176                break;
 177            case HUDElementID.LOADING:
 1178                hudElement = new LoadingHUDController();
 179                break;
 180        }
 181
 27182        return hudElement;
 183    }
 184
 185    public void Dispose()
 186    {
 493187    }
 188
 189    public void Initialize()
 190    {
 493191    }
 192}