< Summary

Class:HUDController
Assembly:HUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/HUDController.cs
Covered lines:198
Uncovered lines:63
Coverable lines:261
Total lines:566
Line coverage:75.8% (198 of 261)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
HUDController(...)0%110100%
Initialize()0%220100%
ShowSettings()0%6200%
ShowControls()0%6200%
ToggleUIVisibility_OnTriggered(...)0%20400%
AllUIHiddenOnOnChange(...)0%4.254075%
ConfigureHUDElement(...)0%51.3250091.91%
OpenChannelSearchWindow()0%6200%
HandleChannelBacked()0%6200%
HandlePublicChatChannelBacked()0%6200%
OpenPublicChatWindow(...)0%6200%
OpenChannelChatWindow(...)0%6200%
OpenPrivateChatWindow(...)0%6200%
PrivateChatWindowHud_OnPressBack()0%12300%
TaskbarHud_onAnyTaskbarButtonClicked()0%2100%
CreateHudElement(...)0%4.074083.33%
UpdateHudElement(...)0%12300%
Cleanup()0%880100%
HandlePublicChatChannelClosed()0%2100%
GetHUDElement(...)0%220100%
IsHUDElementDeprecated(...)0%110100%
TriggerFakePlayerInfoCard()0%2100%
Dispose()0%110100%

File(s)

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

