< Summary

Class:TaskbarHUDController
Assembly:TaskbarHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/TaskbarHUD/TaskbarHUDController.cs
Covered lines:168
Uncovered lines:330
Coverable lines:498
Total lines:883
Line coverage:33.7% (168 of 498)
Covered branches:0
Total branches:0

Metrics

MethodBranch coverage Crap Score Cyclomatic complexity NPath complexity Sequence coverage
TaskbarHUDController(...)0%110100%
CreateView()0%110100%
Initialize(...)0%22089.47%
HandleFriendsToggle(...)0%4.074083.33%
HandleEmotesToggle(...)0%30500%
ShowEmotes()0%12300%
HandleExperiencesToggle(...)0%12300%
HandleVoiceChatToggle(...)0%20400%
ShowExperiences()0%12300%
ToggleFriendsTrigger_OnTriggered(...)0%42600%
ToggleWorldChatTrigger_OnTriggered(...)0%56700%
CloseWindowTrigger_OnTriggered(...)0%30500%
HandleChatToggle(...)0%3.333066.67%
MouseCatcher_OnMouseUnlock()0%2100%
MouseCatcher_OnMouseLock()0%20400%
AddWorldChatWindow(...)0%8.518080%
ToggleOffChatIcon()0%110100%
OpenFriendsWindow()0%440100%
CloseFriendsWindow()0%6200%
OpenPrivateChatFromPassport(...)0%12300%
OpenPrivateChat(...)0%12300%
OpenLastActiveChatWindow(...)0%42600%
OpenWorldChatWindow()0%440100%
CloseAnyChatWindow()0%2100%
OpenChannelChat(...)0%1101000%
OpenPublicChat(...)0%1321100%
OpenChatList()0%12300%
CloseChatList()0%6200%
OpenVoiceChatWindow()0%12300%
CloseVoiceChatWindow()0%6200%
AddPrivateChatWindow(...)0%98075%
AddPublicChatChannel(...)0%98075%
HandlePublicChannelPreviewModeChanged(...)0%12300%
HandleChannelPreviewModeChanged(...)0%12300%
HandlePrivateChannelPreviewMode(...)0%12300%
AddFriendsWindow(...)0%8.798076.92%
AddVoiceChatWindow(...)0%37.138023.08%
InitializeEmotesSelector(...)0%2.52050%
IsEmotesVisibleChanged(...)0%2100%
InitializeExperiencesViewer(...)0%3.462028.57%
InitializeNotificationPanel(...)0%3.692025%
InitializeTopNotificationPanel(...)0%3.462028.57%
OpenClickedChat(...)0%42600%
IsExperiencesViewerOpenChanged(...)0%6200%
NumOfLoadedExperiencesChanged(...)0%220100%
DisableFriendsWindow()0%2100%
Dispose()0%6.036090.91%
SetVisibility(...)0%2100%
SetVisibility(...)0%110100%
GoBackFromChat()0%6200%
AddChatChannel(...)0%42600%
AddChannelSearch(...)0%3.013090%
AddChannelCreation(...)0%12300%
OpenChannelCreation()0%2100%
AddChannelLeaveConfirmation(...)0%6200%
OpenChannelLeaveConfirmation(...)0%2100%
OpenChannelSearch()0%12300%

File(s)

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

