Back to Home

ESO Lua File v101044

ingame/chatsystem/keyboard/keyboardchatsystem.lua

[◄ back to folders ]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
--[[ Chat Container ]]--
ChatContainer = SharedChatContainer:Subclass()
function ChatContainer:New(...)
    return SharedChatContainer.New(self, ...)
end
function ChatContainer:Initialize(control, windowPool, tabPool)
    SharedChatContainer.Initialize(self, control, windowPool, tabPool)
    self.visualData = {}
    self.newWindowTab = control:GetNamedChild("NewWindowTab")
    if self.newWindowTab then
        ZO_CreateUniformIconTabData(self.visualData, nil, 32, 32, "EsoUI/Art/ChatWindow/chat_addTab_down.dds", "EsoUI/Art/ChatWindow/chat_addTab_up.dds", "EsoUI/Art/ChatWindow/chat_addTab_over.dds", "EsoUI/Art/ChatWindow/chat_addTab_disabled.dds")
        ZO_TabButton_Icon_Initialize(self.newWindowTab, "SimpleIconHighlight", self.visualData)
        self.newWindowTab:SetHandler("OnMouseUp", function(tab, button, isUpInside) if isUpInside and not ZO_TabButton_IsDisabled(self.newWindowTab) then  self.system:CreateNewChatTab(self) end ZO_TabButton_Unselect(tab) end)
        self.newWindowTab.container = self
        self.overflowTab = control:GetNamedChild("OverflowTab")
        if self.overflowTab then
            ZO_CreateUniformIconTabData(self.visualData, nil, 32, 32, "EsoUI/Art/ChatWindow/chat_overflowArrow_down.dds", "EsoUI/Art/ChatWindow/chat_overflowArrow_up.dds", "EsoUI/Art/ChatWindow/chat_overflowArrow_over.dds")
            ZO_TabButton_Icon_Initialize(self.overflowTab, "SimpleIconHighlight", self.visualData)
            self.overflowTab:SetHandler("OnMouseUp", function(tab, button, isUpInside) if isUpInside then self:ShowOverflowedTabsDropdown() end ZO_TabButton_Unselect(tab) end)
            self.overflowTab.container = self
            self.overflowTab:SetAnchor(LEFT, self.newWindowTab, RIGHT, 0, 0)
        end
    end
    self:SetAllowSaveSettings(true)
    self:InitializeWindowManagement(control, windowPool, tabPool)
    self:FadeOut()
end
function ChatContainer:UpdateInteractivity(isInteractive)
    self.control:SetMouseEnabled(isInteractive)
    self.scrollbar:SetHidden(not isInteractive)
    SharedChatContainer.UpdateInteractivity(self, isInteractive)
end
function ChatContainer:PerformLayout(insertIndex, xOffset)
    SharedChatContainer.PerformLayout(self, insertIndex, xOffset)
    self:ApplyInsertIndicator(insertIndex)
end
function ChatContainer:FadeIn(delay, fadeOption)
    SharedChatContainer.FadeIn(self, delay, fadeOption)
end
function ChatContainer:UpdateNewWindowTab()
    if self.newWindowTab and self.windows[self.hiddenTabStartIndex - 1] then
        local finalTab = self.windows[self.hiddenTabStartIndex - 1].tab
        self.newWindowTab:SetAnchor(LEFT, finalTab, RIGHT, 0, 0)
    end
