| | 1 | | using DCL; |
| | 2 | | using DCL.Browser; |
| | 3 | | using DCL.Chat; |
| | 4 | | using DCL.Chat.Channels; |
| | 5 | | using DCL.Chat.HUD; |
| | 6 | | using DCL.HelpAndSupportHUD; |
| | 7 | | using DCL.Huds.QuestsPanel; |
| | 8 | | using DCL.Huds.QuestsTracker; |
| | 9 | | using DCL.SettingsCommon; |
| | 10 | | using DCL.SettingsPanelHUD; |
| | 11 | | using DCL.Social.Chat; |
| | 12 | | using DCL.Social.Friends; |
| | 13 | | using DCL.Social.Passports; |
| | 14 | | using SignupHUD; |
| | 15 | | using SocialFeaturesAnalytics; |
| | 16 | | using UnityEngine; |
| | 17 | |
|
| | 18 | | public class HUDFactory : IHUDFactory |
| | 19 | | { |
| | 20 | | public virtual IHUD CreateHUD(HUDElementID hudElementId) |
| | 21 | | { |
| 28 | 22 | | IHUD hudElement = null; |
| | 23 | | switch (hudElementId) |
| | 24 | | { |
| | 25 | | case HUDElementID.NONE: |
| | 26 | | break; |
| | 27 | | case HUDElementID.MINIMAP: |
| 1 | 28 | | hudElement = new MinimapHUDController(MinimapMetadataController.i, new WebInterfaceHomeLocationControlle |
| 1 | 29 | | break; |
| | 30 | | case HUDElementID.PROFILE_HUD: |
| 1 | 31 | | hudElement = new ProfileHUDController(new UserProfileWebInterfaceBridge()); |
| 1 | 32 | | break; |
| | 33 | | case HUDElementID.NOTIFICATION: |
| 1 | 34 | | hudElement = new NotificationHUDController(); |
| 1 | 35 | | break; |
| | 36 | | case HUDElementID.AVATAR_EDITOR: |
| 1 | 37 | | hudElement = new AvatarEditorHUDController(DataStore.i.featureFlags, |
| | 38 | | Environment.i.platform.serviceProviders.analytics); |
| 1 | 39 | | break; |
| | 40 | | case HUDElementID.SETTINGS_PANEL: |
| 1 | 41 | | hudElement = new SettingsPanelHUDController(); |
| 1 | 42 | | break; |
| | 43 | | case HUDElementID.PLAYER_INFO_CARD: |
| 1 | 44 | | if(DataStore.i.HUDs.enableNewPassport.Get()) |
| | 45 | | { |
| | 46 | | //TODO: this is temporary, once the old passport flow is removed |
| | 47 | | //this can be moved to the passport plugin |
| 0 | 48 | | PlayerPassportHUDView view = PlayerPassportHUDView.CreateView(); |
| 0 | 49 | | hudElement = new PlayerPassportHUDController( |
| | 50 | | view, |
| | 51 | | new PassportPlayerInfoComponentController( |
| | 52 | | Resources.Load<StringVariable>("CurrentPlayerInfoCardId"), |
| | 53 | | view.PlayerInfoView, |
| | 54 | | DataStore.i, |
| | 55 | | ProfanityFilterSharedInstances.regexFilter, |
| | 56 | | FriendsController.i, |
| | 57 | | new UserProfileWebInterfaceBridge(), |
| | 58 | | new SocialAnalytics( |
| | 59 | | Environment.i.platform.serviceProviders.analytics, |
| | 60 | | new UserProfileWebInterfaceBridge())), |
| | 61 | | new PassportPlayerPreviewComponentController(view.PlayerPreviewView), |
| | 62 | | new PassportNavigationComponentController( |
| | 63 | | view.PassportNavigationView, |
| | 64 | | ProfanityFilterSharedInstances.regexFilter, |
| | 65 | | DataStore.i), |
| | 66 | | Resources.Load<StringVariable>("CurrentPlayerInfoCardId"), |
| | 67 | | new UserProfileWebInterfaceBridge(), |
| | 68 | | new SocialAnalytics( |
| | 69 | | Environment.i.platform.serviceProviders.analytics, |
| | 70 | | new UserProfileWebInterfaceBridge())); |
| | 71 | | } |
| | 72 | | else |
| | 73 | | { |
| 1 | 74 | | hudElement = new PlayerInfoCardHUDController( |
| | 75 | | FriendsController.i, |
| | 76 | | Resources.Load<StringVariable>("CurrentPlayerInfoCardId"), |
| | 77 | | new UserProfileWebInterfaceBridge(), |
| | 78 | | new WearablesCatalogControllerBridge(), |
| | 79 | | new SocialAnalytics( |
| | 80 | | Environment.i.platform.serviceProviders.analytics, |
| | 81 | | new UserProfileWebInterfaceBridge()), |
| | 82 | | ProfanityFilterSharedInstances.regexFilter, |
| | 83 | | DataStore.i, |
| | 84 | | CommonScriptableObjects.playerInfoCardVisibleState); |
| | 85 | | } |
| 1 | 86 | | break; |
| | 87 | | case HUDElementID.AIRDROPPING: |
| 1 | 88 | | hudElement = new AirdroppingHUDController(); |
| 1 | 89 | | break; |
| | 90 | | case HUDElementID.TERMS_OF_SERVICE: |
| 1 | 91 | | hudElement = new TermsOfServiceHUDController(); |
| 1 | 92 | | break; |
| | 93 | | case HUDElementID.FRIENDS: |
| 1 | 94 | | hudElement = new FriendsHUDController(DataStore.i, |
| | 95 | | FriendsController.i, |
| | 96 | | new UserProfileWebInterfaceBridge(), |
| | 97 | | new SocialAnalytics( |
| | 98 | | Environment.i.platform.serviceProviders.analytics, |
| | 99 | | new UserProfileWebInterfaceBridge()), |
| | 100 | | ChatController.i, |
| | 101 | | SceneReferences.i.mouseCatcher); |
| 1 | 102 | | break; |
| | 103 | | case HUDElementID.WORLD_CHAT_WINDOW: |
| 1 | 104 | | hudElement = new WorldChatWindowController( |
| | 105 | | new UserProfileWebInterfaceBridge(), |
| | 106 | | FriendsController.i, |
| | 107 | | ChatController.i, |
| | 108 | | DataStore.i, |
| | 109 | | SceneReferences.i.mouseCatcher, |
| | 110 | | new SocialAnalytics( |
| | 111 | | Environment.i.platform.serviceProviders.analytics, |
| | 112 | | new UserProfileWebInterfaceBridge()), |
| | 113 | | Environment.i.serviceLocator.Get<IChannelsFeatureFlagService>(), |
| | 114 | | new WebInterfaceBrowserBridge(), |
| | 115 | | CommonScriptableObjects.rendererState); |
| 1 | 116 | | break; |
| | 117 | | case HUDElementID.PRIVATE_CHAT_WINDOW: |
| 1 | 118 | | hudElement = new PrivateChatWindowController( |
| | 119 | | DataStore.i, |
| | 120 | | new UserProfileWebInterfaceBridge(), |
| | 121 | | ChatController.i, |
| | 122 | | FriendsController.i, |
| | 123 | | new SocialAnalytics( |
| | 124 | | Environment.i.platform.serviceProviders.analytics, |
| | 125 | | new UserProfileWebInterfaceBridge()), |
| | 126 | | SceneReferences.i.mouseCatcher, |
| | 127 | | Resources.Load<InputAction_Trigger>("ToggleWorldChat")); |
| 1 | 128 | | break; |
| | 129 | | case HUDElementID.PUBLIC_CHAT: |
| 1 | 130 | | hudElement = new PublicChatWindowController( |
| | 131 | | ChatController.i, |
| | 132 | | new UserProfileWebInterfaceBridge(), |
| | 133 | | DataStore.i, |
| | 134 | | ProfanityFilterSharedInstances.regexFilter, |
| | 135 | | SceneReferences.i.mouseCatcher, |
| | 136 | | Resources.Load<InputAction_Trigger>("ToggleWorldChat")); |
| 1 | 137 | | break; |
| | 138 | | case HUDElementID.CHANNELS_CHAT: |
| 1 | 139 | | hudElement = new ChatChannelHUDController( |
| | 140 | | DataStore.i, |
| | 141 | | new UserProfileWebInterfaceBridge(), |
| | 142 | | ChatController.i, |
| | 143 | | SceneReferences.i.mouseCatcher, |
| | 144 | | Resources.Load<InputAction_Trigger>("ToggleWorldChat"), |
| | 145 | | new SocialAnalytics( |
| | 146 | | Environment.i.platform.serviceProviders.analytics, |
| | 147 | | new UserProfileWebInterfaceBridge()), |
| | 148 | | ProfanityFilterSharedInstances.regexFilter); |
| 1 | 149 | | break; |
| | 150 | | case HUDElementID.CHANNELS_SEARCH: |
| 1 | 151 | | hudElement = new SearchChannelsWindowController( |
| | 152 | | ChatController.i, |
| | 153 | | SceneReferences.i.mouseCatcher, |
| | 154 | | DataStore.i, |
| | 155 | | new SocialAnalytics( |
| | 156 | | Environment.i.platform.serviceProviders.analytics, |
| | 157 | | new UserProfileWebInterfaceBridge()), |
| | 158 | | Environment.i.serviceLocator.Get<IChannelsFeatureFlagService>()); |
| 1 | 159 | | break; |
| | 160 | | case HUDElementID.CHANNELS_CREATE: |
| 1 | 161 | | hudElement = new CreateChannelWindowController(ChatController.i, DataStore.i); |
| 1 | 162 | | break; |
| | 163 | | case HUDElementID.CHANNELS_LEAVE_CONFIRMATION: |
| 1 | 164 | | hudElement = new LeaveChannelConfirmationWindowController(ChatController.i); |
| 1 | 165 | | break; |
| | 166 | | case HUDElementID.TASKBAR: |
| 1 | 167 | | hudElement = new TaskbarHUDController(ChatController.i, FriendsController.i); |
| 1 | 168 | | break; |
| | 169 | | case HUDElementID.OPEN_EXTERNAL_URL_PROMPT: |
| 1 | 170 | | hudElement = new ExternalUrlPromptHUDController(); |
| 1 | 171 | | break; |
| | 172 | | case HUDElementID.NFT_INFO_DIALOG: |
| 1 | 173 | | hudElement = new NFTPromptHUDController(); |
| 1 | 174 | | break; |
| | 175 | | case HUDElementID.TELEPORT_DIALOG: |
| 1 | 176 | | hudElement = new TeleportPromptHUDController(); |
| 1 | 177 | | break; |
| | 178 | | case HUDElementID.CONTROLS_HUD: |
| 1 | 179 | | hudElement = new ControlsHUDController(); |
| 1 | 180 | | break; |
| | 181 | | case HUDElementID.HELP_AND_SUPPORT_HUD: |
| 1 | 182 | | hudElement = new HelpAndSupportHUDController(); |
| 1 | 183 | | break; |
| | 184 | | case HUDElementID.USERS_AROUND_LIST_HUD: |
| 1 | 185 | | hudElement = new VoiceChatWindowController( |
| | 186 | | new UserProfileWebInterfaceBridge(), |
| | 187 | | FriendsController.i, |
| | 188 | | new SocialAnalytics( |
| | 189 | | Environment.i.platform.serviceProviders.analytics, |
| | 190 | | new UserProfileWebInterfaceBridge()), |
| | 191 | | DataStore.i, |
| | 192 | | Settings.i, |
| | 193 | | SceneReferences.i.mouseCatcher); |
| 1 | 194 | | break; |
| | 195 | | case HUDElementID.GRAPHIC_CARD_WARNING: |
| 1 | 196 | | hudElement = new GraphicCardWarningHUDController(); |
| 1 | 197 | | break; |
| | 198 | | case HUDElementID.BUILDER_IN_WORLD_MAIN: |
| | 199 | | break; |
| | 200 | | case HUDElementID.QUESTS_PANEL: |
| 1 | 201 | | hudElement = new QuestsPanelHUDController(); |
| 1 | 202 | | break; |
| | 203 | | case HUDElementID.QUESTS_TRACKER: |
| 1 | 204 | | hudElement = new QuestsTrackerHUDController(); |
| 1 | 205 | | break; |
| | 206 | | case HUDElementID.SIGNUP: |
| 1 | 207 | | var analytics = Environment.i.platform.serviceProviders.analytics; |
| 1 | 208 | | hudElement = new SignupHUDController(analytics); |
| 1 | 209 | | break; |
| | 210 | | case HUDElementID.BUILDER_PROJECTS_PANEL: |
| | 211 | | break; |
| | 212 | | case HUDElementID.LOADING: |
| 1 | 213 | | hudElement = new LoadingHUDController(); |
| | 214 | | break; |
| | 215 | | } |
| | 216 | |
|
| 28 | 217 | | return hudElement; |
| | 218 | | } |
| | 219 | |
|
| | 220 | | public void Dispose() |
| | 221 | | { |
| 558 | 222 | | } |
| | 223 | |
|
| | 224 | | public void Initialize() |
| | 225 | | { |
| 558 | 226 | | } |
| | 227 | | } |