< Summary

Class:TaskbarHUDController
Assembly:TaskbarHUD
File(s):/tmp/workspace/unity-renderer/unity-renderer/Assets/Scripts/MainScripts/DCL/Controllers/HUD/TaskbarHUD/TaskbarHUDController.cs
Covered lines:175
Uncovered lines:324
Coverable lines:499
Total lines:871
Line coverage:35% (175 of 499)
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%220100%
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.213071.43%
MouseCatcher_OnMouseUnlock()0%2100%
MouseCatcher_OnMouseLock()0%20400%
AddWorldChatWindow(...)0%8.518080%
ToggleOffChatIcon()0%110100%
OpenFriendsWindow()0%440100%
CloseFriendsWindow()0%6200%
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%660100%
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 TMPro;
 6using UnityEngine;
 7using UnityEngine.EventSystems;
 8
 9public class TaskbarHUDController : IHUD
 10{
 11    private readonly IChatController chatController;
 12    private readonly IFriendsController friendsController;
 13
 14    [Serializable]
 15    public struct Configuration
 16    {
 17        public bool enableVoiceChat;
 18        public bool enableQuestPanel;
 19    }
 20
 21    public TaskbarHUDView view;
 22    public WorldChatWindowController worldChatWindowHud;
 23    public PrivateChatWindowController privateChatWindow;
 24    public PublicChatWindowController publicChatWindow;
 25    public ChatChannelHUDController channelChatWindow;
 26    public FriendsHUDController friendsHud;
 27    public VoiceChatWindowController voiceChatHud;
 28
 29    private IMouseCatcher mouseCatcher;
 30    private InputAction_Trigger toggleFriendsTrigger;
 31    private InputAction_Trigger closeWindowTrigger;
 32    private InputAction_Trigger toggleWorldChatTrigger;
 33    private Transform experiencesViewerTransform;
 34    private Transform notificationViewerTransform;
 35    private Transform topNotificationViewerTransform;
 36    private IHUD chatToggleTargetWindow;
 37    private IHUD chatInputTargetWindow;
 38    private IHUD chatBackWindow;
 39    private SearchChannelsWindowController searchChannelsHud;
 40    private CreateChannelWindowController channelCreationWindow;
 41    private LeaveChannelConfirmationWindowController channelLeaveWindow;
 42
 43    public event Action OnAnyTaskbarButtonClicked;
 44
 045    public RectTransform socialTooltipReference => view.socialTooltipReference;
 46
 1247    internal BaseVariable<bool> isEmotesWheelInitialized => DataStore.i.emotesCustomization.isWheelInitialized;
 1148    internal BaseVariable<bool> isEmotesVisible => DataStore.i.HUDs.emotesVisible;
 049    internal BaseVariable<bool> emoteJustTriggeredFromShortcut => DataStore.i.HUDs.emoteJustTriggeredFromShortcut;
 1250    internal BaseVariable<Transform> isExperiencesViewerInitialized => DataStore.i.experiencesViewer.isInitialized;
 851    internal BaseVariable<Transform> notificationPanelTransform => DataStore.i.HUDs.notificationPanelTransform;
 852    internal BaseVariable<Transform> topNotificationPanelTransform => DataStore.i.HUDs.topNotificationPanelTransform;
 1553    internal BaseVariable<bool> isExperiencesViewerOpen => DataStore.i.experiencesViewer.isOpen;
 1254    internal BaseVariable<int> numOfLoadedExperiences => DataStore.i.experiencesViewer.numOfLoadedExperiences;
 055    internal BaseVariable<string> openedChat => DataStore.i.HUDs.openedChat;
 356    internal BaseVariable<bool> isPromoteChannelsToastVisible => DataStore.i.channels.isPromoteToastVisible;
 57
 458    public TaskbarHUDController(IChatController chatController, IFriendsController friendsController)
 59    {
 460        this.chatController = chatController;
 461        this.friendsController = friendsController;
 462    }
 63
 64    protected virtual TaskbarHUDView CreateView()
 65    {
 466        return TaskbarHUDView.Create();
 67    }
 68
 69    public void Initialize(IMouseCatcher mouseCatcher)
 70    {
 471        this.mouseCatcher = mouseCatcher;
 72
 473        view = CreateView();
 74
 475        if (mouseCatcher != null)
 76        {
 177            mouseCatcher.OnMouseLock -= MouseCatcher_OnMouseLock;
 178            mouseCatcher.OnMouseUnlock -= MouseCatcher_OnMouseUnlock;
 179            mouseCatcher.OnMouseLock += MouseCatcher_OnMouseLock;
 180            mouseCatcher.OnMouseUnlock += MouseCatcher_OnMouseUnlock;
 81        }
 82
 483        view.leftWindowContainerLayout.enabled = false;
 84
 485        view.OnChatToggle += HandleChatToggle;
 486        view.OnFriendsToggle += HandleFriendsToggle;
 487        view.OnEmotesToggle += HandleEmotesToggle;
 488        view.OnExperiencesToggle += HandleExperiencesToggle;
 489        view.OnVoiceChatToggle += HandleVoiceChatToggle;
 90
 491        toggleFriendsTrigger = Resources.Load<InputAction_Trigger>("ToggleFriends");
 492        toggleFriendsTrigger.OnTriggered -= ToggleFriendsTrigger_OnTriggered;
 493        toggleFriendsTrigger.OnTriggered += ToggleFriendsTrigger_OnTriggered;
 94
 495        closeWindowTrigger = Resources.Load<InputAction_Trigger>("CloseWindow");
 496        closeWindowTrigger.OnTriggered -= CloseWindowTrigger_OnTriggered;
 497        closeWindowTrigger.OnTriggered += CloseWindowTrigger_OnTriggered;
 98
 499        toggleWorldChatTrigger = Resources.Load<InputAction_Trigger>("ToggleWorldChat");
 4100        toggleWorldChatTrigger.OnTriggered -= ToggleWorldChatTrigger_OnTriggered;
 4101        toggleWorldChatTrigger.OnTriggered += ToggleWorldChatTrigger_OnTriggered;
 102
 4103        isEmotesWheelInitialized.OnChange += InitializeEmotesSelector;
 4104        InitializeEmotesSelector(isEmotesWheelInitialized.Get(), false);
 4105        isEmotesVisible.OnChange += IsEmotesVisibleChanged;
 106
 4107        isExperiencesViewerOpen.OnChange += IsExperiencesViewerOpenChanged;
 108
 4109        view.leftWindowContainerAnimator.Show();
 110
 4111        CommonScriptableObjects.isTaskbarHUDInitialized.Set(true);
 4112        DataStore.i.builderInWorld.showTaskBar.OnChange += SetVisibility;
 113
 4114        isExperiencesViewerInitialized.OnChange += InitializeExperiencesViewer;
 4115        InitializeExperiencesViewer(isExperiencesViewerInitialized.Get(), null);
 116
 4117        notificationPanelTransform.OnChange += InitializeNotificationPanel;
 4118        InitializeNotificationPanel(notificationPanelTransform.Get(), null);
 119
 4120        topNotificationPanelTransform.OnChange += InitializeTopNotificationPanel;
 4121        InitializeTopNotificationPanel(topNotificationPanelTransform.Get(), null);
 122
 4123        numOfLoadedExperiences.OnChange += NumOfLoadedExperiencesChanged;
 4124        NumOfLoadedExperiencesChanged(numOfLoadedExperiences.Get(), 0);
 4125    }
 126
 127    private void HandleFriendsToggle(bool show)
 128    {
 3129        if (show)
 2130            OpenFriendsWindow();
 131        else
 132        {
 1133            friendsHud?.SetVisibility(false);
 1134            ToggleOffChatIcon();
 135        }
 136
 3137        OnAnyTaskbarButtonClicked?.Invoke();
 0138    }
 139
 140    private void HandleEmotesToggle(bool show)
 141    {
 0142        if (show && emoteJustTriggeredFromShortcut.Get())
 143        {
 0144            emoteJustTriggeredFromShortcut.Set(false);
 0145            return;
 146        }
 147
 0148        if (show)
 149        {
 0150            ToggleOffChatIcon();
 0151            ShowEmotes();
 0152        }
 153        else
 154        {
 0155            view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Emotes);
 0156            isEmotesVisible.Set(false);
 0157            ToggleOffChatIcon();
 158        }
 159
 0160        OnAnyTaskbarButtonClicked?.Invoke();
 0161    }
 162
 163    private void ShowEmotes()
 164    {
 0165        worldChatWindowHud.SetVisibility(false);
 0166        privateChatWindow.SetVisibility(false);
 0167        channelChatWindow.SetVisibility(false);
 0168        friendsHud?.SetVisibility(false);
 0169        searchChannelsHud.SetVisibility(false);
 0170        isExperiencesViewerOpen.Set(false);
 0171        voiceChatHud?.SetVisibility(false);
 0172        isEmotesVisible.Set(true);
 0173        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Emotes);
 0174    }
 175
 176    private void HandleExperiencesToggle(bool show)
 177    {
 0178        if (show)
 0179            ShowExperiences();
 180        else
 181        {
 0182            isExperiencesViewerOpen.Set(false);
 0183            ToggleOffChatIcon();
 184        }
 185
 0186        OnAnyTaskbarButtonClicked?.Invoke();
 0187    }
 188
 189    private void HandleVoiceChatToggle(bool show)
 190    {
 0191        if (show)
 0192            OpenVoiceChatWindow();
 193        else
 0194            voiceChatHud?.SetVisibility(false);
 0195        OnAnyTaskbarButtonClicked?.Invoke();
 0196    }
 197
 198    private void ShowExperiences()
 199    {
 0200        worldChatWindowHud.SetVisibility(false);
 0201        privateChatWindow.SetVisibility(false);
 0202        publicChatWindow.SetVisibility(false);
 0203        channelChatWindow.SetVisibility(false);
 0204        searchChannelsHud.SetVisibility(false);
 0205        friendsHud?.SetVisibility(false);
 0206        isEmotesVisible.Set(false);
 0207        voiceChatHud?.SetVisibility(false);
 0208        isExperiencesViewerOpen.Set(true);
 0209        isPromoteChannelsToastVisible.Set(false);
 0210    }
 211
 212    private void ToggleFriendsTrigger_OnTriggered(DCLAction_Trigger action)
 213    {
 0214        if (friendsHud == null) return;
 215
 0216        bool anyInputFieldIsSelected = EventSystem.current != null &&
 217                                       EventSystem.current.currentSelectedGameObject != null &&
 218                                       EventSystem.current.currentSelectedGameObject.GetComponent<TMP_InputField>() !=
 219                                       null;
 220
 0221        if (anyInputFieldIsSelected) return;
 222
 0223        mouseCatcher.UnlockCursor();
 224
 0225        if (!friendsHud.View.IsActive())
 226        {
 0227            view.leftWindowContainerAnimator.Show();
 0228            OpenFriendsWindow();
 0229        }
 230        else
 231        {
 0232            CloseFriendsWindow();
 0233            ToggleOffChatIcon();
 234        }
 0235    }
 236
 237    private void ToggleWorldChatTrigger_OnTriggered(DCLAction_Trigger action)
 238    {
 0239        bool anyInputFieldIsSelected = EventSystem.current != null &&
 240                                       EventSystem.current.currentSelectedGameObject != null &&
 241                                       EventSystem.current.currentSelectedGameObject.GetComponent<TMP_InputField>() !=
 242                                       null;
 243
 0244        if (anyInputFieldIsSelected) return;
 245
 0246        mouseCatcher.UnlockCursor();
 0247        chatBackWindow = worldChatWindowHud;
 248
 0249        if (!worldChatWindowHud.View.IsActive
 250            && !privateChatWindow.View.IsActive
 251            && !publicChatWindow.View.IsActive)
 0252            OpenLastActiveChatWindow(chatInputTargetWindow);
 0253    }
 254
 255    private void CloseWindowTrigger_OnTriggered(DCLAction_Trigger action)
 256    {
 0257        if (mouseCatcher.isLocked) return;
 258
 0259        if (publicChatWindow.View.IsActive ||
 260            channelChatWindow.View.IsActive ||
 261            privateChatWindow.View.IsActive)
 262        {
 0263            publicChatWindow.SetVisibility(false);
 0264            worldChatWindowHud.SetVisibility(true);
 0265            chatToggleTargetWindow = worldChatWindowHud;
 0266            chatInputTargetWindow = publicChatWindow;
 0267        }
 268        else
 269        {
 0270            worldChatWindowHud.SetVisibility(false);
 0271            view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Chat);
 272        }
 273
 0274        publicChatWindow.SetVisibility(false);
 0275        privateChatWindow.SetVisibility(false);
 0276        channelChatWindow.SetVisibility(false);
 0277        CloseFriendsWindow();
 0278        CloseVoiceChatWindow();
 0279        isEmotesVisible.Set(false);
 0280        isExperiencesViewerOpen.Set(false);
 0281    }
 282
 283    private void HandleChatToggle(bool show)
 284    {
 1285        if (show)
 286        {
 1287            chatBackWindow = worldChatWindowHud;
 1288            OpenWorldChatWindow();
 1289        }
 290        else
 291        {
 0292            CloseAnyChatWindow();
 293        }
 294
 1295        OnAnyTaskbarButtonClicked?.Invoke();
 0296    }
 297
 298    private void MouseCatcher_OnMouseUnlock()
 299    {
 0300    }
 301
 302    private void MouseCatcher_OnMouseLock()
 303    {
 0304        CloseFriendsWindow();
 0305        CloseChatList();
 0306        CloseVoiceChatWindow();
 0307        isExperiencesViewerOpen.Set(false);
 308
 0309        if (!privateChatWindow.View.IsActive
 310            && !publicChatWindow.View.IsActive
 311            && !channelChatWindow.View.IsActive)
 0312            ToggleOffChatIcon();
 0313    }
 314
 315    public void AddWorldChatWindow(WorldChatWindowController controller)
 316    {
 2317        if (controller?.View == null)
 318        {
 0319            Debug.LogWarning("AddChatWindow >>> World Chat Window doesn't exist yet!");
 0320            return;
 321        }
 322
 2323        if (controller.View.Transform.parent == view.leftWindowContainer) return;
 324
 2325        controller.View.Transform.SetParent(view.leftWindowContainer, false);
 2326        notificationViewerTransform?.SetAsLastSibling();
 2327        topNotificationViewerTransform?.SetAsFirstSibling();
 2328        experiencesViewerTransform?.SetAsLastSibling();
 329
 2330        worldChatWindowHud = controller;
 331
 2332        view.ShowChatButton();
 2333        worldChatWindowHud.OnCloseView += ToggleOffChatIcon;
 2334        worldChatWindowHud.OnOpenChannelCreation += OpenChannelCreation;
 2335        worldChatWindowHud.OnOpenChannelLeave += OpenChannelLeaveConfirmation;
 2336    }
 337
 1338    private void ToggleOffChatIcon() => view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Chat);
 339
 340    private void OpenFriendsWindow()
 341    {
 2342        worldChatWindowHud.SetVisibility(false);
 2343        privateChatWindow.SetVisibility(false);
 2344        publicChatWindow.SetVisibility(false);
 2345        channelChatWindow?.SetVisibility(false);
 2346        searchChannelsHud.SetVisibility(false);
 2347        isExperiencesViewerOpen.Set(false);
 2348        isEmotesVisible.Set(false);
 2349        voiceChatHud?.SetVisibility(false);
 2350        friendsHud?.SetVisibility(true);
 2351        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Friends);
 2352        chatBackWindow = friendsHud;
 2353        isPromoteChannelsToastVisible.Set(false);
 2354    }
 355
 356    private void CloseFriendsWindow()
 357    {
 0358        friendsHud?.SetVisibility(false);
 0359        view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Friends);
 0360    }
 361
 362    public void OpenPrivateChat(string userId)
 363    {
 0364        worldChatWindowHud.SetVisibility(false);
 0365        publicChatWindow.SetVisibility(false);
 0366        channelChatWindow.SetVisibility(false);
 0367        searchChannelsHud.SetVisibility(false);
 0368        friendsHud?.SetVisibility(false);
 0369        isExperiencesViewerOpen.Set(false);
 0370        isEmotesVisible.Set(false);
 0371        voiceChatHud?.SetVisibility(false);
 0372        openedChat.Set(userId);
 0373        privateChatWindow.Setup(userId);
 0374        privateChatWindow.SetVisibility(true);
 0375        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 0376        chatToggleTargetWindow = worldChatWindowHud;
 0377        chatInputTargetWindow = privateChatWindow;
 0378    }
 379
 380    private IHUD OpenLastActiveChatWindow(IHUD lastActiveWindow)
 381    {
 0382        worldChatWindowHud.SetVisibility(false);
 0383        privateChatWindow.SetVisibility(false);
 0384        publicChatWindow.SetVisibility(false);
 0385        channelChatWindow?.SetVisibility(false);
 0386        searchChannelsHud.SetVisibility(false);
 0387        friendsHud?.SetVisibility(false);
 0388        isEmotesVisible.Set(false);
 0389        isExperiencesViewerOpen.Set(false);
 0390        voiceChatHud?.SetVisibility(false);
 0391        isPromoteChannelsToastVisible.Set(false);
 392
 393        IHUD visibleWindow;
 394
 0395        if (lastActiveWindow == publicChatWindow)
 396        {
 0397            publicChatWindow.SetVisibility(true, true);
 0398            visibleWindow = publicChatWindow;
 0399        }
 0400        else if (lastActiveWindow != null)
 401        {
 0402            lastActiveWindow.SetVisibility(true);
 0403            visibleWindow = lastActiveWindow;
 0404        }
 405        else
 406        {
 0407            publicChatWindow.SetVisibility(true, true);
 0408            visibleWindow = publicChatWindow;
 409        }
 410
 0411        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 412
 0413        return visibleWindow;
 414    }
 415
 416    private void OpenWorldChatWindow()
 417    {
 1418        privateChatWindow.SetVisibility(false);
 1419        publicChatWindow.SetVisibility(false);
 1420        channelChatWindow?.SetVisibility(false);
 1421        searchChannelsHud.SetVisibility(false);
 1422        friendsHud?.SetVisibility(false);
 1423        isEmotesVisible.Set(false);
 1424        isExperiencesViewerOpen.Set(false);
 1425        voiceChatHud?.SetVisibility(false);
 1426        isPromoteChannelsToastVisible.Set(false);
 1427        worldChatWindowHud.SetVisibility(true);
 1428        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 1429    }
 430
 431    private void CloseAnyChatWindow()
 432    {
 0433        worldChatWindowHud.SetVisibility(false);
 0434        privateChatWindow.SetVisibility(false);
 0435        publicChatWindow.SetVisibility(false);
 0436        channelChatWindow.SetVisibility(false);
 0437        searchChannelsHud.SetVisibility(false);
 0438        view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Chat);
 0439    }
 440
 441    public void OpenChannelChat(string channelId)
 442    {
 0443        openedChat.Set(channelId);
 0444        channelChatWindow?.Setup(channelId);
 0445        channelChatWindow?.SetVisibility(true);
 0446        publicChatWindow?.SetVisibility(false);
 0447        worldChatWindowHud?.SetVisibility(false);
 0448        privateChatWindow?.SetVisibility(false);
 0449        searchChannelsHud.SetVisibility(false);
 0450        friendsHud?.SetVisibility(false);
 0451        isExperiencesViewerOpen?.Set(false);
 0452        isEmotesVisible?.Set(false);
 0453        voiceChatHud?.SetVisibility(false);
 454
 0455        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 456
 0457        chatToggleTargetWindow = worldChatWindowHud;
 0458        chatInputTargetWindow = channelChatWindow;
 0459    }
 460
 461
 462    public void OpenPublicChat(string channelId, bool focusInputField)
 463    {
 0464        openedChat.Set(channelId);
 0465        publicChatWindow?.Setup(channelId);
 0466        publicChatWindow?.SetVisibility(true, focusInputField);
 0467        channelChatWindow?.SetVisibility(false);
 0468        worldChatWindowHud?.SetVisibility(false);
 0469        privateChatWindow?.SetVisibility(false);
 0470        searchChannelsHud?.SetVisibility(false);
 0471        friendsHud?.SetVisibility(false);
 0472        isExperiencesViewerOpen?.Set(false);
 0473        isEmotesVisible?.Set(false);
 0474        voiceChatHud?.SetVisibility(false);
 475
 0476        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 477
 0478        chatToggleTargetWindow = worldChatWindowHud;
 0479        chatInputTargetWindow = publicChatWindow;
 0480    }
 481
 482    private void OpenChatList()
 483    {
 0484        privateChatWindow.SetVisibility(false);
 0485        publicChatWindow.SetVisibility(false);
 0486        channelChatWindow.SetVisibility(false);
 0487        searchChannelsHud.SetVisibility(false);
 0488        friendsHud?.SetVisibility(false);
 0489        isExperiencesViewerOpen.Set(false);
 0490        isEmotesVisible.Set(false);
 0491        voiceChatHud?.SetVisibility(false);
 0492        worldChatWindowHud.SetVisibility(true);
 0493        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 494
 0495        chatToggleTargetWindow = worldChatWindowHud;
 0496    }
 497
 498    private void CloseChatList()
 499    {
 0500        if (!worldChatWindowHud.View.IsActive) return;
 0501        worldChatWindowHud.SetVisibility(false);
 0502        view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Chat);
 0503    }
 504
 505    private void OpenVoiceChatWindow()
 506    {
 0507        worldChatWindowHud.SetVisibility(false);
 0508        privateChatWindow.SetVisibility(false);
 0509        publicChatWindow.SetVisibility(false);
 0510        channelChatWindow.SetVisibility(false);
 0511        searchChannelsHud.SetVisibility(false);
 0512        isExperiencesViewerOpen.Set(false);
 0513        isEmotesVisible.Set(false);
 0514        friendsHud?.SetVisibility(false);
 0515        voiceChatHud?.SetVisibility(true);
 0516        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.VoiceChat);
 0517        isPromoteChannelsToastVisible.Set(false);
 0518    }
 519
 520    private void CloseVoiceChatWindow()
 521    {
 0522        voiceChatHud?.SetVisibility(false);
 0523        view.ToggleOff(TaskbarHUDView.TaskbarButtonType.VoiceChat);
 0524    }
 525
 526    public void AddPrivateChatWindow(PrivateChatWindowController controller)
 527    {
 1528        if (controller?.View == null)
 529        {
 0530            Debug.LogWarning("AddPrivateChatWindow >>> Private Chat Window doesn't exist yet!");
 0531            return;
 532        }
 533
 1534        if (controller.View.Transform.parent == view.leftWindowContainer)
 0535            return;
 536
 1537        controller.View.Transform.SetParent(view.leftWindowContainer, false);
 1538        notificationViewerTransform?.SetAsLastSibling();
 1539        topNotificationViewerTransform?.SetAsFirstSibling();
 1540        experiencesViewerTransform?.SetAsLastSibling();
 541
 1542        privateChatWindow = controller;
 543
 1544        controller.OnClosed += ToggleOffChatIcon;
 1545    }
 546
 547    public void AddPublicChatChannel(PublicChatWindowController controller)
 548    {
 1549        if (controller?.View == null)
 550        {
 0551            Debug.LogWarning("AddPublicChatChannel >>> Public Chat Window doesn't exist yet!");
 0552            return;
 553        }
 554
 1555        if (controller.View.Transform.parent == view.leftWindowContainer) return;
 556
 1557        controller.View.Transform.SetParent(view.leftWindowContainer, false);
 1558        notificationViewerTransform?.SetAsLastSibling();
 1559        topNotificationViewerTransform?.SetAsFirstSibling();
 1560        experiencesViewerTransform?.SetAsLastSibling();
 561
 1562        publicChatWindow = controller;
 563
 1564        controller.OnClosed += ToggleOffChatIcon;
 1565    }
 566
 567    private void HandlePublicChannelPreviewModeChanged(bool isPreviewMode)
 568    {
 0569        if (!publicChatWindow.View.IsActive) return;
 0570        if (isPreviewMode)
 0571            view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Chat);
 572        else
 0573            view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 0574    }
 575
 576    private void HandleChannelPreviewModeChanged(bool isPreviewMode)
 577    {
 0578        if (!channelChatWindow.View.IsActive) return;
 0579        if (isPreviewMode)
 0580            view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Chat);
 581        else
 0582            view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 0583    }
 584
 585    private void HandlePrivateChannelPreviewMode(bool isPreviewMode)
 586    {
 0587        if (!privateChatWindow.View.IsActive) return;
 0588        if (isPreviewMode)
 0589            view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Chat);
 590        else
 0591            view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 0592    }
 593
 594    public void AddFriendsWindow(FriendsHUDController controller)
 595    {
 3596        if (controller?.View == null)
 597        {
 0598            Debug.LogWarning("AddFriendsWindow >>> Friends window doesn't exist yet!");
 0599            return;
 600        }
 601
 3602        if (controller.View.Transform.parent == view.leftWindowContainer)
 0603            return;
 604
 3605        controller.View.Transform.SetParent(view.leftWindowContainer, false);
 3606        notificationViewerTransform?.SetAsLastSibling();
 3607        topNotificationViewerTransform?.SetAsFirstSibling();
 3608        experiencesViewerTransform?.SetAsLastSibling();
 609
 3610        friendsHud = controller;
 3611        view.ShowFriendsButton();
 3612        friendsHud.OnViewClosed += () =>
 613        {
 0614            view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Friends);
 0615            ToggleOffChatIcon();
 0616        };
 3617    }
 618
 619    public void AddVoiceChatWindow(VoiceChatWindowController controller)
 620    {
 1621        if (controller?.VoiceChatWindowView == null)
 622        {
 1623            Debug.LogWarning("AddVoiceChatWindow >>> Voice Chat window doesn't exist yet!");
 1624            return;
 625        }
 626
 0627        if (controller.VoiceChatWindowView.Transform.parent == view.leftWindowContainer)
 0628            return;
 629
 0630        controller.VoiceChatWindowView.Transform.SetParent(view.leftWindowContainer, false);
 631
 0632        voiceChatHud = controller;
 0633        view.ShowVoiceChatButton();
 0634        voiceChatHud.OnCloseView += () => view.ToggleOff(TaskbarHUDView.TaskbarButtonType.VoiceChat);
 635
 0636        if (controller?.VoiceChatBarView != null)
 637        {
 0638            controller.VoiceChatBarView.Transform.SetParent(view.altSectionContainer, false);
 0639            controller.VoiceChatBarView.Transform.SetAsFirstSibling();
 640        }
 0641    }
 642
 643    private void InitializeEmotesSelector(bool current, bool previous)
 644    {
 8645        if (!current) return;
 0646        view.ShowEmotesButton();
 0647    }
 648
 0649    private void IsEmotesVisibleChanged(bool current, bool previous) => HandleEmotesToggle(current);
 650
 651    private void InitializeExperiencesViewer(Transform currentViewTransform, Transform previousViewTransform)
 652    {
 4653        if (currentViewTransform == null)
 4654            return;
 655
 0656        experiencesViewerTransform = currentViewTransform;
 0657        experiencesViewerTransform.SetParent(view.leftWindowContainer, false);
 0658        experiencesViewerTransform.SetAsLastSibling();
 659
 0660        view.ShowExperiencesButton();
 0661    }
 662
 663    private void InitializeNotificationPanel(Transform currentPanelTransform, Transform previousPanelTransform)
 664    {
 4665        if (currentPanelTransform == null)
 4666            return;
 667
 0668        notificationViewerTransform = currentPanelTransform;
 0669        notificationViewerTransform.SetParent(view.leftWindowContainer, false);
 0670        notificationViewerTransform.SetAsLastSibling();
 0671        experiencesViewerTransform.SetAsLastSibling();
 0672        notificationViewerTransform.GetComponent<MainChatNotificationsComponentView>().OnClickedNotification += OpenClic
 0673    }
 674
 675    private void InitializeTopNotificationPanel(Transform currentPanelTransform, Transform previousPanelTransform)
 676    {
 4677        if (currentPanelTransform == null)
 4678            return;
 679
 0680        topNotificationViewerTransform = currentPanelTransform;
 0681        topNotificationViewerTransform.SetParent(view.leftWindowContainer, false);
 0682        topNotificationViewerTransform.SetAsFirstSibling();
 0683        topNotificationViewerTransform.GetComponent<TopNotificationComponentView>().OnClickedNotification += OpenClicked
 0684    }
 685
 686    private void OpenClickedChat(string chatId)
 687    {
 688        const string nearbyChannelId = "nearby";
 689        const string conversationListId = "conversationList";
 690
 0691        if (chatId == nearbyChannelId)
 0692            OpenPublicChat(nearbyChannelId, true);
 0693        else if (chatController.GetAllocatedChannel(chatId) != null)
 694        {
 0695            if(chatController.GetAllocatedChannel(chatId).Joined)
 0696                OpenChannelChat(chatId);
 697            else
 0698                return;
 699        }
 0700        else if(chatId == conversationListId)
 0701            OpenChatList();
 702        else
 703        {
 0704            if(friendsController.GetUserStatus(chatId).friendshipStatus == FriendshipStatus.FRIEND)
 0705                OpenPrivateChat(chatId);
 706        }
 0707    }
 708
 709    private void IsExperiencesViewerOpenChanged(bool current, bool previous)
 710    {
 0711        if (current)
 0712            return;
 713
 0714        view.ToggleOff(TaskbarHUDView.TaskbarButtonType.Experiences);
 0715        ToggleOffChatIcon();
 0716    }
 717
 718    private void NumOfLoadedExperiencesChanged(int current, int previous)
 719    {
 4720        view.SetExperiencesVisibility(current > 0);
 721
 4722        if (current == 0)
 4723            isExperiencesViewerOpen.Set(false);
 4724    }
 725
 726    public void DisableFriendsWindow()
 727    {
 0728        view.friendsButton.transform.parent.gameObject.SetActive(false);
 0729    }
 730
 731    public void Dispose()
 732    {
 4733        if (view != null)
 734        {
 4735            view.OnChatToggle -= HandleChatToggle;
 4736            view.OnFriendsToggle -= HandleFriendsToggle;
 4737            view.OnEmotesToggle -= HandleEmotesToggle;
 4738            view.OnExperiencesToggle -= HandleExperiencesToggle;
 4739            view.OnVoiceChatToggle -= HandleVoiceChatToggle;
 740
 4741            view.Destroy();
 742        }
 743
 4744        if (mouseCatcher != null)
 745        {
 1746            mouseCatcher.OnMouseLock -= MouseCatcher_OnMouseLock;
 1747            mouseCatcher.OnMouseUnlock -= MouseCatcher_OnMouseUnlock;
 748        }
 749
 4750        if (toggleFriendsTrigger != null)
 4751            toggleFriendsTrigger.OnTriggered -= ToggleFriendsTrigger_OnTriggered;
 752
 4753        if (closeWindowTrigger != null)
 4754            closeWindowTrigger.OnTriggered -= CloseWindowTrigger_OnTriggered;
 755
 4756        if (toggleWorldChatTrigger != null)
 4757            toggleWorldChatTrigger.OnTriggered -= ToggleWorldChatTrigger_OnTriggered;
 758
 4759        DataStore.i.builderInWorld.showTaskBar.OnChange -= SetVisibility;
 4760        isEmotesWheelInitialized.OnChange -= InitializeEmotesSelector;
 4761        isEmotesVisible.OnChange -= IsEmotesVisibleChanged;
 4762        isExperiencesViewerOpen.OnChange -= IsExperiencesViewerOpenChanged;
 4763        isExperiencesViewerInitialized.OnChange -= InitializeExperiencesViewer;
 4764        numOfLoadedExperiences.OnChange -= NumOfLoadedExperiencesChanged;
 4765    }
 766
 767    private void SetVisibility(bool visible, bool previus)
 768    {
 0769        SetVisibility(visible);
 0770    }
 771
 772    public void SetVisibility(bool visible)
 773    {
 1774        view.SetVisibility(visible);
 1775    }
 776
 777    public void GoBackFromChat()
 778    {
 0779        if (chatBackWindow == friendsHud)
 0780            OpenFriendsWindow();
 781        else
 0782            OpenChatList();
 0783    }
 784
 785    public void AddChatChannel(ChatChannelHUDController controller)
 786    {
 0787        if (controller?.View == null)
 788        {
 0789            Debug.LogWarning("AddChatChannel >>> Chat Window doesn't exist yet!");
 0790            return;
 791        }
 792
 0793        if (controller.View.Transform.parent == view.leftWindowContainer) return;
 794
 0795        controller.View.Transform.SetParent(view.leftWindowContainer, false);
 0796        experiencesViewerTransform?.SetAsLastSibling();
 797
 0798        channelChatWindow = controller;
 799
 0800        controller.OnClosed += ToggleOffChatIcon;
 0801        controller.OnOpenChannelLeave += OpenChannelLeaveConfirmation;
 0802    }
 803
 804    public void AddChannelSearch(SearchChannelsWindowController controller)
 805    {
 1806        if (controller.View.Transform.parent == view.leftWindowContainer) return;
 807
 1808        controller.View.Transform.SetParent(view.leftWindowContainer, false);
 1809        experiencesViewerTransform?.SetAsLastSibling();
 810
 1811        searchChannelsHud = controller;
 812
 1813        controller.OnClosed += () =>
 814        {
 0815            controller.SetVisibility(false);
 0816            ToggleOffChatIcon();
 0817        };
 1818        controller.OnBack += GoBackFromChat;
 1819        controller.OnOpenChannelCreation += OpenChannelCreation;
 1820        controller.OnOpenChannelLeave += OpenChannelLeaveConfirmation;
 1821    }
 822
 823    public void AddChannelCreation(CreateChannelWindowController controller)
 824    {
 0825        if (controller.View.Transform.parent == view.fullScreenWindowContainer) return;
 826
 0827        controller.View.Transform.SetParent(view.fullScreenWindowContainer, false);
 0828        experiencesViewerTransform?.SetAsLastSibling();
 829
 0830        channelCreationWindow = controller;
 831
 0832        controller.OnNavigateToChannelWindow += channelId =>
 833        {
 0834            OpenChannelChat(channelId);
 0835            channelCreationWindow.SetVisibility(false);
 0836        };
 0837    }
 838
 839    private void OpenChannelCreation()
 840    {
 0841        channelCreationWindow.SetVisibility(true);
 0842    }
 843
 844    public void AddChannelLeaveConfirmation(LeaveChannelConfirmationWindowController controller)
 845    {
 0846        if (controller.View.Transform.parent == view.fullScreenWindowContainer) return;
 847
 0848        controller.View.Transform.SetParent(view.fullScreenWindowContainer, false);
 0849        channelLeaveWindow = controller;
 0850    }
 851
 852    private void OpenChannelLeaveConfirmation(string channelId)
 853    {
 0854        channelLeaveWindow.SetChannelToLeave(channelId);
 0855        channelLeaveWindow.SetVisibility(true);
 0856    }
 857
 858    public void OpenChannelSearch()
 859    {
 0860        privateChatWindow.SetVisibility(false);
 0861        publicChatWindow.SetVisibility(false);
 0862        channelChatWindow.SetVisibility(false);
 0863        searchChannelsHud.SetVisibility(true);
 0864        friendsHud?.SetVisibility(false);
 0865        isExperiencesViewerOpen.Set(false);
 0866        isEmotesVisible.Set(false);
 0867        voiceChatHud?.SetVisibility(false);
 0868        worldChatWindowHud.SetVisibility(false);
 0869        view.ToggleOn(TaskbarHUDView.TaskbarButtonType.Chat);
 0870    }
 871}

Methods/Properties

socialTooltipReference()
isEmotesWheelInitialized()
isEmotesVisible()
emoteJustTriggeredFromShortcut()
isExperiencesViewerInitialized()
notificationPanelTransform()
topNotificationPanelTransform()
isExperiencesViewerOpen()
numOfLoadedExperiences()
openedChat()
isPromoteChannelsToastVisible()
TaskbarHUDController(IChatController, 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()
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()