end
function SharedChatContainer:ShowContextMenu(tabIndex)
    local parentControl = self.control
    tabIndex = tabIndex or (self.currentBuffer and self.currentBuffer:GetParent() and self.currentBuffer:GetParent().tab and self.currentBuffer:GetParent().tab.index)
    local window = self.windows[tabIndex]
    if window then
        ClearMenu()
        if not ZO_Dialogs_IsShowingDialog() then
            AddMenuItem(GetString(SI_CHAT_CONFIG_CREATE_NEW), function() self.system:CreateNewChatTab(self) end)
            if not window.combatLog and (not self:IsPrimary() or tabIndex ~= 1) then
                AddMenuItem(GetString(SI_CHAT_CONFIG_REMOVE), function() self:ShowRemoveTabDialog(tabIndex) end)
            end
            AddMenuItem(GetString(SI_CHAT_CONFIG_OPTIONS), function() self:ShowOptions(tabIndex) end)
        end
        if self:IsPrimary() and tabIndex == 1 then
            if self:IsLocked(tabIndex) then
                AddMenuItem(GetString(SI_CHAT_CONFIG_UNLOCK), function() self:SetLocked(tabIndex, false) end)
            else
                AddMenuItem(GetString(SI_CHAT_CONFIG_LOCK), function() self:SetLocked(tabIndex, true) end)
            end
        end
        if window.combatLog then
            if self:AreTimestampsEnabled(tabIndex) then
                AddMenuItem(GetString(SI_CHAT_CONFIG_HIDE_TIMESTAMP), function() self:SetTimestampsEnabled(tabIndex, false) end)
            else
                AddMenuItem(GetString(SI_CHAT_CONFIG_SHOW_TIMESTAMP), function() self:SetTimestampsEnabled(tabIndex, true) end)
            end
        end
        parentControl = window.tab
    end
    AddMenuItem(GetString(SI_CHAT_CONFIG_RESET), function() ZO_Dialogs_ShowDialog("CHAT_RESET") end)
    ShowMenu(parentControl)
end
function ChatContainer:LoadSettings(settings)
    self.control:SetAnchor(settings.point, nil, settings.relPoint, settings.x, settings.y)
    self.control:SetDimensions(settings.width, settings.height)
    self:FadeOut(0)
    SharedChatContainer.LoadSettings(self, settings)
end
function ChatContainer:GetChatFont()
    return ZoFontChat
end
function ChatContainer:IsMouseInside()
    if MouseIsOver(self.control) or (self.overflowTab and MouseIsOver(self.overflowTab)) then
        return true
    end
    for i=1, #self.windows do
        if MouseIsOver(self.windows[i].tab) then
            return true
        end
    end
    return false
end
function ChatContainer:MonitorForMouseExit()
    self.FadeOutCheckOnUpdate = self.FadeOutCheckOnUpdate or function()
        if not self:IsMouseInside() and not self.resizing and not self.fadeAnim:IsPlaying() and not self.isDragging then
            if not self:IsPrimary() or not self.system:IsTextEntryOpen() then
                if not self.monitoredControl then
                    self:FadeOut()
                    self.windowContainer:SetHandler("OnUpdate", nil)
                end
            end
        end
    end
    self.windowContainer:SetHandler("OnUpdate", self.FadeOutCheckOnUpdate)
end
function ChatContainer:ShowRemoveTabDialog(index)
    local dialogName = "CHAT_TAB_REMOVE"
    local window = self.windows[index]
    local name = ZO_TabButton_Text_GetText(window.tab)
    ZO_Dialogs_ShowDialog(dialogName, {container = self, index = index}, {mainTextParams = {name}} )
end
function ChatContainer:ShowOverflowedTabsDropdown()
    if self.overflowTab and self.hiddenTabStartIndex <= #self.windows then
        ClearMenu()
        for i=self.hiddenTabStartIndex, #self.windows do
            AddMenuItem(self:GetTabName(i), function() self:ForceWindowIntoView(i) end)
        end
        ShowMenu(self.overflowTab)
    end
end
function ChatContainer:UpdateOverflowArrow()
    if self.overflowTab then
        if self.hiddenTabStartIndex <= #self.windows then
            self.overflowTab:SetHidden(false)
        else
            self.overflowTab:SetHidden(true)
        end
    end
end
--
--[[ Chat System ]]--
--
ZO_ChatSystem = SharedChatSystem:Subclass()
function ZO_ChatSystem:New(...)
    return SharedChatSystem.New(self, ...)