#LineLine coverage
 1using System;
 2using DCL;
 3using DCL.Chat.HUD;
 4using DCL.Chat.Notifications;
 5using DCl.Social.Friends;
 6using DCL.Social.Friends;
 7using TMPro;
 8using UnityEngine;
 9using UnityEngine.EventSystems;
 10
 11public class TaskbarHUDController : IHUD
 12{
 13    private readonly IChatController chatController;
 14    private readonly IFriendsController friendsController;
 15
 16    [Serializable]
 17    public struct Configuration
 18    {
 19        public bool enableVoiceChat;
 20        public bool enableQuestPanel;
 21    }
 22
 23    public TaskbarHUDView view;
 24    public WorldChatWindowController worldChatWindowHud;
 25    public PrivateChatWindowController privateChatWindow;
 26    public PublicChatWindowController publicChatWindow;
 27    public ChatChannelHUDController channelChatWindow;
 28    public FriendsHUDController friendsHud;
 29    public VoiceChatWindowController voiceChatHud;
 30
 31    private IMouseCatcher mouseCatcher;
 32    private InputAction_Trigger toggleFriendsTrigger;
 33    private InputAction_Trigger closeWindowTrigger;
 34    private InputAction_Trigger toggleWorldChatTrigger;
 35    private Transform experiencesViewerTransform;
 36    private Transform notificationViewerTransform;
 37    private Transform topNotificationViewerTransform;
 38    private IHUD chatToggleTargetWindow;
 39    private IHUD chatInputTargetWindow;
 40    private IHUD chatBackWindow;
 41    private SearchChannelsWindowController searchChannelsHud;
 42    private CreateChannelWindowController channelCreationWindow;
 43    private LeaveChannelConfirmationWindowController channelLeaveWindow;
 44
 45    public event Action OnAnyTaskbarButtonClicked;
 46
 047    public RectTransform socialTooltipReference => view.socialTooltipReference;
 48
 1249    internal BaseVariable<bool> isEmotesWheelInitialized => DataStore.i.emotesCustomization.isWheelInitialized;
 1150    internal BaseVariable<bool> isEmotesVisible => DataStore.i.HUDs.emotesVisible;
 051    internal BaseVariable<bool> emoteJustTriggeredFromShortcut => DataStore.i.HUDs.emoteJustTriggeredFromShortcut;
 1252    internal BaseVariable<Transform> isExperiencesViewerInitialized => DataStore.i.experiencesViewer.isInitialized;
 853    internal BaseVariable<Transform> notificationPanelTransform => DataStore.i.HUDs.notificationPanelTransform;
 854    internal BaseVariable<Transform> topNotificationPanelTransform => DataStore.i.HUDs.topNotificationPanelTransform;
 1555    internal BaseVariable<bool> isExperiencesViewerOpen => DataStore.i.experiencesViewer.isOpen;
 1256    internal BaseVariable<int> numOfLoadedExperiences => DataStore.i.experiencesViewer.numOfLoadedExperiences;
 457    internal BaseVariable<string> openPrivateChat => DataStore.i.HUDs.openPrivateChat;
 058    internal BaseVariable<string> openedChat => DataStore.i.HUDs.openedChat;
 359    internal BaseVariable<bool> isPromoteChannelsToastVisible => DataStore.i.channels.isPromoteToastVisible;
 60
 461    public TaskbarHUDController(IChatController chatController, IFriendsController friendsController)
 62    {
 463        this.chatController = chatController;
 464        this.friendsController = friendsController;
 465    }
 66
 67    protected virtual TaskbarHUDView CreateView()
 68    {
 469        return TaskbarHUDView.Create();
 70    }
 71
 72    public void Initialize(IMouseCatcher mouseCatcher)
 73    {
 474        this.mouseCatcher = mouseCatcher;
 75
 476        view = CreateView();
 77
 478        if (mouseCatcher != null)
 79        {
 080            mouseCatcher.OnMouseLock -= MouseCatcher_OnMouseLock;
 081            mouseCatcher.OnMouseUnlock -= MouseCatcher_OnMouseUnlock;
 082            mouseCatcher.OnMouseLock += MouseCatcher_OnMouseLock;
 083            mouseCatcher.OnMouseUnlock += MouseCatcher_OnMouseUnlock;
 84        }
 85
 486        view.leftWindowContainerLayout.enabled = false;
 87
 488        view.OnChatToggle += HandleChatToggle;
 489        view.OnFriendsToggle += HandleFriendsToggle;
 490        view.OnEmotesToggle += HandleEmotesToggle;
 491        view.OnExperiencesToggle += HandleExperiencesToggle;
 492        view.OnVoiceChatToggle += HandleVoiceChatToggle;
 93
 494        toggleFriendsTrigger = Resources.Load<InputAction_Trigger>("ToggleFriends");
 495        toggleFriendsTrigger.OnTriggered -= ToggleFriendsTrigger_OnTriggered;
 496        toggleFriendsTrigger.OnTriggered += ToggleFriendsTrigger_OnTriggered;
 97
 498        closeWindowTrigger = Resources.Load<InputAction_Trigger>("CloseWindow");
 499        closeWindowTrigger.OnTriggered -= CloseWindowTrigger_OnTriggered;
 4100        closeWindowTrigger.OnTriggered += CloseWindowTrigger_OnTriggered;
 101
 4102        toggleWorldChatTrigger = Resources.Load<InputAction_Trigger>("ToggleWorldChat");
 4103        toggleWorldChatTrigger.OnTriggered -= ToggleWorldChatTrigger_OnTriggered;
 4104        toggleWorldChatTrigger.OnTriggered += ToggleWorldChatTrigger_OnTriggered;
 105
 4106        isEmotesWheelInitialized.OnChange += InitializeEmotesSelector;
 4107        InitializeEmotesSelector(isEmotesWheelInitialized.Get(), false);
 4108        isEmotesVisible.OnChange += IsEmotesVisibleChanged;
 109
 4110        isExperiencesViewerOpen.OnChange += IsExperiencesViewerOpenChanged;
 111
 4112        view.leftWindowContainerAnimator.Show();
 113
 4114        CommonScriptableObjects.isTaskbarHUDInitialized.Set(true);
 115
 4116        isExperiencesViewerInitialized.OnChange += InitializeExperiencesViewer;
 4117        InitializeExperiencesViewer(isExperiencesViewerInitialized.Get(), null);
 118
 4119        notificationPanelTransform.OnChange += InitializeNotificationPanel;
 4120        InitializeNotificationPanel(notificationPanelTransform.Get(), null);
 121
 4122        topNotificationPanelTransform.OnChange += InitializeTopNotificationPanel;
 4123        InitializeTopNotificationPanel(topNotificationPanelTransform.Get(), null);
 124
 4125        numOfLoadedExperiences.OnChange += NumOfLoadedExperiencesChanged;
 4126        NumOfLoadedExperiencesChanged(numOfLoadedExperiences.Get(), 0);
 127
 4128        openPrivateChat.OnChange += OpenPrivateChatFromPassport;
 4129    }
 130
 131    private void HandleFriendsToggle(bool show)
 132    {
 3133        if (show)
 2134            OpenFriendsWindow();
 135        else
 136        {
 1137            friendsHud?.SetVisibility(false);
 1138            ToggleOffChatIcon();
 139        }
 140
 3141        OnAnyTaskbarButtonClicked?.Invoke();
 0142    }
 143
 144    private void HandleEmotesToggle(bool show)
 145    {
 0146        if (show && emoteJustTriggeredFromShortcut.Get())
 147        {
 0148            emoteJustTriggeredFromShortcut.Set(false);
 0149            return;
 150        }
 151
 0152        if (show)
 153        {
 0154            ToggleOffChatIcon();
 0155            ShowEmotes();
 156        }
 157        else
 158        {
 0159            view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Emotes);
 0160            isEmotesVisible.Set(false);
 0161            ToggleOffChatIcon();
 162        }
 163
 0164        OnAnyTaskbarButtonClicked?.Invoke();
 0165    }
 166
 167    private void ShowEmotes()
 168    {
 0169        worldChatWindowHud.SetVisibility(false);
 0170        privateChatWindow.SetVisibility(false);
 0171        channelChatWindow.SetVisibility(false);
 0172        friendsHud?.SetVisibility(false);
 0173        searchChannelsHud.SetVisibility(false);
 0174        isExperiencesViewerOpen.Set(false);
 0175        voiceChatHud?.SetVisibility(false);
 0176        isEmotesVisible.Set(true);
 0177        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Emotes);
 0178    }
 179
 180    private void HandleExperiencesToggle(bool show)
 181    {
 0182        if (show)
 0183            ShowExperiences();
 184        else
 185        {
 0186            isExperiencesViewerOpen.Set(false);
 0187            ToggleOffChatIcon();
 188        }
 189
 0190        OnAnyTaskbarButtonClicked?.Invoke();
 0191    }
 192
 193    private void HandleVoiceChatToggle(bool show)
 194    {
 0195        if (show)
 0196            OpenVoiceChatWindow();
 197        else
 0198            voiceChatHud?.SetVisibility(false);
 0199        OnAnyTaskbarButtonClicked?.Invoke();
 0200    }
 201
 202    private void ShowExperiences()
 203    {
 0204        worldChatWindowHud.SetVisibility(false);
 0205        privateChatWindow.SetVisibility(false);
 0206        publicChatWindow.SetVisibility(false);
 0207        channelChatWindow.SetVisibility(false);
 0208        searchChannelsHud.SetVisibility(false);
 0209        friendsHud?.SetVisibility(false);
 0210        isEmotesVisible.Set(false);
 0211        voiceChatHud?.SetVisibility(false);
 0212        isExperiencesViewerOpen.Set(true);
 0213        isPromoteChannelsToastVisible.Set(false);
 0214    }
 215
 216    private void ToggleFriendsTrigger_OnTriggered(DCLAction_Trigger action)
 217    {
 0218        if (friendsHud == null) return;
 219
 0220        bool anyInputFieldIsSelected = EventSystem.current != null &&
 221                                       EventSystem.current.currentSelectedGameObject != null &&
 222                                       EventSystem.current.currentSelectedGameObject.GetComponent<TMP_InputField>() !=
 223                                       null;
 224
 0225        if (anyInputFieldIsSelected) return;
 226
 0227        mouseCatcher.UnlockCursor();
 228
 0229        if (!friendsHud.View.IsActive())
 230        {
 0231            view.leftWindowContainerAnimator.Show();
 0232            OpenFriendsWindow();
 233        }
 234        else
 235        {
 0236            CloseFriendsWindow();
 0237            ToggleOffChatIcon();
 238        }
 0239    }
 240
 241    private void ToggleWorldChatTrigger_OnTriggered(DCLAction_Trigger action)
 242    {
 0243        bool anyInputFieldIsSelected = EventSystem.current != null &&
 244                                       EventSystem.current.currentSelectedGameObject != null &&
 245                                       EventSystem.current.currentSelectedGameObject.GetComponent<TMP_InputField>() !=
 246                                       null;
 247
 0248        if (anyInputFieldIsSelected) return;
 249
 0250        mouseCatcher.UnlockCursor();
 0251        chatBackWindow = worldChatWindowHud;
 252
 0253        if (!worldChatWindowHud.View.IsActive
 254            && !privateChatWindow.View.IsActive
 255            && !publicChatWindow.View.IsActive)
 0256            OpenLastActiveChatWindow(chatInputTargetWindow);
 0257    }
 258
 259    private void CloseWindowTrigger_OnTriggered(DCLAction_Trigger action)
 260    {
 0261        if (mouseCatcher.isLocked) return;
 262
 0263        if (publicChatWindow.View.IsActive ||
 264            channelChatWindow.View.IsActive ||
 265            privateChatWindow.View.IsActive)
 266        {
 0267            publicChatWindow.SetVisibility(false);
 0268            worldChatWindowHud.SetVisibility(true);
 0269            chatToggleTargetWindow = worldChatWindowHud;
 0270            chatInputTargetWindow = publicChatWindow;
 271        }
 272        else
 273        {
 0274            worldChatWindowHud.SetVisibility(false);
 0275            view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Chat);
 276        }
 277
 0278        publicChatWindow.SetVisibility(false);
 0279        privateChatWindow.SetVisibility(false);
 0280        channelChatWindow.SetVisibility(false);
 0281        CloseFriendsWindow();
 0282        CloseVoiceChatWindow();
 0283        isEmotesVisible.Set(false);
 0284        isExperiencesViewerOpen.Set(false);
 0285    }
 286
 287    private void HandleChatToggle(bool show)
 288    {
 1289        if (show)
 290        {
 1291            chatBackWindow = worldChatWindowHud;
 1292            OpenWorldChatWindow();
 293        }
 294        else
 295        {
 0296            CloseAnyChatWindow();
 297        }
 298
 1299        OnAnyTaskbarButtonClicked?.Invoke();
 0300    }
 301
 302    private void MouseCatcher_OnMouseUnlock()
 303    {
 0304    }
 305
 306    private void MouseCatcher_OnMouseLock()
 307    {
 0308        CloseFriendsWindow();
 0309        CloseChatList();
 0310        CloseVoiceChatWindow();
 0311        isExperiencesViewerOpen.Set(false);
 312
 0313        if (!privateChatWindow.View.IsActive
 314            && !publicChatWindow.View.IsActive
 315            && !channelChatWindow.View.IsActive)
 0316            ToggleOffChatIcon();
 0317    }
 318
 319    public void AddWorldChatWindow(WorldChatWindowController controller)
 320    {
 2321        if (controller?.View == null)
 322        {
 0323            Debug.LogWarning("AddChatWindow >>> World Chat Window doesn't exist yet!");
 0324            return;
 325        }
 326
 2327        if (controller.View.Transform.parent == view.leftWindowContainer) return;
 328
 2329        controller.View.Transform.SetParent(view.leftWindowContainer, false);
 2330        notificationViewerTransform?.SetAsLastSibling();
 2331        topNotificationViewerTransform?.SetAsFirstSibling();
 2332        experiencesViewerTransform?.SetAsLastSibling();
 333
 2334        worldChatWindowHud = controller;
 335
 2336        view.ShowChatButton();
 2337        worldChatWindowHud.OnCloseView += ToggleOffChatIcon;
 2338        worldChatWindowHud.OnOpenChannelCreation += OpenChannelCreation;
 2339        worldChatWindowHud.OnOpenChannelLeave += OpenChannelLeaveConfirmation;
 2340    }
 341
 1342    private void ToggleOffChatIcon() => view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Chat);
 343
 344    private void OpenFriendsWindow()
 345    {
 2346        worldChatWindowHud.SetVisibility(false);
 2347        privateChatWindow.SetVisibility(false);
 2348        publicChatWindow.SetVisibility(false);
 2349        channelChatWindow?.SetVisibility(false);
 2350        searchChannelsHud.SetVisibility(false);
 2351        isExperiencesViewerOpen.Set(false);
 2352        isEmotesVisible.Set(false);
 2353        voiceChatHud?.SetVisibility(false);
 2354        friendsHud?.SetVisibility(true);
 2355        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Friends);
 2356        chatBackWindow = friendsHud;
 2357        isPromoteChannelsToastVisible.Set(false);
 2358    }
 359
 360    private void CloseFriendsWindow()
 361    {
 0362        friendsHud?.SetVisibility(false);
 0363        view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Friends);
 0364    }
 365
 366    private void OpenPrivateChatFromPassport(string current, string previous)
 367    {
 0368        if (current == "" || current == previous)
 0369            return;
 370
 0371        OpenPrivateChat(current);
 0372        openPrivateChat.Set("", false);
 0373    }
 374
 375    public void OpenPrivateChat(string userId)
 376    {
 0377        worldChatWindowHud.SetVisibility(false);
 0378        publicChatWindow.SetVisibility(false);
 0379        channelChatWindow.SetVisibility(false);
 0380        searchChannelsHud.SetVisibility(false);
 0381        friendsHud?.SetVisibility(false);
 0382        isExperiencesViewerOpen.Set(false);
 0383        isEmotesVisible.Set(false);
 0384        voiceChatHud?.SetVisibility(false);
 0385        openedChat.Set(userId);
 0386        privateChatWindow.Setup(userId);
 0387        privateChatWindow.SetVisibility(true);
 0388        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 0389        chatToggleTargetWindow = worldChatWindowHud;
 0390        chatInputTargetWindow = privateChatWindow;
 0391    }
 392
 393    private IHUD OpenLastActiveChatWindow(IHUD lastActiveWindow)
 394    {
 0395        worldChatWindowHud.SetVisibility(false);
 0396        privateChatWindow.SetVisibility(false);
 0397        publicChatWindow.SetVisibility(false);
 0398        channelChatWindow?.SetVisibility(false);
 0399        searchChannelsHud.SetVisibility(false);
 0400        friendsHud?.SetVisibility(false);
 0401        isEmotesVisible.Set(false);
 0402        isExperiencesViewerOpen.Set(false);
 0403        voiceChatHud?.SetVisibility(false);
 0404        isPromoteChannelsToastVisible.Set(false);
 405
 406        IHUD visibleWindow;
 407
 0408        if (lastActiveWindow == publicChatWindow)
 409        {
 0410            publicChatWindow.SetVisibility(true, true);
 0411            visibleWindow = publicChatWindow;
 412        }
 0413        else if (lastActiveWindow != null)
 414        {
 0415            lastActiveWindow.SetVisibility(true);
 0416            visibleWindow = lastActiveWindow;
 417        }
 418        else
 419        {
 0420            publicChatWindow.SetVisibility(true, true);
 0421            visibleWindow = publicChatWindow;
 422        }
 423
 0424        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 425
 0426        return visibleWindow;
 427    }
 428
 429    private void OpenWorldChatWindow()
 430    {
 1431        privateChatWindow.SetVisibility(false);
 1432        publicChatWindow.SetVisibility(false);
 1433        channelChatWindow?.SetVisibility(false);
 1434        searchChannelsHud.SetVisibility(false);
 1435        friendsHud?.SetVisibility(false);
 1436        isEmotesVisible.Set(false);
 1437        isExperiencesViewerOpen.Set(false);
 1438        voiceChatHud?.SetVisibility(false);
 1439        isPromoteChannelsToastVisible.Set(false);
 1440        worldChatWindowHud.SetVisibility(true);
 1441        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 1442    }
 443
 444    private void CloseAnyChatWindow()
 445    {
 0446        worldChatWindowHud.SetVisibility(false);
 0447        privateChatWindow.SetVisibility(false);
 0448        publicChatWindow.SetVisibility(false);
 0449        channelChatWindow.SetVisibility(false);
 0450        searchChannelsHud.SetVisibility(false);
 0451        view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Chat);
 0452    }
 453
 454    public void OpenChannelChat(string channelId)
 455    {
 0456        openedChat.Set(channelId);
 0457        channelChatWindow?.Setup(channelId);
 0458        channelChatWindow?.SetVisibility(true);
 0459        publicChatWindow?.SetVisibility(false);
 0460        worldChatWindowHud?.SetVisibility(false);
 0461        privateChatWindow?.SetVisibility(false);
 0462        searchChannelsHud.SetVisibility(false);
 0463        friendsHud?.SetVisibility(false);
 0464        isExperiencesViewerOpen?.Set(false);
 0465        isEmotesVisible?.Set(false);
 0466        voiceChatHud?.SetVisibility(false);
 467
 0468        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 469
 0470        chatToggleTargetWindow = worldChatWindowHud;
 0471        chatInputTargetWindow = channelChatWindow;
 0472    }
 473
 474
 475    public void OpenPublicChat(string channelId, bool focusInputField)
 476    {
 0477        openedChat.Set(channelId);
 0478        publicChatWindow?.Setup(channelId);
 0479        publicChatWindow?.SetVisibility(true, focusInputField);
 0480        channelChatWindow?.SetVisibility(false);
 0481        worldChatWindowHud?.SetVisibility(false);
 0482        privateChatWindow?.SetVisibility(false);
 0483        searchChannelsHud?.SetVisibility(false);
 0484        friendsHud?.SetVisibility(false);
 0485        isExperiencesViewerOpen?.Set(false);
 0486        isEmotesVisible?.Set(false);
 0487        voiceChatHud?.SetVisibility(false);
 488
 0489        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 490
 0491        chatToggleTargetWindow = worldChatWindowHud;
 0492        chatInputTargetWindow = publicChatWindow;
 0493    }
 494
 495    private void OpenChatList()
 496    {
 0497        privateChatWindow.SetVisibility(false);
 0498        publicChatWindow.SetVisibility(false);
 0499        channelChatWindow.SetVisibility(false);
 0500        searchChannelsHud.SetVisibility(false);
 0501        friendsHud?.SetVisibility(false);
 0502        isExperiencesViewerOpen.Set(false);
 0503        isEmotesVisible.Set(false);
 0504        voiceChatHud?.SetVisibility(false);
 0505        worldChatWindowHud.SetVisibility(true);
 0506        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 507
 0508        chatToggleTargetWindow = worldChatWindowHud;
 0509    }
 510
 511    private void CloseChatList()
 512    {
 0513        if (!worldChatWindowHud.View.IsActive) return;
 0514        worldChatWindowHud.SetVisibility(false);
 0515        view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Chat);
 0516    }
 517
 518    private void OpenVoiceChatWindow()
 519    {
 0520        worldChatWindowHud.SetVisibility(false);
 0521        privateChatWindow.SetVisibility(false);
 0522        publicChatWindow.SetVisibility(false);
 0523        channelChatWindow.SetVisibility(false);
 0524        searchChannelsHud.SetVisibility(false);
 0525        isExperiencesViewerOpen.Set(false);
 0526        isEmotesVisible.Set(false);
 0527        friendsHud?.SetVisibility(false);
 0528        voiceChatHud?.SetVisibility(true);
 0529        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.VoiceChat);
 0530        isPromoteChannelsToastVisible.Set(false);
 0531    }
 532
 533    private void CloseVoiceChatWindow()
 534    {
 0535        voiceChatHud?.SetVisibility(false);
 0536        view.ToggleOff(TaskbarHUDView.TaskbarButtonType.VoiceChat);
 0537    }
 538
 539    public void AddPrivateChatWindow(PrivateChatWindowController controller)
 540    {
 1541        if (controller?.View == null)
 542        {
 0543            Debug.LogWarning("AddPrivateChatWindow >>> Private Chat Window doesn't exist yet!");
 0544            return;
 545        }
 546
 1547        if (controller.View.Transform.parent == view.leftWindowContainer)
 0548            return;
 549
 1550        controller.View.Transform.SetParent(view.leftWindowContainer, false);
 1551        notificationViewerTransform?.SetAsLastSibling();
 1552        topNotificationViewerTransform?.SetAsFirstSibling();
 1553        experiencesViewerTransform?.SetAsLastSibling();
 554
 1555        privateChatWindow = controller;
 556
 1557        controller.OnClosed += ToggleOffChatIcon;
 1558    }
 559
 560    public void AddPublicChatChannel(PublicChatWindowController controller)
 561    {
 1562        if (controller?.View == null)
 563        {
 0564            Debug.LogWarning("AddPublicChatChannel >>> Public Chat Window doesn't exist yet!");
 0565            return;
 566        }
 567
 1568        if (controller.View.Transform.parent == view.leftWindowContainer) return;
 569
 1570        controller.View.Transform.SetParent(view.leftWindowContainer, false);
 1571        notificationViewerTransform?.SetAsLastSibling();
 1572        topNotificationViewerTransform?.SetAsFirstSibling();
 1573        experiencesViewerTransform?.SetAsLastSibling();
 574
 1575        publicChatWindow = controller;
 576
 1577        controller.OnClosed += ToggleOffChatIcon;
 1578    }
 579
 580    private void HandlePublicChannelPreviewModeChanged(bool isPreviewMode)
 581    {
 0582        if (!publicChatWindow.View.IsActive) return;
 0583        if (isPreviewMode)
 0584            view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Chat);
 585        else
 0586            view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 0587    }
 588
 589    private void HandleChannelPreviewModeChanged(bool isPreviewMode)
 590    {
 0591        if (!channelChatWindow.View.IsActive) return;
 0592        if (isPreviewMode)
 0593            view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Chat);
 594        else
 0595            view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 0596    }
 597
 598    private void HandlePrivateChannelPreviewMode(bool isPreviewMode)
 599    {
 0600        if (!privateChatWindow.View.IsActive) return;
 0601        if (isPreviewMode)
 0602            view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Chat);
 603        else
 0604            view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 0605    }
 606
 607    public void AddFriendsWindow(FriendsHUDController controller)
 608    {
 3609        if (controller?.View == null)
 610        {
 0611            Debug.LogWarning("AddFriendsWindow >>> Friends window doesn't exist yet!");
 0612            return;
 613        }
 614
 3615        if (controller.View.Transform.parent == view.leftWindowContainer)
 0616            return;
 617
 3618        controller.View.Transform.SetParent(view.leftWindowContainer, false);
 3619        notificationViewerTransform?.SetAsLastSibling();
 3620        topNotificationViewerTransform?.SetAsFirstSibling();
 3621        experiencesViewerTransform?.SetAsLastSibling();
 622
 3623        friendsHud = controller;
 3624        view.ShowFriendsButton();
 3625        friendsHud.OnViewClosed += () =>
 626        {
 0627            view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Friends);
 0628            ToggleOffChatIcon();
 0629        };
 3630    }
 631
 632    public void AddVoiceChatWindow(VoiceChatWindowController controller)
 633    {
 1634        if (controller?.VoiceChatWindowView == null)
 635        {
 1636            Debug.LogWarning("AddVoiceChatWindow >>> Voice Chat window doesn't exist yet!");
 1637            return;
 638        }
 639
 0640        if (controller.VoiceChatWindowView.Transform.parent == view.leftWindowContainer)
 0641            return;
 642
 0643        controller.VoiceChatWindowView.Transform.SetParent(view.leftWindowContainer, false);
 644
 0645        voiceChatHud = controller;
 0646        view.ShowVoiceChatButton();
 0647        voiceChatHud.OnCloseView += () => view.ToggleOff(TaskbarHUDView.TaskbarButtonType.VoiceChat);
 648
 0649        if (controller?.VoiceChatBarView != null)
 650        {
 0651            controller.VoiceChatBarView.Transform.SetParent(view.altSectionContainer, false);
 0652            controller.VoiceChatBarView.Transform.SetAsFirstSibling();
 653        }
 0654    }
 655
 656    private void InitializeEmotesSelector(bool current, bool previous)
 657    {
 8658        if (!current) return;
 0659        view.ShowEmotesButton();
 0660    }
 661
 0662    private void IsEmotesVisibleChanged(bool current, bool previous) => HandleEmotesToggle(current);
 663
 664    private void InitializeExperiencesViewer(Transform currentViewTransform, Transform previousViewTransform)
 665    {
 4666        if (currentViewTransform == null)
 4667            return;
 668
 0669        experiencesViewerTransform = currentViewTransform;
 0670        experiencesViewerTransform.SetParent(view.leftWindowContainer, false);
 0671        experiencesViewerTransform.SetAsLastSibling();
 672
 0673        view.ShowExperiencesButton();
 0674    }
 675
 676    private void InitializeNotificationPanel(Transform currentPanelTransform, Transform previousPanelTransform)
 677    {
 4678        if (currentPanelTransform == null)
 4679            return;
 680
 0681        notificationViewerTransform = currentPanelTransform;
 0682        notificationViewerTransform.SetParent(view.leftWindowContainer, false);
 0683        notificationViewerTransform.SetAsLastSibling();
 0684        experiencesViewerTransform.SetAsLastSibling();
 0685        notificationViewerTransform.GetComponent<MainChatNotificationsComponentView>().OnClickedNotification += OpenClic
 0686    }
 687
 688    private void InitializeTopNotificationPanel(Transform currentPanelTransform, Transform previousPanelTransform)
 689    {
 4690        if (currentPanelTransform == null)
 4691            return;
 692
 0693        topNotificationViewerTransform = currentPanelTransform;
 0694        topNotificationViewerTransform.SetParent(view.leftWindowContainer, false);
 0695        topNotificationViewerTransform.SetAsFirstSibling();
 0696        topNotificationViewerTransform.GetComponent<TopNotificationComponentView>().OnClickedNotification += OpenClicked
 0697    }
 698
 699    private void OpenClickedChat(string chatId)
 700    {
 701        const string nearbyChannelId = "nearby";
 702        const string conversationListId = "conversationList";
 703
 0704        if (chatId == nearbyChannelId)
 0705            OpenPublicChat(nearbyChannelId, true);
 0706        else if (chatController.GetAllocatedChannel(chatId) != null)
 707        {
 0708            if(chatController.GetAllocatedChannel(chatId).Joined)
 0709                OpenChannelChat(chatId);
 710            else
 0711                return;
 712        }
 0713        else if(chatId == conversationListId)
 0714            OpenChatList();
 715        else
 716        {
 0717            if(friendsController.GetUserStatus(chatId).friendshipStatus == FriendshipStatus.FRIEND)
 0718                OpenPrivateChat(chatId);
 719        }
 0720    }
 721
 722    private void IsExperiencesViewerOpenChanged(bool current, bool previous)
 723    {
 0724        if (current)
 0725            return;
 726
 0727        view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Experiences);
 0728        ToggleOffChatIcon();
 0729    }
 730
 731    private void NumOfLoadedExperiencesChanged(int current, int previous)
 732    {
 4733        view.SetExperiencesVisibility(current > 0);
 734
 4735        if (current == 0)
 4736            isExperiencesViewerOpen.Set(false);
 4737    }
 738
 739    public void DisableFriendsWindow()
 740    {
 0741        view.friendsButton.transform.parent.gameObject.SetActive(false);
 0742    }
 743
 744    public void Dispose()
 745    {
 4746        if (view != null)
 747        {
 4748            view.OnChatToggle -= HandleChatToggle;
 4749            view.OnFriendsToggle -= HandleFriendsToggle;
 4750            view.OnEmotesToggle -= HandleEmotesToggle;
 4751            view.OnExperiencesToggle -= HandleExperiencesToggle;
 4752            view.OnVoiceChatToggle -= HandleVoiceChatToggle;
 753
 4754            view.Destroy();
 755        }
 756
 4757        if (mouseCatcher != null)
 758        {
 0759            mouseCatcher.OnMouseLock -= MouseCatcher_OnMouseLock;
 0760            mouseCatcher.OnMouseUnlock -= MouseCatcher_OnMouseUnlock;
 761        }
 762
 4763        if (toggleFriendsTrigger != null)
 4764            toggleFriendsTrigger.OnTriggered -= ToggleFriendsTrigger_OnTriggered;
 765
 4766        if (closeWindowTrigger != null)
 4767            closeWindowTrigger.OnTriggered -= CloseWindowTrigger_OnTriggered;
 768
 4769        if (toggleWorldChatTrigger != null)
 4770            toggleWorldChatTrigger.OnTriggered -= ToggleWorldChatTrigger_OnTriggered;
 771
 4772        isEmotesWheelInitialized.OnChange -= InitializeEmotesSelector;
 4773        isEmotesVisible.OnChange -= IsEmotesVisibleChanged;
 4774        isExperiencesViewerOpen.OnChange -= IsExperiencesViewerOpenChanged;
 4775        isExperiencesViewerInitialized.OnChange -= InitializeExperiencesViewer;
 4776        numOfLoadedExperiences.OnChange -= NumOfLoadedExperiencesChanged;
 4777    }
 778
 779    private void SetVisibility(bool visible, bool previus)
 780    {
 0781        SetVisibility(visible);
 0782    }
 783
 784    public void SetVisibility(bool visible)
 785    {
 1786        view.SetVisibility(visible);
 1787    }
 788
 789    public void GoBackFromChat()
 790    {
 0791        if (chatBackWindow == friendsHud)
 0792            OpenFriendsWindow();
 793        else
 0794            OpenChatList();
 0795    }
 796
 797    public void AddChatChannel(ChatChannelHUDController controller)
 798    {
 0799        if (controller?.View == null)
 800        {
 0801            Debug.LogWarning("AddChatChannel >>> Chat Window doesn't exist yet!");
 0802            return;
 803        }
 804
 0805        if (controller.View.Transform.parent == view.leftWindowContainer) return;
 806
 0807        controller.View.Transform.SetParent(view.leftWindowContainer, false);
 0808        experiencesViewerTransform?.SetAsLastSibling();
 809
 0810        channelChatWindow = controller;
 811
 0812        controller.OnClosed += ToggleOffChatIcon;
 0813        controller.OnOpenChannelLeave += OpenChannelLeaveConfirmation;
 0814    }
 815
 816    public void AddChannelSearch(SearchChannelsWindowController controller)
 817    {
 1818        if (controller.View.Transform.parent == view.leftWindowContainer) return;
 819
 1820        controller.View.Transform.SetParent(view.leftWindowContainer, false);
 1821        experiencesViewerTransform?.SetAsLastSibling();
 822
 1823        searchChannelsHud = controller;
 824
 1825        controller.OnClosed += () =>
 826        {
 0827            controller.SetVisibility(false);
 0828            ToggleOffChatIcon();
 0829        };
 1830        controller.OnBack += GoBackFromChat;
 1831        controller.OnOpenChannelCreation += OpenChannelCreation;
 1832        controller.OnOpenChannelLeave += OpenChannelLeaveConfirmation;
 1833    }
 834
 835    public void AddChannelCreation(CreateChannelWindowController controller)
 836    {
 0837        if (controller.View.Transform.parent == view.fullScreenWindowContainer) return;
 838
 0839        controller.View.Transform.SetParent(view.fullScreenWindowContainer, false);
 0840        experiencesViewerTransform?.SetAsLastSibling();
 841
 0842        channelCreationWindow = controller;
 843
 0844        controller.OnNavigateToChannelWindow += channelId =>
 845        {
 0846            OpenChannelChat(channelId);
 0847            channelCreationWindow.SetVisibility(false);
 0848        };
 0849    }
 850
 851    private void OpenChannelCreation()
 852    {
 0853        channelCreationWindow.SetVisibility(true);
 0854    }
 855
 856    public void AddChannelLeaveConfirmation(LeaveChannelConfirmationWindowController controller)
 857    {
 0858        if (controller.View.Transform.parent == view.fullScreenWindowContainer) return;
 859
 0860        controller.View.Transform.SetParent(view.fullScreenWindowContainer, false);
 0861        channelLeaveWindow = controller;
 0862    }
 863
 864    private void OpenChannelLeaveConfirmation(string channelId)
 865    {
 0866        channelLeaveWindow.SetChannelToLeave(channelId);
 0867        channelLeaveWindow.SetVisibility(true);
 0868    }
 869
 870    public void OpenChannelSearch()
 871    {
 0872        privateChatWindow.SetVisibility(false);
 0873        publicChatWindow.SetVisibility(false);
 0874        channelChatWindow.SetVisibility(false);
 0875        searchChannelsHud.SetVisibility(true);
 0876        friendsHud?.SetVisibility(false);
 0877        isExperiencesViewerOpen.Set(false);
 0878        isEmotesVisible.Set(false);
 0879        voiceChatHud?.SetVisibility(false);
 0880        worldChatWindowHud.SetVisibility(false);
 0881        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 0882    }
 883}

