Back to Home

ESO Lua File v100031

ingame/guildfinder/keyboard/guildbrowser_keyboard.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
------------------
-- Guild Finder --
------------------
ZO_GUILD_BROWSER_APPLICATIONS_SUBCATEGORY_ACTIVE = 1
ZO_GUILD_BROWSER_APPLICATIONS_SUBCATEGORY_MESSAGE = 2
local treeIdToCategoryInfo =
{
    [ZO_GUILD_BROWSER_CATEGORY_APPLICATIONS] = 
    {
        name = GetString(SI_GUILD_BROWSER_CATEGORY_APPLICATIONS),
        up = "EsoUI/Art/GuildFinder/Keyboard/guildBrowser_applications_up.dds",
        down = "EsoUI/Art/GuildFinder/Keyboard/guildBrowser_applications_down.dds",
        over = "EsoUI/Art/GuildFinder/Keyboard/guildBrowser_applications_over.dds",
        category = ZO_GUILD_BROWSER_CATEGORY_APPLICATIONS,
        subCategories =
        {
            { name = GetString(SI_GUILD_BROWSER_APPLICATIONS_ACTIVE), value = ZO_GUILD_BROWSER_APPLICATIONS_SUBCATEGORY_ACTIVE },
            { name = GetString(SI_GUILD_BROWSER_APPLICATIONS_MESSAGE), value = ZO_GUILD_BROWSER_APPLICATIONS_SUBCATEGORY_MESSAGE },
        }
    },
    [ZO_GUILD_BROWSER_CATEGORY_GUILD_LIST] = 
    {
        name = GetString(SI_GUILD_BROWSER_CATEGORY_BROWSE_GUILDS),
        up = "EsoUI/Art/GuildFinder/Keyboard/guildBrowser_guildList_up.dds",
        down = "EsoUI/Art/GuildFinder/Keyboard/guildBrowser_guildList_down.dds",
        over = "EsoUI/Art/GuildFinder/Keyboard/guildBrowser_guildList_over.dds",
        category = ZO_GUILD_BROWSER_CATEGORY_GUILD_LIST,
        subCategories =
        {
            { name = GetString("SI_GUILDFOCUSATTRIBUTEVALUE", GUILD_FOCUS_ATTRIBUTE_VALUE_TRADING), value = GUILD_FOCUS_ATTRIBUTE_VALUE_TRADING },
            { name = GetString("SI_GUILDFOCUSATTRIBUTEVALUE", GUILD_FOCUS_ATTRIBUTE_VALUE_GROUP_PVE), value = GUILD_FOCUS_ATTRIBUTE_VALUE_GROUP_PVE },
            { name = GetString("SI_GUILDFOCUSATTRIBUTEVALUE", GUILD_FOCUS_ATTRIBUTE_VALUE_ROLEPLAYING), value = GUILD_FOCUS_ATTRIBUTE_VALUE_ROLEPLAYING },
            { name = GetString("SI_GUILDFOCUSATTRIBUTEVALUE", GUILD_FOCUS_ATTRIBUTE_VALUE_SOCIAL), value = GUILD_FOCUS_ATTRIBUTE_VALUE_SOCIAL },
            { name = GetString("SI_GUILDFOCUSATTRIBUTEVALUE", GUILD_FOCUS_ATTRIBUTE_VALUE_PVP), value = GUILD_FOCUS_ATTRIBUTE_VALUE_PVP },
            { name = GetString("SI_GUILDFOCUSATTRIBUTEVALUE", GUILD_FOCUS_ATTRIBUTE_VALUE_QUESTING), value = GUILD_FOCUS_ATTRIBUTE_VALUE_QUESTING },
            { name = GetString("SI_GUILDFOCUSATTRIBUTEVALUE", GUILD_FOCUS_ATTRIBUTE_VALUE_CRAFTING), value = GUILD_FOCUS_ATTRIBUTE_VALUE_CRAFTING },
        }
    },
}
local ZO_GuildBrowser_Keyboard = ZO_Object.MultiSubclass(ZO_GuildBrowser_Shared, ZO_GuildFinder_Keyboard_Base)
function ZO_GuildBrowser_Keyboard:New(...)
    return ZO_GuildFinder_Keyboard_Base.New(self, ...)