end
local PC_SETTINGS =
{
    horizontalAlignment = TEXT_ALIGN_LEFT,
    initialFadeAlpha = 0,
    finalFadeAlpha = 1,
    fadeTransitionTime = 2000, -- milliseconds
    chatEditBufferTop = 3,
    chatEditBufferBottom = 3,
}
function ZO_ChatSystem:Initialize(control)
    self.agentChatButton = control:GetNamedChild("AgentChat")
    self.agentChatGlow = self.agentChatButton:GetNamedChild("Glow")
    local agentChatBurst = self.agentChatButton:GetNamedChild("Burst")
    self.agentChatBurstTimeline = ANIMATION_MANAGER:CreateTimelineFromVirtual("NotificationAddedBurst", agentChatBurst)
    self.agentChatBurstTimeline:SetHandler("OnStop", function() agentChatBurst:SetAlpha(0) end)
    local agentChatEcho = self.agentChatButton:GetNamedChild("Echo")
    self.agentChatPulseTimeline = ANIMATION_MANAGER:CreateTimelineFromVirtual("NotificationPulse", agentChatEcho)
    self.agentChatPulseTimeline:SetHandler("OnStop", function() agentChatEcho:SetAlpha(0) end)
    SharedChatSystem.Initialize(self, control, PC_SETTINGS)
    self.currentNumNotifications = 0
end
local function NewContainerHelper(chat, control, windowPool, tabPool)
    return ChatContainer:New(chat, control, windowPool, tabPool)
end
function ZO_ChatSystem:LoadChatFromSettings()
    local defaults = {
        containers = {
            ["*"] = {
                point = BOTTOMLEFT,
                relPoint = BOTTOMLEFT,
                x = 0,
                y = -82,
                width = 445,
                height = 267,
            },
        },
    }
    SharedChatSystem.LoadChatFromSettings(self, NewContainerHelper, defaults)
end
function ZO_ChatSystem:SetupSavedVars(defaults)
    self.sv = ZO_SavedVars:New("ZO_Ingame_SavedVariables", 4, "Chat", defaults)
end
function ZO_ChatSystem:SaveLocalContainerSettings(container, containerControl)
    local id = container.id
    local settings = self.sv.containers[id]
    settings.width, settings.height = containerControl:GetDimensions()
    local _
    _, settings.point, _, settings.relPoint, settings.x, settings.y = containerControl:GetAnchor(0)
end
function ZO_ChatSystem:InitializeSharedControlManagement(control)
    SharedChatSystem.InitializeSharedControlManagement(self, control, NewContainerHelper, "ZO_KeyboardChatWindowTemplate", "ZO_ChatWindowTabTemplate")
    self.friendsButton = control:GetNamedChild("Friends")
    self.friendsLabel = control:GetNamedChild("NumOnlineFriends")
    self.notificationsButton = control:GetNamedChild("Notifications")
    self.notificationsLabel = control:GetNamedChild("NumNotifications")
    self.notificationsGlow = self.notificationsButton:GetNamedChild("Glow")
    self.mailButton = control:GetNamedChild("Mail")
    self.mailLabel = control:GetNamedChild("NumUnreadMail")
    self.mailGlow = self.mailButton:GetNamedChild("Glow")
    local notificationsBurst = self.notificationsButton:GetNamedChild("Burst")
    self.notificationBurstTimeline = ANIMATION_MANAGER:CreateTimelineFromVirtual("NotificationAddedBurst", notificationsBurst)
    self.notificationBurstTimeline:SetHandler("OnStop", function() notificationsBurst:SetAlpha(0) end)
    local notificationEcho = self.notificationsButton:GetNamedChild("Echo")
    self.notificationPulseTimeline = ANIMATION_MANAGER:CreateTimelineFromVirtual("NotificationPulse", notificationEcho)
    self.notificationPulseTimeline:SetHandler("OnStop", function() notificationEcho:SetAlpha(0) end)
    local mailBurst = self.mailButton:GetNamedChild("Burst")
    self.mailBurstTimeline = ANIMATION_MANAGER:CreateTimelineFromVirtual("NotificationAddedBurst", mailBurst)
    self.mailBurstTimeline:SetHandler("OnStop", function() mailBurst:SetAlpha(0) end)
    -- Setup the minimized bar
    self.minBar = control:GetNamedChild("MinBar")
    self.minBar:SetInheritAlpha(false)
    self.minBar.maxButton = self.minBar:GetNamedChild("Maximize")
    self.minBar.bgHighlight = self.minBar:GetNamedChild("BGHighlight")
    self.newChatFadeAnim = ZO_AlphaAnimation:New(self.minBar.bgHighlight)
