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 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 |
---------------------
--Crown Crates Pack--
---------------------
ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH = 1024
ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT = 1024
ZO_CROWN_CRATES_PACK_TEXTURE_LID_HEIGHT = 44
ZO_CROWN_CRATES_PACK_WIDTH_TO_HEIGHT_RATIO = 1
ZO_CROWN_CRATES_PACK_WIDTH_TO_DEPTH_RATIO = 1
ZO_CROWN_CRATES_PACK_HEIGHT_TO_LID_THICKNESS_RATIO = ZO_CROWN_CRATES_PACK_TEXTURE_LID_HEIGHT / ( ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT * 0.5 )
ZO_CROWN_CRATES_PACK_WIDTH_WORLD = 0.1
ZO_CROWN_CRATES_PACK_HEIGHT_WORLD = ZO_CROWN_CRATES_PACK_WIDTH_WORLD * ZO_CROWN_CRATES_PACK_WIDTH_TO_HEIGHT_RATIO
ZO_CROWN_CRATES_PACK_DEPTH_WORLD = ZO_CROWN_CRATES_PACK_WIDTH_WORLD * ZO_CROWN_CRATES_PACK_WIDTH_TO_DEPTH_RATIO
ZO_CROWN_CRATES_PACK_LID_THICKNESS_WORLD = ZO_CROWN_CRATES_PACK_HEIGHT_WORLD * ZO_CROWN_CRATES_PACK_HEIGHT_TO_LID_THICKNESS_RATIO
ZO_CROWN_CRATES_PACK_WIDTH_UI = 350
ZO_CROWN_CRATES_PACK_SPACING_UI = 75
ZO_CROWN_CRATES_PACK_OFFSET_Y_UI = 120
ZO_CROWN_CRATES_PACK_PLACEHOLDER_ALPHA = 0.4
ZO_CROWN_CRATES_PACK_NORMAL_ALPHA = 1
ZO_CROWN_CRATES_PACK_FRONT_MOUSE_PLANE_BUFFER_WORLD = 3
ZO_CROWN_CRATES_PACK_COUNT_LABEL_HEIGHT_UI = 42
ZO_CROWN_CRATES_PACK_COUNT_LABEL_INSET_X_PERCENT = 0.1
ZO_CROWN_CRATES_PACK_COUNT_LABEL_INSET_Y_PERCENT = 0.05
ZO_CROWN_CRATES_PACK_SHOW_MOVE_DURATION_MS = 800
ZO_CROWN_CRATES_PACK_SHOW_SPIN_DURATION_MS = 700
ZO_CROWN_CRATES_PACK_SHOW_SPIN_DELAY_MS = 100
ZO_CROWN_CRATES_PACK_SHOW_SPACING_MS = 100
ZO_CROWN_CRATES_PACK_SELECTION_DURATION_MS = 300
ZO_CROWN_CRATES_PACK_SELECTION_OFFSET_Y_UI = 40
ZO_CROWN_CRATES_PACK_HIDE_DURATION_MS = 200
ZO_CROWN_CRATES_PACK_HIDE_OFFSET_Y_UI = - 40
ZO_CROWN_CRATES_PACK_CHOOSE_MOVE_DURATION_MS = 650
ZO_CROWN_CRATES_PACK_CHOOSE_ROTATE_DURATION_MS = 200
ZO_CROWN_CRATES_PACK_CHOOSE_HIDE_DELAY_MS = 450
ZO_CROWN_CRATES_PACK_CHOOSE_HIDE_DURATION_MS = 300
ZO_CROWN_CRATES_PACK_CHOOSE_OFFSET_Y_UI = 150
--Show Info
ZO_CROWN_CRATES_PACK_INFO_AREA_HEIGHT_UI = ZO_CROWN_CRATES_PACK_OFFSET_Y_UI
ZO_CROWN_CRATES_PACK_SHOW_INFO_DURATION_MS = 220
--Hide Info
ZO_CROWN_CRATES_PACK_HIDE_INFO_DURATION_MS = 200
--Animations
ZO_CROWN_CRATES_ANIMATION_PACK_SHOW = "packShow"
ZO_CROWN_CRATES_ANIMATION_PACK_SHOW_INFO = "packShowInfo"
ZO_CROWN_CRATES_ANIMATION_PACK_HIDE_INFO = "packHideInfo"
ZO_CROWN_CRATES_ANIMATION_PACK_SELECT = "packSelect"
ZO_CROWN_CRATES_ANIMATION_PACK_DESELECT = "packDeselect"
ZO_CROWN_CRATES_ANIMATION_PACK_GLOW = "packGlow"
ZO_CROWN_CRATES_ANIMATION_PACK_HIDE = "packHide"
ZO_CROWN_CRATES_ANIMATION_PACK_CHOOSE = "packChoose"
ZO_CROWN_CRATES_ANIMATION_PACK_OPEN = "packOpen"
end
self . owner = owner
self . box = box
--Because these textures use the depth buffer and can be transparent the order in which they render matters. If something closer to the camera is drawn
--before something farther, then the farther plane will not appear under the closer one even if the closer one is transparent. We use this to simplify
--the look of the transparent box.
--Lid (Drawn First)
local lid = owner : CreateRectagularPrism ( self . box , ZO_CROWN_CRATES_PACK_WIDTH_WORLD , ZO_CROWN_CRATES_PACK_LID_THICKNESS_WORLD , ZO_CROWN_CRATES_PACK_DEPTH_WORLD , 0.5 , 0 , 1 )
self . lidRootOffsetY = 0.5 * ZO_CROWN_CRATES_PACK_HEIGHT_WORLD - ZO_CROWN_CRATES_PACK_LID_THICKNESS_WORLD
box . lid = lid
--Draw the front and top first since they will remove the left/right/back planes from showing.
lid . left : SetTextureCoords ( 512 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 1024 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 512 / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT , ( 512 + ZO_CROWN_CRATES_PACK_TEXTURE_LID_HEIGHT ) / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT )
lid . front : SetTextureCoords ( 0 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 512 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 512 / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT , ( 512 + ZO_CROWN_CRATES_PACK_TEXTURE_LID_HEIGHT ) / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT )
lid . right : SetTextureCoords ( 512 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 1024 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 512 / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT , ( 512 + ZO_CROWN_CRATES_PACK_TEXTURE_LID_HEIGHT ) / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT )
lid . back : SetTextureCoords ( 0 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 512 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 512 / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT , ( 512 + ZO_CROWN_CRATES_PACK_TEXTURE_LID_HEIGHT ) / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT )
lid . top : SetTextureCoords ( 0 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 512 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 0 / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT , 512 / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT )
lid . bottom : SetTextureCoords ( 512 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 1024 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 512 / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT , 1024 / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT )
--Body (Drawn Second)
local body = owner : CreateRectagularPrism ( self . box , ZO_CROWN_CRATES_PACK_WIDTH_WORLD , ZO_CROWN_CRATES_PACK_HEIGHT_WORLD - ZO_CROWN_CRATES_PACK_LID_THICKNESS_WORLD , ZO_CROWN_CRATES_PACK_DEPTH_WORLD , 0.5 , 0.5 , 0.5 )
--Draw the front and top first since they will remove the left/right/back planes from showing.
box . body = body
body . left : SetTextureCoords ( 512 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 1024 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , ( 512 + ZO_CROWN_CRATES_PACK_TEXTURE_LID_HEIGHT ) / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT , 1024 / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT )
body . front : SetTextureCoords ( 0 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 512 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , ( 512 + ZO_CROWN_CRATES_PACK_TEXTURE_LID_HEIGHT ) / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT , 1024 / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT )
body . right : SetTextureCoords ( 512 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 1024 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , ( 512 + ZO_CROWN_CRATES_PACK_TEXTURE_LID_HEIGHT ) / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT , 1024 / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT )
body . back : SetTextureCoords ( 0 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 512 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , ( 512 + ZO_CROWN_CRATES_PACK_TEXTURE_LID_HEIGHT ) / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT , 1024 / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT )
body . top : SetTextureCoords ( 0 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 512 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 0 / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT , 512 / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT )
body . bottom : SetTextureCoords ( 512 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 1024 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 512 / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT , 1024 / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT )
--"Shadow" the top surface
local glowFront = owner : CreateCenteredFace ( body , ZO_CROWN_CRATES_PACK_WIDTH_WORLD , ZO_CROWN_CRATES_PACK_HEIGHT_WORLD - ZO_CROWN_CRATES_PACK_LID_THICKNESS_WORLD )
body . glowFront = glowFront
body . glowFront : SetTextureCoords ( 512 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , 1024 / ZO_CROWN_CRATES_PACK_TEXTURE_WIDTH , ZO_CROWN_CRATES_PACK_TEXTURE_LID_HEIGHT / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT , 512 / ZO_CROWN_CRATES_PACK_TEXTURE_HEIGHT )
--Front Mouse Plane
local frontMousePlaneHeightWorld = ZO_CROWN_CRATES_PACK_HEIGHT_WORLD + ZO_CROWN_CRATES_PACK_FRONT_MOUSE_PLANE_BUFFER_WORLD
local frontMousePlane = owner : CreateCenteredFace ( box , ZO_CROWN_CRATES_PACK_WIDTH_WORLD , frontMousePlaneHeightWorld )
frontMousePlane : Set3DRenderSpaceOrigin ( frontOriginX , frontOriginY - 0.5 * frontMousePlaneHeightWorld + 0.5 * ZO_CROWN_CRATES_PACK_HEIGHT_WORLD , frontOriginZ )
self . frontMousePlane = frontMousePlane
end
end
--where ... is a list of controls to add the handlers to
end
end
end
do
local KEYBOARD_STYLE =
{
nameFonts =
{
{
font = "ZoFontWinH1" ,
lineLimit = 2 ,
} ,
{
font = "ZoFontWinH2" ,
lineLimit = 2 ,
} ,
{
font = "ZoFontWinH3" ,
lineLimit = 2 ,
dontUseForAdjusting = true ,
} ,
} ,
}
local GAMEPAD_STYLE =
{
nameFonts =
{
{
font = "ZoFontGamepad42" ,
lineLimit = 2 ,
} ,
{
font = "ZoFontGamepad36" ,
lineLimit = 2 ,
} ,
{
font = "ZoFontGamepad34" ,
lineLimit = 2 ,
} ,
{
font = "ZoFontGamepad27" ,
lineLimit = 2 ,
dontUseForAdjusting = true ,
} ,
} ,
}
end
end
ZO_FontAdjustingWrapLabel_OnInitialized ( self . infoNameLabel , style . nameFonts , TEXT_WRAP_MODE_ELLIPSIS )
end
self . crateId = nil
self . visualCrateId = nil
self . visualSlotIndex = nil
local box = self . box
self . visuallySelected = false
self . rootX = nil
self . rootY = nil
self . rootZ = nil
end
self . crateId = crateId
local visualCrateId = crateId
if not visualCrateId then
end
self . visualCrateId = visualCrateId
self . visualSlotIndex = visualSlotIndex
if visualCrateId then
local box = self . box
box : SetAlpha ( isPlaceholderCrate and ZO_CROWN_CRATES_PACK_PLACEHOLDER_ALPHA or ZO_CROWN_CRATES_PACK_NORMAL_ALPHA )
local body = box . body
local lid = box . lid
end
if isPlaceholderCrate then
else
if crateCount > 1 then
self . infoNameLabel : SetText ( zo_strformat ( SI_CROWN_CRATE_PACK_WITH_STACK_NAME , crateName , crateCount ) )
else
end
end
end
return self . crateId == nil
end
return self . crateId
end
end
end
end
end
end
end
self . control : Set3DRenderSpaceOrientation ( ZO_CROWN_CRATES_PACK_SHOW_START_PITCH_RADIANS , ZO_CROWN_CRATES_PACK_SHOW_START_YAW_RADIANS , ZO_CROWN_CRATES_PACK_SHOW_START_ROLL_RADIANS )
local animationTimeline = self : AcquireAndApplyAnimationTimeline ( ZO_CROWN_CRATES_ANIMATION_PACK_SHOW , self . control , function ( timeline , completedPlaying )
if completedPlaying then
--Mouse input on the crate is not enabled until it is finished showing. This will prevent the case where the mouse enters the
--crate and then exits it again as it flips and then enters once more but we suppress the enter because of the bounce prevention logic.
end
end )
rotateAnimation : SetRotationValues ( ZO_CROWN_CRATES_PACK_SHOW_START_PITCH_RADIANS , ZO_CROWN_CRATES_PACK_SHOW_START_YAW_RADIANS , ZO_CROWN_CRATES_PACK_SHOW_START_ROLL_RADIANS ,
ZO_CROWN_CRATES_PACK_SHOW_END_PITCH_RADIANS , ZO_CROWN_CRATES_PACK_SHOW_END_YAW_RADIANS , ZO_CROWN_CRATES_PACK_SHOW_END_ROLL_RADIANS )
self . rootX = endX
self . rootY = endY
self . rootZ = endZ
end
local body = self . box . body
end
local body = self . box . body
end
local timeline = self : AcquireAndApplyAnimationTimeline ( ZO_CROWN_CRATES_ANIMATION_PACK_SELECT , self . control , function ( timeline , completedPlaying )
if completedPlaying then
self . visuallySelected = true
end
end
end )
rotateAnimation : SetRotationValues ( ZO_CROWN_CRATES_PACK_SHOW_END_PITCH_RADIANS , ZO_CROWN_CRATES_PACK_SHOW_END_YAW_RADIANS , ZO_CROWN_CRATES_PACK_SHOW_END_ROLL_RADIANS ,
ZO_CROWN_CRATES_PACK_SELECTED_PITCH_RADIANS , ZO_CROWN_CRATES_PACK_SELECTED_YAW_RADIANS , ZO_CROWN_CRATES_PACK_SELECTED_ROLL_RADIANS )
local offsetYWorld = ZO_CrownCrates . ConvertUIUnitsToWorldUnits ( self . owner : GetManifestCameraPlaneMetrics ( ) , ZO_CROWN_CRATES_PACK_SELECTION_OFFSET_Y_UI )
translateAnimation : SetTranslateOffsets ( self . rootX , self . rootY , self . rootZ , self . rootX , self . rootY + offsetYWorld , self . rootZ )
end
not self . visuallySelected then
end
end
local timeline = self : AcquireAndApplyAnimationTimeline ( ZO_CROWN_CRATES_ANIMATION_PACK_DESELECT , self . control , function ( timeline , completedPlaying )
self . visuallySelected = false
if completedPlaying then
end
end
end )
rotateAnimation : SetRotationValues ( ZO_CROWN_CRATES_PACK_SELECTED_PITCH_RADIANS , ZO_CROWN_CRATES_PACK_SELECTED_YAW_RADIANS , ZO_CROWN_CRATES_PACK_SELECTED_ROLL_RADIANS ,
ZO_CROWN_CRATES_PACK_SHOW_END_PITCH_RADIANS , ZO_CROWN_CRATES_PACK_SHOW_END_YAW_RADIANS , ZO_CROWN_CRATES_PACK_SHOW_END_ROLL_RADIANS )
local offsetYWorld = ZO_CrownCrates . ConvertUIUnitsToWorldUnits ( self . owner : GetManifestCameraPlaneMetrics ( ) , ZO_CROWN_CRATES_PACK_SELECTION_OFFSET_Y_UI )
translateAnimation : SetTranslateOffsets ( self . rootX , self . rootY + offsetYWorld , self . rootZ , self . rootX , self . rootY , self . rootZ )
end
self . visuallySelected then
end
end
local animationTimeline = self : AcquireAndApplyAnimationTimeline ( ZO_CROWN_CRATES_ANIMATION_PACK_SHOW_INFO , self . infoControl )
local infoX , infoY = ZO_CrownCrates . ComputeSlotBottomUIPosition ( ZO_CROWN_CRATES_PACK_WIDTH_UI , ZO_CROWN_CRATES_PACK_SPACING_UI , self . visualSlotIndex , self . owner : GetVisualPackCount ( ) )
end
local animationTimeline = self : AcquireAndApplyAnimationTimeline ( ZO_CROWN_CRATES_ANIMATION_PACK_HIDE_INFO , self . infoControl )
end
local timeline = self : AcquireAndApplyAnimationTimeline ( ZO_CROWN_CRATES_ANIMATION_PACK_HIDE , self . control , function ( timeline , completedPlaying )
if completedPlaying then
end
end )
local endX = startX
local endY = startY + ZO_CrownCrates . ConvertUIUnitsToWorldUnits ( manifestPlaneMetrics , ZO_CROWN_CRATES_PACK_HIDE_OFFSET_Y_UI )
local endZ = startZ
end
local timeline = self : AcquireAndApplyAnimationTimeline ( ZO_CROWN_CRATES_ANIMATION_PACK_CHOOSE , self . control , function ( timeline , completedPlaying )
if completedPlaying then
end
end )
local endX = startX
local endY = startY + ZO_CrownCrates . ConvertUIUnitsToWorldUnits ( manifestPlaneMetrics , ZO_CROWN_CRATES_PACK_CHOOSE_OFFSET_Y_UI )
local endZ = startZ
rotateAnimation : SetRotationValues ( startPitch , startYaw , startRoll , ZO_CROWN_CRATES_PACK_CHOOSEN_PITCH_RADIANS , ZO_CROWN_CRATES_PACK_CHOOSEN_YAW_RADIANS , ZO_CROWN_CRATES_PACK_CHOOSEN_ROLL_RADIANS )
local boxOpenTimeline = self : AcquireAndApplyAnimationTimeline ( ZO_CROWN_CRATES_ANIMATION_PACK_OPEN , self . box . lid )
end
------------------------------
--Crown Crates Pack Choosing--
------------------------------
ZO_CROWN_CRATES_PACK_CHOOSING_PACKS_PER_PAGE = 5
return obj
end
self . owner = owner
self . nextPackIndex = 1
self . packsInVisualOrder = { }
self . initialized = true
end
return self . stateMachine
end
self . stateMachine = stateMachine
end
return self . owner
end
end
local pack = ZO_CrownCratesPack : New ( CreateControlFromVirtual ( "$(parent)Pack" , self . owner : GetControl ( ) , "ZO_CrownCratePack" , self . nextPackIndex ) , self )
self . nextPackIndex = self . nextPackIndex + 1
return pack
end
end
-- Keyboard --
self . keyboardManifestKeybindStripDescriptor =
{
alignment = KEYBIND_STRIP_ALIGN_CENTER ,
{
keybind = "UI_SHORTCUT_PRIMARY" ,
end ,
return true
end
return false , GetString ( "SI_LOOTCRATEOPENRESPONSE" , LOOT_CRATE_OPEN_RESPONSE_OUT_OF_ALL_LOOT_CRATES )
end
} ,
ZO_CROWN_CRATES_BUY_CRATES_KEYBIND_KEYBOARD ,
}
-- Gamepad --
self . gamepadManifestKeybindStripDescriptor =
{
alignment = KEYBIND_STRIP_ALIGN_CENTER ,
{
keybind = "UI_SHORTCUT_PRIMARY" ,
end ,
return true
end
return false , GetString ( "SI_LOOTCRATEOPENRESPONSE" , LOOT_CRATE_OPEN_RESPONSE_OUT_OF_ALL_LOOT_CRATES )
end
} ,
ZO_CROWN_CRATES_BUY_CRATES_KEYBIND_GAMEPAD ,
}
end
self . manifestCameraPlaneMetrics = self . owner : ComputeCameraPlaneMetrics ( ZO_CROWN_CRATES_PACK_WIDTH_WORLD , ZO_CROWN_CRATES_PACK_WIDTH_UI )
end
end
return self . manifestCameraPlaneMetrics
end
self . currentPage = nil
self . crateIds = nil
self . chosenPack = nil
self . selectedPack = nil
end
function ZO_CrownCratesPackChoosing : CreateRectagularPrism ( parentControl , width , height , depth , registrationX , registrationY , registrationZ , texture )
local centerX = width * ( 0.5 - registrationX )
local centerY = height * ( 0.5 - registrationY )
local centerZ = depth * ( 0.5 - registrationZ )
--Front
prism . front = frontFace
--Back
prism . back = backFace
--Bottom
prism . bottom = bottomFace
--Top
prism . top = topFace
--Left
prism . left = leftFace
--Right
prism . right = rightFace
return prism
end
return face
end
end
local crateIds = { }
end
self . crateIds = crateIds
self . currentPage = 1
if # self . crateIds > 0 then
else
self . numPages = 0
end
end
if pack ~= self . chosenPack then
end
end
end
end
end
function ZO_CrownCratesPackChoosing : ComputeSlotCenterWorldPosition ( planeMetrics , spacingUI , bottomOffsetUI , bottomOffsetWorld , slotIndex , totalSlots )
local spacingWorldWidth = spacingUI * planeMetrics . worldUnitsPerUIUnit
local totalWorldWidth = totalSlots * ZO_CROWN_CRATES_PACK_WIDTH_WORLD + ( totalSlots - 1 ) * spacingWorldWidth
local slotCenterX = ZO_CROWN_CRATES_PACK_WIDTH_WORLD * 0.5 + ( slotIndex - 1 ) * ( ZO_CROWN_CRATES_PACK_WIDTH_WORLD + spacingWorldWidth )
local x = slotCenterX - totalWorldWidth * 0.5
local y = planeMetrics . frustumHeightWorld * - 0.5 + bottomOffsetUI * planeMetrics . worldUnitsPerUIUnit + bottomOffsetWorld + ZO_CROWN_CRATES_PACK_HEIGHT_WORLD * 0.5
--we build the box from the center, but we choose its world width based on the front, so push it half its depth into the screen so its front is registered with manifest plane.
local z = planeMetrics . depthFromCamera + ZO_CROWN_CRATES_PACK_DEPTH_WORLD * 0.5
return x , y , z
end
--20 more units off the bottom to start so the packs are just peeking above the bottom of the screen
local ADDITIONAL_START_OFFSET_Y = - 20
local startX , startY , startZ = self : ComputeSlotCenterWorldPosition ( self . manifestCameraPlaneMetrics , ZO_CROWN_CRATES_PACK_SPACING_UI , ADDITIONAL_START_OFFSET_Y , - ZO_CROWN_CRATES_PACK_HEIGHT_WORLD , packIndex , numPacks )
local endX , endY , endZ = self : ComputeSlotCenterWorldPosition ( self . manifestCameraPlaneMetrics , ZO_CROWN_CRATES_PACK_SPACING_UI , ZO_CROWN_CRATES_PACK_OFFSET_Y_UI + ZO_CrownCrates . GetBottomOffsetUI ( ) , 0 , packIndex , numPacks )
end , ( packIndex - 1 ) * ZO_CROWN_CRATES_PACK_SHOW_SPACING_MS + 1 )
self . packsInVisualOrder [ packIndex ] = pack
end
if # self . crateIds > 0 then
local startIndex = 1 + ( self . currentPage - 1 ) * ZO_CROWN_CRATES_PACK_CHOOSING_PACKS_PER_PAGE
local endIndex = self . currentPage * ZO_CROWN_CRATES_PACK_CHOOSING_PACKS_PER_PAGE
local packIndex = 1
local numPacks = endIndex - startIndex + 1
for i = startIndex , endIndex do
local crateId = self . crateIds [ i ]
packIndex = packIndex + 1
end
else
end
end
ZO_AlertEvent ( EVENT_CROWN_CRATE_OPEN_RESPONSE , nil , LOOT_CRATE_OPEN_RESPONSE_OUT_OF_ALL_LOOT_CRATES )
else
self . chosenPack = chosenPack
else
ZO_AlertEvent ( EVENT_CROWN_CRATE_OPEN_RESPONSE , crownCrateId , LOOT_CRATE_OPEN_RESPONSE_FAIL_NO_INVENTORY_SPACE )
end
end
end
end
end
end
return self . currentPage
end
local page = self . currentPage - 1
return page == 0 and self . numPages or page
end
local page = self . currentPage + 1
return page > self . numPages and 1 or page
end
if self . crateIds then
if page > 0 and page < self . numPages then
return ZO_CROWN_CRATES_PACK_CHOOSING_PACKS_PER_PAGE
elseif page == self . numPages then
end
end
return 0
end
if self . initialized then
else
end
end
end
if self . initialized then
else
end
end
end
local nextPack
if selectedPack then
local nextVisualSlotIndex = selectedPack . visualSlotIndex + selectedDirection
nextVisualSlotIndex = 1
elseif nextVisualSlotIndex < 1 then
end
else
-- this is specifically for players using the gamepad UI but using a mouse and gamepad to navigate this
end
end
end
return self . packsInVisualOrder [ visualIndex ]
end
return # self . packsInVisualOrder
end
return self . selectedPack
end
if self . selectedPack ~= pack then
if self . selectedPack then
end
self . selectedPack = pack
if pack then
end
end
end
if self . selectedPack then
end
end
--Pack Mouse Behavior
end
end
end
end
end
end |