ESO Lua File v100010

pregame/console/createaccount/createaccountautofill_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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
local function InitKeybindingDescriptor(self)
    self.keybindStripDescriptor = 
    {
        {
            alignment = KEYBIND_STRIP_ALIGN_LEFT,
            name = GetString(SI_CONSOLE_PREGAME_SELECT),
            keybind = "UI_SHORTCUT_PRIMARY",
            callback = function()
                for i,v in ipairs(self.buttons) do
                    local selected = (i == self.selectedButtonIndex)
                    if selected then
                        if v.selected ~= nil then
                            v.selected()
                        end
                        break
                    end
                end
            end,
        },
        {
            alignment = KEYBIND_STRIP_ALIGN_LEFT,
            name = GetString(SI_CONSOLE_CREATEACCOUNT_AUTOFILL_CANCEL),
            keybind = "UI_SHORTCUT_EXIT",
            callback = function()
                SCENE_MANAGER:HideCurrentScene()
            end,
        },
    }
end
local function SetupText(self)
    local container = self:GetNamedChild("Panel")
    -- TODO: Set the icon (the nil value in the call)
    ZO_PregameGamepadHeaderTemplate_Setup(self:GetNamedChild("Header"), GetString(SI_CONSOLE_PREGAME_GETTING_STARTED), nil, GetString(SI_CONSOLE_CREATEACCOUNT_HEADER_CONSOLE), GetString(SI_CONSOLE_CREATEACCOUNT_DESCRIPTION))
    local info = container:GetNamedChild("Info")
    info:SetText(GetString(SI_CONSOLE_CREATEACCOUNT_AUTOFILL_QUESTION))
    local description = container:GetNamedChild("Description")
    description:SetText(GetString(SI_CONSOLE_CREATEACCOUNT_AUTOFILL_NOTICE))
end
local function UpdateButtons(self)
    for i,v in ipairs(self.buttons) do
        local selected = (i == self.selectedButtonIndex)
        local label = v.control:GetNamedChild("Label")
        label:SetText(v.text)
        local r, g, b = (selected and ZO_SELECTED_TEXT or ZO_DISABLED_TEXT):UnpackRGB()
        label:SetColor(r, g, b, 1)
        label:SetFont(selected and "ZoFontGamepad37" or "ZoFontGamepad30")
    end
end
    self.selectedButtonIndex = (self.selectedButtonIndex % #self.buttons) + 1
end
    self.selectedButtonIndex = self.selectedButtonIndex - 1
    if self.selectedButtonIndex < 1 then
        self.selectedButtonIndex = #self.buttons
    end
end
    local result = self.movementController:CheckMovement()
    if result == MOVEMENT_CONTROLLER_MOVE_NEXT then
    elseif result == MOVEMENT_CONTROLLER_MOVE_PREVIOUS then
    end
end
---------------------------------------
    local createAccountAutoFill_Gamepad_Fragment = ZO_FadeSceneFragment:New(self)
    local createAccountAutoFill_Gamepad_Scene = ZO_Scene:New("CreateAccountAutoFill_Gamepad", SCENE_MANAGER)
    createAccountAutoFill_Gamepad_Scene:AddFragment(createAccountAutoFill_Gamepad_Fragment)
    createAccountAutoFill_Gamepad_Scene:AddFragment(KEYBIND_STRIP_GAMEPAD_FRAGMENT)
    SetupText(self)
    self.animation = self:GetNamedChild("Animation")
    self.buttons = 
    {
        {
            text = GetString(SI_CONSOLE_CREATEACCOUNT_AUTOFILL_YES),
            control = self:GetNamedChild("YesButton"),
            selected = function()
                -- TODO: Retrieve the data from the PSN/XBox Live account and fill the form in.
                SCENE_MANAGER:HideCurrentScene()
            end
        },
        {
            text = GetString(SI_CONSOLE_CREATEACCOUNT_AUTOFILL_NO),
            control = self:GetNamedChild("NoButton"),
            selected = function()
                SCENE_MANAGER:HideCurrentScene()
            end
        }
    }
    self.selectedButtonIndex = 1
    self.movementController = ZO_MovementController:New(MOVEMENT_CONTROLLER_DIRECTION_VERTICAL)
    local StateChanged = function(oldState, newState)
        if newState == SCENE_SHOWING then
            self.currentKeybindStripDescriptor = self.keybindStripDescriptor
            KEYBIND_STRIP:RemoveDefaultExit()
            KEYBIND_STRIP:AddKeybindButtonGroup(self.currentKeybindStripDescriptor)
        elseif newState == SCENE_HIDDEN then
            if self.currentKeybindStripDescriptor then
                KEYBIND_STRIP:RemoveKeybindButtonGroup(self.currentKeybindStripDescriptor)
                KEYBIND_STRIP:RestoreDefaultExit()
            end
        end
    end
    createAccountAutoFill_Gamepad_Scene:RegisterCallback("StateChange", StateChanged)
end