end
function ZO_ChatSystem:TryNotificationAndMailBursts()
    if self.currentNumNotifications > 0 then
        self.notificationBurstTimeline:PlayFromStart()
    end
    if self.numUnreadMails > 0 then
        self.mailBurstTimeline:PlayFromStart()
    end
end
function ZO_ChatSystem:ResetContainerPositionAndSize(container)
    self.sv.containers[container.id] = nil
    container:LoadSettings(self.sv.containers[container.id])
end
function ZO_ChatSystem:RemoveSavedContainer(container)
    table.remove(self.sv.containers, container.id)
end
function ZO_ChatSystem:SetupNotifications(numNotifications)
    self.notificationsLabel:SetText(numNotifications)
    self.notificationsButton:SetInheritAlpha(numNotifications == 0)
    self.notificationsLabel:SetInheritAlpha(numNotifications == 0)
    if numNotifications == 0 then
        self.notificationsGlow:SetHidden(true)
        if self.notificationPulseTimeline:IsPlaying() then
            self.notificationPulseTimeline:Stop()
        end
    else
        self.notificationsGlow:SetHidden(false)
        if not self.notificationPulseTimeline:IsPlaying() then
            self.notificationPulseTimeline:PlayFromStart()
        end
    end
end
function ZO_ChatSystem:OnNumNotificationsChanged(numNotifications)
    if numNotifications > self.currentNumNotifications and IsPlayerActivated() then
        self.notificationBurstTimeline:PlayFromStart()
    end
    self.currentNumNotifications = numNotifications
    self:SetupNotifications(numNotifications)
end
function ZO_ChatSystem:OnNumUnreadMailChanged(numUnread)
    if numUnread > self.numUnreadMails and IsPlayerActivated() then
        self.mailBurstTimeline:PlayFromStart()
    end
    SharedChatSystem.OnNumUnreadMailChanged(self, numUnread)
    self.mailLabel:SetText(numUnread)
    self.mailGlow:SetHidden(numUnread == 0)
end
function ZO_ChatSystem:SetNumOnlineFriends(numOnline)
    self.friendsLabel:SetText(numOnline)
    if InformationTooltip:GetOwner() == self.friendsButton then
        FRIENDS_LIST:FriendsButton_OnMouseEnter(self.friendsButton)
    end
end
function ZO_ChatSystem:InitializeEventManagement()
    self:InitializeSharedEvents("KeyboardChatSystem")
    local function OnNumOnlineFriendsChanged(numOnline)
        self:SetNumOnlineFriends(numOnline)
    end
    local function OnChatChannelUpdated()
        local channelData, channelTarget = CHAT_ROUTER:GetCurrentChannelData()
        self:SetChannelInternal(channelData.id, channelTarget)
    end
    CALLBACK_MANAGER:RegisterCallback("NumOnlineFriendsChanged", OnNumOnlineFriendsChanged)
    CALLBACK_MANAGER:RegisterCallback("OnChatChannelUpdated", OnChatChannelUpdated)
    self:SetNumOnlineFriends(FRIENDS_LIST_MANAGER:GetNumOnline())
