Back to Home

ESO Lua File v100032

libraries/utility/zo_platformutils.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
134
135
136
137
138
139
    return IsConsoleUI() and UndecorateDisplayName(name) or name
end
do
    local CHARACTER_NAME_ICON = "EsoUI/Art/Miscellaneous/Gamepad/gp_charNameIcon.dds"
    local CHARACTER_NAME_ICON_SIZE = "70%"
        if name ~= "" then
            if IsInGamepadPreferredMode() then
                return zo_iconTextFormat(CHARACTER_NAME_ICON, CHARACTER_NAME_ICON_SIZE, CHARACTER_NAME_ICON_SIZE, name)
            else
                return name
            end
        else
            return ""
        end
    end
end
do
    local HERON_NAME_ICON_SIZE = "70%"
        if name ~= "" then
            if IsInGamepadPreferredMode() then
                return zo_iconTextFormat(ZO_GAMEPAD_HERON_NAME_ICON, HERON_NAME_ICON_SIZE, HERON_NAME_ICON_SIZE, name)
            else
                return name
            end
        else
            return ""
        end
    end
end
function ZO_FormatUserFacingCharacterOrDisplayName(characterOrDisplayName)
    return IsDecoratedDisplayName(characterOrDisplayName) and ZO_FormatUserFacingDisplayName(characterOrDisplayName) or ZO_FormatUserFacingCharacterName(characterOrDisplayName)
end
    return IsConsoleUI() and DecorateDisplayName(name) or name
end
internalassert(UI_PLATFORM_MAX_VALUE == ACCOUNT_LABEL_MAX_VALUE, "There should be a platform account label for every platform")
    return GetString("SI_PLATFORMACCOUNTLABEL", GetUIPlatform())
end
internalassert(PLATFORM_STORE_LABEL_MAX_VALUE == PLATFORM_SERVICE_TYPE_MAX_VALUE, "There should be a platform store label for every platform service")
    return GetString("SI_PLATFORMSTORELABEL", GetPlatformServiceType())
end
function ZO_GetPlatformUserFacingName(characterName, displayName)
    local userFacingName
    if IsInGamepadPreferredMode() then
        -- Prioritize the userID if using the gamepad UI, but fallback to character name on PC for cases where
        -- we have the character name but not the userID
        userFacingName = displayName ~= "" and ZO_FormatUserFacingDisplayName(displayName) or ZO_FormatUserFacingCharacterName(characterName)
    else
        -- Prioritize the character name in the keyboard UI.
        userFacingName = characterName ~= "" and ZO_FormatUserFacingCharacterName(characterName) or ZO_FormatUserFacingDisplayName(displayName)
    end
    return userFacingName
end
    if IsConsoleUI() and SavePlayerConsoleProfile ~= nil then
        SavePlayerConsoleProfile()
    end
end
    local instructions 
    if IsConsoleUI() then
        local platform = ZO_GetPlatformAccountLabel()
        instructions = zo_strformat(SI_REQUEST_DISPLAY_NAME_INSTRUCTIONS, platform)
    else
        instructions = GetString(SI_REQUEST_NAME_INSTRUCTIONS)
    end
    return instructions
end
function ZO_PlatformIgnorePlayer(displayName, idRequestType, ...)
    if not IsIgnored(displayName) then
        if not IsConsoleUI() then
            AddIgnore(displayName)
        else
            if not idRequestType or idRequestType == ZO_ID_REQUEST_TYPE_DISPLAY_NAME then
                ZO_ShowConsoleIgnoreDialog(displayName)
            else
                ZO_ShowConsoleIgnoreDialogFromDisplayNameOrFallback(displayName, idRequestType, ...)
            end
        end
    end
end
function ZO_PlatformOpenApprovedURL(approvedUrlType, linkText, externalApplicationText)
    if IsHeronUI() then
        OpenURLByType(approvedUrlType)
    else
        ZO_Dialogs_ShowPlatformDialog("CONFIRM_OPEN_URL_BY_TYPE", { urlType = approvedUrlType }, { mainTextParams = { linkText, externalApplicationText } })
    end
end
do
    internalassert(UI_PLATFORM_MAX_VALUE == 4, "Do these functions still do what they say they do?")
    function ZO_IsPCOrHeronUI()
        return not IsConsoleUI()
    end
    function ZO_IsPCUI()
        return not IsConsoleUI() and not IsHeronUI()
    end
    function ZO_IsConsoleOrHeronUI()
        return IsHeronUI() or IsConsoleUI()
    end
    function ZO_IsConsolePlatform()
        local platform = GetUIPlatform()
        return platform == UI_PLATFORM_PS4 or platform == UI_PLATFORM_XBOX
    end
end
function ZO_IsIngameUI()
    return IsInUI("ingame")
end
function ZO_IsPregameUI()
    return IsInUI("pregame")
end