Back to Home

ESO Lua File v100028

internalingame/market/gamepad/esoplusmembershipinfodialog_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
ZO_EsoPlusMembershipInfoDialog_Gamepad = ZO_Object:Subclass()
function ZO_EsoPlusMembershipInfoDialog_Gamepad:New(...)
    local object = ZO_Object.New(self)
    object:Initialize(...)
    return object
end
function ZO_EsoPlusMembershipInfoDialog_Gamepad:Initialize(control)
    self.control = control
    local keybindLabelText = string.format("%s %s", ZO_Keybindings_GetKeyText(KEY_GAMEPAD_BUTTON_2), zo_strformat(SI_GAMEPAD_BACK_OPTION))
    self.control:GetNamedChild("BackKeybind"):SetText(keybindLabelText)
    ZO_Dialogs_RegisterCustomDialog("ESO_PLUS_MEMBERSHIP_INFO", self.dialogInfo)
end
function ZO_EsoPlusMembershipInfoDialog_Gamepad:InitializeDialog(dialog)
    dialog.fragment = ZO_FadeSceneFragment:New(dialog)
    self.benefitLinePool = ZO_ControlPool:New("ZO_GamepadMembershipInfoDialog_BenefitLine", dialog.scrollChild)
    local function SetupBenefitLine(benefitLine)
        benefitLine.iconTexture = benefitLine:GetNamedChild("Icon")
        benefitLine.headerLabel = benefitLine:GetNamedChild("HeaderText")
        benefitLine.lineLabel = benefitLine:GetNamedChild("LineText")
    end
end
function ZO_EsoPlusMembershipInfoDialog_Gamepad:BuildDialogInfo()
    self.dialogInfo =
    {
        setup = function(...) self:DialogSetupFunction(...) end,
        customControl = self.control,
        gamepadInfo = 
        {
            dialogType = GAMEPAD_DIALOGS.CUSTOM,
        },
        title =
        {
            text = SI_MARKET_SUBSCRIPTION_PAGE_BENEFITS_TITLE,
        },
        mainText =
        {
            text = "", -- no main text
        },
        buttons =
        {
            {
                --Ethereal binds show no text, the name field is used to help identify the keybind when debugging. This text does not have to be localized.
                name = "Gamepad Membership Dialog Back",
                ethereal = true,
                keybind = "DIALOG_NEGATIVE",
                clickSound = SOUNDS.DIALOG_DECLINE,
                callback = function(dialog)
                    self:Hide()
                end,
            },
        }
    }
end
function ZO_EsoPlusMembershipInfoDialog_Gamepad:DialogSetupFunction(dialog)
    dialog.headerData.titleTextAlignment = TEXT_ALIGN_CENTER
    ZO_GamepadGenericHeader_Refresh(dialog.header, dialog.headerData)
    self.benefitLinePool:ReleaseAllObjects()
    local numLines = GetNumGamepadMarketSubscriptionBenefitLines()
    local controlToAnchorTo = dialog.scrollChild
    for i = 1, numLines do
        local lineText, headerText, icon = GetGamepadMarketSubscriptionBenefitLineInfo(i);
        local benefitLine = self.benefitLinePool:AcquireObject()
        benefitLine.lineLabel:SetText(lineText)
        benefitLine.headerLabel:SetText(headerText)
        benefitLine.iconTexture:SetTexture(icon)
        benefitLine:ClearAnchors()
        if i == 1 then
            benefitLine:SetAnchor(TOPLEFT, controlToAnchorTo, TOPLEFT, 0, 0)
        else
            benefitLine:SetAnchor(TOPLEFT, controlToAnchorTo, BOTTOMLEFT, 0, 25)
        end
        controlToAnchorTo = benefitLine
    end
end
function ZO_EsoPlusMembershipInfoDialog_Gamepad:Show()
    ZO_Dialogs_ShowGamepadDialog("ESO_PLUS_MEMBERSHIP_INFO")
end
function ZO_EsoPlusMembershipInfoDialog_Gamepad:Hide()
    ZO_Dialogs_ReleaseDialog("ESO_PLUS_MEMBERSHIP_INFO")
end
--
--[[ XML Handlers ]]--
--
    ZO_ESO_PLUS_MEMBERSHIP_DIALOG = ZO_EsoPlusMembershipInfoDialog_Gamepad:New(control)
end