end
function ZO_ChatSystem:ShowMinBar()
    --clear the anchors
    self.mailButton:ClearAnchors()
    self.mailLabel:ClearAnchors()
    self.friendsButton:ClearAnchors()
    self.friendsLabel:ClearAnchors()
    self.notificationsButton:ClearAnchors()
    self.notificationsLabel:ClearAnchors()
    self.minBar.maxButton:ClearAnchors()
    self.agentChatButton:ClearAnchors()
    --reset the parentage for fading purposes
    self.mailButton:SetParent(self.minBar)
    self.mailLabel:SetParent(self.minBar)
    self.friendsButton:SetParent(self.minBar)
    self.friendsLabel:SetParent(self.minBar)
    self.notificationsButton:SetParent(self.minBar)
    self.notificationsLabel:SetParent(self.minBar)
    self.agentChatButton:SetParent(self.minBar)
    --reanchor everything
    self.mailButton:SetAnchor(TOPLEFT, nil, nil, -4, 265)
    self.mailLabel:SetAnchor(TOPLEFT, self.mailButton, BOTTOMLEFT, 0, -5)
    self.mailLabel:SetAnchor(TOPRIGHT, self.mailButton, BOTTOMRIGHT, 0, -5)
    self.friendsButton:SetAnchor(TOPLEFT, self.mailLabel, BOTTOMLEFT)
    self.friendsLabel:SetAnchor(TOPLEFT, self.friendsButton, BOTTOMLEFT, 0, -5)
    self.friendsLabel:SetAnchor(TOPRIGHT, self.friendsButton, BOTTOMRIGHT, 0, -5)
    self.notificationsButton:SetAnchor(TOPLEFT, self.friendsLabel, BOTTOMLEFT)
    self.notificationsLabel:SetAnchor(TOPLEFT, self.notificationsButton, BOTTOMLEFT, 0, -5)
    self.notificationsLabel:SetAnchor(TOPRIGHT, self.notificationsButton, BOTTOMRIGHT, 0, -5)
    self.agentChatButton:SetAnchor(TOPLEFT, self.notificationsLabel, BOTTOMLEFT)
    self.minBar.maxButton:SetAnchor(TOPLEFT, self.agentChatButton, BOTTOMLEFT)
    --center the labels
    self.mailLabel:SetHorizontalAlignment(TEXT_ALIGN_CENTER)
    self.friendsLabel:SetHorizontalAlignment(TEXT_ALIGN_CENTER)
    self.notificationsLabel:SetHorizontalAlignment(TEXT_ALIGN_CENTER)
    self.minBar:SetHidden(false)
    self.isMinimized = true
end
function ZO_ChatSystem:HideMinBar()
    --clear the anchors
    self.mailButton:ClearAnchors()
    self.mailLabel:ClearAnchors()
    self.friendsButton:ClearAnchors()
    self.friendsLabel:ClearAnchors()
    self.notificationsButton:ClearAnchors()
    self.notificationsLabel:ClearAnchors()
    self.agentChatButton:ClearAnchors()
    --reset the parentage for fading purposes
    self.mailButton:SetParent(self.control)
    self.mailLabel:SetParent(self.control)
    self.friendsButton:SetParent(self.control)
    self.friendsLabel:SetParent(self.control)
    self.notificationsButton:SetParent(self.control)
    self.notificationsLabel:SetParent(self.control)
    self.agentChatButton:SetParent(self.control)
    --reanchor everything
    self.mailButton:SetAnchor(TOPLEFT, nil, TOPLEFT, 20, 7)
    self.mailLabel:SetAnchor(LEFT, self.mailButton, RIGHT, 2)
    self.friendsButton:SetAnchor(LEFT, self.mailLabel, RIGHT, 10)
    self.friendsLabel:SetAnchor(LEFT, self.friendsButton, RIGHT, 2)
    self.notificationsButton:SetAnchor(LEFT, self.friendsLabel, RIGHT, 10)
    self.notificationsLabel:SetAnchor(LEFT, self.notificationsButton, RIGHT, 2)
    self.agentChatButton:SetAnchor(LEFT, self.notificationsLabel, RIGHT, 10)
    --left align the labels
    self.mailLabel:SetHorizontalAlignment(TEXT_ALIGN_LEFT)
    self.friendsLabel:SetHorizontalAlignment(TEXT_ALIGN_LEFT)
    self.notificationsLabel:SetHorizontalAlignment(TEXT_ALIGN_LEFT)
    self.isMinimized = false
    self.minBar:SetHidden(true)
