Back to Home

ESO Lua File v101044

ingame/guildfinder/gamepad/guildbrowser_applications_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
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
------------------
-- Guild Finder --
------------------
ZO_GUILD_BROWSER_APPLICATIONS_GAMEPAD_ENTRY_HEIGHT = 64
ZO_GuildBrowser_Applications_Gamepad = ZO_Object.MultiSubclass(ZO_GuildBrowser_Applications_Shared, ZO_GuildFinder_ListPanel_GamepadBehavior)
function ZO_GuildBrowser_Applications_Gamepad:New(...)
    return ZO_GuildFinder_ListPanel_GamepadBehavior.New(self, ...)
end
function ZO_GuildBrowser_Applications_Gamepad:Initialize(control)
    ZO_GuildBrowser_Applications_Shared.Initialize(self, control)
    ZO_GuildFinder_ListPanel_GamepadBehavior.Initialize(self, control)
    local function SetupRow(control, data)
        self:SetupRow(control, data)
    end
    ZO_ScrollList_AddDataType(self.list, ZO_GUILD_FINDER_APPLICATION_ENTRY_TYPE, "ZO_GuildBrowser_Applications_Row_Gamepad", ZO_GUILD_BROWSER_APPLICATIONS_GAMEPAD_ENTRY_HEIGHT, SetupRow)
    ZO_ScrollList_EnableHighlight(self.list, "ZO_ThinListHighlight")
    self:SetEmptyText(GetString(SI_GUILD_BROWSER_APPLICATIONS_EMPTY_LIST_TEXT))
    self:SetupSort(ZO_GUILD_BROWSER_APPLICATIONS_ENTRY_SORT_KEYS, "durationS", ZO_SORT_ORDER_DOWN)
end
function ZO_GuildBrowser_Applications_Gamepad:InitializeKeybinds()
    ZO_GuildFinder_ListPanel_GamepadBehavior.InitializeKeybinds(self)
    table.insert(self.keybindStripDescriptor,
        -- select
        {
            name = GetString(SI_GAMEPAD_GUILD_BROWSER_CANCEL_APPLICATION_LABEL),
            keybind = "UI_SHORTCUT_PRIMARY",
            callback = function()
                local selectedData = self:GetSelectedData()
                if selectedData then
                    local guildInfo = ZO_AllianceIconNameFormatter(selectedData.alliance, selectedData.guildName)
                    ZO_Dialogs_ShowGamepadDialog("GUILD_FINDER_RESCIND_APPLICATION", selectedData, { mainTextParams = { ZO_WHITE:Colorize(guildInfo) } })
                end
            end,
        }
    )
end
function ZO_GuildBrowser_Applications_Gamepad:OnCommitComplete()
    GUILD_BROWSER_GAMEPAD:RefreshKeybinds()
end
function ZO_GuildBrowser_Applications_Gamepad:OnSelectionChanged(previousData, selectedData)
    ZO_GuildFinder_ListPanel_GamepadBehavior.OnSelectionChanged(self, previousData, selectedData)
    GAMEPAD_TOOLTIPS:ClearLines(GAMEPAD_RIGHT_TOOLTIP)
    if selectedData then
        GAMEPAD_TOOLTIPS:LayoutGuildApplicationDetails(GAMEPAD_RIGHT_TOOLTIP, selectedData)
    end
end
function ZO_GuildBrowser_Applications_Gamepad:BuildMasterList()
    self.currentApplications = GUILD_BROWSER_MANAGER:GetCurrentApplicationsList()
end
function ZO_GuildBrowser_Applications_Gamepad:FilterScrollList()
    local scrollData = ZO_ScrollList_GetDataList(self.list)
    ZO_ClearNumericallyIndexedTable(scrollData)
    for _, data in ipairs(self.currentApplications) do
        table.insert(scrollData, ZO_ScrollList_CreateDataEntry(ZO_GUILD_FINDER_APPLICATION_ENTRY_TYPE, data))
    end
end
function ZO_GuildBrowser_Applications_Gamepad:CommitScrollList()
    ZO_GuildFinder_ListPanel_GamepadBehavior.CommitScrollList(self)
end
function ZO_GuildBrowser_Applications_Gamepad:OnShowing()
    ZO_GuildBrowser_Applications_Shared.OnShowing(self)
    self:RefreshData()
end
function ZO_GuildBrowser_Applications_Gamepad:OnHidden()
    ZO_GuildBrowser_Applications_Shared.OnHidden(self)
end
function ZO_GuildBrowser_Applications_Gamepad:GetSelectedNarrationText()
    local narrations = {}
    local selectedData = self:GetSelectedData()
    if selectedData then
        --Get the narration for the guild name column
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString("SI_GUILDMETADATAATTRIBUTE", GUILD_META_DATA_ATTRIBUTE_NAME)))
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(selectedData.guildName))
        --Get the narration for the expiration column
        local timeRemainingS = GetGuildFinderAccountApplicationDuration(selectedData.index)
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString(SI_GUILD_FINDER_APPLICATIONS_SORT_HEADER_EXPIRATION)))
        ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(ZO_FormatCountdownTimer(timeRemainingS)))
    end
    return narrations
end
--Overridden from base
function ZO_GuildBrowser_Applications_Gamepad:GetHeaderNarration()
    return SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString(SI_GUILD_BROWSER_CATEGORY_APPLICATIONS))
end
-- XML Functions
-----------------
    GUILD_BROWSER_APPLICATIONS_GAMEPAD = ZO_GuildBrowser_Applications_Gamepad:New(control)
end