Back to Home

ESO Lua File v100019

ingame/guild/keyboard/guildcreate_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
local GUILD_CREATE
local GuildCreateManager = ZO_Object:Subclass()
function GuildCreateManager:New(control)
    local manager = ZO_Object.New(self)
    manager.control = control
    manager.errorLabel = GetControl(control, "Error")
    manager:InitializeKeybindDescriptor()
    control:RegisterForEvent(EVENT_GUILD_DATA_LOADED, function() manager:RefreshGuildCreateStatus() end)
    control:RegisterForEvent(EVENT_GUILD_MEMBER_RANK_CHANGED, function() manager:RefreshGuildCreateStatus() end)
    control:RegisterForEvent(EVENT_LEVEL_UPDATE, function(_, unitTag) if(unitTag == "player") then manager:RefreshGuildCreateStatus() end end)
    GUILD_CREATE_SCENE = ZO_Scene:New("guildCreate", SCENE_MANAGER)
    GUILD_CREATE_SCENE:RegisterCallback("StateChange",  function(oldState, newState)
                                                            if(newState == SCENE_SHOWING) then                                                                
                                                                KEYBIND_STRIP:AddKeybindButtonGroup(manager.keybindStripDescriptor)
                                                            elseif(newState == SCENE_HIDDEN) then                                                                
                                                                KEYBIND_STRIP:RemoveKeybindButtonGroup(manager.keybindStripDescriptor)
                                                            end
                                                        end)
    manager:RefreshGuildCreateStatus()
    return manager
end
function GuildCreateManager:InitializeKeybindDescriptor()
    self.keybindStripDescriptor =
    {
        alignment = KEYBIND_STRIP_ALIGN_CENTER,
        -- Invite
        {
            name = GetString(SI_GUILD_CREATE),
            keybind = "UI_SHORTCUT_PRIMARY",
        
            callback = function()
                ZO_Dialogs_ShowDialog("CREATE_GUILD")
            end,
            visible = function()
                return self.canCreateGuild
            end
        },
    }
end
function GuildCreateManager:RefreshGuildCreateStatus()
    self.canCreateGuild = ZO_SetGuildCreateError(self.errorLabel)
    KEYBIND_STRIP:UpdateKeybindButtonGroup(self.keybindStripDescriptor)
end
--Global XML
    GUILD_CREATE = GuildCreateManager:New(self)
end