end
do
    local function OnPlay(animation, control)
        control.container:SetMinimizingOrMaximizing(true)
        control:SetClampedToScreen(false)
    end
    local function OnStop(animation, control)
        local progress = animation:GetTimeline():GetProgress()
        local maximized = animation:GetDeltaOffsetX() >= 0
        control:SetClampedToScreen(maximized)
        control.container:SetMinimizingOrMaximizing(false)
    end
    local function GetOrCreateMinimizeAnimationTimeline(container)
        if not container.minimizeAnimationTimeline then
            local animationTimeline = ANIMATION_MANAGER:CreateTimelineFromVirtual("ChatMinMaxAnim", container.control)
            container.minimizeAnimationTimeline = animationTimeline
            local animation = animationTimeline:GetAnimation(1)
            animation:SetHandler("OnPlay", OnPlay)
            animation:SetHandler("OnStop", OnStop)
        end
        return container.minimizeAnimationTimeline
    end
    function ZO_ChatSystem:Minimize()
        if not self.isMinimized then
            -- Slide all chat windows off the left edge of the screen
            for _, container in pairs(self.containers) do
                local animationTimeline = GetOrCreateMinimizeAnimationTimeline(container)
                -- If the animation is still playing keep the same positions;
                -- otherwise save the current position and calculate the minimize distance
                local minimizeDistance
                if not animationTimeline:IsPlaying() then
                    minimizeDistance = container.control:GetRight()
                    container.originalPosition = minimizeDistance
                else
                    minimizeDistance = container.originalPosition
                end
                -- Additional margin to ensure the container is completely hidden
                minimizeDistance = minimizeDistance + 40
                -- Set the animation distance
                animationTimeline:GetAnimation(1):SetTranslateDeltas(-minimizeDistance, 0)
                -- Fire the animation
                animationTimeline:PlayFromStart()
                -- Hide all the tabs at the top
                for _, tab in pairs(container.tabGroup.m_Buttons) do
                    tab:SetHidden(true)
                end
                if container.overflowTab then
                    container.overflowTab:SetHidden(true)
                end
                if container.newWindowTab then
                    container.newWindowTab:SetHidden(true)
                end
            end
            -- Move the buttons to and show the minimized bar
            PlaySound(SOUNDS.CHAT_MINIMIZED)
            self:ShowMinBar()
        end
    end
    function ZO_ChatSystem:Maximize()
        if self.isMinimized then
            for _, container in pairs(self.containers) do
                -- Calculate the distance to the original position
                local maximizeDistance = container.originalPosition - container.control:GetRight()
                -- Setup the animation and fire it
                local animationTimeline = GetOrCreateMinimizeAnimationTimeline(container)
                animationTimeline:GetAnimation(1):SetTranslateDeltas(maximizeDistance, 0)
                animationTimeline:PlayFromStart()
                -- Show the tabs that haven't overflowed
                for _, tab in pairs(container.tabGroup.m_Buttons) do
                    if tab.index < container.hiddenTabStartIndex then
                        tab:SetHidden(false)
                    elseif container.overflowTab then
                        container.overflowTab:SetHidden(false)
                    end
                end
                if container.newWindowTab then
                    container.newWindowTab:SetHidden(false)
                end
                container:FadeIn()
            end
            -- Hide the minimized bar and fade in the windows
            PlaySound(SOUNDS.CHAT_MAXIMIZED)
            self:HideMinBar()
            if self.newChatFadeAnim and self.newChatFadeAnim:IsPlaying() then
                self.newChatFadeAnim:Stop()
                self.minBar.bgHighlight:SetAlpha(0)
            end
        end
    end
end
function ZO_ChatSystem:GetFont()
    return ZoFontEditChat
end
function ZO_ChatSystem:GetFontSizeString(fontSize)
    return string.format("$(KB_%d)", fontSize)
end
function ZO_ChatSystem:GetFontSizeFromSetting()
    return GetChatFontSize()
