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 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 |
local TICKET_STATE_FIELD_ENTRY = 1
local TICKET_STATE_START_SUBMISSION = 2
local TICKET_FIELD_EMAIL = 1
local TICKET_FIELD_CATEGORY = 2
local TICKET_FIELD_SUBCATEGORY = 3
local TICKET_FIELD_REQUIRED_DETAILS = 4
local TICKET_FIELD_ADDITIONAL_DETAILS = 5
local TICKET_VALIDATION_STATUS =
{
SUCCESS = 1 ,
FAILED_NO_EMAIL = 2 ,
FAILED_NO_NAME = 3 ,
}
local REFRESH_KEYBIND_STRIP = true
local TICKET_CATEGORIES =
{
{
id = TICKET_CATEGORY_CHARACTER_ISSUE ,
} ,
{
id = TICKET_CATEGORY_REPORT_DEFAULT ,
} ,
{
id = TICKET_CATEGORY_OTHER ,
} ,
}
local TICKET_SUBCATEGORIES =
{
[ TICKET_CATEGORY_REPORT_DEFAULT ] =
{
{
id = TICKET_CATEGORY_REPORT_BAD_NAME ,
} ,
{
id = TICKET_CATEGORY_REPORT_HARASSMENT ,
} ,
{
id = TICKET_CATEGORY_REPORT_CHEATING ,
} ,
{
id = TICKET_CATEGORY_REPORT_OTHER ,
} ,
} ,
}
local REQUIRED_FIELD_DEFAULT_TEXTS =
{
[ TICKET_CATEGORY_REPORT_DEFAULT ] = zo_strformat ( SI_GAMEPAD_HELP_TICKET_EDIT_REQUIRED_NAME_DISPLAY , ZO_GetPlatformAccountLabel ( ) ) ,
}
local VALIDATION_ERROR_STRINGS =
{
[ TICKET_VALIDATION_STATUS . FAILED_NO_NAME ] =
{
[ TICKET_CATEGORY_REPORT_DEFAULT ] = zo_strformat ( SI_GAMEPAD_HELP_TICKET_FAILED_REPORT_WITHOUT_DISPLAY_NAME , ZO_GetPlatformAccountLabel ( ) )
}
}
-- The email address (result of GetActiveUserEmailAddress) needs to be kept private,
-- so it can't be stored in the ZO_Help_Customer_Service_Gamepad object
local g_email = ""
if validationStatus ~= TICKET_VALIDATION_STATUS . SUCCESS then
local errorStringContainer = VALIDATION_ERROR_STRINGS [ validationStatus ]
if validationStatus == TICKET_VALIDATION_STATUS . FAILED_NO_EMAIL then
return errorStringContainer
else
return errorStringContainer [ category ]
end
end
return nil
end
end
ZO_Gamepad_ParametricList_Screen . Initialize ( self , control , ZO_GAMEPAD_HEADER_TABBAR_DONT_CREATE , nil , HELP_CUSTOMER_SERVICE_GAMEPAD_SCENE )
self . savedFields = { }
self . fieldRegistrationFunctions =
{
if ( categoryId == TICKET_CATEGORY_REPORT_DEFAULT ) then
end
end ,
end ,
}
local headerMessageControl = self . control : GetNamedChild ( "Mask" ) : GetNamedChild ( "Container" ) : GetNamedChild ( "HeaderContainer" ) : GetNamedChild ( "Header" ) : GetNamedChild ( "Message" )
self . ticketSubmittedFailedHeader = GetString ( SI_GAMEPAD_HELP_TICKET_SUBMITTED_DIALOG_HEADER_FAILURE )
self . ticketSubmittedSuccessHeader = GetString ( SI_GAMEPAD_HELP_TICKET_SUBMITTED_DIALOG_HEADER_SUCCESS )
self . ticketSubmittedFailedMessage = GetString ( SI_GAMEPAD_HELP_CUSTOMER_SERVICE_FAILED_TICKET_SUBMISSION )
control : RegisterForEvent ( EVENT_CUSTOMER_SERVICE_TICKET_SUBMITTED , function ( ... ) self : OnCustomerServiceTicketSubmitted ( ... ) end )
end
end
end
end
if ( self . currentDropdown ~= nil ) then
end
end
self . keybindStripDescriptorsByState =
{
[ TICKET_STATE_FIELD_ENTRY ] =
{
alignment = KEYBIND_STRIP_ALIGN_LEFT ,
-- Back
KEYBIND_STRIP : GenerateGamepadBackButtonDescriptor ( function ( ) SCENE_MANAGER : HideCurrentScene ( ) end , nil , SOUNDS . DIALOG_DECLINE ) ,
-- Select
{
keybind = "UI_SHORTCUT_PRIMARY" ,
if targetData . isTextField then
else
end
elseif targetData . isDropdown then
elseif targetData . isSubmit then
end
end ,
if self . itemList then
if selectedData then
return not selectedData . isLocked
end
end
return false
end
} ,
} ,
[ TICKET_STATE_START_SUBMISSION ] =
{
alignment = KEYBIND_STRIP_ALIGN_LEFT ,
} ,
}
ZO_Gamepad_AddListTriggerKeybindDescriptors ( keybindStripDescriptor , function ( ) return self . itemList end )
end
end
self . keybindStripDescriptor = self . keybindStripDescriptorsByState [ self . ticketState ]
end
do
local HEADER_DATA_FIELD_ENTRY =
{
}
local HEADER_DATA_START_SUBMISSION =
{
}
-- refreshKeybindStrip should only be used for internal state changes
self . ticketState = ticketState
if refreshKeybindStrip then
end
-- field entry
if ( self . ticketState == TICKET_STATE_FIELD_ENTRY ) then
self . headerData = HEADER_DATA_FIELD_ENTRY
-- start submission
elseif ( self . ticketState == TICKET_STATE_START_SUBMISSION ) then
self . headerData = HEADER_DATA_START_SUBMISSION
end
end
end
if ( result == TICKET_VALIDATION_STATUS . SUCCESS ) then
else
ZO_Dialogs_ShowGamepadDialog ( "HELP_CUSTOMER_SERVICE_TICKET_FAILED_REASON" , nil , { mainTextParams = { GetValidationErrorString ( result , self : GetCurrentCategory ( ) ) } } )
end
end
local result = TICKET_VALIDATION_STATUS . SUCCESS
local email = g_email
if ( email == nil ) or ( email == "" ) then
result = TICKET_VALIDATION_STATUS . FAILED_NO_EMAIL
else
local details = self . savedFields [ TICKET_FIELD_REQUIRED_DETAILS ]
if ( details == nil ) or ( details == "" ) then
--"Character" required information is inferred, so nothing is required
if ( categoryId ~= TICKET_CATEGORY_CHARACTER_ISSUE and categoryId ~= TICKET_CATEGORY_OTHER ) then
result = TICKET_VALIDATION_STATUS . FAILED_NO_NAME
end
end
end
return result
end
end
self . savedFields [ TICKET_FIELD_REQUIRED_DETAILS ] = nil
self . savedFields [ TICKET_FIELD_ADDITIONAL_DETAILS ] = nil
self . savedFields [ TICKET_FIELD_SUBCATEGORY ] = nil
self . requiredInfoProvidedInternally = false
end
function ZO_Help_Customer_Service_Gamepad : OnCustomerServiceTicketSubmitted ( eventCode , response , success )
--TODO: Split everything out and refactor
if customerServiceShowing or questAssistanceShowing or itemAssistanceShowing then
local dialogParams = { }
if ( ( success == true ) and ( response ~= nil ) ) then
dialogParams . titleParams = { self . ticketSubmittedSuccessHeader }
dialogParams . mainTextParams = {
self . knowledgeBaseText ,
self . websiteText ,
}
else
dialogParams . titleParams = { self . ticketSubmittedFailedHeader }
dialogParams . mainTextParams = {
self . ticketSubmittedFailedMessage ,
self . knowledgeBaseText ,
self . websiteText ,
}
end
end
end
end
self . savedFields [ TICKET_FIELD_ADDITIONAL_DETAILS ] = bodyText
end
if ( categoryInfo . id == categoryId ) then
self . savedFields [ TICKET_FIELD_CATEGORY ] = categoryIndex
break
end
end
end
local subcategories = TICKET_SUBCATEGORIES [ categoryInfo . id ]
if ( subcategories ) then
if ( subcategoryInfo . id == subcategoryId ) then
self . savedFields [ TICKET_FIELD_CATEGORY ] = categoryIndex
self . savedFields [ TICKET_FIELD_SUBCATEGORY ] = subcategoryIndex
break
end
end
end
end
end
self . requiredInfoProvidedInternally = isProvidedInternally
end
if ( email and ( email ~= "" ) ) then
g_email = email
end
end
local categoryIndex = self . savedFields [ TICKET_FIELD_CATEGORY ]
if categoryIndex then
end
end
local categoryInfo = TICKET_CATEGORIES [ categoryIndex ]
if ( categoryInfo ) then
return categoryInfo . id
end
end
if ( fieldType == TICKET_FIELD_EMAIL ) then
else
end
end
end
end
return g_email
else
end
end
local function SetupTextFieldListEntry ( control , data , selected , reselectingDuringRebuild , enabled , active )
self . activeEditBox = editControl
end )
self . activeEditBox = nil
end )
if ( savedText ) then
else
end
local defaultText = data . fieldType == TICKET_FIELD_EMAIL and GetString ( SI_GAMEPAD_HELP_EMAIL_ADDRESS_REQUIRED ) or REQUIRED_FIELD_DEFAULT_TEXTS [ self : GetCurrentCategory ( ) ]
else
end
end
local function SetupLockedTextFieldListEntry ( control , data , selected , reselectingDuringRebuild , enabled , active )
if ( savedText ) then
else
end
end
local function SetupDropdownListEntry ( control , data , selected , selectedDuringRebuild , enabled , activated )
if ( selected ) then
end
end
list : AddDataTemplateWithHeader ( "ZO_GamepadTextFieldItem_Multiline" , SetupTextFieldListEntry , ZO_GamepadMenuEntryTemplateParametricListFunction , nil , "ZO_GamepadMenuEntryFullWidthHeaderTemplate" )
list : AddDataTemplateWithHeader ( "ZO_Gamepad_Help_EditLockedEntry_MultiLine" , SetupLockedTextFieldListEntry , ZO_GamepadMenuEntryTemplateParametricListFunction , nil , "ZO_GamepadMenuEntryFullWidthHeaderWithLockTemplate" )
list : AddDataTemplateWithHeader ( "ZO_Gamepad_Help_Dropdown_Item" , SetupDropdownListEntry , ZO_GamepadMenuEntryTemplateParametricListFunction , nil , "ZO_GamepadMenuEntryFullWidthHeaderTemplate" )
list : AddDataTemplate ( "ZO_GamepadTextFieldSubmitItem" , ZO_SharedGamepadEntry_OnSetup , ZO_GamepadMenuEntryTemplateParametricListFunction )
end
end
function ZO_Help_Customer_Service_Gamepad : DropdownItemCallback ( selectionIndex , fieldType , ticketCategoryId )
if ( self . savedFields [ fieldType ] ~= selectionIndex ) then
self . savedFields [ fieldType ] = selectionIndex
end
if fieldType == TICKET_FIELD_CATEGORY then
if self . requiredInfoProvidedInternally then
self . savedFields [ TICKET_FIELD_REQUIRED_DETAILS ] = nil
end
self . requiredInfoProvidedInternally = false
end
end
end
dropdown : AddItem ( ZO_ComboBox : CreateItemEntry ( item . name , function ( ) self : DropdownItemCallback ( index , data . fieldType , item . id ) end ) , ZO_COMBOBOX_SUPRESS_UPDATE )
end
end
local savedField = self . savedFields [ fieldType ]
if ( savedField ) then
else
end
end
self . currentDropdown = dropdown
end
if ( self . currentDropdown ~= nil ) then
local savedField = self . savedFields [ fieldType ]
if ( savedField ) then
else
end
end
end
end
end
end
end
entryData . customerServiceObject = self
entryData . fieldType = fieldType
entryData . header = header
entryData . isTextField = true
entryData . isRequired = required
entryData . isLocked = locked
if locked then
else
end
end
entryData . customerServiceObject = self
entryData . fieldType = fieldType
entryData . header = header
entryData . isDropdown = true
end
local entryData = ZO_GamepadEntryData : New ( GetString ( SI_GAMEPAD_HELP_SUBMIT_TICKET ) , ZO_GAMEPAD_SUBMIT_ENTRY_ICON )
entryData . isSubmit = true
end
if ( self . ticketState == TICKET_STATE_FIELD_ENTRY ) then
end
end
self . dirty = false
local FIELD_IS_REQUIRED = true
-- email address
self : AddTextFieldEntry ( TICKET_FIELD_EMAIL , GetString ( SI_GAMEPAD_HELP_FIELD_TITLE_EMAIL ) , FIELD_IS_REQUIRED )
-- categories
self : AddDropdownEntry ( TICKET_FIELD_CATEGORY , GetString ( SI_GAMEPAD_HELP_FIELD_TITLE_CATEGORY ) , TICKET_CATEGORIES )
if ( categoryId ) then
-- contextual subcategories
local subcategories = TICKET_SUBCATEGORIES [ categoryId ]
if ( subcategories ) then
self : AddDropdownEntry ( TICKET_FIELD_SUBCATEGORY , GetString ( SI_GAMEPAD_HELP_FIELD_TITLE_SUBCATEGORY ) , subcategories )
end
-- required fields
if categoryId ~= TICKET_CATEGORY_CHARACTER_ISSUE and categoryId ~= TICKET_CATEGORY_OTHER then
self : AddTextFieldEntry ( TICKET_FIELD_REQUIRED_DETAILS , GetString ( SI_GAMEPAD_HELP_FIELD_TITLE_REQUIRED_DETAILS ) , FIELD_IS_REQUIRED , self . requiredInfoProvidedInternally )
end
end
-- additional details
self : AddTextFieldEntry ( TICKET_FIELD_ADDITIONAL_DETAILS , GetString ( SI_GAMEPAD_HELP_FIELD_TITLE_ADDITIONAL_DETAILS ) )
end
if ( self . activeEditBox ) then
end
end
end
end
end |