< Summary

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

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
CreateHUD(...)0%31.0331096.72%
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.SettingsCommon;
 10using DCL.SettingsPanelHUD;
 11using DCL.Social.Chat;
 12using DCL.Social.Friends;
 13using DCl.Social.Passports;
 14using DCL.Social.Passports;
 15using SignupHUD;
 16using SocialFeaturesAnalytics;
 17using UnityEngine;
 18
 19public class HUDFactory : IHUDFactory
 20{
 21    public virtual IHUD CreateHUD(HUDElementID hudElementId)
 22    {
 2823        IHUD hudElement = null;
 24        switch (hudElementId)
 25        {
 26            case HUDElementID.NONE:
 27                break;
 28            case HUDElementID.MINIMAP:
 129                hudElement = new MinimapHUDController(MinimapMetadataController.i, new WebInterfaceHomeLocationControlle
 130                break;
 31            case HUDElementID.PROFILE_HUD:
 132                hudElement = new ProfileHUDController(new UserProfileWebInterfaceBridge());
 133                break;
 34            case HUDElementID.NOTIFICATION:
 135                hudElement = new NotificationHUDController();
 136                break;
 37            case HUDElementID.AVATAR_EDITOR:
 138                hudElement = new AvatarEditorHUDController(DataStore.i.featureFlags,
 39                    Environment.i.platform.serviceProviders.analytics);
 140                break;
 41            case HUDElementID.SETTINGS_PANEL:
 142                hudElement = new SettingsPanelHUDController();
 143                break;
 44            case HUDElementID.PLAYER_INFO_CARD:
 145                if(DataStore.i.HUDs.enableNewPassport.Get())
 46                {
 47                    //TODO: this is temporary, once the old passport flow is removed
 48                    //this can be moved to the passport plugin
 049                    PlayerPassportHUDView view = PlayerPassportHUDView.CreateView();
 050                    hudElement = new PlayerPassportHUDController(
 51                        view,
 52                        new PassportPlayerInfoComponentController(
 53                            Resources.Load<StringVariable>("CurrentPlayerInfoCardId"),
 54                            view.PlayerInfoView,
 55                            DataStore.i,
 56                            ProfanityFilterSharedInstances.regexFilter,
 57                            FriendsController.i,
 58                            new UserProfileWebInterfaceBridge(),
 59                            new SocialAnalytics(
 60                                Environment.i.platform.serviceProviders.analytics,
 61                                new UserProfileWebInterfaceBridge())),
 62                        new PassportPlayerPreviewComponentController(view.PlayerPreviewView),
 63                        new PassportNavigationComponentController(
 64                            view.PassportNavigationView,
 65                            ProfanityFilterSharedInstances.regexFilter,
 66                            new WearableItemResolver(),
 67                            new WearablesCatalogControllerBridge(),
 68                            Environment.i.serviceLocator.Get<IEmotesCatalogService>(),
 69                            DataStore.i),
 70                        Resources.Load<StringVariable>("CurrentPlayerInfoCardId"),
 71                        new UserProfileWebInterfaceBridge(),
 72                        new WebInterfacePassportApiBridge(),
 73                        new SocialAnalytics(
 74                            Environment.i.platform.serviceProviders.analytics,
 75                            new UserProfileWebInterfaceBridge()));
 76                }
 77                else
 78                {
 179                    hudElement = new PlayerInfoCardHUDController(
 80                        FriendsController.i,
 81                        Resources.Load<StringVariable>("CurrentPlayerInfoCardId"),
 82                        new UserProfileWebInterfaceBridge(),
 83                        new WearablesCatalogControllerBridge(),
 84                        new SocialAnalytics(
 85                            Environment.i.platform.serviceProviders.analytics,
 86                            new UserProfileWebInterfaceBridge()),
 87                        ProfanityFilterSharedInstances.regexFilter,
 88                        DataStore.i,
 89                        CommonScriptableObjects.playerInfoCardVisibleState);
 90                }
 191                break;
 92            case HUDElementID.AIRDROPPING:
 193                hudElement = new AirdroppingHUDController();
 194                break;
 95            case HUDElementID.TERMS_OF_SERVICE:
 196                hudElement = new TermsOfServiceHUDController();
 197                break;
 98            case HUDElementID.FRIENDS:
 199                hudElement = new FriendsHUDController(DataStore.i,
 100                    FriendsController.i,
 101                    new UserProfileWebInterfaceBridge(),
 102                    new SocialAnalytics(
 103                        Environment.i.platform.serviceProviders.analytics,
 104                        new UserProfileWebInterfaceBridge()),
 105                    ChatController.i,
 106                    SceneReferences.i.mouseCatcher);
 1107                break;
 108            case HUDElementID.WORLD_CHAT_WINDOW:
 1109                hudElement = new WorldChatWindowController(
 110                    new UserProfileWebInterfaceBridge(),
 111                    FriendsController.i,
 112                    ChatController.i,
 113                    DataStore.i,
 114                    SceneReferences.i.mouseCatcher,
 115                    new SocialAnalytics(
 116                        Environment.i.platform.serviceProviders.analytics,
 117                        new UserProfileWebInterfaceBridge()),
 118                    Environment.i.serviceLocator.Get<IChannelsFeatureFlagService>(),
 119                    new WebInterfaceBrowserBridge(),
 120                    CommonScriptableObjects.rendererState);
 1121                break;
 122            case HUDElementID.PRIVATE_CHAT_WINDOW:
 1123                hudElement = new PrivateChatWindowController(
 124                    DataStore.i,
 125                    new UserProfileWebInterfaceBridge(),
 126                    ChatController.i,
 127                    FriendsController.i,
 128                    new SocialAnalytics(
 129                        Environment.i.platform.serviceProviders.analytics,
 130                        new UserProfileWebInterfaceBridge()),
 131                    SceneReferences.i.mouseCatcher,
 132                    Resources.Load<InputAction_Trigger>("ToggleWorldChat"));
 1133                break;
 134            case HUDElementID.PUBLIC_CHAT:
 1135                hudElement = new PublicChatWindowController(
 136                    ChatController.i,
 137                    new UserProfileWebInterfaceBridge(),
 138                    DataStore.i,
 139                    ProfanityFilterSharedInstances.regexFilter,
 140                    SceneReferences.i.mouseCatcher,
 141                    Resources.Load<InputAction_Trigger>("ToggleWorldChat"));
 1142                break;
 143            case HUDElementID.CHANNELS_CHAT:
 1144                hudElement = new ChatChannelHUDController(
 145                    DataStore.i,
 146                    new UserProfileWebInterfaceBridge(),
 147                    ChatController.i,
 148                    SceneReferences.i.mouseCatcher,
 149                    Resources.Load<InputAction_Trigger>("ToggleWorldChat"),
 150                    new SocialAnalytics(
 151                        Environment.i.platform.serviceProviders.analytics,
 152                        new UserProfileWebInterfaceBridge()),
 153                    ProfanityFilterSharedInstances.regexFilter);
 1154                break;
 155            case HUDElementID.CHANNELS_SEARCH:
 1156                hudElement = new SearchChannelsWindowController(
 157                    ChatController.i,
 158                    SceneReferences.i.mouseCatcher,
 159                    DataStore.i,
 160                    new SocialAnalytics(
 161                        Environment.i.platform.serviceProviders.analytics,
 162                        new UserProfileWebInterfaceBridge()),
 163                    Environment.i.serviceLocator.Get<IChannelsFeatureFlagService>());
 1164                break;
 165            case HUDElementID.CHANNELS_CREATE:
 1166                hudElement = new CreateChannelWindowController(ChatController.i, DataStore.i);
 1167                break;
 168            case HUDElementID.CHANNELS_LEAVE_CONFIRMATION:
 1169                hudElement = new LeaveChannelConfirmationWindowController(ChatController.i);
 1170                break;
 171            case HUDElementID.TASKBAR:
 1172                hudElement = new TaskbarHUDController(ChatController.i, FriendsController.i);
 1173                break;
 174            case HUDElementID.OPEN_EXTERNAL_URL_PROMPT:
 1175                hudElement = new ExternalUrlPromptHUDController();
 1176                break;
 177            case HUDElementID.NFT_INFO_DIALOG:
 1178                hudElement = new NFTPromptHUDController();
 1179                break;
 180            case HUDElementID.TELEPORT_DIALOG:
 1181                hudElement = new TeleportPromptHUDController();
 1182                break;
 183            case HUDElementID.CONTROLS_HUD:
 1184                hudElement = new ControlsHUDController();
 1185                break;
 186            case HUDElementID.HELP_AND_SUPPORT_HUD:
 1187                hudElement = new HelpAndSupportHUDController();
 1188                break;
 189            case HUDElementID.USERS_AROUND_LIST_HUD:
 1190                hudElement = new VoiceChatWindowController(
 191                    new UserProfileWebInterfaceBridge(),
 192                    FriendsController.i,
 193                    new SocialAnalytics(
 194                        Environment.i.platform.serviceProviders.analytics,
 195                        new UserProfileWebInterfaceBridge()),
 196                    DataStore.i,
 197                    Settings.i,
 198                    SceneReferences.i.mouseCatcher);
 1199                break;
 200            case HUDElementID.GRAPHIC_CARD_WARNING:
 1201                hudElement = new GraphicCardWarningHUDController();
 1202                break;
 203            case HUDElementID.BUILDER_IN_WORLD_MAIN:
 204                break;
 205            case HUDElementID.QUESTS_PANEL:
 1206                hudElement = new QuestsPanelHUDController();
 1207                break;
 208            case HUDElementID.QUESTS_TRACKER:
 1209                hudElement = new QuestsTrackerHUDController();
 1210                break;
 211            case HUDElementID.SIGNUP:
 1212                var analytics = Environment.i.platform.serviceProviders.analytics;
 1213                hudElement = new SignupHUDController(analytics);
 1214                break;
 215            case HUDElementID.BUILDER_PROJECTS_PANEL:
 216                break;
 217            case HUDElementID.LOADING:
 1218                hudElement = new LoadingHUDController();
 219                break;
 220        }
 221
 28222        return hudElement;
 223    }
 224
 225    public void Dispose()
 226    {
 500227    }
 228
 229    public void Initialize()
 230    {
 500231    }
 232}