Methods/Properties

socialTooltipReference()
isEmotesWheelInitialized()
isEmotesVisible()
emoteJustTriggeredFromShortcut()
isExperiencesViewerInitialized()
notificationPanelTransform()
topNotificationPanelTransform()
isExperiencesViewerOpen()
numOfLoadedExperiences()
openPrivateChat()
openedChat()
isPromoteChannelsToastVisible()
TaskbarHUDController(IChatController, DCL.Social.Friends.IFriendsController)
CreateView()
Initialize(DCL.IMouseCatcher)
HandleFriendsToggle(System.Boolean)
HandleEmotesToggle(System.Boolean)
ShowEmotes()
HandleExperiencesToggle(System.Boolean)
HandleVoiceChatToggle(System.Boolean)
ShowExperiences()
ToggleFriendsTrigger_OnTriggered(DCLAction_Trigger)
ToggleWorldChatTrigger_OnTriggered(DCLAction_Trigger)
CloseWindowTrigger_OnTriggered(DCLAction_Trigger)
HandleChatToggle(System.Boolean)
MouseCatcher_OnMouseUnlock()
MouseCatcher_OnMouseLock()
AddWorldChatWindow(WorldChatWindowController)
ToggleOffChatIcon()
OpenFriendsWindow()
CloseFriendsWindow()
OpenPrivateChatFromPassport(System.String, System.String)
OpenPrivateChat(System.String)
OpenLastActiveChatWindow(IHUD)
OpenWorldChatWindow()
CloseAnyChatWindow()
OpenChannelChat(System.String)
OpenPublicChat(System.String, System.Boolean)
OpenChatList()
CloseChatList()
OpenVoiceChatWindow()
CloseVoiceChatWindow()
AddPrivateChatWindow(PrivateChatWindowController)
AddPublicChatChannel(DCL.Chat.HUD.PublicChatWindowController)
HandlePublicChannelPreviewModeChanged(System.Boolean)
HandleChannelPreviewModeChanged(System.Boolean)
HandlePrivateChannelPreviewMode(System.Boolean)
AddFriendsWindow(FriendsHUDController)
AddVoiceChatWindow(VoiceChatWindowController)
InitializeEmotesSelector(System.Boolean, System.Boolean)
IsEmotesVisibleChanged(System.Boolean, System.Boolean)
InitializeExperiencesViewer(UnityEngine.Transform, UnityEngine.Transform)
InitializeNotificationPanel(UnityEngine.Transform, UnityEngine.Transform)
InitializeTopNotificationPanel(UnityEngine.Transform, UnityEngine.Transform)
OpenClickedChat(System.String)
IsExperiencesViewerOpenChanged(System.Boolean, System.Boolean)
NumOfLoadedExperiencesChanged(System.Int32, System.Int32)
DisableFriendsWindow()
Dispose()
SetVisibility(System.Boolean, System.Boolean)
SetVisibility(System.Boolean)
GoBackFromChat()
AddChatChannel(DCL.Chat.HUD.ChatChannelHUDController)
AddChannelSearch(DCL.Chat.HUD.SearchChannelsWindowController)
AddChannelCreation(DCL.Chat.HUD.CreateChannelWindowController)
OpenChannelCreation()
AddChannelLeaveConfirmation(DCL.Chat.HUD.LeaveChannelConfirmationWindowController)
OpenChannelLeaveConfirmation(System.String)
OpenChannelSearch()