Back to Home

ESO Lua File v100016

ingame/contacts/gamepad/contacts_gamepad.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
-----------------
--Contacts Manager
-----------------
local ZO_GamepadContactsManager = ZO_Object:Subclass()
function ZO_GamepadContactsManager:New(...)
    local manager = ZO_Object.New(self)
    manager:Initialize(...)
    return manager
end
function ZO_GamepadContactsManager:Initialize(control)
    self.control = control
    -- Setup the footer
    self.footerData = 
    {
        data1HeaderText = GetString(SI_GAMEPAD_CONTACTS_HEADER_FRIENDS_ONLINE),
    }
    GAMEPAD_CONTACTS_FRAGMENT = ZO_CreateQuadrantConveyorFragment(control)
    GAMEPAD_CONTACTS_FRAGMENT:RegisterCallback("StateChange", function(oldState, newState)
                                                                    if newState == SCENE_FRAGMENT_SHOWN then  
                                                                        self:RefreshFooter()
                                                                        self:PerformDeferredInitialization()
                                                                        TriggerTutorial(TUTORIAL_TRIGGER_CONTACTS_OPENED)
                                                                    end
                                                                end)
end
function ZO_GamepadContactsManager:PerformDeferredInitialization()
    if self.initialized then return end
    self.initialized = true
    self:UpdateOnline()
end
function ZO_GamepadContactsManager:UpdateOnline()
    if not self.control:IsControlHidden() then
        self:RefreshFooter()
    end
end
function ZO_GamepadContactsManager:RefreshFooter()
    self.footerData.data1Text = zo_strformat(SI_GAMEPAD_CONTACTS_HEADER_FRIENDS_ONLINE_FORMAT, FRIENDS_LIST_MANAGER:GetNumOnline(), GetNumFriends())
    GAMEPAD_GENERIC_FOOTER:Refresh(self.footerData)
end
    GAMEPAD_CONTACTS = ZO_GamepadContactsManager:New(self)
end