#LineLine coverage
 1using DCL;
 2using DCL.HelpAndSupportHUD;
 3using DCL.Huds.QuestsPanel;
 4using DCL.Huds.QuestsTracker;
 5using DCL.QuestsController;
 6using DCL.SettingsPanelHUD;
 7using SignupHUD;
 8using System;
 9using System.Collections.Generic;
 10using DCL.Chat.HUD;
 11using DCL.Chat;
 12using DCL.Social.Friends;
 13using UnityEngine;
 14using UnityEngine.EventSystems;
 15
 16public class HUDController : IHUDController
 17{
 18    private const string TOGGLE_UI_VISIBILITY_ASSET_NAME = "ToggleUIVisibility";
 19
 20    static bool VERBOSE = false;
 49521    public static HUDController i { get; private set; }
 22
 23    public IHUDFactory hudFactory = null;
 24
 25    private InputAction_Trigger toggleUIVisibilityTrigger;
 26    private DataStore_FeatureFlag featureFlags;
 27
 49528    private readonly DCL.NotificationModel.Model hiddenUINotification = new DCL.NotificationModel.Model()
 29    {
 30        timer = 3,
 31        type = DCL.NotificationModel.Type.UI_HIDDEN,
 32        groupID = "UIHiddenNotification"
 33    };
 34
 49535    public HUDController(DataStore_FeatureFlag featureFlags, IHUDFactory hudFactory = null)
 36    {
 49537        this.hudFactory = hudFactory;
 49538        this.featureFlags = featureFlags;
 49539    }
 40
 41    public void Initialize()
 42    {
 49543        i = this;
 44
 49545        if (this.hudFactory == null)
 49346            this.hudFactory = DCL.Environment.i.hud.factory;
 47
 49548        toggleUIVisibilityTrigger = Resources.Load<InputAction_Trigger>(TOGGLE_UI_VISIBILITY_ASSET_NAME);
 49549        toggleUIVisibilityTrigger.OnTriggered += ToggleUIVisibility_OnTriggered;
 50
 49551        CommonScriptableObjects.allUIHidden.OnChange += AllUIHiddenOnOnChange;
 49552        UserContextMenu.OnOpenPrivateChatRequest += OpenPrivateChatWindow;
 49553    }
 54
 55
 56    public event Action OnTaskbarCreation;
 57
 058    public ProfileHUDController profileHud => GetHUDElement(HUDElementID.PROFILE_HUD) as ProfileHUDController;
 59
 60    public NotificationHUDController notificationHud =>
 061        GetHUDElement(HUDElementID.NOTIFICATION) as NotificationHUDController;
 62
 363    public MinimapHUDController minimapHud => GetHUDElement(HUDElementID.MINIMAP) as MinimapHUDController;
 64
 65    public AvatarEditorHUDController avatarEditorHud =>
 266        GetHUDElement(HUDElementID.AVATAR_EDITOR) as AvatarEditorHUDController;
 67
 68    public SettingsPanelHUDController settingsPanelHud =>
 369        GetHUDElement(HUDElementID.SETTINGS_PANEL) as SettingsPanelHUDController;
 70
 71    public AirdroppingHUDController airdroppingHud =>
 072        GetHUDElement(HUDElementID.AIRDROPPING) as AirdroppingHUDController;
 73
 74    public TermsOfServiceHUDController termsOfServiceHud =>
 075        GetHUDElement(HUDElementID.TERMS_OF_SERVICE) as TermsOfServiceHUDController;
 76
 51177    public TaskbarHUDController taskbarHud => GetHUDElement(HUDElementID.TASKBAR) as TaskbarHUDController;
 78
 279    public LoadingHUDController loadingHud => GetHUDElement(HUDElementID.LOADING) as LoadingHUDController;
 80
 81    public WorldChatWindowController worldChatWindowHud =>
 51182        GetHUDElement(HUDElementID.WORLD_CHAT_WINDOW) as WorldChatWindowController;
 83
 84    public PrivateChatWindowController PrivateChatWindow =>
 50385        GetHUDElement(HUDElementID.PRIVATE_CHAT_WINDOW) as PrivateChatWindowController;
 86
 87    public PublicChatWindowController PublicChatWindowHud =>
 50688        GetHUDElement(HUDElementID.PUBLIC_CHAT) as PublicChatWindowController;
 89
 90    private ChatChannelHUDController chatChannelHud =>
 591        GetHUDElement(HUDElementID.CHANNELS_CHAT) as ChatChannelHUDController;
 92
 93    private SearchChannelsWindowController channelSearchHud =>
 394        GetHUDElement(HUDElementID.CHANNELS_SEARCH) as SearchChannelsWindowController;
 95
 96    private CreateChannelWindowController channelCreateHud =>
 397        GetHUDElement(HUDElementID.CHANNELS_CREATE) as CreateChannelWindowController;
 98
 99    private LeaveChannelConfirmationWindowController channelLeaveHud =>
 3100        GetHUDElement(HUDElementID.CHANNELS_LEAVE_CONFIRMATION) as LeaveChannelConfirmationWindowController;
 101
 503102    public FriendsHUDController friendsHud => GetHUDElement(HUDElementID.FRIENDS) as FriendsHUDController;
 103
 104    public TeleportPromptHUDController teleportHud =>
 0105        GetHUDElement(HUDElementID.TELEPORT_DIALOG) as TeleportPromptHUDController;
 106
 0107    public ControlsHUDController controlsHud => GetHUDElement(HUDElementID.CONTROLS_HUD) as ControlsHUDController;
 108
 109    public HelpAndSupportHUDController helpAndSupportHud =>
 1110        GetHUDElement(HUDElementID.HELP_AND_SUPPORT_HUD) as HelpAndSupportHUDController;
 111
 0112    public MinimapHUDController minimapHUD => GetHUDElement(HUDElementID.MINIMAP) as MinimapHUDController;
 113
 114    public VoiceChatWindowController voiceChatHud =>
 2115        GetHUDElement(HUDElementID.USERS_AROUND_LIST_HUD) as VoiceChatWindowController;
 116
 117    public QuestsPanelHUDController questsPanelHUD =>
 1118        GetHUDElement(HUDElementID.QUESTS_PANEL) as QuestsPanelHUDController;
 119
 120    public QuestsTrackerHUDController questsTrackerHUD =>
 1121        GetHUDElement(HUDElementID.QUESTS_TRACKER) as QuestsTrackerHUDController;
 122
 1123    public SignupHUDController signupHUD => GetHUDElement(HUDElementID.SIGNUP) as SignupHUDController;
 1124    public LoadingHUDController loadingController => GetHUDElement(HUDElementID.LOADING) as LoadingHUDController;
 125
 4333126    public Dictionary<HUDElementID, IHUD> hudElements { get; private set; } = new Dictionary<HUDElementID, IHUD>();
 127
 1128    private UserProfile ownUserProfile => UserProfile.GetOwnUserProfile();
 1129    private BaseDictionary<string, WearableItem> wearableCatalog => CatalogController.wearableCatalog;
 130
 131    private void ShowSettings()
 132    {
 0133        settingsPanelHud?.SetVisibility(true);
 0134    }
 135
 136    private void ShowControls()
 137    {
 0138        controlsHud?.SetVisibility(true);
 0139    }
 140
 141    private void ToggleUIVisibility_OnTriggered(DCLAction_Trigger action)
 142    {
 0143        bool anyInputFieldIsSelected = InputProcessor.FocusIsInInputField();
 144
 0145        if (anyInputFieldIsSelected ||
 146            DataStore.i.exploreV2.isOpen.Get() ||
 147            CommonScriptableObjects.tutorialActive)
 0148            return;
 149
 0150        CommonScriptableObjects.allUIHidden.Set(!CommonScriptableObjects.allUIHidden.Get());
 0151    }
 152
 153    private void AllUIHiddenOnOnChange(bool current, bool previous)
 154    {
 2155        if (current)
 156        {
 1157            NotificationsController.i?.ShowNotification(hiddenUINotification);
 158        }
 159        else
 160        {
 1161            NotificationsController.i?.DismissAllNotifications(hiddenUINotification.groupID);
 162        }
 0163    }
 164
 165    public void ConfigureHUDElement(HUDElementID hudElementId, HUDConfiguration configuration,
 166        string extraPayload = null)
 167    {
 168        //TODO(Brian): For now, the factory code is using this switch approach.
 169        //             In order to avoid the factory upkeep we can transform the IHUD elements
 170        //             To ScriptableObjects. In this scenario, we can make each element handle its own
 171        //             specific initialization details.
 172        //
 173        //             This will allow us to unify the serialized factory objects design,
 174        //             like we already do with ECS components.
 175
 176        switch (hudElementId)
 177        {
 178            case HUDElementID.NONE:
 179                break;
 180            case HUDElementID.MINIMAP:
 1181                if (minimapHud == null)
 182                {
 1183                    CreateHudElement(configuration, hudElementId);
 184
 1185                    if (minimapHud != null)
 186                    {
 1187                        minimapHud.Initialize();
 188                    }
 189                }
 190
 1191                break;
 192            case HUDElementID.PROFILE_HUD:
 1193                CreateHudElement(configuration, hudElementId);
 1194                break;
 195            case HUDElementID.NOTIFICATION:
 1196                CreateHudElement(configuration, hudElementId);
 1197                NotificationsController.i?.Initialize(notificationHud, DataStore.i.notifications);
 0198                break;
 199            case HUDElementID.AVATAR_EDITOR:
 1200                CreateHudElement(configuration, hudElementId);
 1201                avatarEditorHud?.Initialize(ownUserProfile, wearableCatalog);
 1202                break;
 203            case HUDElementID.SETTINGS_PANEL:
 1204                CreateHudElement(configuration, hudElementId);
 1205                if (settingsPanelHud != null)
 1206                    settingsPanelHud.Initialize();
 1207                break;
 208            case HUDElementID.AIRDROPPING:
 1209                CreateHudElement(configuration, hudElementId);
 1210                break;
 211            case HUDElementID.TERMS_OF_SERVICE:
 1212                CreateHudElement(configuration, hudElementId);
 1213                break;
 214            case HUDElementID.WORLD_CHAT_WINDOW:
 1215                if (worldChatWindowHud == null)
 216                {
 1217                    CreateHudElement(configuration, hudElementId);
 218
 1219                    if (worldChatWindowHud != null)
 220                    {
 1221                        worldChatWindowHud.Initialize(WorldChatWindowComponentView.Create());
 1222                        worldChatWindowHud.SetVisibility(false);
 1223                        worldChatWindowHud.OnOpenPrivateChat -= OpenPrivateChatWindow;
 1224                        worldChatWindowHud.OnOpenPrivateChat += OpenPrivateChatWindow;
 1225                        worldChatWindowHud.OnOpenPublicChat -= OpenPublicChatWindow;
 1226                        worldChatWindowHud.OnOpenPublicChat += OpenPublicChatWindow;
 1227                        worldChatWindowHud.OnOpenChannel -= OpenChannelChatWindow;
 1228                        worldChatWindowHud.OnOpenChannel += OpenChannelChatWindow;
 1229                        worldChatWindowHud.OnOpenChannelSearch -= OpenChannelSearchWindow;
 1230                        worldChatWindowHud.OnOpenChannelSearch += OpenChannelSearchWindow;
 231
 1232                        taskbarHud?.AddWorldChatWindow(worldChatWindowHud);
 233                    }
 234                }
 235                else
 0236                    UpdateHudElement(configuration, hudElementId);
 237
 1238                if (PublicChatWindowHud == null)
 239                {
 1240                    CreateHudElement(configuration, HUDElementID.PUBLIC_CHAT);
 1241                    PublicChatWindowHud.Initialize();
 1242                    PublicChatWindowHud.Setup(ChatUtils.NEARBY_CHANNEL_ID);
 1243                    PublicChatWindowHud.SetVisibility(false);
 1244                    PublicChatWindowHud.OnBack -= HandlePublicChatChannelBacked;
 1245                    PublicChatWindowHud.OnBack += HandlePublicChatChannelBacked;
 1246                    PublicChatWindowHud.OnClosed -= HandlePublicChatChannelClosed;
 1247                    PublicChatWindowHud.OnClosed += HandlePublicChatChannelClosed;
 1248                    taskbarHud?.AddPublicChatChannel(PublicChatWindowHud);
 249                }
 250                else
 0251                    UpdateHudElement(configuration, HUDElementID.PUBLIC_CHAT);
 252
 1253                if (PrivateChatWindow == null)
 254                {
 1255                    CreateHudElement(configuration, HUDElementID.PRIVATE_CHAT_WINDOW);
 256
 1257                    if (PrivateChatWindow != null)
 258                    {
 1259                        PrivateChatWindow.Initialize();
 1260                        PrivateChatWindow.SetVisibility(false);
 1261                        PrivateChatWindow.OnBack -= PrivateChatWindowHud_OnPressBack;
 1262                        PrivateChatWindow.OnBack += PrivateChatWindowHud_OnPressBack;
 263
 1264                        taskbarHud?.AddPrivateChatWindow(PrivateChatWindow);
 265                    }
 266                }
 267                else
 0268                    UpdateHudElement(configuration, HUDElementID.PRIVATE_CHAT_WINDOW);
 269
 1270                if (chatChannelHud == null)
 271                {
 1272                    CreateHudElement(configuration, HUDElementID.CHANNELS_CHAT);
 273
 1274                    chatChannelHud.Initialize();
 1275                    chatChannelHud.SetVisibility(false);
 1276                    chatChannelHud.OnPressBack -= HandleChannelBacked;
 1277                    chatChannelHud.OnPressBack += HandleChannelBacked;
 278
 1279                    taskbarHud?.AddChatChannel(chatChannelHud);
 280                }
 281
 1282                if (channelSearchHud == null)
 283                {
 1284                    CreateHudElement(configuration, HUDElementID.CHANNELS_SEARCH);
 1285                    channelSearchHud.Initialize(SearchChannelsWindowComponentView.Create());
 1286                    channelSearchHud.SetVisibility(false);
 1287                    taskbarHud?.AddChannelSearch(channelSearchHud);
 288                }
 289
 1290                if (channelCreateHud == null)
 291                {
 1292                    CreateHudElement(configuration, HUDElementID.CHANNELS_CREATE);
 1293                    channelCreateHud.Initialize(CreateChannelWindowComponentView.Create());
 1294                    channelCreateHud.SetVisibility(false);
 1295                    taskbarHud?.AddChannelCreation(channelCreateHud);
 296                }
 297
 1298                if (channelLeaveHud == null)
 299                {
 1300                    CreateHudElement(configuration, HUDElementID.CHANNELS_LEAVE_CONFIRMATION);
 1301                    channelLeaveHud.Initialize(LeaveChannelConfirmationWindowComponentView.Create());
 1302                    channelLeaveHud.SetVisibility(false);
 1303                    taskbarHud?.AddChannelLeaveConfirmation(channelLeaveHud);
 304                }
 305
 0306                break;
 307            case HUDElementID.FRIENDS:
 1308                if (friendsHud == null)
 309                {
 1310                    CreateHudElement(configuration, hudElementId);
 311
 1312                    if (friendsHud != null)
 313                    {
 1314                        friendsHud.Initialize();
 1315                        friendsHud.OnPressWhisper -= OpenPrivateChatWindow;
 1316                        friendsHud.OnPressWhisper += OpenPrivateChatWindow;
 317
 1318                        taskbarHud?.AddFriendsWindow(friendsHud);
 319                    }
 320                }
 321                else
 322                {
 0323                    UpdateHudElement(configuration, hudElementId);
 324
 0325                    if (!configuration.active)
 0326                        taskbarHud?.DisableFriendsWindow();
 327                }
 328
 0329                break;
 330            case HUDElementID.TASKBAR:
 1331                if (taskbarHud == null)
 332                {
 1333                    CreateHudElement(configuration, hudElementId);
 334
 1335                    if (taskbarHud != null)
 336                    {
 1337                        taskbarHud.Initialize(SceneReferences.i.mouseCatcher);
 1338                        taskbarHud.OnAnyTaskbarButtonClicked -= TaskbarHud_onAnyTaskbarButtonClicked;
 1339                        taskbarHud.OnAnyTaskbarButtonClicked += TaskbarHud_onAnyTaskbarButtonClicked;
 340
 1341                        OnTaskbarCreation?.Invoke();
 342                    }
 343                }
 344                else
 345                {
 0346                    UpdateHudElement(configuration, hudElementId);
 347                }
 348
 0349                break;
 350            case HUDElementID.OPEN_EXTERNAL_URL_PROMPT:
 1351                CreateHudElement(configuration, hudElementId);
 1352                break;
 353            case HUDElementID.NFT_INFO_DIALOG:
 1354                CreateHudElement(configuration, hudElementId);
 1355                break;
 356            case HUDElementID.TELEPORT_DIALOG:
 1357                CreateHudElement(configuration, hudElementId);
 1358                break;
 359            case HUDElementID.CONTROLS_HUD:
 1360                CreateHudElement(configuration, hudElementId);
 1361                break;
 362            case HUDElementID.HELP_AND_SUPPORT_HUD:
 1363                CreateHudElement(configuration, hudElementId);
 1364                settingsPanelHud?.AddHelpAndSupportWindow(helpAndSupportHud);
 1365                break;
 366            case HUDElementID.USERS_AROUND_LIST_HUD:
 1367                CreateHudElement(configuration, hudElementId);
 1368                if (voiceChatHud != null)
 1369                    taskbarHud?.AddVoiceChatWindow(voiceChatHud);
 370
 1371                break;
 372            case HUDElementID.GRAPHIC_CARD_WARNING:
 1373                CreateHudElement(configuration, hudElementId);
 1374                break;
 375            case HUDElementID.QUESTS_PANEL:
 1376                CreateHudElement(configuration, hudElementId);
 1377                if (configuration.active)
 1378                    questsPanelHUD.Initialize(QuestsController.i);
 1379                break;
 380            case HUDElementID.QUESTS_TRACKER:
 1381                CreateHudElement(configuration, hudElementId);
 1382                if (configuration.active)
 1383                    questsTrackerHUD.Initialize(QuestsController.i);
 1384                break;
 385            case HUDElementID.SIGNUP:
 1386                CreateHudElement(configuration, hudElementId);
 1387                if (configuration.active)
 388                {
 389                    //Same race condition risks as with the ProfileHUD
 390                    //TODO Refactor the way AvatarEditor sets its visibility to match our data driven pattern
 391                    //Then this reference can be removed so we just work with a BaseVariable<bool>.
 392                    //This refactor applies to the ProfileHUD and the way kernel asks the HUDController during signup
 1393                    signupHUD.Initialize(avatarEditorHud);
 394                }
 395
 1396                break;
 397            case HUDElementID.LOADING:
 1398                if (loadingHud == null && !featureFlags.flags.Get().IsFeatureEnabled(featureFlags.DECOUPLED_LOADING_SCRE
 399                {
 1400                    CreateHudElement(configuration, hudElementId);
 1401                    if (loadingHud != null && configuration.active)
 1402                        loadingController.Initialize();
 403                }
 404                break;
 405            case HUDElementID.AVATAR_NAMES:
 406                // TODO Remove the HUDElementId once kernel stops sending the Configure HUD message
 407                break;
 408        }
 409
 37410        var hudElement = GetHUDElement(hudElementId);
 411
 37412        if (hudElement != null)
 27413            hudElement.SetVisibility(configuration.active && configuration.visible);
 37414    }
 415
 416    private void OpenChannelSearchWindow()
 417    {
 0418        taskbarHud?.OpenChannelSearch();
 0419    }
 420
 421    private void HandleChannelBacked()
 422    {
 0423        chatChannelHud.SetVisibility(false);
 0424        taskbarHud?.GoBackFromChat();
 0425    }
 426
 427    private void HandlePublicChatChannelBacked()
 428    {
 0429        PublicChatWindowHud.SetVisibility(false);
 0430        taskbarHud?.GoBackFromChat();
 0431    }
 432
 433    private void OpenPublicChatWindow(string channelId)
 434    {
 0435        taskbarHud?.OpenPublicChat(channelId, true);
 0436    }
 437
 438    private void OpenChannelChatWindow(string channelId)
 439    {
 0440        taskbarHud?.OpenChannelChat(channelId);
 0441    }
 442
 443    private void OpenPrivateChatWindow(string targetUserId)
 444    {
 0445        taskbarHud?.OpenPrivateChat(targetUserId);
 0446    }
 447
 448    private void PrivateChatWindowHud_OnPressBack()
 449    {
 0450        PrivateChatWindow?.SetVisibility(false);
 0451        taskbarHud?.GoBackFromChat();
 0452    }
 453
 454    private void TaskbarHud_onAnyTaskbarButtonClicked()
 455    {
 0456    }
 457
 458    public void CreateHudElement(HUDConfiguration config, HUDElementID id)
 459    {
 27460        bool controllerCreated = hudElements.ContainsKey(id);
 461
 27462        if (config.active && !controllerCreated)
 463        {
 27464            hudElements.Add(id, hudFactory.CreateHUD(id));
 465
 27466            if (VERBOSE)
 0467                Debug.Log($"Adding {id} .. type {hudElements[id].GetType().Name}");
 468        }
 27469    }
 470
 471    public void UpdateHudElement(HUDConfiguration config, HUDElementID id)
 472    {
 0473        if (!hudElements.ContainsKey(id))
 0474            return;
 475
 0476        if (VERBOSE)
 0477            Debug.Log(
 478                $"Updating {id}, type {hudElements[id].GetType().Name}, active: {config.active} visible: {config.visible
 479
 0480        hudElements[id].SetVisibility(config.visible);
 0481    }
 482
 483    public void Cleanup()
 484    {
 496485        toggleUIVisibilityTrigger.OnTriggered -= ToggleUIVisibility_OnTriggered;
 496486        CommonScriptableObjects.allUIHidden.OnChange -= AllUIHiddenOnOnChange;
 487
 496488        if (worldChatWindowHud != null)
 489        {
 1490            worldChatWindowHud.OnOpenPrivateChat -= OpenPrivateChatWindow;
 1491            worldChatWindowHud.OnOpenPublicChat -= OpenPublicChatWindow;
 1492            worldChatWindowHud.OnOpenChannel -= OpenChannelChatWindow;
 493        }
 494
 496495        if (PrivateChatWindow != null)
 1496            PrivateChatWindow.OnBack -= PrivateChatWindowHud_OnPressBack;
 497
 496498        if (PublicChatWindowHud != null)
 499        {
 1500            PublicChatWindowHud.OnClosed -= HandlePublicChatChannelClosed;
 1501            PublicChatWindowHud.OnBack -= HandlePublicChatChannelBacked;
 502        }
 503
 504
 496505        if (friendsHud != null)
 1506            friendsHud.OnPressWhisper -= OpenPrivateChatWindow;
 507
 496508        if (taskbarHud != null)
 1509            taskbarHud.OnAnyTaskbarButtonClicked -= TaskbarHud_onAnyTaskbarButtonClicked;
 510
 496511        UserContextMenu.OnOpenPrivateChatRequest -= OpenPrivateChatWindow;
 512
 1046513        foreach (var kvp in hudElements)
 514        {
 27515            kvp.Value?.Dispose();
 516        }
 517
 496518        hudElements.Clear();
 496519    }
 520
 521    private void HandlePublicChatChannelClosed()
 522    {
 0523        PublicChatWindowHud.SetVisibility(false);
 0524    }
 525
 526    public IHUD GetHUDElement(HUDElementID id)
 527    {
 2666528        if (!hudElements.ContainsKey(id))
 2540529            return null;
 530
 126531        return hudElements[id];
 532    }
 533
 534    public static bool IsHUDElementDeprecated(HUDElementID element)
 535    {
 37536        Type enumType = typeof(HUDElementID);
 37537        var enumName = enumType.GetEnumName(element);
 37538        var fieldInfo = enumType.GetField(enumName);
 37539        return Attribute.IsDefined(fieldInfo, typeof(ObsoleteAttribute));
 540    }
 541
 542#if UNITY_EDITOR
 543    [ContextMenu("Trigger fake PlayerInfoCard")]
 544    public void TriggerFakePlayerInfoCard()
 545    {
 0546        var newModel = ownUserProfile.CloneModel();
 0547        newModel.name = "FakePassport";
 0548        newModel.description = "Fake Description for Testing";
 0549        newModel.userId = "test-id";
 550
 0551        UserProfileController.i.AddUserProfileToCatalog(newModel);
 0552        UserProfileController.GetProfileByUserId(newModel.userId).SetInventory(new[]
 553        {
 554            "dcl://halloween_2019/machete_headband_top_head",
 555            "dcl://halloween_2019/bee_suit_upper_body",
 556            "dcl://halloween_2019/bride_of_frankie_upper_body",
 557            "dcl://halloween_2019/creepy_nurse_upper_body",
 558        });
 0559        Resources.Load<StringVariable>("CurrentPlayerInfoCardId").Set(newModel.userId);
 0560    }
 561#endif
 562    public void Dispose()
 563    {
 495564        Cleanup();
 495565    }
 566}