Back to Home

ESO Lua File v101044

ingame/guild/gamepad/guildrankiconpicker_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
---------------------------
--Guild Rank Icon Picker --
---------------------------
ZO_GUILD_RANK_RANK_ICON_PICKER_PICK_GAMEPAD_SIZE = 75
ZO_GUILD_RANK_RANK_ICON_PICKER_PICK_GAMEPAD_OFFSET = 30
ZO_GUILD_RANK_RANK_ICON_PICKER_ICON_GAMEPAD_SIZE = 64
ZO_GUILD_RANK_RANK_ICON_PICKER_ICON_GAMEPAD_OFFSET = 5
ZO_GuildRankIconPicker_Gamepad = ZO_GuildRankIconPicker_Shared:Subclass()
function ZO_GuildRankIconPicker_Gamepad:New(...)
    return ZO_GuildRankIconPicker_Shared.New(self, ...)
end
function ZO_GuildRankIconPicker_Gamepad:Initialize(control)
    local templateData =
    {
        gridListClass = ZO_GridScrollList_Gamepad,
        entryTemplate = "ZO_GuildRank_RankIconPickerIcon_Gamepad_Control",
        entryWidth = ZO_GUILD_RANK_RANK_ICON_PICKER_PICK_GAMEPAD_SIZE,
        entryHeight = ZO_GUILD_RANK_RANK_ICON_PICKER_PICK_GAMEPAD_SIZE,
        entryPaddingX = ZO_GUILD_RANK_RANK_ICON_PICKER_PICK_GAMEPAD_OFFSET,
        entryPaddingY = ZO_GUILD_RANK_RANK_ICON_PICKER_PICK_GAMEPAD_OFFSET,
        narrationText = function(entryData)
            local formatter = entryData.isCurrent() and SI_GAMEPAD_GUILD_RANK_SELECTED_ICON_NARRATION_FORMATTER or SI_GAMEPAD_GUILD_RANK_ICON_NARRATION_FORMATTER
            return SCREEN_NARRATION_MANAGER:CreateNarratableObject(zo_strformat(formatter, entryData.iconIndex))
        end,
    }
    ZO_GuildRankIconPicker_Shared.Initialize(self, control, templateData)
end
function ZO_GuildRankIconPicker_Gamepad:InitializeRankIconPickerGridList()
    ZO_GuildRankIconPicker_Shared.InitializeRankIconPickerGridList(self)
    self.rankIconPickerGridList:SetOnSelectedDataChangedCallback(function(...) self:OnRankIconPickerGridSelectionChanged(...) end)
end
function ZO_GuildRankIconPicker_Gamepad:OnRankIconPickerGridSelectionChanged(oldSelectedData, selectedData)
    -- Deselect previous tile
    if oldSelectedData and oldSelectedData.dataEntry then
        oldSelectedData.isSelected = false
    end
    -- Select newly selected tile.
    if selectedData and selectedData.dataEntry then
        selectedData.isSelected = true
    end
    self.rankIconPickerGridList:RefreshGridList()
end
function ZO_GuildRankIconPicker_Gamepad:OnRankIconPickerEntrySetup(control, data)
    local iconTexture = control:GetNamedChild("Icon")
    local pickedControl = control:GetNamedChild("CurrentIconIndicator")
    local isCurrent = data.isCurrent
    if type(isCurrent) == "function" then
        isCurrent = isCurrent()
    end
    iconTexture:SetTexture(GetGuildRankLargeIcon(data.iconIndex))
    pickedControl:SetHidden(not isCurrent)
end
function ZO_GuildRankIconPicker_Gamepad:OnRankIconPickerSelectedGridListEntryClicked()
    local selectedData = self.rankIconPickerGridList:GetSelectedData()
    if selectedData and self.rankIconPickedCallback then
        self.rankIconPickedCallback(selectedData.iconIndex)
    end
    self.rankIconPickerGridList:RefreshGridList()
end
function ZO_GuildRankIconPicker_Gamepad:Activate()
    self.rankIconPickerGridList:Activate()
end
function ZO_GuildRankIconPicker_Gamepad:Deactivate()
    self.rankIconPickerGridList:Deactivate()
end