Back to Home

ESO Lua File v101041

pregameandingame/gamepad/controllerdisconnect/controllerdisconnect.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
    CONTROLLER_DISCONNECT_FRAGMENT = ZO_FadeSceneFragment:New(control)
    local headerData =
    {
        titleTextAlignment = TEXT_ALIGN_CENTER,
        titleText = GetString(SI_GAMEPAD_DISCONNECTED_TITLE),
    }
    local header = control:GetNamedChild("HeaderContainer").header
    local interactKeybindControl = control:GetNamedChild("InteractKeybind")
    ZO_KeybindButtonTemplate_Setup(interactKeybindControl, "DIALOG_PRIMARY", ZO_ControllerDisconnect_DismissPopup, GetString(SI_GAMEPAD_DISCONNECTED_CONTINUE_TEXT))
    local narrationInfo =
    {
        canNarrate = function()
            return not control:IsHidden()
        end,
        headerNarrationFunction = function()
            return ZO_GamepadGenericHeader_GetNarrationText(header, headerData)
        end,
        selectedNarrationFunction = function()
            return SCREEN_NARRATION_MANAGER:CreateNarratableObject(ZO_ControllerDisconnect_GetMessageText())
        end,
        --Because this message box can pop up basically anywhere, we want to ignore the narration for the keybind strip itself
        overrideInputNarrationFunction = function()
            local narrationData = {}
            table.insert(narrationData, interactKeybindControl:GetKeybindButtonNarrationData())
            return narrationData
        end,
        --Because this message box can pop up basically anywhere, we want to ignore all tooltip narration
        canNarrateTooltips = false,
        --Treat this as an alert so it takes priority over everything else
        narrationType = NARRATION_TYPE_ALERT,
    }
    SCREEN_NARRATION_MANAGER:RegisterCustomObject("controllerDisconnect", narrationInfo)
end
    local name = GetOnlineIdForActiveProfile()
    if name == "" then
        --There is no currently active profile, do not show the controller disconnected message.
        return ""
    else
        local message
        if ZO_IsPlaystationPlatform() then
            message = GetString(SI_GAMEPAD_DISCONNECTED_PLAYSTATION_TEXT)
        else
            message = GetString(SI_GAMEPAD_DISCONNECTED_XBOX_TEXT)
        end
        message = zo_strformat(message, name)
        return message
    end
end
    local message = ZO_ControllerDisconnect_GetMessageText()
    if message == "" then
        --There is no message to show.
        return
    end
    local mainText = ZO_ControllerDisconnect:GetNamedChild("ContainerScrollChildMainText")
    mainText:SetText(message)
    mainText:SetHorizontalAlignment(TEXT_ALIGN_CENTER)
    ZO_ControllerDisconnect:SetHidden(false)
    local NARRATE_HEADER = true
    SCREEN_NARRATION_MANAGER:QueueCustomEntry("controllerDisconnect", NARRATE_HEADER)
end
    ZO_ControllerDisconnect:SetHidden(true)
end