Back to Home

ESO Lua File v101044

ingame/fishing/gamepad/fishing_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
ZO_Fishing_Gamepad = ZO_Fishing:Subclass()
function ZO_Fishing_Gamepad:Initialize(...)
    ZO_Fishing.Initialize(self, ...)
end
function ZO_Fishing_Gamepad:InitializeNarrationInfo()
    local narrationInfo =
    {
        canNarrate = function()
            return self:IsInteracting()
        end,
        selectedNarrationFunction = function()
            local narrations = {}
            local selectedEntry = self.menu.selectedEntry
            if selectedEntry then
                local name = selectedEntry.name
                if type(name) == "table" then
                    name = name[1]
                end
                ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(name))
            end
            return narrations
        end,
        headerNarrationFunction = function()
            return SCREEN_NARRATION_MANAGER:CreateNarratableObject(GetString(SI_FISHING_WHEEL_NARRATION))
        end,
        additionalInputNarrationFunction = function()
            local narrationData = {}
            if self.menu:ShouldShowKeybinds() then
                self.menu:ForEachOrdinalEntry(function(ordinalIndex, entry)
                    local actionName = ZO_GetRadialMenuActionNameForOrdinalIndex(ordinalIndex)
                    local name = entry.name
                    if type(name) == "table" then
                        name = name[1]
                    end
                    local entryNarrationData =
                    {
                        name = name,
                        keybindName = ZO_Keybindings_GetHighestPriorityNarrationStringFromAction(actionName) or GetString(SI_ACTION_IS_NOT_BOUND),
                        enabled = true,
                    }
                    table.insert(narrationData, entryNarrationData)
                end)
            end
            return narrationData
        end,
        narrationType = NARRATION_TYPE_HUD,
    }
    SCREEN_NARRATION_MANAGER:RegisterCustomObject("FishingWheelHUD", narrationInfo)
end
function ZO_Fishing_Gamepad:OnSelectionChangedCallback(selectedEntry)
    ZO_Fishing.OnSelectionChangedCallback(self, selectedEntry)
    --Re-narrate on selection changed
    if selectedEntry then
        SCREEN_NARRATION_MANAGER:QueueCustomEntry("FishingWheelHUD")
    end
end
function ZO_Fishing_Gamepad:ShowMenu()
    ZO_Fishing.ShowMenu(self)
    --Narrate the header when first showing
    local NARRATE_HEADER = true
    SCREEN_NARRATION_MANAGER:QueueCustomEntry("FishingWheelHUD", NARRATE_HEADER)
end
function ZO_Fishing_Gamepad:StopInteraction(...)
    local wasShowing = ZO_Fishing.StopInteraction(self, ...)
    if wasShowing then
        --Clear out any in progress HUD narration when exiting the wheel
        ClearNarrationQueue(NARRATION_TYPE_HUD)
    end
    return wasShowing
end
    FISHING_GAMEPAD = ZO_Fishing_Gamepad:New(control, "ZO_GamepadSelectableItemRadialMenuEntryTemplate", "DefaultRadialMenuAnimation", "SelectableItemRadialMenuEntryAnimation")
end