end
function ZO_GuildBrowser_Keyboard:Initialize(control)
    ZO_GuildBrowser_Shared.Initialize(self, control)
    ZO_GuildFinder_Keyboard_Base.Initialize(self, control)
    self.applicationsLabel = self.control:GetNamedChild("PersonalData"):GetNamedChild("ApplicationsLabel")
    KEYBOARD_GUILD_BROWSER_SCENE = ZO_Scene:New("guildBrowserKeyboard", SCENE_MANAGER)
    KEYBOARD_GUILD_BROWSER_SCENE:RegisterCallback("StateChange", function(oldState, state)
                                                                if state == SCENE_SHOWING then
                                                                    self:OnShowing()
                                                                elseif state == SCENE_HIDDEN then
                                                                    self:OnHidden()
                                                                end
                                                            end)
    KEYBOARD_GUILD_BROWSER_FRAGMENT = ZO_FadeSceneFragment:New(self.control)
    self:SetupData(treeIdToCategoryInfo)
    GUILD_BROWSER_MANAGER:RegisterCallback("OnApplicationsChanged", function() self:UpdateApplicationsLabel() end)
end
function ZO_GuildBrowser_Keyboard:DeferredInitialize()
    if self.hasDeferredInitialized then
        return
    end
    treeIdToCategoryInfo[ZO_GUILD_BROWSER_CATEGORY_GUILD_LIST].manager = GUILD_BROWSER_GUILD_LIST_KEYBOARD
    treeIdToCategoryInfo[ZO_GUILD_BROWSER_CATEGORY_APPLICATIONS].manager = GUILD_BROWSER_APPLICATIONS_KEYBOARD
    self.hasDeferredInitialized = true
end
function ZO_GuildBrowser_Keyboard:UpdateApplicationsLabel()
    local applicationLabelText = zo_strformat(SI_GUILD_BROWSER_APPLICATIONS_QUANTITY_FORMATTER, GetGuildFinderNumAccountApplications(), MAX_GUILD_FINDER_APPLICATIONS_PER_ACCOUNT)
    self.applicationsLabel:SetText(applicationLabelText)
end
function ZO_GuildBrowser_Keyboard:ShowApplicationsList()
    local targetNode = self.nodeLookupTable[ZO_GUILD_BROWSER_CATEGORY_APPLICATIONS].subCategories[ZO_GUILD_BROWSER_APPLICATIONS_SUBCATEGORY_ACTIVE]
    self.categoryTree:SelectNode(targetNode)
end
function ZO_GuildBrowser_Keyboard:IsSceneShown()
    return KEYBOARD_GUILD_BROWSER_SCENE:IsShowing()
end
function ZO_GuildBrowser_Keyboard:OnShowing()
    ZO_GuildBrowser_Shared.OnShowing(self)
    -- we cleared our results when exiting this scene. If we open it back up and are on the searching category
    -- we need to start a new search since the old data was old
    if self.selectedCategory.category == ZO_GUILD_BROWSER_CATEGORY_GUILD_LIST then
        GUILD_BROWSER_MANAGER:ExecuteSearch()
    end
end
function ZO_GuildBrowser_Keyboard:OnHidden()
    ZO_GuildBrowser_Shared.OnHidden(self)
    GUILD_BROWSER_MANAGER:ClearCurrentFoundGuilds()
end
function ZO_GuildBrowser_Keyboard:SetCategoryTreeHidden(hidden)
    self.listContainer:SetHidden(hidden)
end
-- XML Functions
-----------------
    GUILD_BROWSER_KEYBOARD = ZO_GuildBrowser_Keyboard:New(control)
end