|
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 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
------------------------------------------------------- Global helper functions used for screen narration-------------------------------------------------------Helper function for determining if something is a narratable object return true end return falseend--Helper function for appending a narration to a table of narratable objects if narration then else end endend--Given a grid list entry, returns the narration text from the entry's object. Intended to be used for entries that inherit from ZO_Tile if entryData and entryData.dataEntry then end endend--Generates narration text for a toggle control. The header and enabled parameters are optional--If nothing is passed in for enabled, assume true local isCheckedText isCheckedText = isChecked and GetString(SI_SCREEN_NARRATION_TOGGLE_ON) or GetString(SI_SCREEN_NARRATION_TOGGLE_OFF) else --If the toggle is disabled, narrate that instead of the on/off state end return SCREEN_NARRATION_MANAGER:CreateNarratableObject(zo_strformat(SI_SCREEN_NARRATION_TOGGLE_WITH_HEADER_FORMATTER, name, isCheckedText, header)) else return SCREEN_NARRATION_MANAGER:CreateNarratableObject(zo_strformat(SI_SCREEN_NARRATION_TOGGLE_FORMATTER, name, isCheckedText)) endend--Generates narration text for a radio button control. The header parameter is optional local isCheckedText = isChecked and GetString(SI_SCREEN_NARRATION_TOGGLE_ON) or GetString(SI_SCREEN_NARRATION_TOGGLE_OFF) return SCREEN_NARRATION_MANAGER:CreateNarratableObject(zo_strformat(SI_SCREEN_NARRATION_RADIO_BUTTON_WITH_HEADER_FORMATTER, name, isCheckedText, header)) else return SCREEN_NARRATION_MANAGER:CreateNarratableObject(zo_strformat(SI_SCREEN_NARRATION_RADIO_BUTTON_FORMATTER, name, isCheckedText)) endenddo local NUMERIC_ONLY_TEXT_TYPES = { [TEXT_TYPE_NUMERIC] = true, [TEXT_TYPE_NUMERIC_UNSIGNED_INT] = true, } --Generates narration text for an edit control. The name parameter is optional. if editControl then --Use a slightly different string if the edit control is numeric (meaning it only accepts numbers) if NUMERIC_ONLY_TEXT_TYPES[textType] then else end --Default to using the current value text of the edit box, and then fall back to the default text if necessary if valueText ~= "" then --If this is a password field, narrate that instead of the actual value else end else end narration:AddNarrationText(zo_strformat(SI_SCREEN_NARRATION_EDIT_BOX_INPUT_CHARACTER_LIMIT, editControl:GetMaxInputChars())) return narration end endend--Generates narration text for a spinner. return SCREEN_NARRATION_MANAGER:CreateNarratableObject(zo_strformat(SI_SCREEN_NARRATION_SPINNER_FORMATTER, name, value)) else return SCREEN_NARRATION_MANAGER:CreateNarratableObject(zo_strformat(SI_SCREEN_NARRATION_SPINNER_FORMATTER_UNNAMED, value)) endend--Generates narration text for a vertical spinner. return SCREEN_NARRATION_MANAGER:CreateNarratableObject(zo_strformat(SI_SCREEN_NARRATION_VERTICAL_SPINNER_FORMATTER, name, value)) else return SCREEN_NARRATION_MANAGER:CreateNarratableObject(zo_strformat(SI_SCREEN_NARRATION_VERTICAL_SPINNER_FORMATTER_UNNAMED, value)) endend--Generates narration text for a slider return SCREEN_NARRATION_MANAGER:CreateNarratableObject(zo_strformat(SI_SCREEN_NARRATION_SLIDER_FORMATTER, name, value, min, max))end--Default function for getting the narration text for a dropdown entry in a parametric listend--Default function for getting the narration text for an edit box control in a parametric listend--Default function for getting the narration text for a toggle in a parametric listend--Function for getting a table of narratable objects for sublabels defined in a shared gamepad entry local narrations = {} else ZO_AppendNarration(narrations, SCREEN_NARRATION_MANAGER:CreateNarratableObject(entryData.subLabelsNarrationText)) end elseif entryData.subLabels then local subLabelText else end end end return narrationsend--Function for getting a narratable object for stack count defined in a shared gamepad entry if entryData.stackCount then if entryData.stackCount > 1 or entryControl.alwaysShowStackCount then narration:AddNarrationText(zo_strformat(SI_SCREEN_NARRATION_STACK_COUNT_FORMATTER, entryData.stackCount)) end end return narrationend--Function for getting a table of narratable objects for the narration for status indicators in a shared gamepad entry local narrations = {} if entryControl then end end end return narrationsend--Function for getting a narratable object for a progress bar, given a min, max, current value, and percentageFormat.--percentageFormat is an optional argument to specify how the progress percent should be formatted for narration.--If not defined, percentageFormat will default to "%.2f". if barMax > barMin then local range = barMax - barMin local percentage = (barValue - barMin) / range percentageFormat = percentageFormat or "%.2f" return SCREEN_NARRATION_MANAGER:CreateNarratableObject(zo_strformat(SI_SCREEN_NARRATION_PROGRESS_BAR_PERCENT_FORMATTER, percentage)) endend--Function for getting a narratable object for a progress bar in a shared gamepad entry local barMax = entryData.barMax if barMax then local barMin = entryData.barMin or 0 local barValue = entryData.barValue or 0 endend--Function for grabbing the default narration for a gamepad entry local narrations = {} ZO_AppendNarration(narrations, ZO_GetSharedGamepadEntrySubLabelNarrationText(entryData, entryControl)) ZO_AppendNarration(narrations, ZO_GetSharedGamepadEntryStackCountNarrationText(entryData, entryControl)) ZO_AppendNarration(narrations, ZO_GetSharedGamepadEntryStatusIndicatorNarrationText(entryData, entryControl)) return narrationsend--Function for getting a narratable object for a vertex of a triangle picker, given a name and a value return SCREEN_NARRATION_MANAGER:CreateNarratableObject(zo_strformat(SI_SCREEN_NARRATION_TRIANGLE_PICKER_PERCENT_FORMATTER, name, percentage))enddo { keybindName = ZO_Keybindings_GetNarrationStringFromKeys(keybind, KEY_INVALID, KEY_INVALID, KEY_INVALID, KEY_INVALID), } end --Function for getting a table of keybind narration info for each direction that has info specified in the parameters local narrationData = {} if leftInfo then local keybind = shouldNarrateGamepad and KEY_GAMEPAD_DPAD_LEFT or KEY_LEFTARROW end if rightInfo then local keybind = shouldNarrateGamepad and KEY_GAMEPAD_DPAD_RIGHT or KEY_RIGHTARROW end if upInfo then local keybind = shouldNarrateGamepad and KEY_GAMEPAD_DPAD_UP or KEY_UPARROW end if downInfo then local keybind = ZO_Keybindings_ShouldShowGamepadKeybind() and KEY_GAMEPAD_DPAD_DOWN or KEY_DOWNARROW end return narrationData endenddo --Helper function for getting keybind narration info specifically for horizontal directional input. --If nothing is specified for leftText or rightText, we will fall back to "Previous" and "Next" respectively --If nothing is specified for leftEnabled or rightEnabled, we will fall back to true function ZO_GetHorizontalDirectionalInputNarrationData(leftText, rightText, leftEnabled, rightEnabled) local leftInfo = { } local rightInfo = { } end --Helper function for getting keybind narration info specifically for vertical directional input. --If nothing is specified for upText or downText, we will fall back to "Next" and "Previous" respectively --If nothing is specified for upEnabled or downEnabled, we will fall back to true local upInfo = { } local downInfo = { } local NO_LEFT_INFO = nil local NO_RIGHT_INFO = nil end --Helper function for getting keybind narration info specifically for combined vertical and horizontal directional input. --If nothing is specified for the text values, the corresponding keybind will have no name --If nothing is specified for the enabled values, we will fall back to true function ZO_GetCombinedDirectionalInputNarrationData(leftText, rightText, upText, downText, leftEnabled, rightEnabled, upEnabled, downEnabled) local leftInfo = { } local rightInfo = { } local upInfo = { } local downInfo = { } endend--Helper function for getting keybind narration info specifically for horizontal directional input for elements that are numeric in nature.--If leftEnabled or rightEnabled are not specified, we will assume enabled is true return ZO_GetHorizontalDirectionalInputNarrationData(GetString(SI_SCREEN_NARRATION_DIRECTIONAL_INPUT_DECREASE), GetString(SI_SCREEN_NARRATION_DIRECTIONAL_INPUT_INCREASE), leftEnabled, rightEnabled)end--Helper function for getting keybind narration info specifically for vertical directional input for elements that are numeric in nature.--If upEnabled or downEnabled are not specified, we will assume enabled is true return ZO_GetVerticalDirectionalInputNarrationData(GetString(SI_SCREEN_NARRATION_DIRECTIONAL_INPUT_INCREASE), GetString(SI_SCREEN_NARRATION_DIRECTIONAL_INPUT_DECREASE), upEnabled, downEnabled)end |