end
--
-- SharedChatSystem Overrides
--
function ZO_ChatSystem:ShouldOnlyShowOnHUD()
    return false
end
function ZO_ChatSystem:IsHidden()
    if not IsChatSystemAvailableForCurrentPlatform() then
        return true
    end
    -- On platforms with both chat systems, hide on the opposite UI mode
        return true
    end
    return false
end
function ZO_ChatSystem:OnAgentChatActiveChanged()
    if self.isAgentChatActive and IsPlayerActivated() then
        self.agentChatBurstTimeline:PlayFromStart()
        PlaySound(SOUNDS.AGENT_CHAT_ACTIVE)
    end
    if self.isAgentChatActive then
        self.agentChatPulseTimeline:PlayFromStart()
    else
        self.agentChatPulseTimeline:Stop()
    end
    self.agentChatButton:SetHidden(not self.isAgentChatActive)
end
function ZO_ChatSystem:OnPlayerActivated()
        if self.isAgentChatActive then
            self.agentChatBurstTimeline:PlayFromStart()
        end
    end
end
function ZO_ChatSystem:ResetChat()
    self.sv:ResetToDefaults()
    SharedChatSystem.ResetChat(self)
end
--
-- End SharedChatSystem Overrides
--
--[[ Global/XML Handlers ]]--
    control.container:ShowContextMenu(control.index)
end
    control.container:ShowContextMenu()
end
    FRIENDS_LIST:FriendsButton_OnMouseEnter(control)
end
    FRIENDS_LIST:FriendsButton_OnMouseExit(control)
end
    if IsInGamepadPreferredMode() then
        SCENE_MANAGER:Show("gamepad_friends")
    else
        SYSTEMS:GetObject("mainMenu"):ToggleCategory(MENU_CATEGORY_CONTACTS)
    end
end
    local numUnreadMail = GetNumUnreadMail()
    InitializeTooltip(InformationTooltip, control, TOPLEFT, 0, 0, BOTTOMRIGHT)
    if numUnreadMail == 0 then
        SetTooltipText(InformationTooltip, GetString(SI_MAIL_NO_UNREAD_MAIL))
    else
        SetTooltipText(InformationTooltip, zo_strformat(SI_MAIL_UNREAD_MAIL, numUnreadMail))
    end
end
    ClearTooltip(InformationTooltip)
end
    SYSTEMS:GetObject("mainMenu"):ToggleCategory(MENU_CATEGORY_MAIL)
end
    InitializeTooltip(InformationTooltip, control, TOPLEFT, 0, 0, BOTTOMRIGHT)
    SetTooltipText(InformationTooltip, GetString(SI_AGENT_CHAT_ACTIVE_TOOLTIP))
end
    ClearTooltip(InformationTooltip)
end
    local isChatRequested = GetAgentChatRequestInfo()
    if isChatRequested then
        AcceptAgentChat()
    end
end
    SYSTEMS:GetObject("mainMenu"):ToggleCategory(MENU_CATEGORY_NOTIFICATIONS)
end
    NOTIFICATIONS:OnNotificationsChatButtonEnter(control)
end
    NOTIFICATIONS:OnNotificationsChatButtonExit(control)
end
    if KEYBOARD_CHAT_SYSTEM:IsMinimized() then
        KEYBOARD_CHAT_SYSTEM:Maximize()
    else
        KEYBOARD_CHAT_SYSTEM:Minimize()
    end
end
    KEYBOARD_CHAT_SYSTEM = ZO_ChatSystem:New(control)
    SYSTEMS:RegisterKeyboardObject("ChatSystem", KEYBOARD_CHAT_SYSTEM)
        -- On platforms that do not support gamepad chat, we do not load a gamepad chat system. Let's reuse the keyboard system instead.
        GAMEPAD_CHAT_SYSTEM = KEYBOARD_CHAT_SYSTEM
        SYSTEMS:RegisterGamepadObject("ChatSystem", KEYBOARD_CHAT_SYSTEM)
    end
end