From b4b2350b888f49011940b61ab646088726dd5f3b Mon Sep 17 00:00:00 2001 From: diamante0018 Date: Thu, 12 Sep 2024 17:25:45 +0200 Subject: [PATCH] init --- .gitignore | 1 + README.md | 2 + lui/actionscontrols.dec.lua | 232 + lui/advancedvideo.dec.lua | 685 ++ lui/bootscreenmargins.dec.lua | 285 + lui/buttondesctext.dec.lua | 75 + lui/buttonhelpertext.dec.lua | 686 ++ lui/chatcontrols.dec.lua | 159 + lui/cod.dec.lua | 1558 ++++ lui/codedependence.dec.lua | 587 ++ lui/common_menus/caccustomizeutils.dec.lua | 1314 ++++ lui/common_menus/cacutils.dec.lua | 426 ++ lui/common_menus/commonpopups.dec.lua | 2095 ++++++ lui/common_menus/friendslist.dec.lua | 2760 +++++++ lui/common_menus/friendslistutils.dec.lua | 16 + lui/common_menus/friendswidget.dec.lua | 150 + lui/common_menus/gamemanual.dec.lua | 423 ++ lui/common_menus/kinectcontrolmenu.dec.lua | 782 ++ lui/common_menus/kinectutils.dec.lua | 1023 +++ lui/common_menus/options.dec.lua | 1142 +++ lui/common_menus/optionslayout.dec.lua | 3699 ++++++++++ lui/common_menus/playercard.dec.lua | 425 ++ lui/common_menus/profilepopup.dec.lua | 122 + lui/common_menus/rankutils.dec.lua | 123 + lui/common_menus/virtualkeyboard.dec.lua | 129 + lui/common_menus/whatcanisay.dec.lua | 372 + lui/default.dec.lua | 1 + lui/eventcatcher.dec.lua | 124 + lui/flowmanager.dec.lua | 1068 +++ lui/gamepadcontrols.dec.lua | 405 + lui/gamex.dec.lua | 288 + lui/hudmanager.dec.lua | 215 + lui/lookcontrols.dec.lua | 300 + lui/lui.dec.lua | 289 + lui/luianimnumber.dec.lua | 56 + lui/luibarrellist.dec.lua | 295 + lui/luibindbutton.dec.lua | 105 + lui/luibutton.dec.lua | 415 ++ lui/luibuttonrepeater.dec.lua | 165 + lui/luicharacterwindow.dec.lua | 19 + lui/luicountdown.dec.lua | 40 + lui/luielement.dec.lua | 730 ++ lui/luigrid.dec.lua | 289 + lui/luihorizontallist.dec.lua | 144 + lui/luiimage.dec.lua | 13 + lui/luilitimage.dec.lua | 13 + lui/luilongcountdown.dec.lua | 25 + lui/luimarqueetext.dec.lua | 284 + lui/luimousecursor.dec.lua | 59 + lui/luiprettynumber.dec.lua | 22 + lui/luiroot.dec.lua | 478 ++ lui/luisafeareaoverlay.dec.lua | 75 + lui/luiscrollable.dec.lua | 74 + lui/luiscrollingverticallist.dec.lua | 178 + lui/luitechydigits.dec.lua | 21 + lui/luitest.dec.lua | 369 + lui/luitext.dec.lua | 44 + lui/luitighttext.dec.lua | 7 + lui/luitimer.dec.lua | 134 + lui/luiverticallist.dec.lua | 185 + lui/luiverticalscrollbar.dec.lua | 261 + lui/menuautonav.dec.lua | 780 ++ lui/menubuilder.dec.lua | 1182 +++ lui/menugenericbuttons.dec.lua | 2027 +++++ lui/menugenerics.dec.lua | 2341 ++++++ lui/movementcontrols.dec.lua | 164 + lui/mp_hud/a10overlayhud.dec.lua | 801 ++ lui/mp_hud/ac130overlayhud.dec.lua | 1244 ++++ lui/mp_hud/aliencapturinghud.dec.lua | 449 ++ lui/mp_hud/alienchaos.dec.lua | 1720 +++++ lui/mp_hud/alienhud.dec.lua | 6534 +++++++++++++++++ lui/mp_hud/alienhudtechtree.dec.lua | 1452 ++++ lui/mp_hud/alienscoreboards.dec.lua | 1405 ++++ lui/mp_hud/alienvanguardoverlayhud.dec.lua | 624 ++ lui/mp_hud/capturinghud.dec.lua | 983 +++ lui/mp_hud/charselectmenu.dec.lua | 561 ++ lui/mp_hud/damagefeedbackhud.dec.lua | 630 ++ lui/mp_hud/dighud.dec.lua | 314 + lui/mp_hud/endgamemenu.dec.lua | 230 + lui/mp_hud/fireteamhud.dec.lua | 152 + lui/mp_hud/fireteammenu.dec.lua | 476 ++ lui/mp_hud/gamemessagehud.dec.lua | 97 + lui/mp_hud/helicopterpilotoverlayhud.dec.lua | 751 ++ lui/mp_hud/hints.dec.lua | 182 + lui/mp_hud/hordehud.dec.lua | 646 ++ lui/mp_hud/hordeperkshud.dec.lua | 437 ++ lui/mp_hud/hostmigration.dec.lua | 84 + lui/mp_hud/hud.dec.lua | 1434 ++++ lui/mp_hud/hudutils.dec.lua | 68 + lui/mp_hud/ingameactionscontrols.dec.lua | 271 + lui/mp_hud/ingameadvancedvideo.dec.lua | 732 ++ lui/mp_hud/ingamechatcontrols.dec.lua | 186 + lui/mp_hud/ingamecontrols.dec.lua | 1046 +++ lui/mp_hud/ingamegamepadcontrols.dec.lua | 432 ++ lui/mp_hud/ingamelookcontrols.dec.lua | 327 + lui/mp_hud/ingamemovementcontrols.dec.lua | 203 + lui/mp_hud/ingamepcoptions.dec.lua | 1186 +++ lui/mp_hud/intelchallenges.dec.lua | 219 + lui/mp_hud/jammereffecthud.dec.lua | 249 + lui/mp_hud/juggernautoverlayhud.dec.lua | 53 + lui/mp_hud/killcamhud.dec.lua | 948 +++ lui/mp_hud/killstreakhud.dec.lua | 847 +++ lui/mp_hud/matchstarthud.dec.lua | 734 ++ lui/mp_hud/minimaphud.dec.lua | 290 + lui/mp_hud/mlghud.dec.lua | 2227 ++++++ lui/mp_hud/muteplayers.dec.lua | 1080 +++ lui/mp_hud/obituaryhud.dec.lua | 522 ++ lui/mp_hud/odinoverlayhud.dec.lua | 807 ++ lui/mp_hud/optionsmenu.dec.lua | 677 ++ lui/mp_hud/optionsmenuscoreboard.dec.lua | 897 +++ lui/mp_hud/overlayhud.dec.lua | 277 + lui/mp_hud/perksonspawnhud.dec.lua | 197 + lui/mp_hud/playercardhud.dec.lua | 171 + lui/mp_hud/playerinfohud.dec.lua | 1047 +++ lui/mp_hud/pointspopuphud.dec.lua | 389 + lui/mp_hud/predatormissileoverlayhud.dec.lua | 274 + lui/mp_hud/predatoroverlayhud2.dec.lua | 519 ++ lui/mp_hud/roundendhud.dec.lua | 1287 ++++ lui/mp_hud/scoreboard.dec.lua | 1345 ++++ lui/mp_hud/scorelisthud.dec.lua | 1220 +++ lui/mp_hud/screeneffectshud.dec.lua | 184 + lui/mp_hud/spectatorhud.dec.lua | 140 + lui/mp_hud/splasheshud.dec.lua | 825 +++ lui/mp_hud/talkerhud.dec.lua | 235 + lui/mp_hud/teamscoreshud.dec.lua | 519 ++ lui/mp_hud/teamselect.dec.lua | 192 + lui/mp_hud/timershud.dec.lua | 581 ++ lui/mp_hud/vanguardoverlayhud.dec.lua | 545 ++ lui/mp_hud/weaponattachment.dec.lua | 242 + lui/mp_hud/weaponinfohud.dec.lua | 906 +++ lui/mp_menus/aarcommon.dec.lua | 449 ++ lui/mp_menus/aarmain.dec.lua | 314 + lui/mp_menus/aarmini.dec.lua | 607 ++ lui/mp_menus/aaroperationprogress.dec.lua | 396 + lui/mp_menus/aarscoreboard.dec.lua | 800 ++ lui/mp_menus/aarsquadsummary.dec.lua | 495 ++ lui/mp_menus/aarsummary.dec.lua | 1388 ++++ lui/mp_menus/aarunlockscreen.dec.lua | 860 +++ lui/mp_menus/aarutils.dec.lua | 153 + lui/mp_menus/aliens.dec.lua | 1237 ++++ lui/mp_menus/aliensintel.dec.lua | 990 +++ lui/mp_menus/aliensloadout.dec.lua | 2736 +++++++ lui/mp_menus/alienspurchasables.dec.lua | 1428 ++++ lui/mp_menus/archetypeselect.dec.lua | 954 +++ lui/mp_menus/cacabilitiesalt.dec.lua | 1922 +++++ lui/mp_menus/caccustomize.dec.lua | 2731 +++++++ lui/mp_menus/cacedit.dec.lua | 699 ++ lui/mp_menus/caceditchooseimagepopup.dec.lua | 1894 +++++ lui/mp_menus/caceditpopup.dec.lua | 213 + lui/mp_menus/caceditselectioninfo.dec.lua | 846 +++ .../caceditweaponattachchoose.dec.lua | 1341 ++++ .../caceditweaponperformanceinfopane.dec.lua | 468 ++ .../caceditweaponstatsinfopane.dec.lua | 602 ++ lui/mp_menus/cacinfopanes.dec.lua | 740 ++ lui/mp_menus/cacloadoututils.dec.lua | 3899 ++++++++++ lui/mp_menus/cacmain.dec.lua | 1355 ++++ lui/mp_menus/cacmemberselect.dec.lua | 1377 ++++ lui/mp_menus/cacprestigedetails.dec.lua | 369 + lui/mp_menus/cacrecap.dec.lua | 2487 +++++++ lui/mp_menus/casabilitybutton.dec.lua | 648 ++ .../choosecodanywhereplatform.dec.lua | 618 ++ lui/mp_menus/clandetails.dec.lua | 1348 ++++ lui/mp_menus/clanelements.dec.lua | 540 ++ lui/mp_menus/claninvites.dec.lua | 620 ++ lui/mp_menus/killstreakselections.dec.lua | 1680 +++++ lui/mp_menus/leaderboards.dec.lua | 1464 ++++ lui/mp_menus/leaderboardutils.dec.lua | 2206 ++++++ lui/mp_menus/loadoutbuilder.dec.lua | 2098 ++++++ lui/mp_menus/luisquadmemberwindow.dec.lua | 923 +++ lui/mp_menus/main.dec.lua | 217 + lui/mp_menus/menudata.dec.lua | 19 + lui/mp_menus/mlgutils.dec.lua | 140 + lui/mp_menus/motdutils.dec.lua | 318 + lui/mp_menus/motdwidgets.dec.lua | 891 +++ lui/mp_menus/mpbarracks.dec.lua | 456 ++ lui/mp_menus/mpcodanywhere.dec.lua | 2920 ++++++++ .../mpcustomclassrestrictions.dec.lua | 607 ++ lui/mp_menus/mpgamemodeselectmenu.dec.lua | 571 ++ lui/mp_menus/mpgamesetupmenu.dec.lua | 516 ++ lui/mp_menus/mpgamesetupmodemenu.dec.lua | 174 + lui/mp_menus/mpgamesetupoptionsmenu.dec.lua | 2439 ++++++ lui/mp_menus/mpleaderboard.dec.lua | 1516 ++++ lui/mp_menus/mpleaderboardpopups.dec.lua | 421 ++ lui/mp_menus/mpliveprivatelobby.dec.lua | 1097 +++ lui/mp_menus/mplivepubliclobby.dec.lua | 1455 ++++ lui/mp_menus/mplobbycharacterview.dec.lua | 324 + lui/mp_menus/mplobbynavigation.dec.lua | 725 ++ lui/mp_menus/mplobbyplayerstats.dec.lua | 828 +++ lui/mp_menus/mplobbysearchwidget.dec.lua | 644 ++ lui/mp_menus/mplobbyutils.dec.lua | 1408 ++++ lui/mp_menus/mplobbywidgets.dec.lua | 1853 +++++ lui/mp_menus/mpmainmenu.dec.lua | 702 ++ lui/mp_menus/mpmapsetupmenu.dec.lua | 550 ++ lui/mp_menus/mpmemberlist.dec.lua | 2453 +++++++ lui/mp_menus/mponlinevault.dec.lua | 1241 ++++ lui/mp_menus/mpplayerpopups.dec.lua | 524 ++ lui/mp_menus/mpplaylist.dec.lua | 1031 +++ lui/mp_menus/mppopups.dec.lua | 1685 +++++ lui/mp_menus/mpprestigereset.dec.lua | 147 + lui/mp_menus/mpsavedmodeselectmenu.dec.lua | 422 ++ lui/mp_menus/mpscreenshotviewer.dec.lua | 140 + lui/mp_menus/mpstatsreset.dec.lua | 54 + lui/mp_menus/mpvault.dec.lua | 136 + lui/mp_menus/mpxboxlivemenu.dec.lua | 1109 +++ lui/mp_menus/operations.dec.lua | 3389 +++++++++ lui/mp_menus/operationsutils.dec.lua | 1093 +++ lui/mp_menus/playerdatainit.dec.lua | 239 + lui/mp_menus/snselements.dec.lua | 1410 ++++ lui/mp_menus/snsutils.dec.lua | 333 + lui/mp_menus/socialfeed.dec.lua | 1337 ++++ lui/mp_menus/splitscreengamesetupmenu.dec.lua | 689 ++ lui/mp_menus/splitscreensignin.dec.lua | 622 ++ lui/mp_menus/squadprepartylobby.dec.lua | 77 + lui/mp_menus/squadreportdetail.dec.lua | 1247 ++++ lui/mp_menus/squadreports.dec.lua | 1140 +++ lui/mp_menus/squadsmodeselect.dec.lua | 1293 ++++ lui/mp_menus/store.dec.lua | 622 ++ lui/mp_menus/svsutils.dec.lua | 642 ++ lui/mp_menus/systemlinkgamesetupmenu.dec.lua | 512 ++ lui/mp_menus/systemlinkjoinmenu.dec.lua | 429 ++ lui/mp_menus/systemlinkmenu.dec.lua | 204 + lui/pcoptions.dec.lua | 1159 +++ lui/persistentbackground.dec.lua | 1055 +++ lui/speech.dec.lua | 188 + 224 files changed, 172565 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 lui/actionscontrols.dec.lua create mode 100644 lui/advancedvideo.dec.lua create mode 100644 lui/bootscreenmargins.dec.lua create mode 100644 lui/buttondesctext.dec.lua create mode 100644 lui/buttonhelpertext.dec.lua create mode 100644 lui/chatcontrols.dec.lua create mode 100644 lui/cod.dec.lua create mode 100644 lui/codedependence.dec.lua create mode 100644 lui/common_menus/caccustomizeutils.dec.lua create mode 100644 lui/common_menus/cacutils.dec.lua create mode 100644 lui/common_menus/commonpopups.dec.lua create mode 100644 lui/common_menus/friendslist.dec.lua create mode 100644 lui/common_menus/friendslistutils.dec.lua create mode 100644 lui/common_menus/friendswidget.dec.lua create mode 100644 lui/common_menus/gamemanual.dec.lua create mode 100644 lui/common_menus/kinectcontrolmenu.dec.lua create mode 100644 lui/common_menus/kinectutils.dec.lua create mode 100644 lui/common_menus/options.dec.lua create mode 100644 lui/common_menus/optionslayout.dec.lua create mode 100644 lui/common_menus/playercard.dec.lua create mode 100644 lui/common_menus/profilepopup.dec.lua create mode 100644 lui/common_menus/rankutils.dec.lua create mode 100644 lui/common_menus/virtualkeyboard.dec.lua create mode 100644 lui/common_menus/whatcanisay.dec.lua create mode 100644 lui/default.dec.lua create mode 100644 lui/eventcatcher.dec.lua create mode 100644 lui/flowmanager.dec.lua create mode 100644 lui/gamepadcontrols.dec.lua create mode 100644 lui/gamex.dec.lua create mode 100644 lui/hudmanager.dec.lua create mode 100644 lui/lookcontrols.dec.lua create mode 100644 lui/lui.dec.lua create mode 100644 lui/luianimnumber.dec.lua create mode 100644 lui/luibarrellist.dec.lua create mode 100644 lui/luibindbutton.dec.lua create mode 100644 lui/luibutton.dec.lua create mode 100644 lui/luibuttonrepeater.dec.lua create mode 100644 lui/luicharacterwindow.dec.lua create mode 100644 lui/luicountdown.dec.lua create mode 100644 lui/luielement.dec.lua create mode 100644 lui/luigrid.dec.lua create mode 100644 lui/luihorizontallist.dec.lua create mode 100644 lui/luiimage.dec.lua create mode 100644 lui/luilitimage.dec.lua create mode 100644 lui/luilongcountdown.dec.lua create mode 100644 lui/luimarqueetext.dec.lua create mode 100644 lui/luimousecursor.dec.lua create mode 100644 lui/luiprettynumber.dec.lua create mode 100644 lui/luiroot.dec.lua create mode 100644 lui/luisafeareaoverlay.dec.lua create mode 100644 lui/luiscrollable.dec.lua create mode 100644 lui/luiscrollingverticallist.dec.lua create mode 100644 lui/luitechydigits.dec.lua create mode 100644 lui/luitest.dec.lua create mode 100644 lui/luitext.dec.lua create mode 100644 lui/luitighttext.dec.lua create mode 100644 lui/luitimer.dec.lua create mode 100644 lui/luiverticallist.dec.lua create mode 100644 lui/luiverticalscrollbar.dec.lua create mode 100644 lui/menuautonav.dec.lua create mode 100644 lui/menubuilder.dec.lua create mode 100644 lui/menugenericbuttons.dec.lua create mode 100644 lui/menugenerics.dec.lua create mode 100644 lui/movementcontrols.dec.lua create mode 100644 lui/mp_hud/a10overlayhud.dec.lua create mode 100644 lui/mp_hud/ac130overlayhud.dec.lua create mode 100644 lui/mp_hud/aliencapturinghud.dec.lua create mode 100644 lui/mp_hud/alienchaos.dec.lua create mode 100644 lui/mp_hud/alienhud.dec.lua create mode 100644 lui/mp_hud/alienhudtechtree.dec.lua create mode 100644 lui/mp_hud/alienscoreboards.dec.lua create mode 100644 lui/mp_hud/alienvanguardoverlayhud.dec.lua create mode 100644 lui/mp_hud/capturinghud.dec.lua create mode 100644 lui/mp_hud/charselectmenu.dec.lua create mode 100644 lui/mp_hud/damagefeedbackhud.dec.lua create mode 100644 lui/mp_hud/dighud.dec.lua create mode 100644 lui/mp_hud/endgamemenu.dec.lua create mode 100644 lui/mp_hud/fireteamhud.dec.lua create mode 100644 lui/mp_hud/fireteammenu.dec.lua create mode 100644 lui/mp_hud/gamemessagehud.dec.lua create mode 100644 lui/mp_hud/helicopterpilotoverlayhud.dec.lua create mode 100644 lui/mp_hud/hints.dec.lua create mode 100644 lui/mp_hud/hordehud.dec.lua create mode 100644 lui/mp_hud/hordeperkshud.dec.lua create mode 100644 lui/mp_hud/hostmigration.dec.lua create mode 100644 lui/mp_hud/hud.dec.lua create mode 100644 lui/mp_hud/hudutils.dec.lua create mode 100644 lui/mp_hud/ingameactionscontrols.dec.lua create mode 100644 lui/mp_hud/ingameadvancedvideo.dec.lua create mode 100644 lui/mp_hud/ingamechatcontrols.dec.lua create mode 100644 lui/mp_hud/ingamecontrols.dec.lua create mode 100644 lui/mp_hud/ingamegamepadcontrols.dec.lua create mode 100644 lui/mp_hud/ingamelookcontrols.dec.lua create mode 100644 lui/mp_hud/ingamemovementcontrols.dec.lua create mode 100644 lui/mp_hud/ingamepcoptions.dec.lua create mode 100644 lui/mp_hud/intelchallenges.dec.lua create mode 100644 lui/mp_hud/jammereffecthud.dec.lua create mode 100644 lui/mp_hud/juggernautoverlayhud.dec.lua create mode 100644 lui/mp_hud/killcamhud.dec.lua create mode 100644 lui/mp_hud/killstreakhud.dec.lua create mode 100644 lui/mp_hud/matchstarthud.dec.lua create mode 100644 lui/mp_hud/minimaphud.dec.lua create mode 100644 lui/mp_hud/mlghud.dec.lua create mode 100644 lui/mp_hud/muteplayers.dec.lua create mode 100644 lui/mp_hud/obituaryhud.dec.lua create mode 100644 lui/mp_hud/odinoverlayhud.dec.lua create mode 100644 lui/mp_hud/optionsmenu.dec.lua create mode 100644 lui/mp_hud/optionsmenuscoreboard.dec.lua create mode 100644 lui/mp_hud/overlayhud.dec.lua create mode 100644 lui/mp_hud/perksonspawnhud.dec.lua create mode 100644 lui/mp_hud/playercardhud.dec.lua create mode 100644 lui/mp_hud/playerinfohud.dec.lua create mode 100644 lui/mp_hud/pointspopuphud.dec.lua create mode 100644 lui/mp_hud/predatormissileoverlayhud.dec.lua create mode 100644 lui/mp_hud/predatoroverlayhud2.dec.lua create mode 100644 lui/mp_hud/roundendhud.dec.lua create mode 100644 lui/mp_hud/scoreboard.dec.lua create mode 100644 lui/mp_hud/scorelisthud.dec.lua create mode 100644 lui/mp_hud/screeneffectshud.dec.lua create mode 100644 lui/mp_hud/spectatorhud.dec.lua create mode 100644 lui/mp_hud/splasheshud.dec.lua create mode 100644 lui/mp_hud/talkerhud.dec.lua create mode 100644 lui/mp_hud/teamscoreshud.dec.lua create mode 100644 lui/mp_hud/teamselect.dec.lua create mode 100644 lui/mp_hud/timershud.dec.lua create mode 100644 lui/mp_hud/vanguardoverlayhud.dec.lua create mode 100644 lui/mp_hud/weaponattachment.dec.lua create mode 100644 lui/mp_hud/weaponinfohud.dec.lua create mode 100644 lui/mp_menus/aarcommon.dec.lua create mode 100644 lui/mp_menus/aarmain.dec.lua create mode 100644 lui/mp_menus/aarmini.dec.lua create mode 100644 lui/mp_menus/aaroperationprogress.dec.lua create mode 100644 lui/mp_menus/aarscoreboard.dec.lua create mode 100644 lui/mp_menus/aarsquadsummary.dec.lua create mode 100644 lui/mp_menus/aarsummary.dec.lua create mode 100644 lui/mp_menus/aarunlockscreen.dec.lua create mode 100644 lui/mp_menus/aarutils.dec.lua create mode 100644 lui/mp_menus/aliens.dec.lua create mode 100644 lui/mp_menus/aliensintel.dec.lua create mode 100644 lui/mp_menus/aliensloadout.dec.lua create mode 100644 lui/mp_menus/alienspurchasables.dec.lua create mode 100644 lui/mp_menus/archetypeselect.dec.lua create mode 100644 lui/mp_menus/cacabilitiesalt.dec.lua create mode 100644 lui/mp_menus/caccustomize.dec.lua create mode 100644 lui/mp_menus/cacedit.dec.lua create mode 100644 lui/mp_menus/caceditchooseimagepopup.dec.lua create mode 100644 lui/mp_menus/caceditpopup.dec.lua create mode 100644 lui/mp_menus/caceditselectioninfo.dec.lua create mode 100644 lui/mp_menus/caceditweaponattachchoose.dec.lua create mode 100644 lui/mp_menus/caceditweaponperformanceinfopane.dec.lua create mode 100644 lui/mp_menus/caceditweaponstatsinfopane.dec.lua create mode 100644 lui/mp_menus/cacinfopanes.dec.lua create mode 100644 lui/mp_menus/cacloadoututils.dec.lua create mode 100644 lui/mp_menus/cacmain.dec.lua create mode 100644 lui/mp_menus/cacmemberselect.dec.lua create mode 100644 lui/mp_menus/cacprestigedetails.dec.lua create mode 100644 lui/mp_menus/cacrecap.dec.lua create mode 100644 lui/mp_menus/casabilitybutton.dec.lua create mode 100644 lui/mp_menus/choosecodanywhereplatform.dec.lua create mode 100644 lui/mp_menus/clandetails.dec.lua create mode 100644 lui/mp_menus/clanelements.dec.lua create mode 100644 lui/mp_menus/claninvites.dec.lua create mode 100644 lui/mp_menus/killstreakselections.dec.lua create mode 100644 lui/mp_menus/leaderboards.dec.lua create mode 100644 lui/mp_menus/leaderboardutils.dec.lua create mode 100644 lui/mp_menus/loadoutbuilder.dec.lua create mode 100644 lui/mp_menus/luisquadmemberwindow.dec.lua create mode 100644 lui/mp_menus/main.dec.lua create mode 100644 lui/mp_menus/menudata.dec.lua create mode 100644 lui/mp_menus/mlgutils.dec.lua create mode 100644 lui/mp_menus/motdutils.dec.lua create mode 100644 lui/mp_menus/motdwidgets.dec.lua create mode 100644 lui/mp_menus/mpbarracks.dec.lua create mode 100644 lui/mp_menus/mpcodanywhere.dec.lua create mode 100644 lui/mp_menus/mpcustomclassrestrictions.dec.lua create mode 100644 lui/mp_menus/mpgamemodeselectmenu.dec.lua create mode 100644 lui/mp_menus/mpgamesetupmenu.dec.lua create mode 100644 lui/mp_menus/mpgamesetupmodemenu.dec.lua create mode 100644 lui/mp_menus/mpgamesetupoptionsmenu.dec.lua create mode 100644 lui/mp_menus/mpleaderboard.dec.lua create mode 100644 lui/mp_menus/mpleaderboardpopups.dec.lua create mode 100644 lui/mp_menus/mpliveprivatelobby.dec.lua create mode 100644 lui/mp_menus/mplivepubliclobby.dec.lua create mode 100644 lui/mp_menus/mplobbycharacterview.dec.lua create mode 100644 lui/mp_menus/mplobbynavigation.dec.lua create mode 100644 lui/mp_menus/mplobbyplayerstats.dec.lua create mode 100644 lui/mp_menus/mplobbysearchwidget.dec.lua create mode 100644 lui/mp_menus/mplobbyutils.dec.lua create mode 100644 lui/mp_menus/mplobbywidgets.dec.lua create mode 100644 lui/mp_menus/mpmainmenu.dec.lua create mode 100644 lui/mp_menus/mpmapsetupmenu.dec.lua create mode 100644 lui/mp_menus/mpmemberlist.dec.lua create mode 100644 lui/mp_menus/mponlinevault.dec.lua create mode 100644 lui/mp_menus/mpplayerpopups.dec.lua create mode 100644 lui/mp_menus/mpplaylist.dec.lua create mode 100644 lui/mp_menus/mppopups.dec.lua create mode 100644 lui/mp_menus/mpprestigereset.dec.lua create mode 100644 lui/mp_menus/mpsavedmodeselectmenu.dec.lua create mode 100644 lui/mp_menus/mpscreenshotviewer.dec.lua create mode 100644 lui/mp_menus/mpstatsreset.dec.lua create mode 100644 lui/mp_menus/mpvault.dec.lua create mode 100644 lui/mp_menus/mpxboxlivemenu.dec.lua create mode 100644 lui/mp_menus/operations.dec.lua create mode 100644 lui/mp_menus/operationsutils.dec.lua create mode 100644 lui/mp_menus/playerdatainit.dec.lua create mode 100644 lui/mp_menus/snselements.dec.lua create mode 100644 lui/mp_menus/snsutils.dec.lua create mode 100644 lui/mp_menus/socialfeed.dec.lua create mode 100644 lui/mp_menus/splitscreengamesetupmenu.dec.lua create mode 100644 lui/mp_menus/splitscreensignin.dec.lua create mode 100644 lui/mp_menus/squadprepartylobby.dec.lua create mode 100644 lui/mp_menus/squadreportdetail.dec.lua create mode 100644 lui/mp_menus/squadreports.dec.lua create mode 100644 lui/mp_menus/squadsmodeselect.dec.lua create mode 100644 lui/mp_menus/store.dec.lua create mode 100644 lui/mp_menus/svsutils.dec.lua create mode 100644 lui/mp_menus/systemlinkgamesetupmenu.dec.lua create mode 100644 lui/mp_menus/systemlinkjoinmenu.dec.lua create mode 100644 lui/mp_menus/systemlinkmenu.dec.lua create mode 100644 lui/pcoptions.dec.lua create mode 100644 lui/persistentbackground.dec.lua create mode 100644 lui/speech.dec.lua diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..31b688b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.luac diff --git a/README.md b/README.md new file mode 100644 index 0000000..6d63ab0 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# IW6 LUI +This repo contains the IW6 LUI dump. diff --git a/lui/actionscontrols.dec.lua b/lui/actionscontrols.dec.lua new file mode 100644 index 0000000..f99bd2d --- /dev/null +++ b/lui/actionscontrols.dec.lua @@ -0,0 +1,232 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GetDisplay( f1_arg0 ) + return Engine.GetBinding( f1_arg0 ) +end + +function bindKey( f2_arg0 ) + Engine.BindKey( f2_arg0 ) +end + +function OptionsWindowRefresh( f3_arg0, f3_arg1 ) + if f3_arg1.source_input == "button_action" or f3_arg1.source_input == "key_bound" then + f3_arg0:processEvent( { + name = "menu_refresh" + } ) + f3_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function OptionsWindowTriggerRefresh( f4_arg0, f4_arg1 ) + f4_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f4_arg1.name, + immediate = true + } ) +end + +function SinglePlayerDisableFunction( f5_arg0, f5_arg1 ) + return not Engine.IsMultiplayer() +end + +function ControlBindFactory( f6_arg0, f6_arg1, f6_arg2 ) + return { + type = "UIGenericButton", + id = "bind_" .. f6_arg0, + disabledFunc = f6_arg2 or function () + return false + end + , + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( f6_arg0 ), + button_display_func = function ( f8_arg0, f8_arg1 ) + return GetDisplay( f6_arg1 ) + end + , + button_action_func = function ( f9_arg0, f9_arg1 ) + Engine.BindKey( f6_arg1 ) + OptionsWindowTriggerRefresh( f9_arg0, f9_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ), + key_bound = OptionsWindowTriggerRefresh + } + } +end + +function OptionFactoryProfileData( f10_arg0, f10_arg1, f10_arg2, f10_arg3, f10_arg4, f10_arg5 ) + local f10_local0 = Engine.GetProfileData( f10_arg0 ) + local f10_local1 = 1 + for f10_local5, f10_local6 in pairs( f10_arg3 ) do + if f10_local6.value == f10_local0 then + f10_local1 = f10_local5 + break + end + end + f10_local2 = function ( f11_arg0, f11_arg1 ) + Engine.ExecNow( f10_arg1 ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + OptionsWindowTriggerRefresh( f11_arg0, f11_arg1 ) + end + + f10_local3 = { + type = "UIGenericButton", + id = "option_" .. f10_arg0, + disabledFunc = f10_arg4 or function () + return false + end + + } + f10_local4 = { + variant = GenericButtonSettings.Variants.Select + } + if f10_arg5 then + local f10_local7 = f10_arg2 + end + f10_local4.button_text = f10_local7 or Engine.Localize( f10_arg2 ) + f10_local4.button_display_func = function ( f13_arg0, f13_arg1 ) + return Engine.Localize( f10_arg3[f10_local1].text ) + end + + f10_local4.button_left_func = function ( f14_arg0, f14_arg1 ) + f10_local1 = 1 + (#f10_arg3 + f10_local1 - 1 - 1) % #f10_arg3 + f10_local2( f14_arg0, f14_arg1 ) + end + + f10_local4.button_right_func = function ( f15_arg0, f15_arg1 ) + f10_local1 = 1 + (f10_local1 - 1 + 1) % #f10_arg3 + f10_local2( f15_arg0, f15_arg1 ) + end + + f10_local3.properties = f10_local4 + f10_local3.handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ) + } + return f10_local3 +end + +function OptionsFeeder( f16_arg0 ) + local f16_local0 = {} + Engine.ExecNow( "profile_menuDvarsSetup" ) + f16_local0[#f16_local0 + 1] = OptionFactoryProfileData( "leanEnabled", "profile_toggleLean", "@LUA_MENU_LEAN_TOGGLE", { + { + text = "@LUA_MENU_ENABLED", + value = true + }, + { + text = "@LUA_MENU_DISABLED", + value = false + } + } ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_FIRE_WEAPON", "+attack" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_AIM_DOWN_THE_SIGHT", "+toggleads_throw" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_HOLD_AIM_DOWN_SIGHT", "+speed_throw" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_RELOAD_WEAPON", "+reload" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_SWITCH_WEAPON", "weapnext" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@PLATFORM_MELEEZOOM", "+melee_zoom" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_USE", "+activate" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_FRAG_EQUIPMENT", "+frag" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_THROW_SPECIAL_GRENADE", "+smoke" ) + if SinglePlayerDisableFunction() then + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_WEAPON_ATTACHMENT", "+actionslot 3" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_INVENTORY_KILLSTREAK", "+actionslot 4" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_NVG_WATCH", "+actionslot 1" ) + else + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_KILLSTREAK_REWARD_SLOT_1", "+actionslot 4" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_KILLSTREAK_REWARD_SLOT_2", "+actionslot 5" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_KILLSTREAK_REWARD_SLOT_3", "+actionslot 6" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( "@MENU_KILLSTREAK_REWARD_SLOT_4", "+actionslot 7" ) + f16_local0[#f16_local0 + 1] = ControlBindFactory( Engine.IsAliensMode() and "ALIENS_UPGRADE_ABILITIES" or "@PLATFORM_UI_SHOW_SCORES", "togglescores" ) + end + return f16_local0 +end + +function OptionsMainCreate( f17_arg0, f17_arg1 ) + f17_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function actions_controls_vlist() + return { + type = "UIScrollingVerticalList", + childrenFeeder = OptionsFeeder, + properties = { + use_arrows = true, + sendScrollEvents = true, + exclusiveController = MBh.Property( "exclusiveController" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = OptionsListDims.menu_top, + bottom = OptionsListDims.menu_bottom, + left = OptionsListDims.menu_left, + right = OptionsListDims.menu_right + } + }, + handlers = { + options_window_refresh = OptionsWindowRefresh + } + } +end + +function actions_controls() + return { + type = "UIElement", + id = "actions_controls_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = function ( f20_arg0, f20_arg1 ) + Engine.Exec( "updategamerprofile" ) + end + + }, + children = { + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_ACTIONS" ) + } + }, + { + type = "actions_controls_vlist", + id = "actions_cotnrols_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "actions_controls_vlist", actions_controls_vlist ) +LUI.MenuBuilder.registerDef( "actions_controls", actions_controls ) +LockTable( _M ) diff --git a/lui/advancedvideo.dec.lua b/lui/advancedvideo.dec.lua new file mode 100644 index 0000000..8feb883 --- /dev/null +++ b/lui/advancedvideo.dec.lua @@ -0,0 +1,685 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function BackButtonAction( f1_arg0, f1_arg1 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + f1_arg0:dispatchEventToRoot( { + name = "check_show_apply", + immediate = true + } ) + if f1_local0.showApplySettings then + if Engine.ShowLowTextureResolutionWarning() then + if f1_local0.vidRestart then + LUI.FlowManager.RequestPopupMenu( f1_arg0, "show_low_texture_res_warning_restart_popmenu", false, f1_arg1.controller, false ) + else + LUI.FlowManager.RequestPopupMenu( f1_arg0, "show_low_texture_res_warning_popmenu", false, f1_arg1.controller, false ) + end + elseif f1_local0.vidRestart then + LUI.FlowManager.RequestPopupMenu( f1_arg0, "apply_settings_restart_popmenu", false, f1_arg1.controller, false ) + else + LUI.FlowManager.RequestPopupMenu( f1_arg0, "apply_settings_popmenu", false, f1_arg1.controller, false ) + end + end + LUI.FlowManager.RequestLeaveMenu( f1_arg0 ) +end + +function PicmipDisabledFunc() + return Engine.GetDvarInt( "ui_r_picmip_manual" ) == 0 +end + +f0_local0 = nil +function NVidiaButtonOver( f3_arg0, f3_arg1 ) + f0_local0 = f3_arg0.id + f3_arg0:dispatchEventToRoot( { + name = "show_nvidia_subtitle", + immediate = true + } ) +end + +function NVidiaButtonUp( f4_arg0, f4_arg1 ) + if f0_local0 == f4_arg0.id then + f0_local0 = nil + f4_arg0:dispatchEventToRoot( { + name = "hide_nvidia_subtitle", + immediate = true + } ) + end +end + +function OptionsWindowRefresh( f5_arg0, f5_arg1 ) + if f5_arg1.source_input == "button_action" or f5_arg1.source_input == "key_bound" or f5_arg1.source_input == "button_right" or f5_arg1.source_input == "button_left" then + f5_arg0:processEvent( { + name = "menu_refresh" + } ) + f5_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function OptionsWindowTriggerRefresh( f6_arg0, f6_arg1 ) + f6_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f6_arg1.name, + immediate = true + } ) +end + +function GetFOV( f7_arg0 ) + return (Engine.GetDvarFloat( "ui_cg_fov" ) - f7_arg0.Min) / (f7_arg0.Max - f7_arg0.Min) +end + +function SliderChange( f8_arg0, f8_arg1, f8_arg2, f8_arg3 ) + Engine.SetDvarFloat( f8_arg3, math.min( f8_arg1, math.max( f8_arg0, Engine.GetDvarFloat( f8_arg3 ) + f8_arg2 ) ) ) +end + +function OptionFactory( f9_arg0, f9_arg1, f9_arg2, f9_arg3, f9_arg4, f9_arg5, f9_arg6, f9_arg7, f9_arg8, f9_arg9, f9_arg10, f9_arg11 ) + local f9_local0 = nil + local f9_local1 = 1 + local f9_local2 = Engine.GetDvarType( f9_arg0 ) + local f9_local3 = nil + if f9_arg9 then + f9_local3 = { + variant = GenericButtonSettings.Variants.Slider, + button_text = Engine.Localize( f9_arg1 ), + button_display_func = function ( f10_arg0, f10_arg1 ) + return f9_arg11( f9_arg10 ) + end, + button_left_func = function ( f11_arg0, f11_arg1 ) + SliderChange( f9_arg10.Min, f9_arg10.Max, -f9_arg10.Step, f9_arg0 ) + end, + button_right_func = function ( f12_arg0, f12_arg1 ) + SliderChange( f9_arg10.Min, f9_arg10.Max, f9_arg10.Step, f9_arg0 ) + end + } + else + if f9_local2 == DvarTypeTable.DvarString or f9_local2 == DvarTypeTable.DvarEnum then + f9_local0 = Engine.GetDvarString( f9_arg0 ) + elseif f9_local2 == DvarTypeTable.DvarInt then + f9_local0 = Engine.GetDvarInt( f9_arg0 ) + elseif f9_local2 == DvarTypeTable.DvarBool then + f9_local0 = Engine.GetDvarBool( f9_arg0 ) + end + for f9_local7, f9_local8 in pairs( f9_arg2 ) do + if f9_local8.value == f9_local0 then + f9_local1 = f9_local7 + break + end + end + f9_local4 = function ( f13_arg0, f13_arg1 ) + if f9_local2 == DvarTypeTable.DvarString or f9_local2 == DvarTypeTable.DvarEnum then + Engine.SetDvarString( f9_arg0, f9_arg2[f9_local1].value ) + elseif f9_local2 == DvarTypeTable.DvarInt then + Engine.SetDvarInt( f9_arg0, f9_arg2[f9_local1].value ) + elseif f9_local2 == DvarTypeTable.DvarBool then + Engine.SetDvarBool( f9_arg0, f9_arg2[f9_local1].value ) + end + OptionsWindowTriggerRefresh( f13_arg0, f13_arg1 ) + end + + f9_local3 = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( f9_arg1 ), + button_display_func = function ( f14_arg0, f14_arg1 ) + return f9_arg6 and f9_arg2[f9_local1].text or Engine.Localize( f9_arg2[f9_local1].text ) + end, + button_left_func = function ( f15_arg0, f15_arg1 ) + f9_local1 = 1 + (#f9_arg2 + f9_local1 - 1 - 1) % #f9_arg2 + f9_local4( f15_arg0, f15_arg1 ) + end, + button_right_func = function ( f16_arg0, f16_arg1 ) + f9_local1 = 1 + (f9_local1 - 1 + 1) % #f9_arg2 + f9_local4( f16_arg0, f16_arg1 ) + end, + button_over_func = f9_arg7, + button_up_func = f9_arg8 + } + end + return { + type = "UIGenericButton", + id = "option_" .. f9_arg0, + disabledFunc = f9_arg4 or function () + return false + end + , + states = { + default = { + alpha = 1 + }, + invisible = { + alpha = 0 + } + }, + properties = f9_local3, + handlers = { + check_show_apply = function ( f18_arg0, f18_arg1 ) + if f9_arg3 then + if f9_arg9 then + local f18_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f18_arg0 ) + if Engine.GetDvarFloat( f9_arg3 ) ~= Engine.GetDvarFloat( f9_arg0 ) then + f18_local0.showApplySettings = true + if f9_arg5 then + f18_local0.vidRestart = true + end + end + else + local f18_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f18_arg0 ) + local f18_local1 = nil + local f18_local2 = Engine.GetDvarType( f9_arg3 ) + if f18_local2 == DvarTypeTable.DvarString or f18_local2 == DvarTypeTable.DvarEnum then + f18_local1 = Engine.GetDvarString( f9_arg3 ) + elseif f18_local2 == DvarTypeTable.DvarInt then + f18_local1 = tostring( Engine.GetDvarInt( f9_arg3 ) ) + elseif f18_local2 == DvarTypeTable.DvarBool then + if Engine.GetDvarBool( f9_arg3 ) then + local f18_local3 = "1" + end + f18_local1 = f18_local3 or "0" + elseif f18_local2 == DvarTypeTable.DvarFloat then + f18_local1 = tostring( Engine.GetDvarFloat( f9_arg3 ) ) + end + if f18_local1 ~= f9_arg2[f9_local1].value then + f18_local0.showApplySettings = true + if f9_arg5 then + f18_local0.vidRestart = true + end + end + end + end + end + + } + } +end + +function OptionsFeeder( f19_arg0 ) + local f19_local0 = { + [#f19_local0 + 1] = OptionFactory( "ui_r_aspectratio", "@MENU_ASPECT_RATIO", { + { + text = "@MENU_AUTO", + value = "auto" + }, + { + text = "@MENU_STANDARD_4_3", + value = "standard" + }, + { + text = "@MENU_WIDE_16_10", + value = "wide 16:10" + }, + { + text = "MENU_WIDE_16_9", + value = "wide 16:9" + } + }, "r_aspectratio", nil, true ) + } + local f19_local1 = {} + for f19_local5, f19_local6 in pairs( Engine.GetDvarEnumList( "r_displayRefresh" ) ) do + f19_local1[#f19_local1 + 1] = { + text = f19_local6, + value = f19_local6 + } + end + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_displayRefresh", "@MENU_SCREEN_REFRESH_RATE", f19_local1, "r_displayRefresh", nil, true, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_vsync", "@MENU_SYNC_EVERY_FRAME", { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + }, "r_vsync", nil, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_imageQuality", "@PLATFORM_UI_IMAGE_QUALITY", { + { + text = "@MENU_VERY_LOW", + value = "1" + }, + { + text = "@MENU_LOW", + value = "2" + }, + { + text = "@MENU_NORMAL", + value = "3" + }, + { + text = "@MENU_HIGH", + value = "4" + }, + { + text = "@MENU_EXTRA", + value = "0" + } + }, "r_imageQuality", nil, true ) + if Engine.IsMultiplayer() then + f19_local2 = {} + f19_local3 = SliderBounds.FOV.Max - SliderBounds.FOV.Min + for f19_local4 = 0, f19_local3, 1 do + local f19_local7 = tostring( SliderBounds.FOV.Min + f19_local4 ) + f19_local2[f19_local4 + 1] = { + text = Engine.MarkLocalized( f19_local7 ), + value = f19_local7 + } + end + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_cg_fov", "@MENU_FOV", f19_local2, "cg_fov", nil, false, true, function ( f20_arg0, f20_arg1 ) + f20_arg0:dispatchEventToRoot( { + name = "show_fov_subtitle", + immediate = true + } ) + end, function ( f21_arg0, f21_arg1 ) + f21_arg0:dispatchEventToRoot( { + name = "hide_fov_subtitle", + immediate = true + } ) + end, false, false, false ) + end + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_dof_enable", "@MENU_DOF", { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + }, "r_dof_enable", nil, false ) + if Engine.HBAOAvailable() then + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_ssao", "@PLATFORM_SSAO", { + { + text = "@MENU_OFF", + value = "0_Off" + }, + { + text = "@PLATFORM_LOW_QUALITY", + value = "1_Low" + }, + { + text = "@PLATFORM_HIGH_QUALITY", + value = "2_High" + }, + { + text = "@PLATFORM_HBAO", + value = "3_HBAO" + } + }, "r_ssao", nil, true ) + else + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_ssao", "@PLATFORM_SSAO", { + { + text = "@MENU_OFF", + value = "0_Off" + }, + { + text = "@PLATFORM_LOW_QUALITY", + value = "1_Low" + }, + { + text = "@PLATFORM_HIGH_QUALITY", + value = "2_High" + } + }, "r_ssao", nil, true ) + end + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_tessellation", "@MENU_TESSELLATION", { + { + text = "@MENU_OFF", + value = "0_Off" + }, + { + text = "@MENU_NORMAL", + value = "1_Near" + }, + { + text = "@MENU_EXTRA", + value = "2_All" + } + }, "r_tessellation", nil, false ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_texFilterAnisoMin", "@LUA_MENU_ANISOTROPIC_FILTERING", { + { + text = "@MENU_LOW", + value = "1" + }, + { + text = "@MENU_NORMAL", + value = "8" + }, + { + text = "@MENU_HIGH", + value = "16" + } + }, "r_texFilterAnisoMin", nil, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_mbEnableA", "@MENU_MOTION_BLUR", { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + }, "r_mbEnableA", nil, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_distortion", "@MENU_DISTORTION", { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + }, "r_distortion", nil, false ) + if Engine.TXAAAvailable() then + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_aaMode", "@MENU_ANTIALIASING", { + { + text = "@MENU_OFF", + value = "Off" + }, + { + text = "@MENU_FXAA", + value = "FXAA" + }, + { + text = "@MENU_2X_MSAA", + value = "2xMSAA" + }, + { + text = "@MENU_4X_MSAA", + value = "4xMSAA" + }, + { + text = "@MENU_SMAA", + value = "SMAA" + }, + { + text = "@MENU_2X_TXAA", + value = "2xTXAA" + }, + { + text = "@MENU_4X_TXAA", + value = "4xTXAA" + } + }, "r_aaMode", nil, true ) + else + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_aaMode", "@MENU_ANTIALIASING", { + { + text = "@MENU_OFF", + value = "Off" + }, + { + text = "@MENU_FXAA", + value = "FXAA" + }, + { + text = "@MENU_2X_MSAA", + value = "2xMSAA" + }, + { + text = "@MENU_4X_MSAA", + value = "4xMSAA" + }, + { + text = "@MENU_SMAA", + value = "SMAA" + } + }, "r_aaMode", nil, true ) + end + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_sm_enable", "@MENU_SHADOWS", { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + }, "sm_enable", nil, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip_manual", "@MENU_TEXTURE_QUALITY", { + { + text = "@MENU_AUTOMATIC", + value = "0" + }, + { + text = "@MENU_MANUAL", + value = "1" + } + }, "r_picmip_manual", nil, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip", "@MENU_TEXTURE_RESOLUTION", { + { + text = "@MENU_LOW", + value = "3" + }, + { + text = "@MENU_NORMAL", + value = "2" + }, + { + text = "@MENU_HIGH", + value = "1" + }, + { + text = "@MENU_EXTRA", + value = "0" + } + }, "r_picmip", PicmipDisabledFunc, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip_bump", "@MENU_NORMAL_MAP_RESOLUTION", { + { + text = "@MENU_LOW", + value = "3" + }, + { + text = "@MENU_NORMAL", + value = "2" + }, + { + text = "@MENU_HIGH", + value = "1" + }, + { + text = "@MENU_EXTRA", + value = "0" + } + }, "r_picmip_bump", PicmipDisabledFunc, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip_spec", "@MENU_SPECULAR_MAP_RESOLUTION", { + { + text = "@MENU_LOW", + value = "3" + }, + { + text = "@MENU_NORMAL", + value = "2" + }, + { + text = "@MENU_HIGH", + value = "1" + }, + { + text = "@MENU_EXTRA", + value = "0" + } + }, "r_picmip_spec", PicmipDisabledFunc, true ) + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_picmip_water", "@MENU_WATER_MAP_RESOLUTION", { + { + text = "@MENU_LOW", + value = "1" + }, + { + text = "@MENU_HIGH", + value = "0" + } + }, "r_picmip_water", PicmipDisabledFunc, true ) + if Engine.FurShaderAvailable() then + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_fur_shader", "@MENU_FUR_SHADER", { + { + text = "@MENU_OFF", + value = "0" + }, + { + text = "@MENU_LOW", + value = "1" + }, + { + text = "@MENU_HIGH", + value = "2" + } + }, "r_fur_shader", nil, true, nil, NVidiaButtonOver, NVidiaButtonUp ) + end + if Engine.APEXTurbulenceAvailable() then + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_r_apex_turbulence", "@MENU_APEX_TURBULENCE", { + { + text = "@MENU_ON", + value = "1" + }, + { + text = "@MENU_OFF", + value = "0" + } + }, "r_apex_turbulence", nil, true, nil, NVidiaButtonOver, NVidiaButtonUp ) + end + return f19_local0 +end + +function OptionsMainCreate( f22_arg0, f22_arg1 ) + Engine.ExecNow( "profile_menuDvarsSetup" ) + f22_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function OptionsMainClose( f23_arg0, f23_arg1 ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + if Engine.GetDvarString( "r_lodScaleRigid" ) == "2" then + Engine.SetDvarString( "r_lodScaleSkinned", "4" ) + Engine.SetDvarString( "r_lodBiasSkinned", "-200" ) + Engine.SetDvarString( "r_lodBiasRigid", "-100" ) + end + if Engine.GetDvarString( "r_lodScaleRigid" ) == "1" then + Engine.SetDvarString( "r_lodScaleSkinned", "1" ) + Engine.SetDvarString( "r_lodBiasSkinned", "0" ) + Engine.SetDvarString( "r_lodBiasRigid", "0" ) + end +end + +function advanced_video_vlist() + return { + type = "UIScrollingVerticalList", + childrenFeeder = OptionsFeeder, + properties = { + use_arrows = true, + sendScrollEvents = true, + exclusiveController = MBh.Property( "exclusiveController" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = OptionsListDims.menu_top, + bottom = OptionsListDims.menu_bottom, + left = OptionsListDims.menu_left, + right = OptionsListDims.menu_right + } + } + } +end + +function advanced_video() + return { + type = "UIElement", + id = "advanced_video_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = OptionsMainClose, + options_window_refresh = OptionsWindowRefresh + }, + children = { + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_ADVANCED_VIDEO" ) + } + }, + { + type = "advanced_video_vlist", + id = "advanced_video_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIMarqueeText", + id = "nvidia_option_subtitle", + properties = { + text = Engine.Localize( "@MENU_NVIDIA_OPTION_SUB" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = OptionsListDims.menu_bottom - CoD.TextSettings.HudIW6NormalFont.Height, + bottom = OptionsListDims.menu_bottom - CoD.TextSettings.HudIW6NormalFont.Height + CoD.TextSettings.TinyFont.Height, + left = 10, + right = OptionsListDims.menu_right - 110, + font = CoD.TextSettings.TinyFont.Font, + alignment = LUI.Alignment.Right, + red = 0.7, + green = 0.7, + blue = 0.7, + alpha = 0 + }, + show_me = { + alpha = 1 + }, + hide_me = { + alpha = 0 + } + }, + handlers = { + show_nvidia_subtitle = function ( f26_arg0, f26_arg1 ) + f26_arg0:setText( Engine.Localize( "@MENU_NVIDIA_OPTION_SUB" ) ) + f26_arg0:animateToState( "show_me", 0 ) + end + , + hide_nvidia_subtitle = function ( f27_arg0, f27_arg1 ) + f27_arg0:animateToState( "hide_me", 0 ) + end + , + show_fov_subtitle = function ( f28_arg0, f28_arg1 ) + f28_arg0:setText( Engine.Localize( "@LUA_MENU_MP_FOV_OPTION_SUB" ) ) + f28_arg0:animateToState( "show_me", 0 ) + end + , + hide_fov_subtitle = function ( f29_arg0, f29_arg1 ) + f29_arg0:animateToState( "hide_me", 0 ) + end + + } + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = BackButtonAction + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "advanced_video_vlist", advanced_video_vlist ) +LUI.MenuBuilder.registerDef( "advanced_video", advanced_video ) +LockTable( _M ) diff --git a/lui/bootscreenmargins.dec.lua b/lui/bootscreenmargins.dec.lua new file mode 100644 index 0000000..190003c --- /dev/null +++ b/lui/bootscreenmargins.dec.lua @@ -0,0 +1,285 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +DebugPrint( "Registering " .. _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + f1_local0.ContinueMessageVisible = false + if f1_arg0.properties.linkTo == "controls" then + f1_local0.ContinueMessageVisible = true + f1_arg0:dispatchEventToRoot( { + name = "continue_message_visible" + } ) + end + f1_local0.OriginalVertMargin = Engine.GetDvarFloat( "profileMenuOption_safeAreaVert" ) + f1_local0.OriginalHorzMargin = Engine.GetDvarFloat( "profileMenuOption_safeAreaHorz" ) + f1_local0.VertMarginMinAmount = SliderBounds.VertMargin.Min + f1_local0.VertMarginMaxAmount = SliderBounds.VertMargin.Max + f1_local0.VertMarginIncrement = SliderBounds.VertMargin.Step + f1_local0.HorzMarginMinAmount = SliderBounds.HorzMargin.Min + f1_local0.HorzMarginMaxAmount = SliderBounds.HorzMargin.Max + f1_local0.HorzMarginIncrement = SliderBounds.HorzMargin.Step + f1_arg0:dispatchEventToChildren( { + name = "vertical_margin_over" + } ) + f1_arg0:dispatchEventToChildren( { + name = "horizontal_margin_over" + } ) +end + +f0_local1 = function ( f2_arg0, f2_arg1, f2_arg2, f2_arg3, f2_arg4, f2_arg5 ) + local f2_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f2_arg0 ) + local f2_local1 = math.min( f2_arg2, math.max( f2_arg1, Engine.GetDvarFloat( f2_arg4 ) + f2_arg3 ) ) + Engine.SetDvarFloat( f2_arg4, f2_local1 ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + f2_arg0:dispatchEventToRoot( { + name = "margin_updated" + } ) + if f2_local1 <= f2_arg1 or f2_arg2 <= f2_local1 then + Engine.PlaySound( CoD.SFX.DenyAdjustSafeArea ) + else + Engine.PlaySound( CoD.SFX.AdjustSafeArea ) + end + if f2_local0.ContinueMessageVisible == false and f2_local1 ~= f2_arg5 then + f2_local0.ContinueMessageVisible = true + f2_arg0:dispatchEventToRoot( { + name = "continue_message_visible" + } ) + end +end + +f0_local2 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f3_arg0 ) + if f3_local0.ContinueMessageVisible then + local f3_local1 = LUI.FlowManager.RequestAddMenu + local f3_local2 = f3_arg0 + local f3_local3 = f3_arg0.properties.linkTo + local f3_local4 = f3_arg0:getParent() + f3_local1( f3_local2, f3_local3, f3_local4.properties.continueExclusive, f3_arg1.controller, true, { + focusSafeArea = true + } ) + end +end + +function boot_screen_margins() + return { + type = "UIElement", + id = "boot_screen_margins_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = f0_local0 + }, + properties = { + linkTo = "main_menu", + continueExclusive = false + }, + children = { + { + type = "margins_guide" + }, + { + type = "UIText", + id = "boot_screen_margins_title_txt_id", + properties = { + text = Engine.Localize( "@MENU_HUD_MARGINS_CAPS" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 60, + bottom = 60 + CoD.TextSettings.ExtraBigFont.Height, + left = 100, + right = 0, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Left + } + } + }, + { + type = "UIText", + id = "boot_screen_margins_instruction_txt1_id", + properties = { + text = Engine.Localize( "@MENU_ADJUST_SCREENMARGINS" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 210, + bottom = 210 + CoD.TextSettings.NormalFont.Height, + left = 0, + right = 0, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + }, + { + type = "UIText", + id = "boot_screen_margins_instruction_txt2_id", + properties = { + text = Engine.Localize( "@MENU_ADJUST_SCREENMARGINS_DESC" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 210 + CoD.TextSettings.NormalFont.Height, + bottom = 210 + 2 * CoD.TextSettings.NormalFont.Height, + left = 0, + right = 0, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + }, + { + type = "UIText", + id = "boot_screen_margins_instruction_txt3_id", + properties = { + text = Engine.Localize( "@MENU_ADJUST_SCREENMARGINS_INST1" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -1.2 * CoD.TextSettings.BoldFont.Height, + bottom = 0, + left = 0, + right = 0, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + }, + { + type = "UIText", + id = "boot_screen_margins_instruction_txt4_id", + properties = { + text = Engine.Localize( "@MENU_ADJUST_SCREENMARGINS_INST2" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 1.2 * CoD.TextSettings.BoldFont.Height, + left = 0, + right = 0, + font = CoD.TextSettings.BoldFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + }, + { + type = "UIButton", + id = "boot_screen_margins_continue_btn_id", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + top = -1 * (CoD.TextSettings.BoldFont.Height + 105), + bottom = -100, + left = -200, + right = 200, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + button_action = f0_local2, + continue_message_visible = MBh.AnimateToState( "visible", 0 ) + }, + children = { + { + type = "UIText", + properties = { + text = Engine.Localize( "@PLATFORM_UI_PRESS_TO_CONTINUE" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } + } + } + } + }, + { + type = "UIBindButton", + id = "boot_screen_margins_bind_btn_id", + handlers = { + button_up = function ( f5_arg0, f5_arg1 ) + local f5_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f5_arg0 ) + f0_local1( f5_arg0, f5_local0.VertMarginMinAmount, f5_local0.VertMarginMaxAmount, f5_local0.VertMarginIncrement, "profileMenuOption_safeAreaVert", f5_local0.OriginalVertMargin ) + end + , + button_down = function ( f6_arg0, f6_arg1 ) + local f6_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f6_arg0 ) + f0_local1( f6_arg0, f6_local0.VertMarginMinAmount, f6_local0.VertMarginMaxAmount, -f6_local0.VertMarginIncrement, "profileMenuOption_safeAreaVert", f6_local0.OriginalVertMargin ) + end + , + button_left = function ( f7_arg0, f7_arg1 ) + local f7_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f7_arg0 ) + f0_local1( f7_arg0, f7_local0.HorzMarginMinAmount, f7_local0.HorzMarginMaxAmount, -f7_local0.HorzMarginIncrement, "profileMenuOption_safeAreaHorz", f7_local0.OriginalHorzMargin ) + end + , + button_right = function ( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 ) + f0_local1( f8_arg0, f8_local0.HorzMarginMinAmount, f8_local0.HorzMarginMaxAmount, f8_local0.HorzMarginIncrement, "profileMenuOption_safeAreaHorz", f8_local0.OriginalHorzMargin ) + end + + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "boot_screen_margins", boot_screen_margins ) +LockTable( _M ) diff --git a/lui/buttondesctext.dec.lua b/lui/buttondesctext.dec.lua new file mode 100644 index 0000000..0bf4c95 --- /dev/null +++ b/lui/buttondesctext.dec.lua @@ -0,0 +1,75 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( "Registering " .. _NAME ) +LUI.ButtonDescText = {} +LUI.ButtonDescText.new = function ( f1_arg0, f1_arg1 ) + if not f1_arg1 then + f1_arg1 = {} + end + local f1_local0 = f1_arg1.lines or 2 + local self = LUI.UIElement.new() + self.id = "generic_button_desc_text_id" + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = f1_local0 * CoD.TextSettings.SmallFont.Height + } ) + self:animateToState( "default" ) + local f1_local2 = LUI.UIImage.new() + f1_local2.id = "left_bullet_point" + f1_local2:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 3, + left = 100, + height = 13, + width = 5, + alpha = 0.6 + } ) + f1_local2:animateToState( "default" ) + self:addElement( f1_local2 ) + local f1_local3 = LUI.UIMarqueeText.new() + f1_local3.id = "desc_text" + f1_local3:SetUseTextWrapping( true ) + f1_local3:SetTextHeight( CoD.TextSettings.SmallFont.Height ) + f1_local3:registerAnimationState( "default", { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.SmallFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = f1_local0 * CoD.TextSettings.SmallFont.Height, + left = 111, + right = -23, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b, + alpha = 1 + } ) + f1_local3:animateToState( "default" ) + f1_local3:registerEventHandler( "set_button_info_text", function ( element, event ) + if event.text then + element:setText( event.text ) + end + end ) + self:addElement( f1_local3 ) + return self +end + +LUI.ButtonDescText.build = function ( f3_arg0, f3_arg1, f3_arg2 ) + return LUI.ButtonDescText.new( f3_arg0, f3_arg1 ) +end + +LUI.MenuBuilder.registerType( "button_desc_text", LUI.ButtonDescText.build ) +LockTable( _M ) diff --git a/lui/buttonhelpertext.dec.lua b/lui/buttonhelpertext.dec.lua new file mode 100644 index 0000000..48ca165 --- /dev/null +++ b/lui/buttonhelpertext.dec.lua @@ -0,0 +1,686 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( "Registering " .. _NAME ) +CommonEvents = { + addBackButton = { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true, + priority = -1000 + }, + addActionButton = { + name = "add_button_helper_text", + button_ref = "button_action", + helper_text = Engine.Localize( "@MENU_CONTINUE" ), + side = "left", + clickable = true, + priority = -1000 + }, + addFriendsButton = { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize( "@LUA_MENU_FRIENDS" ), + side = "right", + clickable = true, + width = 190, + priority = -1000 + }, + removeFriendsButton = { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = "" + }, + addGameSummaryButton = { + name = "add_button_helper_text", + button_ref = "button_select", + helper_text = Engine.Localize( "@LUA_MENU_MATCH_SUMMARY" ), + side = "left", + clickable = true + }, + addAcceptButton = { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = Engine.Localize( "@LUA_MENU_ACCEPT" ), + side = "left", + clickable = true, + priority = -1000 + }, + addDeclineButton = { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_DECLINE" ), + side = "left", + clickable = true, + priority = -1000 + }, + addLeftButton = { + name = "add_button_helper_text", + button_ref = "button_shoulderl", + helper_text = Engine.Localize( "@LUA_MENU_PREV_PAGE" ), + side = "left", + clickable = true, + priority = -1000 + }, + addRightButton = { + name = "add_button_helper_text", + button_ref = "button_shoulderr", + helper_text = Engine.Localize( "@LUA_MENU_NEXT_PAGE" ), + side = "left", + clickable = true, + priority = -1000 + } +} +function AddHelperTextObject( f1_arg0, f1_arg1 ) + assert( f1_arg1.button_ref ) + assert( f1_arg1.helper_text ) + local f1_local0 = nil + if f1_arg1.side and f1_arg1.side == "left" then + f1_local0 = f1_arg0:getChildById( "left_button_helper_list_id" ) + else + f1_local0 = f1_arg0:getChildById( "right_button_helper_list_id" ) + end + assert( f1_local0 ) + local f1_local1 = f1_arg1.button_ref .. "_id" + local f1_local2 = f1_local0:getChildById( f1_local1 ) + if f1_local2 and f1_arg1.helper_text ~= f1_local2.currentText then + f1_local2:close() + f1_local2 = nil + end + if not f1_local2 and f1_arg1.helper_text ~= "" then + local f1_local3 = helper_text_item( ButtonMap[f1_arg1.button_ref], f1_arg1.helper_text, f1_arg1.button_ref2 and ButtonMap[f1_arg1.button_ref2] or nil, f1_arg1.width, f1_arg1.priority, f1_arg1.ignorePopups or false, f1_arg1.customEvent or nil, f1_arg1.customEventTarget or nil, f1_arg1.useAnimIntro or nil, f1_arg1.flash or nil ) + f1_local3.id = f1_local1 + if f1_arg1.clickable == true and ButtonMap[f1_arg1.button_ref] then + f1_local3.triggers_event = f1_arg1.button_ref + end + if Engine.IsConsoleGame() then + f1_local3:makeNotFocusable() + end + f1_local0:addElement( f1_local3 ) + end + return true +end + +function ClearHelperTextObjects( f2_arg0, f2_arg1 ) + if not f2_arg1.side then + DebugPrint( "WARNING: clear_button_helper_text event sent without specifying the desired side. Ignoring..." ) + return + end + local f2_local0 = nil + if f2_arg1.side == "left" then + f2_local0 = f2_arg0:getChildById( "left_button_helper_list_id" ) + else + f2_local0 = f2_arg0:getChildById( "right_button_helper_list_id" ) + end + assert( f2_local0 ) + f2_local0:closeChildren() + return true +end + +function sendButtonEvent( f3_arg0, f3_arg1 ) + if f3_arg0.triggers_event and f3_arg1.mouse == true then + local f3_local0 = { + name = "gamepad_button", + immediate = true, + down = true + } + assert( ButtonMap[f3_arg0.triggers_event].raw_button ) + f3_local0.button = ButtonMap[f3_arg0.triggers_event].raw_button + f3_local0.controller = f3_arg1.controller + f3_arg0:dispatchEventToRoot( f3_local0 ) + end +end + +function sendCustomEvent( f4_arg0, f4_arg1 ) + customEvent = f4_arg1.customEvent + eventTarget = f4_arg1.eventTarget + eventTarget:processEvent( customEvent ) +end + +function getButtonPosition( f5_arg0, f5_arg1, f5_arg2 ) + local f5_local0 = Engine.IsConsoleGame() + if not f5_local0 then + f5_local0 = Engine.IsGamepadEnabled() == 1 + end + local f5_local1 + if f5_local0 then + f5_local1 = 32 + if not f5_local1 then + + else + local f5_local2, f5_local3 = nil + if f5_arg0 then + if f5_local0 and f5_arg0.string then + f5_local2 = Engine.Localize( f5_arg0.string ) .. " " + if f5_arg1 and f5_arg1.string then + f5_local3 = " " .. Engine.Localize( f5_arg1.string ) + end + elseif f5_arg0.keyboard_string then + f5_local2 = Engine.Localize( f5_arg0.keyboard_string ) .. " " + if f5_arg1 and f5_arg1.keyboard_string then + f5_local3 = " " .. Engine.Localize( f5_arg1.keyboard_string ) + end + end + end + return f5_local2, f5_local3, f5_local1 + end + end + f5_local1 = f5_arg2.Height +end + +function getButtonWidth( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4, f6_arg5, f6_arg6, f6_arg7 ) + local f6_local0 = f6_arg7 + local f6_local1 = 0 + local f6_local2 = 0 + local f6_local3 = 0 + local f6_local4, f6_local5, f6_local6, f6_local7 = nil + if f6_arg0 then + local f6_local8, f6_local9, f6_local10, f6_local11 = GetTextDimensions( f6_arg3, f6_arg6.Font, f6_arg5 ) + f6_local7 = f6_local11 + f6_local6 = f6_local10 + f6_local5 = f6_local9 + f6_local1 = f6_local6 - f6_local8 + end + local f6_local8, f6_local9, f6_local10, f6_local11 = GetTextDimensions( f6_arg2, f6_arg6.Font, f6_arg6.Height ) + f6_local7 = f6_local11 + f6_local6 = f6_local10 + f6_local5 = f6_local9 + f6_local3 = f6_local6 - f6_local8 + if f6_arg1 then + f6_local8, f6_local9, f6_local10, f6_local11 = GetTextDimensions( f6_arg4, f6_arg6.Font, f6_arg5 ) + f6_local7 = f6_local11 + f6_local6 = f6_local10 + f6_local5 = f6_local9 + f6_local2 = f6_local6 - f6_local8 + end + if not f6_arg7 then + f6_local0 = 20 + f6_local1 + f6_local3 + f6_local2 + end + return f6_local0, f6_local1, f6_local2, f6_local3 +end + +function helper_text_item( f7_arg0, f7_arg1, f7_arg2, f7_arg3, f7_arg4, f7_arg5, f7_arg6, f7_arg7, f7_arg8, f7_arg9 ) + local f7_local0 = CoD.TextSettings.SmallFont + local f7_local1, f7_local2, f7_local3 = getButtonPosition( f7_arg0, f7_arg2, f7_local0 ) + local f7_local4, f7_local5, f7_local6, f7_local7 = getButtonWidth( f7_arg0, f7_arg2, f7_arg1, f7_local1, f7_local2, f7_local3, f7_local0, f7_arg3 ) + local self = LUI.UIButton.new() + self.id = "helper_text_item" + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f7_local4, + top = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + self.m_disableNavigation = true + self.m_requireFocusType = FocusType.MouseOver + if f7_arg6 then + assert( f7_arg7 ) + self:registerEventHandler( "button_action", function ( element, event ) + f7_arg7:processEvent( f7_arg6 ) + end ) + else + self:registerEventHandler( "button_action", sendButtonEvent ) + end + self:registerEventHandler( "rebind", function ( element, event ) + if event.buttonLeft and event.buttonLeft == f7_arg0 then + element.m_ignoreMouseFocus = nil + end + end ) + self:registerEventHandler( "refresh_button_helper", function ( element, event ) + local f10_local0, f10_local1, f10_local2 = getButtonPosition( f7_arg0, f7_arg2, f7_local0 ) + local f10_local3 = getButtonWidth( f7_arg0, f7_arg2, f7_arg1, f10_local0, f10_local1, f10_local2, f7_local0, f7_arg3 ) + element:registerAnimationState( "refreshed", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f7_local4, + top = 0, + bottom = 0 + } ) + element:animateToState( "refreshed" ) + end ) + if f7_arg5 then + self:registerEventHandler( "popup_active", nil ) + self:registerEventHandler( "popup_inactive", nil ) + end + if f7_local1 then + local f7_local9 = LUI.UIText.new() + f7_local9.id = "left" + f7_local9:setText( f7_local1 ) + f7_local9:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, { + font = f7_local0.Font, + alignment = LUI.Alignment.Left, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = -f7_local3 / 2, + bottom = f7_local3 / 2 + } ) ) + f7_local9:animateToState( "default" ) + f7_local9:registerEventHandler( "refresh_button_helper", function ( element, event ) + local f11_local0, f11_local1, f11_local2 = getButtonPosition( f7_arg0, f7_arg2, f7_local0 ) + element:setText( f11_local0 ) + element:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, { + font = f7_local0.Font, + alignment = LUI.Alignment.Left, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = -f11_local2 / 2, + bottom = f11_local2 / 2 + } ) ) + element:animateToState( "default" ) + end ) + self:addElement( f7_local9 ) + end + local f7_local9 = LUI.UIText.new() + f7_local9.properties = {} + f7_local9.id = "helper_text_text" + f7_local9:setText( f7_arg1 ) + f7_local9:registerAnimationState( "default", CoD.ColorizeState( Colors.cac_label_text, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f7_local5, + right = 0, + top = -f7_local0.Height / 2, + bottom = f7_local0.Height / 2, + font = f7_local0.Font, + alignment = LUI.Alignment.Left + } ) ) + f7_local9:registerAnimationState( "anim_intro", CoD.ColorizeState( Colors.cac_label_text, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 0, + font = f7_local0.Font, + alignment = LUI.Alignment.Left + } ) ) + f7_local9:registerAnimationState( "over", CoD.ColorizeState( Colors.white ) ) + f7_local9.properties.animLoop = MBh.AnimateLoop( { + { + "default", + 500 + }, + { + "flash", + 500 + } + } ) + if f7_arg8 then + f7_local9:animateToState( "anim_intro" ) + else + f7_local9:animateToState( "default" ) + end + if f7_arg9 then + f7_local9:registerAnimationState( "flash", CoD.ColorizeState( Colors.frontend_hilite ) ) + f7_local9.properties:animLoop() + end + local f7_local10 = f7_local9 + local f7_local11 = f7_local9.registerEventHandler + local f7_local12 = "button_up" + local f7_local13 + if f7_arg9 then + f7_local13 = f7_local9.properties.animLoop + if not f7_local13 then + + else + f7_local11( f7_local10, f7_local12, f7_local13 ) + f7_local9:registerEventHandler( "button_over", MBh.AnimateToState( "over" ) ) + f7_local9:registerEventHandler( "refresh_button_helper", function ( element, event ) + local f12_local0, f12_local1, f12_local2 = getButtonPosition( f7_arg0, f7_arg2, f7_local0 ) + local f12_local3, f12_local4 = getButtonWidth( f7_arg0, f7_arg2, f7_arg1, f12_local0, f12_local1, f12_local2, f7_local0, f7_arg3 ) + element:registerAnimationState( "default", CoD.ColorizeState( Colors.cac_label_text, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f12_local4, + right = 0, + top = -f7_local0.Height / 2, + bottom = f7_local0.Height / 2, + font = f7_local0.Font, + alignment = LUI.Alignment.Left + } ) ) + element:animateToState( "default" ) + end ) + self.currentText = f7_arg1 + self:addElement( f7_local9 ) + if f7_local2 then + f7_local11 = LUI.UIText.new() + f7_local11.id = "right" + f7_local11:setText( f7_local2 ) + f7_local11:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, { + font = f7_local0.Font, + alignment = LUI.Alignment.Left, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f7_local5 + f7_local7, + right = 0, + top = -f7_local3 / 2, + bottom = f7_local3 / 2 + } ) ) + f7_local11:registerEventHandler( "refresh_button_helper", function ( element, event ) + local f13_local0, f13_local1, f13_local2 = getButtonPosition( f7_arg0, f7_arg2, f7_local0 ) + local f13_local3, f13_local4 = getButtonWidth( f7_arg0, f7_arg2, f7_arg1, f13_local0, f13_local1, f13_local2, f7_local0, f7_arg3 ) + element:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, { + font = f7_local0.Font, + alignment = LUI.Alignment.Left, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f13_local4 + f7_local7, + right = 0, + top = -f13_local2 / 2, + bottom = f13_local2 / 2 + } ) ) + element:animateToState( "default" ) + end ) + f7_local11:animateToState( "default" ) + self:addElement( f7_local11 ) + end + if f7_arg4 then + self:setPriority( f7_arg4 ) + end + return self + end + end + f7_local13 = MBh.AnimateToState( "default" ) +end + +function button_helper_text_main() + return { + type = "UIElement", + id = "button_helper_text_main_id", + properties = { + left_inset = 100, + right_inset = -75, + top_margin = GenericFooterDims.TopMargin_WithBackground, + bottom_margin = -35, + height = GenericFooterDims.Height, + spacing = 12, + background_alpha = 1, + hideAlienBar = false + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = 0, + top = MBh.Property( "top_margin" ), + bottom = 0, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + show_button_helper_text = MBh.AnimateToState( "default" ), + hide_button_helper_text = MBh.AnimateToState( "hidden" ) + }, + children = { + { + type = "UIImage", + id = "black_bar", + states = { + default = { + leftAnchor = true, + topAnchor = false, + rightAnchor = true, + bottomAnchor = true, + left = 0, + top = 0, + right = 0, + height = 300, + red = 0, + green = 0, + blue = 0, + alpha = MBh.Property( "background_alpha" ), + material = RegisterMaterial( "white" ) + } + } + }, + { + type = "UIImage", + id = "button_helper_background_id", + properties = { + background_alpha = MBh.Property( "background_alpha" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -25, + height = 128, + left = 0, + right = 0, + material = RegisterMaterial( "bkgd_title_bar" ), + zRot = 180, + alpha = MBh.Property( "background_alpha" ) + } + } + }, + { + type = "UIImage", + id = "button_helper_background_alien_id", + properties = { + hideAlienBar = MBh.Property( "hideAlienBar" ), + background_alpha = MBh.Property( "background_alpha" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -8, + bottom = 22, + left = 0, + right = 0, + material = Engine.IsAliensMode() and RegisterMaterial( "box_alien_header_footer" ) or RegisterMaterial( "white" ), + alpha = 0 + }, + show = { + alpha = MBh.Property( "background_alpha" ) + } + }, + handlers = { + menu_create = function ( f15_arg0, f15_arg1 ) + if Engine.IsAliensMode() and not f15_arg0.properties.hideAlienBar then + f15_arg0:animateToState( "show", 0 ) + end + end + + } + }, + { + type = "UIText", + id = "build_number_text", + properties = { + text = Engine.GetBuildNumber(), + background_alpha = MBh.Property( "background_alpha" ) + }, + states = { + default = CoD.ColorizeState( Colors.build_number, { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = -70, + bottom = -22, + height = CoD.TextSettings.TinyFont.Height, + font = CoD.TextSettings.TinyFont.Font, + alignment = LUI.Alignment.Right, + alpha = 0 + } ), + visible = { + alpha = MBh.Property( "background_alpha" ) + } + }, + handlers = { + menu_create = function ( f16_arg0, f16_arg1 ) + if Engine.InFrontend() and Engine.IsMultiplayer() then + f16_arg0:animateToState( "visible" ) + end + end + + } + }, + { + type = "UIText", + id = "ds_text", + properties = { + text = "", + background_alpha = MBh.Property( "background_alpha" ) + }, + states = { + default = CoD.ColorizeState( Colors.build_number, { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true, + left = 0, + right = -70, + bottom = -10, + height = CoD.TextSettings.TinyFont.Height, + font = CoD.TextSettings.TinyFont.Font, + alignment = LUI.Alignment.Right, + alpha = 0 + } ), + visible = { + alpha = MBh.Property( "background_alpha" ) + } + }, + handlers = { + menu_create = MBh.EmitEvent( "update_ds_text" ), + update_ds_text = function ( f17_arg0, f17_arg1 ) + if Engine.GetDvarBool( "ds_info_enable" ) then + f17_arg0:animateToState( "visible" ) + f17_arg0:setText( Engine.GetDvarString( "ds_info" ) or "" ) + else + f17_arg0:animateToState( "default" ) + end + end + + }, + children = { + { + type = "UITimer", + id = "ds_text_refresh_timer", + properties = { + event = { + name = "update_ds_text" + }, + interval = 1000 + } + } + } + }, + { + type = "UIElement", + id = "container", + properties = { + height = MBh.Property( "height" ), + spacing = MBh.Property( "spacing" ), + left_inset = MBh.Property( "left_inset" ), + right_inset = MBh.Property( "right_inset" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 10, + height = MBh.Property( "height" ) + } + }, + children = { + { + type = "UIHorizontalList", + id = "left_button_helper_list_id", + properties = { + spacing = MBh.Property( "spacing" ), + left_inset = MBh.Property( "left_inset" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = MBh.Property( "left_inset" ), + right = 0, + top = 0, + bottom = 0, + alignment = LUI.Alignment.Left, + spacing = MBh.Property( "spacing" ) + } + } + }, + { + type = "UIHorizontalList", + id = "right_button_helper_list_id", + properties = { + spacing = MBh.Property( "spacing" ), + right_inset = MBh.Property( "right_inset" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = MBh.Property( "right_inset" ), + top = 0, + bottom = 0, + alignment = LUI.Alignment.Right, + spacing = MBh.Property( "spacing" ) + } + } + } + }, + handlers = { + add_button_helper_text = AddHelperTextObject, + clear_button_helper_text = ClearHelperTextObjects + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "button_helper_text_main", button_helper_text_main ) +LockTable( _M ) diff --git a/lui/chatcontrols.dec.lua b/lui/chatcontrols.dec.lua new file mode 100644 index 0000000..8fda3f1 --- /dev/null +++ b/lui/chatcontrols.dec.lua @@ -0,0 +1,159 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GetDisplay( f1_arg0 ) + return Engine.GetBinding( f1_arg0 ) +end + +function bindKey( f2_arg0 ) + Engine.BindKey( f2_arg0 ) +end + +function OptionsWindowRefresh( f3_arg0, f3_arg1 ) + if f3_arg1.source_input == "button_action" or f3_arg1.source_input == "key_bound" then + f3_arg0:processEvent( { + name = "menu_refresh" + } ) + f3_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function OptionsWindowTriggerRefresh( f4_arg0, f4_arg1 ) + f4_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f4_arg1.name, + immediate = true + } ) +end + +function ControlBindFactory( f5_arg0, f5_arg1 ) + return { + type = "UIGenericButton", + id = "bind_" .. f5_arg1, + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( f5_arg0 ), + button_display_func = function ( f6_arg0, f6_arg1 ) + return GetDisplay( f5_arg1 ) + end + , + button_action_func = function ( f7_arg0, f7_arg1 ) + Engine.BindKey( f5_arg1 ) + OptionsWindowTriggerRefresh( f7_arg0, f7_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ), + key_bound = OptionsWindowTriggerRefresh + } + } +end + +function OptionsFeeder( f8_arg0 ) + local f8_local0 = {} + Engine.ExecNow( "profile_menuDvarsSetup" ) + f8_local0[#f8_local0 + 1] = ControlBindFactory( "@MENU_TEXT_CHAT", "chatmodepublic" ) + f8_local0[#f8_local0 + 1] = ControlBindFactory( "@MENU_TEXT_TEAM_CHAT", "chatmodeteam" ) + f8_local0[#f8_local0 + 1] = ControlBindFactory( "@MENU_VOICE_CHAT_BUTTON", "+talk" ) + return f8_local0 +end + +function OptionsMainCreate( f9_arg0, f9_arg1 ) + f9_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function chat_controls_vlist() + return { + type = "UIStencil", + children = { + { + type = "UIVerticalList", + childrenFeeder = OptionsFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -25, + top = 0, + bottom = 0 + } + } + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_wide, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + handlers = { + options_window_refresh = OptionsWindowRefresh + } + } +end + +function chat_controls() + return { + type = "UIElement", + id = "chat_controls_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = function ( f12_arg0, f12_arg1 ) + Engine.Exec( "updategamerprofile" ) + end + + }, + children = { + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_CHAT" ) + } + }, + { + type = "chat_controls_vlist", + id = "chat_controls_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "chat_controls_vlist", chat_controls_vlist ) +LUI.MenuBuilder.registerDef( "chat_controls", chat_controls ) +LockTable( _M ) diff --git a/lui/cod.dec.lua b/lui/cod.dec.lua new file mode 100644 index 0000000..563b2ff --- /dev/null +++ b/lui/cod.dec.lua @@ -0,0 +1,1558 @@ +local f0_local0 = false +local f0_local1 = false +Memory = { + InGame = { + lowFreeBytes = 307200 + }, + Frontend = { + lowFreeBytes = 1048576 + }, + CheckLow = function () + local f1_local0 = Engine.GetBytesFree() + local f1_local1 = Memory.InGame.lowFreeBytes + if Engine.InFrontend() then + f1_local1 = Memory.Frontend.lowFreeBytes + end + if f1_local0 < f1_local1 then + DebugPrint( "LUI: Low on memory, running GC now. BytesFree = " .. Engine.GetBytesFree() ) + collectgarbage( "collect" ) + end + end +} +MaxLocalClients = 2 +ScreenResolution = { + HD = { + width = Engine.GetDisplayWidth() / Engine.GetDisplayHeight() * 720, + height = 720, + name = "HD" + } +} +currentScreenResolution = "HD" +Teams = { + free = 0, + axis = 1, + allies = 2, + spectator = 3 +} +otherTeamLookup = { + 2, + 1 +} +spectatorFakeTeam = 2 +font_smallFont = "fonts/smallFont" +font_normalFont = "fonts/normalFont" +font_bigFont = "fonts/bigFont" +font_extraBigFont = "fonts/extraBigFont" +font_boldFont = "fonts/boldFont" +font_consoleFont = "fonts/consoleFont" +font_objectiveFont = "fonts/objectiveFont" +font_hudIW6SmallFont = "fonts/hudSmallFont" +font_hudIW6NormalFont = "fonts/hudNormalFont" +font_hudIW6BigFont = "fonts/hudBigFont" +font_hudEuroSmallFont = "fonts/smallFont" +font_hudEuroNormalFont = "fonts/normalFont" +font_hudEuroBigFont = "fonts/bigFont" +font_hudDigitalFont20 = "fonts/hudDigitalFont20" +font_hudDigitalFont25 = "fonts/hudDigitalFont25" +font_hudDigitalFont30 = "fonts/hudDigitalFont30" +font_hudDigitalFont40 = "fonts/hudDigitalFont40" +odayaka = 0 +if Engine.GetCurrentLanguage() == 10 then + odayaka = 0 +end +CoD = { + TextSettings = { + TinyFont = { + Font = RegisterFont( font_smallFont ), + Height = 15 + odayaka + }, + SmallFont = { + Font = RegisterFont( font_normalFont ), + Height = 21 + odayaka + }, + NormalFont = { + Font = RegisterFont( font_normalFont ), + Height = 21 + odayaka + }, + BigFont = { + Font = RegisterFont( font_bigFont ), + Height = 28 + odayaka, + MaxHeight = 50 + }, + ExtraBigFont = { + Font = RegisterFont( font_extraBigFont ), + Height = 28 + odayaka + }, + BoldFont = { + Font = RegisterFont( font_boldFont ), + Height = 21 + odayaka + }, + HudIW6TinyFont = { + Font = RegisterFont( font_hudIW6SmallFont ), + Height = 15 + }, + HudIW6SmallFont = { + Font = RegisterFont( font_hudIW6SmallFont ), + Height = 20 + }, + HudIW6NormalFont = { + Font = RegisterFont( font_hudIW6NormalFont ), + Height = 25 + }, + HudIW6BigFont = { + Font = RegisterFont( font_hudIW6BigFont ), + Height = 30 + }, + HudIW6ExtraBigFont = { + Font = RegisterFont( font_hudIW6BigFont ), + Height = 40 + }, + HudEuroConRegTinyFont = { + Font = RegisterFont( font_hudEuroSmallFont ), + Height = 15 + }, + HudEuroMedTinyFont = { + Font = RegisterFont( font_hudEuroNormalFont ), + Height = 15 + }, + HudEuroConRegSmallFont = { + Font = RegisterFont( font_hudEuroSmallFont ), + Height = 20 + }, + HudEuroMedSmallFont = { + Font = RegisterFont( font_hudEuroNormalFont ), + Height = 20 + }, + HudEuroNormalFont = { + Font = RegisterFont( font_hudEuroNormalFont ), + Height = 25 + }, + HudEuroBigFont = { + Font = RegisterFont( font_hudEuroBigFont ), + Height = 30 + }, + HudEuroExtraBigFont = { + Font = RegisterFont( font_hudEuroBigFont ), + Height = 40 + }, + HudDigitalSmallFont = { + Font = RegisterFont( font_hudDigitalFont20 ), + Height = 20 + }, + HudDigitalNormalFont = { + Font = RegisterFont( font_hudDigitalFont25 ), + Height = 26 + }, + HudDigitalBigFont = { + Font = RegisterFont( font_hudDigitalFont30 ), + Height = 30 + }, + HudDigitalExtraBigFont = { + Font = RegisterFont( font_hudDigitalFont40 ), + Height = 40 + } + }, + TextStyle = { + None = 0, + Shadowed = 3, + ShadowedMore = 6, + Outlined = 7, + OutlinedMore = 8, + ForceUpperCase = 9, + ForceLowerCase = 10, + Monospace = 128, + MonospaceShadow = 132 + }, + MaxSafeguardPlayers = 4, + PlayMode = { + None = 0, + SP = 1, + Core = 2, + Aliens = 3, + SquadVsSquad = 4, + Count = 5 + }, + Ownerdraw = { + CGSpectatorControls = 61, + CGChangeZoomHint = 70, + CGHoldBreathHint = 71, + CGCursorHint = 72, + CGToggleThermalHint = 76, + CGToggleHybridHint = 77, + CGMantleHint = 80, + CGDeadQuote = 97, + CGMissionObjectiveHeader = 99, + CGMissionObjectiveList = 100, + CGMissionObjectiveBackdrop = 101, + CGSaving = 111, + CGLowHealthOverlay = 112, + CGInvalidCmdHint = 113, + CGVehicleReticle = 200, + CGHudTargetsVehicle = 201, + UIRecordLevel = 365, + UIIOTD = 387 + }, + OwnerdrawAlignment = { + None = 0, + TextCenter = 2, + TextTopLeft = 1 + } +} +if Engine.InFrontend() then + if not Engine.IsXbox360() then + CoD.Music = { + MainSPMusic = "music_mainmenu", + MainMPMusic = "music_mainmenu_mp", + MainSquadMusic = "music_mainmenu_squad", + MainExtinctMusic = "music_mainmenu_extinct", + MainExtinctMusic_DLC1 = "music_mainmenu_extinct_dlc1", + MainExtinctMusic_DLC2 = "music_mainmenu_extinct_dlc2", + MainExtinctMusic_DLC3 = "music_mainmenu_extinct_dlc3", + MainExtinctMusic_DLC4 = "music_mainmenu_extinct_dlc4", + MainExtinctIntelMusic = "music_mainmenu_extinct_intel", + MainRorkeMusic = "music_mainmenu_rorke_files" + } + else + CoD.Music = { + MainSPMusic = "music_mainmenu", + MainMPMusic = "music_mainmenu_mp", + MainSquadMusic = "music_mainmenu_squad", + MainExtinctMusic = "music_mainmenu_extinct", + MainExtinctMusic_DLC1 = "music_mainmenu_extinct_xenon", + MainExtinctMusic_DLC2 = "music_mainmenu_extinct_xenon", + MainExtinctMusic_DLC3 = "music_mainmenu_extinct_xenon", + MainExtinctMusic_DLC4 = "music_mainmenu_extinct_xenon", + MainExtinctIntelMusic = "music_mainmenu_extinct_intel", + MainRorkeMusic = "music_mainmenu_rorke_files" + } + end +end +CoD.SFX = { + OtherAdjust = "ui_other_adjust", + MouseOver = "ui_hilite", + MouseClick = "ui_select_confirm", + SelectBack = "ui_select_back", + AdjustSafeArea = "ui_screen_adjust", + DenyAdjustSafeArea = "ui_screen_edge_deny", + MPLobbyPlayerJoin = "ui_mp_player_join_lobby", + MPLobbyPlayerExit = "ui_mp_player_leave_lobby", + ChangeScreen = "ui_screen_change", + AdjustSlider = "ui_slide_adjust", + CharacterSlide = "ui_character_slide", + SPMinimap = "ui_sp_minimap", + SubMenuMouseOver = "ui_hilite_submenu", + CacSelectAbility = "ui_mp_ability_select", + CacDeselectAbility = "ui_mp_ability_deselect", + CacSelectStrikePackage = "ui_mp_package_select", + CacDeselectStrikePackage = "ui_mp_package_deselect", + CacSpendPoints = "ui_points_spent", + DenySelect = "ui_select_deny", + UIKinectCommandGood = "ui_kinect_command_good", + UIKinectCommandBad = "ui_kinect_command_bad", + CacSetAILoadout = "ui_mp_ability_select", + RestrictClass = "ui_select_confirm", + XPTick = "mp_experience_tick" +} +CoD.KeyboardInputTypes = { + Normal = 0, + Email = 1, + Password = 2 +} +if Engine.InFrontend() then + CoD.AntiCheat = { + Ban = { + FEATURE_BAN_LIVE_MP = 1, + FEATURE_BAN_LIVE_EXTINCTION = 2, + FEATURE_BAN_LEADERBOARD_WRITE_MP = 3, + FEATURE_BAN_LEADERBOARD_WRITE_EXTINCTION = 4, + FEATURE_BAN_MP_SPLITSCREEN = 5, + FEATURE_BAN_CLAN_TAGS = 6, + FEATURE_BAN_VOICE_CHAT = 7, + FEATURE_BAN_PRESTIGE = 8, + FEATURE_BAN_BOT_GAMES = 9, + FEATURE_BAN_SEARCH_DEDICATED_SERVER = 10, + FEATURE_BAN_ALLOCATE_DEDICATED_SERVER = 11, + FEATURE_BAN_HOSTING = 12, + FEATURE_BAN_PRESTIGE_EXTRAS = 13 + } + } +end +CoD.PlayOnlineFailure = { + OPFR_XBOXLIVE_MPNOTALLOWED = 8 +} +CoD.RequiredDLCError = { + COMPATIBILITY_ERROR_NONE = 0, + COMPATIBILITY_ERROR_DISK_FULL = 1, + COMPATIBILITY_ERROR_CORRUPTED = 2, + COMPATIBILITY_ERROR_CANCELED = 3, + COMPATIBILITY_ERROR_UNKNOWN = 4 +} +CoD.CompassType = { + Partial = 0, + Full = 1 +} +GenericMenuDims = { + menu_left = 0, + menu_right_narrow = 390, + menu_right = 490, + menu_right_med = 525, + menu_right_more = 565, + menu_right_wide = 640, + menu_top = 115, + menu_top_low = 215, + menu_top_scroll = 95, + menu_bottom = 600, + menu_bottom_scroll = 542, + menu_bottom_tall = 700 +} +GenericTitleBarDims = { + TitleBarHeight = 32, + TitleBarLCapWidth = 32, + TitleBarRCapWidth = 4 +} +GenericFooterDims = { + Height = 36, + BuildNumberHeight = 35, + TopMargin_WithBackground = -80, + TopMargin_WithoutBackground = -48 +} +DialogPopupDims = { + Width = 400, + Height = 85 +} +DialogWidgetDims = { + Width = 30, + Height = 30 +} +GenericButtonDims = { + button_height = 27, + button_width = 500, + pad_button_width = 35 +} +OptionsListDims = { + menu_top = 100, + menu_bottom = 609, + menu_left = 0, + menu_right = 600 +} +local f0_local2 = { + [0] = "LANGUAGE_ENGLISH" +} +local f0_local3 = "LANGUAGE_FRENCH" +local f0_local4 = "LANGUAGE_GERMAN" +local f0_local5 = "LANGUAGE_ITALIAN" +local f0_local6 = "LANGUAGE_SPANISH" +local f0_local7 = "LANGUAGE_BRITISH" +local f0_local8 = "LANGUAGE_RUSSIAN" +local f0_local9 = "LANGUAGE_POLISH" +local f0_local10 = "LANGUAGE_KOREAN" +local f0_local11 = "LANGUAGE_TAIWANESE" +local f0_local12 = "LANGUAGE_JAPANESE" +local f0_local13 = "LANGUAGE_CHINESE" +local f0_local14 = "LANGUAGE_THAI" +local f0_local15 = "LANGUAGE_CZECH" +local f0_local16 = "LANGUAGE_SPANISHNA" +local f0_local17 = "LANGUAGE_PORTUGUESE" +local f0_local18 = "MAX_LANGUAGES" +f0_local2[1] = f0_local3 +f0_local2[2] = f0_local4 +f0_local2[3] = f0_local5 +f0_local2[4] = f0_local6 +f0_local2[5] = f0_local7 +f0_local2[6] = f0_local8 +f0_local2[7] = f0_local9 +f0_local2[8] = f0_local10 +f0_local2[9] = f0_local11 +f0_local2[10] = f0_local12 +f0_local2[11] = f0_local13 +f0_local2[12] = f0_local14 +f0_local2[13] = f0_local15 +f0_local2[14] = f0_local16 +f0_local2[15] = f0_local17 +f0_local2[16] = f0_local18 +Languages = f0_local2 +ButtonMap = { + button_action = { + string = "@LUA_MENU_PAD_PRIMARY_BUTTON", + keyboard_string = "@PLATFORM_KB_PRIMARY_BUTTON", + raw_button = "primary" + }, + button_secondary = { + string = "@LUA_MENU_PAD_SECONDARY_BUTTON", + keyboard_string = "@PLATFORM_KB_SECONDARY_BUTTON", + raw_button = "secondary" + }, + button_alt1 = { + string = "@LUA_MENU_PAD_ALT1_BUTTON", + keyboard_string = "@PLATFORM_KB_ALT1_BUTTON", + raw_button = "alt1" + }, + button_alt2 = { + string = "@LUA_MENU_PAD_ALT2_BUTTON", + keyboard_string = "@PLATFORM_KB_ALT2_BUTTON", + raw_button = "alt2" + }, + button_right_trigger = { + string = "@LUA_MENU_PAD_RIGHT_TRIGGER_BUTTON", + keyboard_string = "@PLATFORM_KB_RIGHT_TRIGGER_BUTTON", + raw_button = "right_trigger" + }, + button_left_trigger = { + string = "@LUA_MENU_PAD_LEFT_TRIGGER_BUTTON", + keyboard_string = "@PLATFORM_KB_LEFT_TRIGGER_BUTTON", + raw_button = "left_trigger" + }, + button_shoulderr = { + string = "@LUA_MENU_PAD_RIGHT_SHOULDER_BUTTON", + keyboard_string = "@PLATFORM_KB_RIGHT_SHOULDER_BUTTON", + raw_button = "shoulderr" + }, + button_shoulderl = { + string = "@LUA_MENU_PAD_LEFT_SHOULDER_BUTTON", + keyboard_string = "@PLATFORM_KB_LEFT_SHOULDER_BUTTON", + raw_button = "shoulderl" + }, + button_select = { + string = "@LUA_MENU_PAD_BACK_BUTTON", + keyboard_string = "@PLATFORM_KB_BACK_BUTTON", + raw_button = "select" + }, + button_start = { + string = "@LUA_MENU_PAD_START_BUTTON", + keyboard_string = "@PLATFORM_KB_START_BUTTON", + raw_button = "start" + }, + button_dpad_up = { + string = "@LUA_MENU_PAD_DPAD_UP_BUTTON", + keyboard_string = "@PLATFORM_KB_DPAD_UP_BUTTON", + raw_button = "dpad_up" + }, + button_dpad_down = { + string = "@LUA_MENU_PAD_DPAD_DOWN_BUTTON", + keyboard_string = "@PLATFORM_KB_DPAD_DOWN_BUTTON", + raw_button = "dpad_down" + }, + button_dpad_left = { + string = "@LUA_MENU_MP_PAD_DPAD_LEFT_BUTTON", + keyboard_string = "@PLATFORM_KB_DPAD_LEFT_BUTTON", + raw_button = "dpad_left" + }, + button_dpad_right = { + string = "@LUA_MENU_MP_PAD_DPAD_RIGHT_BUTTON", + keyboard_string = "@PLATFORM_KB_DPAD_RIGHT_BUTTON", + raw_button = "dpad_right" + }, + button_l3 = { + string = "@LUA_MENU_PAD_L3_BUTTON", + keyboard_string = "@PLATFORM_KB_L3_BUTTON", + raw_button = "l3" + }, + button_page_up = { + string = "@PLATFORM_PAGE_UP", + keyboard_string = "@PLATFORM_KB_PAGE_UP_BUTTON", + raw_button = "page_up" + }, + button_page_down = { + string = "@PLATFORM_PAGE_DOWN", + keyboard_string = "@PLATFORM_KB_PAGE_DOWN_BUTTON", + raw_button = "page_down" + }, + button_home = { + string = "@PLATFORM_KB_HOME_BUTTON", + keyboard_string = "@PLATFORM_KB_HOME_BUTTON", + raw_button = "home" + }, + button_ins = { + string = "@PLATFORM_KB_INS_BUTTON", + keyboard_string = "@PLATFORM_KB_INS_BUTTON", + raw_button = "ins" + }, + button_del = { + string = "@PLATFORM_KB_DEL_BUTTON", + keyboard_string = "@PLATFORM_KB_DEL_BUTTON", + raw_button = "del" + } +} +ButtonQualifiers = { + Gamepad = "gamepad", + DPad = "dpad", + Keyboard = "keyboard", + Mousewheel = "mousewheel" +} +Colors = { + white = { + r = 1, + g = 1, + b = 1 + }, + black = { + r = 0, + g = 0, + b = 0 + }, + new_icon_green = { + r = 0.38, + g = 0.65, + b = 0.31 + }, + even_stripe = { + r = 0, + g = 0, + b = 0, + a = 0 + }, + frontend_hilite = { + r = 0.9, + g = 0.78, + b = 0.1 + }, + alien_frontend_hilite = { + r = 1, + g = 0.24, + b = 0.04 + }, + window_title_text_color = { + r = 0.8, + g = 0.8, + b = 0.8 + }, + window_border_color = { + r = 0.4, + g = 0.4, + b = 0.4 + }, + orange = { + r = 0.9, + g = 0.6, + b = 0 + }, + cyan = { + r = 0.35, + g = 0.7, + b = 0.9 + }, + blue = { + r = 0, + g = 0.45, + b = 0.7 + }, + seafoam_blue = { + r = 0.45, + g = 0.8, + b = 0.78 + }, + very_dark_cyan = { + r = 0.07, + g = 0.1, + b = 0.11 + }, + yellow = { + r = 0.9, + g = 0.78, + b = 0.1 + }, + red = { + r = 1, + g = 0, + b = 0 + }, + grey_14 = { + r = 0.14, + g = 0.14, + b = 0.14 + }, + grey_2 = { + r = 0.2, + g = 0.2, + b = 0.2 + }, + grey_22 = { + r = 0.22, + g = 0.22, + b = 0.22 + }, + grey_3 = { + r = 0.3, + g = 0.3, + b = 0.3 + }, + grey_4 = { + r = 0.4, + g = 0.4, + b = 0.4 + }, + grey_5 = { + r = 0.5, + g = 0.5, + b = 0.5 + }, + md_grey = { + r = 0.75, + g = 0.75, + b = 0.75 + }, + light_grey = { + r = 0.85, + g = 0.85, + b = 0.85 + }, + cac_label_text = { + r = 0.5, + g = 0.5, + b = 0.5 + }, + cac_ability_text = { + r = 0.8, + g = 0.8, + b = 0.8 + }, + cac_focus_text = { + r = 0, + g = 0, + b = 0 + }, + cac_button = { + r = 0.2, + g = 0.2, + b = 0.2 + }, + cac_border = { + r = 0.5, + g = 0.5, + b = 0.5 + }, + cac_weapon_meter_main = { + r = 0.8, + g = 0.8, + b = 0.8 + }, + cac_weapon_meter_better = { + r = 0.36, + g = 0.66, + b = 0.2 + }, + cac_weapon_meter_better_dark = { + r = 0.22, + g = 0.42, + b = 0.12 + }, + cac_weapon_meter_worse = { + r = 0.88, + g = 0.26, + b = 0.26 + }, + cac_weapon_meter_worse_dark = { + r = 0.55, + g = 0.16, + b = 0.16 + }, + build_number = { + r = 0.75, + g = 0.75, + b = 0.75 + }, + cac_sub_popup_text = { + r = 0.55, + g = 0.55, + b = 0.55 + }, + cac_ability = { + bg = { + r = 0.85, + g = 0.85, + b = 0.85 + }, + ability_speed = { + r = 0.76, + g = 0.25, + b = 0.13 + }, + ability_handling = { + r = 0.4, + g = 0.49, + b = 0.52 + }, + ability_stealth = { + r = 0.38, + g = 0.28, + b = 0.52 + }, + ability_awareness = { + r = 0.76, + g = 0.53, + b = 0.16 + }, + ability_resistance = { + r = 0.47, + g = 0.58, + b = 0.3 + }, + ability_equipment = { + r = 0.12, + g = 0.31, + b = 0.62 + }, + ability_elite = { + r = 0.5, + g = 0.5, + b = 0.5 + } + }, + cac_specialist_bonus = { + r = 0.35, + g = 0.7, + b = 0.9 + }, + cac_attach_shade = { + r = 0.1, + g = 0.1, + b = 0.1 + }, + cac_performance_header = { + r = 0.7, + g = 0.7, + b = 0.7 + }, + primary_text_color = { + r = 0.6, + g = 0.6, + b = 0.6 + }, + secondary_text_color = { + r = 0.35, + g = 0.35, + b = 0.35 + }, + generic_menu_bg_color = { + r = 0.13, + g = 0.13, + b = 0.13 + }, + generic_menu_frame_color = { + r = 0.5, + g = 0.5, + b = 0.5 + }, + generic_button_text_default_color = { + r = 0.65, + g = 0.65, + b = 0.65, + a = 1 + }, + generic_button_text_focus_color = { + r = 0, + g = 0, + b = 0, + a = 1 + }, + generic_button_content_focus_color = { + r = 1, + g = 1, + b = 1, + a = 1 + }, + generic_button_text_disabled_color = { + r = 0.5, + g = 0.5, + b = 0.5, + a = 0.5 + }, + generic_button_text_over_disabled_color = { + r = 1, + g = 1, + b = 1, + a = 1 + }, + generic_button_text_over_disabled_pulse_color = { + r = 1, + g = 1, + b = 1, + a = 0.65 + }, + generic_button_border_color = { + r = 0.22, + g = 0.22, + b = 0.22, + a = 1 + }, + alien_tech_tree_bright_grey = { + r = 0.8, + g = 0.8, + b = 0.8, + a = 1 + }, + alien_scoreboard_dull_grey = { + r = 0.54, + g = 0.54, + b = 0.54, + a = 1 + }, + alien_scoreboard_bright_grey = { + r = 0.76, + g = 0.76, + b = 0.76, + a = 1 + }, + alien_chaos_hilite = { + r = 0.96, + g = 0.56, + b = 0.34, + a = 1 + }, + alien_chaos_freeze = { + r = 0.43, + g = 0.81, + b = 0.96, + a = 1 + } +} +Swatches = { + GenericMenu = { + Background = Colors.very_dark_cyan, + Border = Colors.window_border_color, + BackgroundAlpha = 0.4, + BorderAlpha = 0.4 + }, + Overlay = { + Color = Colors.very_dark_cyan, + Alpha = 0.4, + AlphaMedium = 0.7, + AlphaMore = 0.85 + } +} +BrightnessGuideConstants = { + not_visible = { + item_id = "bg_not_visible", + color_default = 0.02 + }, + barely_visible = { + item_id = "bg_barely_visible", + color_default = 0.07 + }, + easily_visible = { + item_id = "bg_easily_visible", + color_default = 0.19 + } +} +GenericButtonSettings = { + Variants = { + Plain = "Plain", + Info = "Info", + Select = "Select", + Slider = "Slider", + Checkbox = "Checkbox", + Input = "Input" + }, + Common = { + force_enable_action_button = false, + force_disable_action_button = false, + y_offset = -3, + disable_height_guard = false, + disable_padlock = false, + use_locking = true, + text_align_without_content = LUI.Alignment.Right, + text_align_with_content = LUI.Alignment.Right, + text_padding_without_content = 60, + text_padding_with_content = 275, + label_align = LUI.Alignment.Center, + over_disabled_animation_duration = 300, + text_default_color = Colors.generic_button_text_default_color, + text_focus_color = Colors.generic_button_text_focus_color, + text_lock_color = Colors.generic_button_text_focus_color, + text_disabled_color = Colors.generic_button_text_disabled_color, + text_over_disabled_color = Colors.generic_button_text_over_disabled_color, + text_over_disabled_pulse_color = Colors.generic_button_text_over_disabled_pulse_color, + content_background_margin_top = 0, + content_background_margin_bottom = 0, + content_margin = 12, + content_width = 250, + content_arrows_margin = 18, + content_slider_height = 12, + content_slider_width = 143, + checkbox_margin = 35, + content_default_color = Colors.generic_button_text_default_color, + content_focus_color = Colors.generic_button_content_focus_color, + content_focus_color_without_bg = Colors.generic_button_text_focus_color, + content_lock_color = Colors.generic_button_content_focus_color, + newIconSize = 35, + newIconIndent = 90, + field_edited_func = function () + + end, + max_length = 20, + password_field = false, + filter_profanity = false, + keyboard_type = CoD.KeyboardInputTypes.Normal, + text_alignment = LUI.Alignment.Left, + field_name = "Placeholder Label" + }, + Styles = { + GradientButton = { + y_offset = -2, + height = 40.67, + lt_cap_width = 170.67, + rt_cap_width = 85.33, + content_margin = 26, + content_width = 236, + content_background_margin_top = 7, + content_background_margin_bottom = 12, + action_button_margin = 23, + slide_in_min_duration = 60, + slide_in_duration_step = 25, + focus_animation_distance = 40, + focus_animation_duration = 100, + focus_glow_animation_duration = 1200, + focus_alien_glow_animation_duration = 1800, + focus_action_button_glow_max_alpha = 0.35, + focus_alien_action_button_glow_max_alpha = 0.5, + focus_glow_max_alpha = 0.35 + }, + FlatButton = { + SubStyles = { + Default = {}, + SubMenu = { + y_offset = 0, + border_padding = 0, + border_height = 1, + submenu_substyle = true, + anim_interval = 750, + anim_1_alpha = 0.8, + anim_2_alpha = 0.5 + } + }, + height = 43, + submenu_substyle = false, + y_offset = -2, + text_align_without_content = LUI.Alignment.Left, + text_padding_with_content = 275, + text_padding_without_content = 10, + content_background_margin_top = 5, + content_background_margin_bottom = 10, + prompt_width = 36, + action_button_margin = 1, + disable_border = false, + border_color = Colors.generic_button_border_color, + border_padding = 4, + border_height = 1, + background_padding = 0 + }, + GlassButton = { + SubStyles = { + Default = { + y_offset = 2, + height = 26.67, + ghost_width = 8, + ghost_height = 10, + rt_cap_width = 85.33, + action_button_margin = 11, + border_padding = 7 + }, + Popup = { + y_offset = 2, + height = 26.67, + ghost_width = 8, + ghost_height = 10, + rt_cap_width = 85.33, + action_button_margin = 11, + popup_substyle = true, + force_disable_action_button = true, + anim_interval = 750, + anim_1_alpha = 0.8, + anim_2_alpha = 0.5, + text_over_disabled_color = Colors.generic_button_text_focus_color, + text_over_disabled_pulse_color = Colors.generic_button_text_focus_color, + border_padding = 7 + }, + YesNoPopup = { + y_offset = 2, + height = 26.67, + ghost_width = 8, + ghost_height = 10, + rt_cap_width = 85.33, + action_button_margin = 11, + popup_substyle = true, + force_disable_action_button = true, + anim_interval = 750, + anim_1_alpha = 0.8, + anim_2_alpha = 0.5, + text_over_disabled_color = Colors.generic_button_text_focus_color, + text_over_disabled_pulse_color = Colors.generic_button_text_focus_color, + border_padding = 35 + }, + SubMenu = { + y_offset = 2, + height = 26.67, + ghost_width = 8, + ghost_height = 10, + rt_cap_width = 85.33, + action_button_margin = 11, + submenu_substyle = true, + force_disable_action_button = true, + anim_interval = 750, + anim_1_alpha = 0.8, + anim_2_alpha = 0.5, + text_over_disabled_color = Colors.generic_button_text_focus_color, + text_over_disabled_pulse_color = Colors.generic_button_text_focus_color, + border_padding = 7 + } + }, + popup_substyle = false, + submenu_substyle = false, + text_align_without_content = LUI.Alignment.Center, + text_padding_without_content = 12, + content_background_margin_top = 5, + content_background_margin_bottom = 2, + lt_cap_width = 10.67, + padlock_width = 16, + padlock_height = 16, + padlock_margin = 17, + border_color = Colors.generic_button_border_color, + disable_border = false, + border_height = 1, + lock_padding = 7, + text_default_color = Colors.primary_text_color, + text_disabled_color = Colors.secondary_text_color, + newIconSize = 24, + newIconIndent = 4 + } + } +} +FocusType = { + MenuFlow = 0, + MouseOver = 1, + ListSelection = 2, + Gamepad = 3 +} +DvarTypeTable = { + DvarBool = 0, + DvarFloat = 1, + DvarInt = 5, + DvarEnum = 6, + DvarString = 7 +} +SliderBounds = { + Brightness = { + Min = -0.4, + Max = 0.2, + Step = -0.01 + }, + PCBrightness = { + Min = -0.4, + Max = 0.2, + Step = -0.01 + }, + HorzMargin = { + Min = 0.9, + Max = 1, + Step = 0 + }, + MouseSensitivity = { + Min = 1, + Max = 30, + Step = 1 + }, + VertMargin = { + Min = 0.9, + Max = 1, + Step = 0 + }, + Volume = { + Min = 0, + Max = 0.8, + Step = 0.02, + PCStep = 0.02 + }, + VoiceRecord = { + Min = 0, + Max = 65535, + Step = 655 + }, + VoiceThreshold = { + Min = 0, + Max = 65535, + Step = 655 + }, + FOV = { + Min = 65, + Max = 80, + Step = 1 + } +} +MousePitchTable = { + PitchFloat = 0.02 +} +PCOptionsMenuDimensions = { + Padding = 4, + Spacing = 2 +} +ActiveMenus = { + None = 0, + Main = 1, + InGame = 2, + PreGame = 3, + PostGame = 4 +} +CoD.SetMaterial = function ( f3_arg0, f3_arg1, f3_arg2, f3_arg3 ) + if f3_arg2 == nil then + f3_arg2 = 1 + end + if f3_arg3 == nil then + f3_arg3 = 0 + end + f3_arg0:registerAnimationState( "changeMaterial", { + material = f3_arg1, + alpha = f3_arg2 + } ) + f3_arg0:animateToState( "changeMaterial", f3_arg3 ) +end + +CoD.UsingController = function () + local f4_local0 = Engine.IsConsoleGame() + if not f4_local0 then + if Engine.IsConsoleGame() or Engine.IsGamepadEnabled() ~= 1 then + f4_local0 = false + else + f4_local0 = true + end + end + return f4_local0 +end + +CoD.MuteStrategies = { + MuteStrategyUnmute = 0, + MuteStrategyMuteAll = 1, + MuteStrategyMuteAllButParty = 2, + MuteStrategyMuteAllButFriends = 3 +} +CoD.WeaponListPrimary = { + iw6_cbjms = 1, + iw6_k7 = 1, + iw6_kriss = 1, + iw6_microtar = 1, + iw6_pdw = 1, + iw6_pdwauto = 1, + iw6_pp19 = 1, + iw6_vepr = 1, + iw6_ak12 = 1, + iw6_arx160 = 1, + iw6_bren = 1, + iw6_fads = 1, + iw6_honeybadger = 1, + iw6_msbs = 1, + iw6_r5rgp = 1, + iw6_sc2010 = 1, + iw6_gm6 = 1, + iw6_l115a3 = 1, + iw6_usr = 1, + iw6_vks = 1, + iw6_g28 = 1, + iw6_imbel = 1, + iw6_mk14 = 1, + iw6_svu = 1, + iw6_fp6 = 1, + iw6_maul = 1, + iw6_mts255 = 1, + iw6_uts15 = 1, + iw6_ameli = 1, + iw6_kac = 1, + iw6_lsat = 1, + iw6_m27 = 1, + iw6_minigun = 1, + iw6_dlcweap01 = 1, + iw6_dlcweap02 = 1, + iw6_dlcweap03 = 1, + iw6_maaws = 1, + iw6_minigunjugg = 1, + iw6_gm6helisnipe = 1, + iw6_mariachimagnum = 1, + venomxgun = 1 +} +CoD.WeaponListSecondary = { + iw6_m9a1 = 1, + iw6_magnum = 1, + iw6_mp443 = 1, + iw6_p226 = 1, + iw6_mk32 = 1, + iw6_panzerfaust3 = 1, + iw6_rgm = 1, + iw6_magnumjugg = 1, + iw6_p226jugg = 1, + iw6_magnumhorde = 1, + iw6_mk32horde = 1 +} +CoD.remoteKillstreakWeaponTable = { + killstreak_ac130_mp = true, + ac130_105mm_mp = true, + ac130_40mm_mp = true, + ac130_25mm_mp = true, + killstreak_remote_tank_laptop_mp = true, + killstreak_remote_tank_remote_mp = true, + killstreak_helicopter_minigun_mp = true, + killstreak_predator_missile_mp = true, + heli_remote_mp = true, + killstreak_remote_turret_remote_mp = true, + killstreak_remote_turret_laptop_mp = true, + mortar_remote_mp = true, + mortar_remote_zoom_mp = true, + uav_remote_mp = true, + killstreak_precision_airstrike_mp = true, + killstreak_heli_pilot_mp = true, + killstreak_odin_support_mp = true, + killstreak_odin_assault_mp = true, + killstreak_level_event_laptop_mp = true, + killstreak_vanguard_mp = true +} +CoD.UsingKillstreakRemote = function () + return CoD.remoteKillstreakWeaponTable[Game.GetPlayerWeaponName()] +end + +CoD.UsingOdinOrLoki = function () + local f6_local0 = Game.GetPlayerWeaponName() + local f6_local1 = false + if f6_local0 == "killstreak_odin_support_mp" or f6_local0 == "killstreak_odin_assault_mp" then + f6_local1 = true + end + return f6_local1 +end + +CoD.IsFireTeamMode = function () + return Lobby.GetBotsConnectType() == 2 +end + +CoD.ColorizeState = function ( f8_arg0, f8_arg1 ) + if not f8_arg1 then + f8_arg1 = {} + end + if not f8_arg0 then + DebugPrint( "Warning: Calling CoD.ColorizeState without specifying a color" ) + return f8_arg1 + end + f8_arg1.red = f8_arg0.r + f8_arg1.green = f8_arg0.g + f8_arg1.blue = f8_arg0.b + local f8_local0 = f8_arg0.a + if not f8_local0 then + f8_local0 = f8_arg1.alpha or 1 + end + f8_arg1.alpha = f8_local0 + return f8_arg1 +end + +CoD.PrintModuleLoad = function ( f9_arg0 ) + +end + +CoD.StatsGroup = { + Ranked = 0, + Private = 1, + Coop = 2, + Common = 3 +} +CoD.GetStatsGroupForGameMode = function () + return Engine.GetStatsGroupForGameMode() +end + +CoD.GetStatsGroupForSquadLocation = function ( f11_arg0 ) + local f11_local0 = CoD.GetStatsGroupForGameMode() + if f11_arg0 == "squadMembers" then + f11_local0 = CoD.StatsGroup.Ranked + elseif f11_arg0 == "privateMatchSquadMembers" then + f11_local0 = CoD.StatsGroup.Private + end + return f11_local0 +end + +if f0_local0 then + f0_local2 = profile.beginuserevent + f0_local3 = profile.enduserevent + profile.beginuserevent = function ( f12_arg0 ) + if type( f12_arg0 ) ~= "number" then + f12_arg0 = profile.lookupusereventid( f12_arg0 ) or profile.createuserevent( f12_arg0, "duration" ) + end + f0_local2( f12_arg0 ) + return f12_arg0 + end + + profile.enduserevent = function ( f13_arg0 ) + if type( f13_arg0 ) ~= "number" then + f13_arg0 = profile.lookupusereventid( f13_arg0 ) + end + f0_local3( f13_arg0 ) + end + +else + profile.beginuserevent = function () + + end + + profile.enduserevent = function () + + end + + profile.createuserevent = function () + + end + + profile.lookupusereventid = function () + + end + +end +if f0_local1 then + function run_gc( f18_arg0 ) + local f18_local0 + if f18_arg0 then + f18_local0 = " (" .. f18_arg0 .. ")" + if not f18_local0 then + + else + local f18_local1 = collectgarbage( "count" ) + collectgarbage( "collect" ) + local f18_local2 = collectgarbage( "count" ) + DebugPrint( "LUI - Ran GC cycle, cleared " .. f18_local1 - f18_local2 .. "kb. " .. f18_local2 .. "kb remaining." .. f18_local0 ) + end + end + f18_local0 = "" + end + +else + function run_gc() + collectgarbage( "collect" ) + end + +end +function hashset( f20_arg0 ) + local f20_local0 = {} + for f20_local4, f20_local5 in pairs( f20_arg0 ) do + f20_local0[f20_local5] = true + end + return f20_local0 +end + +function bit( f21_arg0 ) + return 2 ^ (f21_arg0 - 1) +end + +function hasbit( f22_arg0, f22_arg1 ) + return f22_arg1 <= f22_arg0 % (f22_arg1 + f22_arg1) +end + +function setbit( f23_arg0, f23_arg1 ) + if hasbit( f23_arg0, f23_arg1 ) then + local f23_local0 = f23_arg0 + end + return f23_local0 or f23_arg0 + f23_arg1 +end + +function clearbit( f24_arg0, f24_arg1 ) + return hasbit( f24_arg0, f24_arg1 ) and f24_arg0 - f24_arg1 or f24_arg0 +end + +function IsCurrentSticksLayoutSouthpaw() + return Engine.GetProfileData( "gpadSticksConfig" ) == "thumbstick_southpaw" +end + +function IsCurrentSticksLayoutLegacy() + return Engine.GetProfileData( "gpadSticksConfig" ) == "thumbstick_legacy" +end + +function IsCurrentSticksLayoutLegacySouthpaw() + return Engine.GetProfileData( "gpadSticksConfig" ) == "thumbstick_legacysouthpaw" +end + +CoD.CreateState = function ( f28_arg0, f28_arg1, f28_arg2, f28_arg3, f28_arg4 ) + return { + left = f28_arg0, + top = f28_arg1, + right = f28_arg2, + bottom = f28_arg3, + leftAnchor = f28_arg4.leftAnchor, + topAnchor = f28_arg4.topAnchor, + rightAnchor = f28_arg4.rightAnchor, + bottomAnchor = f28_arg4.bottomAnchor + } +end + +CoD.GradientMap = function ( f29_arg0, f29_arg1 ) + assert( f29_arg0 and #f29_arg0 >= 2 ) + local f29_local0 = assert + local f29_local1 + if f29_arg0[1].threshold ~= 0 or f29_arg0[#f29_arg0].threshold ~= 1 then + f29_local1 = false + else + f29_local1 = true + end + f29_local0( f29_local1 ) + if f29_arg1 <= 0 then + return f29_arg0[1].color + elseif f29_arg1 >= 1 then + return f29_arg0[#f29_arg0].color + end + f29_local0 = f29_arg0[1] + f29_local1 = f29_arg0[1] + for f29_local6, f29_local7 in ipairs( f29_arg0 ) do + if f29_arg1 < f29_local7.threshold then + local f29_local5 = (f29_arg1 - f29_local0.threshold) / (f29_local7.threshold - f29_local0.threshold) + return { + r = f29_local5 * f29_local7.color.r + (1 - f29_local5) * f29_local0.color.r, + g = f29_local5 * f29_local7.color.g + (1 - f29_local5) * f29_local0.color.g, + b = f29_local5 * f29_local7.color.b + (1 - f29_local5) * f29_local0.color.b + } + end + f29_local0 = f29_local7 + end + return f29_arg0[#f29_arg0].color +end + +CoD.AnchorTypes = { + All = { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = true + }, + None = { + leftAnchor = false, + topAnchor = false, + rightAnchor = false, + bottomAnchor = false + }, + Top = { + leftAnchor = false, + topAnchor = true, + rightAnchor = false, + bottomAnchor = false + }, + TopLeft = { + leftAnchor = true, + topAnchor = true, + rightAnchor = false, + bottomAnchor = false + }, + TopRight = { + leftAnchor = false, + topAnchor = true, + rightAnchor = true, + bottomAnchor = false + }, + TopLeftRight = { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = false + }, + Bottom = { + leftAnchor = false, + topAnchor = false, + rightAnchor = false, + bottomAnchor = true + }, + BottomLeft = { + leftAnchor = true, + topAnchor = false, + rightAnchor = false, + bottomAnchor = true + }, + BottomRight = { + leftAnchor = false, + topAnchor = false, + rightAnchor = true, + bottomAnchor = true + }, + BottomLeftRight = { + leftAnchor = true, + topAnchor = false, + rightAnchor = true, + bottomAnchor = true + }, + TopBottomLeft = { + leftAnchor = true, + topAnchor = true, + rightAnchor = false, + bottomAnchor = true + }, + TopBottomRight = { + leftAnchor = false, + topAnchor = true, + rightAnchor = true, + bottomAnchor = true + }, + Left = { + leftAnchor = true, + topAnchor = false, + rightAnchor = false, + bottomAnchor = false + }, + Right = { + leftAnchor = false, + topAnchor = false, + rightAnchor = true, + bottomAnchor = false + }, + LeftRight = { + leftAnchor = true, + topAnchor = false, + rightAnchor = true, + bottomAnchor = false + } +} +CoD.FormatInfectedTime = function ( f30_arg0, f30_arg1 ) + local f30_local0 = Engine.Localize( "@LUA_MENU_S_FOR_SECONDS" ) + local f30_local1 = Engine.Localize( "@LUA_MENU_M_FOR_MINUTES" ) + local f30_local2 = math.floor( f30_arg0 / 60 ) + local f30_local3 = "" + if not f30_arg1 then + if f30_local2 < 1 then + f30_local3 = f30_arg0 .. f30_local0 + else + f30_local3 = f30_local2 .. f30_local1 + if f30_local2 >= 16 then + f30_local3 = max_text + end + end + else + f30_arg0 = f30_arg0 - f30_local2 * 60 + if f30_arg0 >= 10 then + f30_local3 = f30_local2 .. ":" .. f30_arg0 + else + f30_local3 = f30_local2 .. ":0" .. f30_arg0 + end + end + return f30_local3 +end + +if Engine.UsingSplitscreenUpscaling() then + GenericMenuDims.menu_top = GenericMenuDims.menu_top - 10 + GenericMenuDims.menu_bottom = GenericMenuDims.menu_top + GenericButtonSettings.Styles.GradientButton.height * 6 +end +CoD.IsUsingAspectRatio = function ( f31_arg0 ) + return math.abs( f31_arg0 - Engine.GetAspectRatio() ) < 0.01 +end + +CoD.CoDAnywhere = { + COD_ANYWHERE_PLATFORM_TEXT_TYPE_LAST_PLAYED = 0, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_TIME_PLAYED = 1, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER1 = 2, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER2 = 3, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER3 = 4, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER4 = 5, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER5 = 6, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER6 = 7, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER7 = 8, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER8 = 9, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER9 = 10, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER10 = 11, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK1 = 12, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK2 = 13, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK3 = 14, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK4 = 15, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK5 = 16, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK6 = 17, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK7 = 18, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK8 = 19, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK9 = 20, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_SQUAD_MEMBER_RANK10 = 21, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_TOKENS_EARNED = 22, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_TOKENS_AVAILABLE = 23, + COD_ANYWHERE_PLATFORM_TEXT_TYPE_PLATFORM_NAME = 24 +} diff --git a/lui/codedependence.dec.lua b/lui/codedependence.dec.lua new file mode 100644 index 0000000..8061a30 --- /dev/null +++ b/lui/codedependence.dec.lua @@ -0,0 +1,587 @@ +function ModuleInaccessible( f1_arg0 ) + assert( not _G[f1_arg0] ) + _G[f1_arg0] = setmetatable( {}, { + __index = function ( f2_arg0, f2_arg1 ) + return function () + assert( false, "Functions from the " .. f1_arg0 .. " module are not allowed to be called from this scope." ) + end + + end + } ) +end + +if Engine then + Engine.UsingSplitscreenUpscaling = Engine.UsingSplitscreenUpscaling or function () + return false + end + + Engine.IsNetworkConnected = Engine.IsNetworkConnected or function () + return true + end + + Engine.HasAcceptedInvite = Engine.HasAcceptedInvite or function () + return false + end + + Engine.SetAndEnableCustomClanTag = Engine.SetAndEnableCustomClanTag or function () + + end + + Engine.CanViewClanTags = Engine.CanViewClanTags or function () + return true + end + + Engine.AllowOnline = Engine.AllowOnline or function () + return true + end + + Engine.IsSpecialRegion = Engine.IsSpecialRegion or function () + return false + end + + Engine.HasSnapshot = Engine.HasSnapshot or function () + return true + end + + Engine.APEXTurbulenceAvailable = Engine.APEXTurbulenceAvailable or function () + return false + end + + Engine.FurShaderAvailable = Engine.FurShaderAvailable or function () + return false + end + + Engine.HBAOAvailable = Engine.HBAOAvailable or function () + return false + end + + Engine.NVidiaGPUAvailable = Engine.NVidiaGPUAvailable or function () + return false + end + + local f0_local0 = Engine + local f0_local1 = Engine.TXAAAvailable + if not f0_local1 then + f0_local1 = Engine.NVidiaGPUAvailable + end + f0_local0.TXAAAvailable = f0_local1 + Engine.CanVidRestart = Engine.CanVidRestart or function () + return false + end + + Engine.FormatTimeHoursMinutesSeconds = Engine.FormatTimeHoursMinutesSeconds or function () + return "" + end + + Engine.UserIsGuest = Engine.UserIsGuest or function () + return false + end + + Engine.ClearCustomClanTag = Engine.ClearCustomClanTag or function () + + end + + Engine.GetCurrentDayMonthYear = Engine.GetCurrentDayMonthYear or function () + return 1, 1, 2100 + end + + Engine.GetCurrentYear = Engine.GetCurrentYear or function () + return 2100 + end + + Engine.UserCanAccessFriendsList = Engine.UserCanAccessFriendsList or function () + return false + end + + Engine.AnyoneHasSeasonPass = Engine.AnyoneHasSeasonPass or function () + return false + end + + Engine.AnyoneHasAliensDLC = Engine.AnyoneHasAliensDLC or function () + return false + end + + Engine.AnyoneHasAliensDLC1 = Engine.AnyoneHasAliensDLC1 or function () + return false + end + + Engine.AnyoneHasAliensDLC2 = Engine.AnyoneHasAliensDLC2 or function () + return false + end + + Engine.AnyoneHasAliensDLC3 = Engine.AnyoneHasAliensDLC3 or function () + return false + end + + Engine.AnyoneHasAliensDLC4 = Engine.AnyoneHasAliensDLC4 or function () + return false + end + + Engine.IsXenonDevTitle = Engine.IsXenonDevTitle or function () + return false + end + + Engine.GetRawMonthDayYear = Engine.GetRawMonthDayYear or function () + return nil + end + + Engine.GetClanTag = Engine.GetClanTag or function () + return "" + end + + Engine.LocalClientProfileCanSave = Engine.LocalClientProfileCanSave or function () + return true + end + + Engine.IsProfanity = Engine.IsProfanity or function () + return false + end + + Engine.GetAspectRatio = Engine.GetAspectRatio or function () + return 1.78 + end + + Engine.IsChatRestricted = Engine.IsChatRestricted or function () + return false + end + + Engine.UserCanAccessStore = Engine.UserCanAccessStore or function () + return false + end + + Engine.ShowXB3GoldUpsell = Engine.ShowXB3GoldUpsell or function () + return false + end + + Engine.ShowLowTextureResolutionWarning = Engine.ShowLowTextureResolutionWarning or function () + return false + end + + Engine.IsPC = Engine.IsPC or function () + return false + end + + Engine.ClearUnlockData = Engine.ClearUnlockData or function () + return false + end + + Engine.GetControllerForLocalClient = Engine.GetControllerForLocalClient or function () + return 0 + end + + Engine.PartyEveryoneHasMap = Engine.PartyEveryoneHasMap or function () + return true + end + + Engine.IsActiveLocalClientPrimary = Engine.IsActiveLocalClientPrimary or function () + return true + end + + Engine.PLMRefreshData = Engine.PLMRefreshData or function () + + end + + Engine.HasSaveDevice = Engine.HasSaveDevice or function () + return true + end + + Engine.AnyoneHasSpecificDLCPack = Engine.AnyoneHasSpecificDLCPack or function () + return true + end + + Engine.VoteForDLCItem = Engine.VoteForDLCItem or function () + + end + + Engine.GetVoteItemText = Engine.GetVoteItemText or function () + return "" + end + + Engine.GetVoteItemFileID = Engine.GetVoteItemFileID or function () + return -1 + end + + Engine.GetActiveVotes = Engine.GetActiveVotes or function () + return 0 + end + + Engine.GetNumberOfImagesForVote = Engine.GetNumberOfImagesForVote or function () + return 0 + end + + Engine.StartVoteImageDownload = Engine.StartVoteImageDownload or function () + + end + + Engine.IsVoteImageDownloaded = Engine.IsVoteImageDownloaded or function () + return false + end + + Engine.GetVoteImageHandle = Engine.GetVoteImageHandle or function () + return RegisterMaterial( "white" ) + end + + Engine.GetVotingID = Engine.GetVotingID or function () + return -1 + end + + Engine.GetPlayerDataReservedShort = Engine.GetPlayerDataReservedShort or function () + + end + + Engine.SetPlayerDataReservedShort = Engine.SetPlayerDataReservedShort or function () + + end + + Engine.GetVotingHeader = Engine.GetVotingHeader or function () + return "" + end + + Engine.HasPlayerData = Engine.HasPlayerData or function () + return true + end + + Engine.IsAnnouncerReleased = Engine.IsAnnouncerReleased or function () + return true + end + + Engine.IsAnnouncerUnlocked = Engine.IsAnnouncerUnlocked or function () + return true + end + + Engine.AnyoneHasBadReputation = Engine.AnyoneHasBadReputation or function () + return false + end + +end +if Game then + if not Engine.IsConsoleGame() then + local f0_local0 = Game.GetNumPlayersOnTeam + Game.GetNumPlayersOnTeam = function ( f63_arg0 ) + if Engine.GetDvarBool( "onlinegame" ) or Engine.GetDvarBool( "systemlink" ) then + return f0_local0( f63_arg0 ) + else + return 0 + end + end + + end + Game.IsKillCamEntityActive = Game.IsKillCamEntityActive or function () + return false + end + + Game.IsSpectatorCameraActive = Game.IsSpectatorCameraActive or function () + return false + end + + Game.StartBlur = Game.StartBlur or function () + + end + + Game.GetLastMLGSpectateTeam = Game.GetLastMLGSpectateTeam or function () + return Teams.allies + end + +else + ModuleInaccessible( "Game" ) +end +if Store then + Store.RequestContentServerImages = Store.RequestContentServerImages or function () + + end + + Store.GetCategoryForDLCName = Store.GetCategoryForDLCName or function () + return 0 + end + + Store.ShowSystemOffer = Store.ShowSystemOffer or function () + + end + +else + ModuleInaccessible( "Store" ) +end +if Friends then + Friends.HasPartyGameInvite = Friends.HasPartyGameInvite or function () + return false + end + + Friends.AcceptLivePartyInvitation = Friends.AcceptLivePartyInvitation or function () + + end + + Friends.CanShowFriendGamercard = Friends.CanShowFriendGamercard or function () + return true + end + + Friends.GetEliteClanFriendMemberStatus = Friends.GetEliteClanFriendMemberStatus or function ( f74_arg0, f74_arg1 ) + return "" + end + +else + ModuleInaccessible( "Friends" ) +end +if Squad then + Squad.PostMatch = Squad.PostMatch or function () + return "" + end + + Squad.GetHostSquadName = Squad.GetHostSquadName or function () + return "" + end + + Squad.UpdateReportPlayerCardCache = Squad.UpdateReportPlayerCardCache or function () + return "" + end + + Squad.GetReportPlayercard = Squad.GetReportPlayercard or function () + + end + + Squad.GetClanTagForReport = Squad.GetClanTagForReport or function () + return "" + end + + Squad.GetCompareInfoForLobby = Squad.GetCompareInfoForLobby or function () + return {} + end + + Squad.SetMinPlayersToHumanMax = Squad.SetMinPlayersToHumanMax or function () + + end + + Squad.GetSquadModePlaylist = Squad.GetSquadModePlaylist or function ( f82_arg0, f82_arg1 ) + if f82_arg1 == 1 then + return 5, 0 + elseif f82_arg1 == 2 then + return 5, 4 + elseif f82_arg1 == 3 then + return 5, 1 + elseif f82_arg1 == 4 then + return 5, 2 + elseif f82_arg1 == 5 then + return 5, 3 + elseif f82_arg1 == 6 then + return 5, 5 + else + return -1, -1 + end + end + +else + ModuleInaccessible( "Squad" ) +end +if Leaderboards then + Leaderboards.GetPlayerValue = Leaderboards.GetPlayerValue or function ( f83_arg0, f83_arg1 ) + return "" + end + + Leaderboards.GetValue = Leaderboards.GetValue or function ( f84_arg0, f84_arg1, f84_arg2 ) + return "" + end + + Leaderboards.GetOffset = Leaderboards.GetOffset or function ( f85_arg0 ) + return 0 + end + + Leaderboards.GetCurrentIndex = Leaderboards.GetCurrentIndex or function ( f86_arg0 ) + return 0 + end + + Leaderboards.UpdateLeaderboard = Leaderboards.UpdateLeaderboard or function ( f87_arg0, f87_arg1 ) + + end + + Leaderboards.UpdateCurrentIndex = Leaderboards.UpdateCurrentIndex or function ( f88_arg0, f88_arg1 ) + + end + + Leaderboards.OnSelect = Leaderboards.OnSelect or function ( f89_arg0 ) + + end + +else + ModuleInaccessible( "Leaderboards" ) +end +if Lobby then + Lobby.ShowMemberInfo = Lobby.ShowMemberInfo or function ( f90_arg0, f90_arg1, f90_arg2 ) + return true + end + + Lobby.UnsetAllMLGSpectators = Lobby.UnsetAllMLGSpectators or function () + + end + + Lobby.GetMemberWeaponSetup = Lobby.GetMemberWeaponSetup or function () + return {} + end + + Lobby.GetPartyPrivacy = Lobby.GetPartyPrivacy or function () + return -1 + end + + Lobby.SetPartyPrivacy = Lobby.SetPartyPrivacy or function () + + end + + Lobby.GetPlayerLimit = Lobby.GetPlayerLimit or function () + return -1 + end + + Lobby.SetPlayerLimit = Lobby.SetPlayerLimit or function () + + end + + Lobby.SetUsingMLGRules = Lobby.SetUsingMLGRules or function () + + end + + Lobby.IsUsingMLGRules = Lobby.IsUsingMLGRules or function () + return false + end + + Lobby.EnteringLobby = Lobby.EnteringLobby or function () + return false + end + + Lobby.EnteredLobby = Lobby.EnteredLobby or function () + + end + + Lobby.HowManyPlayersCanWeHost = Lobby.HowManyPlayersCanWeHost or function () + return 12 + end + + Lobby.IsUsingSecondScreen = Lobby.IsUsingSecondScreen or function () + return false + end + + Lobby.IsAlone = Lobby.IsAlone or function () + return false + end + + Lobby.IsChaosEnabled = Lobby.IsChaosEnabled or function () + return false + end + + Lobby.SetChaosEnabled = Lobby.SetChaosEnabled or function () + + end + + Lobby.SetExtinctionDifficulty = Lobby.SetExtinctionDifficulty or function () + + end + + Lobby.GetExtinctionDifficulty = Lobby.GetExtinctionDifficulty or function () + return 2 + end + +else + ModuleInaccessible( "Lobby" ) +end +if LobbyMember then + LobbyMember.SelectedMember_SetLocalMemberMLGSpectator = LobbyMember.SelectedMember_SetLocalMemberMLGSpectator or function () + + end + +end +Clan = Clan or {} +Clan.IsEnabled = Clan.IsEnabled or function () + return false +end + +Clan.IsDownloadingData = Clan.IsDownloadingData or function () + return false +end + +Clan.GetDCXPTime = Clan.GetDCXPTime or function () + return 0 +end + +Clan.GetClanDivision = Clan.GetClanDivision or function () + return 0 +end + +CoDAnywhere = CoDAnywhere or {} +CoDAnywhere.HasUCDSaveGame = CoDAnywhere.HasUCDSaveGame or function () + return false +end + +CoDAnywhere.ServiceAvailable = CoDAnywhere.ServiceAvailable or function () + return true +end + +if Playlist then + Playlist.GetCanShowItem = Playlist.GetCanShowItem or function () + return true + end + + Playlist.GetItemMaxParty = Playlist.GetItemMaxParty or function () + return 12 + end + + Playlist.WillCXPBeAwarded = Playlist.WillCXPBeAwarded or function () + return false + end + + Playlist.GetItemVideo = Playlist.GetItemVideo or function () + return "" + end + +else + ModuleInaccessible( "Playlist" ) +end +if CharacterScene then + +else + ModuleInaccessible( "CharacterScene" ) +end +MLG = MLG or {} +MLG.GetFollowedClientNum = MLG.GetFollowedClientNum or function () + +end + +MLG.HighlightClientNum = MLG.HighlightClientNum or function () + +end + +MLG.TogglePlayerOutlines = MLG.TogglePlayerOutlines or function () + +end + +Customization = Customization or {} +Customization.GetCompleteHeadModelName = Customization.GetCompleteHeadModelName or function ( f122_arg0, f122_arg1 ) + local f122_local0 = Engine.TableLookup( "mp/cac/heads.csv", 0, f122_arg0, 1 ) + local f122_local1 = "" + if f122_arg1 then + f122_local1 = Engine.TableLookup( "mp/cac/helmets.csv", 0, f122_arg1, 1 ) + end + return f122_local0 .. f122_local1 +end + +MatchRules = MatchRules or {} +MatchRules.SelectSaveDevice = MatchRules.SelectSaveDevice or function () + +end + +MatchRules.HasSelectedSaveDevice = MatchRules.HasSaveDevice or function () + return true +end + +SocialFeed = SocialFeed or {} +SocialFeed.GetNewsItemID = SocialFeed.GetNewsItemID or function () + return "" +end + +SocialFeed.HasIOTD = SocialFeed.HasIOTD or function () + return true +end + +SocialFeed.DowloadIOTD = SocialFeed.DowloadIOTD or function () + +end + +SocialFeed.SetNewsArticleImageJPEG = SocialFeed.SetNewsArticleImageJPEG or function () + +end + diff --git a/lui/common_menus/caccustomizeutils.dec.lua b/lui/common_menus/caccustomizeutils.dec.lua new file mode 100644 index 0000000..8d29e8b --- /dev/null +++ b/lui/common_menus/caccustomizeutils.dec.lua @@ -0,0 +1,1314 @@ +Cac = Cac or {} +CharacterCameraPresets = { + Lobby = { + Position = { + -25, + 0, + 156 + }, + Rotation = { + 0, + 0, + 0 + } + }, + CharSelectMenu = { + Position = { + -25, + 3, + 90 + }, + Rotation = { + 0, + 0, + 0 + } + }, + LoadoutMenu = { + Position = { + -25, + 0, + 156 + }, + Rotation = { + 0, + 0, + 0 + } + }, + MemberSelect = { + Position = { + -25, + 0, + 156 + }, + Rotation = { + 0, + 0, + 0 + } + }, + CustomizeMenu = { + Default = { + Position = { + -25, + 0, + 156 + }, + Rotation = { + 0, + 0, + 0 + } + }, + Head = { + Position = { + 0, + 0, + 60 + }, + Rotation = { + 0, + 0, + 0 + } + }, + Helmet = { + Position = { + 0, + 0, + -60 + }, + Rotation = { + 0, + 0, + 0 + } + }, + Patch = { + Position = { + 0, + 0, + 0 + }, + Rotation = { + 0, + 0, + 0 + } + } + }, + ClanDetails = { + Left = { + Position = { + -66, + 0, + 180 + }, + Rotation = { + 0, + 0, + 0 + } + }, + Center = { + Position = { + -19, + 0, + 180 + }, + Rotation = { + 0, + 0, + 0 + } + }, + Right = { + Position = { + 28, + 0, + 180 + }, + Rotation = { + 0, + 0, + 0 + } + } + } +} +local f0_local0 = Cac +local f0_local1 = { + Animations = { + default = "mp_menu_male_idle", + idles = { + normal = { + "mp_menu_male_idle", + "mp_menu_male_twitch_A", + "mp_menu_male_twitch_B" + }, + riotshield = { + "mp_menu_shield_idle", + "mp_menu_shield_twitch_A", + "mp_menu_shield_twitch_B" + }, + knifeonly = { + "jug_maniac_idle", + "jug_maniac_twitchA", + "jug_maniac_twitchB", + "jug_maniac_twitchC" + }, + pistol = { + "mp_alien_menu_male_idle", + "mp_alien_menu_male_twitch_A", + "mp_alien_menu_male_twitch_B" + } + }, + weapon_grabs = { + normal_1 = { + "mp_menu_male_grab_gun_1_A", + "mp_menu_male_grab_gun_2_A" + }, + normal_2 = { + "mp_menu_male_grab_gun_1_B", + "mp_menu_male_grab_gun_2_B" + }, + riotshield = { + "mp_menu_grab_shield_1_A", + "mp_menu_grab_shield_2_A" + }, + knifeonly = { + "mp_menu_male_grab_knife_1_A", + "mp_menu_male_grab_knife_2_A" + }, + pistol = {} + } + }, + FieldIndexes = { + Head = 1, + Helmet = 2, + Body = 3, + Patch = 4, + Patchbacking = 5, + Background = 6, + ClanTag = 7, + GuardDog = 8, + Announcer = 9 + }, + Gender = { + Male = "m", + Female = "f", + Special = "b" + } +} +local f0_local2 = {} +local f0_local3 = { + csv = "mp/cac/heads.csv", + LocName = "HEAD", + UnlockType = "Head", + PublicOnly = false, + ImpactsPlayercard = false, + SaveRef = function ( f1_arg0, f1_arg1, f1_arg2, f1_arg3 ) + local f1_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet] + local f1_local1 = Cac.IsCommonGender( Cac.GetGenderFromHeadRef( f1_arg3 ) ) + if f1_local1 then + f1_local1 = not Cac.IsCommonGender( Cac.GetCurrentGender( f1_arg0, f1_arg1, f1_arg2 ) ) + end + if f1_local1 then + Cac.SetBodyIndex( f1_arg0, f1_arg1, f1_arg2, Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body].GetDefaultRef( f1_arg0, Cac.GetGenderFromHeadRef( f1_arg3 ) ) ) + end + Cac.SetHeadIndex( f1_arg0, f1_arg1, f1_arg2, f1_arg3 ) + if not Cac.DoesHeadUseHelmet( f1_arg3 ) then + f1_local0.SaveRef( f1_arg0, f1_arg1, f1_arg2, f1_local0.NoneRef ) + end + end, + GetSavedRef = function ( f2_arg0, f2_arg1, f2_arg2 ) + return Cac.GetHeadIndex( f2_arg0, f2_arg1, f2_arg2 ) + end, + GetSavedModel = function ( f3_arg0, f3_arg1, f3_arg2 ) + local f3_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + return f3_local0.MakeModelName( f3_local0.GetSavedRef( f3_arg0, f3_arg1, f3_arg2 ), Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet].GetSavedRef( f3_arg0, f3_arg1, f3_arg2 ) ) + end, + SelectionPopup = "cac_customize_buttons_popup" +} +local f0_local4 = package.loaded["LUI.mp_menus.CacCustomize"] +if f0_local4 then + f0_local4 = LUI.mp_menus.CacCustomize.CustomizePopupGridGenericButton +end +f0_local3.SelectionButtonFactory = f0_local4 +f0_local3.GetName = function ( f4_arg0 ) + return Engine.TableLookup( "mp/cac/heads.csv", 0, f4_arg0, 2 ) +end + +f0_local3.PreviewFunction = function ( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, f5_arg5 ) + local f5_local0 = {} + local f5_local1 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body] + local f5_local2 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + local f5_local3 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet] + local f5_local4 = f5_local3.GetSavedRef( f5_arg0, Cac.GetSquadLoc(), f5_arg4 ) + if not Cac.DoesHeadUseHelmet( f5_arg3 ) or not f5_local4 then + f5_local4 = f5_local3.NoneRef + end + local f5_local5 = f5_local2.MakeModelName( f5_arg3, f5_local4, f5_arg5 ) + if Cac.GetGenderFromBodyRef( f5_local1.GetSavedRef( f5_arg0, Cac.GetSquadLoc(), f5_arg4 ) ) ~= Cac.GetGenderFromHeadRef( f5_arg3 ) then + local f5_local6 = f5_local1.GetDefaultRef( f5_arg0, Cac.GetGenderFromHeadRef( f5_arg3 ) ) + CharacterScene.ChangeBody( f5_arg2, f5_local1.MakeModelName( f5_local6, f5_arg5 ), Cac.GetPatchIndex( f5_arg0, Cac.GetSquadLoc(), f5_arg4 ) ) + f5_local0[f5_local1] = f5_local6 + end + CharacterScene.ChangeHead( f5_arg2, f5_local5 ) + f5_local0[f5_local3] = f5_local4 + f5_local0[f5_local2] = f5_arg3 + return f5_local0 +end + +f0_local3.MakeModelName = function ( f6_arg0, f6_arg1, f6_arg2 ) + local f6_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet] + if not f6_arg2 then + f6_arg2 = Cac.GetDefaultBodyCamoRef() + end + if not f6_arg1 then + f6_arg1 = f6_local0.NoneRef + end + return Customization.GetCompleteHeadModelName( f6_arg0, f6_arg1, Cac.GetHeadCamoSuffix( f6_arg2 ) ) +end + +f0_local3.CustomizeCamera = CharacterCameraPresets.CustomizeMenu.Head +f0_local3.GetUIMaterial = function ( f7_arg0 ) + return "icon_aar_head" +end + +f0_local3.GenderColumn = 3 +f0_local3.UseHelmetColumn = 4 +f0_local3.IsEntitlementColumn = 5 +f0_local3.HideUnlessUnlockedColumn = 6 +f0_local3.CustomUnlockText = 7 +f0_local3.DLCOffer = 9 +f0_local3.ReleaseKillswitch = 10 +f0_local3.SecondaryEntitlementColumn = 11 +f0_local3.GetDefaultRef = function ( f8_arg0, f8_arg1 ) + local f8_local0 = Cac.Customization.GetElementRefsForField( f8_arg0, Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head], f8_arg1 ) + assert( #f8_local0 > 0 ) + return f8_local0[1] +end + +f0_local4 = { + csv = "mp/cac/helmets.csv", + LocName = "HELMET", + UnlockType = "Helmet", + PublicOnly = false, + ImpactsPlayercard = false, + NoneRef = 0, + SaveRef = function ( f9_arg0, f9_arg1, f9_arg2, f9_arg3 ) + local f9_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet] + local f9_local1 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + local f9_local2 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body] + if not Cac.IsCommonGender( Cac.GetCurrentGender( f9_arg0, f9_arg1, f9_arg2 ) ) then + Cac.SetBodyIndex( f9_arg0, f9_arg1, f9_arg2, f9_local2.GetDefaultRef( f9_arg0, Cac.Customization.Gender.Male ) ) + Cac.SetHeadIndex( f9_arg0, f9_arg1, f9_arg2, f9_local1.GetDefaultRef( f9_arg0, Cac.Customization.Gender.Male ) ) + end + Cac.SetHelmetIndex( f9_arg0, f9_arg1, f9_arg2, f9_arg3 ) + if not Cac.DoesHeadUseHelmet( f9_local1.GetSavedRef( f9_arg0, f9_arg1, f9_arg2 ) ) and f9_arg3 ~= f9_local0.NoneRef then + f9_local1.SaveRef( f9_arg0, f9_arg1, f9_arg2, f9_local1.GetDefaultRef( f9_arg0, Cac.GetCurrentGender( f9_arg0, f9_arg1, f9_arg2 ) ) ) + end + end, + GetSavedRef = function ( f10_arg0, f10_arg1, f10_arg2 ) + return Cac.GetHelmetIndex( f10_arg0, f10_arg1, f10_arg2 ) + end, + SelectionPopup = "cac_customize_buttons_popup" +} +local f0_local5 = package.loaded["LUI.mp_menus.CacCustomize"] +if f0_local5 then + f0_local5 = LUI.mp_menus.CacCustomize.CustomizePopupGridGenericButton +end +f0_local4.SelectionButtonFactory = f0_local5 +f0_local4.GetName = function ( f11_arg0 ) + return Engine.TableLookup( "mp/cac/helmets.csv", 0, f11_arg0, 2 ) +end + +f0_local4.PreviewFunction = function ( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4, f12_arg5 ) + local f12_local0 = {} + local f12_local1 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body] + local f12_local2 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + local f12_local3 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet] + local f12_local4 = Cac.GetHeadIndex( f12_arg0, Cac.GetSquadLoc(), f12_arg4 or Cac.GetEditSquadMember( f12_arg0 ) ) + if not Cac.IsCommonGender( Cac.GetGenderFromBodyRef( f12_local1.GetSavedRef( f12_arg0, Cac.GetSquadLoc(), f12_arg4 ) ) ) and f12_arg3 ~= f12_local3.NoneRef then + local f12_local5 = f12_local1.GetDefaultRef( f12_arg0, Cac.Customization.Gender.Male ) + CharacterScene.ChangeBody( f12_arg2, f12_local1.MakeModelName( f12_local5, f12_arg5 ), Cac.GetPatchIndex( f12_arg0, Cac.GetSquadLoc(), f12_arg4 ) ) + f12_local0[f12_local1] = f12_local5 + end + if f12_arg3 ~= f12_local3.NoneRef and not Cac.DoesHeadUseHelmet( f12_local4 ) then + local f12_local5 = Cac.GetCurrentGender( f12_arg0, Cac.GetSquadLoc(), f12_arg4 ) + if not Cac.IsCommonGender( f12_local5 ) then + f12_local5 = Cac.Customization.Gender.Male + end + f12_local4 = f12_local2.GetDefaultRef( f12_arg0, f12_local5 ) + end + CharacterScene.ChangeHead( f12_arg2, Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head].MakeModelName( f12_local4, f12_arg3, f12_arg5 ) ) + f12_local0[f12_local3] = f12_arg3 + f12_local0[f12_local2] = f12_local4 + return f12_local0 +end + +f0_local4.CustomizeCamera = CharacterCameraPresets.CustomizeMenu.Helmet +f0_local4.GetUIMaterial = function ( f13_arg0 ) + return "icon_aar_helmet" +end + +f0_local4.IsEntitlementColumn = 4 +f0_local4.HideUnlessUnlockedColumn = 5 +f0_local4.CustomUnlockText = 6 +f0_local4.DLCOffer = 8 +f0_local4.ReleaseKillswitch = 9 +f0_local4.GetDefaultRef = function ( f14_arg0, f14_arg1 ) + local f14_local0 = Cac.Customization.GetElementRefsForField( f14_arg0, Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet], f14_arg1 ) + assert( #f14_local0 > 0 ) + return f14_local0[1] +end + +f0_local5 = { + csv = "mp/cac/bodies.csv", + LocName = "BODY", + UnlockType = "Body", + PublicOnly = false, + ImpactsPlayercard = false, + SaveRef = function ( f15_arg0, f15_arg1, f15_arg2, f15_arg3 ) + local f15_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + local f15_local1 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet] + Cac.SetBodyIndex( f15_arg0, f15_arg1, f15_arg2, f15_arg3 ) + local f15_local2 = Cac.GetGenderFromBodyRef( f15_arg3 ) + if f15_local2 == Cac.Customization.Gender.Special then + Cac.SetHelmetIndex( f15_arg0, f15_arg1, f15_arg2, f15_local1.NoneRef ) + Cac.SetHeadIndex( f15_arg0, f15_arg1, f15_arg2, f15_local0.GetDefaultRef( f15_arg0, f15_local2 ) ) + elseif not Cac.IsCommonGender( f15_local2 ) then + local f15_local3 = f15_local0.GetDefaultRef( f15_arg0, f15_local2 ) + Cac.SetHelmetIndex( f15_arg0, f15_arg1, f15_arg2, f15_local1.NoneRef ) + Cac.SetHeadIndex( f15_arg0, f15_arg1, f15_arg2, f15_local3 ) + elseif not Cac.IsCommonGender( Cac.GetGenderFromHeadRef( f15_local0.GetSavedRef( f15_arg0, f15_arg1, f15_arg2 ) ) ) then + Cac.SetHeadIndex( f15_arg0, f15_arg1, f15_arg2, f15_local0.GetDefaultRef( f15_arg0, f15_local2 ) ) + end + end, + GetSavedRef = function ( f16_arg0, f16_arg1, f16_arg2 ) + return Cac.GetBodyIndex( f16_arg0, f16_arg1, f16_arg2 ) + end, + GetSavedModel = function ( f17_arg0, f17_arg1, f17_arg2 ) + local f17_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body] + return f17_local0.MakeModelName( f17_local0.GetSavedRef( f17_arg0, f17_arg1, f17_arg2 ) ) + end, + SelectionPopup = "cac_customize_buttons_popup" +} +local f0_local6 = package.loaded["LUI.mp_menus.CacCustomize"] +if f0_local6 then + f0_local6 = LUI.mp_menus.CacCustomize.CustomizePopupGridGenericButton +end +f0_local5.SelectionButtonFactory = f0_local6 +f0_local5.GetName = function ( f18_arg0 ) + return Engine.TableLookup( "mp/cac/bodies.csv", 0, f18_arg0, 2 ) +end + +f0_local5.PreviewFunction = function ( f19_arg0, f19_arg1, f19_arg2, f19_arg3, f19_arg4, f19_arg5 ) + local f19_local0 = {} + local f19_local1 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body] + local f19_local2 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + local f19_local3 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Helmet] + local f19_local4 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body].MakeModelName( f19_arg3, f19_arg5 ) + local f19_local5 = Cac.GetGenderFromBodyRef( f19_arg3 ) + local f19_local6 = Cac.GetSquadLoc() + CharacterScene.ChangeBody( f19_arg2, f19_local4, Cac.GetPatchIndex( f19_arg0, f19_local6, f19_arg4 ) ) + if Cac.IsCommonGender( f19_local5 ) then + if not Cac.IsCommonGender( Cac.GetGenderFromHeadRef( f19_local2.GetSavedRef( f19_arg0, f19_local6, f19_arg4 ) ) ) then + local f19_local7 = f19_local2.GetDefaultRef( f19_arg0, f19_local5 ) + CharacterScene.ChangeHead( f19_arg2, f19_local2.MakeModelName( f19_local7 ) ) + f19_local0[f19_local2] = f19_local7 + end + elseif f19_local5 == Cac.Customization.Gender.Special then + + else + local f19_local7 = f19_local2.GetDefaultRef( f19_arg0, f19_local5 ) + CharacterScene.ChangeHead( f19_arg2, f19_local2.MakeModelName( f19_local7 ) ) + f19_local0[f19_local3] = f19_local3.NoneRef + f19_local0[f19_local2] = f19_local7 + end + f19_local0[f19_local1] = f19_arg3 + return f19_local0 +end + +f0_local5.MakeModelName = function ( f20_arg0, f20_arg1 ) + if not f20_arg1 then + f20_arg1 = Cac.GetDefaultBodyCamoRef() + end + return Engine.TableLookup( "mp/cac/bodies.csv", 0, f20_arg0, 1 ) .. Cac.GetBodyCamoSuffix( f20_arg1 ) +end + +f0_local5.CustomizeCamera = CharacterCameraPresets.CustomizeMenu.Default +f0_local5.GetUIMaterial = function ( f21_arg0 ) + return "icon_aar_uniform" +end + +f0_local5.GenderColumn = 4 +f0_local5.IsEntitlementColumn = 6 +f0_local5.HideUnlessUnlockedColumn = 7 +f0_local5.CustomUnlockText = 8 +f0_local5.DLCOffer = 10 +f0_local5.ReleaseKillswitch = 11 +f0_local5.GetDefaultRef = function ( f22_arg0, f22_arg1 ) + local f22_local0 = Cac.Customization.GetElementRefsForField( f22_arg0, Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body], f22_arg1 ) + assert( #f22_local0 > 0 ) + return f22_local0[1] +end + +f0_local6 = { + csv = "mp/cac/patches.csv", + LocName = "PATCH", + UnlockType = "Patch", + PublicOnly = true, + ImpactsPlayercard = true, + SaveRef = function ( f23_arg0, f23_arg1, f23_arg2, f23_arg3 ) + Cac.SetPatchIndex( f23_arg0, f23_arg1, f23_arg2, f23_arg3 ) + end, + GetSavedRef = function ( f24_arg0, f24_arg1, f24_arg2 ) + return Cac.GetPatchIndex( f24_arg0, f24_arg1, f24_arg2 ) + end, + SelectionPopup = "cac_customize_grid_popup" +} +local f0_local7 = package.loaded["LUI.mp_menus.CacCustomize"] +if f0_local7 then + f0_local7 = LUI.mp_menus.CacCustomize.CustomizePopupGridGraphicalButton +end +f0_local6.SelectionButtonFactory = f0_local7 +f0_local6.CategoryColumn = 5 +f0_local6.CategoryNameColumn = 6 +f0_local6.CategoryDLCName = "DLC" +f0_local6.GetName = function ( f25_arg0 ) + return Engine.TableLookup( "mp/cac/patches.csv", 0, f25_arg0, 2 ) +end + +f0_local6.GetQuip = function ( f26_arg0 ) + return Engine.TableLookup( "mp/cac/patches.csv", 0, f26_arg0, 3 ) +end + +f0_local6.PreviewFunction = function ( f27_arg0, f27_arg1, f27_arg2, f27_arg3, f27_arg4, f27_arg5 ) + CharacterScene.ChangeBody( f27_arg2, Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body].MakeModelName( Cac.GetBodyIndex( f27_arg0, Cac.GetSquadLoc(), f27_arg4 ), f27_arg5 ), f27_arg3 ) + f27_arg1:processEvent( { + name = "update_playercard", + patchEmblem = f27_arg3 + } ) +end + +f0_local6.InitFunction = function ( f28_arg0, f28_arg1, f28_arg2, f28_arg3, f28_arg4 ) + f28_arg1:processEvent( { + name = "update_playercard", + patchEmblem = f28_arg3 + } ) +end + +f0_local6.CustomizeCamera = CharacterCameraPresets.CustomizeMenu.Patch +f0_local6.GetUIMaterial = function ( f29_arg0 ) + return Engine.TableLookup( "mp/cac/patches.csv", 0, f29_arg0, 4 ) +end + +f0_local6.IsEntitlementColumn = 7 +f0_local6.HideUnlessUnlockedColumn = 8 +f0_local6.CustomUnlockText = 9 +f0_local6.DLCOffer = 10 +f0_local6.ReleaseKillswitch = 11 +f0_local6.HideIfItemColumn = 12 +f0_local6.GetDefaultRef = function ( f30_arg0, f30_arg1 ) + local f30_local0 = Cac.Customization.GetElementRefsForField( f30_arg0, Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patch], f30_arg1 ) + assert( #f30_local0 > 0 ) + return f30_local0[1] +end + +f0_local7 = { + csv = "mp/cac/patchbackings.csv", + LocName = "PATCHBACKING", + UnlockType = "Patchbacking", + PublicOnly = true, + ImpactsPlayercard = true, + SaveRef = function ( f31_arg0, f31_arg1, f31_arg2, f31_arg3 ) + Cac.SetPatchbackingIndex( f31_arg0, f31_arg1, f31_arg2, f31_arg3 ) + end, + GetSavedRef = function ( f32_arg0, f32_arg1, f32_arg2 ) + return Cac.GetPatchbackingIndex( f32_arg0, f32_arg1, f32_arg2 ) + end, + SelectionPopup = "cac_customize_grid_popup" +} +local f0_local8 = package.loaded["LUI.mp_menus.CacCustomize"] +if f0_local8 then + f0_local8 = LUI.mp_menus.CacCustomize.CustomizePopupGridGraphicalButton +end +f0_local7.SelectionButtonFactory = f0_local8 +f0_local7.CategoryColumn = 3 +f0_local7.CategoryNameColumn = 4 +f0_local7.GetName = function ( f33_arg0 ) + return Engine.TableLookup( "mp/cac/patchbackings.csv", 0, f33_arg0, 1 ) +end + +f0_local7.PreviewFunction = function ( f34_arg0, f34_arg1, f34_arg2, f34_arg3, f34_arg4 ) + f34_arg1:processEvent( { + name = "update_playercard", + patchShape = f34_arg3 + } ) +end + +f0_local7.CustomizeCamera = CharacterCameraPresets.CustomizeMenu.Patch +f0_local7.GetUIMaterial = function ( f35_arg0 ) + return Engine.TableLookup( "mp/cac/patchbackings.csv", 0, f35_arg0, 2 ) +end + +f0_local7.IsEntitlementColumn = 5 +f0_local7.HideUnlessUnlockedColumn = 6 +f0_local7.CustomUnlockText = 7 +f0_local8 = { + csv = "mp/cac/backgrounds.csv", + LocName = "BACKGROUND", + UnlockType = "Background", + PublicOnly = true, + ImpactsPlayercard = true, + SaveRef = function ( f36_arg0, f36_arg1, f36_arg2, f36_arg3 ) + Cac.SetBackgroundIndex( f36_arg0, f36_arg1, f36_arg2, f36_arg3 ) + end, + GetSavedRef = function ( f37_arg0, f37_arg1, f37_arg2 ) + return Cac.GetBackgroundIndex( f37_arg0, f37_arg1, f37_arg2 ) + end, + SelectionPopup = "cac_customize_vlist_popup" +} +local f0_local9 = package.loaded["LUI.mp_menus.CacCustomize"] +if f0_local9 then + f0_local9 = LUI.mp_menus.CacCustomize.CustomizePopupGridGraphicalButton +end +f0_local8.SelectionButtonFactory = f0_local9 +f0_local8.CategoryColumn = 4 +f0_local8.CategoryNameColumn = 5 +f0_local8.CategoryDLCName = "DLC Backgrounds" +f0_local8.GetName = function ( f38_arg0 ) + return Engine.TableLookup( "mp/cac/backgrounds.csv", 0, f38_arg0, 2 ) +end + +f0_local8.PreviewFunction = function ( f39_arg0, f39_arg1, f39_arg2, f39_arg3, f39_arg4 ) + f39_arg1:processEvent( { + name = "update_character_bg", + material = RegisterMaterial( Engine.TableLookup( "mp/cac/backgrounds.csv", 0, f39_arg3, 1 ) ) + } ) + f39_arg1:processEvent( { + name = "update_playercard", + background = f39_arg3 + } ) +end + +f0_local8.CustomizeCamera = CharacterCameraPresets.CustomizeMenu.Default +f0_local8.GetUIMaterial = function ( f40_arg0 ) + return Engine.TableLookup( "mp/cac/backgrounds.csv", 0, f40_arg0, 3 ) +end + +f0_local8.IsEntitlementColumn = 6 +f0_local8.HideUnlessUnlockedColumn = 7 +f0_local8.CustomUnlockText = 8 +f0_local8.DLCOffer = 9 +f0_local8.ReleaseKillswitch = 10 +f0_local8.HideIfItemColumn = 11 +f0_local8.GetDefaultRef = function ( f41_arg0, f41_arg1 ) + local f41_local0 = Cac.Customization.GetElementRefsForField( f41_arg0, Cac.Customization.Fields[Cac.Customization.FieldIndexes.Background], f41_arg1 ) + assert( #f41_local0 > 0 ) + return f41_local0[1] +end + +f0_local9 = { + LocName = "CLAN_TAG", + UnlockType = "ClanTag", + PublicOnly = false, + ImpactsPlayercard = true, + SaveRef = function () + + end, + GetSavedRef = function ( f43_arg0 ) + return Engine.GetProfileDataUseEliteClanTag( f43_arg0 ) and Engine.GetClanTag( f43_arg0 ) or Engine.GetCustomClanTag( f43_arg0 ) + end, + SelectionPopup = "cac_customize_clan_tag_popup", + PreviewFunction = function ( f44_arg0, f44_arg1, f44_arg2, f44_arg3, f44_arg4 ) + f44_arg1:processEvent( { + name = "update_playercard", + clantag = f44_arg3 + } ) + end +} +local f0_local10 = { + csv = "mp/cac/dogs.csv", + UnlockType = "GuardDog", + LocName = "GUARD_DOG", + PublicOnly = false, + ImpactsPlayercard = false, + SaveRef = function ( f45_arg0, f45_arg1, f45_arg2, f45_arg3 ) + Engine.SetPlayerDataReservedInt( f45_arg0, CoD.StatsGroup.Common, "mp_dog_type", f45_arg3 ) + end, + GetSavedRef = function ( f46_arg0 ) + return Engine.GetPlayerDataReservedInt( f46_arg0, CoD.StatsGroup.Common, "mp_dog_type" ) + end, + GetDefaultRef = function () + return 0 + end, + buttonVariant = GenericButtonSettings.Variants.Info, + SelectionPopup = "cac_customize_small_popup", + HelpText = "LUA_MENU_GUARD_DOG_CHOICE_MESSAGE", + GetName = function ( f48_arg0 ) + return Engine.TableLookup( "mp/cac/dogs.csv", 0, tostring( f48_arg0 ), 1 ) + end, + IsUnlocked = function ( f49_arg0, f49_arg1 ) + return Lobby.IsItemOfTypeUnlocked( f49_arg0, Engine.TableLookup( "mp/cac/dogs.csv", 0, tostring( f49_arg1 ), 2 ), "DLC" ) + end, + DLCOffer = 3, + GetUIMaterial = function ( f50_arg0 ) + return Engine.TableLookup( "mp/cac/dogs.csv", 0, f50_arg0, 4 ) + end, + IsEntitlementColumn = 5 +} +local f0_local11 = { + csv = "mp/cac/announcers.csv", + LocName = "ANNOUNCER", + UnlockType = "Announcer", + PublicOnly = false, + ImpactsPlayercard = false, + SaveRef = function ( f51_arg0, f51_arg1, f51_arg2, f51_arg3 ) + f51_arg3 = tonumber( f51_arg3 ) + assert( f51_arg3 and f51_arg3 < 128 ) + Engine.SetPlayerDataReservedInt( f51_arg0, CoD.StatsGroup.Common, "mp_announcer_type", f51_arg3 ) + end, + GetSavedRef = function ( f52_arg0 ) + return Engine.GetPlayerDataReservedInt( f52_arg0, CoD.StatsGroup.Common, "mp_announcer_type" ) + end, + IsReleased = function ( f53_arg0 ) + return Engine.IsAnnouncerReleased( f53_arg0 ) + end, + IsUnlocked = function ( f54_arg0, f54_arg1 ) + return Engine.IsAnnouncerUnlocked( f54_arg1 ) + end, + DLCOffer = 3, + SelectionPopup = "cac_customize_small_popup", + HelpText = "LUA_MENU_MP_CHOOSE_ANNOUNCER", + PreviewFunction = function ( f55_arg0, f55_arg1, f55_arg2, f55_arg3, f55_arg4 ) + local f55_local0 = Engine.TableLookup( "mp/cac/announcers.csv", 0, tostring( f55_arg3 ), 2 ) + if f55_local0 ~= "" then + return Engine.PlaySound( f55_local0 ) + else + + end + end, + GetDefaultRef = function () + return 0 + end, + GetName = function ( f57_arg0 ) + return Engine.TableLookup( "mp/cac/announcers.csv", 0, tostring( f57_arg0 ), 1 ) + end, + buttonVariant = GenericButtonSettings.Variants.Info, + IsEntitlementColumn = 4 +} +f0_local2[1] = f0_local3 +f0_local2[2] = f0_local4 +f0_local2[3] = f0_local5 +f0_local2[4] = f0_local6 +f0_local2[5] = f0_local7 +f0_local2[6] = f0_local8 +f0_local2[7] = f0_local9 +f0_local2[8] = f0_local10 +f0_local2[9] = f0_local11 +f0_local1.Fields = f0_local2 +f0_local1.Camos = { + File = "mp/cac/camos.csv", + Cols = { + Ref = 0, + Suffix = 1, + Name = 2, + HeadSuffix = 3 + } +} +f0_local0.Customization = f0_local1 +Cac.Customization.GetReqsStringForItem = function ( f58_arg0, f58_arg1, f58_arg2, f58_arg3, f58_arg4 ) + local f58_local0 = "" + local f58_local1 = "" + if SvS.IsSvS() then + if IsPublicMatch() then + f58_local1 = Engine.Localize( "LUA_MENU_PLAY_ONLINE_TO_UNLOCK" ) + end + return f58_local0, f58_local1 + elseif Cac.IsCustomizationItemDLC( f58_arg1, f58_arg0 ) and Cac.IsCustomizationItemUnlocked( f58_arg2, f58_arg1, f58_arg0 ) == true then + f58_local0 = "@DLC_ALREADY_PURCHASED" + else + f58_local0 = Engine.TableLookup( f58_arg1.csv, 0, f58_arg0, f58_arg1.CustomUnlockText ) + end + if f58_local0 ~= "" then + f58_local0 = Engine.Localize( f58_local0 ) + end + if f58_local0 == "" and (IsPublicMatch() or IsOnlineAliens()) then + local f58_local2 = getUnlockReqsForItemOfType( f58_arg0, f58_arg1.UnlockType ) + if f58_local2.chalAndTier ~= "" then + f58_local0, f58_local1 = getUnlockInfoStrings( f58_local2.chalAndTier, f58_arg2, f58_arg3, f58_arg4 ) + elseif f58_local2.rank ~= "" and tonumber( f58_local2.rank ) > 0 then + f58_local0 = Engine.Localize( "@LUA_MENU_UNLOCKED_AT_RANK", tonumber( f58_local2.rank ) + 1 ) + elseif f58_local2.rankExt ~= "" and tonumber( f58_local2.rankExt ) > 0 then + f58_local0 = Engine.Localize( "@LUA_MENU_UNLOCKED_EXT_RANK", tonumber( f58_local2.rankExt ) + 1 ) + elseif f58_local2.prestigeExt ~= "" and tonumber( f58_local2.prestigeExt ) > 0 then + f58_local0 = Engine.Localize( "@ALIENS_REQ_PRESTIGE", tonumber( f58_local2.prestigeExt ) ) + elseif f58_local2.prestige ~= "" and tonumber( f58_local2.prestige ) > 0 then + f58_local0 = Engine.Localize( "@LUA_MENU_REACH_PRESTIGE", tonumber( f58_local2.prestige ) ) + elseif f58_local2.escapesExt ~= "" and tonumber( f58_local2.escapesExt ) > 0 then + local f58_local3 = tonumber( f58_local2.escapesExt ) + if f58_local3 == 1 then + f58_local0 = Engine.Localize( "@ALIENS_REQ_ESCAPE" ) + else + f58_local0 = Engine.Localize( "@ALIENS_REQ_ESCAPE_N_TIMES", f58_local3 ) + end + elseif f58_local2.highestRelicEscapeExt ~= "" and tonumber( f58_local2.highestRelicEscapeExt ) > 0 then + f58_local0 = Engine.Localize( "@ALIENS_REQ_N_RELICS", tonumber( f58_local2.highestRelicEscapeExt ) ) + elseif f58_local2.killsExt ~= "" and tonumber( f58_local2.killsExt ) > 0 then + f58_local0 = Engine.Localize( "@ALIENS_REQ_N_KILLS", tonumber( f58_local2.killsExt ) ) + elseif f58_local2.revivesExt ~= "" and tonumber( f58_local2.revivesExt ) > 0 then + f58_local0 = Engine.Localize( "@ALIENS_REQ_N_REVIVES", tonumber( f58_local2.revivesExt ) ) + else + f58_local0 = Engine.Localize( "@LUA_MENU_UNLOCKED_BY_DEFAULT" ) + end + end + return f58_local0, f58_local1 +end + +function makeGenderFilter( f59_arg0 ) + if type( f59_arg0 ) == "string" then + return function ( f60_arg0 ) + return f60_arg0 == f59_arg0 + end + + else + return f59_arg0 + end +end + +Cac.Customization.GetElementRefsForField = function ( f61_arg0, f61_arg1, f61_arg2 ) + assert( f61_arg1.csv ) + local f61_local0 = {} + local f61_local1 = 0 + local f61_local2 = 1000 + local f61_local3 = f61_arg2 and f61_arg1.GenderColumn + f61_arg2 = makeGenderFilter( f61_arg2 ) + for f61_local4 = f61_local1, f61_local2, 1 do + if Engine.TableLookup( f61_arg1.csv, 0, tostring( f61_local4 ), 0 ) == "" then + break + elseif not Cac.ShouldConcealCacItem( f61_arg0, f61_arg1, tostring( f61_local4 ) ) and (not f61_local3 or f61_arg2( Engine.TableLookup( f61_arg1.csv, 0, tostring( f61_local4 ), f61_arg1.GenderColumn ) )) then + table.insert( f61_local0, tostring( f61_local4 ) ) + end + end + return f61_local0 +end + +Cac.Customization.GetElementCountForField = function ( f62_arg0 ) + local f62_local0 = 0 + local f62_local1 = Engine.TableLookup( f62_arg0.csv, 0, tostring( f62_local0 ), 2 ) + while f62_local1 ~= "" do + f62_local0 = f62_local0 + 1 + f62_local1 = Engine.TableLookup( f62_arg0.csv, 0, tostring( f62_local0 ), 2 ) + end + return f62_local0 +end + +Cac.Customization.GetCategorizedElementRefsForField = function ( f63_arg0, f63_arg1, f63_arg2 ) + local f63_local0 = {} + local f63_local1 = f63_arg2 and f63_arg1.GenderColumn + f63_arg2 = makeGenderFilter( f63_arg2 ) + if f63_arg1.CategoryColumn and f63_arg1.CategoryNameColumn then + local f63_local2 = 0 + local f63_local3 = 1000 + local f63_local4 = f63_arg1.unlockType + local f63_local5 = {} + local f63_local6 = "" + local f63_local7 = 0 + for f63_local8 = f63_local2, f63_local3, 1 do + if Engine.TableLookup( f63_arg1.csv, 0, tostring( f63_local8 ), 1 ) == "" then + break + elseif not Cac.ShouldConcealCacItem( f63_arg0, f63_arg1, tostring( f63_local8 ) ) then + local f63_local11 = Engine.TableLookup( f63_arg1.csv, 0, tostring( f63_local8 ), f63_arg1.CategoryColumn ) + if not f63_local5[f63_local11] then + table.insert( f63_local0, { + name = Engine.Localize( Engine.TableLookup( f63_arg1.csv, 0, tostring( f63_local8 ), f63_arg1.CategoryNameColumn ) ), + elements = {}, + dlc = f63_arg1.CategoryDLCName == f63_local11 + } ) + f63_local5[f63_local11] = #f63_local0 + end + if not f63_local1 or f63_arg2( Engine.TableLookup( f63_arg1.csv, 0, tostring( f63_local8 ), f63_arg1.GenderColumn ) ) then + f63_local7 = f63_local5[f63_local11] + table.insert( f63_local0[f63_local5[f63_local11]].elements, tostring( f63_local8 ) ) + end + end + end + if f63_arg1.CategoryDLCName then + for f63_local12, f63_local13 in ipairs( f63_local0 ) do + if f63_local13.dlc then + f63_local13.elements = LUI.ReverseTable( f63_local13.elements ) + end + end + end + else + f63_local0 = { + { + name = Engine.Localize( "@LUA_MENU_CUSTOMIZATION_FIELD_" .. f63_arg1.LocName .. "_CAPS" ), + elements = Cac.Customization.GetElementRefsForField( f63_arg0, f63_arg1, f63_arg2 ) + } + } + local f63_local2 = function ( f64_arg0, f64_arg1 ) + local f64_local0 = tonumber( f64_arg0 ) + local f64_local1 = tonumber( f64_arg1 ) + local f64_local2 = Cac.IsCustomizationItemDLC( f63_arg1, f64_local0 ) + local f64_local3 = Cac.IsCustomizationItemDLC( f63_arg1, f64_local1 ) + if f64_local2 ~= f64_local3 then + return f64_local3 + elseif f64_local2 then + return f64_local1 < f64_local0 + else + return f64_local0 < f64_local1 + end + end + + for f63_local6, f63_local7 in ipairs( f63_local0 ) do + table.sort( f63_local7.elements, f63_local2 ) + end + end + return f63_local0 +end + +Cac.GetDefaultBodyModel = function ( f65_arg0, f65_arg1 ) + local f65_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body] + return f65_local0.MakeModelName( f65_local0.GetDefaultRef( f65_arg0, f65_arg1 ) ) +end + +Cac.GetDefaultHeadModel = function ( f66_arg0, f66_arg1 ) + local f66_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + return f66_local0.MakeModelName( f66_local0.GetDefaultRef( f66_arg0, f66_arg1 ) ) +end + +Cac.GetDefaultBodyCamoRef = function () + return Engine.TableLookupByRow( Cac.Customization.Camos.File, 4, Cac.Customization.Camos.Cols.Ref ) +end + +Cac.GetCamoRefs = function () + local f68_local0 = {} + local f68_local1 = 0 + local f68_local2 = 1000 + for f68_local3 = f68_local1, f68_local2, 1 do + if Engine.TableLookup( Cac.Customization.Camos.File, Cac.Customization.Camos.Cols.Ref, tostring( f68_local3 ), Cac.Customization.Camos.Cols.Suffix ) == "" then + break + end + table.insert( f68_local0, tostring( f68_local3 ) ) + end + return f68_local0 +end + +Cac.GetBodyCamoSuffix = function ( f69_arg0 ) + return Engine.TableLookup( Cac.Customization.Camos.File, Cac.Customization.Camos.Cols.Ref, f69_arg0, Cac.Customization.Camos.Cols.Suffix ) +end + +Cac.GetHeadCamoSuffix = function ( f70_arg0 ) + return Engine.TableLookup( Cac.Customization.Camos.File, Cac.Customization.Camos.Cols.Ref, f70_arg0, Cac.Customization.Camos.Cols.HeadSuffix ) +end + +Cac.GetBodyCamoName = function ( f71_arg0 ) + return Engine.Localize( Engine.TableLookup( Cac.Customization.Camos.File, Cac.Customization.Camos.Cols.Ref, f71_arg0, Cac.Customization.Camos.Cols.Name ) ) +end + +Cac.GetHeadIndex = function ( f72_arg0, f72_arg1, f72_arg2 ) + return Cac.GetCacConfig( f72_arg0, f72_arg1, f72_arg2, "head" ) +end + +Cac.SetHeadIndex = function ( f73_arg0, f73_arg1, f73_arg2, f73_arg3 ) + Cac.SetCacConfig( f73_arg0, f73_arg1, f73_arg2, "head", f73_arg3 ) +end + +Cac.GetHelmetIndex = function ( f74_arg0, f74_arg1, f74_arg2 ) + return Cac.GetCacConfig( f74_arg0, f74_arg1, f74_arg2, "helmet" ) +end + +Cac.SetHelmetIndex = function ( f75_arg0, f75_arg1, f75_arg2, f75_arg3 ) + Cac.SetCacConfig( f75_arg0, f75_arg1, f75_arg2, "helmet", f75_arg3 ) +end + +Cac.GetBodyIndex = function ( f76_arg0, f76_arg1, f76_arg2 ) + return Cac.GetCacConfig( f76_arg0, f76_arg1, f76_arg2, "body" ) +end + +Cac.SetBodyIndex = function ( f77_arg0, f77_arg1, f77_arg2, f77_arg3 ) + Cac.SetCacConfig( f77_arg0, f77_arg1, f77_arg2, "body", f77_arg3 ) +end + +Cac.GetPatchIndex = function ( f78_arg0, f78_arg1, f78_arg2 ) + return Cac.GetCacConfig( f78_arg0, f78_arg1, f78_arg2, "patch" ) +end + +Cac.SetPatchIndex = function ( f79_arg0, f79_arg1, f79_arg2, f79_arg3 ) + Cac.SetCacConfig( f79_arg0, f79_arg1, f79_arg2, "patch", f79_arg3 ) +end + +Cac.GetPatchbackingIndex = function ( f80_arg0, f80_arg1, f80_arg2 ) + return Cac.GetCacConfig( f80_arg0, f80_arg1, f80_arg2, "patchbacking" ) +end + +Cac.SetPatchbackingIndex = function ( f81_arg0, f81_arg1, f81_arg2, f81_arg3 ) + Cac.SetCacConfig( f81_arg0, f81_arg1, f81_arg2, "patchbacking", f81_arg3 ) +end + +Cac.GetBackgroundIndex = function ( f82_arg0, f82_arg1, f82_arg2 ) + return Cac.GetCacConfig( f82_arg0, f82_arg1, f82_arg2, "background" ) +end + +Cac.SetBackgroundIndex = function ( f83_arg0, f83_arg1, f83_arg2, f83_arg3 ) + Cac.SetCacConfig( f83_arg0, f83_arg1, f83_arg2, "background", f83_arg3 ) +end + +Cac.SetDogIndex = function ( f84_arg0, f84_arg1 ) + Engine.SetPlayerDataEx( f84_arg0, CoD.StatsGroup.Ranked, "dogType", f84_arg1 ) +end + +Cac.GetGenderFromHeadRef = function ( f85_arg0 ) + local f85_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + return Engine.TableLookup( f85_local0.csv, 0, f85_arg0, f85_local0.GenderColumn ) +end + +Cac.GetGenderFromBodyRef = function ( f86_arg0 ) + local f86_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body] + return Engine.TableLookup( f86_local0.csv, 0, f86_arg0, f86_local0.GenderColumn ) +end + +Cac.GetCurrentGender = function ( f87_arg0, f87_arg1, f87_arg2 ) + return Cac.GetGenderFromBodyRef( Cac.Customization.Fields[Cac.Customization.FieldIndexes.Body].GetSavedRef( f87_arg0, f87_arg1, f87_arg2 ) ) +end + +Cac.IsCommonGender = function ( f88_arg0 ) + local f88_local0 + if f88_arg0 ~= Cac.Customization.Gender.Male and f88_arg0 ~= Cac.Customization.Gender.Female then + f88_local0 = false + else + f88_local0 = true + end + return f88_local0 +end + +Cac.ResetGenderDependantFields = function ( f89_arg0, f89_arg1, f89_arg2, f89_arg3 ) + assert( f89_arg3 ) + for f89_local7, f89_local8 in ipairs( Cac.Customization.Fields ) do + if f89_local8.GenderColumn then + for f89_local3 = 0, 1000, 1 do + local f89_local6 = tostring( f89_local3 ) + if Engine.TableLookup( f89_local8.csv, 0, f89_local6, 1 ) == "" then + DebugPrint( "WARNING: did not find a suitable value when resetting field " .. f89_local8.LocName .. " with gender restriction " .. f89_arg3 ) + end + if f89_arg3 == Engine.TableLookup( f89_local8.csv, 0, tostring( f89_local3 ), f89_local8.GenderColumn ) then + f89_local8.SaveRef( f89_arg0, f89_arg1, f89_arg2, f89_local6 ) + end + end + end + end +end + +Cac.IsCustomizationItemUnlocked = function ( f90_arg0, f90_arg1, f90_arg2, f90_arg3 ) + return Cac.IsLoadOutItemUnlocked( f90_arg0, f90_arg1, f90_arg2, f90_arg3 ) +end + +Cac.IsCamoReticleItemUnlocked = function ( f91_arg0, f91_arg1, f91_arg2, f91_arg3 ) + return Cac.IsLoadOutItemUnlocked( f91_arg0, f91_arg1, f91_arg2, f91_arg3 ) +end + +Cac.IsWeaponItemUnlocked = function ( f92_arg0, f92_arg1, f92_arg2, f92_arg3 ) + return Cac.IsLoadOutItemUnlocked( f92_arg0, f92_arg1, f92_arg2, f92_arg3 ) +end + +Cac.IsLoadOutItemUnlocked = function ( f93_arg0, f93_arg1, f93_arg2, f93_arg3 ) + if Engine.IsUserAGuest( f93_arg0 ) or not Engine.IsUserSignedInToLive( f93_arg0 ) then + f93_arg0 = Engine.GetFirstActiveController() + end + if f93_arg1.IsUnlocked then + return f93_arg1.IsUnlocked( f93_arg0, f93_arg2 ) + elseif IsPublicMatch() or f93_arg3 or IsOnlineAliens() then + return Lobby.IsItemOfTypeUnlocked( f93_arg0, f93_arg2, f93_arg1.UnlockType ) + else + return true + end +end + +Cac.IsCustomizationItemDLC = function ( f94_arg0, f94_arg1 ) + assert( f94_arg0.csv ) + if f94_arg0.DLCOffer and Engine.TableLookup( f94_arg0.csv, 0, f94_arg1, f94_arg0.DLCOffer ) ~= "" then + return true + elseif f94_arg0.IsEntitlementColumn and Engine.TableLookup( f94_arg0.csv, 0, f94_arg1, f94_arg0.IsEntitlementColumn ) == "2" then + return true + elseif f94_arg0.SecondaryEntitlementColumn and Engine.TableLookup( f94_arg0.csv, 0, f94_arg1, f94_arg0.SecondaryEntitlementColumn ) == "2" then + return true + else + return false + end +end + +Cac.ShouldConcealCacItem = function ( f95_arg0, f95_arg1, f95_arg2 ) + if f95_arg1.HideIfItemColumn then + local f95_local0 = Engine.TableLookup( f95_arg1.csv, 0, f95_arg2, f95_arg1.HideIfItemColumn ) + if f95_local0 ~= "" and Cac.IsLoadOutItemUnlocked( f95_arg0, f95_arg1, f95_local0 ) then + return true + end + end + if f95_arg1.IsReleased and not f95_arg1.IsReleased( f95_arg2 ) then + return true + end + local f95_local0 = f95_arg1.IsEntitlementColumn and Engine.TableLookup( f95_arg1.csv, 0, f95_arg2, f95_arg1.IsEntitlementColumn ) or nil + local f95_local1 = f95_arg1.SecondaryEntitlementColumn and Engine.TableLookup( f95_arg1.csv, 0, f95_arg2, f95_arg1.SecondaryEntitlementColumn ) or nil + local f95_local2 + if f95_local0 ~= "2" and f95_local1 ~= "2" then + f95_local2 = false + else + f95_local2 = true + end + local f95_local3 + if f95_local0 ~= "3" and f95_local1 ~= "3" then + f95_local3 = false + else + f95_local3 = true + end + if ((f95_arg1.HideUnlessUnlockedColumn and Engine.TableLookup( f95_arg1.csv, 0, f95_arg2, f95_arg1.HideUnlessUnlockedColumn ) or false) == "1" or (f95_local2 or f95_local3) and not IsPublicMatch() and not IsOnlineAliens()) and not Cac.IsLoadOutItemUnlocked( f95_arg0, f95_arg1, f95_arg2, true ) then + return true + elseif f95_arg1.ReleaseKillswitch and (f95_local0 ~= "1" or not Cac.IsLoadOutItemUnlocked( f95_arg0, f95_arg1, f95_arg2, true )) then + local f95_local4 = Engine.TableLookup( f95_arg1.csv, 0, f95_arg2, f95_arg1.ReleaseKillswitch ) + local f95_local5 + if f95_local4 ~= "" and Engine.GetDvarInt( f95_local4 ) ~= 1 then + f95_local5 = false + else + f95_local5 = true + end + if not f95_local5 then + return true + end + end + return false +end + +Cac.DoesHeadUseHelmet = function ( f96_arg0 ) + local f96_local0 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Head] + return Engine.TableLookup( f96_local0.csv, 0, f96_arg0, f96_local0.UseHelmetColumn ) == "1" +end + +Cac.GetRandomIdleAnim = function ( f97_arg0, f97_arg1 ) + local f97_local0 = Cac.Customization.Animations.idles.normal + if Engine.IsAliensMode() then + f97_local0 = Cac.Customization.Animations.idles.pistol + elseif string.find( f97_arg0, "riotshield" ) then + f97_local0 = Cac.Customization.Animations.idles.riotshield + elseif string.find( f97_arg0, "knifeonly" ) then + f97_local0 = Cac.Customization.Animations.idles.knifeonly + end + local f97_local1 = math.random( 1, #f97_local0 ) + if f97_arg1 and f97_local0[f97_local1] == f97_arg1 and #f97_local0 > 1 then + if #f97_local0 < f97_local1 + 1 then + f97_local1 = f97_local1 - 1 + else + f97_local1 = f97_local1 + 1 + end + end + return f97_local0[f97_local1] +end + +NewIconsTable = { + File = "mp/mDLCNewIcons.csv", + Cols = { + Idx = 0, + Item = 1, + Type = 2, + ReleaseKillswitch = 3 + }, + Size = 600, + CACItemTypes = { + "Weapon_Primary", + "Weapon_Secondary", + "Camo", + "Patch", + "Background", + "Head", + "Helmet", + "Body", + "Special", + "LoadoutSlot", + "Announcer" + } +} +Cac.TryGetFieldFromType = function ( f98_arg0 ) + for f98_local3, f98_local4 in ipairs( Cac.Customization.Fields ) do + if f98_local4.UnlockType then + if f98_local4.UnlockType == f98_arg0 then + return f98_local4 + elseif f98_arg0 == "Special" and f98_local4.UnlockType == "Body" then + return f98_local4 + end + end + end +end + +Cac.AnyUnseenMDLCItems = function ( f99_arg0, f99_arg1, f99_arg2 ) + if not Engine.InFrontend() or not IsPublicMatch() then + return false + elseif f99_arg2 then + f99_arg2 = makeGenderFilter( f99_arg2 ) + end + local f99_local0 = {} + local f99_local1 = 0 + local f99_local2 = 0 + repeat + local f99_local3 = Engine.TableLookupByRow( NewIconsTable.File, f99_local2, NewIconsTable.Cols.Item ) + local f99_local4 = Engine.TableLookupByRow( NewIconsTable.File, f99_local2, NewIconsTable.Cols.Type ) + local f99_local5 = Engine.TableLookupByRow( NewIconsTable.File, f99_local2, NewIconsTable.Cols.ReleaseKillswitch ) + if f99_local3 == "" then + break + else + if f99_local5 ~= "" and Engine.GetDvarInt( f99_local5 ) ~= 1 then + local f99_local6 = false + else + local f99_local6 = true + end + if f99_local5 == "AnnouncerCheck" then + local f99_local6 = Engine.IsAnnouncerReleased( f99_local3 ) + end + if f99_local6 and not Engine.GetPlayerDataEx( f99_arg0, CoD.StatsGroup.Common, "iconNew", f99_local2 ) then + local f99_local7 = false + if f99_local4 == "Camo" then + f99_local7 = Cac.ShouldHideCamoOrReticleEntitlement( f99_arg0, f99_local3 ) + else + local f99_local8 = Cac.TryGetFieldFromType( f99_local4 ) + if f99_local8 then + if Cac.ShouldConcealCacItem( f99_arg0, f99_local8, f99_local3 ) then + f99_local7 = true + elseif f99_arg2 and f99_local8.GenderColumn and not f99_arg2( Engine.TableLookup( f99_local8.csv, 0, tostring( f99_local3 ), f99_local8.GenderColumn ) ) then + f99_local7 = true + end + end + end + if not f99_local7 then + if not f99_local0[f99_local4] then + f99_local0[f99_local4] = {} + end + table.insert( f99_local0[f99_local4], f99_local3 ) + f99_local1 = f99_local1 + 1 + end + end + f99_local2 = f99_local2 + 1 + end + until f99_local2 >= NewIconsTable.Size + if f99_arg1 then + for f99_local6, f99_local7 in pairs( f99_arg1 ) do + if f99_local0[f99_local7] then + return true + end + end + return false + else + return f99_local1 > 0 + end +end + +Cac.GetRowForNewIconItem = function ( f100_arg0, f100_arg1 ) + local f100_local0 = 0 + repeat + local f100_local1 = Engine.TableLookupByRow( NewIconsTable.File, f100_local0, NewIconsTable.Cols.Item ) + local f100_local2 = Engine.TableLookupByRow( NewIconsTable.File, f100_local0, NewIconsTable.Cols.Type ) + if f100_local1 == "" then + return nil + elseif f100_local1 == f100_arg0 and f100_local2 == f100_arg1 then + return f100_local0 + end + f100_local0 = f100_local0 + 1 + until f100_local0 >= NewIconsTable.Size +end + +Cac.ItemHasNewIcon = function ( f101_arg0, f101_arg1, f101_arg2, f101_arg3 ) + local f101_local0 = false + if Engine.InFrontend() and IsPublicMatch() then + if f101_arg3 then + if not Cac.ShouldConcealCacItem( f101_arg0, f101_arg3, f101_arg1 ) then + local f101_local1 = Cac.GetRowForNewIconItem( f101_arg1, f101_arg2 or f101_arg3.UnlockType ) + if f101_local1 and not Engine.GetPlayerDataEx( f101_arg0, CoD.StatsGroup.Common, "iconNew", f101_local1 ) then + f101_local0 = true + end + end + else + local f101_local1 = Cac.GetRowForNewIconItem( f101_arg1, f101_arg2 ) + if f101_local1 and not Engine.GetPlayerDataEx( f101_arg0, CoD.StatsGroup.Common, "iconNew", f101_local1 ) then + f101_local0 = true + end + end + end + return f101_local0 +end + +Cac.MarkItemNoMoreNewIcon = function ( f102_arg0, f102_arg1, f102_arg2 ) + local f102_local0 = Cac.GetRowForNewIconItem( f102_arg1, f102_arg2 ) + if f102_local0 then + Engine.SetPlayerDataEx( f102_arg0, CoD.StatsGroup.Common, "iconNew", f102_local0, true ) + end +end + +Cac.ClearAllNewIconsForType = function ( f103_arg0, f103_arg1 ) + local f103_local0 = 0 + repeat + local f103_local1 = Engine.TableLookupByRow( NewIconsTable.File, f103_local0, NewIconsTable.Cols.Item ) + local f103_local2 = Engine.TableLookupByRow( NewIconsTable.File, f103_local0, NewIconsTable.Cols.Type ) + if f103_local1 == "" then + break + else + if f103_local2 == f103_arg1 then + Engine.SetPlayerDataEx( f103_arg0, CoD.StatsGroup.Common, "iconNew", f103_local0, true ) + end + f103_local0 = f103_local0 + 1 + end + until f103_local0 >= NewIconsTable.Size +end + +Cac.AnyNewIconsForWeaponsOfClass = function ( f104_arg0, f104_arg1 ) + if not Engine.InFrontend() or not IsPublicMatch() then + return false + end + local f104_local0 = 0 + repeat + local f104_local1 = Engine.TableLookupByRow( NewIconsTable.File, f104_local0, NewIconsTable.Cols.Item ) + local f104_local2 = Engine.TableLookupByRow( NewIconsTable.File, f104_local0, NewIconsTable.Cols.Type ) + if f104_local1 == "" then + break + else + if f104_local2 == "Weapon_Primary" or f104_local2 == "Weapon_Secondary" then + local f104_local3 = Engine.TableLookupByRow( NewIconsTable.File, f104_local0, NewIconsTable.Cols.ReleaseKillswitch ) + local f104_local4 + if f104_local3 ~= "" and Engine.GetDvarInt( f104_local3 ) ~= 1 then + f104_local4 = false + else + f104_local4 = true + end + if f104_local4 and Cac.GetWeaponClass( f104_local1 ) == f104_arg1 and not Engine.GetPlayerDataEx( f104_arg0, CoD.StatsGroup.Common, "iconNew", f104_local0 ) then + return true + end + end + f104_local0 = f104_local0 + 1 + end + until f104_local0 >= NewIconsTable.Size + return false +end + +Cac.ValidateCustomizationItems = function ( f105_arg0, f105_arg1, f105_arg2 ) + for f105_local6, f105_local7 in ipairs( Cac.Customization.Fields ) do + if f105_local7.GetSavedRef and f105_local7.GetDefaultRef and f105_local7.SaveRef then + local f105_local3 = f105_local7.GetSavedRef( f105_arg0, f105_arg1, f105_arg2 ) + local f105_local4 = true + if f105_arg1 == "privateMatchSquadMembers" and Cac.IsCustomizationItemDLC( f105_local7, f105_local3 ) then + f105_local4 = Cac.IsCustomizationItemUnlocked( f105_arg0, f105_local7, f105_local3, true ) + else + f105_local4 = Cac.IsCustomizationItemUnlocked( f105_arg0, f105_local7, f105_local3, false ) + end + if f105_local3 and not f105_local4 then + local f105_local5 = Cac.GetCurrentGender( f105_arg0, f105_arg1, f105_arg2 ) + if f105_local7.GenderColumn and not Cac.IsCommonGender( f105_local5 ) then + Cac.ResetGenderDependantFields( f105_arg0, f105_arg1, f105_arg2, Cac.Customization.Gender.Male ) + else + f105_local7.SaveRef( f105_arg0, f105_arg1, f105_arg2, f105_local7.GetDefaultRef( f105_arg0, f105_local5 ) ) + end + end + end + end +end + diff --git a/lui/common_menus/cacutils.dec.lua b/lui/common_menus/cacutils.dec.lua new file mode 100644 index 0000000..1c72f4c --- /dev/null +++ b/lui/common_menus/cacutils.dec.lua @@ -0,0 +1,426 @@ +Cac = { + Settings = { + DataLoc = { + squadMembers = { + maxClassSlots = 10 + }, + privateMatchSquadMembers = { + maxClassSlots = 6 + }, + coopSquadMembers = { + maxClassSlots = 1 + }, + loadouts = { + maxClassSlots = 10, + baseClassSlots = 6 + }, + defaultClassesTeam0 = { + maxClassSlots = 6, + teamName = "allies" + }, + defaultClassesTeam1 = { + maxClassSlots = 6, + baseClassSlots = 6, + teamName = "axis", + infectedString = Engine.Localize( "LUA_MENU_INFECT_CAPS" ), + string = Engine.Localize( "@LUA_MENU_AXIS_CAPS" ) + }, + defaultClassesTeam2 = { + maxClassSlots = 6, + baseClassSlots = 6, + teamName = "allies", + infectedString = Engine.Localize( "LUA_MENU_MP_SURVIVORS_CAPS" ), + string = Engine.Localize( "@LUA_MENU_ALLIES_CAPS" ) + }, + defaultClassesTeam3 = { + teamName = "spectator" + } + }, + minUsableSlots = 5 + }, + MemberCost = { + 0, + 3, + 3, + 3, + 3, + 3, + 200, + 300, + 400, + 500 + } +} +if MatchRules then + MatchRules.AllowCustomClasses = function ( f1_arg0 ) + if not MatchRules.IsUsingMatchRulesData() then + return false + else + local f1_local0 + if f1_arg0 then + f1_local0 = Cac.IsDefaultClass( f1_arg0 ) + if not f1_local0 then + + elseif not f1_local0 then + return MatchRules.GetData( "commonOption", "allowCustomClasses" ) + else + + end + end + end + f1_local0 = false + end + +end +Cac.GetCacConfig = function ( f2_arg0, f2_arg1, f2_arg2, ... ) + local f2_local0 = { + ... + } + for f2_local1 = 1, #f2_local0, 1 do + if type( f2_local0[f2_local1] ) == "string" and Cac.IsDefaultClass( f2_local0[f2_local1] ) then + local f2_local4 = Cac.Settings.DataLoc[f2_local0[f2_local1]].teamName + local f2_local5 = f2_local0[f2_local1 + 1] + table.remove( f2_local0, 1 ) + table.remove( f2_local0, 1 ) + return MatchRules.GetData( "defaultClasses", f2_local4, f2_local5, "class", unpack( f2_local0 ) ) + end + end + local f2_local1 = CoD.GetStatsGroupForSquadLocation( f2_arg1 ) + if f2_local0[1] == "loadouts" and type( f2_local0[2] ) == "number" then + local f2_local2 = f2_local0[1] + local f2_local3 = f2_local0[2] + if Cac.Settings.DataLoc[f2_local2].baseClassSlots <= f2_local3 then + table.remove( f2_local0, 1 ) + table.remove( f2_local0, 1 ) + return Engine.GetPlayerDataExtendedEx( f2_arg0, f2_local1, f2_arg1, f2_arg2, f2_local2, f2_local3 - Cac.Settings.DataLoc[f2_local2].baseClassSlots, unpack( f2_local0 ) ) + end + end + return Engine.GetPlayerDataEx( f2_arg0, f2_local1, f2_arg1, f2_arg2, ... ) +end + +Cac.SetCacConfig = function ( f3_arg0, f3_arg1, f3_arg2, ... ) + local f3_local0 = { + ... + } + for f3_local1 = 1, #f3_local0, 1 do + if type( f3_local0[f3_local1] ) == "string" and Cac.IsDefaultClass( f3_local0[f3_local1] ) then + local f3_local4 = Cac.Settings.DataLoc[f3_local0[f3_local1]].teamName + local f3_local5 = f3_local0[f3_local1 + 1] + table.remove( f3_local0, 1 ) + table.remove( f3_local0, 1 ) + return MatchRules.SetData( "defaultClasses", f3_local4, f3_local5, "class", unpack( f3_local0 ) ) + end + end + local f3_local1 = CoD.GetStatsGroupForSquadLocation( f3_arg1 ) + if f3_local0[1] == "loadouts" and type( f3_local0[2] ) == "number" then + local f3_local2 = f3_local0[1] + local f3_local3 = f3_local0[2] + if Cac.Settings.DataLoc[f3_local2].baseClassSlots <= f3_local3 then + table.remove( f3_local0, 1 ) + table.remove( f3_local0, 1 ) + return Engine.SetPlayerDataExtendedEx( f3_arg0, f3_local1, f3_arg1, f3_arg2, f3_local2, f3_local3 - Cac.Settings.DataLoc[f3_local2].baseClassSlots, unpack( f3_local0 ) ) + end + end + return Engine.SetPlayerDataEx( f3_arg0, f3_local1, f3_arg1, f3_arg2, ... ) +end + +Cac.GetNumCustomSlots = function ( f4_arg0, f4_arg1 ) + if not f4_arg1 then + f4_arg1 = Cac.GetCustomClassLoc() + end + if Cac.IsDefaultClass( f4_arg1 ) or IsOnlineMatch() and (Engine.HasExtendedLoadouts( f4_arg0 ) or not IsPrivateMatch()) and Engine.GetDvarInt( "extendedLoadoutsEnable" ) == 1 then + return Cac.Settings.DataLoc[f4_arg1].maxClassSlots + else + return Cac.Settings.DataLoc[f4_arg1].baseClassSlots + end +end + +Cac.IsClassInUse = function ( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4 ) + local f5_local0 = nil + local f5_local1 = Cac.IsDefaultClass( f5_arg3 ) + if f5_arg1 == "privateMatchSquadMembers" and not f5_local1 and f5_arg4 < Cac.Settings.DataLoc[f5_arg3].baseClassSlots then + f5_local0 = true + else + f5_local0 = Cac.GetCacConfig( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, "inUse" ) + if not f5_local1 and Engine.InFrontend() and f5_arg4 <= 2 and not f5_local0 then + Cac.SetClassInUse( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, true ) + end + end + return f5_local0 +end + +Cac.SetClassInUse = function ( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4, f6_arg5 ) + if f6_arg5 == nil then + f6_arg5 = true + end + return Cac.SetCacConfig( f6_arg0, f6_arg1, f6_arg2, f6_arg3, f6_arg4, "inUse", f6_arg5 ) +end + +Cac.IsSquadMemberInUse = function ( f7_arg0, f7_arg1, f7_arg2 ) + local f7_local0 = nil + if f7_arg1 == "privateMatchSquadMembers" then + f7_local0 = true + else + f7_local0 = Cac.GetCacConfig( f7_arg0, f7_arg1, f7_arg2, "inUse" ) + end + return f7_local0 +end + +Cac.SetSquadMemberInUse = function ( f8_arg0, f8_arg1, f8_arg2 ) + return Cac.SetCacConfig( f8_arg0, f8_arg1, f8_arg2, "inUse", true ) +end + +Cac.HasCustomClasses = function ( f9_arg0, f9_arg1, f9_arg2, f9_arg3 ) + local f9_local0 = false + for f9_local1 = 0, Cac.GetNumCustomSlots( f9_arg0, f9_arg3 ) - 1, 1 do + if Cac.IsClassInUse( f9_arg0, f9_arg1, f9_arg2, f9_arg3, f9_local1 ) then + f9_local0 = true + break + end + end + return f9_local0 +end + +Cac.GetFirstCustomClass = function ( f10_arg0, f10_arg1, f10_arg2, f10_arg3 ) + for f10_local0 = 0, Cac.GetNumCustomSlots( f10_arg0, f10_arg3 ) - 1, 1 do + if Cac.IsClassInUse( f10_arg0, f10_arg1, f10_arg2, f10_arg3, f10_local0 ) then + return f10_local0 + end + end + assert( Cac.HasCustomClasses( f10_arg0, f10_arg1, f10_arg2, f10_arg3 ) ) + return 0 +end + +Cac.IsCaCSlotRestricted = function ( f11_arg0, f11_arg1, f11_arg2, f11_arg3, f11_arg4 ) + local f11_local0 = false + if MatchRules.AllowCustomClasses( f11_arg3 ) then + if not f11_arg3 then + f11_arg3 = Cac.GetCustomClassLoc() + end + if not Engine.InFrontend() and f11_arg3 == "loadouts" then + local f11_local1 = CoD.GetStatsGroupForGameMode() + if MatchRules.CustomClassIsRestricted( f11_arg0, CoD.GetStatsGroupForGameMode(), f11_arg1, f11_arg2, f11_arg3, f11_arg4 ) then + f11_local0 = true + end + end + end + return f11_local0 +end + +Cac.IsCaCSlotLocked = function ( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 ) + if not Cac.IsDefaultClass( f12_arg3 ) then + return not Cac.IsClassInUse( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 ) + else + + end +end + +Cac.GetSquadLoc = function () + local f13_local0 + if not Engine.GetDvarBool( "onlinegame" ) or Engine.GetDvarBool( "xblive_privatematch" ) then + f13_local0 = Engine.GetDvarBool( "force_ranking" ) + else + f13_local0 = true + end + if Engine.IsAliensMode() then + return "coopSquadMembers" + elseif f13_local0 then + return "squadMembers" + else + return "privateMatchSquadMembers" + end +end + +Cac.GetEditSquadMember = function () + return Engine.GetDvarInt( "ui_editSquadMemberIndex" ) or 0 +end + +Cac.SetEditSquadMember = function ( f15_arg0 ) + Engine.SetDvarInt( "ui_editSquadMemberIndex", f15_arg0 ) +end + +Cac.GetActiveSquadMember = function ( f16_arg0, f16_arg1 ) + local f16_local0 = f16_arg1 or CoD.GetStatsGroupForGameMode() + if f16_local0 ~= CoD.StatsGroup.Ranked or not "activeSquadMember" then + local f16_local1 = "privateMatchActiveSquadMember" + end + if Engine.IsAliensMode() then + local f16_local1 = "coopActiveSquadMember" + end + return Engine.GetPlayerDataEx( f16_arg0, f16_local0, f16_local1 ) +end + +Cac.SetActiveSquadMember = function ( f17_arg0, f17_arg1 ) + local f17_local0 = CoD.GetStatsGroupForGameMode() + local f17_local1 + if f17_local0 == CoD.StatsGroup.Ranked then + f17_local1 = "activeSquadMember" + if not f17_local1 then + + else + Engine.SetPlayerDataEx( f17_arg0, f17_local0, f17_local1, f17_arg1 ) + if f17_local0 == CoD.StatsGroup.Ranked then + syncXP( f17_arg0, f17_arg1 ) + end + Cac.SyncPrivateDataFromPlayercard( f17_arg0 ) + end + end + f17_local1 = "privateMatchActiveSquadMember" +end + +Cac.SyncPrivateDataFromPlayercard = function ( f18_arg0 ) + local f18_local0 = Engine.GetPlayerDataEx( f18_arg0, CoD.StatsGroup.Ranked, "activeSquadMember" ) + local f18_local1 = Engine.GetPlayerDataEx( f18_arg0, CoD.StatsGroup.Ranked, "squadMembers", f18_local0, "patch" ) + local f18_local2 = Engine.GetPlayerDataEx( f18_arg0, CoD.StatsGroup.Ranked, "squadMembers", f18_local0, "patchbacking" ) + local f18_local3 = Engine.GetPlayerDataEx( f18_arg0, CoD.StatsGroup.Ranked, "squadMembers", f18_local0, "background" ) + for f18_local4 = 0, Cac.Settings.DataLoc.privateMatchSquadMembers.maxClassSlots - 1, 1 do + Engine.SetPlayerDataEx( f18_arg0, CoD.StatsGroup.Private, "privateMatchSquadMembers", f18_local4, "patch", f18_local1 ) + Engine.SetPlayerDataEx( f18_arg0, CoD.StatsGroup.Private, "privateMatchSquadMembers", f18_local4, "patchbacking", f18_local2 ) + Engine.SetPlayerDataEx( f18_arg0, CoD.StatsGroup.Private, "privateMatchSquadMembers", f18_local4, "background", f18_local3 ) + end +end + +Cac.GetCustomClassLoc = function ( f19_arg0 ) + local f19_local0 = "loadouts" + if f19_arg0 ~= nil then + f19_local0 = f19_arg0 + elseif not MatchRules.AllowCustomClasses( f19_arg0 ) then + if not Engine.InFrontend() then + f19_local0 = "defaultClassesTeam1" + else + f19_local0 = "defaultClassesTeam1" + end + end + return f19_local0 +end + +Cac.GetLoadoutName = function ( f20_arg0, f20_arg1, f20_arg2, f20_arg3, f20_arg4 ) + local f20_local0 = Cac.GetCacConfig( f20_arg0, f20_arg1, f20_arg2, f20_arg3, f20_arg4, "name" ) + if f20_local0 == "" then + f20_local0 = Engine.Localize( "@MP_LOADOUT_DEFAULT_NAME", f20_arg4 + 1 ) + end + return f20_local0 +end + +Cac.MaxSquadMemberCount = function ( f21_arg0 ) + return Cac.Settings.DataLoc[f21_arg0].maxClassSlots +end + +Cac.ActiveSquadMemberCount = function ( f22_arg0, f22_arg1 ) + local f22_local0 = 0 + for f22_local1 = 0, Cac.MaxSquadMemberCount( f22_arg1 ) - 1, 1 do + if Cac.IsSquadMemberInUse( f22_arg0, f22_arg1, f22_local1 ) then + f22_local0 = f22_local0 + 1 + end + end + return f22_local0 +end + +Cac.AddNewSquadMember = function ( f23_arg0, f23_arg1 ) + local f23_local0 = Cac.ActiveSquadMemberCount( f23_arg0, f23_arg1 ) + if f23_local0 + 1 <= Cac.MaxSquadMemberCount( f23_arg1 ) then + Cac.SetSquadMemberInUse( f23_arg0, f23_arg1, f23_local0 ) + return f23_local0 + else + DebugPrint( "WARNING: Attempting to add squad member when we are already at max. Ignoring..." ) + end +end + +Cac.UnlockSquadMember = function ( f24_arg0, f24_arg1, f24_arg2 ) + if f24_arg2 < Cac.MaxSquadMemberCount( f24_arg1 ) then + Cac.SetSquadMemberInUse( f24_arg0, f24_arg1, f24_arg2 ) + else + DebugPrint( "WARNING: Attempting to unlock squad member past the max index. Ignoring..." ) + end + local f24_local0 = Cac.ActiveSquadMemberCount( f24_arg0, f24_arg1 ) + for f24_local1 = 1, f24_local0, 1 do + Engine.SetPlayerDataEx( f24_arg0, CoD.GetStatsGroupForGameMode(), "challengeState", "ch_squad_member" .. f24_local1 .. "_purchase", 2 ) + end +end + +Cac.GetSquadMemberName = function ( f25_arg0, f25_arg1, f25_arg2 ) + return Engine.GetPlayerDataEx( f25_arg0, CoD.GetStatsGroupForGameMode(), f25_arg1, f25_arg2, "name" ) +end + +Cac.SetSquadMemberName = function ( f26_arg0, f26_arg1, f26_arg2, f26_arg3 ) + return Engine.SetPlayerDataEx( f26_arg0, CoD.GetStatsGroupForGameMode(), f26_arg1, f26_arg2, "name", f26_arg3 ) +end + +Cac.HasSquadMemberPrestiged = function ( f27_arg0, f27_arg1, f27_arg2 ) + return Engine.GetPlayerDataEx( f27_arg0, CoD.GetStatsGroupForGameMode(), f27_arg1, f27_arg2, "squadMemXP" ) >= Rank.GetRankMaxXP( Rank.GetMaxRank() ) +end + +Cac.GetSquadMemberPrestigeLevel = function ( f28_arg0, f28_arg1, f28_arg2 ) + if not Cac.HasSquadMemberPrestiged( f28_arg0, f28_arg1, f28_arg2 ) then + return 0 + end + local f28_local0 = 1 + local f28_local1 = Engine.GetPlayerDataEx( f28_arg0, CoD.GetStatsGroupForGameMode(), "characterXP", f28_arg2 ) + for f28_local2 = 0, Cac.MaxSquadMemberCount( f28_arg1 ) - 1, 1 do + if f28_local2 ~= f28_arg2 and Cac.IsSquadMemberInUse( f28_arg0, f28_arg1, f28_local2 ) and Cac.HasSquadMemberPrestiged( f28_arg0, f28_arg1, f28_local2 ) and Engine.GetPlayerDataEx( f28_arg0, CoD.GetStatsGroupForGameMode(), "characterXP", f28_local2 ) < f28_local1 then + f28_local0 = f28_local0 + 1 + end + end + return f28_local0 +end + +Cac.GetPrestigeLevel = function ( f29_arg0, f29_arg1 ) + local f29_local0 = 0 + for f29_local1 = 0, Cac.MaxSquadMemberCount( f29_arg1 ) - 1, 1 do + if Cac.IsSquadMemberInUse( f29_arg0, f29_arg1, f29_local1 ) and Cac.HasSquadMemberPrestiged( f29_arg0, f29_arg1, f29_local1 ) then + f29_local0 = f29_local0 + 1 + end + end + return f29_local0 +end + +Cac.SyncPrestigeLevel = function ( f30_arg0 ) + Engine.SetPlayerDataEx( f30_arg0, CoD.GetStatsGroupForGameMode(), "prestige", Cac.GetPrestigeLevel( f30_arg0, Cac.GetSquadLoc() ) ) +end + +Cac.GetSquadMemberLoadoutUnlockCost = function ( f31_arg0 ) + if Cac.Settings.DataLoc.loadouts.baseClassSlots <= f31_arg0 then + return 0 + else + return 20 + (f31_arg0 - 3) * 5 + end +end + +Cac.ValidateAllPlayersPrivateSquadMembers = function () + for f32_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do + if Engine.HasActiveLocalClient( f32_local0 ) and Engine.HasPlayerData( f32_local0 ) then + if not Lobby.IsItemOfTypeUnlocked( f32_local0, "wolf", "DLC" ) then + DebugPrint( "You are not Entitled to the Wolf. So removing." ) + Engine.SetPlayerDataReservedInt( f32_local0, CoD.StatsGroup.Common, "mp_dog_type", 0 ) + end + for f32_local3 = 0, Cac.MaxSquadMemberCount( "privateMatchSquadMembers" ) - 1, 1 do + Cac.ValidateCustomizationItems( f32_local0, "privateMatchSquadMembers", f32_local3 ) + if not Engine.IsAliensMode() then + Cac.ValidateLoadoutItems( f32_local0, "privateMatchSquadMembers", f32_local3, "loadouts" ) + end + end + if not Engine.IsAliensMode() then + Cac.ValidateCustomizationItems( f32_local0, "squadMembers", Cac.GetActiveSquadMember( f32_local0, CoD.StatsGroup.Ranked ) ) + end + end + end +end + +Cac.ValidateAllPlayersPublicSquadMembers = function () + local f33_local0 = Cac.GetSquadLoc() + assert( f33_local0 ~= "privateMatchSquadMembers", "Cac.GetSquadLoc() returned private match location in public lobby." ) + for f33_local1 = 0, Engine.GetMaxControllerCount() - 1, 1 do + if Engine.HasActiveLocalClient( f33_local1 ) then + if not Lobby.IsItemOfTypeUnlocked( f33_local1, "wolf", "DLC" ) then + DebugPrint( "You are not Entitled to the Wolf. So removing." ) + Engine.SetPlayerDataReservedInt( f33_local1, CoD.StatsGroup.Common, "mp_dog_type", 0 ) + end + local f33_local4 = Cac.GetActiveSquadMember( f33_local1 ) + Cac.ValidateCustomizationItems( f33_local1, f33_local0, f33_local4 ) + if not Engine.IsAliensMode() then + Cac.ValidateLoadoutItems( f33_local1, "squadMembers", f33_local4, "loadouts" ) + end + end + end +end + diff --git a/lui/common_menus/commonpopups.dec.lua b/lui/common_menus/commonpopups.dec.lua new file mode 100644 index 0000000..18e0f16 --- /dev/null +++ b/lui/common_menus/commonpopups.dec.lua @@ -0,0 +1,2095 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function readingsavedevice() + return { + type = "generic_popup_message", + id = "readingsavedevice_id", + properties = { + message_text = Engine.Localize( "@PLATFORM_READING_SAVE_DEVICE" ) + }, + handlers = { + menu_close = MBh.EmitEventToRoot( { + name = "finish_read_device" + } ) + } + } +end + +f0_local0 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = Engine.GetDvarString( "com_errorTitle" ) + local f2_local1 = Engine.GetDvarString( "com_errorMessage" ) + local f2_local2 = { + name = "update_title", + title_text = f2_local0 + } + local f2_local3 = { + name = "update_message", + message_text = f2_local1 + } + f2_arg0:dispatchEventToChildren( f2_local2 ) + f2_arg0:dispatchEventToChildren( f2_local3 ) + local f2_local4 = Engine.GetLuiRoot() + if f2_local4:IsMenuOpenAndVisible( "menu_splitscreensignin" ) then + Engine.ExecNow( "incnosplitscreencontrol errorpopup" ) + end +end + +f0_local1 = function () + Engine.ClearError( Engine.GetFirstActiveController() ) + local f3_local0 = Engine.GetLuiRoot() + if f3_local0:IsMenuOpenAndVisible( "menu_splitscreensignin" ) then + Engine.ExecNow( "decnosplitscreencontrol errorpopup" ) + end +end + +function errorPopupClosePlus( f4_arg0, f4_arg1 ) + if Engine.ShowPSPlusUpsell then + Engine.ShowPSPlusUpsell( f4_arg1.controller ) + end +end + +function error_popmenu() + return { + type = "generic_confirmation_popup", + id = "error_popup_id", + handlers = { + menu_create = f0_local0 + } + } +end + +function error_popmenu_party() + return { + type = "generic_confirmation_popup", + id = "error_popmenu_party_id", + handlers = { + menu_create = f0_local0 + } + } +end + +function error_popmenu_psplus_party() + return { + type = "generic_confirmation_popup", + id = "error_popmenu_party_plus_id", + properties = { + confirmation_action = errorPopupClosePlus + }, + handlers = { + menu_create = f0_local0 + } + } +end + +f0_local2 = function ( f8_arg0, f8_arg1 ) + DebugPrint( "QUIT GAME NOW" ) + Engine.Quit() +end + +function quit_popmenu() + return { + type = "generic_yesno_popup", + id = "quit_confirmation_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MENU_QUIT_WARNING" ), + yes_action = f0_local2 + } + } +end + +function error_popmenu_submenu() + return { + type = "generic_confirmation_popup", + id = "error_popmenu_submenu_id", + handlers = { + menu_create = f0_local0 + } + } +end + +local f0_local3 = function ( f11_arg0, f11_arg1 ) + DebugPrint( "Applying video settings with restart..." ) + if Engine.GetDvarString( "gameMode" ) == "sp" and not Engine.GetDvarBool( "sv_running" ) then + if Engine.GetDvarInt( "ui_zfeather" ) == 1 then + Engine.Exec( "set cg_laserLight 1" ) + else + Engine.Exec( "set cg_laserLight 0" ) + end + end + Engine.ExecNow( "exec options_graphics_set.cfg" ) + Engine.Exec( "wait; wait; r_applyPicmip" ) + Engine.Exec( "setfromdvar snd_outputConfiguration ui_OutputConfig" ) + Engine.Exec( "setfromdvar snd_enableEq ui_snd_enableEq" ) + Engine.Exec( "snd_restart" ) + Engine.Exec( "regeneratePlaylistPopulationImage" ) +end + +local f0_local4 = function ( f12_arg0, f12_arg1 ) + DebugPrint( "Applying video settings..." ) + if Engine.GetDvarString( "gameMode" ) == "sp" and not Engine.GetDvarBool( "sv_running" ) then + if Engine.GetDvarInt( "ui_zfeather" ) == 1 then + Engine.Exec( "set cg_laserLight 1" ) + else + Engine.Exec( "set cg_laserLight 0" ) + end + end + Engine.ExecNow( "exec options_graphics_set.cfg" ) +end + +local f0_local5 = function ( f13_arg0, f13_arg1 ) + DebugPrint( "No setting video settings..." ) + Engine.ExecNow( "exec options_graphics.cfg" ) + Engine.Exec( "setfromdvar ui_snd_enableEq\tsnd_enableEq" ) + Engine.Exec( "setfromdvar ui_outputConfig\tsnd_outputConfiguration" ) + Engine.SetOldLocalVarBool( f13_arg1.controller, "ui_showAudioApply", false ) + Engine.SetOldLocalVarBool( f13_arg1.controller, "ui_showApply", false ) +end + +local f0_local6 = function ( f14_arg0 ) + local f14_local0 = {} + if not Engine.InFrontend() then + f14_local0[#f14_local0 + 1] = { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_PAUSED_CAPS" ) + } + } + f14_local0[#f14_local0 + 1] = { + type = "UIWorldBlur", + id = "world_blur_id", + states = { + default = { + worldBlur = 5 + } + } + } + end + return f14_local0 +end + +function apply_settings_restart_popmenu() + return { + type = "generic_yesno_popup", + id = "apply_video_restart_popmenu_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_APPLY_SETTINGS" ), + message_text = Engine.Localize( "@LUA_MENU_APPLY_SETTINGS_MESSAGE" ), + yes_action = f0_local3, + no_action = f0_local5 + }, + childrenFeeder = f0_local6 + } +end + +function apply_settings_popmenu() + return { + type = "generic_yesno_popup", + id = "apply_video_popmenu_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_APPLY_SETTINGS" ), + message_text = Engine.Localize( "@LUA_MENU_APPLY_SETTINGS_MESSAGE" ), + yes_action = f0_local4, + no_action = f0_local5 + }, + childrenFeeder = f0_local6 + } +end + +function show_low_texture_res_warning_restart_popmenu() + return { + type = "generic_yesno_popup", + id = "show_low_texture_res_warning_restart_popmenu_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_APPLY_SETTINGS" ), + message_text = Engine.Localize( "@MENU_VIDEO_SETTINGS_TEXTURE_WARNING" ), + yes_action = f0_local3, + no_action = f0_local5 + }, + childrenFeeder = f0_local6 + } +end + +function show_low_texture_res_warning_popmenu() + return { + type = "generic_yesno_popup", + id = "show_low_texture_res_warning_popmenu_id", + properties = { + popup_title = Engine.Localize( "@LUA_MENU_APPLY_SETTINGS" ), + message_text = Engine.Localize( "@MENU_VIDEO_SETTINGS_TEXTURE_WARNING" ), + yes_action = f0_local4, + no_action = f0_local5 + }, + childrenFeeder = f0_local6 + } +end + +local f0_local7 = function ( f19_arg0, f19_arg1 ) + Engine.Exec( "xsignin", f19_arg1.controller ) +end + +local f0_local8 = function ( f20_arg0, f20_arg1 ) + LUI.FlowManager.RequestAddMenu( f20_arg0, "boot_brightness", false, f20_arg1.controller, true, {} ) +end + +function no_profile_warning_popmenu() + return { + type = "generic_yesno_popup", + id = "no_profile_warning_popmenu_id", + properties = { + popup_title = Engine.Localize( "@MENU_WARNING" ), + message_text = Engine.Localize( "@MENU_SP_PROFILE_WARNING_SP" ), + yes_action = f0_local7, + no_action = f0_local8 + } + } +end + +local f0_local9 = function ( f22_arg0, f22_arg1 ) + Engine.DeleteProfile( f22_arg1.controller ) + Engine.Exec( "xsignin", f22_arg1.controller ) + LUI.FlowManager.RequestAddMenu( f22_arg0, "boot_brightness", false, f22_arg1.controller, true, {} ) +end + +function error_corrupt_savedata() + return { + type = "generic_confirmation_popup", + id = "error_corrupt_savedata_id", + properties = { + cancel_will_close = false, + popup_title = Engine.Localize( "@MENU_CORRUPT_SAVEDATA_TITLE" ), + message_text = Engine.Localize( "@MENU_CORRUPT_SAVEDATA_MESSAGE" ), + button_text = Engine.Localize( "@MENU_OK" ), + confirmation_action = f0_local9 + } + } +end + +local f0_local10 = function ( f24_arg0, f24_arg1 ) + Engine.RetrySaveData( f24_arg1.controller ) +end + +local f0_local11 = function ( f25_arg0, f25_arg1 ) + Engine.ClearSaveDataErrors( f25_arg1.controller ) +end + +function savedata_failed_popmenu() + return { + type = "generic_yesno_popup", + id = "savedata_failed_popmenu_id", + properties = { + popup_title = Engine.Localize( "@MENU_SAVEDATA_FAILED_TITLE" ), + message_text = Engine.Localize( "@MENU_SAVEDATA_FAILED_MESSAGE" ), + yes_action = f0_local10, + no_action = f0_local11 + } + } +end + +function no_profile_force_popmenu() + return { + type = "generic_confirmation_popup", + id = "no_profile_force_popmenu_id", + properties = { + popup_title = Engine.Localize( "@MENU_WARNING" ), + message_text = Engine.Localize( "@LUA_MENU_PROFILE_FORCE_SP" ), + button_text = Engine.Localize( "@MENU_OK" ) + } + } +end + +function live_party_invite_popmenu() + return { + type = "generic_yesno_popup", + id = "live_party_invite_popmenu_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@XBOXLIVE_PARTY_INVITE" ), + yes_text = Engine.Localize( "@XBOXLIVE_PARTY_INVITE_ACCEPT_NOW" ), + yes_action = function ( f29_arg0, f29_arg1 ) + Friends.AcceptLivePartyInvitation( f29_arg1.controller ) + end + , + no_text = Engine.Localize( "@XBOXLIVE_PARTY_INVITE_ACCEPT_LATER" ), + no_action = function ( f30_arg0, f30_arg1 ) + + end + + } + } +end + +function sign_in_as_sub_or_guest() + return { + type = "generic_yesno_popup", + id = "sign_in_as_sub_or_guest_id", + properties = { + popup_title = Engine.Localize( "@MENU_SIGN_IN_GUEST_OR_SUB_TITLE" ), + message_text = Engine.Localize( "@MENU_SIGN_IN_GUEST_OR_SUB_TEXT" ), + yes_text = Engine.Localize( "@MENU_SIGN_IN_GUEST_OR_SUB_YES" ), + yes_action = function ( f32_arg0, f32_arg1 ) + Lobby.DoSubSignIn( f32_arg1.controller ) + end + , + no_text = Engine.Localize( "@MENU_SIGN_IN_GUEST_OR_SUB_NO" ), + no_action = function ( f33_arg0, f33_arg1 ) + Lobby.DoGuestSignIn( f33_arg1.controller ) + end + + } + } +end + +function TryDisplayingAliensUnlockedPopup( f34_arg0 ) + if Engine.IsAliensMode( f34_arg0 ) then + Engine.Exec( "profile_SetKnowsAboutAliens", f34_arg0 ) + return false + end + local f34_local0 = Engine.IsUserSignedIn( f34_arg0 ) and Engine.UnlockedAliens() and Engine.GetProfileData( "knowsAboutAliens", f34_arg0 ) == false + if f34_local0 then + LUI.FlowManager.RequestPopupMenu( self, "aliens_unlocked_popup", true, f34_arg0, nil, nil, nil, nil, false ) + Engine.Exec( "profile_SetKnowsAboutAliens", f34_arg0 ) + end + return f34_local0 +end + +function aliens_unlocked_popup() + return { + type = "generic_confirmation_popup", + id = "aliens_unlocked_popup", + properties = { + popup_title = Engine.Localize( "MENU_NOTICE" ), + message_text = Engine.Localize( "LUA_MENU_UNLOCKED_ALIENS" ) + } + } +end + +function CancelAcceptingInvite( f36_arg0, f36_arg1 ) + local f36_local0 = f36_arg1.controller + Engine.SetDvarBool( "onlinegame", false ) + Engine.SetDvarBool( "systemlink", false ) + Engine.SetDvarBool( "specialops", false ) + Engine.SetDvarBool( "so_survival", false ) + Engine.Exec( "stopPrivateListen", f36_local0 ) + Engine.Exec( "coopStopSearch", f36_local0 ) + Engine.Exec( "useonlinestats 0", f36_local0 ) + Engine.Exec( "statsdownloadcancel", f36_local0 ) + Engine.Exec( "xstopparty WAITING_POPUP_CANCELED_ACTION", f36_local0 ) + Engine.Exec( "xstopprivateparty", f36_local0 ) + Engine.Exec( "xcancelconnectingdialog", f36_local0 ) + Engine.Exec( "forcesplitscreencontrol WAITING_POPUP_CANCELED_ACTION", f36_local0 ) + LUI.FlowManager.RequestLeaveMenu( f36_arg0 ) +end + +function popup_acceptinginvite() + return { + type = "live_dialog_text_box_with_cancel", + id = "popup_acceptinginvite_id", + properties = { + message = Engine.Localize( "@MENU_POPUP_ACCEPTINVITE" ), + cancel_func = CancelAcceptingInvite + } + } +end + +function UpdateTextDots( f38_arg0, f38_arg1 ) + assert( f38_arg0.properties.numDots ) + assert( f38_arg0.properties.message ) + local f38_local0 = f38_arg0.properties.numDots + local f38_local1 = f38_arg0.properties.message + f38_local0 = (f38_local0 + 1) % 4 + for f38_local2 = 1, f38_local0, 1 do + local f38_local5 = f38_local2 + f38_local1 = f38_local1 .. ". " + end + f38_arg0:setText( f38_local1 ) + f38_arg0.properties.numDots = f38_local0 +end + +function live_dialog_processing_widget() + local f39_local0 = 1 + local f39_local1 = 300 / 1.8 + local f39_local2 = { + alpha = 1, + scale = -1 + } + local f39_local3 = { + alpha = 1, + scale = 0.4 + } + local f39_local4 = { + alpha = 1, + scale = 0 + } + local f39_local5 = { + alpha = 0.25, + scale = 0 + } + local f39_local6 = MBh.AnimateSequence( { + { + "state0", + 0 / f39_local0 + }, + { + "state1", + 150 / f39_local0, + true, + true + }, + { + "state2", + 100 / f39_local0, + true, + true + }, + { + "state3", + 300 / f39_local0, + true, + true + } + } ) + return { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -DialogWidgetDims.Width / 2, + bottom = DialogWidgetDims.Width / 2, + left = -DialogWidgetDims.Width / 2, + right = DialogWidgetDims.Width / 2 + } + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = -16, + bottom = 0, + left = -16, + right = 0, + material = RegisterMaterial( "widg_loading_triangle" ), + alpha = 0.25 + }, + state0 = f39_local2, + state1 = f39_local3, + state2 = f39_local4, + state3 = f39_local5 + }, + handlers = { + tick_0 = f39_local6 + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -16, + bottom = 0, + left = 16, + right = 0, + material = RegisterMaterial( "widg_loading_triangle" ), + alpha = 0.25 + }, + state0 = f39_local2, + state1 = f39_local3, + state2 = f39_local4, + state3 = f39_local5 + }, + handlers = { + tick_1 = f39_local6 + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 16, + bottom = 0, + left = 16, + right = 0, + material = RegisterMaterial( "widg_loading_triangle" ), + alpha = 0.25 + }, + state0 = f39_local2, + state1 = f39_local3, + state2 = f39_local4, + state3 = f39_local5 + }, + handlers = { + tick_2 = f39_local6 + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 16, + bottom = 0, + left = -16, + right = 0, + material = RegisterMaterial( "widg_loading_triangle" ), + alpha = 0.25 + }, + state0 = f39_local2, + state1 = f39_local3, + state2 = f39_local4, + state3 = f39_local5 + }, + handlers = { + tick_3 = f39_local6 + } + }, + { + type = "UITimer", + id = "spinner_timer", + properties = { + event = "anim_arrow", + interval = f39_local1, + disposable = false + } + }, + { + type = "UIElement", + handlers = { + anim_arrow = function ( f40_arg0, f40_arg1 ) + f40_arg0.tick = f40_arg0.tick or 0 + local f40_local0 = f40_arg0:getParent() + f40_local0:processEvent( { + name = "tick_" .. f40_arg0.tick + } ) + f40_arg0.tick = (f40_arg0.tick + 1) % 4 + f40_arg0.tick = f40_arg0.tick and 0 or f40_arg0.tick + end + + } + } + } + } +end + +function live_dialog_popup_background() + return { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + children = { + { + type = "generic_drop_shadow", + properties = { + offset_shadow = 0 + } + }, + { + type = "generic_menu_background", + properties = { + top_offset = 0, + fill_alpha = 1 + } + } + }, + handlers = { + hide_popup_background = MBh.AnimateToState( "hidden", 0 ) + } + } +end + +function AddLiveDialogFooterHelperText( f42_arg0, f42_arg1 ) + local f42_local0 = LUI.ButtonHelperText.helper_text_item( ButtonMap.button_secondary, Engine.Localize( "@LUA_MENU_CANCEL" ), nil, nil, nil ) + f42_local0.triggers_event = "button_secondary" + f42_local0.id = "popup_cancel_text_id" + local f42_local1 = Engine.IsConsoleGame() + if not f42_local1 then + f42_local1 = Engine.IsGamepadEnabled() == 1 + end + local f42_local2 + if f42_local1 then + f42_local2 = 32 + if not f42_local2 then + + else + f42_local0:registerAnimationState( "default", { + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + left = -50, + right = 50, + bottom = -4, + height = f42_local2 + } ) + f42_local0:animateToState( "default" ) + f42_local0:registerEventHandler( "virtual_keyboard_popup_active", MBh.EmitEvent( "popup_active" ) ) + f42_arg0:addElement( f42_local0 ) + end + end + f42_local2 = CoD.TextSettings.SmallFont.Height +end + +function live_dialog_text_box_with_cancel() + local f43_local0 = { + type = "UIElement", + properties = { + message = "", + indent = 15, + cancel_func = function () + + end + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + } + } + local f43_local1 = {} + local f43_local2 = { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + red = 0.1, + green = 0.14, + blue = 0.16, + alpha = 0.85 + } + } + } + local f43_local3 = { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -75, + width = DialogPopupDims.Width, + height = DialogPopupDims.Height + } + } + } + local f43_local4 = {} + local f43_local5 = MBh.DoMultiple + local f43_local6 = {} + local f43_local7 = AddLiveDialogFooterHelperText + local f43_local8 = MBh.EmitEvent( "reposition_elements" ) + f43_local4.menu_create = f43_local5( f43_local7 ) + f43_local4.reposition_elements = function ( f45_arg0, f45_arg1 ) + local f45_local0 = 10 + local f45_local1, f45_local2, f45_local3, f45_local4 = GetTextDimensions( f45_arg0.properties.message, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f45_local5 = f45_local3 - f45_local1 + local f45_local6 = DialogWidgetDims.Width + f45_local0 + f45_local5 + local f45_local7 = f45_arg0:getChildById( "popup_text_id" ) + f45_local7:registerAnimationState( "updated", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -CoD.TextSettings.NormalFont.Height, + bottom = 0, + left = -1 * (f45_local6 * 0.5 - DialogWidgetDims.Width + f45_local0), + width = f45_local5 + f45_local0 + } ) + f45_local7:animateToState( "updated", 0 ) + local f45_local8 = f45_arg0:getChildById( "popup_diamond_id" ) + f45_local8:registerAnimationState( "updated", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -26, + left = -f45_local6 * 0.5, + height = DialogWidgetDims.Height, + width = DialogWidgetDims.Width + } ) + f45_local8:animateToState( "updated", 0 ) + end + + f43_local3.handlers = f43_local4 + f43_local3.children = { + { + type = "live_dialog_popup_background" + }, + { + type = "UIText", + id = "popup_text_id", + properties = { + message = MBh.Property( "message" ), + text = MBh.Property( "message" ), + indent = MBh.Property( "indent" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -CoD.TextSettings.NormalFont.Height, + bottom = 0, + left = 0, + right = 0, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b + } + } + }, + { + type = "live_dialog_processing_widget", + id = "popup_diamond_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -26, + width = DialogWidgetDims.Width, + height = DialogWidgetDims.Height + } + } + } + } + f43_local4 = { + type = "UIBindButton", + handlers = { + button_secondary = function ( f46_arg0, f46_arg1 ) + if f46_arg0.properties.cancel_func then + f46_arg0.properties:cancel_func( f46_arg1 ) + end + end + } + } + f43_local1[1] = f43_local2 + f43_local1[2] = f43_local3 + f43_local1[3] = f43_local4 + f43_local0.children = f43_local1 + return f43_local0 +end + +function live_dialog_text_box() + return { + type = "UIElement", + properties = { + message = "", + indent = 15, + overlay_alpha = 0.85, + top = -75, + left = -DialogPopupDims.Width / 2 + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + red = 0.1, + green = 0.14, + blue = 0.16, + alpha = MBh.Property( "overlay_alpha" ) + } + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = MBh.Property( "top" ), + left = MBh.Property( "left" ), + width = DialogPopupDims.Width, + height = DialogPopupDims.Height + } + }, + handlers = { + menu_create = MBh.EmitEvent( "reposition_elements" ), + reposition_elements = function ( f48_arg0, f48_arg1 ) + local f48_local0 = 10 + local f48_local1, f48_local2, f48_local3, f48_local4 = GetTextDimensions( f48_arg0.properties.message, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f48_local5 = f48_local3 - f48_local1 + local f48_local6 = DialogWidgetDims.Width + f48_local0 + f48_local5 + local f48_local7 = f48_arg0:getChildById( "popup_text_id" ) + f48_local7:registerAnimationState( "updated", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + height = CoD.TextSettings.NormalFont.Height, + left = -1 * (f48_local6 * 0.5 - DialogWidgetDims.Width + f48_local0), + width = f48_local5 + f48_local0 + } ) + f48_local7:animateToState( "updated", 0 ) + local f48_local8 = f48_arg0:getChildById( "popup_diamond_id" ) + f48_local8:registerAnimationState( "updated", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = -f48_local6 * 0.5, + height = DialogWidgetDims.Height, + width = DialogWidgetDims.Width + } ) + f48_local8:animateToState( "updated", 0 ) + end + + }, + children = { + { + type = "live_dialog_popup_background" + }, + { + type = "UIText", + id = "popup_text_id", + properties = { + message = MBh.Property( "message" ), + text = MBh.Property( "message" ), + indent = MBh.Property( "indent" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = 0, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b + } + } + }, + { + type = "live_dialog_processing_widget", + id = "popup_diamond_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + width = DialogWidgetDims.Width, + height = DialogWidgetDims.Height + } + } + } + } + } + } + } +end + +function live_multi_line_text_box() + return { + type = "UIElement", + properties = { + message = "", + overlay_alpha = 0.85, + dialog_width = DialogPopupDims.Width, + dialog_height = DialogPopupDims.Height + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + red = 0.1, + green = 0.14, + blue = 0.16, + alpha = MBh.Property( "overlay_alpha" ) + } + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = MBh.HalfOppositeProperty( "dialog_height" ), + left = MBh.HalfOppositeProperty( "dialog_width" ), + width = MBh.Property( "dialog_width" ), + height = MBh.Property( "dialog_height" ) + } + }, + children = { + { + type = "live_dialog_popup_background" + }, + { + type = "UIMarqueeText", + id = "popup_text_id", + properties = { + message = MBh.Property( "message" ), + text = MBh.Property( "message" ), + useTextWrapping = true, + textHeight = CoD.TextSettings.NormalFont.Height, + dialog_height = MBh.Property( "dialog_height" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 10, + left = DialogWidgetDims.Width + 20, + right = -10, + bottom = -10, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b + } + } + }, + { + type = "live_dialog_processing_widget", + id = "popup_diamond_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + left = 10, + width = DialogWidgetDims.Width, + height = DialogWidgetDims.Height + } + } + } + } + } + } + } +end + +function popup_connecting() + return { + type = "live_dialog_text_box_with_cancel", + id = "popup_connecting_id", + properties = { + message = Engine.Localize( "@XBOXLIVE_POPUP_CONNECTION" ), + cancel_func = LUI.common_menus.CommonPopups.CancelAcceptingInvite + } + } +end + +local f0_local12 = function ( f51_arg0, f51_arg1 ) + local f51_local0 = Engine.Localize( "@MENU_NOTICE" ) + local f51_local1 = Engine.GetDvarString( "online_end_reason" ) + f51_arg0:dispatchEventToChildren( { + name = "update_title", + title_text = f51_local0 + } ) + f51_arg0:dispatchEventToChildren( { + name = "update_message", + message_text = f51_local1 + } ) +end + +local f0_local13 = function ( f52_arg0, f52_arg1 ) + Engine.ResolveError( f52_arg1.controller ) +end + +function menu_online_ended() + return { + type = "generic_confirmation_popup", + id = "menu_online_ended", + properties = { + confirmation_action = f0_local13 + }, + handlers = { + menu_create = f0_local12 + } + } +end + +local f0_local14 = function ( f54_arg0, f54_arg1 ) + LUI.FlowManager.RequestCloseAllMenus( f54_arg0 ) + Engine.TogglePause() + f54_arg0:dispatchEventToRoot( { + name = "toggle_pause_off" + } ) +end + +local f0_local15 = function ( f55_arg0, f55_arg1 ) + LUI.FlowManager.RequestAddMenu( f55_arg0, "save_game_info_hud", true, f55_arg1.controller, false ) +end + +local f0_local16 = function ( f56_arg0, f56_arg1 ) + Engine.Exec( "disconnect" ) + Engine.AcceptInvite() +end + +function SaveGameErrorCreate( f57_arg0, f57_arg1 ) + LUI.FlowManager.RequestLeaveMenuByName( "save_game_info_hud" ) +end + +function SaveGameErrorFeeder( f58_arg0 ) + local f58_local0 = Engine.GetDvarBool( "sv_saveDeviceAvailable" ) + if not f58_local0 then + f58_local0 = Engine.IsPS4() + end + local f58_local1 = Engine.IsXbox360() + if f58_local1 then + f58_local1 = Engine.GetDvarBool( "sv_saveGameAvailable" ) + end + local f58_local2 = {} + local f58_local3 = "" + if f58_local0 then + if f58_local1 then + f58_local3 = Engine.Localize( "@MENU_WARNING_CHECKPOINT_RESET" ) + elseif Engine.IsPS4() then + f58_local3 = Engine.Localize( "@PLATFORM_SAVE_ERROR" ) + else + f58_local3 = Engine.Localize( "@MENU_NO_SAVE_DEVICE_WARNING_NOW_OKAY" ) + end + else + f58_local3 = Engine.Localize( "@MENU_NO_SAVE_DEVICE_WARNING" ) + end + f58_local2[#f58_local2 + 1] = { + type = "UIText", + id = "desc_text", + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + red = 1, + green = 1, + blue = 1 + } + }, + properties = { + text = f58_local3 + } + } + local f58_local4 = "" + if f58_local0 then + if f58_local1 then + f58_local4 = Engine.Localize( "@MENU_OVERWRITE_SAVE" ) + else + f58_local4 = Engine.Localize( "@MENU_RETRY_SAVE" ) + end + else + f58_local4 = Engine.Localize( "@PLATFORM_SELECT_SAVE_DEVICE" ) + end + f58_local2[#f58_local2 + 1] = { + type = "UIGenericButton", + id = "first_button", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = f58_local4, + button_action_func = function ( f59_arg0, f59_arg1 ) + if f58_local0 then + f0_local15( f59_arg0, f59_arg1 ) + else + Engine.ForceSelectSaveDevice( f59_arg1.controller ) + if Engine.GetDvarBool( "sv_saveDeviceAvailable" ) then + LUI.FlowManager.RequestLeaveMenu( f59_arg0 ) + Engine.TogglePause() + end + end + end + } + } + f58_local2[#f58_local2 + 1] = { + type = "UIGenericButton", + id = "resume_game_nosave", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@MENU_RESUMEGAME_NOSAVE" ), + button_action_func = function ( f60_arg0, f60_arg1 ) + f0_local14( f60_arg0, f60_arg1 ) + Engine.SaveRevert() + end + } + } + f58_local2[#f58_local2 + 1] = { + type = "UIGenericButton", + id = "quit_nosave", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@MENU_QUIT_NO_SAVE" ), + button_action_func = function ( f61_arg0, f61_arg1 ) + Engine.SaveRevert() + LUI.FlowManager.RequestPopupMenu( f61_arg0, "quit_confirm_popup", false, f61_arg1.controller, false ) + end + } + } + if f58_local0 and not Engine.IsPS4() then + f58_local2[#f58_local2 + 1] = { + type = "UIGenericButton", + id = "reselect_save_device", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@PLATFORM_RESELECT_SAVE_DEVICE" ), + button_action_func = function ( f62_arg0, f62_arg1 ) + Engine.ForceSelectSaveDevice( f62_arg1.controller ) + end + } + } + end + return f58_local2 +end + +function save_game_error_popup() + local f63_local0 = Engine.GetDvarBool( "sv_saveDeviceAvailable" ) + local f63_local1 = { + type = "generic_selectionList_popup", + id = "save_game_error_popup_id" + } + local f63_local2 = { + cancel_will_close = false + } + local f63_local3 + if f63_local0 then + f63_local3 = Engine.Localize( "@PLATFORM_SAVE_ERROR_NOW_OKAY" ) + if not f63_local3 then + + else + f63_local2.popup_title = f63_local3 + f63_local2.popup_childfeeder = SaveGameErrorFeeder + f63_local1.properties = f63_local2 + f63_local1.handlers = { + menu_create = SaveGameErrorCreate + } + return f63_local1 + end + end + f63_local3 = Engine.Localize( "@PLATFORM_SAVE_ERROR" ) +end + +function LostSelectedSaveDevicePopupConfirm( f64_arg0, f64_arg1 ) + Engine.Exec( "select_save_device" ) +end + +function lost_selected_save_device_popup() + return { + type = "generic_confirmation_popup", + id = "lost_selected_save_device_popup_id", + properties = { + message_text = Engine.Localize( "@PLATFORM_SAVE_DEVICE_LOST" ) + }, + handlers = { + menu_close = LostSelectedSaveDevicePopupConfirm + } + } +end + +local f0_local17 = function ( f66_arg0, f66_arg1 ) + CoDAnywhere.IntegrateCACFile() +end + +local f0_local18 = function ( f67_arg0, f67_arg1 ) + CoDAnywhere.DeleteCACFile() +end + +function cac_elite_popup() + return { + type = "generic_yesno_popup", + id = "cac_elite_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_COD_MOBILE_APP_DATA_TITLE" ), + squadMembersChanged = 1, + loadoutsChanged = 2, + modifiedDay = 1, + modifiedMonth = 10, + modifiedYear = 2013, + message_text = Engine.GetDvarString( "mobile_app_data_available" ), + yes_action = f0_local17, + no_action = f0_local18, + yes_text = Engine.Localize( "@MENU_YES" ), + no_text = Engine.Localize( "@MENU_NO" ) + } + } +end + +local f0_local19 = function ( f69_arg0, f69_arg1 ) + Engine.Exec( "disconnect" ) +end + +function quit_no_save_confirm_popup() + return { + type = "generic_yesno_popup", + id = "quit_no_save_confirm_popup_id", + properties = { + popup_title = Engine.Localize( "@PLATFORM_QUIT" ), + message_text = Engine.Localize( "@MENU_QUIT_WARNING" ), + yes_action = f0_local19, + yes_text = Engine.Localize( "@MENU_QUIT" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function quit_confirm_popup() + return { + type = "generic_yesno_popup", + id = "quit_confirm_popup_id", + properties = { + popup_title = Engine.Localize( "@PLATFORM_QUIT" ), + message_text = Engine.Localize( "@MENU_ARE_YOU_SURE_QUIT" ), + yes_action = f0_local19, + yes_text = Engine.Localize( "@MENU_QUIT" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function save_and_quit_confirm_popup() + return { + type = "generic_yesno_popup", + id = "save_and_quit_confirm_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_QUIT_WARNING" ), + message_text = Engine.Localize( "@MENU_SAVEQUIT_TEXT_1" ) .. Engine.Localize( "@MENU_SAVEQUIT_TEXT_2" ) .. Engine.Localize( "@MENU_SAVEQUIT_TEXT_3" ), + yes_action = f0_local15, + yes_text = Engine.Localize( "@CGAME_CONTINUE_SAVING" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function save_and_quit_confirm_invited_popup() + return { + type = "generic_yesno_popup", + id = "save_and_quit_confirm_invited_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_CONTINUE_SAVING" ), + message_text = Engine.Localize( "@MENU_SAVEQUIT_TEXT_1" ) .. Engine.Localize( "@MENU_SAVEQUIT_TEXT_2" ) .. Engine.Localize( "@MENU_SAVEQUIT_TEXT_3" ), + yes_action = f0_local15, + no_action = f0_local16, + yes_text = Engine.Localize( "@CGAME_CONTINUE_SAVING" ), + no_text = Engine.Localize( "@MENU_CONTINUE_WITHOUT_SAVING" ) + } + } +end + +local f0_local20 = function () + return { + type = "UIText", + id = "save_game_loading_hud_id", + properties = { + text = Engine.Localize( "@CGAME_NOW_SAVING" ), + textStyle = CoD.TextStyle.Shadowed + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 80, + bottom = 120, + left = 0, + right = 0, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alignment = LUI.Alignment.Center, + red = 1, + green = 1, + blue = 1 + } + } + } +end + +local f0_local21 = function ( f75_arg0, f75_arg1 ) + Engine.SetSaveExecOnSuccess( "disconnect" ) + Engine.SetDvarBool( "ui_skipMainLockout", true ) + Engine.SaveDelay() + Engine.WriteSave() +end + +local f0_local22 = function ( f76_arg0, f76_arg1 ) + if f76_arg1.finished then + Engine.SaveComplete() + end +end + +local f0_local23 = function () + return { + type = "UIElement", + id = "save_game_info_hud_id", + states = { + default = { + topAnchor = true, + leftAnchor = true, + rightAnchor = true, + botomAnchor = true + } + }, + handlers = { + menu_create = f0_local21, + save_event = f0_local22 + }, + children = { + { + type = "UIOwnerdraw", + id = "save_game_info_background", + properties = { + ownerDraw = CoD.Ownerdraw.CGMissionObjectiveBackdrop + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + red = 0, + green = 0, + blue = 0, + alpha = 0.5 + } + } + }, + { + type = "UIText", + id = "save_game_info_text", + properties = { + text = Engine.Localize( "@CGAME_NOW_SAVING" ), + textStyle = CoD.TextStyle.Shadowed + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 80, + bottom = 120, + left = 150, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Center, + red = 1, + green = 1, + blue = 1 + } + } + } + } + } +end + +local f0_local24 = function ( f78_arg0 ) + return Engine.MarkLocalized( string.format( "%02d", f78_arg0 ) ) +end + +local f0_local25 = function ( f79_arg0, f79_arg1 ) + local f79_local0, f79_local1 = Engine.StreamingCheckInstall() + if f79_local0 == nil then + f79_local0 = 0 + end + local f79_local2 = f79_arg0:getFirstDescendentById( "middle" ) + if f79_local2 ~= nil then + f79_local2:registerAnimationState( "move_bar", { + right = f79_local2.properties.m_maxWidth * f79_local0 + } ) + f79_local2:animateToState( "move_bar", 150 ) + end + if f79_local1 > 0 then + local f79_local3 = f79_arg0:getFirstDescendentById( "streaming_install_seconds_remaining" ) + if f79_local3 ~= nil then + local f79_local4 = nil + local f79_local5 = math.floor( f79_local1 / 3600 ) + local f79_local6 = math.floor( f79_local1 / 60 - f79_local5 * 60 ) + f79_local3:setText( Engine.Localize( "@MENU_SP_STREAMING_INSTALL_REMAINING", f0_local24( f79_local5 ), f0_local24( f79_local6 ), f0_local24( f79_local1 - f79_local6 * 60 - f79_local5 * 3600 ) ) ) + end + end +end + +local f0_local26 = 104 +local f0_local27 = 416 +local f0_local28 = 26 +local f0_local29 = 341 +local f0_local30 = 416 +local f0_local31 = 26 +local f0_local32 = 26 +local f0_local33 = function () + return { + type = "generic_selectionList_popup", + id = "streaming_install_base_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MENU_SP_STREAMING_INSTALL" ), + button_text = Engine.Localize( "@LUA_MENU_CANCEL" ), + confirmation_action = MBh.LeaveMenu(), + message_text_alignment = LUI.Alignment.Center, + callback_params = {}, + padding_top = 12, + popup_childfeeder = function () + return { + { + type = "UIText", + id = "message_text_id", + properties = { + text = MBh.Property( "message_text" ), + message_text_alignment = MBh.Property( "message_text_alignment" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + left = 12, + right = -12, + alignment = MBh.Property( "message_text_alignment" ), + font = CoD.TextSettings.NormalFont.Font, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + }, + handlers = { + update_message = setMessageText + } + }, + { + type = "UIElement", + id = "spacer1", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 40 + } + } + }, + { + type = "UIImage", + id = "bar_bg", + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + width = f0_local27, + top = 0, + bottom = f0_local26, + red = 1, + green = 1, + blue = 1, + alpha = 1, + material = RegisterMaterial( "capturing_bg_mp" ) + } + }, + children = { + { + type = "UIHorizontalList", + id = "streaming_bar_hl", + states = { + default = { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + bottom = -53, + left = 43, + height = f0_local28, + width = f0_local29, + alignment = LUI.Alignment.Left, + spacing = 0, + alpha = 1 + } + }, + children = { + { + type = "UIImage", + id = "start_cap", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = f0_local28, + width = f0_local32, + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b, + alpha = 1, + material = RegisterMaterial( "capturing_bar_start_mp" ) + } + } + }, + { + type = "UIImage", + id = "middle", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 0, + height = f0_local28, + width = 0, + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b, + alpha = 1, + material = RegisterMaterial( "capturing_bar_mp" ) + } + }, + properties = { + m_maxWidth = f0_local29 - f0_local32 - f0_local32 + } + }, + { + type = "UIImage", + id = "end_cap", + states = { + default = { + topAnchor = true, + rightAnchor = true, + top = 0, + right = 0, + height = f0_local28, + width = f0_local32, + red = Colors.cyan.r, + green = Colors.cyan.g, + blue = Colors.cyan.b, + alpha = 1, + material = RegisterMaterial( "capturing_bar_end_mp" ) + } + } + } + } + } + } + }, + { + type = "UIText", + id = "streaming_install_seconds_remaining", + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + red = 1, + green = 1, + blue = 1 + } + }, + properties = { + text = "" + } + }, + { + type = "UIGenericButton", + id = "exit_button_id", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = MBh.Property( "button_text" ), + confirmation_action = MBh.Property( "confirmation_action" ), + button_action_func = function ( f82_arg0, f82_arg1 ) + f82_arg0.properties:confirmation_action( f82_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f82_arg0 ) + end + , + callback_params = MBh.Property( "callback_params" ) + } + } + } + end + + }, + children = { + { + type = "UITimer", + id = "streaming_install_timer", + properties = { + event = "refresh_streaming_install_progress", + interval = 500, + disposable = false + } + } + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + handlers = { + menu_create = SetupStreamingInstallRefreshTimer, + refresh_streaming_install_progress = f0_local25 + } + } +end + +local f0_local34 = function () + return { + type = "streaming_install_base", + properties = { + button_text = Engine.Localize( "@LUA_MENU_BACK" ), + confirmation_action = MBh.LeaveMenu() + } + } +end + +local f0_local35 = function () + return { + type = "streaming_install_base", + properties = { + cancel_will_close = false, + button_text = Engine.Localize( "@MENU_MAIN_MENU" ), + confirmation_action = function ( f85_arg0, f85_arg1 ) + if Engine.IsSaveAvailable() then + f0_local15( f85_arg0, f85_arg1 ) + else + f0_local19( f85_arg0, f85_arg1 ) + end + end + + } + } +end + +function menu_ps3_ui_bg() + return { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + red = 0.1, + green = 0.14, + blue = 0.16, + alpha = 0.85 + } + } + } +end + +local f0_local36 = function ( f87_arg0, f87_arg1 ) + local f87_local0 = Engine.GetLuiRoot() + Engine.ExecNow( "profile_toggleEnableGamepad" ) + LUI.FlowManager.tryAddMouseCursor( f87_local0 ) + Engine.Exec( "updategamerprofile" ) +end + +if Engine.IsConsoleGame() then + function controllerremoved_popmenu() + return { + type = "generic_popup_message", + id = "controller_removed_id", + properties = { + message_text = Engine.Localize( "@PLATFORM_CONTROLLER_DISCONNECTED" ) + } + } + end + +else + function controllerremoved_popmenu() + return { + type = "generic_confirmation_popup", + id = "controller_removed_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@PLATFORM_CONTROLLER_DISCONNECTED" ), + button_text = Engine.Localize( "@MENU_SWITCH_TO_MOUSE" ), + confirmation_action = f0_local36 + } + } + end + +end +if not Engine.IsConsoleGame() then + function steam_overlay_required() + return { + type = "generic_confirmation_popup", + id = "steam_overlay_required_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@PLATFORM_UI_STEAM_OVERLAY_REQUIRED" ) + } + } + end + +end +function ConfirmProfileChange( f91_arg0, f91_arg1 ) + DebugPrint( "Confirm profile change" ) + Engine.ConfirmXB3UserProfileChange( f91_arg1.controller ) + LUI.FlowManager.RequestLeaveMenu( f91_arg0 ) +end + +function IgnoreProfileChange( f92_arg0, f92_arg1 ) + DebugPrint( "Ignore profile change" ) + Engine.IgnoreXB3UserProfileChange( f92_arg1.controller ) + LUI.FlowManager.RequestLeaveMenu( f92_arg0 ) +end + +function user_changed_confirm_mp() + return { + type = "generic_yesno_popup", + properties = { + message_text = Engine.Localize( "@MENU_PROFILE_PAIRING_CONFIRM" ), + popup_title = Engine.Localize( "@MENU_WARNING" ), + yes_text = Engine.Localize( "@MENU_YES" ), + no_text = Engine.Localize( "@MENU_NO" ), + yes_action = IgnoreProfileChange, + no_action = ConfirmProfileChange, + default_focus_index = 1 + } + } +end + +function controller_changed_confirm_mp() + return { + type = "generic_confirmation_popup", + properties = { + message_text = Engine.Localize( "@MENU_CONTROLLER_PAIRING_CONFIRM" ), + popup_title = Engine.Localize( "@MENU_WARNING" ) + } + } +end + +function updating_squad_reports() + return { + type = "UIElement", + id = "updating_squad_reports_id", + handlers = { + finish_report_update = MBh.LeaveMenu() + }, + children = { + { + type = "live_dialog_text_box", + id = "live_dialog_text_box_id", + properties = { + message = Engine.Localize( "LUA_MENU_UPDATING_REPORTS" ) + } + }, + { + type = "UITimer", + id = "updating_squad_reports_timer", + properties = { + event = "finish_report_update", + interval = 1500 + } + } + } + } +end + +function recipe_load_failed_popup() + return { + type = "generic_confirmation_popup", + id = "recipe_load_failed_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MPUI_RECIPE_LOAD_FAILED" ) + } + } +end + +function recipe_save_failed_popup() + return { + type = "generic_confirmation_popup", + id = "recipe_save_failed_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MPUI_RECIPE_SAVE_FAILED" ) + } + } +end + +function recipe_save_failed_no_guests_popup() + return { + type = "generic_confirmation_popup", + id = "recipe_save_failed_no_guests_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MPUI_RULES_NOGUESTSAVE" ) + } + } +end + +function recipe_save_failed_no_device_popup() + return { + type = "generic_confirmation_popup", + id = "recipe_save_failed_no_device_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MPUI_RULES_NOSAVEDEVICE" ) + } + } +end + +function no_controller_initial_popup() + return { + type = "generic_yesno_popup", + id = "no_controller_initial_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MENU_NO_CONTROLLER_INITIAL" ), + yes_action = f0_local36 + } + } +end + +local f0_local37 = function ( f101_arg0, f101_arg1 ) + Engine.ExecNow( "profile_toggleEnableGamepad 1" ) + Engine.ExecNow( "updategamerprofile" ) + f101_arg0:dispatchEventToRoot( { + name = "refresh_button_helper", + dispatchChildren = true + } ) + f101_arg0:dispatchEventToRoot( { + name = "refresh_button_background" + } ) +end + +local f0_local38 = function ( f102_arg0, f102_arg1 ) + Engine.ExecNow( "profile_toggleEnableGamepad 0" ) + Engine.ExecNow( "updategamerprofile" ) +end + +function controller_initial_popup() + return { + type = "generic_yesno_popup", + id = "controller_initial_popup_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MENU_CONTROLLER_INITIAL" ), + yes_action = f0_local37, + no_action = f0_local38 + } + } +end + +if Engine.IsXbox360() then + function required_dlc_download_initiated() + return { + type = "generic_confirmation_popup", + id = "required_dlc_download_initiated", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_REQUIRED_DLC_DOWNLOAD_INITIATED" ), + button_text = Engine.Localize( "@MENU_OK" ) + } + } + end + + function required_dlc_download_failed() + return { + type = "generic_confirmation_popup", + id = "required_dlc_download_failed", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_REQUIRED_DLC_DOWNLOAD_FAILED" ), + button_text = Engine.Localize( "@MENU_OK" ) + } + } + end + +end +LUI.MenuBuilder.registerDef( "live_dialog_text_box_with_cancel", live_dialog_text_box_with_cancel ) +LUI.MenuBuilder.registerDef( "live_dialog_text_box", live_dialog_text_box ) +LUI.MenuBuilder.registerDef( "live_multi_line_text_box", live_multi_line_text_box ) +LUI.MenuBuilder.registerDef( "live_dialog_processing_widget", live_dialog_processing_widget ) +LUI.MenuBuilder.registerDef( "live_dialog_popup_background", live_dialog_popup_background ) +LUI.MenuBuilder.registerDef( "error_popmenu_party", error_popmenu_party ) +LUI.MenuBuilder.registerDef( "error_popmenu_psplus_party", error_popmenu_psplus_party ) +LUI.MenuBuilder.registerDef( "live_party_invite_popmenu", live_party_invite_popmenu ) +LUI.MenuBuilder.registerDef( "sign_in_as_sub_or_guest", sign_in_as_sub_or_guest ) +LUI.MenuBuilder.registerDef( "aliens_unlocked_popup", aliens_unlocked_popup ) +LUI.MenuBuilder.registerDef( "popup_acceptinginvite", popup_acceptinginvite ) +LUI.MenuBuilder.registerDef( "popup_connecting", popup_connecting ) +LUI.MenuBuilder.registerDef( "error_popmenu_submenu", error_popmenu_submenu ) +LUI.MenuBuilder.registerDef( "readingsavedevice", readingsavedevice ) +LUI.MenuBuilder.registerDef( "error_corrupt_savedata", error_corrupt_savedata ) +LUI.MenuBuilder.registerDef( "savedata_failed_popmenu", savedata_failed_popmenu ) +LUI.MenuBuilder.registerDef( "error_popmenu", error_popmenu ) +LUI.MenuBuilder.registerDef( "quit_popmenu", quit_popmenu ) +LUI.MenuBuilder.registerDef( "apply_settings_popmenu", apply_settings_popmenu ) +LUI.MenuBuilder.registerDef( "apply_settings_restart_popmenu", apply_settings_restart_popmenu ) +LUI.MenuBuilder.registerDef( "show_low_texture_res_warning_restart_popmenu", show_low_texture_res_warning_restart_popmenu ) +LUI.MenuBuilder.registerDef( "show_low_texture_res_warning_popmenu", show_low_texture_res_warning_popmenu ) +LUI.MenuBuilder.registerDef( "no_profile_warning_popmenu", no_profile_warning_popmenu ) +LUI.MenuBuilder.registerDef( "no_profile_force_popmenu", no_profile_force_popmenu ) +LUI.MenuBuilder.registerDef( "quit_no_save_confirm_popup", quit_no_save_confirm_popup ) +LUI.MenuBuilder.registerDef( "quit_confirm_popup", quit_confirm_popup ) +LUI.MenuBuilder.registerDef( "save_and_quit_confirm_popup", save_and_quit_confirm_popup ) +LUI.MenuBuilder.registerDef( "save_and_quit_confirm_invited_popup", save_and_quit_confirm_invited_popup ) +LUI.MenuBuilder.registerDef( "save_game_error_popup", save_game_error_popup ) +LUI.MenuBuilder.registerDef( "lost_selected_save_device_popup", lost_selected_save_device_popup ) +LUI.MenuBuilder.registerDef( "save_game_loading_hud", f0_local20 ) +LUI.MenuBuilder.registerDef( "save_game_info_hud", f0_local23 ) +LUI.MenuBuilder.registerDef( "streaming_install_base", f0_local33 ) +LUI.MenuBuilder.registerDef( "streaming_install_frontend", f0_local34 ) +LUI.MenuBuilder.registerDef( "streaming_install_ingame", f0_local35 ) +LUI.MenuBuilder.registerDef( "menu_ps3_ui_bg", menu_ps3_ui_bg ) +LUI.MenuBuilder.registerDef( "menu_online_ended", menu_online_ended ) +LUI.MenuBuilder.registerDef( "controllerremoved_popmenu", controllerremoved_popmenu ) +LUI.MenuBuilder.registerDef( "user_changed_confirm_mp", user_changed_confirm_mp ) +LUI.MenuBuilder.registerDef( "controller_changed_confirm_mp", controller_changed_confirm_mp ) +LUI.MenuBuilder.registerDef( "cac_elite_popup", cac_elite_popup ) +LUI.MenuBuilder.registerDef( "updating_squad_reports", updating_squad_reports ) +LUI.MenuBuilder.registerDef( "recipe_load_failed_popup", recipe_load_failed_popup ) +LUI.MenuBuilder.registerDef( "recipe_save_failed_popup", recipe_save_failed_popup ) +LUI.MenuBuilder.registerDef( "recipe_save_failed_no_guests_popup", recipe_save_failed_no_guests_popup ) +LUI.MenuBuilder.registerDef( "recipe_save_failed_no_device_popup", recipe_save_failed_no_device_popup ) +LUI.MenuBuilder.registerDef( "no_controller_initial_popup", no_controller_initial_popup ) +LUI.MenuBuilder.registerDef( "controller_initial_popup", controller_initial_popup ) +if not Engine.IsConsoleGame() then + LUI.MenuBuilder.registerDef( "steam_overlay_required", steam_overlay_required ) +end +LUI.FlowManager.RegisterStackPopBehaviour( "error_popmenu", f0_local1 ) +LUI.FlowManager.RegisterStackPopBehaviour( "error_popmenu_party", f0_local1 ) +LUI.FlowManager.RegisterStackPopBehaviour( "error_popmenu_submenu", f0_local1 ) +LUI.FlowManager.RegisterStackPopBehaviour( "error_popmenu_psplus_party", f0_local1 ) +if Engine.IsXbox360() then + LUI.MenuBuilder.registerDef( "required_dlc_download_initiated", required_dlc_download_initiated ) + LUI.MenuBuilder.registerDef( "required_dlc_download_failed", required_dlc_download_failed ) +end +LockTable( _M ) diff --git a/lui/common_menus/friendslist.dec.lua b/lui/common_menus/friendslist.dec.lua new file mode 100644 index 0000000..11de9d7 --- /dev/null +++ b/lui/common_menus/friendslist.dec.lua @@ -0,0 +1,2760 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function StartChallenge( f1_arg0, f1_arg1 ) + local f1_local0, f1_local1 = f1_arg1( f1_arg0 ) + if f1_local0 ~= -1 and f1_local1 ~= -1 and Playlist.DoAction( f1_local0, f1_local1, false, false ) then + Squad.StartMatch( f1_arg0, false ) + Engine.SetDvarBool( "squad_find_match", true ) + LUI.FlowManager.RequestAddMenu( nil, "menu_xboxlive_lobby", false, f1_arg0, false, {} ) + end +end + +function ChallengeFriend( f2_arg0 ) + StartChallenge( f2_arg0, Squad.FightFriend ) +end + +function ChallengeRecentPlayer( f3_arg0 ) + StartChallenge( f3_arg0, Squad.FightRecentPlayer ) +end + +function ChallengeLivePartyPlayer( f4_arg0 ) + StartChallenge( f4_arg0, Squad.FightLivePartyPlayer ) +end + +function popup_elite_clan_updating() + return { + type = "live_dialog_text_box", + id = "popup_elite_clan_updating_id", + properties = { + message = Engine.Localize( "@MENU_FACEBOOK_UPLOADING" ) + } + } +end + +function popup_update_clan_finished() + local f6_local0 + if Engine.MarkLocalized( Engine.GetDvarString( "elite_clan_single_task_popup_text" ) ) == Engine.Localize( "MENU_CLAN_CREATED" ) then + f6_local0 = Engine.Localize( "PATCH_MENU_CONGRATULATIONS" ) + if not f6_local0 then + + else + return { + type = "generic_confirmation_popup", + id = "popup_update_clan_finished", + properties = { + popup_title = f6_local0, + message_text = Engine.GetDvarString( "elite_clan_single_task_popup_text" ), + confirmation_action = function ( f7_arg0, f7_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f7_arg0, true ) + end + + }, + handlers = { + menu_close = function ( f8_arg0, f8_arg1 ) + f8_arg0:dispatchEventToRoot( { + name = "close_actions", + immediate = true + } ) + f8_arg0:dispatchEventToRoot( { + name = "friends_refresh", + forceRefresh = true + } ) + end + + } + } + end + end + f6_local0 = Engine.Localize( "@MENU_NOTICE" ) +end + +function popup_friend_invite_sent() + return { + type = "generic_confirmation_popup", + properties = { + popup_title = Engine.Localize( "@MENU_POPUP_INVITE_SENT" ), + message_text = Engine.Localize( "@MENU_POPUP_INVITE_SENT" ), + dialog_top = -100, + dialog_bottom = 100 + } + } +end + +function popup_confirm_report() + return { + type = "generic_confirmation_popup", + id = "popup_confirm_report", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = "", + dialog_top = -100, + dialog_bottom = 100 + } + } +end + +function ReportPopupFeeder( f11_arg0 ) + local f11_local0 = { + { + text = "@MENU_REPORT_OFFENSIVE", + confirmationString = "@MENU_REPORT_OFFENSIVE_SUBMIT", + offense = Friends.Constants.reportOffensiveLobbyPlayer + }, + { + text = "@MENU_REPORT_EXPLOITING", + confirmationString = "@MENU_REPORT_EXPLOITING_SUBMIT", + offense = Friends.Constants.reportExploitingLobbyPlayer + }, + { + text = "@MENU_REPORT_CHEATING", + confirmationString = "@MENU_REPORT_CHEATING_SUBMIT", + offense = Friends.Constants.reportCheatingLobbyPlayer + }, + { + text = "@MENU_REPORT_BOOSTING", + confirmationString = "@MENU_REPORT_BOOSTING_SUBMIT", + offense = Friends.Constants.reportBoostingLobbyPlayer + } + } + local f11_local1 = {} + for f11_local5, f11_local6 in ipairs( f11_local0 ) do + f11_local1[#f11_local1 + 1] = { + type = "UIGenericButton", + id = "offense_" .. f11_local5, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( f11_local6.text ), + button_action_func = function ( f12_arg0, f12_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f12_arg0 ) + f11_arg0.reportFunction( f12_arg1.controller, f11_local6.offense ) + f11_arg0.confirmationAction( f12_arg0, f12_arg1, Engine.Localize( f11_local6.confirmationString ) ) + end + } + } + end + return f11_local1 +end + +function popup_friend_report() + return { + type = "generic_selectionList_popup", + id = "popup_friend_report", + properties = { + popup_title = Engine.Localize( "@MENU_REPORT_PLAYER" ), + popup_childfeeder = ReportPopupFeeder, + friendIndex = 0, + confirmationAction = function ( f14_arg0, f14_arg1, f14_arg2 ) + LUI.FlowManager.RequestPopupMenu( f14_arg0, "popup_confirm_report", true, controller, false, { + message_text = f14_arg2 + } ) + end + , + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + } + } +end + +function popup_kick_are_you_sure() + return { + type = "generic_yesno_popup", + id = "popup_kick_are_you_sure", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@LUA_MENU_CLAN_KICK_ARE_YOU_SURE" ), + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ), + yes_action = function ( f16_arg0, f16_arg1 ) + Clan.KickMemberFromClan( f16_arg1.controller ) + end + , + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + } + } +end + +function ChangeStatusFeeder() + local f17_local0 = { + [#f17_local0 + 1] = { + type = "UIGenericButton", + id = "member_status_coleader", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@CLANS_STATUS_COLEADER" ), + button_action_func = function ( f18_arg0, f18_arg1 ) + Clan.SetToCoLeader( f18_arg1.controller ) + end, + button_over_func = function ( f19_arg0, f19_arg1 ) + f19_arg0:dispatchEventToRoot( { + name = "update_member_status_desc", + text = Engine.Localize( "@CLANS_STATUS_COLEADER_DESC" ) + } ) + end + } + }, + [#f17_local0 + 1] = { + type = "UIGenericButton", + id = "member_status_member", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@CLANS_STATUS_MEMBER" ), + button_action_func = function ( f20_arg0, f20_arg1 ) + Clan.SetToClanMember( f20_arg1.controller ) + end, + button_over_func = function ( f21_arg0, f21_arg1 ) + f21_arg0:dispatchEventToRoot( { + name = "update_member_status_desc", + text = Engine.Localize( "@CLANS_STATUS_MEMBER_DESC" ) + } ) + end + } + }, + [#f17_local0 + 1] = { + type = "UIElement", + id = "spacer", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 10 + } + } + }, + [#f17_local0 + 1] = { + type = "UIText", + id = "help_text", + properties = { + text = Engine.Localize( "@CLANS_STATUS_COLEADER_DESC" ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + red = 1, + green = 1, + blue = 1 + } + }, + handlers = { + update_member_status_desc = function ( f22_arg0, f22_arg1 ) + f22_arg0:setText( f22_arg1.text or "" ) + end + } + } + } + return f17_local0 +end + +function popup_change_status() + return { + type = "generic_selectionList_popup", + id = "popup_change_status_id", + properties = { + popup_title = Engine.Localize( "@CLANS_CHANGE_MEMBER_STATUS" ), + popup_childfeeder = ChangeStatusFeeder, + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + } + } +end + +function popup_transfer_are_you_sure() + return { + type = "generic_yesno_popup", + id = "popup_transfer_are_you_sure_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@CLANS_TRANSFER_LEADERSHIP_CONFIRM" ), + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ), + yes_action = function ( f25_arg0, f25_arg1 ) + Clan.TransferLeadership( f25_arg1.controller ) + end + , + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + } + } +end + +function popup_leave_are_you_sure() + return { + type = "generic_yesno_popup", + id = "popup_leave_are_you_sure_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@CLANS_LEAVE_CONFIRM" ), + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ), + yes_action = function ( f27_arg0, f27_arg1 ) + Clan.LeaveClan( f27_arg1.controller ) + if LUI.FlowManager.IsMenuInStack( f27_arg0:getRootParent(), "menu_barracks" ) then + LUI.FlowManager.RequestRestoreMenu( f27_arg0, "menu_barracks", true, f27_arg1.controller ) + end + end + , + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + } + } +end + +function popup_leave_leader_are_you_sure() + return { + type = "generic_yesno_popup", + id = "popup_leave_leader_are_you_sure_id", + properties = { + popup_title = Engine.Localize( "@MENU_WARNING" ), + message_text = Engine.Localize( "@CLANS_LEADER_LEAVE_CONFIRM" ), + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ), + yes_action = function ( f29_arg0, f29_arg1 ) + Clan.LeaveClan( f29_arg1.controller ) + if LUI.FlowManager.IsMenuInStack( f29_arg0:getRootParent(), "menu_barracks" ) then + LUI.FlowManager.RequestRestoreMenu( f29_arg0, "menu_barracks", true, f29_arg1.controller ) + end + end + , + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + } + } +end + +function popup_leave_leader_with_members() + return { + type = "generic_confirmation_popup", + id = "popup_leave_leader_with_members_id", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@CLANS_LEADER_CANT_LEAVE" ), + button_text = Engine.Localize( "@MENU_OK" ), + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + } + } +end + +function GetFriendRequestLocString() + return Engine.Localize( Engine.IsXB3() and "LUA_MENU_FRIEND_FOLLOW" or "MENU_FRIEND_REQUEST" ) +end + +function LivePartyFriendActionsFeeder( f32_arg0, f32_arg1 ) + local f32_local0 = {} + local f32_local1 = Engine.IsXbox360() + if not f32_local1 then + f32_local1 = Engine.IsXB3() + if not f32_local1 then + f32_local1 = Engine.IsPS4() + end + end + local f32_local2 = not Engine.InFrontend() + local f32_local3 = Engine.InLobby() + if Engine.IsMultiplayer() then + local f32_local4 = #f32_local0 + 1 + local f32_local5 = { + type = "UIGenericButton", + id = "invite" + } + local f32_local6 = Friends.IsLivePartyLocal( f32_arg1.controller ) + if not f32_local6 then + if Engine.GetDvarBool( "onlinegame" ) then + f32_local6 = isAliensSolo() + else + f32_local6 = true + end + end + f32_local5.disabled = f32_local6 + f32_local6 = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup + } + local f32_local7 + if f32_local2 or f32_local3 then + f32_local7 = Engine.Localize( "@MENU_INVITE_TO_GAME" ) + if not f32_local7 then + + else + f32_local6.button_text = f32_local7 + f32_local6.button_action_func = function ( f33_arg0, f33_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f33_arg0 ) + Friends.InviteLivePartyFriend( f33_arg1.controller ) + end + + f32_local5.properties = f32_local6 + f32_local0[f32_local4] = f32_local5 + end + end + f32_local7 = Engine.Localize( "@MENU_INVITE_TO_PARTY" ) + end + local f32_local4 = #f32_local0 + 1 + local f32_local5 = { + type = "UIGenericButton", + id = "join" + } + local f32_local6 = Friends.IsLivePartyLocal( f32_arg1.controller ) + if not f32_local6 then + f32_local6 = not Engine.UserCanPlayOnline( f32_arg1.controller ) + end + f32_local5.disabled = f32_local6 + f32_local5.properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@MENU_JOIN_GAME" ), + button_action_func = function ( f34_arg0, f34_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f34_arg0 ) + Friends.JoinLivePartyFriend( f34_arg1.controller ) + end + } + f32_local0[f32_local4] = f32_local5 + if Clan.IsEnabled() and Clan.CanISendInviteToLiveParty( f32_arg1.controller, f32_arg0.friendIndex ) and f32_local2 == false then + f32_local0[#f32_local0 + 1] = { + type = "UIGenericButton", + id = "clan_invite", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@LUA_MENU_CLAN_INVITE_TO_CLAN" ), + button_action_func = function ( f35_arg0, f35_arg1 ) + if Engine.IsChatRestricted() then + LUI.FlowManager.RequestPopupMenu( f35_arg0, "user_generated_content_restriction_popup", true, f35_arg1.controller ) + else + Clan.InviteLivePartyToClan( f35_arg1.controller ) + end + end + } + } + end + if f32_local1 then + f32_local0[#f32_local0 + 1] = { + type = "UIGenericButton", + id = "profile", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@XBOXLIVE_VIEW_PROFILE" ), + button_action_func = function ( f36_arg0, f36_arg1 ) + Friends.ShowLivePartyFriendGamercard( f36_arg1.controller ) + end + } + } + end + f32_local0[#f32_local0 + 1] = { + type = "UIGenericButton", + id = "report", + disabled = Friends.IsLivePartyFriendMe( f32_arg1.controller, f32_arg0.friendIndex ), + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@MENU_REPORT_PLAYER" ), + button_action_func = function ( f37_arg0, f37_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f37_arg0 ) + LUI.FlowManager.RequestPopupMenu( f37_arg0, "popup_friend_report", true, f37_arg1.controller, false, { + friendIndex = f32_arg0.friendIndex, + reportFunction = Friends.ReportLivePartyFriend + } ) + end + } + } + return f32_local0 +end + +function OnlineFriendActionsFeeder( f38_arg0, f38_arg1 ) + local f38_local0 = {} + local f38_local1 = Engine.IsXbox360() + if not f38_local1 then + f38_local1 = Engine.IsXB3() + if not f38_local1 then + f38_local1 = Engine.IsPS4() + end + end + local f38_local2 = not Engine.InFrontend() + local f38_local3 = Engine.InLobby() + local f38_local4 = function () + local f39_local0 + if IsOnlineMatch() and Friends.IsFriendInvitable( f38_arg1.controller ) then + f39_local0 = isAliensSolo() + else + f39_local0 = true + end + return f39_local0 + end + + if Engine.IsMultiplayer() then + local f38_local5 = #f38_local0 + 1 + local f38_local6 = { + type = "UIGenericButton", + id = "invite", + disabledFunc = f38_local4 + } + local f38_local7 = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup + } + local f38_local8 + if f38_local2 or f38_local3 then + f38_local8 = Engine.Localize( "@MENU_INVITE_TO_GAME" ) + if not f38_local8 then + + else + f38_local7.button_text = f38_local8 + f38_local7.button_action_func = function ( f40_arg0, f40_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f40_arg0 ) + Friends.InviteOnlineFriend( f40_arg1.controller ) + end + + f38_local6.properties = f38_local7 + f38_local6.handlers = { + element_refresh = function ( f41_arg0, f41_arg1 ) + if f38_local4() then + f41_arg0:processEvent( { + name = "disable" + } ) + else + f41_arg0:processEvent( { + name = "enable" + } ) + end + end + } + f38_local0[f38_local5] = f38_local6 + end + end + f38_local8 = Engine.Localize( "@MENU_INVITE_TO_PARTY" ) + end + if Engine.IsMultiplayer() or not Engine.IsPS4() and not Engine.IsXB3() and Engine.IsConsoleGame() then + local f38_local5 = function () + local f42_local0 + if Engine.UserCanPlayOnline( f38_arg1.controller ) then + f42_local0 = not Friends.IsFriendJoinable( f38_arg1.controller ) + else + f42_local0 = true + end + return f42_local0 + end + + f38_local0[#f38_local0 + 1] = { + type = "UIGenericButton", + id = "join", + disabledFunc = f38_local5, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@MENU_JOIN_GAME" ), + button_action_func = function ( f43_arg0, f43_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f43_arg0 ) + Friends.JoinOnlineFriend( f43_arg1.controller ) + end + }, + handlers = { + element_refresh = function ( f44_arg0, f44_arg1 ) + if f38_local5() then + f44_arg0:processEvent( { + name = "disable" + } ) + else + f44_arg0:processEvent( { + name = "enable" + } ) + end + end + } + } + end + if Clan.IsEnabled() and Clan.CanISendInviteToFriend( f38_arg1.controller, f38_arg0.friendIndex ) and f38_local2 == false then + f38_local0[#f38_local0 + 1] = { + type = "UIGenericButton", + id = "clan_invite", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@LUA_MENU_CLAN_INVITE_TO_CLAN" ), + button_action_func = function ( f45_arg0, f45_arg1 ) + if Engine.IsChatRestricted() then + LUI.FlowManager.RequestPopupMenu( f45_arg0, "user_generated_content_restriction_popup", true, f45_arg1.controller ) + else + Clan.InviteFriendToClan( f45_arg1.controller ) + end + end + } + } + end + local f38_local5 = function () + return not Friends.CanShowFriendGamercard( f38_arg1.controller ) + end + + if f38_local1 then + f38_local0[#f38_local0 + 1] = { + type = "UIGenericButton", + id = "profile", + disabledFunc = f38_local5, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@XBOXLIVE_VIEW_PROFILE" ), + button_action_func = function ( f47_arg0, f47_arg1 ) + Friends.ShowOnlineFriendGamercard( f47_arg1.controller ) + end + }, + handlers = { + element_refresh = function ( f48_arg0, f48_arg1 ) + if f38_local5() then + f48_arg0:processEvent( { + name = "disable" + } ) + else + f48_arg0:processEvent( { + name = "enable" + } ) + end + end + } + } + end + f38_local0[#f38_local0 + 1] = { + type = "UIGenericButton", + id = "report", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@MENU_REPORT_PLAYER" ), + button_action_func = function ( f49_arg0, f49_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f49_arg0 ) + LUI.FlowManager.RequestPopupMenu( f49_arg0, "popup_friend_report", true, f49_arg1.controller, false, { + friendIndex = f38_arg0.friendIndex, + reportFunction = Friends.ReportOnlineFriend + } ) + end + } + } + return f38_local0 +end + +function popup_join_on_blocked_player_are_you_sure() + return { + type = "generic_yesno_popup", + id = "popup_join_on_blocked_player_are_you_sure", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@XBOXLIVE_JOIN_ON_BLOCKED_USER_CONFIRM" ), + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ), + yes_action = function ( f51_arg0, f51_arg1 ) + Friends.JoinRecentPlayer( f51_arg1.controller ) + end + , + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + } + } +end + +function RecentPlayerActionsFeeder( f52_arg0, f52_arg1 ) + local f52_local0 = {} + local f52_local1 = Engine.IsXbox360() + if not f52_local1 then + f52_local1 = Engine.IsXB3() + if not f52_local1 then + f52_local1 = Engine.IsPS4() + end + end + local f52_local2 = not Engine.InFrontend() + local f52_local3 = Engine.InLobby() + if Engine.IsConsoleGame() then + if Engine.IsMultiplayer() then + local f52_local4 = #f52_local0 + 1 + local f52_local5 = { + type = "UIGenericButton", + id = "invite" + } + local f52_local6 + if Engine.GetDvarBool( "onlinegame" ) then + f52_local6 = isAliensSolo() + else + f52_local6 = true + end + f52_local5.disabled = f52_local6 + f52_local6 = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup + } + local f52_local7 + if f52_local2 or f52_local3 then + f52_local7 = Engine.Localize( "@MENU_INVITE_TO_GAME" ) + if not f52_local7 then + + else + f52_local6.button_text = f52_local7 + f52_local6.button_action_func = function ( f53_arg0, f53_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f53_arg0 ) + Friends.InviteRecentPlayer( f53_arg1.controller ) + end + + f52_local5.properties = f52_local6 + f52_local0[f52_local4] = f52_local5 + end + end + f52_local7 = Engine.Localize( "@MENU_INVITE_TO_PARTY" ) + end + f52_local0[#f52_local0 + 1] = { + type = "UIGenericButton", + id = "join", + disabled = not Engine.UserCanPlayOnline( f52_arg1.controller ), + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@MENU_JOIN_GAME" ), + button_action_func = function ( f54_arg0, f54_arg1 ) + if Engine.IsXB3() and Friends.IsUserInBlockList( f54_arg1.controller ) then + LUI.FlowManager.RequestPopupMenu( f54_arg0, "popup_join_on_blocked_player_are_you_sure", true, f54_arg1.controller, false, { + friendIndex = f52_arg0.friendIndex + } ) + else + LUI.FlowManager.RequestLeaveMenu( f54_arg0 ) + Friends.JoinRecentPlayer( f54_arg1.controller ) + end + end + } + } + end + if Clan.IsEnabled() and Clan.CanISendInviteToRecentPlayer( f52_arg1.controller, f52_arg0.friendIndex ) and f52_local2 == false then + f52_local0[#f52_local0 + 1] = { + type = "UIGenericButton", + id = "clan_invite", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@LUA_MENU_CLAN_INVITE_TO_CLAN" ), + button_action_func = function ( f55_arg0, f55_arg1 ) + if Engine.IsChatRestricted() then + LUI.FlowManager.RequestPopupMenu( f55_arg0, "user_generated_content_restriction_popup", true, f55_arg1.controller ) + else + Clan.InviteRecentPlayerToClan( f55_arg1.controller ) + end + end + } + } + end + if f52_local1 then + f52_local0[#f52_local0 + 1] = { + type = "UIGenericButton", + id = "profile", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@XBOXLIVE_VIEW_PROFILE" ), + button_action_func = function ( f56_arg0, f56_arg1 ) + Friends.ShowRecentPlayerGamercard( f56_arg1.controller ) + end + } + } + end + if not Engine.IsPS4() then + f52_local0[#f52_local0 + 1] = { + type = "UIGenericButton", + id = "add_friend_btn", + disabled = Friends.IsRecentPlayerAFriend( f52_arg1.controller ), + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = GetFriendRequestLocString(), + button_action_func = function ( f57_arg0, f57_arg1 ) + Friends.RequestRecentPlayerAsFriend( f57_arg1.controller ) + end + } + } + end + f52_local0[#f52_local0 + 1] = { + type = "UIGenericButton", + id = "report", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@MENU_REPORT_PLAYER" ), + button_action_func = function ( f58_arg0, f58_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f58_arg0 ) + LUI.FlowManager.RequestPopupMenu( f58_arg0, "popup_friend_report", true, f58_arg1.controller, false, { + friendIndex = f52_arg0.friendIndex, + reportFunction = Friends.ReportRecentPlayer + } ) + end + } + } + return f52_local0 +end + +function EliteClanFriendActionsFeeder( f59_arg0, f59_arg1 ) + local f59_local0 = {} + local f59_local1 = Engine.IsXbox360() + if not f59_local1 then + f59_local1 = Engine.IsXB3() + if not f59_local1 then + f59_local1 = Engine.IsPS4() + end + end + local f59_local2 = not Engine.InFrontend() + local f59_local3 = Engine.InLobby() + local f59_local4 = Friends.IsEliteClanFriendMe( f59_arg1.controller, f59_arg0.friendIndex ) + if Engine.IsMultiplayer() then + local f59_local5 = #f59_local0 + 1 + local f59_local6 = { + type = "UIGenericButton", + id = "invite" + } + local f59_local7 = f59_local4 + local f59_local8 + if Engine.GetDvarBool( "onlinegame" ) then + f59_local8 = isAliensSolo() + else + f59_local8 = f59_local7 or true + end + f59_local6.disabled = f59_local8 + f59_local8 = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup + } + local f59_local9 + if f59_local2 or f59_local3 then + f59_local9 = Engine.Localize( "@MENU_INVITE_TO_GAME" ) + if not f59_local9 then + + else + f59_local8.button_text = f59_local9 + f59_local8.button_action_func = function ( f60_arg0, f60_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f60_arg0 ) + Friends.InviteEliteClanFriend( f60_arg1.controller ) + end + + f59_local6.properties = f59_local8 + f59_local0[f59_local5] = f59_local6 + end + end + f59_local9 = Engine.Localize( "@MENU_INVITE_TO_PARTY" ) + end + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "join", + disabled = f59_local4 or not Engine.UserCanPlayOnline( f59_arg1.controller ), + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@MENU_JOIN_GAME" ), + button_action_func = function ( f61_arg0, f61_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f61_arg0 ) + Friends.JoinEliteClanFriend( f61_arg1.controller ) + end + } + } + if f59_local2 == false then + if Clan.CanIChangeMemberStatus( f59_arg1.controller ) and f59_local4 == false then + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "clan_change_status", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@CLANS_CHANGE_MEMBER_STATUS" ), + button_action_func = function ( f62_arg0, f62_arg1 ) + LUI.FlowManager.RequestPopupMenu( f62_arg0, "popup_change_status", true, f62_arg1.controller, false, { + friendIndex = f59_arg0.friendIndex + } ) + end + } + } + end + if Clan.CanIKickMember( f59_arg1.controller ) and f59_local4 == false then + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "clan_kick", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@LUA_MENU_CLAN_KICK_FROM_CLAN" ), + button_action_func = function ( f63_arg0, f63_arg1 ) + LUI.FlowManager.RequestPopupMenu( f63_arg0, "popup_kick_are_you_sure", true, f63_arg1.controller, false, { + friendIndex = f59_arg0.friendIndex + } ) + end + } + } + end + if Clan.AmILeader( f59_arg1.controller ) and f59_local4 == false then + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "clan_transfer_ownership", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@CLANS_TRANSFER_OWNERSHIP" ), + button_action_func = function ( f64_arg0, f64_arg1 ) + LUI.FlowManager.RequestPopupMenu( f64_arg0, "popup_transfer_are_you_sure", true, f64_arg1.controller, false, { + friendIndex = f59_arg0.friendIndex + } ) + end + } + } + end + if f59_local4 then + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "clan_leave", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@CLANS_LEAVE_CLAN" ), + button_action_func = function ( f65_arg0, f65_arg1 ) + local f65_local0 = "popup_leave_are_you_sure" + if Clan.AmILeader( f59_arg1.controller ) then + if Clan.GetMemberCount( f59_arg1.controller ) > 1 then + local f65_local1 = "popup_leave_leader_with_members" + end + f65_local0 = f65_local1 or "popup_leave_leader_are_you_sure" + end + LUI.FlowManager.RequestPopupMenu( f65_arg0, f65_local0, true, f65_arg1.controller, false ) + end + } + } + end + end + if f59_local1 then + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "profile", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@XBOXLIVE_VIEW_PROFILE" ), + button_action_func = function ( f66_arg0, f66_arg1 ) + Friends.ShowEliteClanFriendGamercard( f66_arg1.controller ) + end + } + } + end + if not Engine.IsPS4() then + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "add_friend_btn", + disabled = f59_local4 or Friends.IsEliteClanPlayerAFriend( f59_arg1.controller ), + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = GetFriendRequestLocString(), + button_action_func = function ( f67_arg0, f67_arg1 ) + Friends.RequestEliteClanPlayerAsFriend( f67_arg1.controller ) + end + } + } + end + f59_local0[#f59_local0 + 1] = { + type = "UIGenericButton", + id = "report", + disabled = f59_local4, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_text = Engine.Localize( "@MENU_REPORT_PLAYER" ), + button_action_func = function ( f68_arg0, f68_arg1 ) + LUI.FlowManager.RequestPopupMenu( f68_arg0, "popup_friend_report", true, f68_arg1.controller, false, { + friendIndex = f59_arg0.friendIndex, + reportFunction = Friends.ReportEliteClanFriend + } ) + end + } + } + return f59_local0 +end + +function ActionsFeeder( f69_arg0 ) + local f69_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "popup_friends" ) + if f69_local0.actionsFeeder then + return f69_local0.actionsFeeder( f69_arg0, f69_local0 ) + else + return {} + end +end + +function popup_friend_list_actions() + return { + type = "generic_selectionList_popup", + id = "popup_friend_list_actions", + handlers = { + close_actions = MBh.LeaveMenu() + }, + properties = { + popup_title = "", + popup_childfeeder = ActionsFeeder, + friendIndex = 0, + additional_handlers = { + kill_friends_list = MBh.LeaveMenu() + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = { + { + type = "UITimer", + id = "friends_actions_refresh_timer", + properties = { + event = { + name = "element_refresh" + }, + interval = 1000 + } + } + } + } +end + +function RefreshScrollbar( f71_arg0 ) + if f71_arg0.scrollbar then + f71_arg0.scrollbar:manualUpdate( f71_arg0.slot_offset, f71_arg0.maxButtonsOnPage, f71_arg0.total, Friends.Constants.FriendButtonHeight ) + end +end + +function ScrollBy( f72_arg0, f72_arg1, f72_arg2, f72_arg3 ) + local f72_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f72_arg0 ) + local f72_local1 = f72_local0.slot_offset + f72_local0.slot_offset = LUI.clamp( f72_local0.slot_offset + f72_arg3, 0, math.max( 0, f72_local0.total - f72_local0.maxButtonsOnPage ) ) + if f72_local1 ~= f72_local0.slot_offset then + local f72_local2 = f72_arg0:getParent() + if f72_arg1.qualifier ~= ButtonQualifiers.Mousewheel then + f72_arg0:processEvent( { + name = "lose_focus", + immediate = true + } ) + end + f72_local2:dispatchEventToRoot( { + name = "friends_refresh", + immediate = true + } ) + if f72_arg1.qualifier ~= ButtonQualifiers.Mousewheel then + local f72_local3 = f72_local2:getChildById( "friend_button_" .. f72_arg2 ) + f72_local3:processEvent( { + name = "gain_focus", + immediate = true + } ) + end + end + RefreshScrollbar( f72_local0 ) +end + +function FriendButtonGamepadButton( f73_arg0, f73_arg1, f73_arg2 ) + local f73_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f73_arg0 ) + if f73_arg1.down and f73_arg0:isInFocus() then + if f73_arg1.qualifier == ButtonQualifiers.Mousewheel then + if f73_arg1.button == "up" then + ScrollBy( f73_arg0, f73_arg1, f73_arg2, -1 ) + elseif f73_arg1.button == "down" then + ScrollBy( f73_arg0, f73_arg1, f73_arg2, 1 ) + end + return true + elseif f73_arg1.button == "up" and f73_arg2 == 0 then + ScrollBy( f73_arg0, f73_arg1, f73_arg2, -1 ) + return true + elseif f73_arg1.button == "down" and f73_arg2 == f73_local0.maxButtonsOnPage - 1 then + ScrollBy( f73_arg0, f73_arg1, f73_arg2, 1 ) + return true + end + end + return LUI.UIButton.GamepadButton( f73_arg0, f73_arg1 ) +end + +function FriendButtonOverAction( f74_arg0, f74_arg1, f74_arg2 ) + local f74_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f74_arg0 ) + if f74_arg0.properties.toTopAllowed then + f74_arg0:dispatchEventToRoot( { + name = "update_to_top_button_helper", + immediate = true + } ) + end + local f74_local1 = f74_local0.current_slot + f74_local0.current_slot = f74_arg0.properties.buttonNumber + if f74_local0.controller and f74_arg0.properties.friendIndex then + f74_arg2( f74_local0.controller, f74_arg0.properties.friendIndex ) + end + if Engine.IsConsoleGame() or f74_arg1.focusType ~= FocusType.MouseOver then + local f74_local2 + if f74_local0.current_slot > f74_local0.upScrollBoundary or f74_local0.current_slot >= f74_local1 then + f74_local2 = false + else + f74_local2 = true + end + local f74_local3 + if f74_local0.downScrollBoundary > f74_local0.current_slot or f74_local1 >= f74_local0.current_slot then + f74_local3 = false + else + f74_local3 = true + end + local f74_local4 = f74_local2 and f74_local0.slot_offset > 0 + local f74_local5 = f74_local3 and f74_local0.slot_offset < f74_local0.total - f74_local0.maxButtonsOnPage + if f74_local4 then + ScrollBy( f74_arg0, f74_arg1, f74_local1, -1 ) + elseif f74_local5 then + ScrollBy( f74_arg0, f74_arg1, f74_local1, 1 ) + else + f74_arg0:dispatchEventToRoot( { + name = "friends_refresh", + immediate = true + } ) + end + else + f74_arg0:dispatchEventToRoot( { + name = "friends_refresh", + immediate = true + } ) + end +end + +function OpenFriendsOptionPopup( f75_arg0, f75_arg1, f75_arg2, f75_arg3 ) + local f75_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f75_arg0 ) + LUI.FlowManager.RequestPopupMenu( f75_arg0, "popup_friend_list_actions", true, f75_arg3, false, { + popup_title = f75_arg1, + friendIndex = f75_arg2 + } ) +end + +function OpenChallengePopup( f76_arg0, f76_arg1, f76_arg2 ) + if not Engine.InFrontend() or not f76_arg0.properties.challengeFunc then + return + else + f76_arg0:dispatchEventToRoot( { + name = "kill_friends_list", + immediate = true + } ) + LUI.FlowManager.RequestLeaveMenu( f76_arg0 ) + f76_arg0.properties.challengeFunc( f76_arg2 ) + end +end + +function friend_button_children( f77_arg0, f77_arg1, f77_arg2, f77_arg3, f77_arg4, f77_arg5, f77_arg6, f77_arg7, f77_arg8, f77_arg9 ) + local f77_local0 = {} + local f77_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "popup_friends" ) + if Engine.InFrontend() then + f77_local0[#f77_local0 + 1] = { + type = "UIImage", + states = { + default = CoD.ColorizeState( Colors.black, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = -1, + left = 0, + width = 100, + alpha = 0 + } ), + visible = { + alpha = 1 + } + }, + children = { + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Colors.black, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 30, + bottom = 0, + left = 0, + width = 342 + } ) + } + } + }, + handlers = { + button_over = MBh.AnimateToState( "visible" ), + button_up = MBh.AnimateToState( "default" ) + } + } + f77_local0[#f77_local0 + 1] = { + type = "playercard", + properties = { + force_show_rank = true, + patchScale = -0.15 + }, + states = { + default = { + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + button_over = MBh.AnimateToState( "visible" ), + button_up = MBh.AnimateToState( "default" ) + } + } + f77_local0[#f77_local0 + 1] = { + type = "UIImage", + id = "small_rectangle_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 20, + height = 16, + left = 450, + width = 5, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b, + material = RegisterMaterial( "white" ) + }, + over = { + red = 0, + green = 0, + blue = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ) + } + } + f77_local0[#f77_local0 + 1] = { + type = "UIText", + id = "friend_button_subtext", + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 469, + right = -15, + top = 60, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right + } ), + over = { + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.b + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ), + subtext_refresh = function ( f78_arg0, f78_arg1 ) + f78_arg0:setText( f78_arg1.text or "" ) + end + } + } + else + local f77_local2 = Engine.IsAliensMode() and CoD.PlayMode.Aliens or CoD.PlayMode.Core + f77_local0[#f77_local0 + 1] = { + type = "UIImage", + id = "rank_background_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + height = 49, + left = 0, + width = 60, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b, + alpha = 0.2, + material = RegisterMaterial( "white" ) + }, + over = { + red = 0, + green = 0, + blue = 0, + alpha = 1 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ) + } + } + f77_local0[#f77_local0 + 1] = { + type = "UIImage", + id = "rank_emblem_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 14, + height = 21, + left = 3, + width = 25, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b + }, + over = { + red = 1, + green = 1, + blue = 1 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ), + rank_refresh = function ( f79_arg0, f79_arg1 ) + f79_arg0:setImage( RegisterMaterial( Rank.GetRankIcon( f79_arg1.rank, f79_arg1.prestige, f77_local2 ) ) ) + end + } + } + f77_local0[#f77_local0 + 1] = { + type = "UIText", + id = "rank_number_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 14, + height = 21, + left = 31, + width = 22, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b, + font = CoD.TextSettings.BigFont.Font, + alignment = LUI.Alignment.Center + }, + over = { + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ), + rank_refresh = function ( f80_arg0, f80_arg1 ) + f80_arg0:setText( Rank.GetRankDisplay( f80_arg1.rank, f77_local2 ) ) + end + } + } + f77_local0[#f77_local0 + 1] = { + type = "UIImage", + id = "small_rectangle_id", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 14, + height = 21, + left = 470, + width = 5, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b, + material = RegisterMaterial( "white" ) + }, + over = { + red = 0, + green = 0, + blue = 0 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over" ), + button_up = MBh.AnimateToState( "default" ) + } + } + end + return f77_local0 +end + +function friend_button( f81_arg0, f81_arg1, f81_arg2, f81_arg3, f81_arg4, f81_arg5, f81_arg6, f81_arg7, f81_arg8, f81_arg9, f81_arg10, f81_arg11, f81_arg12, f81_arg13 ) + return { + type = "UIGenericButton", + id = "friend_button_" .. f81_arg1, + properties = { + style = GenericButtonSettings.Styles.FlatButton, + substyle = GenericButtonSettings.Styles.FlatButton.SubStyles.SubMenu, + variant = GenericButtonSettings.Variants.Info, + buttonNumber = f81_arg1, + toTopAllowed = f81_arg12, + button_display_func = function ( f82_arg0, f82_arg1 ) + if f81_arg0.slot_offset and f81_arg1 then + return f81_arg9( f81_arg0.controller, f81_arg0.slot_offset + f81_arg1 ) + else + + end + end + , + height = Engine.InFrontend() and Friends.Constants.FriendButtonHeight or 49, + y_offset = Engine.InFrontend() and -17 or 0, + content_width = Engine.InFrontend() and 260 or 450, + content_margin = Engine.InFrontend() and 40 or 10, + text_padding_with_content = Engine.InFrontend() and 116 or 70, + label_align = LUI.Alignment.Left, + text_align_with_content = LUI.Alignment.Left, + text_default_color = { + r = 1, + g = 1, + b = 1, + a = 1 + }, + text_focus_color = Engine.InFrontend() and { + a = 0 + } or Colors.black, + content_focus_color_without_bg = Colors.black, + use_locking = false, + challengeFunc = f81_arg13 + }, + handlers = { + gamepad_button = function ( f83_arg0, f83_arg1 ) + return FriendButtonGamepadButton( f83_arg0, f83_arg1, f81_arg1 ) + end + , + button_over = function ( f84_arg0, f84_arg1 ) + FriendButtonOverAction( f84_arg0, f84_arg1, f81_arg11 ) + end + , + button_action = function ( f85_arg0, f85_arg1 ) + local f85_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f85_arg0 ) + if not f85_local0.challengeMode then + OpenFriendsOptionPopup( f85_arg0, f85_arg0.properties.friendName, f85_local0.slot_offset + f81_arg1, f85_arg1.controller ) + else + OpenChallengePopup( f85_arg0, f85_arg0.properties.friendIndex, f85_arg1.controller ) + end + end + , + element_refresh = function ( f86_arg0, f86_arg1 ) + local f86_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f86_arg0 ) + local f86_local1 = f86_local0.slot_offset + f81_arg1 + f86_arg0.properties.friendIndex = f86_local1 + if f86_arg0:isInFocus() then + f81_arg11( f86_local0.controller, f86_local1 ) + end + local f86_local2 = { + gamertag = f81_arg2( f86_local0.controller, f86_local1 ) + } + if not Engine.IsChatRestricted() then + f86_local2.clantag = f81_arg3( f86_local0.controller, f86_local1 ) + end + f86_local2.rank = f81_arg7( f86_local0.controller, f86_local1 ) + f86_local2.prestige = f81_arg8( f86_local0.controller, f86_local1 ) + f86_local2.background = f81_arg6 and f81_arg6( f86_local0.controller, f86_local1 ) or 0 + f86_local2.patchEmblem = f81_arg4 and f81_arg4( f86_local0.controller, f86_local1 ) or 0 + f86_local2.patchShape = f81_arg5 and f81_arg5( f86_local0.controller, f86_local1 ) or 0 + f86_local2.name = "update_playercard" + f86_arg0:processEvent( f86_local2 ) + f86_arg0.properties.friendName = f86_local2.gamertag + if not Engine.InFrontend() and f86_local2.clantag and f86_local2.clantag ~= "" then + f86_arg0:setText( "[" .. f86_local2.clantag .. "]" .. f86_local2.gamertag ) + else + f86_arg0:setText( f86_local2.gamertag ) + end + f86_arg0:processEvent( { + name = "content_refresh" + } ) + f86_arg0:processEvent( { + name = "subtext_refresh", + text = f81_arg10( f86_local0.controller, f86_local1 ) + } ) + if not Engine.InFrontend() then + f86_arg0:processEvent( { + name = "rank_refresh", + rank = f86_local2.rank, + prestige = f86_local2.prestige + } ) + end + end + + }, + children = friend_button_children( f81_arg1, f81_arg2, f81_arg3, f81_arg4, f81_arg5, f81_arg6, f81_arg7, f81_arg8, f81_arg9, f81_arg10 ) + } +end + +function no_friends( f87_arg0 ) + return { + type = "UIElement", + id = "no_friends_id", + properties = { + text = f87_arg0 + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = Friends.Constants.scrollbarWidth + } + }, + children = { + { + type = "UIElement", + id = "container", + properties = { + text = MBh.Property( "text" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 70, + bottom = -167 + } + }, + children = { + { + type = "UIText", + id = "no_friends_txt", + properties = { + text = MBh.Property( "text" ), + textStyle = CoD.TextStyle.Shadowed + }, + states = { + default = CoD.ColorizeState( Colors.primary_text_color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + height = CoD.TextSettings.BigFont.Height, + font = CoD.TextSettings.BigFont.Font, + alignment = LUI.Alignment.Center + } ) + } + } + } + } + } + } +end + +function EmptySubTextGetter( f88_arg0, f88_arg1 ) + return "" +end + +function FriendFeederFactory( f89_arg0, f89_arg1, f89_arg2, f89_arg3, f89_arg4, f89_arg5, f89_arg6, f89_arg7, f89_arg8, f89_arg9, f89_arg10, f89_arg11, f89_arg12 ) + return function ( f90_arg0, f90_arg1 ) + local f90_local0 = {} + if f90_arg1.total > 0 then + for f90_local1 = 0, math.min( f90_arg1.maxButtonsOnPage - 1, f90_arg1.total - 1 ), 1 do + f90_local0[#f90_local0 + 1] = friend_button( f90_arg1, f90_local1, f89_arg0, f89_arg3, f89_arg4, f89_arg5, f89_arg6, f89_arg7, f89_arg8, f89_arg1, f89_arg2, f89_arg9, f89_arg11, f89_arg12 ) + end + else + f90_local0[#f90_local0 + 1] = f89_arg10() + end + return f90_local0 + end + +end + +function OnlineFriendsFeeder( f91_arg0, f91_arg1 ) + local f91_local0 = Engine.IsAliensMode() + local f91_local1 = FriendFeederFactory + local f91_local2 = Friends.GetOnlineFriendGamertag + local f91_local3 = Friends.GetOnlineFriendPresence + local f91_local4 = EmptySubTextGetter + local f91_local5 = Friends.GetOnlineFriendClanTag + local f91_local6 = Friends.GetOnlineFriendPatch + local f91_local7 = Friends.GetOnlineFriendPatchbacking + local f91_local8 = Friends.GetOnlineFriendBackground + local f91_local9 + if f91_local0 then + f91_local9 = Friends.GetOnlineFriendAlienRank + if not f91_local9 then + + else + local f91_local10 + if f91_local0 then + f91_local10 = Friends.GetOnlineFriendAlienPrestige + if not f91_local10 then + + else + f91_local1 = f91_local1( f91_local2, f91_local3, f91_local4, f91_local5, f91_local6, f91_local7, f91_local8, f91_local9, f91_local10, Friends.SetOnlineFriendStoredXUID, function () + return no_friends( Engine.Localize( "@PLATFORM_NO_FRIENDS" ) ) + end, true, ChallengeFriend ) + return f91_local1( f91_arg0, f91_arg1 ) + end + end + f91_local10 = Friends.GetOnlineFriendPrestige + end + end + f91_local9 = Friends.GetOnlineFriendRank +end + +function LivePartyFriendsFeeder( f93_arg0, f93_arg1 ) + local f93_local0 = Engine.IsAliensMode() + local f93_local1 = FriendFeederFactory + local f93_local2 = Friends.GetLivePartyFriendGamertag + local f93_local3 = Friends.GetLivePartyFriendPresence + local f93_local4 = EmptySubTextGetter + local f93_local5 = Friends.GetLivePartyFriendClanTag + local f93_local6 = Friends.GetLivePartyFriendPatch + local f93_local7 = Friends.GetLivePartyFriendPatchbacking + local f93_local8 = Friends.GetLivePartyFriendBackground + local f93_local9 + if f93_local0 then + f93_local9 = Friends.GetLivePartyFriendAlienRank + if not f93_local9 then + + else + local f93_local10 + if f93_local0 then + f93_local10 = Friends.GetLivePartyFriendAlienPrestige + if not f93_local10 then + + else + f93_local1 = f93_local1( f93_local2, f93_local3, f93_local4, f93_local5, f93_local6, f93_local7, f93_local8, f93_local9, f93_local10, Friends.SetLivePartyFriendStoredXUID, function () + return no_friends( Engine.Localize( "@PLATFORM_NOT_IN_PARTY" ) ) + end, false, ChallengeLivePartyPlayer ) + return f93_local1( f93_arg0, f93_arg1 ) + end + end + f93_local10 = Friends.GetLivePartyFriendPrestige + end + end + f93_local9 = Friends.GetLivePartyFriendRank +end + +function RecentPlayersFeeder( f95_arg0, f95_arg1 ) + local f95_local0 = Engine.IsAliensMode() + local f95_local1 = FriendFeederFactory + local f95_local2 = Friends.GetRecentPlayerGamertag + local f95_local3 = Friends.GetRecentPlayerPresence + local f95_local4 = EmptySubTextGetter + local f95_local5 = Friends.GetRecentPlayerClanTag + local f95_local6 = Friends.GetRecentPlayerPatch + local f95_local7 = Friends.GetRecentPlayerPatchbacking + local f95_local8 = Friends.GetRecentPlayerBackground + local f95_local9 + if f95_local0 then + f95_local9 = Friends.GetRecentPlayerAlienRank + if not f95_local9 then + + else + local f95_local10 + if f95_local0 then + f95_local10 = Friends.GetRecentPlayerAlienPrestige + if not f95_local10 then + + else + f95_local1 = f95_local1( f95_local2, f95_local3, f95_local4, f95_local5, f95_local6, f95_local7, f95_local8, f95_local9, f95_local10, Friends.SetRecentPlayerStoredXUID, function () + return no_friends( Engine.Localize( "@LUA_MENU_NO_RECENT_PLAYERS" ) ) + end, false, ChallengeRecentPlayer ) + return f95_local1( f95_arg0, f95_arg1 ) + end + end + f95_local10 = Friends.GetRecentPlayerPrestige + end + end + f95_local9 = Friends.GetRecentPlayerRank +end + +function EliteClanFriendsFeeder( f97_arg0, f97_arg1 ) + local f97_local0 = Engine.IsAliensMode() + local f97_local1 = FriendFeederFactory + local f97_local2 = Friends.GetEliteClanFriendGamertag + local f97_local3 = Friends.GetEliteClanFriendPresence + local f97_local4 = Friends.GetEliteClanFriendMemberStatus + local f97_local5 = Friends.GetEliteClanFriendClanTag + local f97_local6 = Friends.GetEliteClanFriendPatch + local f97_local7 = Friends.GetEliteClanFriendPatchbacking + local f97_local8 = Friends.GetEliteClanFriendBackground + local f97_local9 + if f97_local0 then + f97_local9 = Friends.GetEliteClanFriendAlienRank + if not f97_local9 then + + else + local f97_local10 + if f97_local0 then + f97_local10 = Friends.GetEliteClanFriendAlienPrestige + if not f97_local10 then + + else + f97_local1 = f97_local1( f97_local2, f97_local3, f97_local4, f97_local5, f97_local6, f97_local7, f97_local8, f97_local9, f97_local10, Friends.SetEliteClanFriendStoredXUID, function () + if not CoDAnywhere.ServiceAvailable( f97_arg1.controller ) then + return no_friends( Engine.Localize( "@LUA_MENU_COD_ANYWHERE_ERROR_SERVICE" ) ) + elseif Clan.IsDownloadingData( f97_arg1.controller ) then + return { + type = "generic_loading_widget", + properties = { + message = Engine.Localize( "@MENU_DOWNLOADING" ) + } + } + else + return no_friends( Engine.Localize( "@MENU_NO_CLAN_DESCRIPTION" ) ) + end + end, false, false ) + return f97_local1( f97_arg0, f97_arg1 ) + end + end + f97_local10 = Friends.GetEliteClanFriendPrestige + end + end + f97_local9 = Friends.GetEliteClanFriendRank +end + +function DebugFriendsFeeder( f99_arg0, f99_arg1 ) + local f99_local0 = FriendFeederFactory( function ( f100_arg0, f100_arg1 ) + return "Friend " .. f100_arg1 + end, function () + return "At the beach" + end, function () + return "h" + end, function () + return "OINK" + end, function () + return 0 + end, function () + return 0 + end, function () + return 0 + end, function () + return 10 + end, function () + return 1 + end, function () + + end, function () + return no_friends( "No debug friends" ) + end, false ) + return f99_local0( f99_arg0, f99_arg1 ) +end + +function WIPFeeder( f111_arg0, f111_arg1 ) + local f111_local0 = {} + return no_friends( "Work in Progress" ) +end + +function MainFriendFeeder( f112_arg0 ) + local f112_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "popup_friends" ) + if f112_local0.feeder then + return f112_local0.feeder( f112_arg0, f112_local0 ) + else + return {} + end +end + +function CursorToTop( f113_arg0, f113_arg1 ) + local f113_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f113_arg0 ) + if f113_local0.slot_offset == 0 and f113_local0.current_slot == 0 then + return + else + f113_local0.slot_offset = 0 + f113_local0.current_slot = 0 + RefreshPage( f113_arg0, f113_arg1 ) + f113_arg0:dispatchEventToChildren( { + name = "focus_vlist", + immediate = true + } ) + end +end + +function PlatformShouldShowGameInvites() + local f114_local0 = Engine.IsPS3() + if not f114_local0 then + f114_local0 = Engine.IsPS4() + end + return f114_local0 +end + +function PlatformShouldShowPartyGameInvites() + return Engine.IsXB3() +end + +function PlatformShouldShowPartyUI() + return Engine.IsXbox360() +end + +function UpdateToTopButtonHelper( f117_arg0 ) + local f117_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f117_arg0 ) + local f117_local1 + if f117_local0.slot_offset <= 0 and f117_local0.current_slot <= 0 then + f117_local1 = false + else + f117_local1 = true + end + local f117_local2 = f117_arg0 + local f117_local3 = f117_arg0.processEvent + local f117_local4 = { + name = "add_button_helper_text", + button_ref = "button_alt1" + } + local f117_local5 + if f117_local1 then + f117_local5 = Engine.Localize( "@LUA_MENU_TOP" ) + if not f117_local5 then + + else + f117_local4.helper_text = f117_local5 + f117_local4.side = "left" + f117_local4.clickable = true + f117_local3( f117_local2, f117_local4 ) + end + end + f117_local5 = "" +end + +function UpdateSelectButtonHelper( f118_arg0 ) + local f118_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f118_arg0 ) + if f118_local0.total then + local f118_local1 = f118_local0.total > 0 + end + local f118_local2 = "" + if not f118_local0.challengeMode then + f118_local2 = Engine.Localize( "@LUA_MENU_SELECT" ) + else + f118_local2 = Engine.Localize( "@LUA_MENU_CHALLENGE" ) + end + f118_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_action", + helper_text = f118_local2, + side = "left", + clickable = true + } ) +end + +function SetOnlineFriendsHelpers( f119_arg0 ) + local f119_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f119_arg0 ) + UpdateToTopButtonHelper( f119_arg0 ) + if PlatformShouldShowGameInvites() and Friends.CountPendingPlaystationInvites and Friends.CountPendingPlaystationInvites( f119_local0.controller ) > 0 then + f119_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize( "@PLATFORM_VIEW_GAME_INVITES" ), + side = "left", + clickable = true + } ) + else + f119_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = "", + side = "left", + clickable = true + } ) + end + f119_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = "", + side = "left", + clickable = true + } ) +end + +function SetRecentPlayersHelpers( f120_arg0 ) + SetOnlineFriendsHelpers( f120_arg0 ) + f120_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = "", + side = "left", + clickable = true + } ) +end + +function SetLivePartyHelpers( f121_arg0 ) + local f121_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f121_arg0 ) + local f121_local1 = f121_local0.total + if f121_local1 then + f121_local1 = f121_local0.total > 1 + end + local f121_local2 = Engine.GetDvarBool( "onlinegame" ) + local f121_local3 = Engine.Localize + local f121_local4 + if f121_local1 and f121_local2 then + f121_local4 = "@PLATFORM_INVITE_XBOX_LIVE_PARTY" + if not f121_local4 then + + else + f121_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt1", + helper_text = f121_local3( f121_local4 ), + side = "left", + clickable = true + } ) + if PlatformShouldShowPartyUI() then + f121_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = Engine.Localize( "@PLATFORM_PARTY_UI" ), + side = "left", + clickable = true + } ) + else + f121_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = "", + side = "left", + clickable = true + } ) + end + if PlatformShouldShowPartyGameInvites() and Friends.HasPartyGameInvite() then + f121_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = Engine.Localize( "@XBOXLIVE_PARTY_INVITE_ACCEPT" ), + side = "left", + clickable = false + } ) + else + f121_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = "", + side = "left", + clickable = true + } ) + end + end + end + f121_local4 = "@MENU_INVITE_FRIENDS" +end + +function SetClanFriendsHelpers( f122_arg0 ) + local f122_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f122_arg0 ) + UpdateToTopButtonHelper( f122_arg0 ) + f122_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_alt2", + helper_text = "", + side = "left", + clickable = true + } ) + f122_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_start", + helper_text = "", + side = "left", + clickable = true + } ) +end + +function ButtonAlt1Action( f123_arg0, f123_arg1 ) + local f123_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f123_arg0 ) + if f123_local0.CurrentAlt1Action and f123_arg1.controller == f123_local0.exclusiveController then + f123_local0.CurrentAlt1Action( f123_arg0, f123_arg1 ) + end +end + +function ButtonAlt2Action( f124_arg0, f124_arg1 ) + local f124_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f124_arg0 ) + if f124_local0.CurrentAlt2Action and f124_arg1.controller == f124_local0.exclusiveController then + f124_local0.CurrentAlt2Action( f124_arg0, f124_arg1 ) + end +end + +function ButtonStartAction( f125_arg0, f125_arg1 ) + local f125_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f125_arg0 ) + if f125_local0.CurrentStartAction and f125_arg1.controller == f125_local0.exclusiveController then + f125_local0.CurrentStartAction( f125_arg0, f125_arg1 ) + end +end + +function ChangePage( f126_arg0, f126_arg1, f126_arg2, f126_arg3 ) + local f126_local0 + if f126_arg2 == 0 then + f126_local0 = not f126_arg3 + else + f126_local0 = false + end + local f126_local1 = LUI.FlowManager.GetMenuScopedDataFromElement( f126_arg0 ) + local f126_local2 = {} + if not f126_local1.isClanRoster then + f126_local2[#f126_local2 + 1] = { + title = Engine.Localize( "@LUA_MENU_FRIENDS" ), + feeder = OnlineFriendsFeeder, + actionsFeeder = OnlineFriendActionsFeeder, + friendsCounter = Friends.GetOnlineFriendsCount, + helpers = SetOnlineFriendsHelpers, + alt1Action = function ( f127_arg0, f127_arg1 ) + f127_arg0:dispatchEventToRoot( { + name = "cursor_to_top_trigger", + immediate = true + } ) + end, + alt2Action = function ( f128_arg0, f128_arg1 ) + if PlatformShouldShowGameInvites() and Friends.CountPendingPlaystationInvites and Friends.CountPendingPlaystationInvites( f128_arg1.controller ) > 0 then + Engine.Exec( "gameInvitesReceived", f128_arg1.controller ) + end + end + } + end + if not f126_local1.isClanRoster then + f126_local2[#f126_local2 + 1] = { + title = Engine.Localize( "@MENU_RECENT_PLAYERS" ), + feeder = RecentPlayersFeeder, + actionsFeeder = RecentPlayerActionsFeeder, + friendsCounter = Friends.GetRecentPlayersCount, + helpers = SetRecentPlayersHelpers, + alt1Action = function ( f129_arg0, f129_arg1 ) + f129_arg0:dispatchEventToRoot( { + name = "cursor_to_top_trigger", + immediate = true + } ) + end + } + end + if not f126_local1.isClanRoster and (Engine.IsXbox360() or Engine.IsXB3()) and not f126_local1.challengeMode then + f126_local2[#f126_local2 + 1] = { + title = Engine.Localize( "@XBOXLIVE_LIVE_PARTY" ), + actionsFeeder = LivePartyFriendActionsFeeder, + feeder = LivePartyFriendsFeeder, + friendsCounter = Friends.GetLivePartyFriendsCount, + helpers = SetLivePartyHelpers, + alt1Action = function ( f130_arg0, f130_arg1 ) + local f130_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f130_arg0 ) + local f130_local1 = f130_local0.total + if f130_local1 then + f130_local1 = f130_local0.total > 1 + end + if Engine.GetDvarBool( "onlinegame" ) and f130_local1 then + Friends.InviteAllLiveParty( f130_arg1.controller ) + elseif Friends.OpenSystemFriendsList then + Friends.OpenSystemFriendsList( f130_arg1.controller ) + else + Engine.Exec( "xshowfriendslist" ) + end + end, + alt2Action = function ( f131_arg0, f131_arg1 ) + Friends.OpenLivePartyUI( f131_arg1.controller ) + end, + startAction = function ( f132_arg0, f132_arg1 ) + if Friends.HasPartyGameInvite() then + Friends.AcceptLivePartyInvitation( f132_arg1.controller ) + end + end + } + end + local f126_local3 = nil + if Clan.IsEnabled() and not f126_local1.challengeMode then + f126_local2[#f126_local2 + 1] = { + title = Friends.GetEliteClanName( f126_local1.controller ), + feeder = EliteClanFriendsFeeder, + actionsFeeder = EliteClanFriendActionsFeeder, + friendsCounter = Friends.GetEliteClanFriendsCount, + helpers = SetClanFriendsHelpers, + alt1Action = function ( f133_arg0, f133_arg1 ) + f133_arg0:dispatchEventToRoot( { + name = "cursor_to_top_trigger", + immediate = true + } ) + end + } + f126_local3 = #f126_local2 + end + if not f126_local1.total then + f126_local1.total = 0 + end + local f126_local4 = f126_local1.page_index + local f126_local5 = f126_local4 + f126_local4 = math.max( 1, math.min( f126_local4 + f126_arg2, #f126_local2 ) ) + if f126_arg2 ~= 0 and f126_local4 == f126_local5 then + return + end + f126_local1.page_index = f126_local4 + f126_local1.feeder = f126_local2[f126_local4].feeder + f126_local1.actionsFeeder = f126_local2[f126_local4].actionsFeeder + local f126_local6 = f126_local1.total + f126_local1.total = f126_local2[f126_local4].friendsCounter( f126_local1.controller ) + if f126_arg2 ~= 0 and f126_local1.total == 0 then + Engine.PlaySound( CoD.SFX.MouseOver ) + end + if f126_local0 then + f126_local0 = f126_local1.total == f126_local6 + end + if not f126_local0 and not f126_local1.isTopOfStack then + f126_local1.total = f126_local6 + return + end + local f126_local7 = Clan.IsDownloadingData( f126_local1.controller ) + if f126_local0 then + if f126_local1.page_index == f126_local3 and f126_local1.wasDownloadingClanData then + f126_local0 = f126_local7 + else + f126_local0 = true + end + end + f126_local1.wasDownloadingClanData = f126_local7 + if not f126_local0 then + f126_local1.current_slot = 0 + f126_local1.slot_offset = 0 + f126_arg0:processEvent( { + name = "wipe_vlist" + } ) + f126_local1.maxButtonsOnPage = Engine.InFrontend() and 5 or 9 + f126_local1.upScrollBoundary = 1 + f126_local1.downScrollBoundary = f126_local1.maxButtonsOnPage - 2 + end + if not f126_local0 then + f126_arg0:processEvent( { + name = "menu_refresh" + } ) + else + f126_arg0:processEvent( { + name = "element_refresh" + } ) + end + if not f126_local0 then + if f126_local1.isTopOfStack and not f126_arg1.mouse then + f126_arg0:processEvent( { + name = "focus_vlist" + } ) + end + if f126_local1.isClanRoster then + f126_arg0:processEvent( { + name = "hide_arrows" + } ) + else + if f126_local4 == 1 then + f126_arg0:processEvent( { + name = "disable_left_arrow" + } ) + else + f126_arg0:processEvent( { + name = "enable_left_arrow" + } ) + end + if f126_local4 == #f126_local2 then + f126_arg0:processEvent( { + name = "disable_right_arrow" + } ) + else + f126_arg0:processEvent( { + name = "enable_right_arrow" + } ) + end + end + f126_arg0:processEvent( { + name = "update_title", + title_text = f126_local2[f126_local4].title + } ) + f126_local1.CurrentAlt1Action = f126_local2[f126_local4].alt1Action + f126_local1.CurrentAlt2Action = f126_local2[f126_local4].alt2Action + f126_local1.CurrentStartAction = f126_local2[f126_local4].startAction + UpdateSelectButtonHelper( f126_arg0 ) + end + if f126_local1.total and 0 < f126_local1.total then + f126_arg0:processEvent( { + name = "show_scrollbar" + } ) + if f126_local1.scrollbar then + f126_local1.scrollbar:manualUpdate( f126_local1.slot_offset, f126_local1.maxButtonsOnPage, f126_local1.total, Friends.Constants.FriendButtonHeight ) + end + else + f126_arg0:processEvent( { + name = "hide_scrollbar" + } ) + end + if f126_local2[f126_local4].helpers then + f126_local2[f126_local4].helpers( f126_arg0 ) + end +end + +function NextPage( f134_arg0, f134_arg1 ) + local f134_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f134_arg0 ) + if f134_arg1.controller == f134_local0.exclusiveController then + ChangePage( f134_arg0, f134_arg1, 1, true ) + end +end + +function PreviousPage( f135_arg0, f135_arg1 ) + local f135_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f135_arg0 ) + if f135_arg1.controller == f135_local0.exclusiveController then + ChangePage( f135_arg0, f135_arg1, -1, true ) + end +end + +function RefreshPage( f136_arg0, f136_arg1 ) + ChangePage( f136_arg0, f136_arg1, 0, f136_arg1.forceRefresh or false ) +end + +function UpdatePopupTitle( f137_arg0, f137_arg1 ) + f137_arg0:setText( f137_arg1.title ) +end + +f0_local0 = function ( f138_arg0, f138_arg1 ) + local f138_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f138_arg0 ) + f138_local0.isTopOfStack = true + f138_local0.controller = f138_arg0.properties.exclusiveController + f138_local0.isClanRoster = f138_arg0.properties.isClanRoster + f138_local0.feeder = function () + return {} + end + + f138_local0.page_index = 1 + f138_local0.slot_offset = 0 + f138_local0.current_slot = 0 + f138_local0.scrollbar = f138_arg0:getFirstDescendentById( "scrollbar" ) + f138_local0.scrollbar:setList( f138_arg0:getFirstDescendentById( "friends_vlist" ) ) + if Friends.IsEliteClanAllowed( f138_local0.controller ) and Engine.InFrontend() and 0 > Engine.GetDvarInt( "elite_clan_delay" ) then + Engine.Exec( "starteliteclan" ) + end + if Engine.IsXB3() then + Engine.ExecNow( "friends_refresh", f138_local0.controller ) + end + Engine.ExecNow( "refreshfacebookfriends" ) + Engine.ExecNow( "eliteclan_refresh", f138_arg0.properties.exclusiveController ) + f138_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true + } ) + if Friends.HasPartyGameInvite() and not f138_local0.isClanRoster then + ChangePage( f138_arg0, f138_arg1, 2, true ) + else + ChangePage( f138_arg0, f138_arg1, 0, true ) + end +end + +function friends_list() + return { + type = "UIElement", + id = "friends_list_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + handlers = { + menu_create = f0_local0, + popup_active = function ( f141_arg0, f141_arg1 ) + local f141_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f141_arg0 ) + f141_local0.isTopOfStack = false + end + , + popup_inactive = function ( f142_arg0, f142_arg1 ) + local f142_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f142_arg0 ) + f142_local0.isTopOfStack = true + end + , + previous_page = PreviousPage, + next_page = NextPage, + friends_refresh = RefreshPage, + cursor_to_top_trigger = CursorToTop, + update_to_top_button_helper = UpdateToTopButtonHelper, + live_connection = function ( f143_arg0, f143_arg1 ) + if f143_arg1.signed_in == nil then + f143_arg1.signed_in = Engine.IsUserSignedInToLive() + end + if not f143_arg1.signed_in then + f143_arg0:dispatchEventToRoot( { + name = "kill_friends_list", + immediate = true + } ) + LUI.FlowManager.RequestLeaveMenu( f143_arg0 ) + end + end + + }, + children = { + { + type = "UITimer", + id = "friends_refresh_timer", + properties = { + event = { + name = "friends_refresh", + dispatchChildren = true + }, + interval = 1000 + } + }, + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.Overlay.AlphaMore + } ) + } + }, + { + type = "UIImage", + id = "black_bar_1", + states = { + default = { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = false, + left = 0, + bottom = 0, + right = 0, + height = 300, + red = 0, + green = 0, + blue = 0, + alpha = Engine.InFrontend() and 0 or 1, + material = RegisterMaterial( "white" ) + } + } + }, + { + type = "UIImage", + id = "black_bar_2", + states = { + default = { + leftAnchor = true, + topAnchor = false, + rightAnchor = true, + bottomAnchor = true, + left = 0, + top = 0, + right = 0, + height = 300, + red = 0, + green = 0, + blue = 0, + alpha = Engine.InFrontend() and 0 or 1, + material = RegisterMaterial( "white" ) + } + } + }, + { + type = "UIElement", + id = "popup", + properties = { + exclusiveController = MBh.Property( "exclusiveController" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -275, + bottom = 275, + left = Engine.InFrontend() and -395 or -485, + right = Engine.InFrontend() and 395 or 485 + } + }, + children = { + { + type = "generic_drop_shadow", + properties = { + offset_shadow = 0 + } + }, + { + type = "generic_menu_titlebar", + id = "popup_title", + properties = { + title_bar_text = "", + fill_alpha = 1 + } + }, + { + type = "UIWorldBlur", + id = "optionsWorldBlurOverlay", + states = { + default = { + worldBlur = Engine.InFrontend() and 0 or 5 + } + } + }, + { + type = "generic_menu_background", + id = "popup_background", + properties = { + fill_alpha = 1 + } + }, + { + type = "UIElement", + id = "help_padding", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 1, + right = -1, + top = 0, + bottom = -1 + } + }, + children = { + { + type = "button_helper_text_main", + id = "help_texts", + properties = { + left_inset = 10, + top_margin = GenericFooterDims.TopMargin_WithoutBackground, + background_alpha = 0 + } + } + } + }, + { + type = "UIButton", + id = "arrow_left_btn", + requireFocusType = FocusType.MouseOver, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 6, + bottom = 28, + left = 50, + right = 72, + alpha = 1 + }, + disabled = { + alpha = 0.3 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + button_action = function ( f144_arg0, f144_arg1 ) + f144_arg0:dispatchEventToRoot( { + name = "previous_page", + mouse = true, + controller = f144_arg1.controller + } ) + end + , + enable_left_arrow = MBh.AnimateToState( "default" ), + disable_left_arrow = MBh.AnimateToState( "disabled" ), + hide_arrows = MBh.AnimateToState( "hidden" ) + }, + children = { + { + type = "UIImage", + id = "arrow_left", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 22, + right = -22, + material = RegisterMaterial( "widg_lobby_arrow" ) + } + } + } + } + }, + { + type = "UIButton", + id = "arrow_right_btn", + requireFocusType = FocusType.MouseOver, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 6, + bottom = 28, + left = -72, + right = -50, + alpha = 1 + }, + disabled = { + alpha = 0.3 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + button_action = function ( f145_arg0, f145_arg1 ) + f145_arg0:dispatchEventToRoot( { + name = "next_page", + mouse = true, + controller = f145_arg1.controller + } ) + end + , + enable_right_arrow = MBh.AnimateToState( "default" ), + disable_right_arrow = MBh.AnimateToState( "disabled" ), + hide_arrows = MBh.AnimateToState( "hidden" ) + }, + children = { + { + type = "UIImage", + id = "arrow_right", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "widg_lobby_arrow" ) + } + } + } + } + }, + { + type = "UIElement", + id = "popup_content", + properties = { + exclusiveController = MBh.Property( "exclusiveController" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = GenericTitleBarDims.TitleBarHeight, + bottom = 0, + spacing = 0 + } + }, + children = { + { + type = "UIVerticalList", + id = "friends_vlist", + handlers = { + focus_vlist = function ( f146_arg0, f146_arg1 ) + f146_arg0:processEvent( { + name = "lose_focus" + } ) + f146_arg0:clearSavedState() + f146_arg0:processEvent( { + name = "gain_focus" + } ) + end + , + wipe_vlist = function ( f147_arg0, f147_arg1 ) + f147_arg0:closeChildren() + f147_arg0:processEvent( { + name = "lose_focus" + } ) + f147_arg0:clearSavedState() + end + + }, + properties = { + exclusiveController = MBh.Property( "exclusiveController" ), + noWrap = true, + sendScrollEvents = true + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 4, + right = -Friends.Constants.scrollbarWidth - 3, + top = 3, + bottom = -3, + spacing = 4, + alignment = LUI.Alignment.Center + } + }, + childrenFeeder = MainFriendFeeder + }, + { + type = "UIVerticalScrollbar", + id = "scrollbar", + properties = { + on_move_func = function ( f148_arg0, f148_arg1, f148_arg2, f148_arg3 ) + local f148_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f148_arg1 ) + if f148_local0.total then + f148_local0.slot_offset = math.floor( f148_arg2 * f148_local0.total ) + f148_local0.slot_offset = LUI.clamp( f148_local0.slot_offset, 0, math.max( 0, f148_local0.total - f148_local0.maxButtonsOnPage ) ) + f148_arg1:dispatchEventToRoot( { + name = "friends_refresh", + immediate = true + } ) + end + end + + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 3, + bottom = -41, + left = -Friends.Constants.scrollbarWidth, + right = -4, + alpha = 1 + }, + visible = { + alpha = 1 + }, + hidden = { + alpha = 0 + } + }, + handlers = { + hide_scrollbar = MBh.AnimateToState( "hidden", 0 ), + show_scrollbar = MBh.AnimateToState( "visible", 0 ), + init_scrollbar = function ( f149_arg0, f149_arg1 ) + local f149_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f149_arg0 ) + f149_arg0:manualUpdate( f149_local0.slot_offset, f149_local0.maxButtonsOnPage, f149_local0.total, Friends.Constants.FriendButtonHeight ) + end + + }, + children = { + { + type = "UITimer", + properties = { + event = "init_scrollbar", + interval = 1, + disposable = true, + deferNextFrame = true + } + } + } + } + } + } + } + }, + { + type = "generic_back_button" + }, + { + type = "UIBindButton", + handlers = { + button_left = function ( f150_arg0, f150_arg1 ) + f150_arg0:dispatchEventToRoot( { + name = "previous_page", + controller = f150_arg1.controller, + immediate = true + } ) + end + , + button_right = function ( f151_arg0, f151_arg1 ) + f151_arg0:dispatchEventToRoot( { + name = "next_page", + controller = f151_arg1.controller, + immediate = true + } ) + end + , + button_alt1 = ButtonAlt1Action, + button_alt2 = ButtonAlt2Action, + button_start = ButtonStartAction + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "popup_friends", friends_list ) +LUI.MenuBuilder.registerDef( "popup_friend_list_actions", popup_friend_list_actions ) +LUI.MenuBuilder.registerDef( "popup_friend_invite_sent", popup_friend_invite_sent ) +LUI.MenuBuilder.registerDef( "popup_friend_report", popup_friend_report ) +LUI.MenuBuilder.registerDef( "popup_confirm_report", popup_confirm_report ) +LUI.MenuBuilder.registerDef( "popup_elite_clan_updating", popup_elite_clan_updating ) +LUI.MenuBuilder.registerDef( "popup_update_clan_finished", popup_update_clan_finished ) +LUI.MenuBuilder.registerDef( "popup_kick_are_you_sure", popup_kick_are_you_sure ) +LUI.MenuBuilder.registerDef( "popup_transfer_are_you_sure", popup_transfer_are_you_sure ) +LUI.MenuBuilder.registerDef( "popup_leave_are_you_sure", popup_leave_are_you_sure ) +LUI.MenuBuilder.registerDef( "popup_leave_leader_are_you_sure", popup_leave_leader_are_you_sure ) +LUI.MenuBuilder.registerDef( "popup_leave_leader_with_members", popup_leave_leader_with_members ) +LUI.MenuBuilder.registerDef( "popup_change_status", popup_change_status ) +LUI.MenuBuilder.registerDef( "popup_join_on_blocked_player_are_you_sure", popup_join_on_blocked_player_are_you_sure ) +LockTable( _M ) diff --git a/lui/common_menus/friendslistutils.dec.lua b/lui/common_menus/friendslistutils.dec.lua new file mode 100644 index 0000000..fa46267 --- /dev/null +++ b/lui/common_menus/friendslistutils.dec.lua @@ -0,0 +1,16 @@ +if Friends then + Friends.Constants = { + scrollbarWidth = 14, + FriendButtonHeight = 90, + reportOffensiveLobbyPlayer = 4, + reportExploitingLobbyPlayer = 5, + reportCheatingLobbyPlayer = 6, + reportBoostingLobbyPlayer = 7 + } + Friends.FacebookAllowedFlags = { + Active = 1, + FriendsActive = 2, + UploadPhotoActive = 4, + UploadVideoActive = 8 + } +end diff --git a/lui/common_menus/friendswidget.dec.lua b/lui/common_menus/friendswidget.dec.lua new file mode 100644 index 0000000..3d0faea --- /dev/null +++ b/lui/common_menus/friendswidget.dec.lua @@ -0,0 +1,150 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function CanSomeoneAccessFriendslist() + for f1_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do + if Engine.HasActiveLocalClient( f1_local0 ) and Engine.UserCanAccessFriendsList( f1_local0 ) then + return true + end + end + return false +end + +function online_friends_widget( f2_arg0, f2_arg1 ) + if not f2_arg1 then + f2_arg1 = {} + end + local self = LUI.UIElement.new( { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + bottom = -35, + right = -100, + width = 50, + height = 36, + alpha = 1 + } ) + self:registerAnimationState( "disabled", { + alpha = 0 + } ) + self.id = "online_friends_widget" + self:registerEventHandler( "show_widget", function ( element, event ) + local f3_local0 = element:getParent() + if f3_local0 then + local f3_local1 = LUI.ButtonHelperText.CommonEvents.addFriendsButton + f3_local1.ignorePopups = f2_arg1.ignorePopups + f3_local0:processEvent( f3_local1 ) + element:animateToState( "default", 100 ) + if Engine.IsXB3() or not Engine.IsConsoleGame() then + Engine.ExecNow( "friends_widget_refresh" ) + end + end + end ) + self:registerEventHandler( "hide_widget", function ( element, event ) + local f4_local0 = element:getParent() + if f4_local0 then + local f4_local1 = LUI.ButtonHelperText.CommonEvents.removeFriendsButton + f4_local1.dispatchChildren = true + f4_local0:processEvent( f4_local1 ) + element:animateToState( "disabled", 0 ) + end + end ) + self:registerEventHandler( "live_connection", function ( element, event ) + if event.signed_in == nil then + local f5_local0 = Engine.IsNetworkConnected() + if f5_local0 then + f5_local0 = Engine.IsUserSignedInToLive() + end + event.signed_in = f5_local0 + end + if event.signed_in and CanSomeoneAccessFriendslist() then + element:processEvent( { + name = "show_widget" + } ) + else + element:processEvent( { + name = "hide_widget" + } ) + end + end ) + self:registerEventHandler( "network_connection", function ( element, event ) + if not event.plugged_in then + element:processEvent( { + name = "hide_widget" + } ) + elseif Engine.IsUserSignedInToLive() then + element:processEvent( { + name = "show_widget" + } ) + end + end ) + self:registerEventHandler( "menu_create", function ( element, event ) + element:processEvent( { + name = "live_connection" + } ) + end ) + local f2_local1 = LUI.UIBindButton.new() + f2_local1.id = "friends_bind_buttons_id" + f2_local1:registerEventHandler( "button_alt2", function ( element, event ) + if Engine.IsNetworkConnected() and Engine.IsUserSignedInToLive( event.controller ) then + local f8_local0 = Engine.UserCanAccessFriendsList( event.controller ) + local f8_local1 = Engine.IsUserAGuest( event.controller ) + if f8_local0 and not f8_local1 then + if Engine.InFrontend() then + LUI.FlowManager.RequestPopupMenu( element, "popup_friends", true, event.controller, false, {} ) + else + LUI.FlowManager.RequestAddMenu( element, "popup_friends", true, event.controller, false, {} ) + end + elseif f8_local1 then + LUI.FlowManager.RequestPopupMenu( element, "mp_no_guest_popup", false, event.controller, false ) + elseif Engine.IsPS3() and event.controller ~= 0 then + LUI.FlowManager.RequestPopupMenu( element, "mp_wrong_controller_popup", false, event.controller, false ) + end + end + return true + end ) + self:addElement( f2_local1 ) + local f2_local2 = LUI.UIImage.new + local f2_local3 = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -5, + bottom = 5, + left = 0, + right = 10, + material = RegisterMaterial( "widg_triangle" ) + } + if not Engine.InFrontend() then + local f2_local4 = Engine.GetDvarBool( "dedicated_dhclient" ) + local f2_local5 = 0.7 + end + f2_local3.alpha = f2_local4 and f2_local5 or 0.25 + f2_local3.zRot = -135 + f2_local2 = f2_local2( f2_local3 ) + f2_local2.id = "friends_triangle_id" + self:addElement( f2_local2 ) + if Friends then + f2_local3 = LUI.UIText.new( CoD.ColorizeState( Colors.frontend_hilite, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + left = 0, + right = 0, + height = CoD.TextSettings.BigFont.Height, + font = CoD.TextSettings.BigFont.Font, + alignment = LUI.Alignment.Right + } ) ) + f2_local3.id = "friends_number_text" + f2_local3:setupUIBindText( "CountOnlineFriends" ) + self:addElement( f2_local3 ) + end + return self +end + +LUI.MenuBuilder.registerType( "online_friends_widget", online_friends_widget ) +LockTable( _M ) diff --git a/lui/common_menus/gamemanual.dec.lua b/lui/common_menus/gamemanual.dec.lua new file mode 100644 index 0000000..bf7354e --- /dev/null +++ b/lui/common_menus/gamemanual.dec.lua @@ -0,0 +1,423 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function () + local f1_local0 = nil + local f1_local1 = Languages[Engine.GetCurrentLanguage and Engine.GetCurrentLanguage() or 0] + assert( f1_local1 ) + local f1_local2 = "bkgd_manual_" + if Engine.IsSpecialRegion() then + if f1_local1 == "LANGUAGE_FRENCH" then + f1_local2 = "bkgd_manual_alt_language_" + f1_local1 = "LANGUAGE_FRENCHCA" + elseif f1_local1 == "LANGUAGE_ENGLISH" then + f1_local2 = "bkgd_manual_alt_language_" + f1_local1 = "LANGUAGE_ENGLISHUK" + end + end + local f1_local3 = { + X360 = { + LANGUAGE_BRITISH = 4, + LANGUAGE_ENGLISH = 5, + LANGUAGE_FRENCH = 5, + LANGUAGE_GERMAN = 5, + LANGUAGE_ITALIAN = 5, + LANGUAGE_SPANISH = 5, + LANGUAGE_RUSSIAN = 5, + LANGUAGE_POLISH = 5, + LANGUAGE_KOREAN = 5, + LANGUAGE_TAIWANESE = 5, + LANGUAGE_JAPANESE = 4, + LANGUAGE_CHINESE = 5, + LANGUAGE_THAI = 5, + LANGUAGE_CZECH = 5, + LANGUAGE_SPANISHNA = 5, + LANGUAGE_PORTUGUESE = 5, + LANGUAGE_FRENCHCA = 1, + LANGUAGE_ENGLISHUK = 5 + }, + XB3 = { + LANGUAGE_BRITISH = 5, + LANGUAGE_ENGLISH = 4, + LANGUAGE_FRENCH = 4, + LANGUAGE_GERMAN = 4, + LANGUAGE_ITALIAN = 4, + LANGUAGE_SPANISH = 4, + LANGUAGE_RUSSIAN = 4, + LANGUAGE_POLISH = 4, + LANGUAGE_KOREAN = 4, + LANGUAGE_TAIWANESE = 4, + LANGUAGE_JAPANESE = 5, + LANGUAGE_CHINESE = 4, + LANGUAGE_THAI = 4, + LANGUAGE_CZECH = 4, + LANGUAGE_SPANISHNA = 4, + LANGUAGE_PORTUGUESE = 4, + LANGUAGE_FRENCHCA = 4, + LANGUAGE_ENGLISHUK = 4 + }, + PS3 = { + LANGUAGE_BRITISH = 4, + LANGUAGE_ENGLISH = 6, + LANGUAGE_FRENCH = 7, + LANGUAGE_GERMAN = 7, + LANGUAGE_ITALIAN = 7, + LANGUAGE_SPANISH = 7, + LANGUAGE_RUSSIAN = 7, + LANGUAGE_POLISH = 7, + LANGUAGE_KOREAN = 6, + LANGUAGE_TAIWANESE = 6, + LANGUAGE_JAPANESE = 4, + LANGUAGE_CHINESE = 6, + LANGUAGE_THAI = 6, + LANGUAGE_CZECH = 6, + LANGUAGE_SPANISHNA = 6, + LANGUAGE_PORTUGUESE = 6, + LANGUAGE_FRENCHCA = 6, + LANGUAGE_ENGLISHUK = 7 + }, + PS4 = { + LANGUAGE_BRITISH = 4, + LANGUAGE_ENGLISH = 5, + LANGUAGE_FRENCH = 7, + LANGUAGE_GERMAN = 7, + LANGUAGE_ITALIAN = 7, + LANGUAGE_SPANISH = 7, + LANGUAGE_RUSSIAN = 7, + LANGUAGE_POLISH = 7, + LANGUAGE_KOREAN = 6, + LANGUAGE_TAIWANESE = 6, + LANGUAGE_JAPANESE = 4, + LANGUAGE_CHINESE = 6, + LANGUAGE_THAI = 6, + LANGUAGE_CZECH = 6, + LANGUAGE_SPANISHNA = 5, + LANGUAGE_PORTUGUESE = 5, + LANGUAGE_FRENCHCA = 5, + LANGUAGE_ENGLISHUK = 7 + }, + PC = { + LANGUAGE_BRITISH = 3, + LANGUAGE_ENGLISH = 5, + LANGUAGE_FRENCH = 5, + LANGUAGE_GERMAN = 5, + LANGUAGE_ITALIAN = 5, + LANGUAGE_SPANISH = 5, + LANGUAGE_RUSSIAN = 5, + LANGUAGE_POLISH = 5, + LANGUAGE_KOREAN = 5, + LANGUAGE_TAIWANESE = 5, + LANGUAGE_JAPANESE = 3, + LANGUAGE_CHINESE = 5, + LANGUAGE_THAI = 5, + LANGUAGE_CZECH = 5, + LANGUAGE_SPANISHNA = 5, + LANGUAGE_PORTUGUESE = 5, + LANGUAGE_FRENCHCA = 5, + LANGUAGE_ENGLISHUK = 5 + } + } + if Engine.IsXbox360() then + f1_local0 = f1_local3.X360[f1_local1] + elseif Engine.IsXB3() then + f1_local0 = f1_local3.XB3[f1_local1] + elseif Engine.IsPS3() then + f1_local0 = f1_local3.PS3[f1_local1] + elseif Engine.IsPS4() then + f1_local0 = f1_local3.PS4[f1_local1] + else + f1_local0 = f1_local3.PC[f1_local1] + end + assert( f1_local0 ) + local f1_local4 = {} + for f1_local5 = 1, f1_local0, 1 do + table.insert( f1_local4, f1_local2 .. f1_local5 ) + end + return f1_local4 +end + +function changePage( f2_arg0, f2_arg1 ) + local f2_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f2_arg0 ) + local f2_local1 = f2_local0.currentPage + f2_local0.currentPage = LUI.clamp( f2_local0.currentPage + f2_arg1, 1, #f2_local0.manualPages ) + f2_arg0:dispatchEventToRoot( { + name = "change_page" + } ) + if f2_local1 ~= f2_local0.currentPage then + if f2_arg1 > 0 then + f2_arg0:dispatchEventToRoot( { + name = "next_page" + } ) + elseif f2_arg1 < 0 then + f2_arg0:dispatchEventToRoot( { + name = "previous_page" + } ) + end + end +end + +function game_manual() + local f3_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "game_manual" ) + f3_local0.manualPages = f0_local0() + assert( #f3_local0.manualPages > 0 ) + local self = LUI.UIElement.new() + self.id = "game_manual" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f3_local2 = LUI.UIImage.new() + f3_local2.id = "centerPage" + f3_local2:registerAnimationState( "default", { + material = RegisterMaterial( f3_local0.manualPages[1] ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f3_local2:animateToState( "default" ) + f3_local2:registerEventHandler( "change_page", function ( element, event ) + local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + element:setImage( RegisterMaterial( f4_local0.manualPages[f4_local0.currentPage] ) ) + end ) + self:addElement( f3_local2 ) + local f3_local3 = LUI.UIButton.new() + f3_local3.id = "leftArrow" + f3_local3:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -330, + left = 100, + width = 40, + height = 80, + alpha = 1 + } ) + f3_local3:registerAnimationState( "disabled", { + alpha = 0.5 + } ) + f3_local3:registerAnimationState( "bump", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -330, + left = 90, + width = 40, + height = 80 + } ) + f3_local3:registerEventHandler( "next_page", MBh.AnimateToState( "default", 0 ) ) + f3_local3:registerEventHandler( "previous_page", function ( element, event ) + local f5_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + local f5_local1 = { + { + "default", + 0 + }, + { + "bump", + 40, + true, + true + }, + { + "default", + 100, + true, + true + } + } + if f5_local0.currentPage <= 1 then + table.insert( f5_local1, { + "disabled", + 80 + } ) + end + local f5_local2 = MBh.AnimateSequence( f5_local1 ) + f5_local2( element, event ) + end ) + f3_local3:registerEventHandler( "button_action", function ( element, event ) + changePage( element, -1 ) + end ) + f3_local3:registerEventHandler( "button_over", function ( element, event ) + if event.focusType == FocusType.MouseOver then + element:processEvent( { + name = "arrow_image_over", + immediate = true + } ) + end + end ) + f3_local3:registerEventHandler( "button_up", function ( element, event ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + if f8_local0.currentPage > 1 then + element:animateToState( "default" ) + else + element:animateToState( "disabled" ) + end + element:processEvent( { + name = "arrow_image_up", + immediate = true + } ) + end ) + f3_local3:animateToState( "default" ) + f3_local3:animateToState( "disabled" ) + local f3_local4 = LUI.UIImage.new() + f3_local4.id = "leftArrowImage" + f3_local4:registerAnimationState( "default", CoD.ColorizeState( Colors.white, { + material = RegisterMaterial( "widg_margin_arrow_lt" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) ) + f3_local4:registerAnimationState( "over", CoD.ColorizeState( Colors.frontend_hilite, {} ) ) + f3_local4:animateToState( "default" ) + f3_local4:registerEventHandler( "arrow_image_over", MBh.AnimateToState( "over" ) ) + f3_local4:registerEventHandler( "arrow_image_up", MBh.AnimateToState( "default" ) ) + f3_local3:addElement( f3_local4 ) + self:addElement( f3_local3 ) + local f3_local5 = LUI.UIButton.new() + f3_local5.id = "rightArrow" + f3_local5:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = -330, + right = -100, + width = 40, + height = 80, + alpha = 1 + } ) + f3_local5:registerAnimationState( "disabled", { + alpha = 0.5 + } ) + f3_local5:registerAnimationState( "bump", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = -330, + right = -90, + width = 40, + height = 80 + } ) + f3_local5:registerEventHandler( "previous_page", MBh.AnimateToState( "default", 0 ) ) + f3_local5:registerEventHandler( "next_page", function ( element, event ) + local f9_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + local f9_local1 = { + { + "default", + 0 + }, + { + "bump", + 40, + true, + true + }, + { + "default", + 100, + true, + true + } + } + if #f9_local0.manualPages <= f9_local0.currentPage then + table.insert( f9_local1, { + "disabled", + 80 + } ) + end + local f9_local2 = MBh.AnimateSequence( f9_local1 ) + f9_local2( element, event ) + end ) + f3_local5:animateToState( "default" ) + f3_local5:registerEventHandler( "button_action", function ( element, event ) + changePage( element, 1 ) + end ) + f3_local5:registerEventHandler( "button_over", function ( element, event ) + if event.focusType == FocusType.MouseOver then + element:processEvent( { + name = "arrow_image_over", + immediate = true + } ) + end + end ) + f3_local5:registerEventHandler( "button_up", function ( element, event ) + local f12_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + if f12_local0.currentPage < #f12_local0.manualPages then + element:animateToState( "default" ) + else + element:animateToState( "disabled" ) + end + element:processEvent( { + name = "arrow_image_up", + immediate = true + } ) + end ) + local f3_local6 = LUI.UIImage.new() + f3_local6.id = "leftArrowImage" + f3_local6:registerAnimationState( "default", CoD.ColorizeState( Colors.white, { + material = RegisterMaterial( "widg_margin_arrow_rt" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + bottom = 0 + } ) ) + f3_local6:registerAnimationState( "over", CoD.ColorizeState( Colors.frontend_hilite, {} ) ) + f3_local6:animateToState( "default" ) + f3_local6:registerEventHandler( "arrow_image_over", MBh.AnimateToState( "over" ) ) + f3_local6:registerEventHandler( "arrow_image_up", MBh.AnimateToState( "default" ) ) + f3_local5:addElement( f3_local6 ) + self:addElement( f3_local5 ) + local f3_local7 = LUI.MenuBuilder.BuildAddChild( self, { + type = "button_helper_text_main", + properties = { + background_alpha = 1 + } + } ) + f3_local7:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) + local f3_local8 = LUI.UIBindButton.new() + f3_local8.id = "bind" + f3_local8:registerEventHandler( "button_secondary", function ( element, event ) + LUI.FlowManager.RequestLeaveMenu( element ) + end ) + f3_local8:registerEventHandler( "button_left", function ( element, event ) + changePage( element, -1 ) + end ) + f3_local8:registerEventHandler( "button_right", function ( element, event ) + changePage( element, 1 ) + end ) + self:addElement( f3_local8 ) + self:registerEventHandler( "menu_create", function ( element, event ) + local f16_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( element ) + f16_local0.currentPage = 1 + changePage( element, 0 ) + end ) + return self +end + +LUI.MenuBuilder.registerType( "game_manual", game_manual ) +LockTable( _M ) diff --git a/lui/common_menus/kinectcontrolmenu.dec.lua b/lui/common_menus/kinectcontrolmenu.dec.lua new file mode 100644 index 0000000..3dd57db --- /dev/null +++ b/lui/common_menus/kinectcontrolmenu.dec.lua @@ -0,0 +1,782 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function KinectGuideFeeder( f1_arg0 ) + local f1_local0 = {} + Kinect.BuildShortcutArray() + if Kinect.ShortcutArray ~= nil then + for f1_local1 = 1, #Kinect.ShortcutArray, 1 do + local f1_local4 = f1_local1 + table.insert( f1_local0, { + type = "UIButton", + id = "kinect_guide_grid_" .. f1_local4 .. "_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + width = Kinect.Layout.CellWidth, + height = Kinect.Layout.CellHeight + } + }, + handlers = { + button_action = function ( f2_arg0, f2_arg1 ) + Kinect.ExecShortcut( f2_arg0, f2_arg1, f1_local4 ) + end + }, + children = { + { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 1 + }, + dim = { + alpha = 0.8 + } + }, + handlers = { + button_over = MBh.AnimateLoop( { + { + "dim", + 750, + true, + true + }, + { + "default", + 750 + } + } ), + button_up = MBh.AnimateToState( "default", 0 ) + }, + children = { + { + type = "kinect_button_background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.05 + }, + focused = { + alpha = 0.4 + } + }, + handlers = { + button_over = MBh.AnimateToState( "focused" ), + button_up = MBh.AnimateToState( "default" ) + } + } + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 16, + left = 0, + right = 16, + material = RegisterMaterial( "widg_triangle" ), + alpha = 0 + }, + focused = { + alpha = 1 + } + }, + handlers = { + button_over = MBh.AnimateToState( "focused" ), + button_up = MBh.AnimateToState( "default" ) + } + }, + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Colors.white, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = 0, + width = 128, + height = 128, + material = RegisterMaterial( "icon_kinect_number_0" .. f1_local4 ), + alpha = 0.1 + } ), + focused = CoD.ColorizeState( Colors.black, { + scale = 0.1 + } ), + unfocused = CoD.ColorizeState( Colors.black, { + scale = 0 + } ) + }, + handlers = { + button_over = MBh.AnimateSequence( { + { + "unfocused", + 0 + }, + { + "focused", + 100 + }, + { + "unfocused", + 100 + } + } ), + button_up = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = 0, + left = 0, + right = 0, + height = 32 + } + }, + children = { + { + type = "kinect_btn_footer_bg", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.5 + } + } + }, + { + type = "UIMarqueeText", + id = "kinect_guide_grid_desc_id", + properties = { + text = Engine.Localize( Kinect.ShortcutArray[f1_local4].TextLabel ), + textStyle = CoD.TextStyle.OutlinedMore + }, + states = { + default = CoD.ColorizeState( Kinect.Swatch.DescColor, { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 3, + right = -3, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center + } ), + focused = CoD.ColorizeState( Kinect.Swatch.DescColorInvert, {} ), + unfocused = CoD.ColorizeState( Kinect.Swatch.DescColor, {} ) + } + } + } + } + } + } ) + end + else + DebugPrint( "Kinect: Warning, Kinect.ShortcutArray is nil!" ) + end + return f1_local0 +end + +function kinect_btn_footer_bg() + return { + type = "UIElement", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 8, + material = RegisterMaterial( "box_kinect_name_lt" ) + } + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 8, + right = -8, + material = RegisterMaterial( "box_kinect_name_mid" ) + } + } + }, + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -8, + right = 0, + material = RegisterMaterial( "box_kinect_name_rt" ) + } + } + } + } + } +end + +function HandleKinectGuideMenuAutoRefresh( f4_arg0, f4_arg1 ) + if Kinect.DoWeNeedToRebuildShortcutArray() == true then + LUI.FlowManager.RequestLeaveMenu( f4_arg0 ) + end +end + +function kinect_guide_grid() + return { + type = "UIGrid", + id = "kinect_guide_grid_id", + handlers = { + autorefresh = HandleKinectGuideMenuAutoRefresh + }, + properties = { + elementsPerRow = Kinect.Layout.NumRows, + rowHeight = 150, + hSpacing = 6, + vSpacing = 6, + vAlign = LUI.Alignment.Center, + hAlign = LUI.Alignment.Center + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + childrenFeeder = KinectGuideFeeder + } +end + +function HandleKinectGuideMenuSpeechBack( f6_arg0, f6_arg1, f6_arg2 ) + if not Kinect.IsWhatCanISayMenuUp() and Kinect.IsKinectGuideUp() then + LUI.FlowManager.RequestLeaveMenu( f6_arg0 ) + LUI.Speech.PerformingSpeechAction() + end +end + +function HandleKinectGuideMenuSpeechCancel( f7_arg0, f7_arg1, f7_arg2 ) + LUI.FlowManager.RequestLeaveMenu( f7_arg0 ) + LUI.Speech.PerformingSpeechAction() +end + +function HandleKinectGuideMenuSpeechYes( f8_arg0, f8_arg1, f8_arg2 ) + +end + +function HandleKinectGuideMenuSpeechNo( f9_arg0, f9_arg1, f9_arg2 ) + +end + +function HandleKinectGuideMenuSpeechShortcut( f10_arg0, f10_arg1, f10_arg2 ) + assert( f10_arg2, "HandleKinectGuideMenuSpeechShortcut: Missing extradata param!" ) + assert( f10_arg2.shortcutNum, "HandleKinectGuideMenuSpeechShortcut: Missing extradata shortcutNum param!" ) + Kinect.ExecShortcut( f10_arg0, f10_arg1, f10_arg2.shortcutNum ) +end + +function HandleKinectGuideMenuSpeechReplaceShortcut( f11_arg0, f11_arg1, f11_arg2 ) + assert( f11_arg2, "HandleKinectGuideMenuSpeechReplaceShortcut: Missing extradata param!" ) + assert( f11_arg2.shortcutNum, "HandleKinectGuideMenuSpeechReplaceShortcut: Missing extradata shortcutNum param!" ) +end + +if Engine.HasSpeechFeature() then + KinectGuideMenuSpeechGrammarHandlersArray = { + { + action = "back", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechBack, + extradata = nil + }, + { + action = "cancel", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechCancel, + extradata = nil + }, + { + action = "yes", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechYes, + extradata = nil + }, + { + action = "no", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechNo, + extradata = nil + }, + { + action = "Shortcut 1", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 1 + } + }, + { + action = "Shortcut 2", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 2 + } + }, + { + action = "Shortcut 3", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 3 + } + }, + { + action = "Shortcut 4", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 4 + } + }, + { + action = "Shortcut 5", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 5 + } + }, + { + action = "Shortcut 6", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 6 + } + }, + { + action = "Shortcut 7", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 7 + } + }, + { + action = "Shortcut 8", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 8 + } + }, + { + action = "Shortcut 9", + confidence = LUI.Speech.shortcutMenuConfidence, + handler = HandleKinectGuideMenuSpeechShortcut, + extradata = { + shortcutNum = 9 + } + }, + { + action = "Replace Shortcut 1", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 1 + } + }, + { + action = "Replace Shortcut 2", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 2 + } + }, + { + action = "Replace Shortcut 3", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 3 + } + }, + { + action = "Replace Shortcut 4", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 4 + } + }, + { + action = "Replace Shortcut 5", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 5 + } + }, + { + action = "Replace Shortcut 6", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 6 + } + }, + { + action = "Replace Shortcut 7", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 7 + } + }, + { + action = "Replace Shortcut 8", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 8 + } + }, + { + action = "Replace Shortcut 9", + confidence = LUI.Speech.defaultConfidence, + handler = HandleKinectGuideMenuSpeechReplaceShortcut, + extradata = { + shortcutNum = 9 + } + } + } +else + KinectGuideMenuSpeechGrammarHandlersArray = {} +end +function HandleKinectGuideMenuSpeechHandler( f12_arg0, f12_arg1 ) + if Engine.HasSpeechFeature() then + LUI.Speech.ProcessActionEvent( f12_arg0, f12_arg1, KinectGuideMenuSpeechGrammarHandlersArray ) + end +end + +function HandleKinectGuideMenuCreate( f13_arg0, f13_arg1 ) + f13_arg0:processEvent( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true + } ) +end + +function kinect_guide() + return { + type = "UIElement", + id = "kinect_guide_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + handlers = { + menu_create = HandleKinectGuideMenuCreate, + speech_action = HandleKinectGuideMenuSpeechHandler + }, + children = { + { + type = "UIImage", + id = "kinect_menu_overlay_id", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + alpha = Swatches.Overlay.AlphaMore + } ) + } + }, + { + type = "UIElement", + id = "kinect_menu_container_id", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + width = Kinect.Layout.Width, + height = Kinect.Layout.Height + } + }, + children = { + { + type = "generic_drop_shadow", + properties = { + offset_shadow = 0 + } + }, + { + type = "generic_menu_titlebar", + id = "kinect_title_id", + properties = { + font = CoD.TextSettings.ExtraBigFont, + title_bar_text = Engine.Localize( "@SPEECH_SHORTCUTS_TITLE" ), + title_bar_alignment = LUI.Alignment.Center, + fill_alpha = 1 + } + }, + { + type = "generic_menu_background", + id = "kinect_background_id", + properties = { + fill_alpha = 1 + } + }, + { + type = "kinect_guide_grid", + id = "kinect_guide_grid_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = GenericTitleBarDims.TitleBarHeight + 10, + bottom = -1 * (GenericFooterDims.Height + 5), + left = 5, + right = -5 + } + } + }, + { + type = "UITimer", + id = "kinect_guid_grid_autorefresh_timer", + properties = { + event = "autorefresh", + interval = 1000, + disposable = false, + broadcastToRoot = false + } + }, + { + type = "UIImage", + states = { + default = CoD.ColorizeState( Swatches.GenericMenu.Border, { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottom = -40, + left = 1, + right = -1, + height = 1, + material = RegisterMaterial( "white" ), + alpha = Swatches.GenericMenu.BorderAlpha + } ) + } + }, + { + type = "button_helper_text_main", + id = "kinect_helper_text_id", + properties = { + left_inset = 10, + left_margin = 1, + right_margin = -1, + top_margin = GenericFooterDims.TopMargin_WithoutBackground, + spacing = 65, + background_alpha = 0 + } + }, + { + type = "UIBindButton", + id = "kinect_bind_buttons_id", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } + } + } +end + +function kinect_button_background( f15_arg0, f15_arg1 ) + local f15_local0 = f15_arg1.red or 1 + local f15_local1 = f15_arg1.green or 1 + local f15_local2 = f15_arg1.blue or 1 + local f15_local3 = f15_arg1.alpha or 1 + local f15_local4 = f15_arg1.colorLocked or false + local self = LUI.UIElement.new() + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = top, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f15_local6 = LUI.UIImage.new() + f15_local6.id = "corner" + f15_local6:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 32, + left = 0, + right = 32, + material = RegisterMaterial( "btn_cas_item_topleft" ) + } ) + f15_local6:animateToState( "default" ) + self:addElement( f15_local6 ) + local f15_local7 = LUI.UIImage.new() + f15_local7.id = "top" + f15_local7:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 32, + left = 32, + right = 0, + material = RegisterMaterial( "white" ) + } ) + f15_local7:animateToState( "default" ) + self:addElement( f15_local7 ) + local f15_local8 = LUI.UIImage.new() + f15_local8.id = "bottom" + f15_local8:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 32, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ) + } ) + f15_local8:animateToState( "default" ) + self:addElement( f15_local8 ) + self.colorize = function ( f16_arg0, f16_arg1, f16_arg2, f16_arg3 ) + for f16_local3, f16_local4 in ipairs( { + f15_local6, + f15_local7, + f15_local8 + } ) do + f16_local4:registerAnimationState( "current", { + red = f16_arg0, + green = f16_arg1, + blue = f16_arg2, + alpha = f16_arg3 + } ) + f16_local4:animateToState( "current" ) + end + end + + self.colorize( f15_local0, f15_local1, f15_local2, f15_local3 ) + if not f15_local4 then + self:registerEventHandler( "updateBackgroundColor", function ( element, event ) + element.colorize( event.red, event.green, event.blue, event.alpha ) + end ) + end + return self +end + +LUI.MenuBuilder.registerDef( "kinect_guide", kinect_guide ) +LUI.FlowManager.RegisterStackPopBehaviour( "kinect_guide", function () + Engine.ExecNow( "decnosplitscreencontrol kinect_guide_dec" ) +end ) +LUI.MenuBuilder.registerDef( "kinect_guide_grid", kinect_guide_grid ) +LUI.MenuBuilder.registerDef( "kinect_btn_footer_bg", kinect_btn_footer_bg ) +LUI.MenuBuilder.registerType( "kinect_button_background", kinect_button_background ) +LockTable( _M ) diff --git a/lui/common_menus/kinectutils.dec.lua b/lui/common_menus/kinectutils.dec.lua new file mode 100644 index 0000000..43d8f33 --- /dev/null +++ b/lui/common_menus/kinectutils.dec.lua @@ -0,0 +1,1023 @@ +local f0_local0 = { + "speech/iw6/grammars/global.cfg", + "speech/iw6/grammars/frontend.cfg", + "speech/iw6/grammars/shortcuts.cfg", + "speech/iw6/grammars/lobby.cfg" +} +local f0_local1 = { + "speech/iw6/grammars/global.cfg" +} +Kinect = { + DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS = true, + Layout = { + Height = 554, + Width = 780, + NumRows = 3, + CellHeight = 150, + CellWidth = 250 + }, + Swatch = { + Background = Colors.generic_menu_frame_color, + IndexColor = Colors.frontend_hilite, + DescColor = Colors.white, + DescColorInvert = Colors.black + }, + RightBits = { + None = 0, + CodPlayMode = { + SP = 1, + Core = 2, + Aliens = 4, + SquadVsSquad = 8 + }, + UnlockedAliens = 16, + CampaignResume = 32, + CanHostOrFindGame = 64 + }, + KinectShortcutMenuController = 0, + ShortcutRights = 0, + ShortcutArray = nil, + IsWhatCanISayMenuUp = function () + local f1_local0 = Engine.GetLuiRoot() + if f1_local0 and LUI.FlowManager.IsInStack( f1_local0.flowManager, "what_can_i_say" ) then + return true + else + return false + end + end, + IsKinectGuideUp = function () + local f2_local0 = Engine.GetLuiRoot() + if f2_local0 and LUI.FlowManager.IsInStack( f2_local0.flowManager, "kinect_guide" ) then + return true + else + return false + end + end, + IsAnyKinectMenuUp = function () + if Kinect.IsWhatCanISayMenuUp() then + return true + elseif Kinect.IsKinectGuideUp() then + return true + else + return false + end + end, + CanOpenWhatCanISayMenu = function () + if Engine.HasSpeechFeature() == false then + return false + elseif Kinect.IsWhatCanISayMenuUp() == true then + return false + elseif not Engine.InFrontend() and Engine.IsVideoPlaying and Engine.IsVideoPlaying() == true then + DebugPrint( "Speech: Ignoring What Can I Say menu request because we are in the game and a video is playing." ) + return false + elseif true == LUI.FlowManager.IsTopMenuModal() then + return false + elseif not Engine.InFrontend() and Engine.IsMultiplayer() then + DebugPrint( "Speech: Ignoring What Can I Say menu request because we are in the game that does not support any speech commands." ) + return false + else + return true + end + end, + OpenWhatCanISayMenu = function ( f5_arg0 ) + if Kinect.CanOpenWhatCanISayMenu() ~= true then + return + else + local f5_local0 = Engine.GetLuiRoot() + if not f5_local0 then + return + elseif not Engine.InFrontend() and not Engine.IsMultiplayer() and Engine.GetDvarInt( "cl_paused" ) == 0 then + Engine.TogglePause() + f5_local0.is_paused = true + f5_local0:processEvent( { + name = "hud_refresh" + } ) + f5_local0:dispatchEventToRoot( { + name = "toggle_pause", + open_kinect_what_can_i_say_menu_instead = true + } ) + return + else + Kinect.menu_under_what_can_i_say = LUI.FlowManager.GetTopOpenAndVisibleMenuName() + Kinect.what_can_i_say_unpause_when_close = false + LUI.FlowManager.RequestPopupMenu( self, "what_can_i_say", true, f5_arg0, false ) + end + end + end, + CloseWhatCanISayMenu = function ( f6_arg0, f6_arg1 ) + if Kinect.IsWhatCanISayMenuUp() ~= true then + return + end + LUI.FlowManager.RequestLeaveMenu( f6_arg0 ) + if not Engine.InFrontend() and not Engine.IsMultiplayer() and Kinect.what_can_i_say_unpause_when_close == true then + LUI.FlowManager.RequestCloseAllMenus( f6_arg0 ) + Engine.TogglePause() + f6_arg0:dispatchEventToRoot( { + name = "toggle_pause_off" + } ) + end + Kinect.what_can_i_say_unpause_when_close = false + end, + CanOpenKinectGuide = function () + if Engine.HasSpeechFeature() == false then + return false + elseif Engine.InFrontend() == false then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because we are not in the front end menus." ) + return false + elseif Kinect.IsAnyKinectMenuUp() == true then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because we already have one or more kinect menus up." ) + return false + elseif LUI.FlowManager.IsTopMenuModal() then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because we top menu is modal." ) + return false + elseif LUI.MenuAutoNav.IsRunning() then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because we are currently processing a menu autonavigation." ) + return false + end + local f7_local0 = LUI.FlowManager.GetTopOpenAndVisibleMenuName() + if f7_local0 then + if string.lower( f7_local0 ) == string.lower( "main_lockout" ) then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because main_lockout is up." ) + return false + elseif string.lower( f7_local0 ) == string.lower( "boot_brightness" ) then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because boot_brightness is up." ) + return false + elseif string.lower( f7_local0 ) == string.lower( "boot_screen_margins" ) then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because boot_screen_margins is up." ) + return false + elseif string.lower( f7_local0 ) == string.lower( "no_profile_warning_popmenu" ) then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because no_profile_warning_popmenu is up." ) + return false + elseif string.lower( f7_local0 ) == string.lower( "error_popmenu" ) then + DebugPrint( "Speech: Warning, cannot open up Kinect Guide because error_popmenu is up." ) + return false + end + end + return true + end, + OpenKinectGuide = function ( f8_arg0 ) + if Kinect.CanOpenKinectGuide() ~= true then + return + else + Engine.ExecNow( "incnosplitscreencontrol kinect_guide_inc " .. tostring( f8_arg0 ) ) + Kinect.KinectShortcutMenuController = f8_arg0 + LUI.FlowManager.RequestPopupMenu( self, "kinect_guide", true, f8_arg0, false ) + end + end, + EnableGlobalGrammars = function () + if Engine.HasSpeechFeature() then + if Engine.InFrontend() then + LUI.Speech.EnableGrammars( f0_local0 ) + else + LUI.Speech.EnableGrammars( f0_local1 ) + end + end + end, + RestartGlobalGrammars = function () + if Engine.HasSpeechFeature() then + if Engine.InFrontend() then + LUI.Speech.Restart( f0_local0 ) + else + LUI.Speech.Restart( f0_local1 ) + end + end + end, + CanHostOrFindGame = function () + local f11_local0 = Lobby.IsInPrivateParty() + local f11_local1 = Lobby.IsPrivatePartyHost() + local f11_local2 = Lobby.IsPartyHostWaitingOnMembers() + local f11_local3 + if not f11_local0 or f11_local1 then + f11_local3 = f11_local2 + else + f11_local3 = true + end + if f11_local3 ~= true then + return true + else + return false + end + end, + ActionSPResumeCampaign = function ( f12_arg0, f12_arg1 ) + if Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f12_arg0 ) + LUI.MenuAutoNav.Goto( "resume_campaign", f12_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSPMissionSelect = function ( f13_arg0, f13_arg1 ) + if Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f13_arg0 ) + LUI.MenuAutoNav.Goto( "mission_select", f13_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSPGoToMultiplayer = function ( f14_arg0, f14_arg1 ) + if Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f14_arg0 ) + LUI.MenuAutoNav.Goto( "mp", f14_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSPGoToExtinction = function ( f15_arg0, f15_arg1 ) + if Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f15_arg0 ) + LUI.MenuAutoNav.Goto( "aliens", f15_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSPGoToSquads = function ( f16_arg0, f16_arg1 ) + if Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f16_arg0 ) + LUI.MenuAutoNav.Goto( "squads", f16_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPGoToMainMenu = function ( f17_arg0, f17_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f17_arg0 ) + LUI.MenuAutoNav.Goto( "sp", f17_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPSwitchToMultiplayer = function ( f18_arg0, f18_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f18_arg0 ) + LUI.MenuAutoNav.Goto( "mp", f18_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPSwitchToExtinction = function ( f19_arg0, f19_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f19_arg0 ) + LUI.MenuAutoNav.Goto( "aliens", f19_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPSwitchToSquad = function ( f20_arg0, f20_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f20_arg0 ) + LUI.MenuAutoNav.Goto( "squads", f20_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPFindGame = function ( f21_arg0, f21_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f21_arg0 ) + LUI.MenuAutoNav.Goto( "xboxlive_findmatch", f21_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPSplitScreen = function ( f22_arg0, f22_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f22_arg0 ) + LUI.MenuAutoNav.Goto( "splitscreen", f22_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPPrivateMatchGameSetup = function ( f23_arg0, f23_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f23_arg0 ) + LUI.MenuAutoNav.Goto( "xboxlive_privatematch_gamesetup", f23_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPCreateASoldier = function ( f24_arg0, f24_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f24_arg0 ) + LUI.MenuAutoNav.Goto( "xboxlive_create_squad", f24_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionMPLeaderboards = function ( f25_arg0, f25_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f25_arg0 ) + LUI.MenuAutoNav.Goto( "xboxlive_barracks_leaderboards", f25_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionAliensLoadout = function ( f26_arg0, f26_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f26_arg0 ) + LUI.MenuAutoNav.Goto( "xboxlive_aliens_loadout", f26_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionAliensLeaderboards = function ( f27_arg0, f27_arg1 ) + if not Engine.IsMultiplayer() then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f27_arg0 ) + LUI.MenuAutoNav.Goto( "xboxlive_aliens_leaderboards", f27_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSvSSquadAssault = function ( f28_arg0, f28_arg1 ) + if Engine.GetCurrentCoDPlayMode() ~= CoD.PlayMode.SquadVsSquad then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f28_arg0 ) + LUI.MenuAutoNav.Goto( "squadvssquad_squad_assault", f28_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSvSSquadVsSquad = function ( f29_arg0, f29_arg1 ) + if Engine.GetCurrentCoDPlayMode() ~= CoD.PlayMode.SquadVsSquad then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f29_arg0 ) + LUI.MenuAutoNav.Goto( "squadvssquad_squad_vs_squad", f29_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSvSSafeguard = function ( f30_arg0, f30_arg1 ) + if Engine.GetCurrentCoDPlayMode() ~= CoD.PlayMode.SquadVsSquad then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f30_arg0 ) + LUI.MenuAutoNav.Goto( "squadvssquad_safeguard", f30_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSvSWargame = function ( f31_arg0, f31_arg1 ) + if Engine.GetCurrentCoDPlayMode() ~= CoD.PlayMode.SquadVsSquad then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f31_arg0 ) + LUI.MenuAutoNav.Goto( "squadvssquad_wargame", f31_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSvSSquadReports = function ( f32_arg0, f32_arg1 ) + if Engine.GetCurrentCoDPlayMode() ~= CoD.PlayMode.SquadVsSquad then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f32_arg0 ) + LUI.MenuAutoNav.Goto( "squadvssquad_squad_reports", f32_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + ActionSvSLocalPlay = function ( f33_arg0, f33_arg1 ) + if Engine.GetCurrentCoDPlayMode() ~= CoD.PlayMode.SquadVsSquad then + return + elseif LUI.MenuAutoNav.IsRunning() then + return + else + LUI.FlowManager.RequestLeaveMenu( f33_arg0 ) + LUI.MenuAutoNav.Goto( "squadvssquad_local_play", f33_arg1.controller ) + LUI.Speech.PerformingSpeechAction() + end + end, + GetShortcutRightsBits = function () + local f34_local0 = Kinect.RightBits.None + local f34_local1 = Engine.GetCurrentCoDPlayMode() + if f34_local1 == CoD.PlayMode.SP then + f34_local0 = f34_local0 + Kinect.RightBits.CodPlayMode.SP + elseif f34_local1 == CoD.PlayMode.Core then + f34_local0 = f34_local0 + Kinect.RightBits.CodPlayMode.Core + elseif f34_local1 == CoD.PlayMode.Aliens then + f34_local0 = f34_local0 + Kinect.RightBits.CodPlayMode.Aliens + elseif f34_local1 == CoD.PlayMode.SquadVsSquad then + f34_local0 = f34_local0 + Kinect.RightBits.CodPlayMode.SquadVsSquad + end + if Engine.UnlockedAliens() then + f34_local0 = f34_local0 + Kinect.RightBits.UnlockedAliens + end + if not Engine.IsMultiplayer() then + if not LUI.sp_menus.MainCampaignMenu.isResumeDisabled() then + f34_local0 = f34_local0 + Kinect.RightBits.CampaignResume + end + elseif Kinect.CanHostOrFindGame() then + f34_local0 = f34_local0 + Kinect.RightBits.CanHostOrFindGame + end + return f34_local0 + end, + DoWeNeedToRebuildShortcutArray = function () + local f35_local0 = false + if Kinect.ShortcutRights ~= Kinect.GetShortcutRightsBits() then + f35_local0 = true + end + return f35_local0 + end, + BuildShortcutArray = function () + Kinect.ShortcutRights = Kinect.GetShortcutRightsBits() + Kinect.ShortcutArray = {} + local f36_local0 = Engine.GetCurrentCoDPlayMode() + if f36_local0 == CoD.PlayMode.SP then + if not LUI.sp_menus.MainCampaignMenu.isResumeDisabled() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_RESUME_CAMPAIGN", + Action = Kinect.ActionSPResumeCampaign + } + end + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_MISSION_SELECT", + Action = Kinect.ActionSPMissionSelect + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_GO_TO_MULTIPLAYER", + Action = Kinect.ActionSPGoToMultiplayer + } + if Engine.UnlockedAliens() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_GO_TO_EXTINCTION", + Action = Kinect.ActionSPGoToExtinction + } + end + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_GO_TO_SQUADS", + Action = Kinect.ActionSPGoToSquads + } + elseif f36_local0 == CoD.PlayMode.Core then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_GO_TO_MAIN_MENU", + Action = Kinect.ActionMPGoToMainMenu + } + if Engine.UnlockedAliens() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SWITCH_TO_EXTINCTION", + Action = Kinect.ActionMPSwitchToExtinction + } + end + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SWITCH_TO_SQUADS", + Action = Kinect.ActionMPSwitchToSquad + } + if Kinect.CanHostOrFindGame() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_FIND_GAME", + Action = Kinect.ActionMPFindGame + } + end + if Engine.IsConsoleGame() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SPLIT_SCREEN", + Action = Kinect.ActionMPSplitScreen + } + end + if Kinect.CanHostOrFindGame() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_PRIVATE_MATCH_GAME_SETUP", + Action = Kinect.ActionMPPrivateMatchGameSetup + } + end + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_CUSTOMIZE_SQUAD", + Action = Kinect.ActionMPCreateASoldier + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_LEADERBOARDS", + Action = Kinect.ActionMPLeaderboards + } + elseif f36_local0 == CoD.PlayMode.Aliens then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_GO_TO_MAIN_MENU", + Action = Kinect.ActionMPGoToMainMenu + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SWITCH_TO_MULTIPLAYER", + Action = Kinect.ActionMPSwitchToMultiplayer + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SWITCH_TO_SQUADS", + Action = Kinect.ActionMPSwitchToSquad + } + if Kinect.CanHostOrFindGame() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_FIND_GAME", + Action = Kinect.ActionMPFindGame + } + end + if Engine.IsConsoleGame() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_LOCAL_PLAY", + Action = Kinect.ActionMPSplitScreen + } + end + if Kinect.CanHostOrFindGame() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_CUSTOM_MATCH_GAME_SETUP", + Action = Kinect.ActionMPPrivateMatchGameSetup + } + end + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_LOADOUT", + Action = Kinect.ActionAliensLoadout + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_LEADERBOARDS", + Action = Kinect.ActionAliensLeaderboards + } + elseif f36_local0 == CoD.PlayMode.SquadVsSquad then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_GO_TO_MAIN_MENU", + Action = Kinect.ActionMPGoToMainMenu + } + if Engine.UnlockedAliens() then + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SWITCH_TO_EXTINCTION", + Action = Kinect.ActionMPSwitchToExtinction + } + end + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SWITCH_TO_MULTIPLAYER", + Action = Kinect.ActionMPSwitchToMultiplayer + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SQUAD_ASSAULT", + Action = Kinect.ActionSvSSquadAssault + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SQUAD_VS_SQUAD", + Action = Kinect.ActionSvSSquadVsSquad + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SAFEGUARD", + Action = Kinect.ActionSvSSafeguard + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_WARGAME", + Action = Kinect.ActionSvSWargame + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_SQUAD_REPORTS", + Action = Kinect.ActionSvSSquadReports + } + Kinect.ShortcutArray[#Kinect.ShortcutArray + 1] = { + TextLabel = "@SPEECH_OPTION_LOCAL_PLAY", + Action = Kinect.ActionSvSLocalPlay + } + end + end, + FindShortcut = function ( f37_arg0 ) + if Kinect.ShortcutArray ~= nil and f37_arg0 >= 1 and f37_arg0 <= #Kinect.ShortcutArray then + return Kinect.ShortcutArray[f37_arg0] + else + return nil + end + end, + ExecShortcut = function ( f38_arg0, f38_arg1, f38_arg2 ) + local f38_local0 = false + local f38_local1 = Kinect.FindShortcut( f38_arg2 ) + if f38_local1 then + if f38_local1.Action then + f38_local1.Action( f38_arg0, f38_arg1 ) + f38_local0 = true + else + DebugPrint( "Kinect: WARNING: Shortcut for \"" .. f38_local1.TextLabel .. "\" has a NIL Action!" ) + end + else + DebugPrint( "Kinect: WARNING: Unknown shortcut! " .. f38_arg2 ) + end + return f38_local0 + end, + PressMenuButton = function ( f39_arg0, f39_arg1 ) + assert( f39_arg0 ) + local f39_local0 = Engine.GetLuiRoot() + if f39_local0 == nil then + return false + else + local f39_local1 = f39_local0:getFirstDescendentById( f39_arg0 ) + if not f39_local1 then + return false + elseif f39_local1.disabled and not f39_local1.locked then + return false + else + f39_local1:processEvent( { + name = "button_action", + controller = f39_arg1 + } ) + f39_local1:processEvent( { + name = "button_down", + controller = f39_arg1 + } ) + return true + end + end + end +} +KinectLobbyMember = { + Next = function ( f40_arg0 ) + local f40_local0 = f40_arg0 + if not f40_local0 then + return nil + end + f40_local0.index = f40_local0.index + 1 + if f40_local0.maxSlots < f40_local0.index then + return nil + elseif Lobby.IsActiveMemberSlot( f40_local0.index - 1 ) then + f40_local0.isActiveMemberSlot = true + f40_local0.slot = LUI.mp_menus.MPMemberList.LobbyMemberGetSlot( f40_local0.memberListState, f40_local0.index ) + f40_local0.team = LUI.mp_menus.MPMemberList.LobbyMemberGetTeam( f40_local0.memberListState, f40_local0.index ) + f40_local0.gamerTag = Lobby.GetMemberName( f40_local0.memberListState, f40_local0.slot, f40_local0.team ) + f40_local0.muted = Lobby.IsMemberMuted( f40_local0.memberListState, f40_local0.slot, f40_local0.team ) + else + f40_local0.isActiveMemberSlot = false + f40_local0.slot = -1 + f40_local0.team = -1 + f40_local0.gamerTag = "" + f40_local0.muted = false + end + return f40_local0 + end, + Iter = function () + local f41_local0 = Engine.GetLuiRoot() + if not f41_local0 then + return nil + end + local f41_local1 = LUI.FlowManager.IsInStack( f41_local0.flowManager, "menu_xboxlive_lobby" ) + local f41_local2 = LUI.FlowManager.IsInStack( f41_local0.flowManager, "menu_xboxlive_privatelobby" ) + local f41_local3 = LUI.FlowManager.IsInStack( f41_local0.flowManager, "menu_gamesetup_systemlink" ) + local f41_local4 = LUI.FlowManager.IsInStack( f41_local0.flowManager, "menu_gamesetup_splitscreen" ) + local f41_local5 = f41_local1 + local f41_local6 = f41_local2 + local f41_local7 + if not f41_local3 then + f41_local7 = not f41_local4 + else + f41_local7 = false + end + if not f41_local7 then + return nil + end + local f41_local8 = {} + if f41_local1 or f41_local2 then + f41_local8.memberListState = Lobby.MemberListStates.Lobby + else + f41_local8.memberListState = Lobby.MemberListStates.Prelobby + end + f41_local8.memberListState = LobbyMemberListGetState( f41_local8.memberListState ) + f41_local8.count = Lobby.GetMemberCount( f41_local8.memberListState ) + if f41_local8.count <= 0 then + return nil + end + f41_local8.maxSlots = Engine.IsAliensMode() and 4 or Lobby.MaxMemberListSlots + f41_local8.index = 0 + f41_local8.Next = KinectLobbyMember.Next + return f41_local8.Next() + end, + FindCurrentSelected = function ( f42_arg0 ) + local f42_local0 = Engine.GetLuiRoot() + if not f42_local0 then + return nil, nil + end + local f42_local1 = Engine.IsAliensMode() and 4 or Lobby.MaxMemberListSlots + for f42_local2 = 1, f42_local1, 1 do + local f42_local5 = f42_local0:getFirstDescendentById( "member_" .. f42_local2 ) + if f42_local5 and f42_local5:isInFocus() and (not f42_local5.disabled or f42_local5.disabled == false) and Lobby.GetMemberControllerIndex( f42_local5.properties.memberListState, f42_local5.properties.memberSlot, f42_local5.properties.team ) == f42_arg0 then + local f42_local6 = f42_local5.properties.isActiveMemberSlot + local f42_local7 = { + memberListState = f42_local5.properties.memberListState, + count = Lobby.GetMemberCount( f42_local7.memberListState ), + maxSlots = f42_local1, + index = f42_local5.properties.memberIndex, + Next = KinectLobbyMember.Next + } + if f42_local6 then + f42_local7.isActiveMemberSlot = true + f42_local7.slot = f42_local5.properties.memberSlot + f42_local7.team = f42_local5.properties.team + f42_local7.gamerTag = f42_local5.properties.gamerTag + f42_local7.muted = Lobby.IsMemberMuted( f42_local7.memberListState, f42_local7.slot, f42_local7.team ) + else + f42_local7.isActiveMemberSlot = false + f42_local7.slot = -1 + f42_local7.team = -1 + f42_local7.gamerTag = "" + f42_local7.muted = false + end + return f42_local7, f42_local5 + end + end + return nil, nil + end +} +Kinect.DebugDumpPartyPlayers = function () + DebugPrint( "Current party members:" ) + local f43_local0 = KinectLobbyMember.Iter() + while f43_local0 ~= nil do + if f43_local0.isActiveMemberSlot == true then + DebugPrint( " #" .. f43_local0.index .. " : gamerTag = \"" .. tostring( f43_local0.gamerTag ) .. "\", muted = " .. tostring( f43_local0.muted ) ) + else + DebugPrint( " #" .. f43_local0.index .. " : ---" ) + end + f43_local0 = f43_local0.Next() + end + DebugPrint( " " ) +end + +Kinect.LobbyHandleSpeechCompare = function ( f44_arg0, f44_arg1, f44_arg2 ) + if Kinect.DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS == true then + DebugPrint( "Speech: This operation is disabled via the DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS flag." ) + LUI.Speech.SquelchSpeechAction() + return + else + local f44_local0, f44_local1 = nil + f44_local0, f44_local1 = KinectLobbyMember.FindCurrentSelected( f44_arg1.controller ) + if not f44_local0 then + return + elseif not f44_local1 then + return + elseif f44_local0.isActiveMemberSlot ~= true then + return + else + local f44_local2 = LUI.FlowManager.GetMenuScopedDataFromElement( f44_local1 ) + if f44_local2.animating == true then + return + elseif f44_local2.focusedPage ~= 2 then + return + else + f44_local2.force_press_lobby_navigation_arrow_right_btn = true + Kinect.PressMenuButton( "lobby_navigation_arrow_right_btn" ) + LUI.Speech.PerformingSpeechAction() + end + end + end +end + +Kinect.LobbyHandleSpeechMute = function ( f45_arg0, f45_arg1, f45_arg2 ) + assert( f45_arg2 ~= nil, "Kinect.LobbyHandleSpeechMute: Missing extradata param!" ) + assert( f45_arg2.mute ~= nil, "Kinect.LobbyHandleSpeechMute: Missing extradata.mute param!" ) + if Kinect.DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS == true then + DebugPrint( "Speech: This operation is disabled via the DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS flag." ) + LUI.Speech.SquelchSpeechAction() + return + end + local f45_local0, f45_local1 = nil + f45_local0, f45_local1 = KinectLobbyMember.FindCurrentSelected( f45_arg1.controller ) + if not f45_local0 then + return + elseif f45_local0.isActiveMemberSlot ~= true then + return + elseif Lobby.IsMemberALocalPlayer( f45_local0.memberListState, f45_local0.slot, f45_local0.team ) == false then + if Lobby.MemberToggleMute then + if f45_arg2.mute == true then + if Lobby.IsMemberMuted( f45_local0.memberListState, f45_local0.slot, f45_local0.team ) == false then + DebugPrint( "Kinect: Muting player \"" .. f45_local0.gamerTag .. "\"" ) + Lobby.MemberToggleMute( f45_local0.memberListState, f45_local0.slot, f45_local0.team ) + end + elseif Lobby.IsMemberMuted( f45_local0.memberListState, f45_local0.slot, f45_local0.team ) == true then + DebugPrint( "Kinect: Unmuting player \"" .. f45_local0.gamerTag .. "\"" ) + Lobby.MemberToggleMute( f45_local0.memberListState, f45_local0.slot, f45_local0.team ) + end + LUI.Speech.PerformingSpeechAction() + end + else + DebugPrint( "Kinect: Warning, cannot mute or unmute local player \"" .. tostring( f45_local0.gamerTag ) .. "\"" ) + end +end + +Kinect.LobbyHandleSpeechMuteAll = function ( f46_arg0, f46_arg1, f46_arg2 ) + assert( f46_arg2 ~= nil, "Kinect.LobbyHandleSpeechMuteAll: Missing extradata param!" ) + assert( f46_arg2.mute ~= nil, "Kinect.LobbyHandleSpeechMuteAll: Missing extradata.mute param!" ) + if f46_arg2.mute == true then + if Lobby.MuteAllPlayers then + DebugPrint( "Kinect: Muting all players." ) + Lobby.MuteAllPlayers() + LUI.Speech.PerformingSpeechAction() + end + elseif Lobby.UnmuteAllPlayers then + DebugPrint( "Kinect: Unmuting all players." ) + Lobby.UnmuteAllPlayers() + LUI.Speech.PerformingSpeechAction() + end +end + +Kinect.LobbyHandleSpeechMuteFriends = function ( f47_arg0, f47_arg1, f47_arg2 ) + assert( f47_arg2 ~= nil, "Kinect.LobbyHandleSpeechMuteFriends: Missing extradata param!" ) + assert( f47_arg2.mute ~= nil, "Kinect.LobbyHandleSpeechMuteFriends: Missing extradata.mute param!" ) + if Kinect.DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS == true then + DebugPrint( "Speech: This operation is disabled via the DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS flag." ) + LUI.Speech.SquelchSpeechAction() + return + else + DebugPrint( "Kinect: Error, MUTE/UNMUTE FRIENDS not implemented!" ) + end +end + +Kinect.LobbyHandleSpeechMuteNonFriends = function ( f48_arg0, f48_arg1, f48_arg2 ) + assert( f48_arg2 ~= nil, "Kinect.LobbyHandleSpeechMuteNonFriends: Missing extradata param!" ) + assert( f48_arg2.mute ~= nil, "Kinect.LobbyHandleSpeechMuteNonFriends: Missing extradata.mute param!" ) + if Kinect.DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS == true then + DebugPrint( "Speech: This operation is disabled via the DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS flag." ) + LUI.Speech.SquelchSpeechAction() + return + elseif f48_arg2.mute == true then + if Lobby.MuteAllPlayersButFriends then + Lobby.MuteAllPlayersButFriends() + LUI.Speech.PerformingSpeechAction() + end + else + DebugPrint( "Kinect: Error, UNMUTE NON FRIENDS not implemented!" ) + end +end + +Kinect.LobbyHandleSpeechMuteParty = function ( f49_arg0, f49_arg1, f49_arg2 ) + assert( f49_arg2 ~= nil, "Kinect.LobbyHandleSpeechMuteParty: Missing extradata param!" ) + assert( f49_arg2.mute ~= nil, "Kinect.LobbyHandleSpeechMuteParty: Missing extradata.mute param!" ) + if Kinect.DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS == true then + DebugPrint( "Speech: This operation is disabled via the DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS flag." ) + LUI.Speech.SquelchSpeechAction() + return + else + DebugPrint( "Kinect: Error, MUTE/UNMUTE PARTY not implemented!" ) + end +end + +Kinect.LobbyHandleSpeechMuteNonParty = function ( f50_arg0, f50_arg1, f50_arg2 ) + assert( f50_arg2 ~= nil, "Kinect.LobbyHandleSpeechMuteNonParty: Missing extradata param!" ) + assert( f50_arg2.mute ~= nil, "Kinect.LobbyHandleSpeechMuteNonParty: Missing extradata.mute param!" ) + if Kinect.DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS == true then + DebugPrint( "Speech: This operation is disabled via the DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS flag." ) + LUI.Speech.SquelchSpeechAction() + return + elseif f50_arg2.mute == true then + if Lobby.MuteAllPlayersButParty then + Lobby.MuteAllPlayersButParty() + LUI.Speech.PerformingSpeechAction() + end + else + DebugPrint( "Kinect: Error, UNMUTE NON PARTY not implemented!" ) + end +end + +if Engine.HasSpeechFeature() then + Kinect.LobbySpeechGrammarHandlersArray = { + { + action = "compare", + confidence = LUI.Speech.compareConfidence, + handler = Kinect.LobbyHandleSpeechCompare, + extradata = nil + }, + { + action = "mute", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMute, + extradata = { + mute = true + } + }, + { + action = "unmute", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMute, + extradata = { + mute = false + } + }, + { + action = "mute all", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteAll, + extradata = { + mute = true + } + }, + { + action = "unmute all", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteAll, + extradata = { + mute = false + } + }, + { + action = "mute friends", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteFriends, + extradata = { + mute = true + } + }, + { + action = "unmute friends", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteFriends, + extradata = { + mute = false + } + }, + { + action = "mute non friends", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteNonFriends, + extradata = { + mute = true + } + }, + { + action = "unmute non friends", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteNonFriends, + extradata = { + mute = false + } + }, + { + action = "mute party", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteParty, + extradata = { + mute = true + } + }, + { + action = "unmute party", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteParty, + extradata = { + mute = false + } + }, + { + action = "mute non party", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteNonParty, + extradata = { + mute = true + } + }, + { + action = "unmute non party", + confidence = LUI.Speech.muteConfidence, + handler = Kinect.LobbyHandleSpeechMuteNonParty, + extradata = { + mute = false + } + } + } +else + Kinect.LobbySpeechGrammarHandlersArray = {} +end diff --git a/lui/common_menus/options.dec.lua b/lui/common_menus/options.dec.lua new file mode 100644 index 0000000..3af729a --- /dev/null +++ b/lui/common_menus/options.dec.lua @@ -0,0 +1,1142 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GetToggleTextForProfileData( f1_arg0, f1_arg1 ) + return Engine.GetProfileData( f1_arg0, f1_arg1 ) and Engine.Localize( "@LUA_MENU_ENABLED" ) or Engine.Localize( "@LUA_MENU_DISABLED" ) +end + +function GetReverseToggleTextForProfileData( f2_arg0, f2_arg1 ) + return Engine.GetProfileData( f2_arg0, f2_arg1 ) and Engine.Localize( "@LUA_MENU_DISABLED" ) or Engine.Localize( "@LUA_MENU_ENABLED" ) +end + +function ProfileMenuOption( f3_arg0, f3_arg1, f3_arg2, f3_arg3, f3_arg4 ) + Engine.SetDvarFloat( f3_arg4, math.min( f3_arg2, math.max( f3_arg1, Engine.GetDvarFloat( f3_arg4 ) + f3_arg3 ) ) ) + Engine.MenuDvarsFinish( f3_arg0 ) +end + +function GetSticksLayoutName( f4_arg0 ) + local f4_local0 = Engine.GetProfileData( "gpadSticksConfig", f4_arg0 ) + if f4_local0 == "thumbstick_default" then + return Engine.Localize( "@MENU_DEFAULT" ) + elseif f4_local0 == "thumbstick_southpaw" then + return Engine.Localize( "@MENU_SOUTHPAW" ) + elseif f4_local0 == "thumbstick_legacy" then + return Engine.Localize( "@MENU_LEGACY" ) + elseif f4_local0 == "thumbstick_southpaw_ns" then + return Engine.Localize( "@MENU_SOUTHPAW_NS" ) + elseif f4_local0 == "thumbstick_legacysouthpaw_ns" then + return Engine.Localize( "@MENU_LEGACY_SOUTHPAW_NS" ) + else + return Engine.Localize( "@MENU_LEGACY_SOUTHPAW" ) + end +end + +function SticksLayoutAction( f5_arg0, f5_arg1 ) + LUI.FlowManager.RequestAddMenu( f5_arg0, "thumbstick", true, f5_arg1.controller, false ) +end + +function GetButtonsLayoutName( f6_arg0 ) + local f6_local0 = Engine.GetProfileData( "gpadButtonsConfig", f6_arg0 ) + if f6_local0 == "buttons_default" then + return Engine.Localize( "@MENU_DEFAULT" ) + elseif f6_local0 == "buttons_tactical" then + return Engine.Localize( "@MENU_TACTICAL" ) + elseif f6_local0 == "buttons_lefty" then + return Engine.Localize( "@MENU_LEFTY" ) + elseif f6_local0 == "buttons_nomad" then + return Engine.Localize( "@MENU_NOMAD" ) + elseif f6_local0 == "buttons_nomad_tactical" then + return Engine.Localize( "@MENU_NOMAD_TACTICAL" ) + elseif f6_local0 == "buttons_default_alt" then + return Engine.Localize( "@MENU_DEFAULT_ALT" ) + elseif f6_local0 == "buttons_tactical_alt" then + return Engine.Localize( "@MENU_TACTICAL_ALT" ) + elseif f6_local0 == "buttons_lefty_alt" then + return Engine.Localize( "@MENU_LEFTY_ALT" ) + elseif f6_local0 == "buttons_nomad_alt" then + return Engine.Localize( "@MENU_NOMAD_ALT" ) + else + return Engine.Localize( "@MENU_NOMAD_TACTICAL_ALT" ) + end +end + +function ButtonsLayoutAction( f7_arg0, f7_arg1 ) + LUI.FlowManager.RequestAddMenu( f7_arg0, "buttons", true, f7_arg1.controller, false ) +end + +function LookInversionToggle( f8_arg0 ) + Engine.ToggleInvertedPitch( f8_arg0 ) +end + +function GetLookInversionText( f9_arg0 ) + return GetToggleTextForProfileData( "invertedPitch", f9_arg0 ) +end + +function VibrationToggle( f10_arg0 ) + Engine.ToggleRumble( f10_arg0 ) +end + +function GetVibrationText( f11_arg0 ) + return GetToggleTextForProfileData( "rumble", f11_arg0 ) +end + +function GetSensitivityText() + local f12_local0 = Engine.GetDvarFloat( "profileMenuOption_sensitivity" ) + if f12_local0 == 1 then + return Engine.Localize( "@MENU_LOW" ) .. " " .. f12_local0 + elseif f12_local0 == 3 then + return Engine.Localize( "@MENU_MEDIUM" ) .. " " .. f12_local0 + elseif f12_local0 == 7 then + return Engine.Localize( "@MENU_HIGH" ) .. " " .. f12_local0 + elseif f12_local0 == 13 then + return Engine.Localize( "@MENU_VERY_HIGH" ) .. " " .. f12_local0 + elseif f12_local0 == 20 then + return Engine.Localize( "@MENU_INSANE" ) .. " " .. f12_local0 + else + return f12_local0 .. "" + end +end + +function SensitivityLess( f13_arg0 ) + ProfileMenuOption( f13_arg0, 1, 20, -1, "profileMenuOption_sensitivity" ) +end + +function SensitivityMore( f14_arg0 ) + ProfileMenuOption( f14_arg0, 1, 20, 1, "profileMenuOption_sensitivity" ) +end + +function LeanToggle( f15_arg0 ) + Engine.ToggleLean( f15_arg0 ) +end + +function GetLeanToggleText( f16_arg0 ) + return GetToggleTextForProfileData( "leanEnabled", f16_arg0 ) +end + +function RenderColorBlindToggle( f17_arg0 ) + if Engine.ToggleRenderColorBlind then + Engine.ToggleRenderColorBlind( f17_arg0 ) + end +end + +function GetRenderColorBlindText( f18_arg0 ) + if Engine.ToggleRenderColorBlind then + return GetToggleTextForProfileData( "renderColorBlind", f18_arg0 ) + else + return Engine.Localize( "@LUA_MENU_DISABLED" ) + end +end + +function SubtitlesToggle( f19_arg0 ) + Engine.SetSubtitlesEnabled( f19_arg0, not Engine.SubtitlesEnabled( f19_arg0 ) ) +end + +function GetSubtitlesText( f20_arg0 ) + return GetToggleTextForProfileData( "subtitles", f20_arg0 ) +end + +function AimAssistToggle( f21_arg0 ) + Engine.ToggleAutoAim( f21_arg0 ) +end + +function GetAimAssistText( f22_arg0 ) + return GetToggleTextForProfileData( "autoAim", f22_arg0 ) +end + +function SelectSaveDeviceAction( f23_arg0, f23_arg1 ) + if Engine.IsProfileSignedIn( f23_arg1.controller ) then + Engine.ForceSelectSaveDevice( f23_arg1.controller ) + else + Engine.Exec( "xsignin" ) + end +end + +function RedrawMarginGuide( f24_arg0, f24_arg1 ) + local f24_local0 = Engine.GetDvarFloat( "profileMenuOption_safeAreaHorz" ) + local f24_local1 = Engine.GetDvarFloat( "profileMenuOption_safeAreaVert" ) + local f24_local2 = math.ceil( (1 - (f24_local0 - SliderBounds.HorzMargin.Min) / (SliderBounds.HorzMargin.Max - SliderBounds.HorzMargin.Min)) * 1280 * (1 - SliderBounds.HorzMargin.Min) / 2 ) + local f24_local3 = math.ceil( (1 - (f24_local1 - SliderBounds.VertMargin.Min) / (SliderBounds.VertMargin.Max - SliderBounds.VertMargin.Min)) * 720 * (1 - SliderBounds.VertMargin.Min) / 2 ) + f24_arg0:registerAnimationState( "current", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = f24_local2, + right = -f24_local2, + top = f24_local3, + bottom = -f24_local3 + } ) + f24_arg0:animateToState( "current", 0 ) +end + +function margins_guide() + local f25_local0 = { + type = "UIElement", + id = "horizontal_margins_guide_id", + states = { + default = { + alpha = 0 + }, + visible = { + alpha = 1 + } + } + } + local f25_local1 = {} + local f25_local2 = MBh.DoMultiple + local f25_local3 = {} + local f25_local4 = MBh.AnimateToState( "visible", 0 ) + local f25_local5 = RedrawMarginGuide + local f25_local6 = MBh.EmitEvent( { + name = "horizontal_margin_over_children" + } ) + f25_local1.horizontal_margin_over = f25_local2( f25_local4 ) + f25_local2 = MBh.DoMultiple + f25_local3 = {} + f25_local4 = MBh.AnimateToState( "visible", 0 ) + f25_local5 = RedrawMarginGuide + f25_local6 = MBh.EmitEvent( { + name = "vertical_margin_over_children" + } ) + f25_local1.vertical_margin_over = f25_local2( f25_local4 ) + f25_local2 = MBh.DoMultiple + f25_local3 = {} + f25_local4 = MBh.AnimateToState( "default", 100, true, false ) + f25_local5 = MBh.EmitEvent( { + name = "horizontal_margin_up_children" + } ) + f25_local1.horizontal_margin_up = f25_local2( f25_local4 ) + f25_local2 = MBh.DoMultiple + f25_local3 = {} + f25_local4 = MBh.AnimateToState( "default", 100, true, false ) + f25_local5 = MBh.EmitEvent( { + name = "vertical_margin_up_children" + } ) + f25_local1.vertical_margin_up = f25_local2( f25_local4 ) + f25_local1.margin_updated = RedrawMarginGuide + f25_local0.handlers = f25_local1 + f25_local0.children = { + { + type = "UIImage", + id = "margins_guide_dim", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + red = 0.21, + green = 0.21, + blue = 0.21, + alpha = 0.5 + } + } + }, + { + type = "UIImage", + id = "margins_guide_arrow_lt", + handlers = { + horizontal_margin_over_children = MBh.AnimateToState( "visible", 0 ), + horizontal_margin_up_children = MBh.AnimateToState( "default", 0 ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = -3, + right = 29, + top = -32, + bottom = 32, + material = RegisterMaterial( "widg_margin_arrow_lt" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + } + }, + { + type = "UIImage", + id = "margins_guide_arrow_rt", + handlers = { + horizontal_margin_over_children = MBh.AnimateToState( "visible", 0 ), + horizontal_margin_up_children = MBh.AnimateToState( "default", 0 ) + }, + states = { + default = { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = -24, + right = 8, + top = -32, + bottom = 32, + material = RegisterMaterial( "widg_margin_arrow_rt" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + } + }, + { + type = "UIImage", + id = "margins_guide_arrow_top", + handlers = { + vertical_margin_over_children = MBh.AnimateToState( "visible", 0 ), + vertical_margin_up_children = MBh.AnimateToState( "default", 0 ) + }, + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = -32, + right = 32, + top = -3, + bottom = 29, + material = RegisterMaterial( "widg_margin_arrow_top" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + } + }, + { + type = "UIImage", + id = "margins_guide_arrow_bot", + handlers = { + vertical_margin_over_children = MBh.AnimateToState( "visible", 0 ), + vertical_margin_up_children = MBh.AnimateToState( "default", 0 ) + }, + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = true, + left = -32, + right = 32, + top = -24, + bottom = 8, + material = RegisterMaterial( "widg_margin_arrow_bot" ), + alpha = 0 + }, + visible = { + alpha = 1 + } + } + }, + { + type = "generic_border" + } + } + return f25_local0 +end + +function GetVolume() + return (Engine.GetDvarFloat( "profileMenuOption_volume" ) - SliderBounds.Volume.Min) / (SliderBounds.Volume.Max - SliderBounds.Volume.Min) +end + +function VolumeLess( f27_arg0 ) + ProfileMenuOption( f27_arg0, SliderBounds.Volume.Min, SliderBounds.Volume.Max, -SliderBounds.Volume.Step, "profileMenuOption_volume" ) +end + +function VolumeMore( f28_arg0 ) + ProfileMenuOption( f28_arg0, SliderBounds.Volume.Min, SliderBounds.Volume.Max, SliderBounds.Volume.Step, "profileMenuOption_volume" ) +end + +function GetBrightness() + return 1 - (Engine.GetDvarFloat( "profileMenuOption_blacklevel" ) - SliderBounds.Brightness.Min) / (SliderBounds.Brightness.Max - SliderBounds.Brightness.Min) +end + +function BrightnessLess( f30_arg0, f30_arg1 ) + ProfileMenuOption( f30_arg0, SliderBounds.Brightness.Min, SliderBounds.Brightness.Max, -SliderBounds.Brightness.Step, "profileMenuOption_blacklevel" ) + f30_arg1:dispatchEventToRoot( { + name = "brightness_updated" + } ) +end + +function BrightnessMore( f31_arg0, f31_arg1 ) + ProfileMenuOption( f31_arg0, SliderBounds.Brightness.Min, SliderBounds.Brightness.Max, SliderBounds.Brightness.Step, "profileMenuOption_blacklevel" ) + f31_arg1:dispatchEventToRoot( { + name = "brightness_updated" + } ) +end + +function UpdateBrightnessGuide( f32_arg0, f32_arg1 ) + if Engine.IsXbox360() then + return + end + local f32_local0 = Engine.GetDvarFloat( "profileMenuOption_blacklevel" ) + local f32_local1 = nil + if f32_arg0.id == BrightnessGuideConstants.not_visible.item_id then + f32_local1 = BrightnessGuideConstants.not_visible.color_default + elseif f32_arg0.id == BrightnessGuideConstants.barely_visible.item_id then + f32_local1 = BrightnessGuideConstants.barely_visible.color_default + elseif f32_arg0.id == BrightnessGuideConstants.easily_visible.item_id then + f32_local1 = BrightnessGuideConstants.easily_visible.color_default + end + if f32_local1 ~= nil then + local f32_local2 = (f32_local1 - f32_local0) / (1 - f32_local0) + f32_arg0:registerAnimationState( "current", { + red = f32_local2, + green = f32_local2, + blue = f32_local2 + } ) + f32_arg0:animateToState( "current", 0 ) + end +end + +function brightness_guide() + local f33_local0 = { + type = "UIElement", + id = "brightness_guide_id", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = 150, + bottom = 510, + left = 710, + right = 1070, + alpha = 0 + }, + visible = { + alpha = 1 + } + }, + properties = { + band_height = 120 + } + } + local f33_local1 = {} + local f33_local2 = MBh.DoMultiple + local f33_local3 = {} + local f33_local4 = MBh.AnimateToState( "visible", 0 ) + local f33_local5 = MBh.EmitEvent( { + name = "brightness_over_children" + } ) + f33_local1.brightness_over = f33_local2( f33_local4 ) + f33_local1.brightness_up = MBh.AnimateToState( "default", 0 ) + f33_local0.handlers = f33_local1 + f33_local0.children = { + { + type = "generic_border", + properties = { + thickness = 2, + border_red = Colors.generic_menu_frame_color.r, + border_green = Colors.generic_menu_frame_color.g, + border_blue = Colors.generic_menu_frame_color.b + } + }, + { + type = "UIVerticalList", + id = "brightness_guide_list_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = BrightnessGuideConstants.not_visible.item_id, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = MBh.Property( "band_height" ), + material = RegisterMaterial( "white" ), + red = BrightnessGuideConstants.not_visible.color_default, + green = BrightnessGuideConstants.not_visible.color_default, + blue = BrightnessGuideConstants.not_visible.color_default + } + }, + children = { + { + type = "UIText", + id = "text_not_visible", + properties = { + text = Engine.Localize( "@MENU_BRIGHTNESS_NOT_VISIBLE" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = -CoD.TextSettings.ExtraBigFont.Height / 2, + bottom = CoD.TextSettings.ExtraBigFont.Height / 2, + font = CoD.TextSettings.ExtraBigFont.Font, + red = 0, + green = 0, + blue = 0, + alignment = LUI.Alignment.Center + } + } + } + }, + handlers = { + brightness_over_children = UpdateBrightnessGuide, + brightness_updated = UpdateBrightnessGuide + } + }, + { + type = "UIImage", + id = BrightnessGuideConstants.barely_visible.item_id, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = MBh.Property( "band_height" ), + material = RegisterMaterial( "white" ), + red = BrightnessGuideConstants.barely_visible.color_default, + green = BrightnessGuideConstants.barely_visible.color_default, + blue = BrightnessGuideConstants.barely_visible.color_default + } + }, + children = { + { + type = "UIText", + id = "text_barely_visible", + properties = { + text = Engine.Localize( "@MENU_BRIGHTNESS_BARELY_VISIBLE" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = -CoD.TextSettings.ExtraBigFont.Height / 2, + bottom = CoD.TextSettings.ExtraBigFont.Height / 2, + font = CoD.TextSettings.ExtraBigFont.Font, + red = 0, + green = 0, + blue = 0, + alignment = LUI.Alignment.Center + } + } + } + }, + handlers = { + brightness_over_children = UpdateBrightnessGuide, + brightness_updated = UpdateBrightnessGuide + } + }, + { + type = "UIImage", + id = BrightnessGuideConstants.easily_visible.item_id, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = MBh.Property( "band_height" ), + material = RegisterMaterial( "white" ), + red = BrightnessGuideConstants.easily_visible.color_default, + green = BrightnessGuideConstants.easily_visible.color_default, + blue = BrightnessGuideConstants.easily_visible.color_default + } + }, + children = { + { + type = "UIText", + id = "text_barely_visible", + properties = { + text = Engine.Localize( "@MENU_BRIGHTNESS_EASILY_VISIBLE" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + left = 0, + right = 0, + top = -CoD.TextSettings.ExtraBigFont.Height / 2, + bottom = CoD.TextSettings.ExtraBigFont.Height / 2, + font = CoD.TextSettings.ExtraBigFont.Font, + red = 0, + green = 0, + blue = 0, + alignment = LUI.Alignment.Center + } + } + } + }, + handlers = { + brightness_over_children = UpdateBrightnessGuide, + brightness_updated = UpdateBrightnessGuide + } + }, + { + type = "UIElement", + id = "spacing_element_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 15 + } + } + }, + { + type = "UIText", + id = "background_guide_help", + properties = { + text = Engine.Localize( "@MENU_BRIGHTNESS_DESC2" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + } + } + } + } + return f33_local0 +end + +function facebook_notice() + return { + type = "generic_yesno_popup", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@MENU_FACEBOOK_LEGAL" ), + yes_action = MBh.PopupMenu( "facebook_warning", true, false ), + no_action = function ( f35_arg0, f35_arg1 ) + DebugPrint( "Running generic_confirmation_popup no action" ) + end + , + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function facebook_warning() + return { + type = "generic_yesno_popup", + properties = { + popup_title = Engine.Localize( "@MENU_NOTICE" ), + message_text = Engine.Localize( "@PLATFORM_FACEBOOK_LEGAL2" ), + yes_action = MBh.PopupMenu( "facebook_login_form", true, false ), + no_action = function ( f37_arg0, f37_arg1 ) + DebugPrint( "Running generic_confirmation_popup no action" ) + end + , + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_CANCEL" ) + } + } +end + +function facebook_login_form() + return { + type = "generic_selectionList_popup", + properties = { + popup_title = Engine.Localize( "LUA_MENU_FACEBOOK_LOGIN_POPUP" ), + popup_childfeeder = FacebookLoginListFeeder + } + } +end + +function UpdateFacebookLoginButton( f39_arg0, f39_arg1 ) + local f39_local0 = Engine.GetDvarString( "facebook_username" ) + local f39_local1 = Engine.GetDvarString( "facebook_password" ) + if f39_local0 and f39_local1 and #f39_local1 * #f39_local0 ~= 0 then + f39_arg0:enable() + else + f39_arg0:disable() + end +end + +function FacebookLoginListFeeder() + return { + { + type = "generic_input_field", + id = "user_login", + properties = { + dvar_hook = "facebook_username", + help_value = Engine.Localize( "@MENU_ENTER_USERNAME_EMAIL_CAPS" ), + field_name = Engine.Localize( "@MENU_ENTER_USERNAME_EMAIL_CAPS" ), + field_edited_func = MBh.EmitEventToRoot( "facebook_login_changed" ) + } + }, + { + type = "generic_input_field", + id = "user_password", + properties = { + dvar_hook = "facebook_password", + help_value = Engine.Localize( "@MENU_ENTER_PASSWORD_CAPS" ), + field_name = Engine.Localize( "@MENU_ENTER_PASSWORD_CAPS" ), + password_field = true, + field_edited_func = MBh.EmitEventToRoot( "facebook_password_changed" ) + } + }, + { + type = "UIGenericButton", + id = "facebook_login_button", + properties = { + text = Engine.Localize( "@MENU_FACEBOOK_LOGIN" ), + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_action_func = MBh.PopupMenu( "facebook_error_popup", true, false ) + }, + handlers = { + menu_create = UpdateFacebookLoginButton, + facebook_login_changed = UpdateFacebookLoginButton, + facebook_password_changed = UpdateFacebookLoginButton + } + }, + { + type = "UIGenericButton", + id = "facebook_cancel_login_button", + properties = { + text = Engine.Localize( "@LUA_MENU_CANCEL" ), + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + button_action_func = MBh.LeaveMenu() + } + } + } +end + +function facebook_error_popup() + return { + type = "generic_confirmation_popup", + id = "facebook_error_popup_id", + properties = { + popup_title = Engine.Localize( "Placeholder" ), + message_text = Engine.Localize( "@MENU_FACEBOOK_UNAVAILABLE" ) + } + } +end + +function options_vlist() + return { + type = "UIScrollingVerticalList", + properties = { + use_arrows = true, + sendScrollEvents = true, + exclusiveController = MBh.Property( "exclusiveController" ), + focusSafeArea = MBh.Property( "focusSafeArea" ) + }, + focusable = true, + childrenFeeder = OptionsFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = OptionsListDims.menu_top, + bottom = OptionsListDims.menu_bottom, + left = OptionsListDims.menu_left, + right = OptionsListDims.menu_right + } + } + } +end + +function OptionsFeeder( f43_arg0 ) + local f43_local0 = nil + Engine.MenuDvarsSetup( f43_arg0.exclusiveController ) + f43_local0 = { + { + type = "UIGenericButton", + id = "stick_layout_button_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@MENU_THUMBSTICK_LAYOUT_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_STICK_LAYOUT_DESC" ), + button_display_func = function ( f44_arg0, f44_arg1 ) + return GetSticksLayoutName( f43_arg0.exclusiveController ) + end, + button_action_func = SticksLayoutAction + } + }, + { + type = "UIGenericButton", + id = "buttons_layout_button_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@MENU_BUTTON_LAYOUT_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_BUTTON_LAYOUT_DESC" ), + button_display_func = function ( f45_arg0, f45_arg1 ) + return GetButtonsLayoutName( f43_arg0.exclusiveController ) + end, + button_action_func = ButtonsLayoutAction + } + }, + { + type = "UIGenericButton", + id = "look_inversion_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@MENU_LOOK_INVERSION_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_LOOK_INVERSION_DESC" ), + button_display_func = function ( f46_arg0, f46_arg1 ) + return GetLookInversionText( f43_arg0.exclusiveController ) + end, + button_left_func = function ( f47_arg0, f47_arg1 ) + LookInversionToggle( f43_arg0.exclusiveController ) + end, + button_right_func = function ( f48_arg0, f48_arg1 ) + LookInversionToggle( f43_arg0.exclusiveController ) + end + } + }, + { + type = "UIGenericButton", + id = "vibration_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@MENU_CONTROLLER_VIBRATION_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_VIBRATION_DESC" ), + button_display_func = function ( f49_arg0, f49_arg1 ) + return GetVibrationText( f43_arg0.exclusiveController ) + end, + button_left_func = function ( f50_arg0, f50_arg1 ) + return VibrationToggle( f43_arg0.exclusiveController ) + end, + button_right_func = function ( f51_arg0, f51_arg1 ) + return VibrationToggle( f43_arg0.exclusiveController ) + end + } + }, + { + type = "UIGenericButton", + id = "sensitivity_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@MENU_LOOK_SENSITIVITY_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_SENSITIVITY_DESC" ), + button_display_func = GetSensitivityText, + button_left_func = function ( f52_arg0, f52_arg1 ) + return SensitivityLess( f43_arg0.exclusiveController ) + end, + button_right_func = function ( f53_arg0, f53_arg1 ) + return SensitivityMore( f43_arg0.exclusiveController ) + end + } + }, + { + type = "UIGenericButton", + id = "safe_area_button_id", + listDefaultFocus = f43_arg0.focusSafeArea, + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@LUA_MENU_SAFE_AREA_CAPS" ), + button_display_func = function () + return "" + end, + desc_text = Engine.Localize( "@LUA_MENU_SAFE_AREA_DESC" ), + button_action_func = function ( f55_arg0, f55_arg1 ) + LUI.FlowManager.RequestAddMenu( f55_arg0, "boot_screen_margins", false, f55_arg1.controller, true, { + linkTo = "controls", + continueExclusive = true + } ) + end + } + }, + { + type = "UIGenericButton", + id = "volume_button_id", + properties = { + variant = GenericButtonSettings.Variants.Slider, + button_text = Engine.Localize( "@MENU_VOLUME_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_GAME_VOLUME_DESC" ), + button_display_func = GetVolume, + button_left_func = function ( f56_arg0, f56_arg1 ) + VolumeLess( f43_arg0.exclusiveController ) + end, + button_right_func = function ( f57_arg0, f57_arg1 ) + VolumeMore( f43_arg0.exclusiveController ) + end + } + }, + { + type = "UIGenericButton", + id = "brightness_button_id", + properties = { + variant = GenericButtonSettings.Variants.Slider, + button_text = Engine.Localize( "@MENU_BRIGHTNESS_CAPS" ), + desc_text = Engine.Localize( "@MENU_BRIGHTNESS_DESC1" ), + button_display_func = GetBrightness, + button_left_func = function ( f58_arg0, f58_arg1 ) + BrightnessLess( f43_arg0.exclusiveController, f58_arg0 ) + end, + button_right_func = function ( f59_arg0, f59_arg1 ) + BrightnessMore( f43_arg0.exclusiveController, f59_arg0 ) + end, + button_over_func = MBh.EmitEventToRoot( "brightness_over" ), + button_up_func = MBh.EmitEventToRoot( "brightness_up" ) + } + }, + { + type = "UIGenericButton", + id = "render_color_blind_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "LUA_MENU_COLORBLIND_FILTER_CAPS" ), + desc_text = Engine.Localize( "LUA_MENU_COLOR_BLIND_DESC" ), + button_display_func = function ( f60_arg0, f60_arg1 ) + return GetRenderColorBlindText( f43_arg0.exclusiveController ) + end, + button_left_func = function ( f61_arg0, f61_arg1 ) + RenderColorBlindToggle( f43_arg0.exclusiveController ) + end, + button_right_func = function ( f62_arg0, f62_arg1 ) + RenderColorBlindToggle( f43_arg0.exclusiveController ) + end + } + }, + { + type = "UIGenericButton", + id = "manual_button_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.IsXB3() and Engine.Localize( "@LUA_MENU_HELP_CAPS" ) or Engine.Localize( "@LUA_MENU_GAME_MANUAL_CAPS" ), + button_display_func = function () + return "" + end, + desc_text = Engine.Localize( "@LUA_MENU_GAME_MANUAL_DESC" ), + button_action_func = function ( f64_arg0, f64_arg1 ) + LUI.FlowManager.RequestAddMenu( f64_arg0, "game_manual", true, f64_arg1.controller, false ) + end + } + }, + { + type = "UIGenericButton", + id = "toggle_lean_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@LUA_MENU_LEAN_TOGGLE_CAPS" ), + desc_text = Engine.Localize( "@LUA_MENU_LEAN_TOGGLE_DESC" ), + button_display_func = function ( f65_arg0, f65_arg1 ) + return GetLeanToggleText( f43_arg0.exclusiveController ) + end, + button_left_func = function ( f66_arg0, f66_arg1 ) + LeanToggle( f43_arg0.exclusiveController ) + end, + button_right_func = function ( f67_arg0, f67_arg1 ) + LeanToggle( f43_arg0.exclusiveController ) + end + } + } + } + if not Engine.IsMultiplayer() then + f43_local0[#f43_local0 + 1] = { + type = "UIGenericButton", + id = "aim_assist_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@MENU_AIM_ASSIST_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_AIM_ASSIST_DESC" ), + button_display_func = function ( f68_arg0, f68_arg1 ) + return GetAimAssistText( f43_arg0.exclusiveController ) + end, + button_left_func = function ( f69_arg0, f69_arg1 ) + AimAssistToggle( f43_arg0.exclusiveController ) + end, + button_right_func = function ( f70_arg0, f70_arg1 ) + AimAssistToggle( f43_arg0.exclusiveController ) + end + } + } + if Engine.GetCurrentLanguage() ~= 6 then + f43_local0[#f43_local0 + 1] = { + type = "UIGenericButton", + id = "subtitles_button_id", + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "@MENU_SUBTITLES_CAPS" ), + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_SUBTITLES_DESC" ), + button_display_func = function ( f71_arg0, f71_arg1 ) + return GetSubtitlesText( f43_arg0.exclusiveController ) + end, + button_left_func = function ( f72_arg0, f72_arg1 ) + SubtitlesToggle( f43_arg0.exclusiveController ) + end, + button_right_func = function ( f73_arg0, f73_arg1 ) + SubtitlesToggle( f43_arg0.exclusiveController ) + end + } + } + end + end + if not Engine.IsXB3() and not Engine.IsPS3() and not Engine.IsPS4() then + f43_local0[#f43_local0 + 1] = { + type = "UIGenericButton", + id = "save_device_button_id", + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "@MENU_SP_SELECT_SAVE_DEVICE_CAPS" ), + button_display_func = function () + return "" + end, + desc_text = Engine.Localize( "@PLATFORM_OPTIONS_SAVE_DEVICE_DESC" ), + button_action_func = SelectSaveDeviceAction + } + } + end + return f43_local0 +end + +function OptionsMainCreate( f75_arg0, f75_arg1 ) + f75_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true + } ) +end + +function OptionsMainClose( f76_arg0, f76_arg1 ) + Engine.Exec( "updategamerprofile" ) +end + +function options() + local f77_local0 = { + type = "UIElement", + id = "options_root", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + properties = { + focusSafeArea = false + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = OptionsMainClose + }, + children = { + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_OPTIONS_UPPER_CASE" ) + } + }, + { + type = "options_vlist", + id = "options_vlist_id" + }, + { + type = "button_desc_text", + id = "button_info_text", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 590, + bottom = 590 + CoD.TextSettings.SmallFont.Height, + left = 0, + right = OptionsListDims.menu_right - 80 + } + } + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + id = "options_back_id", + handlers = { + button_secondary = function ( f78_arg0, f78_arg1 ) + local f78_local0 = Engine.GetLuiRoot() + if LUI.FlowManager.IsInStack( f78_local0.flowManager, "mp_main_menu" ) then + Engine.ExecNow( "forcesplitscreencontrol main_options_menu_CLOSE", f78_arg0.properties.exclusiveController ) + end + LUI.FlowManager.RequestLeaveMenu( f78_arg0 ) + end + } + } + } + } + table.insert( f77_local0.children, { + type = "brightness_guide" + } ) + return f77_local0 +end + +LUI.MenuBuilder.registerDef( "margins_guide", margins_guide ) +LUI.MenuBuilder.registerDef( "brightness_guide", brightness_guide ) +LUI.MenuBuilder.registerDef( "facebook_notice", facebook_notice ) +LUI.MenuBuilder.registerDef( "facebook_warning", facebook_warning ) +LUI.MenuBuilder.registerDef( "facebook_login_form", facebook_login_form ) +LUI.MenuBuilder.registerDef( "facebook_error_popup", facebook_error_popup ) +LUI.MenuBuilder.registerDef( "options_vlist", options_vlist ) +LUI.MenuBuilder.registerDef( "controls", options ) +LockTable( _M ) diff --git a/lui/common_menus/optionslayout.dec.lua b/lui/common_menus/optionslayout.dec.lua new file mode 100644 index 0000000..80be3dc --- /dev/null +++ b/lui/common_menus/optionslayout.dec.lua @@ -0,0 +1,3699 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +debugPlaystation = false +function GetSticksConfig() + return Engine.GetProfileData( "gpadSticksConfig" ) +end + +function SetSticksConfig( f2_arg0, f2_arg1 ) + Engine.ExecNow( "profile_setSticksConfig " .. f2_arg0.properties.layout_name, f2_arg1.controller ) +end + +function GetButtonsConfig() + return Engine.GetProfileData( "gpadButtonsConfig" ) +end + +function SetButtonsConfig( f4_arg0, f4_arg1 ) + Engine.ExecNow( "profile_setButtonsConfig " .. f4_arg0.properties.layout_name, f4_arg1.controller ) +end + +function layoutMenuClose( f5_arg0, f5_arg1 ) + if not Engine.InFrontend() and Engine.IsMultiplayer() and not f5_arg1.value then + LUI.FlowManager.RequestCloseAllMenus( f5_arg0 ) + end +end + +function layout_buttons_vlist( f6_arg0, f6_arg1, f6_arg2 ) + local f6_local0 = { + type = "UIStencil", + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_narrow, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + children = {} + } + local f6_local1 = { + type = "UIVerticalList", + id = "layouts_vlist_id", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true + } + }, + children = {} + } + for f6_local5, f6_local6 in ipairs( f6_arg2 ) do + local f6_local7 = f6_local1.children + local f6_local8 = #f6_local1.children + 1 + local f6_local9 = { + type = "UIGenericButton", + id = f6_local6.name .. "_layout_button_id", + listDefaultFocus = f6_local6.name == f6_arg0() + } + local f6_local10 = { + layout_name = f6_local6.name, + button_text = Engine.Localize( f6_local6.display_name ) + } + local f6_local11 = MBh.DoMultiple + local f6_local12 = {} + local f6_local13 = f6_arg1 + local f6_local14 = MBh.LeaveMenu() + f6_local10.button_action_func = f6_local11( f6_local13 ) + f6_local11 = MBh.DoMultiple + f6_local12 = {} + f6_local13 = MBh.EmitEventToRoot( "hide_texts" ) + f6_local14 = MBh.EmitEventToRoot( "show_" .. f6_local6.name ) + f6_local10.button_over_func = f6_local11( f6_local13 ) + f6_local9.properties = f6_local10 + f6_local7[f6_local8] = f6_local9 + end + f6_local0.children[#f6_local0.children + 1] = f6_local1 + return f6_local0 +end + +stickBoxW = 190 +stickBoxH = 140 +function stick_box_line( f7_arg0, f7_arg1 ) + return { + type = "UIElement", + id = "stick_text_box_line" .. f7_arg1, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 32 + } + }, + children = { + { + type = "UIImage", + id = "arrow", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 32, + left = 0, + right = 32, + material = RegisterMaterial( f7_arg0 ) + } + } + }, + { + type = "UIText", + id = "text", + properties = { + text = Engine.Localize( f7_arg1 ) + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 37, + right = 0, + top = 4, + bottom = 4 + CoD.TextSettings.NormalFont.Height + } + } + } + } + } +end + +function stick_box_content( f8_arg0, f8_arg1 ) + local f8_local0 = { + type = "UIVerticalList", + id = "vlist_" .. f8_arg0, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 5, + right = 5, + top = 5, + bottom = 5, + alpha = 0, + spacing = 0 + }, + visible = { + alpha = 1 + } + }, + handlers = { + hide_texts = MBh.AnimateToState( "default", 0 ) + }, + children = {}, + handlers = MBh.AnimateToState( "visible", 0 ) + } + local f8_local1 = { + "cont_arrow_up", + "cont_arrow_down", + "cont_arrow_rt", + "cont_arrow_lt" + } + for f8_local5, f8_local6 in ipairs( f8_arg1 ) do + f8_local0.children[#f8_local0.children + 1] = stick_box_line( f8_local1[f8_local5], f8_local6 ) + end + return f8_local0 +end + +function stick_box( f9_arg0, f9_arg1 ) + local f9_local0 = { + type = "UIElement", + id = f9_arg0, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = { + { + type = "UIImage", + id = "sticks_texts_bg", + states = { + default = { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + red = 0, + green = 0, + blue = 0, + alpha = 0.5 + } + } + } + } + } + for f9_local4, f9_local5 in ipairs( f9_arg1 ) do + f9_local0.children[#f9_local0.children + 1] = stick_box_content( f9_local5.name, f9_local5.controls ) + end + return f9_local0 +end + +function left_stick_box( f10_arg0 ) + local f10_local0 = stick_box( "left_stick_box", f10_arg0 ) + f10_local0.states.default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false + } + if Engine.IsVita() then + f10_local0.states.default.top = 40 + f10_local0.states.default.left = -190 + elseif debugPlaystation then + f10_local0.states.default.top = 30 + f10_local0.states.default.left = -175 + elseif Engine.IsPS4() then + f10_local0.states.default.top = 30 + f10_local0.states.default.left = -175 + elseif Engine.IsPS3() then + f10_local0.states.default.top = 30 + f10_local0.states.default.left = -175 + elseif Engine.IsWiiU() then + f10_local0.states.default.top = -150 + f10_local0.states.default.left = -15 + elseif Engine.IsXB3() then + f10_local0.states.default.top = 15 + f10_local0.states.default.left = -195 + else + f10_local0.states.default.top = -15 + f10_local0.states.default.left = -195 + end + f10_local0.states.default.bottom = f10_local0.states.default.top + stickBoxH + f10_local0.states.default.right = f10_local0.states.default.left + stickBoxW + return f10_local0 +end + +function right_stick_box( f11_arg0 ) + local f11_local0 = stick_box( "right_stick_box", f11_arg0 ) + f11_local0.states.default = { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = true + } + if Engine.IsVita() then + f11_local0.states.default.top = -96 + f11_local0.states.default.left = 0 + elseif debugPlaystation then + f11_local0.states.default.top = -150 + f11_local0.states.default.left = -15 + elseif Engine.IsPS4() then + f11_local0.states.default.top = -150 + f11_local0.states.default.left = -15 + elseif Engine.IsPS3() then + f11_local0.states.default.top = -150 + f11_local0.states.default.left = -15 + elseif Engine.IsWiiU() then + f11_local0.states.default.top = -150 + f11_local0.states.default.left = -15 + elseif Engine.IsXB3() then + f11_local0.states.default.top = -95 + f11_local0.states.default.left = 5 + else + f11_local0.states.default.top = -70 + f11_local0.states.default.left = 5 + end + f11_local0.states.default.bottom = f11_local0.states.default.top + stickBoxH + f11_local0.states.default.right = f11_local0.states.default.left + stickBoxW + return f11_local0 +end + +function sticks_texts_overlay() + local f12_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "thumbstick" ) + local f12_local1 = { + type = "UIElement", + id = "sticks_texts_overlay", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = {} + } + local f12_local2 = "@MENU_LOOK_UP" + local f12_local3 = "@MENU_LOOK_DOWN" + if not f12_local0.exclusiveControllerIndex then + DebugPrint( "WARNING: OptionsLayout opened without exclusiveControllerIndex, this should only happen on LUI Reload" ) + f12_local0.exclusiveControllerIndex = 0 + end + if Engine.IsPitchInverted and Engine.IsPitchInverted( f12_local0.exclusiveControllerIndex ) then + local f12_local4 = f12_local2 + f12_local2 = f12_local3 + f12_local3 = f12_local4 + end + f12_local1.children[#f12_local1.children + 1] = left_stick_box( { + { + name = "thumbstick_default", + controls = { + "@MENU_MOVE_FORWARD", + "@MENU_MOVE_BACK", + "@LUA_MENU_STRAFE_RIGHT", + "@LUA_MENU_STRAFE_LEFT" + } + }, + { + name = "thumbstick_southpaw", + controls = { + f12_local2, + f12_local3, + "@LUA_MENU_ROTATE_RIGHT", + "@LUA_MENU_ROTATE_LEFT" + } + }, + { + name = "thumbstick_legacy", + controls = { + "@MENU_MOVE_FORWARD", + "@MENU_MOVE_BACK", + "@LUA_MENU_ROTATE_RIGHT", + "@LUA_MENU_ROTATE_LEFT" + } + }, + { + name = "thumbstick_legacysouthpaw", + controls = { + f12_local2, + f12_local3, + "@LUA_MENU_STRAFE_RIGHT", + "@LUA_MENU_STRAFE_LEFT" + } + }, + { + name = "thumbstick_southpaw_ns", + controls = { + f12_local2, + f12_local3, + "@LUA_MENU_ROTATE_RIGHT", + "@LUA_MENU_ROTATE_LEFT" + } + }, + { + name = "thumbstick_legacysouthpaw_ns", + controls = { + f12_local2, + f12_local3, + "@LUA_MENU_STRAFE_RIGHT", + "@LUA_MENU_STRAFE_LEFT" + } + } + } ) + f12_local1.children[#f12_local1.children + 1] = right_stick_box( { + { + name = "thumbstick_default", + controls = { + f12_local2, + f12_local3, + "@LUA_MENU_ROTATE_RIGHT", + "@LUA_MENU_ROTATE_LEFT" + } + }, + { + name = "thumbstick_southpaw", + controls = { + "@MENU_MOVE_FORWARD", + "@MENU_MOVE_BACK", + "@LUA_MENU_STRAFE_RIGHT", + "@LUA_MENU_STRAFE_LEFT" + } + }, + { + name = "thumbstick_legacy", + controls = { + f12_local2, + f12_local3, + "@LUA_MENU_STRAFE_RIGHT", + "@LUA_MENU_STRAFE_LEFT" + } + }, + { + name = "thumbstick_legacysouthpaw", + controls = { + "@MENU_MOVE_FORWARD", + "@MENU_MOVE_BACK", + "@LUA_MENU_ROTATE_RIGHT", + "@LUA_MENU_ROTATE_LEFT" + } + }, + { + name = "thumbstick_southpaw_ns", + controls = { + "@MENU_MOVE_FORWARD", + "@MENU_MOVE_BACK", + "@LUA_MENU_STRAFE_RIGHT", + "@LUA_MENU_STRAFE_LEFT" + } + }, + { + name = "thumbstick_legacysouthpaw_ns", + controls = { + "@MENU_MOVE_FORWARD", + "@MENU_MOVE_BACK", + "@LUA_MENU_ROTATE_RIGHT", + "@LUA_MENU_ROTATE_LEFT" + } + } + } ) + return f12_local1 +end + +function sticks_overlay() + local f13_local0 = nil + if Engine.IsVita() then + f13_local0 = RegisterMaterial( "cont_lines_stick_vita" ) + else + f13_local0 = RegisterMaterial( "cont_lines_stick" ) + end + local f13_local1 = { + type = "UIImage", + id = "controller_lines", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + material = f13_local0 + } + } + } + local f13_local2 = {} + f13_local1.children = sticks_texts_overlay() + if Engine.IsVita() then + f13_local1.states.default.top = 240 + f13_local1.states.default.left = 24 + elseif debugPlaystation then + f13_local1.states.default.top = 280 + f13_local1.states.default.left = 25 + elseif Engine.IsPS4() then + f13_local1.states.default.top = 280 + f13_local1.states.default.left = 25 + elseif Engine.IsPS3() then + f13_local1.states.default.top = 280 + f13_local1.states.default.left = 25 + elseif Engine.IsWiiU() then + f13_local1.states.default.top = 280 + f13_local1.states.default.left = 25 + elseif Engine.IsXB3() then + f13_local1.states.default.top = 255 + f13_local1.states.default.left = 0 + else + f13_local1.states.default.top = 220 + f13_local1.states.default.left = 5 + end + if Engine.IsVita() then + f13_local1.states.default.bottom = f13_local1.states.default.top + 140 + f13_local1.states.default.right = f13_local1.states.default.left + 558 + else + f13_local1.states.default.bottom = f13_local1.states.default.top + 188 + f13_local1.states.default.right = f13_local1.states.default.left + 512 + end + return f13_local1 +end + +function button_text_overlay( f14_arg0, f14_arg1, f14_arg2 ) + if Engine.IsVita() then + f14_arg2 = f14_arg2.vita + elseif debugPlaystation then + f14_arg2 = f14_arg2.ps3 + elseif Engine.IsPS3() then + f14_arg2 = f14_arg2.ps3 + elseif Engine.IsPS4() then + f14_arg2 = f14_arg2.ps4 + elseif Engine.IsXB3() then + f14_arg2 = f14_arg2.xb3 + elseif Engine.IsWiiU() then + f14_arg2 = f14_arg2.wiiu + else + f14_arg2 = f14_arg2.xbox + end + local f14_local0 = { + type = "UIText", + id = f14_arg0, + properties = { + text = "" + }, + states = { + default = { + font = CoD.TextSettings.NormalFont.Font, + alignment = f14_arg2.alignment, + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = f14_arg2.left, + right = f14_arg2.right, + top = f14_arg2.top, + bottom = f14_arg2.bottom, + red = 1, + green = 1, + blue = 1 + } + }, + handlers = {} + } + for f14_local4, f14_local5 in ipairs( f14_arg1 ) do + f14_local0.handlers["show_" .. f14_local5.name] = function ( f15_arg0, f15_arg1 ) + f15_arg0:setText( Engine.Localize( f14_local5.text ) ) + end + + end + return f14_local0 +end + +function buttons_texts_overlay() + local f16_local0 = not Engine.IsMultiplayer() + local f16_local1 = Engine.IsAliensMode() + local f16_local2 + if f16_local0 then + f16_local2 = "@MENU_THROW_FRAG_GRENADE" + if not f16_local2 then + + else + local f16_local3 + if f16_local0 then + f16_local3 = "@LUA_MENU_NOT_USED" + if not f16_local3 then + if f16_local1 then + f16_local3 = "@ALIENS_UPGRADE_ABILITIES" + if not f16_local3 then + + else + local f16_local4 + if f16_local1 then + f16_local4 = "@LUA_MENU_SCOREBOARD_MENU" + if not f16_local4 then + + else + local f16_local5 = { + type = "UIElement", + id = "buttons_texts_overlay", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = {} + } + local f16_local6 = { + { + name = "buttons_default", + text = "@MENU_SPRINT_HOLD_BREATH" + }, + { + name = "buttons_tactical", + text = "@MENU_SPRINT_HOLD_BREATH" + }, + { + name = "buttons_lefty", + text = "@MENU_MELEE_HOLD_BREATH" + }, + { + name = "buttons_nomad", + text = "@MENU_SPRINT_CHANGE_ZOOM" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_SPRINT_CHANGE_ZOOM" + } + } + local f16_local7 = { + { + name = "buttons_default", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_tactical", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_lefty", + text = f16_local2 + }, + { + name = "buttons_nomad", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_THROW_SPECIAL_GRENADE" + } + } + local f16_local8 = { + { + name = "buttons_default", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_tactical", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_lefty", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_nomad", + text = f16_local2 + }, + { + name = "buttons_nomad_tactical", + text = f16_local2 + } + } + local f16_local9 = { + { + name = "buttons_default", + text = "@MENU_MELEE_CHANGE_ZOOM" + }, + { + name = "buttons_tactical", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_lefty", + text = "@MENU_SPRINT_CHANGE_ZOOM" + }, + { + name = "buttons_nomad", + text = "@MENU_MELEE_HOLD_BREATH" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_CROUCH_PRONE" + } + } + local f16_local10 = { + { + name = "buttons_default", + text = f16_local2 + }, + { + name = "buttons_tactical", + text = f16_local2 + }, + { + name = "buttons_lefty", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_nomad", + text = "@MENU_TOGGLE_AIM_DOWN_SIGHT" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_TOGGLE_AIM_DOWN_SIGHT" + } + } + local f16_local11 = { + { + name = "buttons_default", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_tactical", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_lefty", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_nomad", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_FIRE_WEAPON" + } + } + local f16_local12 = { + { + name = "buttons_default", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_tactical", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_lefty", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_nomad", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_SWITCH_WEAPON" + } + } + local f16_local13 = { + { + name = "buttons_default", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_tactical", + text = "@MENU_MELEE_CHANGE_ZOOM" + }, + { + name = "buttons_lefty", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_nomad", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_MELEE_HOLD_BREATH" + } + } + local f16_local14 = { + { + name = "buttons_default", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_tactical", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_lefty", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_nomad", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_USE_RELOAD" + } + } + local f16_local15 = { + { + name = "buttons_default", + text = "@MENU_JUMP" + }, + { + name = "buttons_tactical", + text = "@MENU_JUMP" + }, + { + name = "buttons_lefty", + text = "@MENU_JUMP" + }, + { + name = "buttons_nomad", + text = "@MENU_JUMP" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_JUMP" + } + } + local f16_local16 = { + { + name = "buttons_default", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_tactical", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_lefty", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_nomad", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_INVENTORY" + } + } + local f16_local17 = { + { + name = "buttons_default", + text = f16_local3 + }, + { + name = "buttons_tactical", + text = f16_local3 + }, + { + name = "buttons_lefty", + text = f16_local3 + }, + { + name = "buttons_nomad", + text = f16_local3 + }, + { + name = "buttons_nomad_tactical", + text = f16_local3 + } + } + local f16_local18 = { + { + name = "buttons_default", + text = f16_local4 + }, + { + name = "buttons_tactical", + text = f16_local4 + }, + { + name = "buttons_lefty", + text = f16_local4 + }, + { + name = "buttons_nomad", + text = f16_local4 + }, + { + name = "buttons_nomad_tactical", + text = f16_local4 + } + } + for f16_local30, f16_local29 in ipairs( { + f16_local6, + f16_local7, + f16_local8, + f16_local9, + f16_local10, + f16_local11, + f16_local12, + f16_local13, + f16_local14, + f16_local15, + f16_local16, + f16_local17, + f16_local18 + } ) do + local f16_local22 = f16_local29 + if f16_local29 == f16_local8 then + f16_local22 = f16_local7 + elseif f16_local29 == f16_local11 then + f16_local22 = f16_local10 + elseif f16_local29 == f16_local7 then + f16_local22 = f16_local8 + elseif f16_local29 == f16_local10 then + f16_local22 = f16_local11 + end + local f16_local23 = {} + for f16_local27, f16_local28 in ipairs( f16_local22 ) do + table.insert( f16_local23, { + name = f16_local28.name .. "_alt", + text = f16_local28.text + } ) + end + f16_local29 = LUI.ConcatenateToTable( f16_local29, f16_local23 ) + end + if Engine.IsPS3() or debugPlaystation then + f16_local19 = f16_local11 + f16_local11 = f16_local10 + f16_local10 = f16_local19 + f16_local20 = f16_local8 + f16_local8 = f16_local7 + f16_local7 = f16_local20 + end + if IsCurrentSticksLayoutSouthpaw() or IsCurrentSticksLayoutLegacySouthpaw() then + f16_local19 = f16_local9 + f16_local9 = f16_local6 + f16_local6 = f16_local19 + end + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LS", f16_local6, { + xbox = { + left = -200, + right = -5, + top = 294, + bottom = 294 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -200, + right = -5, + top = 300, + bottom = 300 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = 230, + right = 400, + top = 438, + bottom = 438 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LB", f16_local7, { + xbox = { + left = -23, + right = 87, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -10, + right = 100, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = 360, + right = 470, + top = 282 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 282 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LT", f16_local8, { + xbox = { + left = -155, + right = 145, + top = 43 - CoD.TextSettings.NormalFont.Height, + bottom = 43, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -167, + right = 133, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + vita = { + left = -250, + right = 50, + top = 70 - CoD.TextSettings.NormalFont.Height, + bottom = 70, + alignment = LUI.Alignment.Right + }, + wiiu = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RS", f16_local9, { + xbox = { + left = 223, + right = 523, + top = 467, + bottom = 467 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 223, + right = 523, + top = 472, + bottom = 472 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + vita = { + left = -164, + right = 672, + top = 250, + bottom = 250 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RT", f16_local11, { + xbox = { + left = 437, + right = 737, + top = 43 - CoD.TextSettings.NormalFont.Height, + bottom = 43, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 456, + right = 756, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + vita = { + left = 520, + right = 820, + top = 70 - CoD.TextSettings.NormalFont.Height, + bottom = 70, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RB", f16_local10, { + xbox = { + left = 495, + right = 605, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 489, + right = 599, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + vita = { + left = 360, + right = 470, + top = 230 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 230 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "Y", f16_local12, { + xbox = { + left = 578, + right = 733, + top = 260 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 260 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 270 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 270 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 114 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 114 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "B", f16_local13, { + xbox = { + left = 578, + right = 733, + top = 300 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 300 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 310 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 310 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 727, + top = 200 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 200 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "X", f16_local14, { + xbox = { + left = 578, + right = 733, + top = 344 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 344 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 354 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 354 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 254 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 254 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "A", f16_local15, { + xbox = { + left = 578, + right = 733, + top = 380 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 380 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 390 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 390 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 306 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 306 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "DPAD", f16_local16, { + xbox = { + left = 56, + right = 356, + top = 467, + bottom = 467 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 56, + right = 356, + top = 472, + bottom = 472 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = -278, + right = 22, + top = 340, + bottom = 340 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -300, + right = 0, + top = 295, + bottom = 295 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = -300, + right = 0, + top = 200, + bottom = 200 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + wiiu = { + left = -300, + right = 0, + top = 295, + bottom = 295 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "back", f16_local17, { + xbox = { + left = 84, + right = 384, + top = 75 - CoD.TextSettings.NormalFont.Height, + bottom = 75, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 92, + right = 392, + top = 80 - CoD.TextSettings.NormalFont.Height, + bottom = 80, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + }, + ps4 = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + }, + vita = { + left = -164, + right = 672, + top = 154, + bottom = 154 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "start", f16_local18, { + xbox = { + left = 194, + right = 494, + top = 107 - CoD.TextSettings.NormalFont.Height, + bottom = 107, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 195, + right = 495, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + ps4 = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + vita = { + left = 520, + right = 670, + top = 452 - CoD.TextSettings.NormalFont.Height, + bottom = 452, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + } + } ) + return f16_local5 + end + end + f16_local4 = "@MENU_OBJECTIVES_MENU" + end + end + f16_local3 = "@MENU_SCOREBOARD" + end + else + if f16_local1 then + f16_local3 = "@ALIENS_UPGRADE_ABILITIES" + if not f16_local3 then + + else + local f16_local4 + if f16_local1 then + f16_local4 = "@LUA_MENU_SCOREBOARD_MENU" + if not f16_local4 then + + else + local f16_local5 = { + type = "UIElement", + id = "buttons_texts_overlay", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = {} + } + local f16_local6 = { + { + name = "buttons_default", + text = "@MENU_SPRINT_HOLD_BREATH" + }, + { + name = "buttons_tactical", + text = "@MENU_SPRINT_HOLD_BREATH" + }, + { + name = "buttons_lefty", + text = "@MENU_MELEE_HOLD_BREATH" + }, + { + name = "buttons_nomad", + text = "@MENU_SPRINT_CHANGE_ZOOM" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_SPRINT_CHANGE_ZOOM" + } + } + local f16_local7 = { + { + name = "buttons_default", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_tactical", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_lefty", + text = f16_local2 + }, + { + name = "buttons_nomad", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_THROW_SPECIAL_GRENADE" + } + } + local f16_local8 = { + { + name = "buttons_default", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_tactical", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_lefty", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_nomad", + text = f16_local2 + }, + { + name = "buttons_nomad_tactical", + text = f16_local2 + } + } + local f16_local9 = { + { + name = "buttons_default", + text = "@MENU_MELEE_CHANGE_ZOOM" + }, + { + name = "buttons_tactical", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_lefty", + text = "@MENU_SPRINT_CHANGE_ZOOM" + }, + { + name = "buttons_nomad", + text = "@MENU_MELEE_HOLD_BREATH" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_CROUCH_PRONE" + } + } + local f16_local10 = { + { + name = "buttons_default", + text = f16_local2 + }, + { + name = "buttons_tactical", + text = f16_local2 + }, + { + name = "buttons_lefty", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_nomad", + text = "@MENU_TOGGLE_AIM_DOWN_SIGHT" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_TOGGLE_AIM_DOWN_SIGHT" + } + } + local f16_local11 = { + { + name = "buttons_default", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_tactical", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_lefty", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_nomad", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_FIRE_WEAPON" + } + } + local f16_local12 = { + { + name = "buttons_default", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_tactical", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_lefty", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_nomad", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_SWITCH_WEAPON" + } + } + local f16_local13 = { + { + name = "buttons_default", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_tactical", + text = "@MENU_MELEE_CHANGE_ZOOM" + }, + { + name = "buttons_lefty", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_nomad", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_MELEE_HOLD_BREATH" + } + } + local f16_local14 = { + { + name = "buttons_default", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_tactical", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_lefty", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_nomad", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_USE_RELOAD" + } + } + local f16_local15 = { + { + name = "buttons_default", + text = "@MENU_JUMP" + }, + { + name = "buttons_tactical", + text = "@MENU_JUMP" + }, + { + name = "buttons_lefty", + text = "@MENU_JUMP" + }, + { + name = "buttons_nomad", + text = "@MENU_JUMP" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_JUMP" + } + } + local f16_local16 = { + { + name = "buttons_default", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_tactical", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_lefty", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_nomad", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_INVENTORY" + } + } + local f16_local17 = { + { + name = "buttons_default", + text = f16_local3 + }, + { + name = "buttons_tactical", + text = f16_local3 + }, + { + name = "buttons_lefty", + text = f16_local3 + }, + { + name = "buttons_nomad", + text = f16_local3 + }, + { + name = "buttons_nomad_tactical", + text = f16_local3 + } + } + local f16_local18 = { + { + name = "buttons_default", + text = f16_local4 + }, + { + name = "buttons_tactical", + text = f16_local4 + }, + { + name = "buttons_lefty", + text = f16_local4 + }, + { + name = "buttons_nomad", + text = f16_local4 + }, + { + name = "buttons_nomad_tactical", + text = f16_local4 + } + } + for f16_local30, f16_local29 in ipairs( { + f16_local6, + f16_local7, + f16_local8, + f16_local9, + f16_local10, + f16_local11, + f16_local12, + f16_local13, + f16_local14, + f16_local15, + f16_local16, + f16_local17, + f16_local18 + } ) do + local f16_local22 = f16_local29 + if f16_local29 == f16_local8 then + f16_local22 = f16_local7 + elseif f16_local29 == f16_local11 then + f16_local22 = f16_local10 + elseif f16_local29 == f16_local7 then + f16_local22 = f16_local8 + elseif f16_local29 == f16_local10 then + f16_local22 = f16_local11 + end + local f16_local23 = {} + for f16_local27, f16_local28 in ipairs( f16_local22 ) do + table.insert( f16_local23, { + name = f16_local28.name .. "_alt", + text = f16_local28.text + } ) + end + f16_local29 = LUI.ConcatenateToTable( f16_local29, f16_local23 ) + end + if Engine.IsPS3() or debugPlaystation then + f16_local19 = f16_local11 + f16_local11 = f16_local10 + f16_local10 = f16_local19 + f16_local20 = f16_local8 + f16_local8 = f16_local7 + f16_local7 = f16_local20 + end + if IsCurrentSticksLayoutSouthpaw() or IsCurrentSticksLayoutLegacySouthpaw() then + f16_local19 = f16_local9 + f16_local9 = f16_local6 + f16_local6 = f16_local19 + end + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LS", f16_local6, { + xbox = { + left = -200, + right = -5, + top = 294, + bottom = 294 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -200, + right = -5, + top = 300, + bottom = 300 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = 230, + right = 400, + top = 438, + bottom = 438 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LB", f16_local7, { + xbox = { + left = -23, + right = 87, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -10, + right = 100, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = 360, + right = 470, + top = 282 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 282 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LT", f16_local8, { + xbox = { + left = -155, + right = 145, + top = 43 - CoD.TextSettings.NormalFont.Height, + bottom = 43, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -167, + right = 133, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + vita = { + left = -250, + right = 50, + top = 70 - CoD.TextSettings.NormalFont.Height, + bottom = 70, + alignment = LUI.Alignment.Right + }, + wiiu = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RS", f16_local9, { + xbox = { + left = 223, + right = 523, + top = 467, + bottom = 467 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 223, + right = 523, + top = 472, + bottom = 472 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + vita = { + left = -164, + right = 672, + top = 250, + bottom = 250 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RT", f16_local11, { + xbox = { + left = 437, + right = 737, + top = 43 - CoD.TextSettings.NormalFont.Height, + bottom = 43, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 456, + right = 756, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + vita = { + left = 520, + right = 820, + top = 70 - CoD.TextSettings.NormalFont.Height, + bottom = 70, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RB", f16_local10, { + xbox = { + left = 495, + right = 605, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 489, + right = 599, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + vita = { + left = 360, + right = 470, + top = 230 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 230 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "Y", f16_local12, { + xbox = { + left = 578, + right = 733, + top = 260 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 260 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 270 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 270 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 114 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 114 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "B", f16_local13, { + xbox = { + left = 578, + right = 733, + top = 300 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 300 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 310 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 310 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 727, + top = 200 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 200 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "X", f16_local14, { + xbox = { + left = 578, + right = 733, + top = 344 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 344 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 354 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 354 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 254 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 254 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "A", f16_local15, { + xbox = { + left = 578, + right = 733, + top = 380 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 380 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 390 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 390 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 306 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 306 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "DPAD", f16_local16, { + xbox = { + left = 56, + right = 356, + top = 467, + bottom = 467 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 56, + right = 356, + top = 472, + bottom = 472 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = -278, + right = 22, + top = 340, + bottom = 340 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -300, + right = 0, + top = 295, + bottom = 295 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = -300, + right = 0, + top = 200, + bottom = 200 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + wiiu = { + left = -300, + right = 0, + top = 295, + bottom = 295 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "back", f16_local17, { + xbox = { + left = 84, + right = 384, + top = 75 - CoD.TextSettings.NormalFont.Height, + bottom = 75, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 92, + right = 392, + top = 80 - CoD.TextSettings.NormalFont.Height, + bottom = 80, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + }, + ps4 = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + }, + vita = { + left = -164, + right = 672, + top = 154, + bottom = 154 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "start", f16_local18, { + xbox = { + left = 194, + right = 494, + top = 107 - CoD.TextSettings.NormalFont.Height, + bottom = 107, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 195, + right = 495, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + ps4 = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + vita = { + left = 520, + right = 670, + top = 452 - CoD.TextSettings.NormalFont.Height, + bottom = 452, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + } + } ) + return f16_local5 + end + end + f16_local4 = "@MENU_OBJECTIVES_MENU" + end + end + f16_local3 = "@MENU_SCOREBOARD" + end + local f16_local4 + if f16_local1 then + f16_local4 = "@LUA_MENU_SCOREBOARD_MENU" + if not f16_local4 then + + else + local f16_local5 = { + type = "UIElement", + id = "buttons_texts_overlay", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + children = {} + } + local f16_local6 = { + { + name = "buttons_default", + text = "@MENU_SPRINT_HOLD_BREATH" + }, + { + name = "buttons_tactical", + text = "@MENU_SPRINT_HOLD_BREATH" + }, + { + name = "buttons_lefty", + text = "@MENU_MELEE_HOLD_BREATH" + }, + { + name = "buttons_nomad", + text = "@MENU_SPRINT_CHANGE_ZOOM" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_SPRINT_CHANGE_ZOOM" + } + } + local f16_local7 = { + { + name = "buttons_default", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_tactical", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_lefty", + text = f16_local2 + }, + { + name = "buttons_nomad", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_THROW_SPECIAL_GRENADE" + } + } + local f16_local8 = { + { + name = "buttons_default", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_tactical", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_lefty", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_nomad", + text = f16_local2 + }, + { + name = "buttons_nomad_tactical", + text = f16_local2 + } + } + local f16_local9 = { + { + name = "buttons_default", + text = "@MENU_MELEE_CHANGE_ZOOM" + }, + { + name = "buttons_tactical", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_lefty", + text = "@MENU_SPRINT_CHANGE_ZOOM" + }, + { + name = "buttons_nomad", + text = "@MENU_MELEE_HOLD_BREATH" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_CROUCH_PRONE" + } + } + local f16_local10 = { + { + name = "buttons_default", + text = f16_local2 + }, + { + name = "buttons_tactical", + text = f16_local2 + }, + { + name = "buttons_lefty", + text = "@MENU_THROW_SPECIAL_GRENADE" + }, + { + name = "buttons_nomad", + text = "@MENU_TOGGLE_AIM_DOWN_SIGHT" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_TOGGLE_AIM_DOWN_SIGHT" + } + } + local f16_local11 = { + { + name = "buttons_default", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_tactical", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_lefty", + text = "@MENU_AIM_DOWN_SIGHT" + }, + { + name = "buttons_nomad", + text = "@MENU_FIRE_WEAPON" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_FIRE_WEAPON" + } + } + local f16_local12 = { + { + name = "buttons_default", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_tactical", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_lefty", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_nomad", + text = "@MENU_SWITCH_WEAPON" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_SWITCH_WEAPON" + } + } + local f16_local13 = { + { + name = "buttons_default", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_tactical", + text = "@MENU_MELEE_CHANGE_ZOOM" + }, + { + name = "buttons_lefty", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_nomad", + text = "@MENU_CROUCH_PRONE" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_MELEE_HOLD_BREATH" + } + } + local f16_local14 = { + { + name = "buttons_default", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_tactical", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_lefty", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_nomad", + text = "@MENU_USE_RELOAD" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_USE_RELOAD" + } + } + local f16_local15 = { + { + name = "buttons_default", + text = "@MENU_JUMP" + }, + { + name = "buttons_tactical", + text = "@MENU_JUMP" + }, + { + name = "buttons_lefty", + text = "@MENU_JUMP" + }, + { + name = "buttons_nomad", + text = "@MENU_JUMP" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_JUMP" + } + } + local f16_local16 = { + { + name = "buttons_default", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_tactical", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_lefty", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_nomad", + text = "@MENU_INVENTORY" + }, + { + name = "buttons_nomad_tactical", + text = "@MENU_INVENTORY" + } + } + local f16_local17 = { + { + name = "buttons_default", + text = f16_local3 + }, + { + name = "buttons_tactical", + text = f16_local3 + }, + { + name = "buttons_lefty", + text = f16_local3 + }, + { + name = "buttons_nomad", + text = f16_local3 + }, + { + name = "buttons_nomad_tactical", + text = f16_local3 + } + } + local f16_local18 = { + { + name = "buttons_default", + text = f16_local4 + }, + { + name = "buttons_tactical", + text = f16_local4 + }, + { + name = "buttons_lefty", + text = f16_local4 + }, + { + name = "buttons_nomad", + text = f16_local4 + }, + { + name = "buttons_nomad_tactical", + text = f16_local4 + } + } + for f16_local30, f16_local29 in ipairs( { + f16_local6, + f16_local7, + f16_local8, + f16_local9, + f16_local10, + f16_local11, + f16_local12, + f16_local13, + f16_local14, + f16_local15, + f16_local16, + f16_local17, + f16_local18 + } ) do + local f16_local22 = f16_local29 + if f16_local29 == f16_local8 then + f16_local22 = f16_local7 + elseif f16_local29 == f16_local11 then + f16_local22 = f16_local10 + elseif f16_local29 == f16_local7 then + f16_local22 = f16_local8 + elseif f16_local29 == f16_local10 then + f16_local22 = f16_local11 + end + local f16_local23 = {} + for f16_local27, f16_local28 in ipairs( f16_local22 ) do + table.insert( f16_local23, { + name = f16_local28.name .. "_alt", + text = f16_local28.text + } ) + end + f16_local29 = LUI.ConcatenateToTable( f16_local29, f16_local23 ) + end + if Engine.IsPS3() or debugPlaystation then + f16_local19 = f16_local11 + f16_local11 = f16_local10 + f16_local10 = f16_local19 + f16_local20 = f16_local8 + f16_local8 = f16_local7 + f16_local7 = f16_local20 + end + if IsCurrentSticksLayoutSouthpaw() or IsCurrentSticksLayoutLegacySouthpaw() then + f16_local19 = f16_local9 + f16_local9 = f16_local6 + f16_local6 = f16_local19 + end + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LS", f16_local6, { + xbox = { + left = -200, + right = -5, + top = 294, + bottom = 294 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -200, + right = -5, + top = 300, + bottom = 300 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = 230, + right = 400, + top = 438, + bottom = 438 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = -100, + right = 200, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LB", f16_local7, { + xbox = { + left = -23, + right = 87, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -10, + right = 100, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = 360, + right = 470, + top = 282 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 282 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = -17, + right = 93, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "LT", f16_local8, { + xbox = { + left = -155, + right = 145, + top = 43 - CoD.TextSettings.NormalFont.Height, + bottom = 43, + alignment = LUI.Alignment.Right + }, + xb3 = { + left = -167, + right = 133, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + ps3 = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + }, + vita = { + left = -250, + right = 50, + top = 70 - CoD.TextSettings.NormalFont.Height, + bottom = 70, + alignment = LUI.Alignment.Right + }, + wiiu = { + left = -158, + right = 142, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RS", f16_local9, { + xbox = { + left = 223, + right = 523, + top = 467, + bottom = 467 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 223, + right = 523, + top = 472, + bottom = 472 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + vita = { + left = -164, + right = 672, + top = 250, + bottom = 250 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 381, + right = 681, + top = 473, + bottom = 473 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RT", f16_local11, { + xbox = { + left = 437, + right = 737, + top = 43 - CoD.TextSettings.NormalFont.Height, + bottom = 43, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 456, + right = 756, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + }, + vita = { + left = 520, + right = 820, + top = 70 - CoD.TextSettings.NormalFont.Height, + bottom = 70, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 437, + right = 737, + top = 40 - CoD.TextSettings.NormalFont.Height, + bottom = 40, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "RB", f16_local10, { + xbox = { + left = 495, + right = 605, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 489, + right = 599, + top = 105 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 105 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + }, + vita = { + left = 360, + right = 470, + top = 230 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 230 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 484, + right = 594, + top = 86 - 2 * CoD.TextSettings.NormalFont.Height, + bottom = 86 - CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "Y", f16_local12, { + xbox = { + left = 578, + right = 733, + top = 260 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 260 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 270 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 270 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 114 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 114 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 285 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 285 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "B", f16_local13, { + xbox = { + left = 578, + right = 733, + top = 300 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 300 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 310 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 310 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 727, + top = 200 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 200 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 727, + top = 325 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 325 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "X", f16_local14, { + xbox = { + left = 578, + right = 733, + top = 344 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 344 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 354 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 354 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 254 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 254 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 369 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 369 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "A", f16_local15, { + xbox = { + left = 578, + right = 733, + top = 380 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 380 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + xb3 = { + left = 578, + right = 733, + top = 390 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 390 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps3 = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + ps4 = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + vita = { + left = 572, + right = 782, + top = 306 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 306 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 572, + right = 782, + top = 405 - CoD.TextSettings.NormalFont.Height / 2, + bottom = 405 + CoD.TextSettings.NormalFont.Height / 2, + alignment = LUI.Alignment.Left + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "DPAD", f16_local16, { + xbox = { + left = 56, + right = 356, + top = 467, + bottom = 467 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 56, + right = 356, + top = 472, + bottom = 472 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = -278, + right = 22, + top = 340, + bottom = 340 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + ps4 = { + left = -300, + right = 0, + top = 295, + bottom = 295 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + vita = { + left = -300, + right = 0, + top = 200, + bottom = 200 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + }, + wiiu = { + left = -300, + right = 0, + top = 295, + bottom = 295 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Right + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "back", f16_local17, { + xbox = { + left = 84, + right = 384, + top = 75 - CoD.TextSettings.NormalFont.Height, + bottom = 75, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 92, + right = 392, + top = 80 - CoD.TextSettings.NormalFont.Height, + bottom = 80, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + }, + ps4 = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + }, + vita = { + left = -164, + right = 672, + top = 154, + bottom = 154 + CoD.TextSettings.NormalFont.Height, + alignment = LUI.Alignment.Center + }, + wiiu = { + left = 90, + right = 390, + top = 78 - CoD.TextSettings.NormalFont.Height, + bottom = 78, + alignment = LUI.Alignment.Center + } + } ) + f16_local5.children[#f16_local5.children + 1] = button_text_overlay( "start", f16_local18, { + xbox = { + left = 194, + right = 494, + top = 107 - CoD.TextSettings.NormalFont.Height, + bottom = 107, + alignment = LUI.Alignment.Center + }, + xb3 = { + left = 195, + right = 495, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + ps3 = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + ps4 = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + }, + vita = { + left = 520, + right = 670, + top = 452 - CoD.TextSettings.NormalFont.Height, + bottom = 452, + alignment = LUI.Alignment.Left + }, + wiiu = { + left = 197, + right = 497, + top = 112 - CoD.TextSettings.NormalFont.Height, + bottom = 112, + alignment = LUI.Alignment.Center + } + } ) + return f16_local5 + end + end + f16_local4 = "@MENU_OBJECTIVES_MENU" + end + end + f16_local2 = "@MENU_USE_EQUIPMENT" +end + +function buttons_overlay() + local f17_local0 = nil + if Engine.IsVita() then + f17_local0 = RegisterMaterial( "cont_lines_btn_vita" ) + else + f17_local0 = RegisterMaterial( "cont_lines_btn" ) + end + local f17_local1 = { + type = "UIImage", + id = "controller_lines", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + material = f17_local0 + } + } + } + local f17_local2 = {} + f17_local1.children = buttons_texts_overlay() + if Engine.IsVita() then + f17_local1.states.default.top = 0 + f17_local1.states.default.left = 13 + elseif debugPlaystation then + f17_local1.states.default.top = -38 + f17_local1.states.default.left = 13 + elseif Engine.IsPS4() then + f17_local1.states.default.top = -38 + f17_local1.states.default.left = 13 + elseif Engine.IsPS3() then + f17_local1.states.default.top = -38 + f17_local1.states.default.left = 13 + elseif Engine.IsWiiU() then + f17_local1.states.default.top = -38 + f17_local1.states.default.left = 55 + elseif Engine.IsXB3() then + f17_local1.states.default.top = -30 + f17_local1.states.default.left = 9 + else + f17_local1.states.default.top = -40 + f17_local1.states.default.left = 12 + end + f17_local1.states.default.bottom = f17_local1.states.default.top + 512 + f17_local1.states.default.right = f17_local1.states.default.left + 572 + return f17_local1 +end + +function menu_base( f18_arg0, f18_arg1, f18_arg2 ) + local f18_local0 = { + type = "UIElement", + id = f18_arg0 .. "_layout_root_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = MainCreate, + omnvar_update = { + ui_pause_menu_show = layoutMenuClose + } + }, + children = {} + } + if Engine.InFrontend() then + f18_local0.children[#f18_local0.children + 1] = { + type = "UIImage", + id = "stick_button_darken_overlay", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = Swatches.Overlay.AlphaMore, + material = RegisterMaterial( "white" ) + } ) + } + } + end + if not Engine.InFrontend() then + f18_local0.children[#f18_local0.children + 1] = { + type = "UIWorldBlur", + id = "world_blur_id", + states = { + default = { + worldBlur = 5 + } + } + } + f18_local0.children[#f18_local0.children + 1] = { + type = "UIImage", + id = "pause_background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.5, + material = RegisterMaterial( "black" ) + } + } + } + end + f18_local0.children[#f18_local0.children + 1] = { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( f18_arg1 ) + } + } + f18_local0.children[#f18_local0.children + 1] = { + type = "button_helper_text_main", + id = "button_helper_text_id" + } + f18_local0.children[#f18_local0.children + 1] = { + type = "generic_back_button", + id = "back_button_id" + } + local f18_local1 = nil + if Engine.IsVita() then + f18_local1 = RegisterMaterial( "cont_vita" ) + else + f18_local1 = RegisterMaterial( "cont" ) + end + local f18_local2, f18_local3 = nil + if Engine.UsingSplitscreenUpscaling() then + f18_local3 = 0.65 + local f18_local4 = 606 * f18_local3 + local f18_local5 = {} + f18_local5 = GameX.GetSafeZoneSize() + f18_local2 = { + leftAnchor = false, + rightAnchor = true, + topAnchor = false, + bottomAnchor = false, + top = (f18_local5[4] + f18_local5[2]) / 2, + right = f18_local5[3] - f18_local4 / 2 - 130, + height = 0, + width = 0 + } + else + f18_local3 = 1 + f18_local2 = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 728, + top = 406, + height = 0, + width = 0 + } + end + local f18_local6 = Engine.UsingSplitscreenUpscaling() + local f18_local7 = Engine.IsPS3() + local f18_local8 = f18_local0.children + f18_local8[#f18_local0.children + 1] = { + type = "UIElement", + states = { + default = f18_local2 + }, + children = { + { + type = "UIElement", + id = "controller_container", + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + width = 606, + height = 512, + scale = f18_local3 - 1 + } + }, + children = { + { + type = "UIImage", + id = "controller", + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 512, + left = 0, + width = 606, + material = f18_local1 + } + } + }, + f18_arg2 + } + } + } + } + local f18_local4 = f18_local6 and f18_local7 or f18_local8 + return f18_local0 +end + +function sticks_layout() + local f19_local0 = menu_base( "sticks", "@MENU_STICK_LAYOUT_CAP", sticks_overlay() ) + f19_local0.children[#f19_local0.children + 1] = layout_buttons_vlist( GetSticksConfig, SetSticksConfig, { + { + name = "thumbstick_default", + display_name = "MENU_DEFAULT" + }, + { + name = "thumbstick_southpaw", + display_name = "MENU_SOUTHPAW" + }, + { + name = "thumbstick_legacy", + display_name = "MENU_LEGACY" + }, + { + name = "thumbstick_legacysouthpaw", + display_name = "MENU_LEGACY_SOUTHPAW" + }, + { + name = "thumbstick_southpaw_ns", + display_name = "MENU_SOUTHPAW_NS" + }, + { + name = "thumbstick_legacysouthpaw_ns", + display_name = "MENU_LEGACY_SOUTHPAW_NS" + } + } ) + return f19_local0 +end + +function buttons_layout() + local f20_local0 = menu_base( "buttons", "@MENU_BUTTON_LAYOUT_CAP", buttons_overlay() ) + local f20_local1 = { + { + name = "buttons_default", + display_name = "MENU_DEFAULT" + }, + { + name = "buttons_tactical", + display_name = "MENU_TACTICAL" + }, + { + name = "buttons_lefty", + display_name = "MENU_LEFTY" + }, + { + name = "buttons_nomad", + display_name = "MENU_NOMAD" + }, + { + name = "buttons_nomad_tactical", + display_name = "MENU_NOMAD_TACTICAL" + } + } + if Engine.IsPS3() or Engine.IsPS4() or debugPlaystation then + f20_local1[#f20_local1 + 1] = { + name = "buttons_default_alt", + display_name = "MENU_DEFAULT_ALT" + } + f20_local1[#f20_local1 + 1] = { + name = "buttons_tactical_alt", + display_name = "MENU_TACTICAL_ALT" + } + f20_local1[#f20_local1 + 1] = { + name = "buttons_lefty_alt", + display_name = "MENU_LEFTY_ALT" + } + f20_local1[#f20_local1 + 1] = { + name = "buttons_nomad_alt", + display_name = "MENU_NOMAD_ALT" + } + f20_local1[#f20_local1 + 1] = { + name = "buttons_nomad_tactical_alt", + display_name = "MENU_NOMAD_TACTICAL_ALT" + } + end + f20_local0.children[#f20_local0.children + 1] = layout_buttons_vlist( GetButtonsConfig, SetButtonsConfig, f20_local1 ) + return f20_local0 +end + +function MainCreate( f21_arg0, f21_arg1 ) + f21_arg0:dispatchEventToRoot( { + name = "add_button_helper_text", + button_ref = "button_secondary", + helper_text = Engine.Localize( "@LUA_MENU_BACK" ), + side = "left", + clickable = true + } ) +end + +LUI.MenuBuilder.registerDef( "thumbstick", sticks_layout ) +LUI.MenuBuilder.registerDef( "buttons", buttons_layout ) +LockTable( _M ) diff --git a/lui/common_menus/playercard.dec.lua b/lui/common_menus/playercard.dec.lua new file mode 100644 index 0000000..b68e0ba --- /dev/null +++ b/lui/common_menus/playercard.dec.lua @@ -0,0 +1,425 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +LUI.Playercard = {} +XP_BAR_WIDTH = 212 +LUI.Playercard.new = function ( f1_arg0, f1_arg1, f1_arg2 ) + local f1_local0 = 130 + local self = LUI.UIElement.new() + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + height = 128, + width = 512, + alpha = 1 + } ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:animateToState( "default" ) + self.card = LUI.UIElement.new() + local f1_local2 = self.card + self:addElement( f1_local2 ) + f1_local2.id = "playercard" .. (f1_arg1.gamertag and "_" .. f1_arg1.gamertag or "") + f1_local2:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -18, + left = -12, + height = 128, + width = 512 + } ) + f1_local2:animateToState( "default" ) + local f1_local3 = LUI.UIImage.new() + f1_local3.id = "mainBG" + f1_local3:registerAnimationState( "default", { + material = RegisterMaterial( "card_bg" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + f1_local3:animateToState( "default" ) + f1_local2:addElement( f1_local3 ) + f1_local2.playerBG = LUI.UIImage.new() + f1_local2.playerBG.id = "playerBG" + f1_local2.playerBG:animateToState( "default" ) + f1_local2:addElement( f1_local2.playerBG ) + f1_local2.playerBGdarken = LUI.UIImage.new() + f1_local2.playerBGdarken.id = "playerBGdarken" + f1_local2.playerBGdarken:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + width = 399, + height = 64, + bottom = -24, + left = 53, + alpha = 0.85 + } ) + f1_local2.playerBGdarken:animateToState( "default" ) + f1_local2.playerBGdarken:setImage( RegisterMaterial( "card_image_darken" ) ) + f1_local2:addElement( f1_local2.playerBGdarken ) + f1_local2.gamertag = LUI.UIMarqueeText.new() + f1_local2.gamertag.id = "gamertag" + f1_local2.gamertag:registerAnimationState( "default", { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f1_local0, + right = -60, + top = 18, + height = CoD.TextSettings.NormalFont.Height + } ) + f1_local2.gamertag:animateToState( "default" ) + f1_local2:addElement( f1_local2.gamertag ) + f1_local2.slogan = LUI.UIMarqueeText.new() + f1_local2.slogan.id = "slogan" + f1_local2.slogan:setTextStyle( CoD.TextStyle.OutlinedMore ) + f1_local2.slogan:registerAnimationState( "default", { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f1_local0, + right = -60, + top = 40, + height = CoD.TextSettings.NormalFont.Height, + red = 1, + green = 1, + blue = 1 + } ) + f1_local2.slogan:animateToState( "default" ) + f1_local2:addElement( f1_local2.slogan ) + f1_local2.clantag = LUI.UIText.new() + f1_local2.clantag.id = "clantag" + f1_local2.clantag.m_textStyle = CoD.TextStyle.OutlinedMore + f1_local2.clantag:registerAnimationState( "default", { + alignment = LUI.Alignment.Left, + font = CoD.TextSettings.NormalFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = f1_local0, + right = -60, + top = 80, + height = CoD.TextSettings.NormalFont.Height, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } ) + f1_local2.clantag:animateToState( "default" ) + f1_local2:addElement( f1_local2.clantag ) + if not (not IsPublicMatch or not IsPublicMatch()) or Engine.IsAliensMode() or f1_arg1.force_show_rank then + f1_local2.rankIcon = LUI.UIImage.new() + f1_local2.rankIcon.id = "rankIcon" + f1_local2:addElement( f1_local2.rankIcon ) + f1_local2.rankNum = LUI.UIText.new() + f1_local2.rankNum.id = "rankNum" + f1_local2.rankNum.m_textStyle = CoD.TextStyle.ShadowedMore + f1_local2.rankNum:registerAnimationState( "default", { + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.BigFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + left = -165, + right = -65, + top = 58, + height = CoD.TextSettings.BigFont.MaxHeight + } ) + f1_local2.rankNum:animateToState( "default" ) + f1_local2:addElement( f1_local2.rankNum ) + end + if f1_arg1.use_level_progress then + LUI.Playercard.AddLevelProgressBar( f1_local2 ) + end + f1_local2.patchShape = LUI.UIImage.new() + f1_local2.patchShape.id = "patchShape" + f1_local2:addElement( f1_local2.patchShape ) + f1_local2.patchEmblem = LUI.UIImage.new() + f1_local2.patchEmblem.id = "patchEmblem" + f1_local2.patchEmblem:animateToState( "default" ) + f1_local2.patchEmblem.scale = f1_arg1.patchScale or 0 + f1_local2:addElement( f1_local2.patchEmblem ) + self.feedContent = LUI.Playercard.FeedContent + self:registerEventHandler( "update_playercard", function ( element, event ) + element:feedContent( event ) + end ) + self:registerEventHandler( "hide_playercard", function ( element, event ) + element:animateToState( "hidden", event.fade or 0 ) + end ) + self:registerEventHandler( "show_playercard", function ( element, event ) + element:animateToState( "default", event.fade or 0 ) + end ) + self:feedContent( f1_arg1 ) + return self +end + +LUI.Playercard.AddLevelProgressBar = function ( f5_arg0 ) + local f5_local0 = 0 + local f5_local1 = 140 + local f5_local2 = -50 + local f5_local3 = 150 + local f5_local4 = CoD.TextSettings.SmallFont.Height + + local levelProgressContainer = LUI.UIElement.new( CoD.CreateState( 45, -22, -58, 0, CoD.AnchorTypes.BottomLeftRight ) ) + levelProgressContainer.id = "playercard_level_bar_container_id" + local f5_local6 = CoD.CreateState( 0, 0, f5_local3, 0, CoD.AnchorTypes.TopBottomLeft ) + CoD.ColorizeState( Colors.black, f5_local6 ) + f5_local6.material = RegisterMaterial( "box_white_gradient_fade_rt" ) + f5_arg0.bgFade = LUI.UIImage.new( f5_local6 ) + levelProgressContainer:addElement( f5_arg0.bgFade ) + f5_local6 = CoD.CreateState( f5_local3, 0, 0, 0, CoD.AnchorTypes.All ) + CoD.ColorizeState( Colors.black, f5_local6 ) + f5_local6.material = RegisterMaterial( "white" ) + f5_arg0.bgFill = LUI.UIImage.new( f5_local6 ) + levelProgressContainer:addElement( f5_arg0.bgFill ) + f5_local6 = CoD.CreateState( f5_local1, 6, f5_local1 + XP_BAR_WIDTH, -6, CoD.AnchorTypes.TopBottomLeft ) + CoD.ColorizeState( Colors.grey_2, f5_local6 ) + f5_arg0.xpBar = LUI.UIImage.new( f5_local6 ) + f5_arg0.xpBar.id = "playercard_level_bar_bg_id" + levelProgressContainer:addElement( f5_arg0.xpBar ) + f5_local6 = CoD.CreateState( 0, 0, 0, 0, CoD.AnchorTypes.TopBottomLeft ) + f5_local6.material = RegisterMaterial( "btn_cas_fill_f" ) + f5_arg0.xpFillBar = LUI.UIImage.new( { + f5_local6 + } ) + f5_arg0.xpFillBar.id = "playercard_level_bar_id" + f5_arg0.xpBar:addElement( f5_arg0.xpFillBar ) + f5_arg0.currentRankIcon = LUI.UIImage.new( CoD.CreateState( f5_local1 - 26, f5_local0, f5_local1 - 6, f5_local0 + f5_local4, CoD.AnchorTypes.TopLeft ) ) + f5_arg0.currentRankIcon.id = "playercard_current_rank_icon_id" + f5_local6 = CoD.CreateState( 0, f5_local0, f5_local1 - 32, f5_local0 + f5_local4, CoD.AnchorTypes.TopLeft ) + f5_local6.font = CoD.TextSettings.SmallFont.Font + f5_local6.alignment = LUI.Alignment.Right + CoD.ColorizeState( Colors.md_grey, f5_local6 ) + f5_arg0.currentRankText = LUI.UIText.new( f5_local6 ) + f5_arg0.currentRankText.id = "playercard_current_rank_id" + f5_arg0.nextRankIcon = LUI.UIImage.new( CoD.CreateState( f5_local2, f5_local0, f5_local2 + 20, f5_local0 + f5_local4, CoD.AnchorTypes.TopRight ) ) + f5_arg0.nextRankIcon.id = "playercard_next_rank_icon_id" + f5_local6 = CoD.CreateState( f5_local2 + 25, f5_local0, 0, f5_local0 + f5_local4, CoD.AnchorTypes.TopRight ) + f5_local6.font = CoD.TextSettings.SmallFont.Font + f5_local6.alignment = LUI.Alignment.Left + CoD.ColorizeState( Colors.md_grey, f5_local6 ) + f5_arg0.nextRankText = LUI.UIText.new( f5_local6 ) + f5_arg0.nextRankText.id = "playercard_next_rank_id" + levelProgressContainer:addElement( f5_arg0.currentRankIcon ) + levelProgressContainer:addElement( f5_arg0.currentRankText ) + levelProgressContainer:addElement( f5_arg0.nextRankIcon ) + levelProgressContainer:addElement( f5_arg0.nextRankText ) + f5_arg0:addElement( levelProgressContainer ) + f5_arg0.levelProgressContainer = levelProgressContainer + +end + +LUI.Playercard.FeedContent = function ( f6_arg0, f6_arg1 ) + local f6_local0 = f6_arg0.card + if f6_arg1.gamertag then + f6_local0.gamertag:setText( f6_arg1.gamertag ) + end + if f6_arg1.clantag then + local f6_local1 = f6_arg1.clantag + if f6_arg1.clantag ~= "" then + if not string.find( f6_arg1.clantag, "[", nil, true ) then + f6_local1 = "[" .. f6_local1 + end + if not string.find( f6_arg1.clantag, "]", nil, true ) then + f6_local1 = f6_local1 .. "]" + end + end + f6_local0.clantag:setText( f6_local1 ) + end + if f6_arg1.background then + local f6_local1 = RegisterMaterial( Cac.Customization.Fields[Cac.Customization.FieldIndexes.Background].GetUIMaterial( f6_arg1.background ) ) + if f6_local1 then + f6_local0.playerBG:setImage( f6_local1 ) + f6_local0.playerBG:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + width = 399, + height = 64, + bottom = -24, + left = 53 + } ) + f6_local0.playerBG:animateToState( "default" ) + end + end + if f6_local0.rankIcon and f6_local0.rankNum and f6_arg1.rank and f6_arg1.prestige then + local f6_local1 = Engine.IsAliensMode() and CoD.PlayMode.Aliens or CoD.PlayMode.Core + local f6_local2 = Rank.GetRankDisplay( f6_arg1.rank, f6_local1 ) + f6_local0.rankNum:setText( f6_local2 ) + local f6_local3 = RegisterMaterial( Rank.GetRankIcon( f6_arg1.rank, f6_arg1.prestige, f6_local1 ) ) + if f6_local3 then + local f6_local4 = f6_arg1.prestige > 0 + local f6_local5 + if f6_local4 then + f6_local5 = 46 + if not f6_local5 then + + else + local f6_local6 + if f6_local4 then + f6_local6 = 61 + if not f6_local6 then + + else + local f6_local7, f6_local8, f6_local9, f6_local10 = GetTextDimensions( f6_local2, CoD.TextSettings.BigFont.Font, CoD.TextSettings.BigFont.MaxHeight ) + local f6_local11 = f6_local9 - f6_local7 + f6_local0.rankIcon:setImage( f6_local3 ) + f6_local0.rankIcon:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = f6_local6, + right = -70 - f6_local11, + width = f6_local5, + height = f6_local5 + } ) + f6_local0.rankIcon:animateToState( "default" ) + end + end + f6_local6 = 63 + end + end + f6_local5 = 40 + end + end + if f6_arg1.patchShape then + local f6_local1 = RegisterMaterial( Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patchbacking].GetUIMaterial( f6_arg1.patchShape ) ) + if f6_local1 then + f6_local0.patchShape:setImage( f6_local1 ) + f6_local0.patchShape:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + width = 128, + height = 128 + } ) + f6_local0.patchShape:animateToState( "default" ) + end + end + if f6_arg1.patchEmblem then + local f6_local1 = RegisterMaterial( Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patch].GetUIMaterial( f6_arg1.patchEmblem ) ) + if f6_local1 then + f6_local0.patchEmblem:setImage( f6_local1 ) + f6_local0.patchEmblem:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + width = 128, + height = 128, + red = 1, + green = 1, + blue = 1, + alpha = 1, + scale = f6_local0.patchEmblem.scale + } ) + f6_local0.patchEmblem:animateToState( "default" ) + end + local f6_local2 = Cac.Customization.Fields[Cac.Customization.FieldIndexes.Patch] + if f6_local2 and f6_local2.GetQuip then + local f6_local3 = f6_local2.GetQuip( f6_arg1.patchEmblem ) + if f6_local3 then + f6_local0.slogan:setText( Engine.Localize( f6_local3 ) ) + end + end + end + if f6_arg1.experience and f6_arg1.prestige and f6_local0.levelProgressContainer then + local f6_local1 = Engine.GetCurrentCoDPlayMode() + local f6_local2 = Rank.GetMaxRank( f6_local1 ) + local f6_local3 = Engine.IsAliensMode() and Lobby.GetAlienRankForXP( f6_arg1.experience ) or Lobby.GetRankForXP( f6_arg1.experience ) + local f6_local4 + if f6_local3 < f6_local2 then + f6_local4 = f6_local3 + 1 + if not f6_local4 then + + else + local f6_local5 = Engine.IsAliensMode() and LUI.mp_menus.Aliens.AlienRanks.MaxPrestige or Lobby.GetMaxPrestigeLevel() + local f6_local6 = Rank.GetRankMaxXP( f6_local2 ) <= f6_arg1.experience + f6_local0.currentRankText:setText( Rank.GetRankDisplay( f6_local3 ) ) + local f6_local7 = RegisterMaterial( Rank.GetRankIcon( f6_local3, f6_arg1.prestige, f6_local1 ) ) + if f6_local7 then + f6_local0.currentRankIcon:setImage( f6_local7 ) + end + local f6_local8 = false + if not Engine.IsAliensMode() and f6_local3 == f6_local4 and not f6_local6 and f6_arg1.prestige < f6_local5 then + f6_local8 = true + end + if Engine.IsAliensMode() and f6_local3 == LUI.mp_menus.Aliens.AlienRanks.MaxLevel and f6_arg1.prestige < f6_local5 then + f6_local8 = true + f6_local4 = 0 + end + f6_local0.nextRankText:setText( Rank.GetRankDisplay( f6_local4, f6_local1 ) ) + local f6_local9 = RegisterMaterial + local f6_local10 = Rank.GetRankIcon + local f6_local11 = f6_local4 + local f6_local12 + if f6_local8 then + f6_local12 = f6_arg1.prestige + 1 + if not f6_local12 then + + else + f6_local7 = f6_local9( f6_local10( f6_local11, f6_local12, f6_local1 ) ) + if f6_local7 then + f6_local0.nextRankIcon:setImage( f6_local7 ) + end + f6_local9 = Rank.GetRankMinXP( f6_local3, f6_local1 ) + f6_local10 = Rank.GetRankMinXP( f6_local4, f6_local1 ) + f6_local11 = Rank.GetRankXPToNext( f6_local3, f6_local1 ) + if f6_local11 == nil or f6_local11 == 0 then + f6_local11 = 1 + end + f6_local12 = math.min( (f6_arg1.experience - f6_local9) / f6_local11, 1 ) + if Engine.IsAliensMode() and f6_local3 == LUI.mp_menus.Aliens.AlienRanks.SuperMaxLevel then + f6_local12 = 1 + end + f6_local0.xpFillBar:registerAnimationState( "default", { + top = 0, + bottom = 0, + left = 0, + right = f6_local12 * XP_BAR_WIDTH, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false + } ) + f6_local0.xpFillBar:animateToState( "default", 0 ) + end + end + f6_local12 = f6_arg1.prestige + end + end + f6_local4 = f6_local3 + end +end + +LUI.MenuBuilder.registerType( "playercard", LUI.Playercard.new ) +LockTable( _M ) diff --git a/lui/common_menus/profilepopup.dec.lua b/lui/common_menus/profilepopup.dec.lua new file mode 100644 index 0000000..fce0d75 --- /dev/null +++ b/lui/common_menus/profilepopup.dec.lua @@ -0,0 +1,122 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function profileMenuOptionsFeeder( f1_arg0 ) + return { + { + type = "UIGenericButton", + id = "offile_profile_create_btn", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@MENU_CREATE_NEW_OFFLINE_PROFILE" ), + button_action_func = function ( f2_arg0, f2_arg1 ) + DebugPrint( "button offile_profile_create_btn press" ) + Engine.Exec( "newOfflineProfile", f2_arg1.controller ) + LUI.FlowManager.RequestLeaveMenu( f2_arg0 ) + end + + } + }, + { + type = "UIGenericButton", + id = "offile_profile_load_btn", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@MENU_LOAD_EXISTING_OFFLINE_PROFILE" ), + button_action_func = function ( f3_arg0, f3_arg1 ) + DebugPrint( "button offile_profile_load_btn press" ) + Engine.Exec( "loadOfflineProfile", f3_arg1.controller ) + LUI.FlowManager.RequestLeaveMenu( f3_arg0 ) + end + + } + }, + { + type = "UIGenericButton", + id = "offile_profile_delete_btn", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "@MENU_DELETE_OFFLINE_PROFILE" ), + button_action_func = function ( f4_arg0, f4_arg1 ) + DebugPrint( "button offile_profile_delete_btn press" ) + Engine.Exec( "deleteOfflineProfile", f4_arg1.controller ) + LUI.FlowManager.RequestLeaveMenu( f4_arg0 ) + end + + } + } + } +end + +function OnCreatePS3ProfileMenu( f5_arg0, f5_arg1 ) + DebugPrint( "On Create PS3 profile menu" ) + Engine.ExecNow( "incnosplitscreencontrol menu_ps3_profile" ) +end + +function OnClosePS3ProfileMenu( f6_arg0, f6_arg1 ) + DebugPrint( "On Close PS3 profile menu" ) + Engine.ExecNow( "decnosplitscreencontrol menu_ps3_profile" ) + local f6_local0 = Engine.GetLuiRoot() + if f6_local0:IsMenuOpenAndVisible( "menu_splitscreensignin" ) and not f6_local0:IsMenuOpenAndVisible( "menu_resetstats_warning" ) and not f6_local0:IsMenuOpenAndVisible( "menu_ps3_savegame_warning" ) then + Engine.Exec( "startsplitscreensignin" ) + end +end + +function menu_ps3_profile() + return { + type = "generic_selectionList_popup", + id = "offline_profile_management_popup", + properties = { + popup_title = Engine.Localize( "@MENU_LOAD_OFFLINE_PROFILE" ), + popup_childfeeder = profileMenuOptionsFeeder + }, + handlers = { + menu_create = OnCreatePS3ProfileMenu, + menu_close = OnClosePS3ProfileMenu + } + } +end + +function SaveErrorContinue( f8_arg0, f8_arg1 ) + DebugPrint( "Save Error Continue" ) + if Engine.GetDvarBool( "splitscreen" ) then + Engine.Exec( "endsplitscreensignin" ) + LUI.FlowManager.RequestAddMenu( f8_arg0, "menu_gamesetup_splitscreen", false, f8_arg1.controller, false, {} ) + else + assert( f8_arg0.properties.callback_params.continue_to_menu ) + LUI.FlowManager.RequestOldMenu( f8_arg0, f8_arg0.properties.callback_params.continue_to_menu, false ) + end +end + +function SaveErrorReturn( f9_arg0, f9_arg1 ) + DebugPrint( "Save Error Cancel" ) + if Engine.GetDvarBool( "splitscreen" ) then + Engine.Exec( "startsplitscreensignin" ) + end +end + +function GetSomeText() + return "my cool text" +end + +function menu_ps3_savegame_error() + return { + type = "generic_yesno_popup", + properties = { + message_text = Engine.UserWithoutOfflineProfile(), + popup_title = Engine.Localize( "@MENU_SAVE_ERROR_MP" ), + yes_text = Engine.Localize( "@MENU_RESUMEGAME_NOSAVE_MP" ), + no_text = Engine.Localize( "@MENU_RETURN_SIGNIN_MP" ), + yes_action = SaveErrorContinue, + no_action = SaveErrorReturn + } + } +end + +LUI.MenuBuilder.registerDef( "menu_ps3_profile", menu_ps3_profile ) +LUI.MenuBuilder.registerDef( "menu_ps3_savegame_error", menu_ps3_savegame_error ) +LockTable( _M ) diff --git a/lui/common_menus/rankutils.dec.lua b/lui/common_menus/rankutils.dec.lua new file mode 100644 index 0000000..f50174d --- /dev/null +++ b/lui/common_menus/rankutils.dec.lua @@ -0,0 +1,123 @@ +Rank = {} +RankTable = { + File = "mp/rankTable.csv", + AlienFile = "mp/alien/rankTable.csv", + Cols = { + RankId = 0, + Rank = 1, + MinXp = 2, + XpToNextLevel = 3, + ShortRankName = 4, + FullRankName = 5, + RankIcon = 6, + MaxXp = 7, + Level = 13, + DisplayLevel = 14, + InGameRank = 16, + UnlockString = 17 + } +} +RankIconTable = { + File = "mp/rankIconTable.csv", + AlienFile = "mp/alien/rankIconTable.csv", + Cols = { + RankId = 0, + Standard = 1, + Prestige1 = 2 + } +} +Rank.GetMaxRank = function ( f1_arg0 ) + local f1_local0 = nil + if not f1_arg0 or f1_arg0 == CoD.PlayMode.Core or f1_arg0 == CoD.PlayMode.SquadVsSquad then + f1_local0 = tonumber( Engine.TableLookup( RankTable.File, 0, "maxrank", 1 ) ) + assert( f1_local0 ~= nil, "Rank.GetMaxRank() : Could not read max rank (MP)" ) + elseif f1_arg0 == CoD.PlayMode.Aliens then + f1_local0 = tonumber( Engine.TableLookup( RankTable.AlienFile, 0, "maxrank", 1 ) ) + assert( f1_local0 ~= nil, "Rank.GetMaxRank() : Could not read max rank (ALIENS)" ) + else + DebugPrint( "[WARNING] Rank.GetMaxRank() : Unsupported CodPlayMode [" .. f1_arg0 .. "]!" ) + f1_local0 = 0 + end + return f1_local0 +end + +Rank.GetRankDisplay = function ( f2_arg0, f2_arg1 ) + local f2_local0 = nil + if not f2_arg1 or f2_arg1 == CoD.PlayMode.Core or f2_arg1 == CoD.PlayMode.SquadVsSquad then + f2_local0 = Engine.TableLookup( RankTable.File, RankTable.Cols.RankId, f2_arg0, RankTable.Cols.DisplayLevel ) + elseif f2_arg1 == CoD.PlayMode.Aliens then + f2_local0 = Engine.TableLookup( RankTable.AlienFile, RankTable.Cols.RankId, f2_arg0, RankTable.Cols.DisplayLevel ) + else + DebugPrint( "[WARNING] Rank.GetRankDisplay() : Unsupported CodPlayMode [" .. f2_arg1 .. "]!" ) + f2_local0 = "" + end + return f2_local0 +end + +Rank.GetRankMinXP = function ( f3_arg0, f3_arg1 ) + local f3_local0 = nil + if not f3_arg1 or f3_arg1 == CoD.PlayMode.Core or f3_arg1 == CoD.PlayMode.SquadVsSquad then + f3_local0 = tonumber( Engine.TableLookup( RankTable.File, RankTable.Cols.RankId, f3_arg0, RankTable.Cols.MinXp ) ) + elseif f3_arg1 == CoD.PlayMode.Aliens then + f3_local0 = tonumber( Engine.TableLookup( RankTable.AlienFile, RankTable.Cols.RankId, f3_arg0, RankTable.Cols.MinXp ) ) + else + DebugPrint( "[WARNING] Rank.GetRankMinXP() : Unsupported CodPlayMode [" .. f3_arg1 .. "]!" ) + f3_local0 = 0 + end + return f3_local0 +end + +Rank.GetRankMaxXP = function ( f4_arg0, f4_arg1 ) + local f4_local0 = nil + if not f4_arg1 or f4_arg1 == CoD.PlayMode.Core or f4_arg1 == CoD.PlayMode.SquadVsSquad then + f4_local0 = tonumber( Engine.TableLookup( RankTable.File, RankTable.Cols.RankId, f4_arg0, RankTable.Cols.MaxXp ) ) + assert( f4_local0 ~= nil, "Rank.GetRankMaxXP() : Could not read max XP for rank (MP)" ) + elseif f4_arg1 == CoD.PlayMode.Aliens then + f4_local0 = tonumber( Engine.TableLookup( RankTable.AlienFile, RankTable.Cols.RankId, f4_arg0, RankTable.Cols.MaxXp ) ) + assert( f4_local0 ~= nil, "Rank.GetRankMaxXP() : Could not read max XP for rank (ALIENS)" ) + else + DebugPrint( "[WARNING] Rank.GetRankMaxXP() : Unsupported CodPlayMode [" .. f4_arg1 .. "]!" ) + f4_local0 = 0 + end + return f4_local0 +end + +Rank.GetRankXPToNext = function ( f5_arg0, f5_arg1 ) + local f5_local0 = nil + if not f5_arg1 or f5_arg1 == CoD.PlayMode.Core or f5_arg1 == CoD.PlayMode.SquadVsSquad then + f5_local0 = tonumber( Engine.TableLookup( RankTable.File, RankTable.Cols.RankId, f5_arg0, RankTable.Cols.XpToNextLevel ) ) + elseif f5_arg1 == CoD.PlayMode.Aliens then + f5_local0 = tonumber( Engine.TableLookup( RankTable.AlienFile, RankTable.Cols.RankId, f5_arg0, RankTable.Cols.XpToNextLevel ) ) + else + DebugPrint( "[WARNING] Rank.GetRankXPToNext() : Unsupported CodPlayMode [" .. f5_arg1 .. "]!" ) + f5_local0 = 0 + end + return f5_local0 +end + +Rank.GetRankIcon = function ( f6_arg0, f6_arg1, f6_arg2 ) + local f6_local0 = nil + if not f6_arg2 or f6_arg2 == CoD.PlayMode.Core or f6_arg2 == CoD.PlayMode.SquadVsSquad then + f6_local0 = Engine.TableLookup( RankIconTable.File, RankIconTable.Cols.RankId, f6_arg0, RankIconTable.Cols.Standard + f6_arg1 ) + elseif f6_arg2 == CoD.PlayMode.Aliens then + f6_local0 = Engine.TableLookup( RankIconTable.AlienFile, RankIconTable.Cols.RankId, f6_arg0, RankIconTable.Cols.Standard + f6_arg1 ) + else + DebugPrint( "[WARNING] Rank.GetRankIcon() : Unsupported CodPlayMode [" .. f6_arg2 .. "]!" ) + f6_local0 = "" + end + return f6_local0 +end + +Rank.GetFullRank = function ( f7_arg0, f7_arg1 ) + local f7_local0 = nil + if not f7_arg1 or f7_arg1 == CoD.PlayMode.Core or f7_arg1 == CoD.PlayMode.SquadVsSquad then + f7_local0 = Engine.Localize( "@" .. Engine.TableLookup( RankTable.File, RankTable.Cols.RankId, f7_arg0, RankTable.Cols.FullRankName ) ) + elseif f7_arg1 == CoD.PlayMode.Aliens then + f7_local0 = Engine.Localize( "@" .. Engine.TableLookup( RankTable.AlienFile, RankTable.Cols.RankId, f7_arg0, RankTable.Cols.FullRankName ) ) + else + DebugPrint( "[WARNING] Rank.GetFullRank() : Unsupported CodPlayMode [" .. f7_arg1 .. "]!" ) + f7_local0 = "" + end + return f7_local0 +end + diff --git a/lui/common_menus/virtualkeyboard.dec.lua b/lui/common_menus/virtualkeyboard.dec.lua new file mode 100644 index 0000000..260b8c3 --- /dev/null +++ b/lui/common_menus/virtualkeyboard.dec.lua @@ -0,0 +1,129 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function ExitVirtualKeyboard( f1_arg0, f1_arg1, f1_arg2 ) + local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) + if f1_local0.exiting then + return + end + f1_local0.exiting = true + f1_arg0:dispatchEventToRoot( { + name = "exit_virtual_keyboard", + immediate = true + } ) + if Engine.TriggerVirtualKeyboardCallback then + local f1_local1 = Engine.TriggerVirtualKeyboardCallback + local f1_local2 = f1_arg1.controller + local f1_local3 = f1_arg2 + local f1_local4 + if not f1_arg2 then + f1_local4 = f1_local0.input + if not f1_local4 then + + else + f1_local1( f1_local2, f1_local3, f1_local4, f1_local0.verifyString or false ) + end + end + f1_local4 = "" + end +end + +function input_popup( f2_arg0, f2_arg1 ) + local f2_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "virtual_keyboard" ) + local f2_local1 = f2_arg1.keyboardType + if not f2_local1 then + f2_local1 = CoD.KeyboardInputTypes.Normal + end + local f2_local2 + if f2_local1 == CoD.KeyboardInputTypes.Email then + f2_local2 = 1000 + if not f2_local2 then + + else + local f2_local3 = f2_local1 == CoD.KeyboardInputTypes.Password + local f2_local4 = f2_arg1.use_auto_align or false + local f2_local5 = LUI.MenuGenerics.generic_selectionList_popup( {}, { + popup_title = f2_arg1.title, + popup_width = f2_local2, + popup_childfeeder = function () + return { + { + type = "generic_input_field", + id = "not_so_virtual_input", + requireFocusType = FocusType.MouseOver, + properties = { + keyboard_type = f2_local1, + password_field = f2_local3, + use_auto_align = f2_local4, + max_length = f2_local0.maxLength, + help_value = f2_local0.input, + field_edited_func = function ( f4_arg0, f4_arg1 ) + local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f4_arg0 ) + f4_local0.input = f4_arg1.text or "" + if f4_local0.exiting then + return + else + f4_arg1.controller = f4_local0.exclusiveController + ExitVirtualKeyboard( f4_arg0, f4_arg1, f4_arg1.cancelled ) + LUI.FlowManager.RequestLeaveMenu( f4_arg0 ) + end + end + , + additional_handlers = { + menu_create = MBh.EmitEvent( { + name = "button_action", + mouse = true + } ), + exit_virtual_keyboard = function ( f5_arg0, f5_arg1 ) + f5_arg0:processEvent( { + name = "finish_editing" + } ) + end + + } + } + }, + { + type = "UIGenericButton", + id = "input_ok", + audio = { + button_over = CoD.SFX.SubMenuMouseOver + }, + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = Engine.Localize( "MENU_OK" ), + button_action_func = function ( f6_arg0, f6_arg1 ) + ExitVirtualKeyboard( f6_arg0, f6_arg1, false ) + LUI.FlowManager.RequestLeaveMenu( f6_arg0 ) + end + + } + } + } + end + } ) + f2_local5:registerEventHandler( "popup_back", function ( element, event ) + ExitVirtualKeyboard( element, event, true ) + end ) + f2_local5:dispatchEventToRoot( { + name = "virtual_keyboard_popup_active", + immediate = true + } ) + return f2_local5 + end + end + f2_local2 = nil +end + +function virtual_keyboard( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "virtual_keyboard" ) + f8_local0.input = f8_arg1.defaultText or "" + f8_local0.maxLength = f8_arg1.maxLength or 12 + f8_local0.verifyString = f8_arg1.verifyString or false + return input_popup( f8_arg0, f8_arg1 ) +end + +LUI.MenuBuilder.registerType( "virtual_keyboard", virtual_keyboard ) +LockTable( _M ) diff --git a/lui/common_menus/whatcanisay.dec.lua b/lui/common_menus/whatcanisay.dec.lua new file mode 100644 index 0000000..59a949d --- /dev/null +++ b/lui/common_menus/whatcanisay.dec.lua @@ -0,0 +1,372 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + Kinect.CloseWhatCanISayMenu( f1_arg0, f1_arg1 ) +end + +function TitleFactory( f2_arg0, f2_arg1 ) + return { + type = "UIText", + id = "text_whatcanisay_" .. tostring( f2_arg0 ), + properties = { + text = Engine.Localize( f2_arg1 ) + }, + states = { + default = { + height = CoD.TextSettings.ExtraBigFont.Height, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Left, + width = 600, + r = 1, + g = 1, + b = 1 + } + } + } +end + +function BlankFactory( f3_arg0 ) + return { + type = "UIText", + id = "text_whatcanisay_" .. tostring( f3_arg0 ), + properties = { + text = "" + }, + states = { + default = { + height = 20, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Left, + width = 600, + r = 1, + g = 1, + b = 1 + } + } + } +end + +function TextFactory( f4_arg0, f4_arg1, f4_arg2 ) + local f4_local0 + if f4_arg2 then + f4_local0 = 200 + if not f4_local0 then + + else + return { + type = "UIText", + id = "text_whatcanisay_" .. tostring( f4_arg0 ), + properties = { + text = Engine.Localize( f4_arg1 ) + }, + states = { + default = { + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + width = f4_local0 + } + } + } + end + end + f4_local0 = 370 +end + +function BigTextFactory( f5_arg0, f5_arg1 ) + return { + type = "UIText", + id = "text_whatcanisay_" .. tostring( f5_arg0 ), + properties = { + text = Engine.Localize( f5_arg1 ) + }, + states = { + default = { + height = CoD.TextSettings.BigFont.Height, + font = CoD.TextSettings.BigFont.Font, + alignment = LUI.Alignment.Left, + width = 600 + } + } + } +end + +function DescFactory( f6_arg0, f6_arg1 ) + return { + type = "UIText", + id = "text_whatcanisay_" .. tostring( f6_arg0 ), + properties = { + text = Engine.Localize( f6_arg1 ) + }, + states = { + default = { + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + width = 600, + red = 0.75, + green = 0.75, + blue = 0.75 + } + } + } +end + +function GrammarFeeder( f7_arg0 ) + local f7_local0 = {} + if Engine.InFrontend() then + local f7_local1 = false + if Kinect.menu_under_what_can_i_say then + if string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "main_lockout" ) then + f7_local1 = true + elseif string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "boot_brightness" ) then + f7_local1 = true + elseif string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "boot_screen_margins" ) then + f7_local1 = true + elseif string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "no_profile_warning_popmenu" ) then + f7_local1 = true + end + end + if f7_local1 == true then + + elseif Kinect.IsKinectGuideUp() then + f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_SAY_GHOSTS_AND_ONE_OF_THE_FOLLOWING" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_KINECT_GUIDE_COMMANDS_CAPS" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_SHORTCUT_1_TO_9", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_SHORTCUT_1_TO_9_COMMAND" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_CANCEL_BACK", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_CANCEL_BACK_COMMAND" ) + else + f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_SAY_GHOSTS_AND_ONE_OF_THE_FOLLOWING" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_GENERAL_COMMANDS_CAPS" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_SHORTCUTS_1", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_SHORTCUTS_COMMAND" ) + local f7_local2 = false + if Kinect.menu_under_what_can_i_say then + if string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "menu_xboxlive_lobby" ) then + f7_local2 = true + elseif string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "menu_xboxlive_privatelobby" ) then + f7_local2 = true + elseif string.lower( Kinect.menu_under_what_can_i_say ) == string.lower( "menu_xboxlive" ) then + f7_local2 = true + end + end + if f7_local2 == true then + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_LOBBY_COMMANDS_CAPS" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + if Kinect.DISABLE_CERTAIN_LOBBY_MUTE_AND_COMPARE_OPERATIONS == true then + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_MUTE_ALL_UNMUTE_ALL", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_MUTE_ALL_UNMUTE_ALL_COMMAND" ) + else + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_MUTE_UNMUTE", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_MUTE_UNMUTE_COMMAND" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_MUTE_ALL_UNMUTE_ALL", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_MUTE_ALL_UNMUTE_ALL_COMMAND" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_MUTE_NON_FRIENDS", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_MUTE_NON_FRIENDS_COMMAND" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_MUTE_NON_PARTY", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_MUTE_NON_PARTY_COMMAND" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_COMPARE", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_COMPARE_COMMAND" ) + end + end + end + elseif not Engine.IsMultiplayer() then + f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_GENERAL_COMMANDS_CAPS" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_GHOST_PAUSE_GHOST_PLAY", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_PAUSE_PLAY_COMMAND" ) + local f7_local1 = Engine.GetDvarString( "mapname" ) + if f7_local1 == "enemyhq" or f7_local1 == "nml" then + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_ATTACK_1", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_ATTACK_COMMAND" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_CANCEL_1", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_CANCEL_COMMAND" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_BARK_1", true ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_BARK_COMMAND" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TitleFactory( #f7_local0, "@SPEECH_SPECIFIC_COMMMAND_CAPS" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = DescFactory( #f7_local0, "@SPEECH_LOCATION_COMMAND" ) + f7_local0[#f7_local0 + 1] = BlankFactory( #f7_local0 ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_DOOR" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_WINDOW" ) + if f7_local1 == "enemyhq" then + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_COUNTER" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_STAIRS" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_STATUE" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_WALKWAY" ) + elseif f7_local1 == "nml" then + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_BALCONY" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_BRIDGE" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_BUILDING" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_CAR" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_GARAGE" ) + f7_local0[#f7_local0 + 1] = TextFactory( #f7_local0, "@SPEECH_TRAILER" ) + end + end + end + if #f7_local0 == 0 then + if Engine.InFrontend() then + f7_local0[#f7_local0 + 1] = BigTextFactory( #f7_local0, "@SPEECH_NO_VOICE_COMMANDS_FRONT_END" ) + else + f7_local0[#f7_local0 + 1] = BigTextFactory( #f7_local0, "@SPEECH_NO_VOICE_COMMANDS_IN_GAME" ) + end + end + return f7_local0 +end + +function OptionsMainCreate( f8_arg0, f8_arg1 ) + f8_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function what_can_i_say_vlist() + return { + type = "UIGrid", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 120, + right = -120, + top = 110, + bottom = -60 + } + }, + properties = { + elementsPerRow = 2, + hSpacing = 10, + rowHeight = 33, + hAlign = LUI.Alignment.Left, + vAlign = LUI.Alignment.Top + }, + childrenFeeder = GrammarFeeder + } +end + +function WhatCanISayHandleSpeechActionBack( f10_arg0, f10_arg1, f10_arg2 ) + if Kinect.IsWhatCanISayMenuUp() then + f0_local0( f10_arg0, f10_arg1 ) + LUI.Speech.PerformingSpeechAction() + end +end + +if Engine.HasSpeechFeature() then + WhatCanISaySpeechGrammarHandlersArray = { + { + action = "back", + confidence = LUI.Speech.defaultConfidence, + handler = WhatCanISayHandleSpeechActionBack, + extradata = nil + }, + { + action = "cancel", + confidence = LUI.Speech.defaultConfidence, + handler = WhatCanISayHandleSpeechActionBack, + extradata = nil + } + } +else + WhatCanISaySpeechGrammarHandlersArray = {} +end +function WhatCanISayHandleSpeechAction( f11_arg0, f11_arg1 ) + if Engine.HasSpeechFeature() then + LUI.Speech.ProcessActionEvent( f11_arg0, f11_arg1, WhatCanISaySpeechGrammarHandlersArray ) + end +end + +function what_can_i_say() + return { + type = "UIElement", + id = "what_can_i_say_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + speech_action = WhatCanISayHandleSpeechAction + }, + children = { + { + type = "UIWorldBlur", + id = "world_blur_id", + states = { + default = { + worldBlur = 5 + } + } + }, + { + type = "UIImage", + id = "options_background", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0.95, + material = RegisterMaterial( "black" ) + } + } + }, + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@SPEECH_WHATCANISAY_CAPS" ) + } + }, + { + type = "what_can_i_say_vlist", + id = "what_can_i_say_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_start = f0_local0, + button_select = f0_local0, + button_secondary = f0_local0 + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "what_can_i_say_vlist", what_can_i_say_vlist ) +LUI.MenuBuilder.registerDef( "what_can_i_say", what_can_i_say ) +LockTable( _M ) diff --git a/lui/default.dec.lua b/lui/default.dec.lua new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/lui/default.dec.lua @@ -0,0 +1 @@ + diff --git a/lui/eventcatcher.dec.lua b/lui/eventcatcher.dec.lua new file mode 100644 index 0000000..5b5640b --- /dev/null +++ b/lui/eventcatcher.dec.lua @@ -0,0 +1,124 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +require( "LUI.CoD" ) +f0_local0 = hashset( { + "keybind", + "action_slot_pressed", + "game_message", + "hide_host_migration", + "obituary", + "show_host_migration_triggered", + "toggle_pause", + "weapon_change", + "show_hud_menu", + "hide_hud_menu", + "playerstate_client_changed", + "close_rival_info", + "open_rival_info", + "camera_client_changed", + "refresh_options_button", + "update_mlg_prev_next", + "spectate_team_change" +} ) +function isDirectDispatchEventType( f1_arg0 ) + return f0_local0[f1_arg0] +end + +function new() + local f2_local0 = {} + setmetatable( f2_local0, { + __index = _M + } ) + f2_local0.direct_dispatch = {} + f2_local0.omnvar_update = {} + f2_local0.dvar_update = {} + return f2_local0 +end + +function setupRoot( f3_arg0, f3_arg1 ) + f3_arg1:registerEventHandler( "omnvar_update", omnvarUpdateDispatcher ) + f3_arg1:registerEventHandler( "dvar_update", dvarUpdateDispatcher ) + for f3_local3, f3_local4 in pairs( f0_local0 ) do + f3_arg1:registerEventHandler( f3_local3, directDispatcher ) + end +end + +function registerOmnvarHandler( f4_arg0, f4_arg1, f4_arg2, f4_arg3 ) + assert( type( f4_arg1 ) == "userdata" ) + assert( type( f4_arg2 ) == "string" ) + assert( type( f4_arg3 ) == "function" ) + local f4_local0 = f4_arg0.omnvar_update + local f4_local1 = f4_arg0.omnvar_update[f4_arg2] + if not f4_local1 then + f4_local1 = setmetatable( {}, { + __mode = "k" + } ) + end + f4_local0[f4_arg2] = f4_local1 + f4_arg0.omnvar_update[f4_arg2][f4_arg1] = f4_arg3 +end + +function omnvarUpdateDispatcher( f5_arg0, f5_arg1 ) + local f5_local0 = f5_arg0.eventCatcher.omnvar_update[f5_arg1.omnvar] + if f5_local0 then + for f5_local4, f5_local5 in pairs( f5_local0 ) do + if not f5_local4:isClosed() then + f5_local5( f5_local4, f5_arg1 ) + end + end + end +end + +function registerDvarHandler( f6_arg0, f6_arg1, f6_arg2, f6_arg3 ) + assert( type( f6_arg1 ) == "userdata" ) + assert( type( f6_arg2 ) == "string" ) + assert( type( f6_arg3 ) == "function" ) + if not f6_arg0.dvar_update[f6_arg2] then + assert( Engine.WatchDvar( f6_arg2 ), "failed to watch dvar" ) + f6_arg0.dvar_update[f6_arg2] = setmetatable( {}, { + __mode = "k" + } ) + end + f6_arg0.dvar_update[f6_arg2][f6_arg1] = f6_arg3 +end + +function dvarUpdateDispatcher( f7_arg0, f7_arg1 ) + local f7_local0 = f7_arg0.eventCatcher.dvar_update[f7_arg1.dvar] + if f7_local0 then + for f7_local4, f7_local5 in pairs( f7_local0 ) do + if not f7_local4:isClosed() then + f7_local5( f7_local4, f7_arg1 ) + end + end + end +end + +function registerDirectDispatchHandler( f8_arg0, f8_arg1, f8_arg2, f8_arg3 ) + assert( type( f8_arg1 ) == "userdata" ) + assert( type( f8_arg2 ) == "string" ) + assert( type( f8_arg3 ) == "function" ) + local f8_local0 = f8_arg0.direct_dispatch + local f8_local1 = f8_arg0.direct_dispatch[f8_arg2] + if not f8_local1 then + f8_local1 = setmetatable( {}, { + __mode = "k" + } ) + end + f8_local0[f8_arg2] = f8_local1 + f8_arg0.direct_dispatch[f8_arg2][f8_arg1] = f8_arg3 +end + +function directDispatcher( f9_arg0, f9_arg1 ) + local f9_local0 = f9_arg0.eventCatcher.direct_dispatch[f9_arg1.name] + if f9_local0 then + for f9_local4, f9_local5 in pairs( f9_local0 ) do + if not f9_local4:isClosed() then + assert( f9_local4.m_eventHandlers[f9_arg1.name] == f9_local5 ) + f9_local5( f9_local4, f9_arg1 ) + end + end + end +end + +LockTable( _M ) diff --git a/lui/flowmanager.dec.lua b/lui/flowmanager.dec.lua new file mode 100644 index 0000000..737a423 --- /dev/null +++ b/lui/flowmanager.dec.lua @@ -0,0 +1,1068 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +LUI.FlowManager.modal_priority = 500 +PushAndPopsTable = {} +function new() + local f1_local0 = {} + setmetatable( f1_local0, { + __index = _M + } ) + f1_local0.menuInfoStack = {} + f1_local0.debug = true + f1_local0.flowEvents = {} + f1_local0.menuInfoData = {} + f1_local0.antiSpam = { + lastOpenedMenu = 0, + countOpenedMenusRecently = 0, + openMenuDelay = 0 + } + setmetatable( f1_local0.menuInfoData, { + __mode = "k" + } ) + return f1_local0 +end + +function RegisterStackPushBehaviour( f2_arg0, f2_arg1 ) + PushAndPopsTable[f2_arg0] = PushAndPopsTable[f2_arg0] or {} + PushAndPopsTable[f2_arg0].pushFunc = f2_arg1 or PushAndPopsTable[f2_arg0].pushFunc +end + +function RegisterStackPopBehaviour( f3_arg0, f3_arg1 ) + PushAndPopsTable[f3_arg0] = PushAndPopsTable[f3_arg0] or {} + PushAndPopsTable[f3_arg0].popFunc = f3_arg1 or PushAndPopsTable[f3_arg0].popFunc +end + +function ResetAntiSpam( f4_arg0 ) + f4_arg0.antiSpam = { + lastOpenedMenu = 0, + countOpenedMenusRecently = 0, + openMenuDelay = 0 + } +end + +function ShouldDelayAgainstSpam( f5_arg0 ) + if Engine.InFrontend() or not Engine.IsMultiplayer() then + return false + end + local f5_local0 = f5_arg0.flowManager.antiSpam + local f5_local1 = Engine.GetMilliseconds() + if f5_local1 - f5_local0.lastOpenedMenu > 1000 then + f5_local0.countOpenedMenusRecently = 0 + f5_local0.openMenuDelay = 0 + elseif f5_local0.countOpenedMenusRecently <= 3 then + f5_local0.openMenuDelay = 200 + else + f5_local0.openMenuDelay = 750 + end + return f5_local1 - f5_local0.lastOpenedMenu < f5_local0.openMenuDelay +end + +function tryAddMouseCursor( f6_arg0 ) + if Engine.UsesMouseCursor() and not f6_arg0:getChildById( "mouse_cursor" ) then + f6_arg0:addElement( LUI.UIMouseCursor.new( { + material = RegisterMaterial( "ui_cursor" ) + } ) ) + end +end + +function GetMenuBuildProps( f7_arg0, f7_arg1 ) + local f7_local0 = {} + if f7_arg0.menuInfoData[f7_arg1] and f7_arg0.menuInfoData[f7_arg1].buildData then + f7_local0 = f7_arg0.menuInfoData[f7_arg1].buildData + end + f7_local0.exclusiveController = f7_arg1.exclusiveControllerIndex + return f7_local0 +end + +function SetMenuBuildProps( f8_arg0, f8_arg1, f8_arg2 ) + f8_arg0.menuInfoData[f8_arg1] = f8_arg0.menuInfoData[f8_arg1] or {} + f8_arg0.menuInfoData[f8_arg1].buildData = f8_arg2 +end + +function GetMenuScopedData( f9_arg0, f9_arg1 ) + if not f9_arg0.menuInfoData[f9_arg1] then + f9_arg0.menuInfoData[f9_arg1] = {} + end + if not f9_arg0.menuInfoData[f9_arg1].scopedData then + f9_arg0.menuInfoData[f9_arg1].scopedData = {} + end + return f9_arg0.menuInfoData[f9_arg1].scopedData +end + +function GetMenuScopedDataFromElement( f10_arg0 ) + if f10_arg0._scoped then + return f10_arg0._scoped + else + local f10_local0 = f10_arg0:getParent() + if f10_local0 then + return GetMenuScopedDataFromElement( f10_local0 ) + else + DebugPrint( "WARNING: could not find scoped data for supplied menu element. This is expected if you've just hit LUI Reload, otherwise not so much." ) + return {} + end + end +end + +function GetMenuScopedDataByMenuName( f11_arg0 ) + local f11_local0 = Engine.GetLuiRoot() + f11_local0 = f11_local0.flowManager + for f11_local1 = #f11_local0.menuInfoStack, 1, -1 do + local f11_local4 = f11_local0.menuInfoStack[f11_local1] + if f11_local4.name == f11_arg0 then + return f11_local0:GetMenuScopedData( f11_local4 ) + end + end + if f11_arg0 then + DebugPrint( "WARNING: could not find scoped data for menu named " .. f11_arg0 .. ". This is expected if you've just hit LUI Reload, otherwise not so much." ) + end + return {} +end + +function IsTopSignInMenu( f12_arg0 ) + local f12_local0 = false + if not LUI.UIRoot.IsButtonInputBlocked( f12_arg0 ) then + local f12_local1 = f12_arg0.flowManager + if f12_local1.menuInfoStack then + local f12_local2 = f12_local1.menuInfoStack[#f12_local1.menuInfoStack] + if f12_local2 and f12_local2.menu and f12_local2.menu.isSignInMenu then + local f12_local3 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_local2.menu ) + if f12_local3 and f12_local3.focusedPage and f12_local3.focusedPage > 2 then + + else + f12_local0 = true + end + end + end + end + return f12_local0 +end + +function PushMenuInfo( f13_arg0, f13_arg1, f13_arg2 ) + if f13_arg1.isModal or #f13_arg0.menuInfoStack == 0 then + table.insert( f13_arg0.menuInfoStack, f13_arg1 ) + else + local f13_local0 = #f13_arg0.menuInfoStack + 1 + while f13_local0 > 1 and f13_arg0.menuInfoStack[f13_local0 - 1].isModal do + f13_local0 = f13_local0 - 1 + end + if f13_arg2 then + f13_local0 = math.max( 1, f13_local0 - 1 ) + end + table.insert( f13_arg0.menuInfoStack, f13_local0, f13_arg1 ) + end + if Engine.InFrontend() and #f13_arg0.menuInfoStack == 1 then + PersistentBackground.Init() + end + if PushAndPopsTable[f13_arg1.name] and PushAndPopsTable[f13_arg1.name].pushFunc then + PushAndPopsTable[f13_arg1.name].pushFunc() + end + if f13_arg0.debug then + f13_arg0:printStack() + end +end + +function PopMenuInfo( f14_arg0, f14_arg1 ) + local f14_local0 = nil + local f14_local1 = #f14_arg0.menuInfoStack + while f14_local1 >= 1 and (not (f14_arg1 or not f14_arg0.menuInfoStack[f14_local1].isModal) or f14_arg1 and f14_arg0.menuInfoStack[f14_local1] ~= f14_arg1) do + f14_local1 = f14_local1 - 1 + end + if f14_local1 >= 1 then + f14_local0 = f14_arg0.menuInfoStack[f14_local1] + if f14_local0 then + if PushAndPopsTable[f14_local0.name] and PushAndPopsTable[f14_local0.name].popFunc then + PushAndPopsTable[f14_local0.name].popFunc() + end + table.remove( f14_arg0.menuInfoStack, f14_local1 ) + end + end + if f14_local0 and #f14_arg0.menuInfoStack == 0 then + local f14_local2 = Engine.GetLuiRoot() + f14_local2:processEvent( { + name = "empty_menu_stack" + } ) + if Engine.IsAliensMode() then + ResetAntiSpam( f14_arg0 ) + else + f14_arg0.antiSpam.lastOpenedMenu = Engine.GetMilliseconds() + end + end + if f14_arg0.debug then + f14_arg0:printStack() + end + return f14_local0 +end + +function GetTopMenuInfo( f15_arg0 ) + local f15_local0 = nil + local f15_local1 = #f15_arg0 + while 1 <= f15_local1 and f15_arg0[f15_local1].isModal do + f15_local1 = f15_local1 - 1 + end + if 1 <= f15_local1 then + f15_local0 = f15_arg0[f15_local1] + end + return f15_local0 +end + +f0_local0 = function ( f16_arg0 ) + local f16_local0 = false + local f16_local1 = f16_arg0[#f16_arg0] + if f16_local1 and f16_local1.isModal then + f16_local0 = true + end + return f16_local0 +end + +function IsTopMenuModal() + local f17_local0 = Engine.GetLuiRoot() + if not f17_local0 then + return false + else + return f0_local0( f17_local0.flowManager.menuInfoStack ) + end +end + +function IsElementAChildOf( f18_arg0, f18_arg1 ) + if not f18_arg0 or not f18_arg1 then + return false + end + while f18_arg0 do + if f18_arg0 == f18_arg1 then + return true + end + f18_arg0 = f18_arg0:getParent() + end + return false +end + +function CloseMenuInfo( f19_arg0, f19_arg1, f19_arg2 ) + if f19_arg1.menu then + if not f19_arg2 then + f19_arg1.menu:processEvent( { + name = "lose_focus" + } ) + f19_arg1.menu:processEvent( { + name = "menu_close", + dispatchChildren = true, + controller = f19_arg1.exclusiveControllerIndex + } ) + end + f19_arg1.menu:clearSavedState() + f19_arg1.menu:closeTree() + f19_arg1.menu:close() + f19_arg1.menu = nil + end +end + +function RestoreMenuInfo( f20_arg0, f20_arg1, f20_arg2, f20_arg3 ) + local f20_local0 = false + if not f20_arg1.menu then + LUI.ActiveScoped = f20_arg0:GetMenuScopedData( f20_arg1 ) + f20_arg1.menu = LUI.MenuBuilder.buildMenu( f20_arg1.name, f20_arg0:GetMenuBuildProps( f20_arg1 ) ) + tryAddMouseCursor( f20_arg2 ) + f20_arg0.menuRoot:addElement( f20_arg1.menu ) + f20_arg1.menu:processEvent( { + name = "menu_create", + dispatchChildren = true, + controller = f20_arg1.exclusiveControllerIndex + } ) + f20_local0 = true + LUI.ActiveScoped = nil + end + if not f0_local0( f20_arg0.menuInfoStack ) then + if f20_arg3 then + f20_arg1.menu:processEvent( { + name = "popup_inactive", + dispatchChildren = true + } ) + end + local f20_local1, f20_local2 = f20_arg1.menu:restoreState() + if not f20_local1 or f20_local2 == 0 then + DebugPrint( "LUI Warning: no saved state found for menu " .. f20_arg1.name ) + f20_arg1.menu:processEvent( { + name = "gain_focus" + } ) + end + elseif f20_local0 then + f20_arg1.menu:processEvent( { + name = "popup_active", + dispatchChildren = true + } ) + end + return f20_arg1.menu +end + +function CloseAllModalMenus( f21_arg0 ) + for f21_local0 = #f21_arg0.menuInfoStack, 1, -1 do + local f21_local3 = f21_arg0.menuInfoStack[f21_local0] + if f21_local3.menu and f21_local3.isModal then + f21_arg0:CloseMenuInfo( f21_local3 ) + f21_arg0:PopMenuInfo( f21_local3 ) + end + end +end + +function CloseVisibleInStack( f22_arg0, f22_arg1 ) + local f22_local0 = true + for f22_local1 = #f22_arg0.menuInfoStack, 1, -1 do + local f22_local4 = f22_arg0.menuInfoStack[f22_local1] + if f22_local4.menu and not f22_local4.isModal then + if f22_local0 then + if f22_arg1 then + f22_local4.menu:clearSavedState() + else + f22_local4.menu:saveState() + end + f22_local4.menu:processEvent( { + name = "lose_focus" + } ) + end + f22_local4.menu:processEvent( { + name = "menu_close", + dispatchChildren = true, + controller = f22_local4.exclusiveControllerIndex + } ) + f22_local4.menu:closeTree() + f22_local4.menu:close() + f22_local4.menu = nil + f22_local0 = false + end + end +end + +f0_local1 = function ( f23_arg0, f23_arg1, f23_arg2 ) + local f23_local0 = { + name = f23_arg0, + menu = f23_arg1, + isOldMenu = f23_arg2 + } + setmetatable( f23_local0, { + __mode = "v" + } ) + return f23_local0 +end + +function printStack( f24_arg0 ) + DebugPrint( "----MENU STACK TOP----" ) + for f24_local0 = #f24_arg0.menuInfoStack, 1, -1 do + local f24_local3 = f24_arg0.menuInfoStack[f24_local0] + DebugPrint( f24_local0 .. ") " .. f24_local3.name .. " (" .. (f24_local3.menu and "Built" or "Not built") .. (f24_local3.isOldMenu and ", old menu" or "") .. ")" ) + end + DebugPrint( "---MENU STACK BOTTOM---" ) +end + +function setupRoot( f25_arg0, f25_arg1 ) + f25_arg0.menuRoot = f25_arg1 + f25_arg0.menuRoot = LUI.UIElement.new( { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = true, + left = 0, + top = 0, + right = 0, + bottom = 0 + } ) + if not Engine.UsingSplitscreenUpscaling() then + f25_arg0.menuRoot:setupLetterboxElement() + end + if f25_arg1 == LUI.primaryRoot then + f25_arg0.menuRoot:setUseStencil( true ) + end + f25_arg0.menuRoot:setPriority( LUI.UIRoot.childPriorities.menuRoot ) + f25_arg1:addElement( f25_arg0.menuRoot ) + for f25_local3, f25_local4 in pairs( m_flowEvents ) do + f25_arg1:registerEventHandler( f25_local3, f25_local4 ) + end +end + +function RequestOldMenu( f26_arg0, f26_arg1, f26_arg2, f26_arg3 ) + local f26_local0 = { + name = "openOldMenu", + menu = f26_arg1, + replaceTop = f26_arg2, + controller = f26_arg3 + } + local f26_local1 = Engine.GetLuiRoot() + LUI.UIRoot.BlockButtonInput( f26_local1, true, "RequestOldMenu" ) + LUI.UIRoot.ProcessEvent( f26_local1, f26_local0 ) +end + +function RequestAddMenu( f27_arg0, f27_arg1, f27_arg2, f27_arg3, f27_arg4, f27_arg5 ) + local f27_local0 = { + name = "addmenu", + menu = f27_arg1, + exclusiveController = f27_arg2, + controller = f27_arg3, + replaceTop = f27_arg4, + data = f27_arg5 + } + local f27_local1 = Engine.GetLuiRoot() + LUI.UIRoot.BlockButtonInput( f27_local1, true, "RequestAddMenu" ) + LUI.UIRoot.ProcessEvent( f27_local1, f27_local0 ) +end + +function RequestPopupMenu( f28_arg0, f28_arg1, f28_arg2, f28_arg3, f28_arg4, f28_arg5, f28_arg6, f28_arg7, f28_arg8 ) + local f28_local0 = { + name = "popupmenu", + menu = f28_arg1, + exclusiveController = f28_arg2, + controller = f28_arg3, + replaceTop = f28_arg4, + data = f28_arg5 + } + if f28_arg8 ~= nil then + f28_local0.immediate = f28_arg8 + else + f28_local0.immediate = true + end + f28_local0.isModal = f28_arg7 + local f28_local1 = Engine.GetLuiRoot() + LUI.UIRoot.BlockButtonInput( f28_local1, true, "RequestPopupMenu " .. f28_arg1 ) + LUI.UIRoot.ProcessEvent( f28_local1, f28_local0 ) +end + +function RequestLeaveMenu( f29_arg0, f29_arg1 ) + local f29_local0 = { + name = "leavemenu", + element = f29_arg0, + immediate = f29_arg1 + } + local f29_local1 = Engine.GetLuiRoot() + LUI.UIRoot.BlockButtonInput( f29_local1, true, "RequestLeaveMenu" ) + LUI.UIRoot.ProcessEvent( f29_local1, f29_local0 ) +end + +function RequestLeaveMenuByName( f30_arg0 ) + local f30_local0 = { + name = "leavemenu", + menu = f30_arg0 + } + LUI.UIRoot.BlockButtonInput( Engine.GetLuiRoot(), true, "RequestLeaveMenuByName" ) + local f30_local1 = Engine.GetLuiRoot() + f30_local1:processEvent( f30_local0 ) +end + +function RequestRestoreMenu( f31_arg0, f31_arg1, f31_arg2, f31_arg3, f31_arg4 ) + local f31_local0 = { + name = "restoreMenu", + menu = f31_arg1, + immediate = true, + replaceTop = f31_arg4, + exclusiveController = f31_arg2, + controller = f31_arg3 + } + local f31_local1 = Engine.GetLuiRoot() + LUI.UIRoot.BlockButtonInput( f31_local1, true, "RequestRestoreMenu" ) + LUI.UIRoot.ProcessEvent( f31_local1, f31_local0 ) +end + +function RequestCloseAllMenus( f32_arg0, f32_arg1 ) + LUI.UIRoot.ProcessEvent( Engine.GetLuiRoot(), { + name = "closeallmenus", + menu = f32_arg1 + } ) +end + +function RequestSetStack( f33_arg0, f33_arg1 ) + LUI.UIRoot.ProcessEvent( Engine.GetLuiRoot(), { + name = "setStack", + stackData = f33_arg1, + immediate = true + } ) +end + +function RequestAddMenuAndSetStack( f34_arg0, f34_arg1, f34_arg2, f34_arg3, f34_arg4, f34_arg5, f34_arg6 ) + local f34_local0 = { + name = "addmenu_setstack", + menu = f34_arg1, + exclusiveController = f34_arg2, + controller = f34_arg3, + replaceTop = f34_arg4, + data = f34_arg5, + stackData = f34_arg6 + } + local f34_local1 = Engine.GetLuiRoot() + LUI.UIRoot.BlockButtonInput( f34_local1, true, "RequestAddMenuAndSetStack" ) + LUI.UIRoot.ProcessEvent( f34_local1, f34_local0 ) +end + +function openOldMenuHandler( f35_arg0, f35_arg1 ) + f35_arg0.flowManager:openOldMenu( f35_arg1, f35_arg0 ) + LUI.UIRoot.BlockButtonInput( f35_arg0, false, "openOldMenu" ) +end + +function openOldMenu( f36_arg0, f36_arg1, f36_arg2 ) + local f36_local0 = f36_arg1.menu + f36_arg0:CloseAllModalMenus() + local f36_local1 = GetTopMenuInfo( f36_arg0.menuInfoStack ) + local self = LUI.UIElement.new() + local f36_local3 = f0_local1( f36_local0, self, true ) + f36_arg0:CloseVisibleInStack( f36_arg1.replaceTop ) + local f36_local4 = f36_arg2:getChildById( "mouse_cursor" ) + if f36_local4 then + f36_local4:close() + end + f36_arg0.menuRoot:addElement( self ) + if f36_arg1.replaceTop then + f36_arg0:PopMenuInfo() + end + f36_arg0:PushMenuInfo( f36_local3 ) + Engine.SetLuiInUse( false ) + Engine.OpenOldMenu( f36_local0, f36_arg1.controller, f36_arg1.ignorePriority ) + return f36_local3.menu +end + +function closeAllMenusHandler( f37_arg0, f37_arg1 ) + f37_arg0.flowManager:closeAllMenus( f37_arg0, f37_arg1 ) +end + +function closeAllMenus( f38_arg0, f38_arg1, f38_arg2 ) + Engine.SetLuiInUse( false ) + for f38_local0 = #f38_arg0.menuInfoStack, 1, -1 do + local f38_local3 = f38_arg0.menuInfoStack[f38_local0] + f38_arg0:CloseMenuInfo( f38_local3, true ) + f38_arg0:PopMenuInfo( f38_local3 ) + end + local f38_local0 = f38_arg1:getChildById( "mouse_cursor" ) + if f38_local0 then + f38_local0:close() + end + f38_arg0.menuInfoStack = {} +end + +function IsInStack( f39_arg0, f39_arg1 ) + local f39_local0 = false + for f39_local4, f39_local5 in ipairs( f39_arg0.menuInfoStack ) do + if f39_local5.name == f39_arg1 and not f39_local5.isOldMenu then + f39_local0 = true + break + end + end + return f39_local0 +end + +function AnyActiveMenusInStack( f40_arg0 ) + local f40_local0 = f40_arg0.flowManager + if f40_local0.menuInfoStack then + for f40_local4, f40_local5 in ipairs( f40_local0.menuInfoStack ) do + if f40_local5.menu ~= nil then + return true + end + end + end + return false +end + +function IsMenuOpenAndVisible( f41_arg0, f41_arg1 ) + local f41_local0 = f41_arg0.flowManager + if f41_local0.menuInfoStack then + for f41_local4, f41_local5 in ipairs( f41_local0.menuInfoStack ) do + if f41_local5.name == f41_arg1 and f41_local5.menu ~= nil then + return true + end + end + end + return false +end + +function IsMenuInStack( f42_arg0, f42_arg1 ) + local f42_local0 = f42_arg0.flowManager + if f42_local0.menuInfoStack then + for f42_local4, f42_local5 in ipairs( f42_local0.menuInfoStack ) do + if f42_local5.name == f42_arg1 then + return true + end + end + end + return false +end + +function IsMenuTopmost( f43_arg0, f43_arg1 ) + local f43_local0 = f43_arg0.flowManager + if f43_local0.menuInfoStack then + local f43_local1 = f43_local0.menuInfoStack[#f43_local0.menuInfoStack] + if f43_local1 ~= nil and f43_local1.name == f43_arg1 then + return true + end + end + return false +end + +function GetTopOpenAndVisibleMenuName() + local f44_local0 = nil + local f44_local1 = Engine.GetLuiRoot() + if f44_local1 then + local f44_local2 = f44_local1.flowManager + if f44_local2.menuInfoStack then + for f44_local6, f44_local7 in ipairs( f44_local2.menuInfoStack ) do + if f44_local7.name and f44_local7.menu and not f44_local7.isModal then + f44_local0 = f44_local7.name + end + end + end + end + return f44_local0 +end + +function restoreMenuHandler( f45_arg0, f45_arg1 ) + f45_arg0.flowManager:restoreMenu( f45_arg1, f45_arg0 ) + LUI.UIRoot.BlockButtonInput( f45_arg0, false, "restoreMenu" ) +end + +function restoreMenu( f46_arg0, f46_arg1, f46_arg2 ) + local f46_local0 = f46_arg1.menu + Engine.SetLuiInUse( true ) + local f46_local1 = nil + if not IsInStack( f46_arg0, f46_local0 ) then + return addMenu( f46_arg0, f46_arg1, f46_arg2 ) + end + local f46_local2 = GetTopMenuInfo( f46_arg0.menuInfoStack ) + if f46_local2.name == f46_local0 then + return f46_local2.menu + end + local f46_local3 = nil + local f46_local4 = false + for f46_local5 = #f46_arg0.menuInfoStack, 1, -1 do + local f46_local8 = f46_arg0.menuInfoStack[f46_local5] + if f46_local8.name ~= f46_local0 then + + else + f46_local3 = f46_local8 + break + end + if not f46_local8.isModal then + if f46_local8.isPopup then + f46_local4 = true + end + f46_arg0:CloseMenuInfo( f46_local8 ) + f46_arg0:PopMenuInfo( f46_arg0.menuInfoStack[f46_local5] ) + end + end + assert( f46_local3 ) + return f46_arg0:RestoreMenuInfo( f46_local3, f46_arg2, f46_local4 ) +end + +function addMenuHandler( f47_arg0, f47_arg1 ) + if ShouldDelayAgainstSpam( f47_arg0 ) and f47_arg1.menu ~= "mp_pause_menu" then + LUI.UIRoot.ProcessEvent( f47_arg0, f47_arg1 ) + else + local f47_local0 = f47_arg0.flowManager.antiSpam + f47_local0.lastOpenedMenu = Engine.GetMilliseconds() + f47_local0.countOpenedMenusRecently = f47_local0.countOpenedMenusRecently + 1 + f47_arg0.flowManager:addMenu( f47_arg1, f47_arg0 ) + LUI.UIRoot.BlockButtonInput( f47_arg0, false, "addMenu" ) + end +end + +function addMenuAndSetStackHandler( f48_arg0, f48_arg1 ) + f48_arg0.flowManager:addMenu( f48_arg1, f48_arg0 ) + f48_arg0.flowManager:setStack( f48_arg0, f48_arg1 ) + LUI.UIRoot.BlockButtonInput( f48_arg0, false, "addMenu_setStack" ) +end + +function addMenu( f49_arg0, f49_arg1, f49_arg2 ) + local f49_local0 = f49_arg1.menu + if IsMenuOpenAndVisible( f49_arg2, f49_local0 ) then + return + end + Engine.SetLuiInUse( true ) + local f49_local1 = Engine.GetBytesFree() + local f49_local2 = nil + if f49_arg1.exclusiveController then + DebugPrint( "Setting exclusiveControllerIndex to " .. tostring( f49_arg1.controller ) ) + f49_local2 = f49_arg1.controller + end + f49_arg0:CloseVisibleInStack( f49_arg1.replaceTop ) + local f49_local3 = f0_local1( f49_local0 ) + f49_arg0:SetMenuBuildProps( f49_local3, f49_arg1.data ) + f49_local3.exclusiveControllerIndex = f49_local2 + if f49_arg1.replaceTop then + f49_arg0:PopMenuInfo() + end + local f49_local4 = f49_arg0:GetMenuScopedData( f49_local3 ) + local f49_local5 = f49_arg0:GetMenuBuildProps( f49_local3 ) + if f49_local2 then + f49_local4.exclusiveControllerIndex = f49_local2 + end + for f49_local9, f49_local10 in pairs( f49_local5 ) do + f49_local4[f49_local9] = f49_local10 + end + LUI.ActiveScoped = f49_local4 + f49_arg0:PushMenuInfo( f49_local3 ) + f49_local6 = LUI.MenuBuilder.buildMenu( f49_local0, f49_local5 ) + assert( f49_local6, "Could not build " .. f49_local0 ) + f49_local3.menu = f49_local6 + f49_arg0.menuRoot:addElement( f49_local6 ) + tryAddMouseCursor( f49_arg2 ) + f49_local6:processEvent( { + name = "update_navigation", + dispatchChildren = true + } ) + f49_local6:processEvent( { + name = "menu_create", + dispatchChildren = true, + controller = f49_local2 + } ) + if not f0_local0( f49_arg0.menuInfoStack ) then + if GetTopMenuInfo( f49_arg0.menuInfoStack ) == f49_local3 then + f49_local6:processEvent( { + name = "gain_focus", + focusType = FocusType.MenuFlow + } ) + end + elseif not f49_local3.isModal then + f49_local6:processEvent( { + name = "popup_active", + dispatchChildren = true + } ) + end + f49_local7 = Engine.GetBytesFree() + if not Engine.BBPrint( "lua_menu_info", "menu_name %s memory_delta_bytes %d init_free_bytes %d post_free_bytes %d in_game %d completed_menu %d", f49_local0, f49_local7 - f49_local1, f49_local1, f49_local7, Engine.InFrontend(), true ) then + DebugPrint( "Failed to write to blackbox" ) + end + LUI.ActiveScoped = nil + return f49_local3.menu +end + +function popupMenuHandler( f50_arg0, f50_arg1 ) + f50_arg0.flowManager:popupMenu( f50_arg1, f50_arg0 ) + LUI.UIRoot.BlockButtonInput( f50_arg0, false, "popupMenu " .. f50_arg1.menu ) +end + +function popupMenu( f51_arg0, f51_arg1, f51_arg2 ) + local f51_local0 = f51_arg1.menu + if IsMenuOpenAndVisible( f51_arg2, f51_local0 ) then + return + end + Engine.SetLuiInUse( true ) + local f51_local1 = Engine.GetBytesFree() + local f51_local2 = f51_arg0.menuInfoStack[#f51_arg0.menuInfoStack] + local f51_local3 = nil + if f51_arg1.exclusiveController then + f51_local3 = f51_arg1.controller + end + local f51_local4 = f0_local1( f51_local0 ) + f51_arg0:SetMenuBuildProps( f51_local4, f51_arg1.data ) + f51_local4.exclusiveControllerIndex = f51_local3 + if f51_arg1.isModal then + f51_local4.isModal = true + end + f51_local4.isPopup = true + local f51_local5 = f51_arg0:GetMenuScopedData( f51_local4 ) + local f51_local6 = f51_arg0:GetMenuBuildProps( f51_local4 ) + if f51_local3 then + f51_local5.exclusiveControllerIndex = f51_local3 + end + for f51_local10, f51_local11 in pairs( f51_local6 ) do + f51_local5[f51_local10] = f51_local11 + end + LUI.ActiveScoped = f51_local5 + if f51_local2 then + if f51_arg1.replaceTop then + assert( f51_local4.isModal ~= true, "Replacing top with a modal dialog is not supported!" ) + f51_arg0:CloseMenuInfo( f51_local2 ) + elseif not f51_local2.isModal then + if f51_local2.menu ~= nil then + f51_local2.menu:saveState() + f51_local2.menu:processEvent( { + name = "lose_focus" + } ) + f51_local2.menu:processEvent( { + name = "popup_active", + dispatchChildren = true, + popup_name = f51_local0 + } ) + end + else + for f51_local7 = #f51_arg0.menuInfoStack, 1, -1 do + if not f51_arg0.menuInfoStack[f51_local7].isPopup and f51_arg0.menuInfoStack[f51_local7].menu ~= nil then + f51_arg0.menuInfoStack[f51_local7].menu:processEvent( { + name = "popup_active", + dispatchChildren = true, + popup_name = f51_local0 + } ) + break + end + end + end + end + if f51_arg1.replaceTop then + assert( f51_local4.isModal ~= true, "Replacing top with a modal dialog is not supported!" ) + f51_arg0.menuInfoStack[#f51_arg0.menuInfoStack] = nil + end + f51_arg0:PushMenuInfo( f51_local4 ) + f51_local7 = LUI.MenuBuilder.buildMenu( f51_local0, f51_local6 ) + assert( f51_local7, "Could not build " .. f51_local0 ) + if f51_arg1.isModal then + f51_local7:setPriority( LUI.FlowManager.modal_priority ) + end + f51_local4.menu = f51_local7 + f51_arg0.menuRoot:addElement( f51_local7 ) + f51_local7:processEvent( { + name = "update_navigation", + dispatchChildren = true + } ) + f51_local7:processEvent( { + name = "menu_create", + dispatchChildren = true, + controller = f51_local3 + } ) + if not f0_local0( f51_arg0.menuInfoStack ) then + if GetTopMenuInfo( f51_arg0.menuInfoStack ) == f51_local4 then + f51_local7:processEvent( { + name = "gain_focus" + } ) + end + elseif not f51_local4.isModal then + f51_local7:processEvent( { + name = "popup_active", + dispatchChildren = true + } ) + end + f51_local8 = Engine.GetBytesFree() + if not Engine.BBPrint( "lua_menu_info", "menu_name %s memory_delta_bytes %d init_free_bytes %d post_free_bytes %d in_game %d completed_menu %d", f51_local0, f51_local8 - f51_local1, f51_local1, f51_local8, Engine.InFrontend(), true ) then + DebugPrint( "Failed to write to blackbox" ) + end + LUI.ActiveScoped = nil + return f51_local4.menu +end + +function leaveMenuHandler( f52_arg0, f52_arg1 ) + if ShouldDelayAgainstSpam( f52_arg0 ) then + LUI.UIRoot.ProcessEvent( f52_arg0, f52_arg1 ) + else + local f52_local0 = f52_arg0.flowManager.antiSpam + f52_local0.lastOpenedMenu = Engine.GetMilliseconds() + f52_local0.countOpenedMenusRecently = f52_local0.countOpenedMenusRecently + 1 + f52_arg0.flowManager:leaveMenu( f52_arg0, f52_arg1 ) + LUI.UIRoot.BlockButtonInput( f52_arg0, false, "leaveMenu" ) + end +end + +function leaveMenuByNameHandler( f53_arg0, f53_arg1 ) + RequestLeaveMenuByName( f53_arg1.menu ) + LUI.UIRoot.BlockButtonInput( f53_arg0, false, "leaveMenuByName" ) +end + +function leaveMenu( f54_arg0, f54_arg1, f54_arg2 ) + local f54_local0 = nil + if f54_arg2.element then + for f54_local1 = #f54_arg0.menuInfoStack, 1, -1 do + local f54_local4 = f54_arg0.menuInfoStack[f54_local1] + if f54_local4.menu and IsElementAChildOf( f54_arg2.element, f54_local4.menu ) then + f54_local0 = f54_local4 + break + end + end + if not f54_local0 then + DebugPrint( "Warning: LeaveMenu was called with an element ref, but that element was not found, it is likely the menu was already closed." ) + return nil + end + end + if not f54_local0 and f54_arg2.menu then + for f54_local1 = #f54_arg0.menuInfoStack, 1, -1 do + local f54_local4 = f54_arg0.menuInfoStack[f54_local1] + if f54_local4.name == f54_arg2.menu then + f54_local0 = f54_local4 + break + end + end + if not f54_local0 then + DebugPrint( "Warning: LeaveMenu was called with a menu name, but that menu was not found in the stack, it is likely the menu was already closed: " .. f54_arg2.menu ) + return nil + end + end + if not f54_local0 and not f54_arg2.menu and not f54_arg2.element then + f54_local0 = GetTopMenuInfo( f54_arg0.menuInfoStack ) + end + if not f54_local0 then + DebugPrint( "WARNING: LeaveMenu failed because the requested menu could not be found or the menu stack is empty." ) + return + elseif f54_local0.menu then + f54_arg0:CloseMenuInfo( f54_local0 ) + end + f54_arg0:PopMenuInfo( f54_local0 ) + if not f54_local0.isModal then + Engine.PlaySound( CoD.SFX.SelectBack ) + end + local f54_local1 = GetTopMenuInfo( f54_arg0.menuInfoStack ) + if Engine.InFrontend and Engine.InFrontend() then + assert( f54_local1, "LUI Error: No menu to back out to, stack is empty" ) + end + local f54_local2 = Engine.SetLuiInUse + local f54_local3 + if f54_local1 ~= nil then + f54_local3 = not f54_local1.isOldMenu + else + f54_local3 = false + end + f54_local2( f54_local3 ) + if f54_local1 then + if f54_local1.isOldMenu then + f54_local2 = f54_arg1:getChildById( "mouse_cursor" ) + if f54_local2 then + f54_local2:close() + end + else + return f54_arg0:RestoreMenuInfo( f54_local1, f54_arg1, f54_local0.isPopup ) + end + end + f54_local2 = f54_arg1:getChildById( "mouse_cursor" ) + if f54_local2 then + f54_local2:close() + end + return nil +end + +function setStackHandler( f55_arg0, f55_arg1 ) + f55_arg0.flowManager:setStack( f55_arg0, f55_arg1 ) +end + +function setStack( f56_arg0, f56_arg1, f56_arg2 ) + DebugPrint( "FlowManager: Rewriting menu stack " ) + local f56_local0 = GetTopMenuInfo( f56_arg0.menuInfoStack ) + if f56_arg0.debug then + local f56_local1 = "" + for f56_local6, f56_local7 in ipairs( f56_arg0.menuInfoStack ) do + local f56_local8 = f56_local1 + local f56_local5 + if f56_local6 > 1 then + f56_local5 = " > " + if not f56_local5 then + + else + f56_local1 = f56_local8 .. f56_local5 .. f56_local7.name + end + end + f56_local5 = "" + end + DebugPrint( " Current stack: " .. f56_local1 ) + f56_local2 = "" + for f56_local7, f56_local8 in ipairs( f56_arg2.stackData ) do + local f56_local5 = f56_local2 + local f56_local9 + if f56_local7 > 1 then + f56_local9 = " > " + if not f56_local9 then + + else + f56_local2 = f56_local5 .. f56_local9 .. f56_local8.name + end + end + f56_local9 = "" + end + DebugPrint( " Requesting: " .. f56_local2 .. " > " .. f56_local0.name ) + end + local f56_local1 = 0 + for f56_local6, f56_local7 in ipairs( f56_arg0.menuInfoStack ) do + if not (not f56_arg2.stackData[f56_local6] or f56_arg2.stackData[f56_local6].name ~= f56_local7.name) or f56_local6 == #f56_arg2.stackData + 1 and f56_local0.name == f56_local7.name then + f56_local1 = f56_local6 + end + end + for f56_local2 = #f56_arg0.menuInfoStack - 1, f56_local1 + 1, -1 do + if not f56_arg0.menuInfoStack[f56_local2 + 1] or not f56_arg0.menuInfoStack[f56_local2 + 1].isModal then + f56_arg0:CloseMenuInfo( f56_arg0.menuInfoStack[f56_local2] ) + f56_arg0:PopMenuInfo( f56_arg0.menuInfoStack[f56_local2] ) + end + end + for f56_local2 = f56_local1 + 1, #f56_arg2.stackData, 1 do + f56_local7 = f0_local1( f56_arg2.stackData[f56_local2].name ) + f56_arg0:SetMenuBuildProps( f56_local7, f56_arg2.stackData[f56_local2].data ) + f56_arg0:PushMenuInfo( f56_local7, true ) + end +end + +function CheckRestoreFocus( f57_arg0 ) + if f57_arg0.menuInfoStack[#f57_arg0.menuInfoStack] and f57_arg0.menuInfoStack[#f57_arg0.menuInfoStack].menu and not f57_arg0.menuInfoStack[#f57_arg0.menuInfoStack].menu:getFirstInFocus() then + DebugPrint( "FLowManager: No child in focus, trying to restore focus. This should probably only happen when using a mouse" ) + f57_arg0.menuInfoStack[#f57_arg0.menuInfoStack].menu:processEvent( { + name = "gain_focus" + } ) + end +end + +function SaveMenuStack( f58_arg0 ) + local f58_local0 = f58_arg0.flowManager + local f58_local1 = {} + if f58_local0.menuInfoStack then + for f58_local8, f58_local9 in ipairs( f58_local0.menuInfoStack ) do + local f58_local10 = {} + for f58_local5, f58_local6 in pairs( f58_local9 ) do + if f58_local5 == "menu" then + if f58_local6 then + f58_local10.menu = true + else + f58_local10.menu = false + goto basicblock_9: + end + end + f58_local10[f58_local5] = f58_local6 + end + if f58_local0.menuInfoData[f58_local9] and f58_local0.menuInfoData[f58_local9].scopedData then + DebugPrint( "WARNING: Menu scoped data lost during the debug luiReload process, UI may act inconsistent" ) + end + f58_local1[#f58_local1 + 1] = f58_local10 + end + end + return serialize.persist( {}, f58_local1 ) +end + +function RestoreMenuStack( f59_arg0, f59_arg1 ) + if f59_arg1 then + local f59_local0 = f59_arg0.flowManager + for f59_local7, f59_local8 in ipairs( serialize.unpersist( {}, f59_arg1 ) ) do + local f59_local9 = f0_local1() + for f59_local4, f59_local5 in pairs( f59_local8 ) do + if f59_local4 ~= "menu" then + f59_local9[f59_local4] = f59_local5 + end + end + f59_local0:PushMenuInfo( f59_local9, false ) + if f59_local8.menu then + if not f59_local8.isOldMenu then + LUI.ActiveScoped = f59_local0:GetMenuScopedData( f59_local9 ) + f59_local9.menu = LUI.MenuBuilder.buildMenu( f59_local8.name, f59_local0:GetMenuBuildProps( f59_local9 ) ) + f59_local0.menuRoot:addElement( f59_local9.menu ) + f59_local9.menu:processEvent( { + name = "update_navigation", + dispatchChildren = true + } ) + f59_local9.menu:processEvent( { + name = "menu_create", + dispatchChildren = true, + stackRestore = true, + controller = f59_local9.exclusiveControllerIndex + } ) + LUI.ActiveScoped = nil + else + Engine.SetLuiInUse( false ) + Engine.OpenOldMenu( f59_local8.name ) + end + end + end + f59_local1 = f59_local0.menuInfoStack[#f59_local0.menuInfoStack] + if f59_local1 and f59_local1.menu then + Engine.SetLuiInUse( true ) + f59_local1.menu:processEvent( { + name = "gain_focus" + } ) + tryAddMouseCursor( f59_arg0 ) + end + end +end + +m_flowEvents = { + addmenu = addMenuHandler, + addmenu_setstack = addMenuAndSetStackHandler, + openOldMenu = openOldMenuHandler, + popupmenu = popupMenuHandler, + leavemenu = leaveMenuHandler, + leavemenubyname = leaveMenuByNameHandler, + restoreMenu = restoreMenuHandler, + closeallmenus = closeAllMenusHandler, + setStack = setStackHandler +} +LockTable( _M ) diff --git a/lui/gamepadcontrols.dec.lua b/lui/gamepadcontrols.dec.lua new file mode 100644 index 0000000..69360cf --- /dev/null +++ b/lui/gamepadcontrols.dec.lua @@ -0,0 +1,405 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GamepadDisabledFunc( f1_arg0, f1_arg1 ) + return not Engine.GetProfileData( "gpadEnabled" ) +end + +function OptionsWindowRefresh( f2_arg0, f2_arg1 ) + if f2_arg1.source_input == "button_action" or f2_arg1.source_input == "key_bound" or f2_arg1.source_input == "button_right" or f2_arg1.source_input == "button_left" then + f2_arg0:processEvent( { + name = "menu_refresh" + } ) + f2_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function SinglePlayerDisableFunction( f3_arg0, f3_arg1 ) + return not Engine.IsMultiplayer() +end + +function OptionsWindowTriggerRefresh( f4_arg0, f4_arg1 ) + f4_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f4_arg1.name, + immediate = true + } ) +end + +function OptionFactoryProfileData( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, f5_arg5, f5_arg6 ) + local f5_local0 = Engine.GetProfileData( f5_arg0 ) + local f5_local1 = 1 + for f5_local5, f5_local6 in pairs( f5_arg3 ) do + if f5_local6.value == f5_local0 then + f5_local1 = f5_local5 + break + end + end + f5_local2 = function ( f6_arg0, f6_arg1 ) + Engine.ExecNow( f5_arg1 ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + OptionsWindowTriggerRefresh( f6_arg0, f6_arg1 ) + if f5_arg6 and type( f5_arg6 ) == "function" then + f5_arg6( f6_arg0 ) + end + end + + f5_local3 = { + type = "UIGenericButton", + id = "option_" .. f5_arg0, + disabledFunc = f5_arg4 or function () + return false + end + + } + f5_local4 = { + variant = GenericButtonSettings.Variants.Select + } + if f5_arg5 then + local f5_local7 = f5_arg2 + end + f5_local4.button_text = f5_local7 or Engine.Localize( f5_arg2 ) + f5_local4.button_display_func = function ( f8_arg0, f8_arg1 ) + return Engine.Localize( f5_arg3[f5_local1].text ) + end + + f5_local4.button_left_func = function ( f9_arg0, f9_arg1 ) + f5_local1 = 1 + (#f5_arg3 + f5_local1 - 1 - 1) % #f5_arg3 + f5_local2( f9_arg0, f9_arg1 ) + end + + f5_local4.button_right_func = function ( f10_arg0, f10_arg1 ) + f5_local1 = 1 + (f5_local1 - 1 + 1) % #f5_arg3 + f5_local2( f10_arg0, f10_arg1 ) + end + + f5_local3.properties = f5_local4 + f5_local3.handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ) + } + return f5_local3 +end + +function SliderOptionFactory( f11_arg0, f11_arg1, f11_arg2, f11_arg3, f11_arg4, f11_arg5 ) + local f11_local0 = function ( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 ) + Engine.SetDvarFloat( f11_arg0, math.min( f12_arg1, math.max( f12_arg0, Engine.GetDvarFloat( f11_arg0 ) + f12_arg2 ) ) ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + OptionsWindowTriggerRefresh( f12_arg3, f12_arg4 ) + end + + return { + type = "UIGenericButton", + id = "options_" .. f11_arg0, + disabledFunc = f11_arg5 or function () + return false + end + , + properties = { + button_text = Engine.Localize( f11_arg1 ), + variant = GenericButtonSettings.Variants.Slider, + button_display_func = function ( f14_arg0, f14_arg1 ) + return (Engine.GetDvarFloat( f11_arg0 ) - f11_arg2) / (f11_arg3 - f11_arg2) + end + , + button_left_func = function ( f15_arg0, f15_arg1 ) + f11_local0( f11_arg2, f11_arg3, -f11_arg4, f15_arg0, f15_arg1 ) + end + , + button_right_func = function ( f16_arg0, f16_arg1 ) + f11_local0( f11_arg2, f11_arg3, f11_arg4, f16_arg0, f16_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ) + } + } +end + +function GetButtonsLayoutName() + local f17_local0 = Engine.GetProfileData( "gpadButtonsConfig" ) + if f17_local0 == "buttons_default" then + return Engine.Localize( "@MENU_DEFAULT" ) + elseif f17_local0 == "buttons_tactical" then + return Engine.Localize( "@MENU_TACTICAL" ) + elseif f17_local0 == "buttons_lefty" then + return Engine.Localize( "@MENU_LEFTY" ) + elseif f17_local0 == "buttons_nomad" then + return Engine.Localize( "@MENU_NOMAD" ) + elseif f17_local0 == "buttons_nomad_tactical" then + return Engine.Localize( "@MENU_NOMAD_TACTICAL" ) + elseif f17_local0 == "buttons_default_alt" then + return Engine.Localize( "@MENU_DEFAULT_ALT" ) + elseif f17_local0 == "buttons_tactical_alt" then + return Engine.Localize( "@MENU_TACTICAL_ALT" ) + elseif f17_local0 == "buttons_lefty_alt" then + return Engine.Localize( "@MENU_LEFTY_ALT" ) + elseif f17_local0 == "buttons_nomad_alt" then + return Engine.Localize( "@MENU_NOMAD_ALT" ) + else + return Engine.Localize( "@MENU_NOMAD_TACTICAL_ALT" ) + end +end + +function ButtonsLayoutAction( f18_arg0, f18_arg1 ) + LUI.FlowManager.RequestAddMenu( f18_arg0, "buttons", true, f18_arg1.controller, false ) +end + +function GetSticksLayoutName() + local f19_local0 = Engine.GetProfileData( "gpadSticksConfig" ) + if f19_local0 == "thumbstick_default" then + return Engine.Localize( "@MENU_DEFAULT" ) + elseif f19_local0 == "thumbstick_southpaw" then + return Engine.Localize( "@MENU_SOUTHPAW" ) + elseif f19_local0 == "thumbstick_legacy" then + return Engine.Localize( "@MENU_LEGACY" ) + elseif f19_local0 == "thumbstick_southpaw_ns" then + return Engine.Localize( "@MENU_SOUTHPAW_NS" ) + elseif f19_local0 == "thumbstick_legacysouthpaw_ns" then + return Engine.Localize( "@MENU_LEGACY_SOUTHPAW_NS" ) + else + return Engine.Localize( "@MENU_LEGACY_SOUTHPAW" ) + end +end + +function SticksLayoutAction( f20_arg0, f20_arg1 ) + LUI.FlowManager.RequestAddMenu( f20_arg0, "thumbstick", true, f20_arg1.controller, false ) +end + +function GetSensitivityText() + local f21_local0 = Engine.GetDvarFloat( "profileMenuOption_sensitivity" ) + if f21_local0 == 1 then + return Engine.Localize( "@MENU_LOW" ) .. " " .. f21_local0 + elseif f21_local0 == 3 then + return Engine.Localize( "@MENU_MEDIUM" ) .. " " .. f21_local0 + elseif f21_local0 == 7 then + return Engine.Localize( "@MENU_HIGH" ) .. " " .. f21_local0 + elseif f21_local0 == 13 then + return Engine.Localize( "@MENU_VERY_HIGH" ) .. " " .. f21_local0 + elseif f21_local0 == 20 then + return Engine.Localize( "@MENU_INSANE" ) .. " " .. f21_local0 + else + return f21_local0 .. "" + end +end + +function SensitivityChange( f22_arg0, f22_arg1 ) + Engine.SetDvarFloat( "profileMenuOption_sensitivity", math.min( 20, math.max( 1, Engine.GetDvarFloat( "profileMenuOption_sensitivity" ) + f22_arg1 ) ) ) + Engine.MenuDvarsFinish( f22_arg0 ) +end + +function OnToggleGPadEnabled( f23_arg0 ) + LUI.FlowManager.tryAddMouseCursor( Engine.GetLuiRoot() ) + Engine.Exec( "updategamerprofile" ) + f23_arg0:dispatchEventToRoot( { + name = "refresh_button_helper", + dispatchChildren = true + } ) +end + +function OptionsFeeder( f24_arg0 ) + local f24_local0 = {} + Engine.ExecNow( "profile_menuDvarsSetup" ) + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "gpadEnabled", "profile_toggleEnableGamepad", "LUA_MENU_GAMEPAD", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, nil, nil, OnToggleGPadEnabled ) + f24_local0[#f24_local0 + 1] = { + type = "UIGenericButton", + id = "stick_layout_button_id", + disabledFunc = GamepadDisabledFunc, + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "MENU_THUMBSTICK_LAYOUT" ), + button_display_func = GetSticksLayoutName, + button_action_func = SticksLayoutAction + } + } + f24_local0[#f24_local0 + 1] = { + type = "UIGenericButton", + id = "buttons_layout_button_id", + disabledFunc = GamepadDisabledFunc, + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( "MENU_BUTTON_LAYOUT" ), + button_display_func = GetButtonsLayoutName, + button_action_func = ButtonsLayoutAction + } + } + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "invertedPitch", "profile_toggleInvertedPitch", "MENU_LOOK_INVERSION", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, GamepadDisabledFunc ) + f24_local0[#f24_local0 + 1] = { + type = "UIGenericButton", + id = "sensitivity_button_id", + disabledFunc = GamepadDisabledFunc, + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( "MENU_LOOK_SENSITIVITY" ), + button_display_func = GetSensitivityText, + button_left_func = function ( f25_arg0, f25_arg1 ) + return SensitivityChange( f24_arg0.exclusiveController, -1 ) + end, + button_right_func = function ( f26_arg0, f26_arg1 ) + return SensitivityChange( f24_arg0.exclusiveController, 1 ) + end + } + } + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "rumble", "profile_toggleRumble", "MENU_CONTROLLER_VIBRATION", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, GamepadDisabledFunc ) + if SinglePlayerDisableFunction() then + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "autoAim", "profile_toggleAutoAim", "MENU_AIM_ASSIST", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, GamepadDisabledFunc ) + end + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "leanEnabled", "profile_toggleLean", "LUA_MENU_LEAN_TOGGLE", { + { + text = "@LUA_MENU_ENABLED", + value = true + }, + { + text = "@LUA_MENU_DISABLED", + value = false + } + }, GamepadDisabledFunc ) + if Engine.IsDevelopmentBuild() then + f24_local0[#f24_local0 + 1] = OptionFactoryProfileData( "useDevKeyboard", "profile_toggleDevKeyboard", "DEBUG_KEYBOARD", { + { + text = "@LUA_MENU_DISABLED", + value = false + }, + { + text = "@LUA_MENU_ENABLED", + value = true + } + }, GamepadDisabledFunc, true ) + end + return f24_local0 +end + +function OptionsMainCreate( f27_arg0, f27_arg1 ) + f27_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function OptionsMainClose( f28_arg0, f28_arg1 ) + Engine.Exec( "updategamerprofile" ) +end + +function gamepad_controls_vlist() + return { + type = "UIStencil", + children = { + { + type = "UIVerticalList", + childrenFeeder = OptionsFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -25, + top = 0, + bottom = 0 + } + } + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_wide, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + handlers = {} + } +end + +function gamepad_controls() + return { + type = "UIElement", + id = "gamepad_controls_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = OptionsMainClose, + options_window_refresh = OptionsWindowRefresh + }, + children = { + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_GAMEPAD" ) + } + }, + { + type = "gamepad_controls_vlist", + id = "gamepad_controls_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "gamepad_controls_vlist", gamepad_controls_vlist ) +LUI.MenuBuilder.registerDef( "gamepad_controls", gamepad_controls ) +LockTable( _M ) diff --git a/lui/gamex.dec.lua b/lui/gamex.dec.lua new file mode 100644 index 0000000..3c886e7 --- /dev/null +++ b/lui/gamex.dec.lua @@ -0,0 +1,288 @@ +if not GameX then + GameX = {} +end +GameX.GetPlayerOpposingTeam = function ( f1_arg0 ) + local f1_local0 = f1_arg0 + if not f1_local0 then + f1_local0 = Game.GetPlayerTeam() + if GameX.IsSpectatingNotOnTeam( f1_local0 ) then + f1_local0 = spectatorFakeTeam + end + end + local f1_local1 = otherTeamLookup[f1_local0] + if not f1_local1 then + f1_local1 = 0 + end + return f1_local1 +end + +GameX.gameModeIsFFA = function ( f2_arg0 ) + local f2_local0 = f2_arg0 or Engine.GetDvarString( "ui_gametype" ) + if f2_local0 == "dm" or f2_local0 == "sotf_ffa" or f2_local0 == "gun" or f2_local0 == "mugger" or f2_local0 == "adrn" or f2_local0 == "assn" or f2_local0 == "fo" or f2_local0 == "sna" then + return true + elseif f2_local0 == "cranked" then + return Engine.GetDvarInt( "scr_cranked_teambased" ) == 0 + else + return false + end +end + +GameX.GetTeamName = function ( f3_arg0 ) + local f3_local0 = { + "free", + "axis", + "allies" + } + return f3_local0[f3_arg0 + 1] +end + +GameX.GetFactionName = function ( f4_arg0 ) + local f4_local0 = { + "free", + "federation", + "ghosts" + } + return f4_local0[f4_arg0 + 1] +end + +GameX.IsSpectatingNotOnTeam = function ( f5_arg0 ) + local f5_local0 + if not (Game.IsSpectating() or Game.GetOmnvar( "ui_session_state" ) == "spectator") or (f5_arg0 or Game.GetPlayerTeam()) ~= Teams.spectator then + f5_local0 = false + else + f5_local0 = true + end + return f5_local0 +end + +GameX.IsHardcoreMode = function () + return Engine.GetDvarBool( "g_hardcore" ) +end + +GameX.IsRankedMatch = function () + return Engine.GetDvarBool( "onlinegame" ) and not Engine.GetDvarBool( "xblive_privatematch" ) +end + +GameX.IsOnlineMatch = function () + local f8_local0 = Engine.GetDvarBool( "onlinegame" ) + if not f8_local0 then + f8_local0 = Engine.GetDvarBool( "xblive_privatematch" ) + end + return f8_local0 +end + +GameX.GetGameMode = function () + return Engine.GetDvarString( "ui_gametype" ) +end + +GameX.GetNumPlayerSlotsForFinalScoreboard = function ( f10_arg0, f10_arg1 ) + local f10_local0 = GameX.IsRankedMatch() and Engine.GetDvarInt( "party_maxplayers" ) or 0 + local f10_local1 = Game.GetNumPlayersOnTeam( f10_arg0 ) + if GameX.gameModeIsFFA( f10_arg1 ) then + assert( f10_arg0 == Teams.free ) + return math.max( 1, math.max( f10_local1, f10_local0 ) ) + elseif f10_arg1 == "infect" then + if f10_arg0 == Teams.allies then + return math.max( 0, f10_local1 ) + else + local f10_local2 = Game.GetNumPlayersOnTeam( GameX.GetPlayerOpposingTeam( f10_arg0 ) ) + local f10_local3 = f10_local0 - f10_local2 + if f10_local1 + f10_local2 == 0 then + return 1 + else + return math.max( 0, math.max( f10_local1, f10_local3 ) ) + end + end + elseif f10_arg1 == "horde" then + if f10_arg0 == Teams.allies then + return math.max( 4, math.max( f10_local1, f10_local0 ) ) + else + return math.max( 0, f10_local1 ) + end + end + local f10_local2 = assert + local f10_local3 + if f10_arg0 ~= Teams.axis and f10_arg0 ~= Teams.allies then + f10_local3 = false + else + f10_local3 = true + end + f10_local2( f10_local3 ) + return math.max( 1, math.max( f10_local1, f10_local0 / 2 ) ) +end + +GameX.GetPlayerScoreInfoAtRankForGameMode = function ( f11_arg0, f11_arg1, f11_arg2, f11_arg3 ) + local f11_local0 = Game.GetPlayerScoreInfoAtRank( f11_arg0, f11_arg1 ) + if not f11_local0 then + return nil + end + local f11_local1 = 99 + local f11_local2 = 99 + if f11_arg2 == "horde" then + f11_local1 = 999 + f11_local2 = 999 + end + f11_local0.score = math.min( 9999, f11_local0.score ) + f11_local0.kills = math.min( f11_local1, f11_local0.kills ) + f11_local0.deaths = math.min( 99, f11_local0.deaths ) + f11_local0.assists = math.min( f11_local2, f11_local0.assists ) + f11_local0.prestige = f11_local0.prestige or 0 + if not (f11_arg2 ~= "dm" and (f11_arg2 ~= "cranked" or not GameX.gameModeIsFFA( f11_arg2 ))) or f11_arg2 == "sotf_ffa" then + local f11_local3 = Game.GetOmnvar( "ui_game_type_kill_value" ) + if not f11_local3 then + f11_local0.extrascore0 = 0 + else + f11_local0.extrascore0 = math.min( 9999, f11_local0.score * f11_local3 ) + end + elseif f11_arg2 == "horde" then + f11_local0.extrascore0 = math.min( 999, f11_local0.extrascore0 ) + elseif f11_arg2 == "infect" then + f11_local0.time = CoD.FormatInfectedTime( f11_local0.extrascore0, f11_arg3 ) + else + f11_local0.extrascore0 = math.min( 99, f11_local0.extrascore0 ) + end + return f11_local0 +end + +GameX.GetScreenDims = function () + local f12_local0 = {} + local f12_local1 = Engine.GetLuiRoot() + f12_local0 = f12_local1:getCurrentGlobalRect() + return f12_local0[3], f12_local0[4] +end + +GameX.GetScreenWidth = function () + local f13_local0 = {} + local f13_local1 = Engine.GetLuiRoot() + f13_local0 = f13_local1:getCurrentGlobalRect() + return f13_local0[3] +end + +GameX.GetScreenHeight = function () + local f14_local0 = {} + local f14_local1 = Engine.GetLuiRoot() + f14_local0 = f14_local1:getCurrentGlobalRect() + return f14_local0[4] +end + +GameX.GetSafeZoneSize = function ( f15_arg0, f15_arg1 ) + local f15_local0 = f15_arg0 or SliderBounds.HorzMargin.Min + local f15_local1 = f15_arg1 or SliderBounds.VertMargin.Min + local f15_local2, f15_local3 = GameX.GetScreenDims() + local f15_local4 = f15_local2 * (1 - f15_local0) / 2 + local f15_local5 = f15_local3 * (1 - f15_local1) / 2 + local f15_local6 = Engine.SplitscreenPlayerCount() + assert( f15_local6 <= MaxLocalClients ) + local f15_local7 = assert + local f15_local8 + if f15_local6 ~= 1 and f15_local6 ~= 2 then + f15_local8 = false + else + f15_local8 = true + end + f15_local7( f15_local8 ) + if f15_local6 == 2 then + f15_local5 = f15_local5 * 2 + f15_local7 = Engine.GetCurrentLocalClient() + assert( f15_local7 and f15_local7 < MaxLocalClients ) + if f15_local7 == 0 then + return f15_local4, f15_local5, -f15_local4, 0 + else + return f15_local4, 0, -f15_local4, -f15_local5 + end + else + return f15_local4, f15_local5, -f15_local4, -f15_local5 + end +end + +GameX.GetAdjustedSafeZoneSize = function () + return GameX.GetSafeZoneSize( Engine.GetDvarFloat( "safeArea_adjusted_horizontal" ), Engine.GetDvarFloat( "safeArea_adjusted_vertical" ) ) +end + +GameX.IsSplitscreen = function () + local f17_local0 = Engine.SplitscreenPlayerCount() + local f17_local1 = assert + local f17_local2 + if f17_local0 and f17_local0 > MaxLocalClients then + f17_local2 = false + else + f17_local2 = true + end + f17_local1( f17_local2 ) + return f17_local0 > 1 +end + +OptionState = { + Locked = false +} +GameX.IsOptionStateLocked = function () + return OptionState.Locked +end + +GameX.SetOptionState = function ( f19_arg0 ) + OptionState.Locked = f19_arg0 +end + +GameX.GetTeamNameOverride = function ( f20_arg0 ) + if not MLG.IsMLGSpectator() then + return nil + elseif MatchRules.IsUsingMatchRulesData() then + local f20_local0 = nil + if f20_arg0 == Teams.allies then + f20_local0 = "ghostsTeamName" + elseif f20_arg0 == Teams.axis then + f20_local0 = "fedTeamName" + end + local f20_local1 = MatchRules.GetData( "commonOption", f20_local0 ) + if f20_local1 and f20_local1 ~= "" then + return f20_local1 + end + end + return nil +end + +GameX.GetLocalizedTeamName = function ( f21_arg0 ) + if f21_arg0 ~= Teams.allies and f21_arg0 ~= Teams.axis then + return nil + else + local f21_local0 = GameX.GetTeamNameOverride( f21_arg0 ) + if f21_local0 and f21_local0 ~= "" then + return f21_local0 + elseif f21_arg0 == Teams.allies then + return Engine.Localize( "LUA_MENU_ALLIES_CAPS" ) + elseif f21_arg0 == Teams.axis then + return Engine.Localize( "LUA_MENU_AXIS_CAPS" ) + else + + end + end +end + +GameX.GetLocalizedTeamNameMixedCase = function ( f22_arg0 ) + if f22_arg0 ~= Teams.allies and f22_arg0 ~= Teams.axis then + return nil + else + local f22_local0 = GameX.GetTeamNameOverride( f22_arg0 ) + if f22_local0 and f22_local0 ~= "" then + return f22_local0 + elseif f22_arg0 == Teams.allies then + return Engine.Localize( "MP_GHOSTS_NAME" ) + elseif f22_arg0 == Teams.axis then + return Engine.Localize( "MP_FEDERATION_NAME" ) + else + + end + end +end + +GameX.UsesFakeLoadout = function () + local f23_local0 = GameX.GetGameMode() + local f23_local1 + if f23_local0 ~= "sotf" and f23_local0 ~= "sotf_ffa" and f23_local0 ~= "infect" and f23_local0 ~= "gun" and f23_local0 ~= "horde" then + f23_local1 = false + else + f23_local1 = true + end + return f23_local1 +end + diff --git a/lui/hudmanager.dec.lua b/lui/hudmanager.dec.lua new file mode 100644 index 0000000..8127502 --- /dev/null +++ b/lui/hudmanager.dec.lua @@ -0,0 +1,215 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +require( "LUI.CoD" ) +if Engine.HasSpeechFeature() then + require( "LUI.Speech" ) +end +f0_local0 = nil +function new() + local f1_local0 = {} + setmetatable( f1_local0, { + __index = _M + } ) + return f1_local0 +end + +function setupRoot( f2_arg0, f2_arg1 ) + f2_arg1:registerEventHandler( "init_hud", hudRootEventHandler( initHud ) ) + f2_arg1:registerEventHandler( "close_hud", closeHudHandler ) + f2_arg1:registerEventHandler( "intermission_began", hudRootEventHandler( beginIntermission ) ) + f2_arg1:registerEventHandler( "post_game_begin", hudRootEventHandler( openRoundEndScreen ) ) + f2_arg1:registerEventHandler( "round_end_show", hudRootEventHandler( openRoundEndScreen ) ) + f2_arg1:registerEventHandler( "show_host_migration", showHostMigrationHandler ) +end + +function registerHud( f3_arg0 ) + f0_local0 = f3_arg0 +end + +function initHud( f4_arg0, f4_arg1, f4_arg2 ) + if not f0_local0 then + return + elseif not f4_arg0.hudContainer then + f4_arg0.hudContainer = LUI.UIElement.new( { + left = 0, + right = 0, + top = 0, + bottom = 0, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true + } ) + f4_arg0.hudContainer.id = "hudContainer" + local f4_local0 = function () + + end + + f4_arg0.hudContainer:registerEventHandler( "mousemove", f4_local0 ) + f4_arg0.hudContainer:registerEventHandler( "mousedown", f4_local0 ) + f4_arg0.hudContainer:registerEventHandler( "mouseup", f4_local0 ) + f4_arg0.hudContainer:registerEventHandler( "gamepad_button", f4_local0 ) + f4_arg0.hudContainer:registerEventHandler( "gamepad_sticks", f4_local0 ) + f4_arg0.hudContainer:registerEventHandler( "keybind", f4_local0 ) + f4_arg0.hudContainer:setPriority( LUI.UIRoot.childPriorities.hudContainer ) + f4_arg2:addElement( f4_arg0.hudContainer ) + if not f4_arg2.m_hudElemLayer then + local f4_local1 = LUI.UIElement.new( { + left = 0, + right = 0, + top = 0, + bottom = 0, + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true + } ) + f4_local1:setHudElemLayer() + f4_local1:setPriority( LUI.UIRoot.childPriorities.hudElems ) + f4_arg2:addElement( f4_local1 ) + f4_arg2.m_hudElemLayer = f4_local1 + end + end + if not GameX.GetScreenWidth() then + LUI.UIRoot.ProcessEvent( f4_arg2, { + name = "init_hud" + } ) + return + end + if Engine.IsMultiplayer() and not Engine.HasSnapshot() then + LUI.UIRoot.ProcessEvent( f4_arg2, { + name = "init_hud" + } ) + return + elseif not f4_arg0.hud then + run_gc() + profile.beginuserevent( "hud_create" ) + local f4_local1 = LUI.MenuBuilder.buildMenu( f0_local0 ) + profile.enduserevent( "hud_create" ) + run_gc() + f4_arg0.hud = f4_local1 + f4_arg0.hudContainer.hud = f4_local1 + f4_arg0.hudContainer:addElement( f4_local1 ) + f4_local1:processEvent( { + name = "menu_create", + dispatchChildren = true + } ) + if Engine.HasSpeechFeature() then + Kinect.EnableGlobalGrammars() + end + collectgarbage( "collect" ) + end + local f4_local1 = Engine.IsMultiplayer() + if f4_local1 then + f4_local1 = MLG.IsMLGSpectator() + end + if f4_local1 then + if not f4_arg0.MLGHud then + f4_arg0.MLGHud = LUI.mp_hud.MLGHud.MLGHud( f4_arg0.hudContainer ) + f4_arg0.MLGHud:setPriority( LUI.UIRoot.childPriorities.MLGHud ) + f4_arg2:addElement( f4_arg0.MLGHud ) + f4_arg0.MLGHud:processEvent( { + name = "menu_create", + dispatchChildren = true + } ) + f4_arg0.hudContainer:registerEventHandler( "gamepad_button", LUI.UIElement.GamepadButton ) + end + MLG.SetMLGActiveMenu() + f4_arg0.MLGHud:processEvent( { + name = "init_hud", + dispatchChildren = true + } ) + end +end + +function closeHud( f6_arg0, f6_arg1, f6_arg2 ) + if f6_arg0.hud then + f6_arg0.hud:processEvent( { + name = "menu_close", + dispatchChildren = true + } ) + f6_arg0.hud:close() + f6_arg0.hud = nil + if f6_arg0.hudContainer then + f6_arg0.hudContainer.hud = nil + end + end + if f6_arg0.MLGHud then + f6_arg0.MLGHud:processEvent( { + name = "menu_close", + dispatchChildren = true + } ) + f6_arg0.MLGHud:close() + f6_arg0.MLGHud = nil + end +end + +function closeRoundEndScreen( f7_arg0, f7_arg1, f7_arg2 ) + if f7_arg0.roundEndScreen then + f7_arg0.roundEndScreen:processEvent( { + name = "menu_close" + } ) + f7_arg0.roundEndScreen:close() + f7_arg0.roundEndScreen = nil + end +end + +function endIntermission( f8_arg0, f8_arg1, f8_arg2 ) + if f8_arg0.finalScoresScreen then + f8_arg0.finalScoresScreen:processEvent( { + name = "menu_close" + } ) + f8_arg0.finalScoresScreen:close() + f8_arg0.finalScoresScreen = nil + end +end + +function beginIntermission( f9_arg0, f9_arg1, f9_arg2 ) + f9_arg0:closeHud( f9_arg1, f9_arg2 ) + f9_arg0:closeRoundEndScreen( f9_arg1, f9_arg2 ) + if Engine.GetDvarBool( "squad_match" ) then + Engine.SetDvarBool( "squad_find_match", true ) + Engine.SetDvarBool( "squad_send_results", true ) + Squad.PostMatch( Engine.GetClientMatchData( "alliesScore" ), Engine.GetClientMatchData( "axisScore" ), Engine.GetClientMatchData( "alliesKills" ), Engine.GetClientMatchData( "alliesDeaths" ), false ) + end + if not f9_arg0.finalScoresScreen then + f9_arg0.finalScoresScreen = LUI.MenuBuilder.BuildAddChild( f9_arg2, { + type = "scoreboard" + } ) + f9_arg0.finalScoresScreen:setPriority( LUI.UIRoot.childPriorities.finalScoresScreen ) + end +end + +function openRoundEndScreen( f10_arg0, f10_arg1, f10_arg2 ) + if not f10_arg0.roundEndScreen then + f10_arg0.roundEndScreen = LUI.MenuBuilder.BuildAddChild( f10_arg2, { + type = "roundEndHudDef" + } ) + f10_arg0.roundEndScreen:setPriority( LUI.UIRoot.childPriorities.roundEndHud ) + end +end + +function hudRootEventHandler( f11_arg0 ) + return function ( f12_arg0, f12_arg1 ) + f11_arg0( f12_arg0.hudManager, f12_arg1, f12_arg0 ) + end + +end + +function closeHudHandler( f13_arg0, f13_arg1 ) + local f13_local0 = f13_arg0.hudManager + if f13_local0 then + f13_local0:closeHud( f13_arg1, f13_arg0 ) + f13_local0:endIntermission( f13_arg1, f13_arg0 ) + end +end + +function showHostMigrationHandler( f14_arg0, f14_arg1 ) + LUI.FlowManager.RequestAddMenu( nil, "host_migration_main" ) + f14_arg0:dispatchEventToRoot( { + name = "show_host_migration_triggered" + } ) +end + +LockTable( _M ) diff --git a/lui/lookcontrols.dec.lua b/lui/lookcontrols.dec.lua new file mode 100644 index 0000000..7811f75 --- /dev/null +++ b/lui/lookcontrols.dec.lua @@ -0,0 +1,300 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function SinglePlayerDisableFunction( f1_arg0, f1_arg1 ) + return not Engine.IsMultiplayer() +end + +function GetDisplay( f2_arg0 ) + return Engine.GetBinding( f2_arg0 ) +end + +function bindKey( f3_arg0 ) + Engine.BindKey( f3_arg0 ) +end + +function OptionsWindowRefresh( f4_arg0, f4_arg1 ) + if f4_arg1.source_input == "button_action" or f4_arg1.source_input == "key_bound" then + f4_arg0:processEvent( { + name = "menu_refresh" + } ) + f4_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function OptionsWindowTriggerRefresh( f5_arg0, f5_arg1 ) + f5_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f5_arg1.name, + immediate = true + } ) +end + +function ControlBindFactory( f6_arg0, f6_arg1 ) + return { + type = "UIGenericButton", + id = "bind_" .. f6_arg1, + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( f6_arg0 ), + button_display_func = function ( f7_arg0, f7_arg1 ) + return GetDisplay( f6_arg1 ) + end + , + button_action_func = function ( f8_arg0, f8_arg1 ) + Engine.BindKey( f6_arg1 ) + OptionsWindowTriggerRefresh( f8_arg0, f8_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ), + key_bound = OptionsWindowTriggerRefresh + } + } +end + +function OptionFactory( f9_arg0, f9_arg1, f9_arg2 ) + local f9_local0 = nil + local f9_local1 = 1 + local f9_local2 = Engine.GetDvarType( f9_arg0 ) + if f9_local2 == DvarTypeTable.DvarString then + f9_local0 = Engine.GetDvarString( f9_arg0 ) + elseif f9_local2 == DvarTypeTable.DvarInt then + f9_local0 = Engine.GetDvarInt( f9_arg0 ) + elseif f9_local2 == DvarTypeTable.DvarBool then + f9_local0 = Engine.GetDvarBool( f9_arg0 ) + end + for f9_local6, f9_local7 in pairs( f9_arg2 ) do + if f9_local7.value == f9_local0 then + f9_local1 = f9_local6 + break + end + end + f9_local3 = function ( f10_arg0, f10_arg1 ) + if f9_arg0 == "ui_mousePitch" then + if Engine.GetDvarBool( f9_arg0 ) then + Engine.SetDvarFloat( "m_pitch", MousePitchTable.PitchFloat ) + else + Engine.SetDvarFloat( "m_pitch", -MousePitchTable.PitchFloat ) + end + end + if f9_local2 == DvarTypeTable.DvarString then + Engine.SetDvarString( f9_arg0, f9_arg2[f9_local1].value ) + elseif f9_local2 == DvarTypeTable.DvarInt then + Engine.SetDvarInt( f9_arg0, f9_arg2[f9_local1].value ) + elseif f9_local2 == DvarTypeTable.DvarBool then + Engine.SetDvarBool( f9_arg0, f9_arg2[f9_local1].value ) + end + end + + return { + type = "UIGenericButton", + id = "option_" .. f9_arg0, + properties = { + variant = GenericButtonSettings.Variants.Select, + button_text = Engine.Localize( f9_arg1 ), + button_display_func = function ( f11_arg0, f11_arg1 ) + return Engine.Localize( f9_arg2[f9_local1].text ) + end + , + button_left_func = function ( f12_arg0, f12_arg1 ) + f9_local1 = 1 + (#f9_arg2 + f9_local1 - 1 - 1) % #f9_arg2 + f9_local3( f12_arg0, f12_arg1 ) + end + , + button_right_func = function ( f13_arg0, f13_arg1 ) + f9_local1 = 1 + (f9_local1 - 1 + 1) % #f9_arg2 + f9_local3( f13_arg0, f13_arg1 ) + end + + } + } +end + +function SliderOptionFactory( f14_arg0, f14_arg1, f14_arg2, f14_arg3, f14_arg4, f14_arg5, f14_arg6 ) + local f14_local0 = function ( f15_arg0, f15_arg1, f15_arg2 ) + Engine.SetDvarFloat( f14_arg0, math.min( f15_arg1, math.max( f15_arg0, Engine.GetDvarFloat( f14_arg0 ) + f15_arg2 ) ) ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + end + + return { + type = "UIGenericButton", + id = "options_" .. f14_arg0, + properties = { + button_text = Engine.Localize( f14_arg1 ), + variant = GenericButtonSettings.Variants.Slider, + button_display_func = function ( f16_arg0, f16_arg1 ) + return (Engine.GetDvarFloat( f14_arg0 ) - f14_arg2) / (f14_arg3 - f14_arg2) + end + , + button_left_func = function ( f17_arg0, f17_arg1 ) + f14_local0( f14_arg2, f14_arg3, -f14_arg4 ) + end + , + button_right_func = function ( f18_arg0, f18_arg1 ) + f14_local0( f14_arg2, f14_arg3, f14_arg4 ) + end + , + button_over_func = MBh.EmitEventToRoot( "brightness_over" ), + button_up_func = MBh.EmitEventToRoot( "brightness_up" ) + } + } +end + +function OptionsFeeder( f19_arg0 ) + local f19_local0 = {} + local f19_local1 = {} + Engine.ExecNow( "profile_menuDvarsSetup" ) + f19_local0[#f19_local0 + 1] = SliderOptionFactory( "sensitivity", "@MENU_MOUSE_SENSITIVITY", SliderBounds.MouseSensitivity.Min, SliderBounds.MouseSensitivity.Max, SliderBounds.MouseSensitivity.Step ) + if SinglePlayerDisableFunction() then + f19_local1 = { + { + text = "@LUA_MENU_YES", + value = true + }, + { + text = "@LUA_MENU_NO", + value = false + } + } + else + f19_local1 = { + { + text = "@LUA_MENU_YES", + value = "1" + }, + { + text = "@LUA_MENU_NO", + value = "0" + } + } + end + f19_local0[#f19_local0 + 1] = OptionFactory( "ui_mousePitch", "@MENU_INVERT_MOUSE", f19_local1 ) + f19_local0[#f19_local0 + 1] = OptionFactory( "m_filter", "@MENU_SMOOTH_MOUSE", { + { + text = "@LUA_MENU_YES", + value = true + }, + { + text = "@LUA_MENU_NO", + value = false + } + } ) + f19_local0[#f19_local0 + 1] = OptionFactory( "cl_freelook", "@MENU_FREE_LOOK", { + { + text = "@LUA_MENU_YES", + value = true + }, + { + text = "@LUA_MENU_NO", + value = false + } + } ) + f19_local0[#f19_local0 + 1] = ControlBindFactory( "@MENU_LOOK_UP", "+lookup" ) + f19_local0[#f19_local0 + 1] = ControlBindFactory( "@MENU_LOOK_DOWN", "+lookdown" ) + f19_local0[#f19_local0 + 1] = ControlBindFactory( "@MENU_HOLD_MOUSE_LOOK", "+mlook" ) + f19_local0[#f19_local0 + 1] = ControlBindFactory( "@MENU_CENTER_VIEW", "centerview" ) + return f19_local0 +end + +function OptionsMainCreate( f20_arg0, f20_arg1 ) + f20_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function OptionsMainClose( f21_arg0, f21_arg1 ) + Engine.ExecNow( "profile_menuDvarsFinish" ) + Engine.Exec( "updategamerprofile" ) +end + +function look_controls_vlist() + return { + type = "UIStencil", + children = { + { + type = "UIVerticalList", + childrenFeeder = OptionsFeeder, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -25, + top = 0, + bottom = 0 + } + } + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = GenericMenuDims.menu_left, + right = GenericMenuDims.menu_right_wide, + top = GenericMenuDims.menu_top, + bottom = GenericMenuDims.menu_bottom + } + }, + handlers = { + options_window_refresh = OptionsWindowRefresh + } + } +end + +function look_controls() + return { + type = "UIElement", + id = "look_controls_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = OptionsMainClose + }, + children = { + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_LOOK" ) + } + }, + { + type = "look_controls_vlist", + id = "look_controls_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "look_controls_vlist", look_controls_vlist ) +LUI.MenuBuilder.registerDef( "look_controls", look_controls ) +LockTable( _M ) diff --git a/lui/lui.dec.lua b/lui/lui.dec.lua new file mode 100644 index 0000000..55228dd --- /dev/null +++ b/lui/lui.dec.lua @@ -0,0 +1,289 @@ +LUI = { + roots = {}, + Alignment = { + None = 0, + Left = 1, + Center = 2, + Right = 3, + Top = 4, + Middle = 5, + Bottom = 6 + }, + savedMenuStates = {}, + ActiveScoped = nil +} +if not Engine.IsDevelopmentBuild() then + function print() + + end + + function printf() + + end + +end +LUI.CachedEvents = { + process_events = { + name = "process_events", + immediate = true + }, + transition_complete = { + name = "transistion_complete_default", + lateness = 0 + }, + gamepad_button = { + name = "gamepad_button", + controller = 0, + button = "primary", + down = true, + immediate = true + } +} +function DisableGlobals() + local f3_local0 = getmetatable( _G ) + if not f3_local0 then + f3_local0 = {} + setmetatable( _G, f3_local0 ) + end + f3_local0.__newindex = function ( f4_arg0, f4_arg1, f4_arg2 ) + error( "LUI Error: Tried to create global variable " .. f4_arg1, 2 ) + end + +end + +function LockTable( f5_arg0 ) + local f5_local0 = getmetatable( f5_arg0 ) + if not f5_local0 then + f5_local0 = {} + setmetatable( f5_arg0, f5_local0 ) + end + f5_local0.__newindex = function ( f6_arg0, f6_arg1, f6_arg2 ) + error( "LUI Error: Tried to create module variable " .. f6_arg1, 2 ) + end + +end + +function InheritFrom( f7_arg0 ) + if not f7_arg0 then + error( "LUI Error: Did not specify base class in InheritFrom!" ) + end + local f7_local0 = {} + setmetatable( f7_local0, { + __index = f7_arg0 + } ) + f7_local0.m_eventHandlers = {} + setmetatable( f7_local0.m_eventHandlers, { + __index = f7_arg0.m_eventHandlers + } ) + return f7_local0 +end + +if nil ~= hpairs then + pairs = hpairs +end +LUI.ShallowCopy = function ( f8_arg0 ) + local f8_local0 = {} + for f8_local4, f8_local5 in pairs( f8_arg0 ) do + f8_local0[f8_local4] = f8_local5 + end + return f8_local0 +end + +LUI.ConcatenateToTable = function ( f9_arg0, f9_arg1 ) + if f9_arg1 == nil then + return + end + for f9_local3, f9_local4 in ipairs( f9_arg1 ) do + table.insert( f9_arg0, f9_local4 ) + end +end + +LUI.RemoveSingleItemFromArray = function ( f10_arg0, f10_arg1 ) + for f10_local0 = 1, #f10_arg0, 1 do + if f10_arg0[f10_local0] == f10_arg1 then + table.remove( f10_arg0, f10_local0 ) + break + end + end +end + +LUI.IsItemInArray = function ( f11_arg0, f11_arg1 ) + for f11_local0 = 1, #f11_arg0, 1 do + if f11_arg0[f11_local0] == f11_arg1 then + return true + end + end + return false +end + +LUI.ReverseTable = function ( f12_arg0 ) + local f12_local0 = #f12_arg0 + local f12_local1 = {} + for f12_local5, f12_local6 in ipairs( f12_arg0 ) do + f12_local1[f12_local0 - f12_local5 + 1] = f12_local6 + end + return f12_local1 +end + +LUI.clamp = function ( f13_arg0, f13_arg1, f13_arg2 ) + if f13_arg0 < f13_arg1 then + return f13_arg1 + elseif f13_arg2 < f13_arg0 then + return f13_arg2 + else + return f13_arg0 + end +end + +LUI.FormatAnimStateFinishEvent = function ( f14_arg0 ) + return "transition_complete_" .. f14_arg0 +end + +LUI.MakeFlyOverAnimationState = function ( f15_arg0, f15_arg1 ) + assert( f15_arg0 ) + assert( f15_arg1 ) + local f15_local0, f15_local1, f15_local2, f15_local3 = f15_arg0:getCurrentGlobalRect() + local f15_local4, f15_local5, f15_local6, f15_local7 = f15_arg1:getCurrentGlobalRect() + local f15_local8 = f15_local4 - f15_local0 + local f15_local9 = f15_local6 - f15_local2 + local f15_local10 = f15_local5 - f15_local1 + local f15_local11 = f15_local7 - f15_local3 + local f15_local12, f15_local13, f15_local14, f15_local15 = f15_arg0:getLocalRect() + local f15_local16, f15_local17, f15_local18, f15_local19 = f15_arg0:GetAnchorData() + return { + topAnchor = f15_local17, + bottomAnchor = f15_local19, + leftAnchor = f15_local16, + rightAnchor = f15_local18, + top = f15_local13 + f15_local10, + bottom = f15_local15 + f15_local11, + left = f15_local12 + f15_local8, + right = f15_local14 + f15_local9 + } +end + +LUI.Debug = {} +LargestElements = {} +LargestElementsSize = {} +LargestElementsCount = {} +if debug then + debug.postdeploymentfunction = function () + for f16_local3, f16_local4 in pairs( LUI.roots ) do + f16_local4.debugReload = true + end + end + +end +function LUITestFunction() + DebugPrint( "Running LUITestFunction()" ) +end + +function CountFieldsHelper( f18_arg0, f18_arg1 ) + if f18_arg1[f18_arg0] then + return + end + f18_arg1[f18_arg0] = true + local f18_local0 = 0 + for f18_local4, f18_local5 in pairs( f18_arg0 ) do + if type( f18_local4 ) == "table" then + f18_local0 = f18_local0 + CountFieldsHelper( f18_local4, f18_arg1 ) + end + f18_local0 = f18_local0 + 1 + end + return f18_local0 +end + +function CountFields( f19_arg0 ) + return CountFieldsHelper( f19_arg0, {} ) +end + +function CountReferencesHelper( f20_arg0, f20_arg1 ) + if f20_arg1[f20_arg0] then + return + end + f20_arg1[f20_arg0] = true + if type( f20_arg0 ) == "userdata" then + local f20_local0 = getmetatable( f20_arg0 ) + if not f20_local0 then + return + end + f20_arg0 = f20_local0.__index + if not f20_arg0 then + return + elseif type( f20_arg0 ) == "table" and f20_arg0.id then + local f20_local1 = CountFields( f20_arg0 ) + if not LargestElementsSize[f20_arg0.id] or LargestElementsSize[f20_arg0.id] < f20_local1 then + LargestElements[f20_arg0.id] = f20_arg0 + LargestElementsSize[f20_arg0.id] = f20_local1 + end + if not LargestElementsCount[f20_arg0.id] then + LargestElementsCount[f20_arg0.id] = 0 + end + LargestElementsCount[f20_arg0.id] = LargestElementsCount[f20_arg0.id] + 1 + end + end + if type( f20_arg0 ) ~= "table" then + return + end + for f20_local3, f20_local4 in pairs( f20_arg0 ) do + CountReferencesHelper( f20_local4, f20_arg1 ) + end +end + +function CountReferences( f21_arg0 ) + local f21_local0 = { + [f21_arg0] = true + } + if type( f21_arg0 ) == "userdata" then + local f21_local1 = getmetatable( f21_arg0 ) + if not f21_local1 then + return 0 + end + f21_arg0 = f21_local1.__index + if not f21_arg0 then + return 0 + end + end + if type( f21_arg0 ) ~= "table" then + return 0 + end + for f21_local4, f21_local5 in pairs( f21_arg0 ) do + CountReferencesHelper( f21_local5, f21_local0 ) + end + f21_local1 = 0 + for f21_local5, f21_local6 in pairs( f21_local0 ) do + f21_local1 = f21_local1 + 1 + end + return f21_local1 +end + +require( "LUI.LUIElement" ) +require( "LUI.LUIRoot" ) +require( "LUI.LUITimer" ) +require( "LUI.LUIButtonRepeater" ) +require( "LUI.LUIImage" ) +require( "LUI.LUILitImage" ) +require( "LUI.LUIText" ) +require( "LUI.LUIAnimNumber" ) +require( "LUI.LUITightText" ) +require( "LUI.LUIButton" ) +require( "LUI.LUIBindButton" ) +require( "LUI.LUIMouseCursor" ) +require( "LUI.LUIVerticalList" ) +require( "LUI.LUIScrollingVerticalList" ) +require( "LUI.LUIHorizontalList" ) +require( "LUI.LUIBarrelList" ) +require( "LUI.LUIGrid" ) +require( "LUI.LUIScrollable" ) +require( "LUI.LUIVerticalScrollbar" ) +require( "LUI.LUISafeAreaOverlay" ) +require( "LUI.LUICountdown" ) +require( "LUI.LUILongCountdown" ) +require( "LUI.LUITechyDigits" ) +require( "LUI.LUIPrettyNumber" ) +require( "LUI.LUICharacterWindow" ) +require( "LUI.FlowManager" ) +require( "LUI.HudManager" ) +require( "LUI.MenuBuilder" ) +require( "LUI.LUIMarqueeText" ) +MBh = LUI.MenuBuilder.helpers diff --git a/lui/luianimnumber.dec.lua b/lui/luianimnumber.dec.lua new file mode 100644 index 0000000..5307f4f --- /dev/null +++ b/lui/luianimnumber.dec.lua @@ -0,0 +1,56 @@ +LUI.UIAnimNumber = {} +LUI.UIAnimNumber.new = function ( f1_arg0 ) + local self = LUI.UIText.new( f1_arg0 ) + self.setNumber = LUI.UIAnimNumber.SetNumber + self.setLocalizedString = LUI.UIAnimNumber.SetLocalizedString + self.layout = LUI.UIAnimNumber.Layout + return self +end + +LUI.UIAnimNumber.SetNumber = function ( f2_arg0, f2_arg1, f2_arg2 ) + if f2_arg2 == nil or f2_arg0.currentNumber == nil then + f2_arg0.currentNumber = f2_arg1 + f2_arg0:setText( f2_arg1 ) + return + else + f2_arg0.startingNumber = f2_arg0.currentNumber + f2_arg0.numberChange = f2_arg1 - f2_arg0.startingNumber + f2_arg0.timeLeft = f2_arg2 + f2_arg0.duration = f2_arg2 + f2_arg0:setLayoutCached( false ) + end +end + +LUI.UIAnimNumber.SetLocalizedString = function ( f3_arg0, f3_arg1 ) + f3_arg0.localizedString = f3_arg1 +end + +LUI.UIAnimNumber.Layout = function ( f4_arg0, f4_arg1 ) + local f4_local0 = true + if f4_arg0.timeLeft ~= nil then + local f4_local1 = f4_arg0.timeLeft - f4_arg1.deltaTime + local f4_local2 = nil + if f4_local1 < 0 then + f4_local2 = f4_arg0.startingNumber + f4_arg0.numberChange + f4_arg0.startingNumber = nil + f4_arg0.numberChange = nil + f4_arg0.timeLeft = nil + f4_arg0.duration = nil + else + f4_arg0.timeLeft = f4_local1 + f4_local2 = math.floor( f4_arg0.startingNumber + f4_arg0.numberChange * (1 - f4_local1 / f4_arg0.duration) + 0.5 ) + end + local f4_local3 = f4_arg0.localizedString + if f4_local3 ~= nil then + f4_arg0:setText( Engine.Localize( f4_local3, f4_local2 ) ) + else + f4_arg0:setText( f4_local2 ) + end + f4_arg0.currentNumber = f4_local2 + f4_local0 = false + end + f4_local0 = f4_arg0:updateElementLayout( f4_arg1 ) and f4_local0 + f4_arg0:layoutChildren( f4_arg1 ) + f4_arg0:setLayoutCached( f4_local0 ) +end + diff --git a/lui/luibarrellist.dec.lua b/lui/luibarrellist.dec.lua new file mode 100644 index 0000000..0871d94 --- /dev/null +++ b/lui/luibarrellist.dec.lua @@ -0,0 +1,295 @@ +LUI.UIBarrelList = {} +LUI.UIBarrelList.build = function ( f1_arg0, f1_arg1 ) + return LUI.UIBarrelList.new( nil, f1_arg1 ) +end + +LUI.UIBarrelList.new = function ( menu, controller ) + local self = LUI.UIElement.new( menu ) + self.id = "UIBarrelList" + if not controller then + controller = {} + end + self.animSpeed = controller.anim_speed or 60 + self.listOffset = controller.list_offset or 0 + self.onUpdateFunc = controller.on_update_func + self.onScrollFunc = controller.on_scroll_func + + local hList = LUI.UIHorizontalList.new( menu ) + hList:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = self.listOffset, + spacing = controller.spacing or 0 + } ) + hList:animateToState( "default" ) + self:addElement( hList ) + self.hList = hList + + self:registerEventHandler( "gain_focus", LUI.UIBarrelList.gainFocus ) + self.addElement = LUI.UIBarrelList.AddElement + self.removeElement = LUI.UIBarrelList.RemoveElement + self.increment = LUI.UIBarrelList.IncrementIndex + self.decrement = LUI.UIBarrelList.DecrementIndex + self.getCurrentIndex = LUI.UIBarrelList.GetCurrentIndex + self.handleGamepadButton = LUI.UIBarrelList.handleGamepadButton + self.setupForAnimation = LUI.UIBarrelList.SetupForAnimation + self.manualUpdate = LUI.UIBarrelList.UpdateList + self:makeFocusable() + self.currentIndex = 0 + return self +end + +LUI.UIBarrelList.AddElement = function ( f3_arg0, f3_arg1 ) + if f3_arg0.usingAnimation then + DebugPrint( "WARNING: Adding an element after the BarrelList has been setup for animation! Cap positions will be wrong and animation will look broken!" ) + end + f3_arg0.hList:addElement( f3_arg1 ) + LUI.UIBarrelList.UpdateList( f3_arg0 ) +end + +LUI.UIBarrelList.RemoveElement = function ( f4_arg0, f4_arg1 ) + if f4_arg0.usingAnimation then + DebugPrint( "WARNING: Removing an element after the BarrelList has been setup for animation! Cap positions will be wrong and animation will look broken!" ) + end + f4_arg0.hList:removeElement( f4_arg1 ) + LUI.UIBarrelList.UpdateList( f4_arg0 ) +end + +LUI.UIBarrelList.UpdateList = function ( f5_arg0 ) + local f5_local0 = f5_arg0.hList:getNumChildren() + local f5_local1 = f5_arg0.hList:getFirstChild() + local f5_local2 = math.floor( f5_local0 / 2 ) + for f5_local3 = 0, f5_local0 - 1, 1 do + f5_local1:processEvent( { + name = "barrel_index_update", + index = f5_arg0.currentIndex - f5_local2 - f5_local3 + } ) + f5_local1 = f5_local1:getNextSibling() + end + if f5_arg0.onUpdateFunc then + f5_arg0:onUpdateFunc( f5_arg0.currentIndex ) + end + return false +end + +LUI.UIBarrelList.gainFocus = function ( f6_arg0 ) + f6_arg0:setFocus( true ) + local f6_local0 = f6_arg0.hList:getNumChildren() + local f6_local1 = f6_arg0.hList:getFirstChild() + local f6_local2 = math.floor( f6_local0 / 2 ) + for f6_local3 = 1, f6_local2, 1 do + local f6_local6 = f6_local3 + f6_local1 = f6_local1:getNextSibling() + end + f6_arg0.focusedChild = f6_local1 + f6_local1:processEvent( { + name = "barrel_list_focus" + } ) + return true +end + +LUI.UIBarrelList.handleGamepadButton = function ( f7_arg0, f7_arg1 ) + if not f7_arg0:isInFocus() or not f7_arg1.down then + return false + end + local f7_local0 = false + if f7_arg1.button == "primary" then + if not f7_arg0.isAnimating then + f7_arg0.focusedChild:processEvent( { + name = "barrel_list_action", + index = f7_arg0.currentIndex, + controller = f7_arg1.controller + } ) + end + f7_local0 = true + elseif f7_arg1.button == "left" then + if not f7_arg0.isAnimating then + LUI.UIBarrelList.DecrementIndex( f7_arg0 ) + end + f7_local0 = true + elseif f7_arg1.button == "right" then + if not f7_arg0.isAnimating then + LUI.UIBarrelList.IncrementIndex( f7_arg0 ) + end + f7_local0 = true + elseif f7_arg1.button == "alt1" then + if not f7_arg0.isAnimating then + f7_arg0.focusedChild:processEvent( { + name = "barrel_list_button_alt1", + index = f7_arg0.currentIndex, + controller = f7_arg1.controller + } ) + end + f7_local0 = true + end + return f7_local0 +end + +LUI.UIBarrelList.IncrementIndex = function ( f8_arg0 ) + f8_arg0.currentIndex = f8_arg0.currentIndex + 1 + if f8_arg0.usingAnimation then + f8_arg0:animateToState( "shift_left", f8_arg0.animSpeed, true, true ) + f8_arg0.rightCap:processEvent( { + name = "barrel_index_update", + index = f8_arg0.currentIndex + math.floor( f8_arg0.hList:getNumChildren() / 2 ), + barrelList = f8_arg0 + } ) + f8_arg0:dispatchEventToChildren( { + name = "barrel_anim_start", + barrelList = f8_arg0, + movingLeft = true + } ) + if f8_arg0.onScrollFunc then + f8_arg0:onScrollFunc() + end + f8_arg0:dispatchEventToChildren( { + name = "barrel_list_unfocus" + } ) + f8_arg0.isAnimating = true + else + LUI.UIBarrelList.UpdateList( f8_arg0 ) + end +end + +LUI.UIBarrelList.DecrementIndex = function ( f9_arg0 ) + f9_arg0.currentIndex = f9_arg0.currentIndex - 1 + if f9_arg0.usingAnimation then + f9_arg0:animateToState( "shift_right", f9_arg0.animSpeed, true, true ) + f9_arg0.leftCap:processEvent( { + name = "barrel_index_update", + index = f9_arg0.currentIndex - math.floor( f9_arg0.hList:getNumChildren() / 2 ), + barrelList = f9_arg0 + } ) + f9_arg0:dispatchEventToChildren( { + name = "barrel_anim_start", + barrelList = f9_arg0, + movingRight = true + } ) + if f9_arg0.onScrollFunc then + f9_arg0:onScrollFunc() + end + f9_arg0:dispatchEventToChildren( { + name = "barrel_list_unfocus" + } ) + f9_arg0.isAnimating = true + else + LUI.UIBarrelList.UpdateList( f9_arg0 ) + end +end + +LUI.UIBarrelList.GetCurrentIndex = function ( f10_arg0 ) + return f10_arg0.currentIndex +end + +LUI.UIBarrelList.ScrollFinished = function ( f11_arg0, f11_arg1 ) + f11_arg0:animateToState( "default", 0 ) + f11_arg0.isAnimating = false +end + +LUI.UIBarrelList.OnDefaultState = function ( f12_arg0, f12_arg1 ) + local f12_local0 = f12_arg0.hList:getNumChildren() + local f12_local1 = f12_arg0.hList:getFirstChild() + local f12_local2 = math.floor( f12_local0 / 2 ) + for f12_local3 = 0, f12_local0 - 1, 1 do + if f12_local3 == f12_local2 then + f12_local1:processEvent( { + name = "barrel_list_focus" + } ) + end + f12_local1 = f12_local1:getNextSibling() + end + LUI.UIBarrelList.UpdateList( f12_arg0 ) + f12_arg0:dispatchEventToChildren( { + name = "barrel_default_state" + } ) +end + +LUI.UIBarrelList.CreateCap = function ( f13_arg0, f13_arg1, f13_arg2, f13_arg3, f13_arg4, f13_arg5, f13_arg6, f13_arg7, f13_arg8 ) + local f13_local0 = f13_arg0( f13_arg2 ) + f13_local0.id = f13_arg1 + f13_local0:registerAnimationState( "default", { + topAnchor = f13_arg7.topAnchor, + bottomAnchor = f13_arg7.bottomAnchor, + leftAnchor = f13_arg7.leftAnchor, + rightAnchor = f13_arg7.rightAnchor, + top = f13_arg3, + bottom = f13_arg4, + left = f13_arg5, + right = f13_arg6 + } ) + f13_local0:animateToState( "default", 0 ) + for f13_local4, f13_local5 in pairs( f13_arg8 ) do + f13_local0:registerEventHandler( f13_local4, f13_local5 ) + end + return f13_local0 +end + +LUI.UIBarrelList.SetupForAnimation = function ( f14_arg0, f14_arg1, f14_arg2, f14_arg3 ) + local f14_local0 = f14_arg0.hList:getNumChildren() + local f14_local1 = f14_arg0.hList:getFirstChild() + local f14_local2 = f14_local1.properties + if f14_arg3 then + f14_arg0:setUseStencil( false ) + else + f14_arg0:setUseStencil( true ) + end + if f14_arg2 then + for f14_local6, f14_local7 in pairs( f14_arg2 ) do + f14_local2[f14_local6] = f14_local7 + end + end + local f14_local3, f14_local4, f14_local5, f14_local6 = f14_local1:getLocalRect() + local f14_local7, f14_local8, f14_local9, f14_local10 = f14_local1:GetAnchorData() + local f14_local11 = { + leftAnchor = f14_local7, + topAnchor = f14_local8, + rightAnchor = f14_local9, + bottomAnchor = f14_local10 + } + local f14_local12 = f14_local5 - f14_local3 + local f14_local13 = -(f14_local12 + f14_arg0.properties.spacing + f14_arg0.listOffset) + f14_arg0.leftCap = LUI.UIBarrelList.CreateCap( f14_arg1, "barrel_left_cap_id", f14_local2, f14_local4, f14_local6, f14_local13, f14_local13 + f14_local12, f14_local11, f14_local1.m_eventHandlers ) + f14_local13 = (f14_local12 + f14_arg0.properties.spacing) * f14_local0 + f14_arg0.listOffset + f14_arg0.rightCap = LUI.UIBarrelList.CreateCap( f14_arg1, "barrel_right_cap_id", f14_local2, f14_local4, f14_local6, f14_local13, f14_local13 + f14_local12, f14_local11, f14_local1.m_eventHandlers ) + LUI.UIElement.addElement( f14_arg0, f14_arg0.leftCap ) + LUI.UIElement.addElement( f14_arg0, f14_arg0.rightCap ) + f14_local3, f14_local4, f14_local5, f14_local6 = f14_arg0:getLocalRect() + f14_local7, f14_local8, f14_local9, f14_local10 = f14_arg0:GetAnchorData() + local f14_local14 = f14_arg0 + local f14_local15 = f14_arg0.registerAnimationState + local f14_local16 = "shift_right" + local f14_local17 = { + topAnchor = f14_local8, + bottomAnchor = f14_local10, + leftAnchor = f14_local7 + } + local f14_local18 = f14_local9 + f14_local17.top = f14_local4 + f14_local17.bottom = f14_local6 + f14_local17.left = f14_local3 + f14_local12 + f14_arg0.properties.spacing + f14_local17.right = 0 + f14_local17[1] = f14_local18 + f14_local15( f14_local14, f14_local16, f14_local17 ) + f14_local14 = f14_arg0 + f14_local15 = f14_arg0.registerAnimationState + f14_local16 = "shift_left" + f14_local17 = { + topAnchor = f14_local8, + bottomAnchor = f14_local10, + leftAnchor = f14_local7 + } + f14_local18 = f14_local9 + f14_local17.top = f14_local4 + f14_local17.bottom = f14_local6 + f14_local17.left = f14_local3 - f14_local12 - f14_arg0.properties.spacing + f14_local17.right = 0 + f14_local17[1] = f14_local18 + f14_local15( f14_local14, f14_local16, f14_local17 ) + f14_arg0:registerEventHandler( "transition_complete_shift_left", LUI.UIBarrelList.ScrollFinished ) + f14_arg0:registerEventHandler( "transition_complete_shift_right", LUI.UIBarrelList.ScrollFinished ) + f14_arg0:registerEventHandler( "transition_complete_default", LUI.UIBarrelList.OnDefaultState ) + f14_arg0.usingAnimation = true +end + diff --git a/lui/luibindbutton.dec.lua b/lui/luibindbutton.dec.lua new file mode 100644 index 0000000..63512f8 --- /dev/null +++ b/lui/luibindbutton.dec.lua @@ -0,0 +1,105 @@ +LUI.UIBindButton = {} +LUI.UIBindButton.GamepadButton = function ( f1_arg0, f1_arg1 ) + if f1_arg0:handleGamepadButton( f1_arg1 ) then + return true + elseif f1_arg0.m_ownerController ~= nil and f1_arg0.m_ownerController ~= f1_arg1.controller then + DebugPrint( "Item Exclusive to controller " .. f1_arg1.controller ) + return false + elseif f1_arg1.down == true then + local f1_local0 = false + local f1_local1 = { + controller = f1_arg1.controller, + qualifier = f1_arg1.qualifier + } + if not f1_arg0.disabled then + f1_local0 = true + if f1_arg1.button == "secondary" then + f1_local1.name = "button_secondary" + elseif f1_arg1.button == "alt1" then + f1_local1.name = "button_alt1" + elseif f1_arg1.button == "alt2" then + f1_local1.name = "button_alt2" + elseif f1_arg1.button == "right_trigger" then + f1_local1.name = "button_right_trigger" + elseif f1_arg1.button == "left_trigger" then + f1_local1.name = "button_left_trigger" + elseif f1_arg1.button == "shoulderr" then + f1_local1.name = "button_shoulderr" + elseif f1_arg1.button == "shoulderl" then + f1_local1.name = "button_shoulderl" + elseif f1_arg1.button == "right_stick" then + f1_local1.name = "button_right_stick" + elseif f1_arg1.button == "left_stick" then + f1_local1.name = "button_left_stick" + elseif f1_arg1.button == "left" then + f1_local1.name = "button_left" + elseif f1_arg1.button == "right" then + f1_local1.name = "button_right" + elseif f1_arg1.button == "up" then + f1_local1.name = "button_up" + elseif f1_arg1.button == "down" then + f1_local1.name = "button_down" + elseif f1_arg1.button == "start" then + f1_local1.name = "button_start" + elseif f1_arg1.button == "select" then + f1_local1.name = "button_select" + elseif f1_arg1.button == "options" then + f1_local1.name = "button_options" + else + f1_local0 = false + end + end + if f1_local0 and f1_arg0:processEvent( f1_local1 ) then + if f1_arg0.actionSFX then + Engine.PlaySound( f1_arg0.actionSFX ) + end + return true + end + end + return f1_arg0:dispatchEventToChildren( f1_arg1 ) +end + +LUI.UIBindButton.ElementEnable = function ( f2_arg0, f2_arg1 ) + f2_arg0.disabled = nil +end + +LUI.UIBindButton.ElementDisable = function ( f3_arg0, f3_arg1 ) + f3_arg0.disabled = true +end + +LUI.UIBindButton.Enable = function ( f4_arg0 ) + f4_arg0:processEvent( { + name = "enable", + dispatchChildren = true + } ) +end + +LUI.UIBindButton.Disable = function ( f5_arg0 ) + f5_arg0:processEvent( { + name = "disable", + dispatchChildren = true + } ) +end + +LUI.UIBindButton.SetActionSFX = function ( f6_arg0, f6_arg1 ) + f6_arg0.actionSFX = f6_arg1 +end + +LUI.UIBindButton.build = function ( f7_arg0, f7_arg1 ) + return LUI.UIBindButton.new() +end + +LUI.UIBindButton.new = function ( menu, controller ) + local self = LUI.UIElement.new( menu ) + self.id = "LUIBindButton" + self.enable = LUI.UIBindButton.Enable + self.disable = LUI.UIBindButton.Disable + self.setActionSFX = LUI.UIBindButton.SetActionSFX + self:registerEventHandlerIfFree( "enable", LUI.UIBindButton.ElementEnable ) + self:registerEventHandlerIfFree( "disable", LUI.UIBindButton.ElementDisable ) + self:registerEventHandlerIfFree( "popup_active", LUI.UIBindButton.ElementDisable ) + self:registerEventHandlerIfFree( "popup_inactive", LUI.UIBindButton.ElementEnable ) + self:registerEventHandler( "gamepad_button", LUI.UIBindButton.GamepadButton ) + return self +end + diff --git a/lui/luibutton.dec.lua b/lui/luibutton.dec.lua new file mode 100644 index 0000000..3313ff0 --- /dev/null +++ b/lui/luibutton.dec.lua @@ -0,0 +1,415 @@ +LUI.UIButton = {} +LUI.UIButton.popupActive = function ( f1_arg0, f1_arg1 ) + f1_arg0.m_ignoreMouseFocus = true +end + +LUI.UIButton.popupInactive = function ( f2_arg0, f2_arg1 ) + f2_arg0.m_ignoreMouseFocus = nil +end + +LUI.UIButton.MouseEnter = function ( f3_arg0, f3_arg1 ) + if f3_arg0.m_leftMouseDown == nil then + if f3_arg0:canFocus( FocusType.MouseOver ) and not f3_arg0:isInFocus() then + if f3_arg0.disabled then + f3_arg0:processEvent( { + name = "button_over_disable" + } ) + else + f3_arg0:processEvent( { + name = "button_over", + controller = f3_arg1.controller + } ) + end + end + elseif f3_arg0.m_leftMouseDown ~= nil then + f3_arg0:processEvent( { + name = "button_over_down" + } ) + end +end + +LUI.UIButton.MouseLeave = function ( f4_arg0, f4_arg1 ) + if f4_arg0.m_leftMouseDown == nil then + if f4_arg0.m_focusable and not f4_arg0:isInFocus() then + if f4_arg0.disabled then + f4_arg0:processEvent( { + name = "button_disable" + } ) + else + f4_arg0:processEvent( { + name = "button_up" + } ) + end + end + else + f4_arg0:processEvent( { + name = "button_down" + } ) + end +end + +LUI.UIButton.LeftMouseDown = function ( f5_arg0, f5_arg1 ) + f5_arg0:processEvent( { + name = "button_over_down" + } ) +end + +LUI.UIButton.RightMouseDown = function ( f6_arg0, f6_arg1 ) + f6_arg0:processEvent( { + name = "button_over_down" + } ) +end + +LUI.UIButton.LeftMouseUp = function ( f7_arg0, f7_arg1 ) + if f7_arg1.inside then + if f7_arg0.disabled then + f7_arg0:processEvent( { + name = "button_over_disable" + } ) + else + f7_arg0:processEvent( { + name = "button_over", + controller = f7_arg1.controller, + focusType = FocusType.MouseOver + } ) + end + if not f7_arg0.disabled then + if not f7_arg0.properties or not f7_arg0.properties.muteAction then + Engine.PlaySound( f7_arg0.actionSFX ) + end + local f7_local0 = f7_arg0:processEvent( { + name = "button_action", + controller = f7_arg1.controller, + mouse = true + } ) + f7_arg0:processEvent( { + name = "button_down", + controller = f7_arg1.controller, + mouse = true + } ) + if f7_local0 then + return f7_local0 + end + elseif f7_arg0.properties and f7_arg0.properties.disableSound then + Engine.PlaySound( f7_arg0.properties.disableSound ) + end + if f7_arg0.properties and f7_arg0.properties.allowDisabledAction then + f7_arg0:processEvent( { + name = "button_action_disable", + controller = f7_arg1.controller + } ) + end + elseif not f7_arg0.disabled then + f7_arg0:processEvent( { + name = "button_up" + } ) + end +end + +LUI.UIButton.RightMouseUp = function ( f8_arg0, f8_arg1 ) + if f8_arg1.inside then + if f8_arg0.disabled then + f8_arg0:processEvent( { + name = "button_over_disable", + controller = f8_arg1.controller + } ) + else + f8_arg0:processEvent( { + name = "button_over", + controller = f8_arg1.controller + } ) + end + if not f8_arg0.disabled then + local f8_local0 = f8_arg0:processEvent( { + name = "button_actionsecondary", + controller = f8_arg1.controller, + mouse = true + } ) + if f8_local0 then + return f8_local0 + end + end + else + f8_arg0:processEvent( { + name = "button_up" + } ) + end +end + +LUI.UIButton.excludeButtons = { + secondary = true, + alt1 = true, + alt2 = true, + right_trigger = true, + left_trigger = true, + shoulderl = true, + shoulderr = true, + start = true +} +LUI.UIButton.GamepadButton = function ( f9_arg0, f9_arg1 ) + if f9_arg0:handleGamepadButton( f9_arg1 ) then + return true + elseif f9_arg0:isInFocus() and f9_arg1.down == true then + if f9_arg1.button == "primary" then + if not f9_arg0.properties or not f9_arg0.properties.muteAction then + Engine.PlaySound( f9_arg0.actionSFX ) + end + if not f9_arg0.disabled then + local f9_local0 + if not f9_arg1.qualifier or f9_arg1.qualifier ~= ButtonQualifiers.Keyboard then + f9_local0 = false + else + f9_local0 = true + end + f9_arg0:processEvent( { + name = "button_action", + controller = f9_arg1.controller, + keyboard = f9_local0 + } ) + f9_arg0:processEvent( { + name = "button_down", + controller = f9_arg1.controller, + keyboard = f9_local0 + } ) + else + if f9_arg0.properties and f9_arg0.properties.disableSound then + Engine.PlaySound( f9_arg0.properties.disableSound ) + end + if f9_arg0.properties and f9_arg0.properties.allowDisabledAction then + f9_arg0:processEvent( { + name = "button_action_disable", + controller = f9_arg1.controller + } ) + end + end + if f9_arg0.m_eventHandlers.button_action ~= nil then + return true + end + elseif f9_arg1.button == "left" then + if not f9_arg0.disabled then + f9_arg0:processEvent( { + name = "button_left", + controller = f9_arg1.controller + } ) + end + if f9_arg0.m_eventHandlers.button_left ~= nil then + return true + end + elseif f9_arg1.button == "right" then + if not f9_arg0.disabled then + f9_arg0:processEvent( { + name = "button_right", + controller = f9_arg1.controller + } ) + end + if f9_arg0.m_eventHandlers.button_right ~= nil then + return true + end + elseif LUI.UIButton.excludeButtons[f9_arg1.button] and f9_arg0.m_eventHandlers["button_" .. f9_arg1.button] ~= nil then + DebugPrint( "Warning: event handler specified for button_" .. f9_arg1.button .. " on a UIButton id = " .. f9_arg0.id .. ", this won't work anymore, use a UIBindButton" ) + end + end + return f9_arg0:dispatchEventToChildren( f9_arg1 ) +end + +LUI.UIButton.gainFocus = function ( f10_arg0, f10_arg1 ) + local f10_local0 = f10_arg0:isInFocus() + LUI.UIElement.gainFocus( f10_arg0, f10_arg1 ) + if not f10_local0 and f10_arg0:isInFocus() and f10_arg0.gainFocusSFX ~= nil and f10_arg1.focusType ~= FocusType.MenuFlow then + Engine.PlaySound( f10_arg0.gainFocusSFX ) + end + if f10_arg0.disabled then + f10_arg0:processEvent( { + name = "button_over_disable", + dispatchChildren = true, + focusType = f10_arg1.focusType + } ) + else + f10_arg0:processEvent( { + name = "button_over", + controller = f10_arg1.controller, + dispatchChildren = true, + focusType = f10_arg1.focusType + } ) + end +end + +LUI.UIButton.loseFocus = function ( f11_arg0, f11_arg1 ) + LUI.UIElement.loseFocus( f11_arg0, f11_arg1 ) + if f11_arg0.disabled then + f11_arg0:processEvent( { + name = "button_disable", + dispatchChildren = true + } ) + else + f11_arg0:processEvent( { + name = "button_up", + dispatchChildren = true + } ) + end +end + +LUI.UIButton.Up = function ( f12_arg0, f12_arg1 ) + f12_arg0:dispatchEventToChildren( f12_arg1 ) + if f12_arg0:isInFocus() then + f12_arg0:processEvent( { + name = "gain_focus" + } ) + end +end + +LUI.UIButton.Over = function ( f13_arg0, f13_arg1 ) + if f13_arg0.disabled and f13_arg0:hasAnimationState( "button_over_disabled" ) then + f13_arg0:animateToState( "button_over_disabled", f13_arg0.disableDuration ) + elseif f13_arg0:hasAnimationState( "button_over" ) then + f13_arg0:animateToState( "button_over", f13_arg0.overDuration, f13_arg0.overEaseIn, f13_arg0.overEaseOut ) + end +end + +LUI.UIButton.ElementUp = function ( f14_arg0, f14_arg1 ) + +end + +LUI.UIButton.ElementDown = function ( f15_arg0, f15_arg1 ) + if f15_arg0:hasAnimationState( "button_down" ) then + f15_arg0:animateToState( "button_down", f15_arg0.downDuration ) + else + LUI.UIButton.ElementUp( f15_arg0, f15_arg1 ) + end + f15_arg0:dispatchEventToChildren( f15_arg1 ) +end + +LUI.UIButton.ElementOverDown = function ( f16_arg0, f16_arg1 ) + if f16_arg0:hasAnimationState( "button_over_down" ) then + f16_arg0:animateToState( "button_over_down", f16_arg0.overDownDuration ) + else + LUI.UIButton.Over( f16_arg0, f16_arg1 ) + end + f16_arg0:dispatchEventToChildren( f16_arg1 ) +end + +LUI.UIButton.ElementEnable = function ( f17_arg0, f17_arg1 ) + f17_arg0.disabled = nil + f17_arg0:dispatchEventToChildren( f17_arg1 ) + if f17_arg0:isInFocus() then + f17_arg0:processEvent( { + name = "button_over", + dispatchChildren = true, + controller = f17_arg1.controller + } ) + else + f17_arg0:processEvent( { + name = "button_up", + dispatchChildren = true + } ) + end +end + +LUI.UIButton.ElementDisable = function ( f18_arg0, f18_arg1 ) + f18_arg0.disabled = true + f18_arg0:dispatchEventToChildren( f18_arg1 ) + if f18_arg0:isInFocus() then + f18_arg0:processEvent( { + name = "button_over_disable", + dispatchChildren = true + } ) + else + f18_arg0:processEvent( { + name = "button_disable", + dispatchChildren = true + } ) + end +end + +LUI.UIButton.UpdateOutsideList = function ( f19_arg0, f19_arg1 ) + f19_arg0.m_outsideParentList = f19_arg1.outside_list +end + +LUI.UIButton.Enable = function ( f20_arg0, f20_arg1 ) + f20_arg0:processEvent( { + name = "enable", + dispatchChildren = true + } ) + if f20_arg0:isInFocus() then + f20_arg0:processEvent( { + name = "button_over", + dispatchChildren = true, + controller = f20_arg1.controller + } ) + else + f20_arg0:processEvent( { + name = "button_up", + dispatchChildren = true + } ) + end +end + +LUI.UIButton.Disable = function ( f21_arg0 ) + f21_arg0:processEvent( { + name = "disable", + dispatchChildren = true + } ) + if f21_arg0:isInFocus() then + f21_arg0:processEvent( { + name = "button_over_disable", + dispatchChildren = true + } ) + else + f21_arg0:processEvent( { + name = "button_disable", + dispatchChildren = true + } ) + end +end + +LUI.UIButton.SetupElement = function ( f22_arg0 ) + f22_arg0:registerEventHandlerIfFree( "enable", LUI.UIButton.ElementEnable ) + f22_arg0:registerEventHandlerIfFree( "disable", LUI.UIButton.ElementDisable ) + f22_arg0:registerEventHandlerIfFree( "button_up", LUI.UIButton.Up ) + f22_arg0:registerEventHandlerIfFree( "button_over", LUI.UIButton.Over ) + f22_arg0:registerEventHandlerIfFree( "button_down", LUI.UIButton.ElementDown ) + f22_arg0:registerEventHandlerIfFree( "button_over_down", LUI.UIButton.ElementOverDown ) +end + +LUI.UIButton.SetGainFocusSFX = function ( f23_arg0, f23_arg1 ) + f23_arg0.gainFocusSFX = f23_arg1 +end + +LUI.UIButton.SetActionSFX = function ( f24_arg0, f24_arg1 ) + f24_arg0.actionSFX = f24_arg1 +end + +LUI.UIButton.build = function ( f25_arg0, f25_arg1 ) + return LUI.UIButton.new() +end + +LUI.UIButton.new = function ( menu, controller ) + local self = LUI.UIElement.new( menu ) + self.id = "LUIButton" + self:makeFocusable() + self:setHandleMouse( true ) + self.enable = LUI.UIButton.Enable + self.disable = LUI.UIButton.Disable + self.lock = LUI.UIButton.Disable + self.actionEventName = controller + self.setActionEventName = LUI.UIButton.setActionEventName + self.setGainFocusSFX = LUI.UIButton.SetGainFocusSFX + self.setActionSFX = LUI.UIButton.SetActionSFX + self.gainFocusSFX = CoD.SFX.MouseOver + self.actionSFX = CoD.SFX.MouseClick + self:registerEventHandler( "mouseenter", LUI.UIButton.MouseEnter ) + self:registerEventHandler( "mouseleave", LUI.UIButton.MouseLeave ) + self:registerEventHandler( "leftmousedown", LUI.UIButton.LeftMouseDown ) + self:registerEventHandler( "leftmouseup", LUI.UIButton.LeftMouseUp ) + self:registerEventHandler( "rightmousedown", LUI.UIButton.RightMouseDown ) + self:registerEventHandler( "rightmouseup", LUI.UIButton.RightMouseUp ) + self:registerEventHandler( "gamepad_button", LUI.UIButton.GamepadButton ) + self:registerEventHandler( "gain_focus", LUI.UIButton.gainFocus ) + self:registerEventHandler( "lose_focus", LUI.UIButton.loseFocus ) + self:registerEventHandler( "popup_active", LUI.UIButton.popupActive ) + self:registerEventHandler( "popup_inactive", LUI.UIButton.popupInactive ) + self:registerEventHandler( "update_outside_list", LUI.UIButton.UpdateOutsideList ) + LUI.UIButton.SetupElement( self ) + return self +end + diff --git a/lui/luibuttonrepeater.dec.lua b/lui/luibuttonrepeater.dec.lua new file mode 100644 index 0000000..ed8f40f --- /dev/null +++ b/lui/luibuttonrepeater.dec.lua @@ -0,0 +1,165 @@ +require( "LUI.LUITimer" ) + +LUI.UIButtonRepeater = {} +LUI.UIButtonRepeater.FirstDelay = 420 +LUI.UIButtonRepeater.Delay = 210 +LUI.UIButtonRepeater.DelayReduction = 25 +LUI.UIButtonRepeater.AccelInterval = 100 +LUI.UIButtonRepeater.MinDelay = 33 +LUI.UIButtonRepeater.new = function ( f1_arg0, f1_arg1, f1_arg2 ) + local self = LUI.UIElement.new() + self.id = "LUIButtonRepeater" + self:setPriority( -1000 ) + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } ) + self:animateToState( "default" ) + self.buttonName = f1_arg0 + if type( f1_arg1 ) == "string" then + self.event = { + name = f1_arg1, + buttonRepeat = true + } + else + f1_arg1.buttonRepeat = true + self.event = f1_arg1 + end + self.eventTarget = f1_arg2 + self.firstDelay = LUI.UIButtonRepeater.FirstDelay + self.delay = LUI.UIButtonRepeater.Delay + self.delayReduction = LUI.UIButtonRepeater.DelayReduction + self.accelInterval = LUI.UIButtonRepeater.AccelInterval + self.minDelay = LUI.UIButtonRepeater.MinDelay + self.handleGamepadButton = LUI.UIButtonRepeater.HandleGamepadButton + self.cancelRepetition = LUI.UIButtonRepeater.CancelRepetition + self.sendButtonRepeat = LUI.UIButtonRepeater.SendButtonRepeat + self.setMinDelay = LUI.UIButtonRepeater.SetMinDelay + self.enable = LUI.UIButtonRepeater.Enable + self.disable = LUI.UIButtonRepeater.Disable + if not Engine.IsConsoleGame() then + self:addEventHandler( "leftmousedown", LUI.UIButtonRepeater.LeftMouseDown ) + self:addEventHandler( "leftmouseup", LUI.UIButtonRepeater.LeftMouseUp ) + self:setHandleMouseButton( true ) + end + self:registerEventHandler( "repeat", LUI.UIButtonRepeater.Repeat ) + self:registerEventHandler( "accelerate", LUI.UIButtonRepeater.Accelerate ) + return self +end + +LUI.UIButtonRepeater.Enable = function ( f2_arg0 ) + f2_arg0.m_disabled = false +end + +LUI.UIButtonRepeater.Disable = function ( f3_arg0 ) + f3_arg0.m_disabled = true + f3_arg0:cancelRepetition() +end + +LUI.UIButtonRepeater.SetMinDelay = function ( f4_arg0, f4_arg1 ) + f4_arg0.minDelay = math.max( 1, f4_arg1 ) +end + +LUI.UIButtonRepeater.LeftMouseDown = function ( f5_arg0, f5_arg1 ) + if "leftmouse" == f5_arg0.buttonName and not f5_arg1.buttonRepeat then + f5_arg0:cancelRepetition() + if f5_arg0.m_disabled then + return false + end + f5_arg0.controller = f5_arg1.controller + local self = LUI.UITimer.new( f5_arg0.firstDelay, { + name = "repeat", + numRepeats = 1 + } ) + f5_arg0:addElement( self ) + f5_arg0.repeatTimer = self + end +end + +LUI.UIButtonRepeater.LeftMouseUp = function ( f6_arg0, f6_arg1 ) + if "leftmouse" == f6_arg0.buttonName and not f6_arg1.buttonRepeat then + f6_arg0:cancelRepetition() + end +end + +LUI.UIButtonRepeater.HandleGamepadButton = function ( f7_arg0, f7_arg1 ) + if LUI.UIElement.handleGamepadButton( f7_arg0, f7_arg1 ) then + return true + elseif f7_arg1.button == f7_arg0.buttonName and not f7_arg1.buttonRepeat then + f7_arg0:cancelRepetition() + if f7_arg0.m_disabled then + return false + elseif f7_arg1.down == true then + f7_arg0.controller = f7_arg1.controller + local self = LUI.UITimer.new( f7_arg0.firstDelay, { + name = "repeat", + numRepeats = 1 + } ) + f7_arg0:addElement( self ) + f7_arg0.repeatTimer = self + end + end +end + +LUI.UIButtonRepeater.CancelRepetition = function ( f8_arg0 ) + local f8_local0 = f8_arg0.repeatTimer + if f8_local0 ~= nil then + f8_local0:close() + f8_arg0.repeatTimer = nil + end + local f8_local1 = f8_arg0.accelTimer + if f8_local1 ~= nil then + f8_local1:close() + f8_arg0.accelTimer = nil + end + f8_arg0.currentDelay = nil +end + +LUI.UIButtonRepeater.SendButtonRepeat = function ( f9_arg0 ) + local f9_local0 = f9_arg0.eventTarget + if f9_local0 == nil then + f9_local0 = f9_arg0:getParent() + end + local f9_local1 = f9_arg0.event + f9_local1.controller = f9_arg0.controller + return f9_local0:processEvent( f9_local1 ) +end + +LUI.UIButtonRepeater.Repeat = function ( f10_arg0, f10_arg1 ) + local f10_local0 = f10_arg0.repeatTimer + local f10_local1 = f10_arg1.numRepeats + if f10_arg0.currentDelay == nil then + f10_local0.interval = f10_arg0.delay + if f10_arg0.accelTimer == nil then + local accelTimer = LUI.UITimer.new( f10_arg0.accelInterval, "accelerate" ) + accelTimer.id = "accelTimer" + f10_arg0:addElement( accelTimer ) + f10_arg0.accelTimer = accelTimer + + end + else + f10_local0.interval = f10_arg0.currentDelay + end + f10_arg0:sendButtonRepeat() + f10_arg1.numRepeats = f10_local1 + 1 +end + +LUI.UIButtonRepeater.Accelerate = function ( f11_arg0, f11_arg1 ) + local f11_local0 = f11_arg0.currentDelay + if f11_local0 == nil then + f11_local0 = f11_arg0.delay + else + f11_local0 = f11_local0 - f11_arg0.delayReduction + if f11_local0 < f11_arg0.minDelay then + f11_local0 = f11_arg0.minDelay + end + end + f11_arg0.currentDelay = f11_local0 +end + diff --git a/lui/luicharacterwindow.dec.lua b/lui/luicharacterwindow.dec.lua new file mode 100644 index 0000000..a8381b9 --- /dev/null +++ b/lui/luicharacterwindow.dec.lua @@ -0,0 +1,19 @@ +LUI.UICharacterWindow = InheritFrom( LUI.UIElement ) +LUI.UICharacterWindow.build = function ( f1_arg0, f1_arg1 ) + return LUI.UICharacterWindow.new( f1_arg1 ) +end + +LUI.UICharacterWindow.new = function ( f2_arg0 ) + local self = LUI.UIElement.new() + self:setupCharacterWindow() + self:setClass( LUI.UICharacterWindow ) + return self +end + +LUI.UICharacterWindow.setCharacterHandle = function ( f3_arg0, f3_arg1 ) + if LUI.UIElement.setCharacterHandleInC ~= nil then + f3_arg0:setCharacterHandleInC( f3_arg1 ) + end +end + +LUI.UICharacterWindow.id = "LUICharacterWindow" diff --git a/lui/luicountdown.dec.lua b/lui/luicountdown.dec.lua new file mode 100644 index 0000000..e43dd38 --- /dev/null +++ b/lui/luicountdown.dec.lua @@ -0,0 +1,40 @@ +LUI.UICountdown = InheritFrom( LUI.UIElement ) +LUI.UICountdown.build = function ( f1_arg0, f1_arg1 ) + return LUI.UICountdown.new( f1_arg1 ) +end + +LUI.UICountdown.new = function ( f2_arg0 ) + local self = LUI.UIElement.new() + if not f2_arg0 then + f2_arg0 = {} + end + if LUI.UIElement.setupUICountdown ~= nil then + if f2_arg0.endTime == "round_end" then + self:setupUICountdown() + else + self:setupUICountdown( f2_arg0.endTime or 0 ) + end + end + self:setClass( LUI.UICountdown ) + return self +end + +LUI.UICountdown.freeze = function ( f3_arg0 ) + f3_arg0.m_frozen = true +end + +LUI.UICountdown.unfreeze = function ( f4_arg0 ) + f4_arg0.m_frozen = false +end + +LUI.UICountdown.setEndTime = function ( f5_arg0, f5_arg1 ) + if LUI.UIElement.setEndTimeInC ~= nil then + f5_arg0:setEndTimeInC( f5_arg1 ) + end +end + +LUI.UICountdown.setTextStyle = function ( f6_arg0, f6_arg1 ) + f6_arg0.m_textStyle = f6_arg1 +end + +LUI.UICountdown.id = "LUICountdown" diff --git a/lui/luielement.dec.lua b/lui/luielement.dec.lua new file mode 100644 index 0000000..40cc431 --- /dev/null +++ b/lui/luielement.dec.lua @@ -0,0 +1,730 @@ +LUI.UIElement = { + id = "LUIElement", + m_defaultAnimationState = { + left = 0, + top = 0, + right = 0, + bottom = 0, + leftAnchor = false, + topAnchor = false, + bottomAnchor = false, + rightAnchor = false, + red = 1, + green = 1, + blue = 1, + alpha = 1, + alphaMultiplier = 1 + } +} +LUI.UIElement.addChildRecord = function ( f1_arg0, f1_arg1 ) + local f1_local0 = rawget + local f1_local1 = getmetatable( f1_arg1 ) + f1_local0 = f1_local0( f1_local1.__newindex, "id" ) + if f1_local0 ~= nil then + if not f1_arg0.childRecord then + f1_arg0.childRecord = {} + end + if f1_arg0.childRecord[f1_local0] ~= nil then + DebugPrint( "LUI Warning: Element has duplicate raw id \"" .. f1_local0 .. "\" id .. \"" .. f1_arg1.id .. "\", closing it" ) + f1_arg0.childRecord[f1_local0]:close() + end + f1_arg0.childRecord[f1_local0] = f1_arg1 + end +end + +LUI.UIElement.removeChildRecord = function ( f2_arg0, f2_arg1 ) + local f2_local0 = rawget + local f2_local1 = getmetatable( f2_arg1 ) + f2_local0 = f2_local0( f2_local1.__newindex, "id" ) + if f2_local0 ~= nil then + if f2_arg0.childRecord and f2_arg0.childRecord[f2_local0] then + f2_arg0.childRecord[f2_local0] = nil + else + DebugPrint( "LUI Warning: Removing element from an element which does not contain it: \"" .. f2_local0 .. "\"" ) + end + end +end + +LUI.UIElement.addElement = function ( f3_arg0, f3_arg1 ) + if f3_arg0:canAddElement( f3_arg1 ) then + f3_arg0:addElementToC( f3_arg1 ) + f3_arg0:addChildRecord( f3_arg1 ) + end +end + +LUI.UIElement.addElementBefore = function ( f4_arg0, f4_arg1 ) + local f4_local0 = f4_arg1:getParent() + if not f4_local0 then + error( "LUI Error: Element has no parent!" ) + return + elseif f4_local0:canAddElement( f4_arg0 ) then + f4_arg0:addElementBeforeInC( f4_arg1 ) + f4_local0:addChildRecord( f4_arg0 ) + end +end + +LUI.UIElement.addElementAfter = function ( f5_arg0, f5_arg1 ) + local f5_local0 = f5_arg1:getParent() + if not f5_local0 then + error( "LUI Error: Element has no parent!" ) + return + elseif f5_local0:canAddElement( f5_arg0 ) then + f5_arg0:addElementAfterInC( f5_arg1 ) + f5_local0:addChildRecord( f5_arg0 ) + end +end + +LUI.UIElement.removeElement = function ( f6_arg0, f6_arg1 ) + if f6_arg0.removeElementInC then + f6_arg0:removeElementInC( f6_arg1 ) + f6_arg0:removeChildRecord( f6_arg1 ) + end +end + +LUI.UIElement.canAddElement = function ( f7_arg0, f7_arg1 ) + if f7_arg1 == nil then + error( "LUI Error: Tried to add nil element!" ) + return false + elseif f7_arg1:getParent() == f7_arg0 then + return false + else + return true + end +end + +LUI.UIElement.isClosed = function ( f8_arg0 ) + return f8_arg0:getParent() == nil +end + +LUI.UIElement.close = function ( f9_arg0 ) + local f9_local0 = f9_arg0:getParent() + if f9_local0 ~= nil then + f9_local0:removeElement( f9_arg0 ) + end +end + +LUI.UIElement.closeChildren = function ( f10_arg0 ) + local f10_local0 = f10_arg0:getFirstChild() + if not f10_local0 then + return + end + while f10_local0 do + local f10_local1 = f10_local0:getNextSibling() + f10_local0:close() + f10_local0 = f10_local1 + end +end + +LUI.UIElement.closeTree = function ( f11_arg0 ) + local f11_local0 = f11_arg0:getFirstChild() + while f11_local0 do + local f11_local1 = f11_local0:getNextSibling() + f11_local0:closeTree() + f11_local0 = f11_local1 + end + local f11_local1 = f11_arg0:getParent() + if f11_local1 ~= nil then + f11_local1:removeElementInC( f11_arg0 ) + f11_local1:removeChildRecord( f11_arg0 ) + end +end + +LUI.UIElement.getFullID = function ( f12_arg0 ) + local f12_local0 = f12_arg0.id + local f12_local1 = f12_arg0:getParent() + while f12_local1 do + f12_local0 = f12_local1.id .. "/" .. f12_local0 + f12_local1 = f12_local1:getParent() + end + return f12_local0 +end + +LUI.UIElement.getChildById = function ( f13_arg0, f13_arg1 ) + return f13_arg0.childRecord and f13_arg0.childRecord[f13_arg1] +end + +LUI.UIElement.getFirstDescendentById = function ( f14_arg0, f14_arg1 ) + local f14_local0 = f14_arg0.childRecord + if f14_local0 then + f14_local0 = f14_arg0.childRecord[f14_arg1] + end + if f14_local0 ~= nil then + return f14_local0 + end + f14_local0 = f14_arg0:getFirstChild() + while f14_local0 ~= nil do + local f14_local1 = f14_local0:getFirstDescendentById( f14_arg1 ) + if f14_local1 ~= nil then + return f14_local1 + end + f14_local0 = f14_local0:getNextSibling() + end + return nil +end + +LUI.UIElement.setHandleMouse = function ( f15_arg0, f15_arg1 ) + f15_arg0.handleMouseMove = f15_arg1 + f15_arg0.handleMouseButton = f15_arg1 +end + +LUI.UIElement.setHandleMouseMove = function ( f16_arg0, f16_arg1 ) + f16_arg0.handleMouseMove = f16_arg1 +end + +LUI.UIElement.setHandleMouseButton = function ( f17_arg0, f17_arg1 ) + f17_arg0.handleMouseButton = f17_arg1 +end + +LUI.UIElement.MouseMoveEvent = function ( f18_arg0, f18_arg1 ) + if f18_arg0.m_ignoreMouseFocus or f18_arg0.m_outsideParentList or f18_arg0.m_focusLockedByScrolling then + return + elseif not Engine.UsesMouseCursor() then + return + elseif not Engine.InFrontend() and not LUI.UIRoot.mouseInitialized then + LUI.UIRoot.mouseInitialized = true + return true + end + local f18_local0 = false + f18_arg0:applyElementTransform() + if f18_arg0.handleMouseMove and not f18_arg1.waitingForKeyBind then + local f18_local1, f18_local2 = ProjectRootCoordinate( f18_arg1.rootName, f18_arg1.x, f18_arg1.y ) + if f18_local1 == nil or f18_local2 == nil then + f18_arg0:undoElementTransform() + return + end + local f18_local3 = false + local f18_local4, f18_local5, f18_local6, f18_local7 = f18_arg0:getRect() + if f18_arg1.mouse_outside == nil and f18_local4 ~= nil and f18_local5 <= f18_local2 and f18_local2 <= f18_local7 and f18_local4 <= f18_local1 and f18_local1 <= f18_local6 then + f18_local3 = true + end + if f18_local3 then + if f18_arg0:canFocus( FocusType.MouseOver ) and not f18_arg0:isInFocus() then + f18_arg0:processEvent( { + name = "gain_focus", + focusType = FocusType.MouseOver + } ) + local f18_local8 = f18_arg0:getParent() + if f18_local8:isIDNamed() then + f18_local8.shouldSaveState = true + end + end + if f18_arg0.m_mouseOver == nil then + f18_arg0.m_mouseOver = true + if f18_arg0.m_eventHandlers.mouseenter ~= nil then + f18_arg0.m_eventHandlers:mouseenter( { + name = "mouseenter", + controller = f18_arg1.controller, + root = f18_arg1.root, + x = f18_local1, + y = f18_local2 + } ) + end + end + if f18_arg0.m_eventHandlers.mouseover ~= nil then + f18_arg0.m_eventHandlers:mouseover( { + name = "mouseover", + controller = f18_arg1.controller, + root = f18_arg1.root, + x = f18_local1, + y = f18_local2 + } ) + end + else + if f18_arg0:isInFocus() then + f18_arg0:processEvent( { + name = "lose_focus" + } ) + end + if f18_arg0.m_mouseOver ~= nil then + f18_arg0.m_mouseOver = nil + if f18_arg0.m_eventHandlers.mouseleave ~= nil then + f18_arg0.m_eventHandlers:mouseleave( { + name = "mouseleave", + controller = f18_arg1.controller, + root = f18_arg1.root + } ) + end + end + end + if not f18_local3 and f18_arg1.mouse_outside == nil then + f18_arg1.mouse_outside = true + f18_local0 = true + end + end + f18_arg0:dispatchEventToChildren( f18_arg1 ) + if f18_arg0.shouldSaveState then + f18_arg0:saveState() + f18_arg0.shouldSaveState = nil + end + if f18_local0 then + f18_arg1.mouse_outside = nil + end + f18_arg0:undoElementTransform() +end + +LUI.UIElement.MouseButtonEvent = function ( f19_arg0, f19_arg1 ) + if f19_arg0.m_ignoreMouseFocus or f19_arg0.m_outsideParentList or f19_arg0.m_focusLockedByScrolling then + return + end + f19_arg0:applyElementTransform() + if f19_arg0.handleMouseButton then + local f19_local0, f19_local1 = ProjectRootCoordinate( f19_arg1.rootName, f19_arg1.x, f19_arg1.y ) + if f19_local0 == nil or f19_local1 == nil then + f19_arg0:undoElementTransform() + return + end + local f19_local2 = false + local f19_local3, f19_local4, f19_local5, f19_local6 = f19_arg0:getRect() + if f19_arg1.mouse_outside == nil and f19_local3 ~= nil and f19_local4 <= f19_local1 and f19_local1 <= f19_local6 and f19_local3 <= f19_local0 and f19_local0 <= f19_local5 then + f19_local2 = true + end + if f19_arg1.name == "mouseup" then + if f19_arg1.button == "left" and f19_arg0.m_leftMouseDown ~= nil then + f19_arg0.m_leftMouseDown = nil + if f19_arg0.m_eventHandlers.leftmouseup ~= nil then + local f19_local7 = f19_arg0.m_eventHandlers:leftmouseup( { + name = "leftmouseup", + controller = f19_arg1.controller, + root = f19_arg1.root, + x = f19_local0, + y = f19_local1, + inside = f19_local2 + } ) + if f19_local7 then + f19_arg0:undoElementTransform() + return f19_local7 + end + end + end + if f19_arg1.button == "right" and f19_arg0.m_rightMouseDown ~= nil then + f19_arg0.m_rightMouseDown = nil + if f19_arg0.m_eventHandlers.rightmouseup ~= nil then + local f19_local7 = f19_arg0.m_eventHandlers:rightmouseup( { + name = "rightmouseup", + controller = f19_arg1.controller, + root = f19_arg1.root, + x = f19_local0, + y = f19_local1, + inside = f19_local2 + } ) + if f19_local7 then + f19_arg0:undoElementTransform() + return f19_local7 + end + end + end + end + if f19_local2 and f19_arg1.name == "mousedown" then + if f19_arg1.button == "left" and f19_arg0.m_eventHandlers.leftmousedown ~= nil and f19_arg0.m_leftMouseDown == nil then + f19_arg0.m_leftMouseDown = true + f19_arg0.m_eventHandlers:leftmousedown( { + name = "leftmousedown", + controller = f19_arg1.controller, + root = f19_arg1.root, + x = f19_local0, + y = f19_local1, + inside = f19_local2 + } ) + end + if f19_arg1.button == "right" and f19_arg0.m_eventHandlers.rightmousedown ~= nil and f19_arg0.m_rightMouseDown == nil then + f19_arg0.m_rightMouseDown = true + f19_arg0.m_eventHandlers:rightmousedown( { + name = "rightmousedown", + controller = f19_arg1.controller, + root = f19_arg1.root, + x = f19_local0, + y = f19_local1, + inside = f19_local2 + } ) + end + end + if f19_arg0.m_eventHandlers.mousedrag ~= nil and f19_arg0.m_leftMouseDown ~= nil then + f19_arg0.m_eventHandlers:mousedrag( { + name = "mousedrag", + controller = f19_arg1.controller, + root = f19_arg1.root, + x = f19_local0, + y = f19_local1 + } ) + end + end + f19_arg0:dispatchEventToChildren( f19_arg1 ) + f19_arg0:undoElementTransform() +end + +LUI.UIElement.GamepadButton = function ( f20_arg0, f20_arg1 ) + if not f20_arg0:handleGamepadButton( f20_arg1 ) then + if f20_arg0.m_ownerController == nil or f20_arg0.m_ownerController == f20_arg1.controller then + return f20_arg0:dispatchEventToChildren( f20_arg1 ) + else + DebugPrint( "Item Exclusive to controller " .. f20_arg1.controller ) + + end + else + return true + end +end + +LUI.UIElement.handleGamepadButton = function ( f21_arg0, f21_arg1 ) + if f21_arg0:isInFocus() and f21_arg1.down == true and f21_arg0.m_disableNavigation ~= true and f21_arg0.navigation[f21_arg1.button] and f21_arg0.navigation[f21_arg1.button]:canFocus( FocusType.Gamepad ) then + local f21_local0 = f21_arg0:getParent() + if f21_local0:isIDNamed() then + f21_local0:saveState() + end + f21_arg0:processEvent( { + name = "lose_focus", + controller = f21_arg1.controller + } ) + f21_arg0.navigation[f21_arg1.button]:processEvent( { + name = "gain_focus", + controller = f21_arg1.controller + } ) + if f21_local0:isIDNamed() and f21_local0 == f21_arg0.navigation[f21_arg1.button]:getParent() then + f21_local0:saveState() + end + return true + else + + end +end + +LUI.UIElement.disableTreeFocus = function ( f22_arg0, f22_arg1 ) + f22_arg0.m_disableTreeFocus = true +end + +LUI.UIElement.enableTreeFocus = function ( f23_arg0, f23_arg1 ) + f23_arg0.m_disableTreeFocus = nil +end + +LUI.UIElement.canFocus = function ( f24_arg0, f24_arg1 ) + local f24_local0 = f24_arg0.m_focusable + if f24_local0 and f24_arg0.m_requireFocusType then + f24_local0 = f24_arg1 == f24_arg0.m_requireFocusType + end + return f24_local0 +end + +LUI.UIElement.gainFocus = function ( f25_arg0, f25_arg1 ) + if f25_arg0:canFocus( f25_arg1.focusType ) then + f25_arg0:setFocus( true ) + end + if not f25_arg0.m_disableTreeFocus then + f25_arg0:dispatchEventToChildren( f25_arg1 ) + end +end + +LUI.UIElement.loseFocus = function ( f26_arg0, f26_arg1 ) + if f26_arg0.m_focusable and f26_arg0:isInFocus() then + f26_arg0:setFocus( false ) + end + f26_arg0:dispatchEventToChildren( f26_arg1 ) +end + +LUI.UIElement.processEvent = function ( f27_arg0, f27_arg1 ) + local f27_local0 = f27_arg0.m_eventHandlers[f27_arg1.name] + if f27_local0 ~= nil then + if f27_arg1.dispatchChildren then + f27_arg0:dispatchEventToChildren( f27_arg1 ) + end + return f27_local0( f27_arg0, f27_arg1 ) + else + return f27_arg0:dispatchEventToChildren( f27_arg1 ) + end +end + +LUI.UIElement.dispatchEventToParent = function ( f28_arg0, f28_arg1 ) + local f28_local0 = f28_arg0:getParent() + while f28_local0 do + local f28_local1 = f28_local0.m_eventHandlers[f28_arg1.name] + if f28_local1 then + if f28_arg1.dispatchChildren then + f28_local0:dispatchEventToChildren( f28_arg1 ) + end + return f28_local1( f28_local0, f28_arg1 ) + end + f28_local0 = f28_local0:getParent() + end +end + +LUI.UIElement.dispatchEventToMenuRoot = function ( f29_arg0, f29_arg1 ) + local f29_local0 = f29_arg0 + local f29_local1 = f29_arg0:getParent() + local f29_local2 = f29_arg0:getRootParent() + if f29_local2.flowManager and f29_local2.flowManager.menuRoot then + local f29_local3 = f29_local2.flowManager.menuRoot + while f29_local1 do + if f29_local1 == f29_local3 then + return f29_local0:processEvent( f29_arg1 ) + end + f29_local0 = f29_local1 + f29_local1 = f29_local1:getParent() + end + end + DebugPrint( "LUI Warning: Could not find the Menu Root for " .. f29_arg1.name .. " called on elemment id " .. (f29_arg0.id or "anonymous element") ) +end + +LUI.UIElement.dispatchEventToChildren = function ( f30_arg0, f30_arg1 ) + local f30_local0 = f30_arg0:getFirstChild() + while f30_local0 do + local f30_local1 = f30_local0:getNextSibling() + local f30_local2 = f30_local0:processEvent( f30_arg1 ) + if f30_local2 then + return f30_local2 + end + f30_local0 = f30_local1 + end +end + +LUI.UIElement.getRootParent = function ( f31_arg0 ) + return Engine.GetLuiRoot() +end + +LUI.UIElement.dispatchEventToRoot = function ( f32_arg0, f32_arg1 ) + LUI.UIRoot.ProcessEvent( f32_arg0:getRootParent(), f32_arg1 ) +end + +LUI.UIElement.dispatchEventToAllOtherRoots = function ( f33_arg0, f33_arg1 ) + local f33_local0 = f33_arg0:getRootParent() + for f33_local4, f33_local5 in pairs( LUI.roots ) do + if f33_local0 ~= f33_local5 and f33_local5 ~= LUI.primaryRoot then + f33_local5:processEvent( f33_arg1 ) + end + end +end + +LUI.UIElement.getRootController = function ( f34_arg0 ) + local f34_local0 = f34_arg0:getRootParent() + return f34_local0.m_controllerIndex +end + +LUI.UIElement.registerEventHandler = function ( f35_arg0, f35_arg1, f35_arg2 ) + f35_arg0.m_eventHandlers[f35_arg1] = f35_arg2 + if not f35_arg0.isaroot and LUI.EventCatcher.isDirectDispatchEventType( f35_arg1 ) then + local f35_local0 = f35_arg0:getRootParent() + f35_local0.eventCatcher:registerDirectDispatchHandler( f35_arg0, f35_arg1, f35_arg2 ) + end +end + +LUI.UIElement.registerOmnvarHandler = function ( f36_arg0, f36_arg1, f36_arg2 ) + assert( not f36_arg0.isaroot ) + local f36_local0 = f36_arg0:getRootParent() + f36_local0.eventCatcher:registerOmnvarHandler( f36_arg0, f36_arg1, f36_arg2 ) +end + +LUI.UIElement.registerDvarHandler = function ( f37_arg0, f37_arg1, f37_arg2 ) + assert( not f37_arg0.isaroot ) + local f37_local0 = f37_arg0:getRootParent() + f37_local0.eventCatcher:registerDvarHandler( f37_arg0, f37_arg1, f37_arg2 ) +end + +LUI.UIElement.registerEventHandlerIfFree = function ( f38_arg0, f38_arg1, f38_arg2 ) + if f38_arg0.m_eventHandlers[f38_arg1] == nil then + f38_arg0:registerEventHandler( f38_arg1, f38_arg2 ) + end +end + +local f0_local0 = function ( f39_arg0, f39_arg1 ) + local f39_local0 = f39_arg0 + local f39_local1 = f39_arg1 + return function ( f40_arg0, f40_arg1 ) + local f40_local0, f40_local1 = nil + return f39_local0( f40_arg0, f40_arg1 ) or f39_local1( f40_arg0, f40_arg1 ) + end + +end + +LUI.UIElement.addEventHandler = function ( f41_arg0, f41_arg1, f41_arg2 ) + if f41_arg0.m_eventHandlers[f41_arg1] then + f41_arg0:registerEventHandler( f41_arg1, f0_local0( f41_arg2, f41_arg0.m_eventHandlers[f41_arg1] ) ) + else + f41_arg0:registerEventHandler( f41_arg1, f41_arg2 ) + end +end + +LUI.UIElement.makeFocusable = function ( f42_arg0 ) + f42_arg0.m_focusable = true + f42_arg0.navigation = {} +end + +LUI.UIElement.makeNotFocusable = function ( f43_arg0 ) + f43_arg0.m_focusable = false +end + +LUI.UIElement.isIDNamed = function ( f44_arg0 ) + local f44_local0 + if type( f44_arg0.id ) ~= "string" or f44_arg0.id == "" then + f44_local0 = false + else + f44_local0 = true + end + return f44_local0 +end + +LUI.UIElement.getFirstInFocus = function ( f45_arg0 ) + if f45_arg0:isInFocus() then + return f45_arg0 + end + local f45_local0 = f45_arg0:getFirstChild() + while f45_local0 do + local f45_local1 = f45_local0:getFirstInFocus() + if f45_local1 then + return f45_local1 + end + f45_local0 = f45_local0:getNextSibling() + end +end + +LUI.UIElement.getAllFocusedChildren = function ( f46_arg0, f46_arg1 ) + if not f46_arg1 then + f46_arg1 = {} + end + local f46_local0 = f46_arg0:getFirstChild() + while f46_local0 do + local f46_local1 = f46_local0:getNextSibling() + if f46_local0:isInFocus() then + f46_arg1[#f46_arg1 + 1] = f46_local0 + else + f46_arg1 = f46_local0:getAllFocusedChildren( f46_arg1 ) + end + f46_local0 = f46_local1 + end + return f46_arg1 +end + +LUI.UIElement.isParentInFocus = function ( f47_arg0 ) + local f47_local0 = f47_arg0:getParent() + if f47_local0 and f47_local0:isInFocus() then + return true + else + return false + end +end + +LUI.UIElement.saveState = function ( f48_arg0 ) + if not f48_arg0:isIDNamed() then + error( "LUI Error: Tried to save menu state, but element has no name: " .. f48_arg0:getFullID() ) + return + end + LUI.savedMenuStates[f48_arg0.id] = {} + for f48_local3, f48_local4 in ipairs( f48_arg0:getAllFocusedChildren() ) do + if not f48_local4:isIDNamed() then + error( "LUI Error: Tried to save menu state, but focused element has no name: " .. f48_local4:getFullID() ) + return + end + LUI.savedMenuStates[f48_arg0.id][#LUI.savedMenuStates[f48_arg0.id] + 1] = { + id = f48_local4.id, + data = f48_local4.saveData + } + end +end + +LUI.UIElement.clearSavedState = function ( f49_arg0 ) + if not f49_arg0:isIDNamed() then + error( "LUI Error: Tried to save menu state, but element has no name: " .. f49_arg0:getFullID() ) + return + end + local f49_local0 = f49_arg0:getFirstChild() + while f49_local0 do + local f49_local1 = f49_local0:getNextSibling() + f49_local0:clearSavedState() + f49_local0 = f49_local1 + end + LUI.savedMenuStates[f49_arg0.id] = nil +end + +LUI.UIElement.restoreState = function ( f50_arg0, f50_arg1 ) + if not f50_arg0:isIDNamed() then + error( "LUI Error: Tried to restore menu state, but element has no name: " .. f50_arg0:getFullID() ) + return + end + local f50_local0 = false + local f50_local1 = 0 + if LUI.savedMenuStates[f50_arg0.id] ~= nil then + f50_local0 = true + for f50_local5, f50_local6 in ipairs( LUI.savedMenuStates[f50_arg0.id] ) do + if f50_local6.id and f50_arg0:processEvent( { + name = "restore_focus", + id = f50_local6.id, + data = f50_local6.data, + isRefresh = f50_arg1 + } ) then + f50_local1 = f50_local1 + 1 + end + end + end + return f50_local0, f50_local1 +end + +LUI.UIElement.restoreFocus = function ( f51_arg0, f51_arg1 ) + if f51_arg0.id == f51_arg1.id and f51_arg0:canFocus( FocusType.MenuFlow ) then + if not f51_arg1.isRefresh or f51_arg1.isRefresh and not f51_arg0._isRefresh then + f51_arg0:processEvent( { + name = "gain_focus", + focusType = FocusType.MenuFlow + } ) + end + return true + else + return f51_arg0:dispatchEventToChildren( f51_arg1 ) + end +end + +if not LUI.UIElement.hasAnimationState then + LUI.UIElement.hasAnimationState = function ( f52_arg0, f52_arg1 ) + if not f52_arg0.hasAnimationStateInC then + return f52_arg0.m_animationStates[f52_arg1] + else + return f52_arg0:hasAnimationStateInC( f52_arg1 ) + end + end + +end +LUI.UIElement.setClass = function ( f53_arg0, f53_arg1 ) + local f53_local0 = getmetatable( f53_arg0 ) + local f53_local1 = f53_local0.__newindex + local f53_local2 = getmetatable( f53_local1 ) + if not f53_local2 then + setmetatable( f53_local1, { + __index = f53_arg1 + } ) + else + f53_local2.__index = f53_arg1 + end + local f53_local3 = getmetatable( f53_local1.m_eventHandlers ) + if not f53_local3 then + setmetatable( f53_local1.m_eventHandlers, { + __index = f53_arg1.m_eventHandlers + } ) + else + f53_local3.__index = f53_arg1.m_eventHandlers + end +end + +LUI.UIElement.m_eventHandlers = { + mousemove = LUI.UIElement.MouseMoveEvent, + mousedown = LUI.UIElement.MouseButtonEvent, + mouseup = LUI.UIElement.MouseButtonEvent, + gamepad_button = LUI.UIElement.GamepadButton, + gain_focus = LUI.UIElement.gainFocus, + lose_focus = LUI.UIElement.loseFocus, + restore_focus = LUI.UIElement.restoreFocus, + close = LUI.UIElement.close +} +LUI.UIElement.build = function ( f54_arg0, f54_arg1 ) + return LUI.UIElement.new() +end + +LUI.UIElement.new = function ( f55_arg0 ) + local f55_local0 = ConstructLUIElement() + LUI.UIElement.setClass( f55_local0, LUI.UIElement ) + f55_local0._scoped = LUI.ActiveScoped + f55_local0:setLayoutCached( false ) + if not f55_arg0 then + f55_local0:registerAnimationState( "default", LUI.UIElement.m_defaultAnimationState ) + else + f55_local0:registerAnimationState( "default", f55_arg0 ) + end + f55_local0:animateToState( "default" ) + return f55_local0 +end + diff --git a/lui/luigrid.dec.lua b/lui/luigrid.dec.lua new file mode 100644 index 0000000..674d40f --- /dev/null +++ b/lui/luigrid.dec.lua @@ -0,0 +1,289 @@ +LUI.UIGrid = {} +LUI.UIGrid.build = function ( f1_arg0, f1_arg1 ) + return LUI.UIGrid.new( nil, f1_arg1 ) +end + +LUI.UIGrid.new = function ( menu, controller ) + local self = LUI.UIElement.new( menu ) + self.id = "LUIGrid" + if not controller then + controller = {} + end + self.width = math.max( 1, controller.elementsPerRow or 5 ) + self.rowHeight = controller.rowHeight or 80 + self.disableHWrap = controller.disableHWrap or false + self.hSpacing = controller.hSpacing or 0 + local f2_local1 = controller.hAlign + if not f2_local1 then + f2_local1 = LUI.Alignment.Left + end + self.hAlign = f2_local1 + self.vlist = LUI.UIVerticalList.new( nil, controller.scrollByChildHeight, nil, controller.sendScrollEvents ) + LUI.UIVerticalList.SetNoWrap( self.vlist, controller.disableVWrap ) + f2_local1 = self.vlist + local f2_local2 = f2_local1 + f2_local1 = f2_local1.registerAnimationState + local f2_local3 = "default" + local f2_local4 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + spacing = controller.vSpacing or 0 + } + local f2_local5 = controller.vAlign + if not f2_local5 then + f2_local5 = LUI.Alignment.Top + end + f2_local4.alignment = f2_local5 + f2_local1( f2_local2, f2_local3, f2_local4 ) + self.vlist:animateToState( "default" ) + self:addElement( self.vlist ) + if controller.sendScrollEvents then + self:registerEventHandler( "list_scroll", function ( element, event ) + if not event.repeatCatch then + event.repeatCatch = true + local f3_local0 = element:getParent() + f3_local0:processEvent( event ) + end + end ) + end + self.addRow = LUI.UIGrid.AddRow + self.addElement = LUI.UIGrid.AddElement + self.removeElement = LUI.UIGrid.RemoveElement + self.shiftFirstElementFromNextRow = LUI.UIGrid.ShiftFirstElementFromNextRow + self.rowEmptinessCheck = LUI.UIGrid.RowEmptinessCheck + self.updateNavigation = LUI.UIGrid.UpdateNavigation + self.updateRowFocusability = LUI.UIGrid.UpdateRowFocusability + self.getChildById = LUI.UIGrid.GetChildById + self.getAllFocusedChildren = LUI.UIGrid.GetAllFocusedChildren + self.clearSavedState = LUI.UIGrid.ClearSavedState + self:registerEventHandler( "update_navigation", self.updateNavigation ) + return self +end + +LUI.UIGrid.GetAllFocusedChildren = function ( f4_arg0 ) + local f4_local0 = {} + local f4_local1 = f4_arg0.vlist:getFirstChild() + while f4_local1 do + for f4_local5, f4_local6 in ipairs( f4_local1:getAllFocusedChildren() ) do + table.insert( f4_local0, f4_local6 ) + end + f4_local1 = f4_local1:getNextSibling() + end + return f4_local0 +end + +LUI.UIGrid.ClearSavedState = function ( f5_arg0 ) + LUI.UIElement.clearSavedState( f5_arg0 ) + local f5_local0 = f5_arg0.vlist:getFirstChild() + while f5_local0 do + f5_local0.listDefaultFocus = nil + local f5_local1 = f5_local0:getFirstChild() + while f5_local1 do + f5_local1.listDefaultFocus = nil + f5_local1 = f5_local1:getNextSibling() + end + f5_local0 = f5_local0:getNextSibling() + end +end + +LUI.UIGrid.GetChildById = function ( f6_arg0, f6_arg1 ) + local f6_local0 = f6_arg0.vlist:getFirstChild() + while f6_local0 do + local f6_local1 = f6_local0:getChildById( f6_arg1 ) + if f6_local1 then + return f6_local1 + end + f6_local0 = f6_local0:getNextSibling() + end +end + +LUI.UIGrid.AddRow = function ( f7_arg0 ) + local f7_local0 = f7_arg0.vlist:getLastChild() + local f7_local1 = f7_arg0 + local self = LUI.UIHorizontalList.new() + LUI.UIHorizontalList.SetNoWrap( self, f7_local1.disableHWrap ) + self.id = "row_" .. f7_arg0.vlist:getNumChildren() + self.removeElement = function ( f8_arg0, f8_arg1 ) + f7_local1:removeElement( f8_arg1 ) + end + + self:makeNotFocusable() + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = f7_arg0.rowHeight, + left = 0, + right = 0, + spacing = f7_arg0.hSpacing, + alignment = f7_arg0.hAlign + } ) + self:registerEventHandler( "menu_refresh", function ( element, event ) + f7_local1:processEvent( event ) + end ) + self:animateToState( "default" ) + f7_arg0.vlist:addElement( self ) + if f7_local0 then + LUI.UIHorizontalList.UpdateNavigation( f7_local0 ) + end + local f7_local3 = f7_arg0.vlist:getFirstChild() + if f7_local3 then + LUI.UIHorizontalList.UpdateNavigation( f7_local3 ) + end +end + +LUI.UIGrid.AddElement = function ( f10_arg0, f10_arg1 ) + local f10_local0 = f10_arg0 + local f10_local1 = f10_local0.vlist:getLastChild() + local f10_local2 + if f10_local1 ~= nil and f10_arg0.width > f10_local1:getNumChildren() then + f10_local2 = false + else + f10_local2 = true + end + if f10_local2 then + f10_arg0:addRow() + end + f10_local1 = f10_local0.vlist:getLastChild() + f10_local1:addElement( f10_arg1 ) + if f10_arg1.listDefaultFocus then + f10_local1.listDefaultFocus = true + end + f10_arg0:updateNavigation() + local f10_local3 = function ( f11_arg0, f11_arg1 ) + local f11_local0 = 1 + local f11_local1 = f11_arg0:getParent() + f11_local1 = f11_local1:getFirstChild() + while f11_local1 do + if f11_local1 == f11_arg0 then + break + end + f11_local0 = f11_local0 + 1 + f11_local1 = f11_local1:getNextSibling() + end + local f11_local2 = { + name = "grid_navigation_update", + column = f11_local0 + } + f10_local0:clearSavedState() + f10_local0:processEvent( f11_local2 ) + local f11_local3 = f11_arg0:getParent() + f11_local3:setFocus( true ) + end + + if not f10_arg1.hasGridHandlers then + f10_arg1.hasGridHandlers = true + f10_arg1:addEventHandler( "element_refresh", function ( f12_arg0, f12_arg1 ) + if f12_arg0:isInFocus() then + f10_local3( f12_arg0, f12_arg1 ) + end + end ) + f10_arg1:addEventHandler( "button_over", f10_local3 ) + f10_arg1:addEventHandler( "button_over_disable", f10_local3 ) + end + f10_arg1:registerEventHandler( "grid_navigation_update", function ( element, event ) + local f13_local0 = 1 + local f13_local1 = element:getParent() + local f13_local2 = f13_local1:getFirstChild() + while f13_local2 do + if f13_local2 == element then + break + end + f13_local0 = f13_local0 + 1 + f13_local2 = f13_local2:getNextSibling() + end + f13_local1:setFocus( false ) + local f13_local3 = event.column == f13_local0 + local f13_local4 = false + local f13_local5 = true + local f13_local6 = 0 + local f13_local7 = f13_local1:getFirstChild() + while f13_local7 do + if f13_local7.m_focusable then + f13_local6 = f13_local6 + 1 + f13_local5 = f13_local7 == element + f13_local4 = f13_local6 < event.column + end + f13_local7 = f13_local7:getNextSibling() + end + element.listDefaultFocus = f13_local4 and (f13_local3 or f13_local5) + end ) +end + +LUI.UIGrid.RemoveElement = function ( f14_arg0, f14_arg1 ) + local f14_local0 = nil + local f14_local1 = f14_arg0.vlist:getFirstChild() + while f14_local1 do + if f14_arg1:getParent() == f14_local1 then + LUI.UIHorizontalList.RemoveElement( f14_local1, f14_arg1 ) + f14_arg0:shiftFirstElementFromNextRow( f14_local1 ) + f14_arg0:rowEmptinessCheck( f14_local1, f14_local0 ) + break + end + f14_local0 = f14_local1 + f14_local1 = f14_local1:getNextSibling() + end + f14_arg0:updateNavigation() +end + +LUI.UIGrid.UpdateNavigation = function ( f15_arg0, f15_arg1 ) + local f15_local0 = f15_arg0.vlist:getFirstChild() + while f15_local0 do + f15_arg0:updateRowFocusability( f15_local0 ) + f15_local0 = f15_local0:getNextSibling() + end + LUI.UIVerticalList.UpdateNavigation( f15_arg0.vlist ) + f15_local0 = f15_arg0.vlist:getFirstChild() + while f15_local0 do + LUI.UIHorizontalList.UpdateNavigation( f15_local0 ) + f15_local0 = f15_local0:getNextSibling() + end +end + +LUI.UIGrid.UpdateRowFocusability = function ( f16_arg0, f16_arg1 ) + local f16_local0 = f16_arg1:canFocus() + local f16_local1 = false + local f16_local2 = f16_arg1:getFirstChild() + while f16_local2 do + if f16_local2:canFocus() then + f16_local1 = true + break + end + f16_local2 = f16_local2:getNextSibling() + end + if f16_local1 ~= f16_local0 then + if f16_local1 then + f16_arg1:makeFocusable() + else + f16_arg1:makeNotFocusable() + end + end +end + +LUI.UIGrid.RowEmptinessCheck = function ( f17_arg0, f17_arg1, f17_arg2 ) + if f17_arg1:getNumChildren() == 0 then + f17_arg0.vlist:removeElement( f17_arg1 ) + end +end + +LUI.UIGrid.ShiftFirstElementFromNextRow = function ( f18_arg0, f18_arg1 ) + local f18_local0 = f18_arg1:getNextSibling() + if f18_local0 then + local f18_local1 = f18_local0:getFirstChild() + if f18_local1 then + LUI.UIHorizontalList.RemoveElement( f18_local0, f18_local1 ) + f18_arg0:rowEmptinessCheck( f18_local0, f18_arg1 ) + f18_arg1:addElement( f18_local1 ) + f18_arg0:shiftFirstElementFromNextRow( f18_local0 ) + end + end +end + diff --git a/lui/luihorizontallist.dec.lua b/lui/luihorizontallist.dec.lua new file mode 100644 index 0000000..0ce0ce7 --- /dev/null +++ b/lui/luihorizontallist.dec.lua @@ -0,0 +1,144 @@ +LUI.UIHorizontalList = {} +LUI.UIHorizontalNavigator = {} +local f0_local0 = function ( f1_arg0, f1_arg1, f1_arg2 ) + local self = LUI.UIElement.new( { + leftAnchor = true, + rightAnchor = false, + left = 0, + right = f1_arg1, + topAnchor = true, + bottomAnchor = true, + top = 0, + bottom = 0 + } ) + self:setPriority( f1_arg2 ) + f1_arg0:addElement( self ) + return self +end + +LUI.UIHorizontalList.build = function ( menu, controller ) + local self = LUI.UIHorizontalList.new( {} ) + LUI.UIHorizontalList.SetNoWrap( self, controller.noWrap ) + return self +end + +LUI.UIHorizontalList.new = function ( f3_arg0 ) + local self = LUI.UIElement.new( f3_arg0 ) + self.id = "LUIHorizontalList" + self:setupUIHorizontalList() + self.addSpacer = f0_local0 + self.addElement = LUI.UIHorizontalList.AddElement + self.removeElement = LUI.UIHorizontalList.RemoveElement + self.updateNavigation = LUI.UIHorizontalList.UpdateNavigation + self:registerEventHandler( "gain_focus", LUI.UIHorizontalList.gainFocus ) + self:registerEventHandler( "update_navigation", function ( element, event ) + element:updateNavigation() + end ) + return self +end + +LUI.UIHorizontalNavigator.build = function ( menu, controller ) + local self = LUI.UIHorizontalNavigator.new( {}, controller.noWrap ) + LUI.UIHorizontalList.SetNoWrap( self, controller.noWrap ) + return self +end + +LUI.UIHorizontalNavigator.new = function ( f6_arg0 ) + local self = LUI.UIElement.new( f6_arg0 ) + self.id = "LUIHorizontalList" + self.addSpacer = f0_local0 + self.addElement = LUI.UIHorizontalList.AddElement + self.removeElement = LUI.UIHorizontalList.RemoveElement + self.updateNavigation = LUI.UIHorizontalList.UpdateNavigation + self:registerEventHandler( "gain_focus", LUI.UIHorizontalList.gainFocus ) + self:registerEventHandler( "update_navigation", function ( element, event ) + element:updateNavigation() + end ) + return self +end + +LUI.UIHorizontalList.SetNoWrap = function ( f8_arg0, f8_arg1 ) + f8_arg0.noWrap = f8_arg1 +end + +LUI.UIHorizontalList.AddElement = function ( f9_arg0, f9_arg1 ) + LUI.UIElement.addElement( f9_arg0, f9_arg1 ) + f9_arg1.navigation = {} + f9_arg0:setLayoutCached( false ) + f9_arg0:updateNavigation() +end + +LUI.UIHorizontalList.RemoveElement = function ( f10_arg0, f10_arg1 ) + LUI.UIElement.removeElement( f10_arg0, f10_arg1 ) + f10_arg0:setLayoutCached( false ) + f10_arg0:updateNavigation() +end + +LUI.UIHorizontalList.UpdateNavigation = function ( f11_arg0 ) + local f11_local0, f11_local1 = nil + local f11_local2 = f11_arg0:getFirstChild() + while f11_local2 ~= nil do + if f11_local2:canFocus( FocusType.ListSelection ) then + if f11_local0 == nil then + f11_local0 = f11_local2 + end + if f11_local1 ~= nil then + f11_local1.navigation.right = f11_local2 + f11_local2.navigation.left = f11_local1 + else + f11_local2.navigation.left = nil + end + if f11_local2.navigation ~= nil and f11_arg0.navigation ~= nil then + f11_local2.navigation.down = f11_arg0.navigation.down + f11_local2.navigation.up = f11_arg0.navigation.up + end + f11_local1 = f11_local2 + end + f11_local2 = f11_local2:getNextSibling() + end + if f11_local1 ~= nil then + if f11_arg0.navigation ~= nil and f11_arg0.navigation.right ~= nil and f11_arg0.navigation.right:canFocus( FocusType.ListSelection ) == true then + f11_local1.navigation.right = f11_arg0.navigation.right + f11_arg0.navigation.right.navigation.left = f11_local1 + elseif f11_local1 ~= f11_local0 and not f11_arg0.noWrap then + f11_local1.navigation.right = f11_local0 + else + f11_local1.navigation.right = nil + end + if f11_arg0.navigation ~= nil and f11_arg0.navigation.left ~= nil and f11_arg0.navigation.left:canFocus( FocusType.ListSelection ) == true then + f11_local0.navigation.left = f11_arg0.navigation.left + f11_arg0.navigation.left.navigation.right = f11_local0 + elseif f11_local1 ~= f11_local0 and not f11_arg0.noWrap then + f11_local0.navigation.left = f11_local1 + else + f11_local0.navigation.left = nil + end + end +end + +LUI.UIHorizontalList.gainFocus = function ( f12_arg0, f12_arg1 ) + local f12_local0, f12_local1 = f12_arg0:restoreState() + if f12_local1 == 0 then + local f12_local2, f12_local3 = nil + local f12_local4 = f12_arg0:getFirstChild() + while f12_local4 ~= nil do + if f12_local4:canFocus( FocusType.ListSelection ) then + if f12_local2 == nil then + f12_local2 = f12_local4 + end + if f12_local3 == nil and f12_local4.listDefaultFocus then + f12_local3 = f12_local4 + end + end + end + if f12_local3 ~= nil then + f12_local3:processEvent( f12_arg1 ) + elseif f12_local2 ~= nil then + f12_local2:processEvent( f12_arg1 ) + else + + end + f12_local4 = f12_local4:getNextSibling() + end +end + diff --git a/lui/luiimage.dec.lua b/lui/luiimage.dec.lua new file mode 100644 index 0000000..bb8b975 --- /dev/null +++ b/lui/luiimage.dec.lua @@ -0,0 +1,13 @@ +LUI.UIImage = InheritFrom( LUI.UIElement ) +LUI.UIImage.build = function ( f1_arg0, f1_arg1 ) + return LUI.UIImage.new() +end + +LUI.UIImage.new = function ( f2_arg0 ) + local self = LUI.UIElement.new( f2_arg0 ) + self:setClass( LUI.UIImage ) + self:setupUIImage() + return self +end + +LUI.UIImage.id = "LUIImage" diff --git a/lui/luilitimage.dec.lua b/lui/luilitimage.dec.lua new file mode 100644 index 0000000..8c6e14d --- /dev/null +++ b/lui/luilitimage.dec.lua @@ -0,0 +1,13 @@ +LUI.UILitImage = InheritFrom( LUI.UIElement ) +LUI.UILitImage.build = function ( f1_arg0, f1_arg1 ) + return LUI.UILitImage.new() +end + +LUI.UILitImage.new = function ( f2_arg0 ) + local self = LUI.UIElement.new( f2_arg0 ) + self:setClass( LUI.UILitImage ) + self:setupUILitImage() + return self +end + +LUI.UILitImage.id = "LUILitImage" diff --git a/lui/luilongcountdown.dec.lua b/lui/luilongcountdown.dec.lua new file mode 100644 index 0000000..ab75d83 --- /dev/null +++ b/lui/luilongcountdown.dec.lua @@ -0,0 +1,25 @@ +LUI.UILongCountdown = InheritFrom( LUI.UIElement ) +LUI.UILongCountdown.build = function ( f1_arg0, f1_arg1 ) + return LUI.UILongCountdown.new( f1_arg1.end_time ) +end + +LUI.UILongCountdown.new = function ( f2_arg0 ) + local self = LUI.UIElement.new() + if LUI.UIElement.setupUILongCountdown ~= nil then + self:setupUILongCountdown( f2_arg0 ) + end + self:setClass( LUI.UILongCountdown ) + self.setEndTime = LUI.UILongCountdown.setEndTime + if f2_arg0 then + self:setEndTime( f2_arg0 ) + end + return self +end + +LUI.UILongCountdown.setEndTime = function ( f3_arg0, f3_arg1 ) + if LUI.UIElement.setEndTimeInC ~= nil then + f3_arg0:setEndTimeInC( f3_arg1 ) + end +end + +LUI.UILongCountdown.id = "LUICountdown" diff --git a/lui/luimarqueetext.dec.lua b/lui/luimarqueetext.dec.lua new file mode 100644 index 0000000..f8aaa49 --- /dev/null +++ b/lui/luimarqueetext.dec.lua @@ -0,0 +1,284 @@ +LUI.UIMarqueeText = InheritFrom( LUI.UIElement ) +LUI.UIMarqueeText.build = function ( f1_arg0, f1_arg1 ) + if not f1_arg1 then + f1_arg1 = {} + end + local self = LUI.UIMarqueeText.new( f1_arg1.defaultAnimationState ) + if f1_arg1.textHeight then + LUI.UIMarqueeText.SetTextHeight( self, f1_arg1.textHeight ) + end + if f1_arg1.useTextWrapping then + LUI.UIMarqueeText.SetUseTextWrapping( self, f1_arg1.useTextWrapping ) + end + if f1_arg1.scrollSpeed then + LUI.UIMarqueeText.SetSpeed( self, f1_arg1.scrollSpeed ) + end + return self +end + +LUI.UIMarqueeText.SetColor = function ( f2_arg0, f2_arg1, f2_arg2, f2_arg3 ) + f2_arg0:registerAnimationState( "default", { + red = f2_arg1, + green = f2_arg2, + blue = f2_arg3, + alpha = 1 + } ) + f2_arg0:animateToState( "default" ) + LUI.UIMarqueeText.RestartScroll( f2_arg0 ) +end + +LUI.UIMarqueeText.new = function ( f3_arg0 ) + local self = LUI.UIElement.new( f3_arg0 ) + self:setClass( LUI.UIMarqueeText ) + self:setUseStencil( true ) + local f3_local1 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + local f3_local2 + if f3_arg0 then + f3_local2 = f3_arg0.font + if not f3_local2 then + + else + f3_local1.font = f3_local2 + f3_local1.red = 1 + f3_local1.green = 1 + f3_local1.blue = 1 + f3_local1.alpha = 1 + f3_local2 = LUI.UIText.new( f3_local1 ) + self.text = f3_local2 + self:addElement( f3_local2 ) + self.text:registerAnimationState( "default", f3_local1 ) + self.text:animateToState( "default" ) + self.text:registerAnimationState( "start", f3_local1 ) + self.text:registerAnimationState( "alphaOut", { + alpha = 0 + } ) + self.text:registerEventHandler( "transition_complete_start", LUI.UIMarqueeText.HandleStartScroll ) + self.text:animateToState( "start", 1 ) + self.text.scrollSpeed = 90 + return self + end + end + f3_local2 = CoD.TextSettings.NormalFont.Font +end + +LUI.UIMarqueeText.RestartScroll = function ( f4_arg0 ) + f4_arg0.text:animateToState( "start", 1 ) +end + +LUI.UIMarqueeText.SetUseTextWrapping = function ( f5_arg0, f5_arg1 ) + f5_arg0.text.useTextWrapping = f5_arg1 + LUI.UIMarqueeText.RestartScroll( f5_arg0 ) +end + +LUI.UIMarqueeText.SetTextHeight = function ( f6_arg0, f6_arg1 ) + local f6_local0 = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = f6_arg1, + left = 0, + right = 0 + } + f6_arg0.text.textHeight = f6_arg1 + f6_arg0.text:registerAnimationState( "default", f6_local0 ) + f6_arg0.text:registerAnimationState( "start", f6_local0 ) + LUI.UIMarqueeText.RestartScroll( f6_arg0 ) +end + +LUI.UIMarqueeText.SetSpeed = function ( f7_arg0, f7_arg1 ) + f7_arg0.text.scrollSpeed = f7_arg1 +end + +LUI.UIMarqueeText.HandleStartScroll = function ( f8_arg0 ) + local f8_local0 = f8_arg0:getParent() + local f8_local1, f8_local2, f8_local3, f8_local4 = f8_local0:getCurrentGlobalRect() + local f8_local5 = f8_arg0:getCurrentGlobalRect() + local f8_local6 = f8_local0:getCurrentAlignment() + local f8_local7 = LUI.Alignment.None + if f8_arg0.useTextWrapping then + if f8_local6 == LUI.Alignment.None then + local f8_local8 = LUI.Alignment.Left + end + f8_local7 = f8_local8 or f8_local6 + end + f8_arg0:registerAnimationState( "setup", { + alignment = f8_local7 + } ) + f8_arg0:animateToState( "setup" ) + if f8_local1 and f8_local5 then + local f8_local9, f8_local10 = f8_arg0:getElementTextDims() + local f8_local11 = f8_local0:getCurrentFont() + local f8_local12, f8_local13, f8_local14, f8_local15 = f8_local0:getCurrentRGBA() + local f8_local16 = nil + local f8_local17 = false + local f8_local18 = { + red = f8_local12, + green = f8_local13, + blue = f8_local14, + alpha = f8_local15 + } + local f8_local19 = 0.01 + if f8_local3 - f8_local1 + f8_local19 < f8_local9 and not f8_arg0.textHeight then + f8_local16 = (f8_local9 - f8_local3 - f8_local1) / f8_arg0.scrollSpeed * 1000 + f8_local17 = true + f8_local18.alignment = LUI.Alignment.None + f8_arg0:registerAnimationState( "alphaIn", f8_local18 ) + f8_arg0:registerAnimationState( "one", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = f8_local10, + left = 0, + right = f8_local9, + font = f8_local11 + } ) + f8_arg0:registerAnimationState( "two", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = f8_local10, + left = -f8_local9, + right = 0, + font = f8_local11 + } ) + local f8_local20 = MBh.AnimateLoop( { + { + "alphaIn", + 0 + }, + { + "one", + 0 + }, + { + "one", + 500 + }, + { + "two", + f8_local16 + }, + { + "two", + 500 + }, + { + "alphaOut", + 250 + }, + { + "one", + 0 + }, + { + "alphaIn", + 250 + } + } ) + f8_local20( f8_arg0 ) + elseif f8_local4 - f8_local2 + f8_local19 < f8_local10 and f8_arg0.textHeight then + local f8_local21 = f8_local10 - f8_local4 - f8_local2 + local f8_local22 = f8_local10 / f8_arg0.textHeight + f8_local16 = f8_local21 / f8_arg0.scrollSpeed * 1000 + f8_local17 = true + local f8_local20 + if f8_local6 == LUI.Alignment.None then + f8_local20 = LUI.Alignment.Center + if not f8_local20 then + + else + f8_local18.alignment = f8_local20 + f8_arg0:registerAnimationState( "alphaIn", f8_local18 ) + f8_local20 = { + { + "alphaOut", + 0 + }, + { + "line_0", + 0 + }, + { + "alphaIn", + 250 + } + } + for f8_local23 = 0, f8_local22 - math.floor( (f8_local4 - f8_local2) / f8_arg0.textHeight ), 1 do + local f8_local26 = "line_" .. f8_local23 + f8_arg0:registerAnimationState( f8_local26, { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -f8_local23 * f8_arg0.textHeight, + bottom = (1 - f8_local23) * f8_arg0.textHeight, + left = 0, + right = 0, + font = f8_local11 + } ) + table.insert( f8_local20, { + f8_local26, + f8_arg0.textHeight / f8_arg0.scrollSpeed * 1000, + true, + true + } ) + table.insert( f8_local20, { + f8_local26, + 2000 + } ) + end + table.insert( f8_local20, { + "alphaOut", + 250 + } ) + table.insert( f8_local20, { + "line_0", + 0 + } ) + local f8_local23 = MBh.AnimateLoop( f8_local20 ) + f8_local23( f8_arg0 ) + end + end + f8_local20 = f8_local6 + end + if not f8_local17 then + f8_local18.alignment = f8_local6 + f8_arg0:registerEventHandler( LUI.FormatAnimStateFinishEvent( "alphaIn" ), nil ) + f8_arg0:registerAnimationState( "alphaIn", f8_local18 ) + f8_arg0:animateToState( "alphaIn", 0 ) + end + else + f8_arg0:animateToState( "alphaOut" ) + f8_arg0:animateToState( "start", 1 ) + end +end + +LUI.UIMarqueeText.setText = function ( f9_arg0, f9_arg1 ) + f9_arg0.text:setTextInC( f9_arg1 ) + if f9_arg0.text.currText ~= f9_arg1 then + LUI.UIMarqueeText.RestartScroll( f9_arg0 ) + end + f9_arg0.text.currText = f9_arg1 +end + +LUI.UIMarqueeText.setTextStyle = function ( f10_arg0, f10_arg1 ) + f10_arg0.text.m_textStyle = f10_arg1 +end + +LUI.UIMarqueeText.id = "LUIMarqueeText" +LUI.MenuBuilder.registerType( "UIMarqueeText", LUI.UIMarqueeText.build ) diff --git a/lui/luimousecursor.dec.lua b/lui/luimousecursor.dec.lua new file mode 100644 index 0000000..b8ccbf6 --- /dev/null +++ b/lui/luimousecursor.dec.lua @@ -0,0 +1,59 @@ +LUI.UIMouseCursor = {} +LUI.UIMouseCursor.priority = 1000 +LUI.UIMouseCursor.mouseTimeout = 3000 +LUI.UIMouseCursor.MouseActivity = function ( f1_arg0, f1_arg1 ) + f1_arg0:applyElementTransform() + f1_arg0.id = "mouse_cursor" + local f1_local0, f1_local1 = ProjectRootCoordinate( f1_arg1.rootName, f1_arg1.x, f1_arg1.y ) + if f1_local0 ~= nil and f1_local1 ~= nil then + f1_local0, f1_local1 = f1_arg1.root:pixelsToUnits( f1_local0, f1_local1 ) + if f1_local0 ~= nil and f1_local1 ~= nil then + f1_arg0:registerAnimationState( "default", { + left = f1_local0 - 32, + right = f1_local0 + 32, + top = f1_local1 - 32, + bottom = f1_local1 + 32, + leftAnchor = true, + topAnchor = true, + rightAnchor = false, + bottomAnchor = false, + alpha = 1 + } ) + f1_arg0:animateToState( "default" ) + end + end + f1_arg0:dispatchEventToChildren( f1_arg1 ) + f1_arg0:undoElementTransform() + f1_arg0.lastMoveTime = Engine.GetMilliseconds() +end + +LUI.UIMouseCursor.Hide = function ( f2_arg0, f2_arg1 ) + f2_arg0:animateToState( "hidden", 400 ) +end + +LUI.UIMouseCursor.new = function ( f3_arg0 ) + local self = LUI.UIImage.new( f3_arg0 ) + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:setPriority( LUI.UIMouseCursor.priority ) + self.lastMoveTime = Engine.GetMilliseconds() + self.id = "mouse_cursor" + self.hide = LUI.UIMouseCursor.Hide + self:registerEventHandler( "mousemove", LUI.UIMouseCursor.MouseActivity ) + self:registerEventHandler( "mousedown", LUI.UIMouseCursor.MouseActivity ) + local f3_local1 = LUI.UITimer.new( 1000, { + name = "update_mouse" + }, nil, false, element, false ) + f3_local1.id = "mouse_update_timer" + self:addElement( f3_local1 ) + self:registerEventHandler( "update_mouse", function ( element, event ) + if not CoD.UsingController() then + return + elseif Engine.GetMilliseconds() - element.lastMoveTime > LUI.UIMouseCursor.mouseTimeout then + element:hide() + end + end ) + return self +end + diff --git a/lui/luiprettynumber.dec.lua b/lui/luiprettynumber.dec.lua new file mode 100644 index 0000000..c5e90c3 --- /dev/null +++ b/lui/luiprettynumber.dec.lua @@ -0,0 +1,22 @@ +LUI.UIPrettyNumber = {} +LUI.UIPrettyNumber.new = function ( f1_arg0, f1_arg1 ) + assert( f1_arg1 ) + assert( type( f1_arg1.speed ) == "number" ) + assert( type( f1_arg1.initialValue ) == "number" ) + local self = assert + local f1_local1 + if f1_arg1.precision and type( f1_arg1.precision ) ~= "number" then + f1_local1 = false + else + f1_local1 = true + end + self( f1_local1 ) + f1_arg1.precision = f1_arg1.precision or 1 + self = LUI.UIText.new( f1_arg0 ) + self.id = "UIPrettyNumber" + if self.setupPrettyNumber then + self:setupPrettyNumber( f1_arg1.speed, f1_arg1.initialValue, f1_arg1.precision ) + end + return self +end + diff --git a/lui/luiroot.dec.lua b/lui/luiroot.dec.lua new file mode 100644 index 0000000..1bdbe80 --- /dev/null +++ b/lui/luiroot.dec.lua @@ -0,0 +1,478 @@ +require( "LUI.CodeDependence" ) + +if not Engine.InFrontend() then + require( "LUI.GameX" ) +end +require( "LUI.FlowManager" ) +require( "LUI.HudManager" ) +require( "LUI.EventCatcher" ) +if Engine.HasSpeechFeature() then + require( "LUI.MenuAutoNav" ) + require( "LUI.Speech" ) + require( "LUI.common_menus.KinectUtils" ) +end +LUI.UIRoot = {} +LUI.UIRoot.childPriorities = { + menuRoot = 10, + default = 0, + MLGHud = -4, + hudElems = -5, + roundEndScreen = -7, + finalScoresScreen = -7, + hudContainer = -10 +} +function LUI_UIRoot_HandleSpeechWhatCanISay( f1_arg0, f1_arg1, f1_arg2 ) + if Engine.HasSpeechFeature() and Kinect.CanOpenWhatCanISayMenu() == true then + Kinect.OpenWhatCanISayMenu( f1_arg1.controler ) + LUI.Speech.PerformingSpeechAction() + end +end + +function LUI_UIRoot_HandleSpeechPause( f2_arg0, f2_arg1, f2_arg2 ) + if Engine.HasSpeechFeature() then + local f2_local0 = false + if not Engine.InFrontend() and not Engine.IsMultiplayer() and Engine.GetDvarInt( "cl_paused" ) == 0 then + local f2_local1 = Engine.GetLuiRoot() + if f2_local1 then + Engine.TogglePause() + f2_local1.is_paused = true + f2_local1:processEvent( { + name = "hud_refresh" + } ) + f2_local1:dispatchEventToRoot( { + name = "toggle_pause" + } ) + f2_local0 = true + end + end + if f2_local0 == false then + LUI.Speech.SquelchSpeechAction() + else + LUI.Speech.PerformingSpeechAction() + end + end +end + +function LUI_UIRoot_HandleSpeechChangeView( f3_arg0, f3_arg1, f3_arg2 ) + if Engine.HasSpeechFeature() and Engine.SpeechEmitKeyPressAndRelease then + DebugPrint( "Kinect: Issuing a GPAD_BACK button press in response to VIEW voice command." ) + Engine.SpeechEmitKeyPressAndRelease( "GPAD_BACK", f3_arg1.controller ) + end +end + +function LUI_UIRoot_HandleSpeechShowMenu( f4_arg0, f4_arg1, f4_arg2 ) + if Engine.HasSpeechFeature() and Engine.SpeechEmitKeyPressAndRelease then + DebugPrint( "Kinect: Issuing a GPAD_START button press in response to MENU voice command." ) + Engine.SpeechEmitKeyPressAndRelease( "GPAD_START", f4_arg1.controller ) + end +end + +function LUI_UIRoot_HandleSpeechBack( f5_arg0, f5_arg1, f5_arg2 ) + if Engine.HasSpeechFeature() and Engine.GetLuiInUse() and Engine.SpeechEmitKeyPressAndRelease then + DebugPrint( "Kinect: Issuing a GPAD_B button press in response to XBOX GO BACK voice command." ) + Engine.SpeechEmitKeyPressAndRelease( "GPAD_B", f5_arg1.controller ) + end +end + +function LUI_UIRoot_HandleSpeechShortcuts( f6_arg0, f6_arg1, f6_arg2 ) + if Engine.HasSpeechFeature() and Kinect.CanOpenKinectGuide() == true then + Kinect.OpenKinectGuide( f6_arg1.controler ) + LUI.Speech.PerformingSpeechAction() + end +end + +if Engine.HasSpeechFeature() then + luiRootSpeechGrammarFrontEndHandlersArray = { + { + action = "what can i say", + confidence = LUI.Speech.whatCanISayConfidence, + handler = LUI_UIRoot_HandleSpeechWhatCanISay, + extradata = nil + }, + { + action = "pause", + confidence = LUI.Speech.pauseConfidence, + handler = LUI_UIRoot_HandleSpeechPause, + extradata = nil + }, + { + action = "show view", + confidence = LUI.Speech.changeViewConfidence, + handler = LUI_UIRoot_HandleSpeechChangeView, + extradata = nil + }, + { + action = "view", + confidence = LUI.Speech.changeViewConfidence, + handler = LUI_UIRoot_HandleSpeechChangeView, + extradata = nil + }, + { + action = "show menu", + confidence = LUI.Speech.showMenuConfidence, + handler = LUI_UIRoot_HandleSpeechShowMenu, + extradata = nil + }, + { + action = "menu", + confidence = LUI.Speech.showMenuConfidence, + handler = LUI_UIRoot_HandleSpeechShowMenu, + extradata = nil + }, + { + action = "shortcuts", + confidence = LUI.Speech.defaultConfidence, + handler = LUI_UIRoot_HandleSpeechShortcuts, + extradata = nil + }, + { + action = "xbox pause", + confidence = LUI.Speech.pauseConfidence, + handler = LUI_UIRoot_HandleSpeechPause, + extradata = nil + }, + { + action = "xbox view", + confidence = LUI.Speech.changeViewConfidence, + handler = LUI_UIRoot_HandleSpeechChangeView, + extradata = nil + }, + { + action = "xbox menu", + confidence = LUI.Speech.showMenuConfidence, + handler = LUI_UIRoot_HandleSpeechShowMenu, + extradata = nil + }, + { + action = "xbox back", + confidence = LUI.Speech.goBackConfidence, + handler = LUI_UIRoot_HandleSpeechBack, + extradata = nil + } + } + luiRootSpeechGrammarInGameHandlersArray = { + { + action = "what can i say", + confidence = LUI.Speech.whatCanISayConfidence, + handler = LUI_UIRoot_HandleSpeechWhatCanISay, + extradata = nil + }, + { + action = "pause", + confidence = LUI.Speech.pauseConfidence, + handler = LUI_UIRoot_HandleSpeechPause, + extradata = nil + }, + { + action = "show view", + confidence = LUI.Speech.changeViewConfidence, + handler = LUI_UIRoot_HandleSpeechChangeView, + extradata = nil + }, + { + action = "view", + confidence = LUI.Speech.changeViewConfidence, + handler = LUI_UIRoot_HandleSpeechChangeView, + extradata = nil + }, + { + action = "show menu", + confidence = LUI.Speech.showMenuConfidence, + handler = LUI_UIRoot_HandleSpeechShowMenu, + extradata = nil + }, + { + action = "menu", + confidence = LUI.Speech.showMenuConfidence, + handler = LUI_UIRoot_HandleSpeechShowMenu, + extradata = nil + }, + { + action = "xbox pause", + confidence = LUI.Speech.pauseConfidence, + handler = LUI_UIRoot_HandleSpeechPause, + extradata = nil + }, + { + action = "xbox view", + confidence = LUI.Speech.changeViewConfidence, + handler = LUI_UIRoot_HandleSpeechChangeView, + extradata = nil + }, + { + action = "xbox menu", + confidence = LUI.Speech.showMenuConfidence, + handler = LUI_UIRoot_HandleSpeechShowMenu, + extradata = nil + }, + { + action = "xbox back", + confidence = LUI.Speech.goBackConfidence, + handler = LUI_UIRoot_HandleSpeechBack, + extradata = nil + } + } +else + luiRootSpeechGrammarFrontEndHandlersArray = {} + luiRootSpeechGrammarInGameHandlersArray = {} +end +function LUI_UIRoot_SpeechRestart( f7_arg0, f7_arg1 ) + if Engine.HasSpeechFeature() then + LUI.Speech.CancelSpeechFailTimer() + Kinect.RestartGlobalGrammars() + end +end + +function LUI_UIRoot_SpeechHandler( f8_arg0, f8_arg1 ) + if Engine.HasSpeechFeature() then + LUI.Speech.LaunchSpeechFailTimer() + if Engine.InFrontend() then + LUI.Speech.ProcessActionEvent( f8_arg0, f8_arg1, luiRootSpeechGrammarFrontEndHandlersArray ) + else + LUI.Speech.ProcessActionEvent( f8_arg0, f8_arg1, luiRootSpeechGrammarInGameHandlersArray ) + end + end +end + +function LUI_UIRoot_SpeechFailTimerHandler( f9_arg0, f9_arg1 ) + if Engine.HasSpeechFeature() then + if LUI.Speech.waitingForOutstandingCommandConfirmation == true then + LUI.Speech.waitingForOutstandingCommandConfirmation = false + LUI.Speech.PlayBadSound() + end + LUI.Speech.CancelSpeechFailTimer() + end +end + +local f0_local0 = function ( f10_arg0, f10_arg1 ) + f10_arg0:registerAnimationState( "default", { + left = -f10_arg1.width / 2, + top = -f10_arg1.height / 2, + right = f10_arg1.width / 2, + bottom = f10_arg1.height / 2, + leftAnchor = false, + topAnchor = false, + rightAnchor = false, + bottomAnchor = false + } ) + f10_arg0:animateToState( "default" ) +end + +local f0_local1 = function ( f11_arg0, f11_arg1 ) + f11_arg1.root = f11_arg0 + f11_arg0:dispatchEventToChildren( f11_arg1 ) +end + +local f0_local2 = function ( f12_arg0, f12_arg1 ) + local f12_local0 = f12_arg0.m_currentAnimationState + local f12_local1 = f12_local0.unitsToPixels + return f12_local0.left + f12_arg1.left * f12_local1, f12_local0.top + f12_arg1.top * f12_local1, f12_local0.left + f12_arg1.right * f12_local1, f12_local0.top + f12_arg1.bottom * f12_local1 +end + +local f0_local3 = function ( f13_arg0, f13_arg1, f13_arg2 ) + local f13_local0 = f13_arg0.m_currentAnimationState + local f13_local1 = f13_local0.unitsToPixels + local f13_local2 = f13_local0.left + local f13_local3 = f13_local0.top + f13_arg2:setRectInC( f13_local2 + f13_arg1.left * f13_local1, f13_local3 + f13_arg1.top * f13_local1, f13_local2 + f13_arg1.right * f13_local1, f13_local3 + f13_arg1.bottom * f13_local1 ) +end + +local f0_local4 = function ( f14_arg0, f14_arg1 ) + return f14_arg1 * f14_arg0.m_currentAnimationState.unitsToPixels +end + +local f0_local5 = function ( f15_arg0, f15_arg1, f15_arg2 ) + return f15_arg0:RootPixelsToUnits( f15_arg1, f15_arg2 ) +end + +LUI.UIRoot.DebugPrint_IgnoreEventsSetup = function ( f16_arg0 ) + f16_arg0.debugPrintIgnoreEvents = { + process_events = true, + gamepad_sticks = true, + mousemove = true + } +end + +local f0_local6 = function ( f17_arg0, f17_arg1 ) + InitPlayerData( f17_arg0, f17_arg1 ) +end + +local f0_local7 = function ( f18_arg0, f18_arg1 ) + InitPlayerDataExtended( f18_arg0, f18_arg1 ) +end + +local f0_local8 = function ( f19_arg0, f19_arg1 ) + +end + +function LUI_UIRoot_TryOpenMOTD( f20_arg0, f20_arg1 ) + TryForceOpenMOTD() +end + +function LUI_UIRoot_OnValidatePlayerData( f21_arg0, f21_arg1 ) + local f21_local0 = f21_arg1.controller + if f21_local0 then + ValidateOperations( f21_local0 ) + end +end + +LUI.UIRoot.new = function ( f22_arg0 ) + local self = LUI.UIElement.new( { + left = 0, + top = 0, + right = 0, + bottom = 0, + leftAnchor = false, + topAnchor = false, + rightAnchor = false, + bottomAnchor = false + } ) + self.id = "LUIRoot" + self.isaroot = true + self.unitsToPixelsRect = f0_local2 + self.pixelsToUnits = f0_local5 + self.unitsToPixels = f0_local4 + self.setDimensionsForElement = f0_local3 + self:registerEventHandler( "resize", f0_local0 ) + self:registerEventHandler( "mousemove", f0_local1 ) + self:registerEventHandler( "mousedown", f0_local1 ) + self:registerEventHandler( "mouseup", f0_local1 ) + self:registerEventHandler( "process_events", LUI.UIRoot.ProcessEvents ) + if Engine.HasSpeechFeature() then + self:registerEventHandler( "menu_auto_nav_timer", LUI.MenuAutoNav.HandleTimerEvent ) + self:registerEventHandler( "speech_grammar_changed", LUI_UIRoot_SpeechRestart ) + self:registerEventHandler( "speech_action", LUI_UIRoot_SpeechHandler ) + self:registerEventHandler( "speech_fail_timer", LUI_UIRoot_SpeechFailTimerHandler ) + end + if Engine.IsMultiplayer() then + self:registerEventHandler( "init_player_data", f0_local6 ) + self:registerEventHandler( "init_player_data_extended", f0_local7 ) + self:registerEventHandler( "get_next_round_of_operations", f0_local8 ) + self:registerEventHandler( "open_motd", LUI_UIRoot_TryOpenMOTD ) + self:registerEventHandler( "validate_player_data", LUI_UIRoot_OnValidatePlayerData ) + end + LUI.roots[f22_arg0] = self + if LUI.primaryRoot == nil then + LUI.primaryRoot = self + end + self.flowManager = LUI.FlowManager.new() + self.flowManager:setupRoot( self ) + if not Engine.InFrontend() then + self.hudManager = LUI.HudManager.new() + self.hudManager:setupRoot( self ) + end + self.eventCatcher = LUI.EventCatcher.new() + self.eventCatcher:setupRoot( self ) + self.timerGroupQueues = {} + self.name = f22_arg0 + self.eventQueue = {} + self.debugEvents = true + LUI.UIRoot.DebugPrint_IgnoreEventsSetup( self ) + self.processEvent = LUI.UIRoot.ProcessEvent + self.SaveMenuStack = self.flowManager.SaveMenuStack + self.RestoreMenuStack = self.flowManager.RestoreMenuStack + self.AnyActiveMenusInStack = self.flowManager.AnyActiveMenusInStack + self.IsMenuOpenAndVisible = self.flowManager.IsMenuOpenAndVisible + self.IsMenuInStack = self.flowManager.IsMenuInStack + self.IsMenuTopmost = self.flowManager.IsMenuTopmost + self.IsTopSignInMenu = self.flowManager.IsTopSignInMenu + self.GetFirstButtonActionInFocusId = LUI.UIRoot.GetFirstButtonActionInFocusId + if Engine.HasSpeechFeature() then + Kinect.EnableGlobalGrammars() + end + return self +end + +LUI.UIRoot.GetFirstButtonActionInFocus = function ( f23_arg0 ) + if f23_arg0:isInFocus() and f23_arg0.m_eventHandlers.button_action then + return f23_arg0 + end + local f23_local0 = f23_arg0:getFirstChild() + while f23_local0 do + local f23_local1 = LUI.UIRoot.GetFirstButtonActionInFocus( f23_local0 ) + if f23_local1 then + return f23_local1 + end + f23_local0 = f23_local0:getNextSibling() + end +end + +LUI.UIRoot.GetFirstButtonActionInFocusId = function ( f24_arg0 ) + local f24_local0 = LUI.UIRoot.GetFirstButtonActionInFocus( f24_arg0 ) + return f24_local0.id +end + +LUI.UIRoot.BlockButtonInput = function ( f25_arg0, f25_arg1, f25_arg2 ) + if f25_arg1 then + f25_arg0.m_blockButtonInput = true + else + f25_arg0.m_blockButtonInput = false + end +end + +LUI.UIRoot.IsButtonInputBlocked = function ( f26_arg0 ) + return f26_arg0.m_blockButtonInput +end + +LUI.UIRoot.ProcessEvent = function ( f27_arg0, f27_arg1 ) + if f27_arg1.immediate == true then + local f27_local0 = profile.beginuserevent( "IE_" .. f27_arg1.name ) + LUI.UIRoot.ProcessEventNow( f27_arg0, f27_arg1 ) + profile.enduserevent( f27_local0 ) + else + local f27_local0 = f27_arg0.eventQueue + table.insert( f27_local0, f27_arg1 ) + if #f27_local0 > 20 then + DebugPrint( "LUI WARNING: Event queue exceeded 20 events! " .. f27_arg1.name ) + if f27_arg1.name == "omnvar_update" then + DebugPrint( "LUI WARNING: omnvar = " .. f27_arg1.omnvar ) + end + end + end +end + +LUI.UIRoot.ProcessEvents = function ( f28_arg0, f28_arg1 ) + LUI.UITimer.DispatchEventsFromQueue( f28_arg0 ) + local f28_local0 = f28_arg0.eventQueue + local f28_local1 = f28_local0[1] + if f28_local1 ~= nil then + table.remove( f28_local0, 1 ) + local f28_local2 = profile.beginuserevent( "RE_" .. f28_local1.name ) + LUI.UIRoot.ProcessEventNow( f28_arg0, f28_local1 ) + profile.enduserevent( f28_local2 ) + end +end + +LUI.UIRoot.IsNavigationEvent = function ( f29_arg0 ) + if not handled and f29_arg0.name == "gamepad_button" and f29_arg0.down and (f29_arg0.button == "up" or f29_arg0.button == "down" or f29_arg0.button == "left" or f29_arg0.button == "right") then + return true + else + return false + end +end + +LUI.UIRoot.ProcessEventNow = function ( f30_arg0, f30_arg1 ) + if not f30_arg0.debugPrintIgnoreEvents[f30_arg1.name] and Engine.GetDvarBool( "lui_print_events" ) then + DebugPrint( "Processed Event " .. f30_arg1.name ) + if f30_arg1.name == "gamepad_button" then + DebugPrint( "button " .. f30_arg1.button ) + end + if f30_arg1.name == "keybind" then + DebugPrint( "keybind " .. f30_arg1.command ) + end + end + if f30_arg0.m_blockButtonInput and (f30_arg1.name == "gamepad_button" or f30_arg1.name == "mouseup") then + DebugPrint( "Blocking Button input for " .. f30_arg1.button .. " because m_ignoreButtonInput is true" ) + return false + end + local f30_local0 = f30_arg0 + if f30_arg1.target then + f30_local0 = f30_arg1.target + end + local f30_local1 = LUI.UIElement.processEvent( f30_local0, f30_arg1 ) + if not f30_local1 and LUI.UIRoot.IsNavigationEvent( f30_arg1 ) then + f30_arg0.flowManager:CheckRestoreFocus() + end + return f30_local1 +end + diff --git a/lui/luisafeareaoverlay.dec.lua b/lui/luisafeareaoverlay.dec.lua new file mode 100644 index 0000000..2c93ce9 --- /dev/null +++ b/lui/luisafeareaoverlay.dec.lua @@ -0,0 +1,75 @@ +LUI.UISafeAreaOverlay = {} +LUI.UISafeAreaOverlay.new = function () + local self = LUI.UIElement.new( { + left = 0, + top = 0, + right = 0, + bottom = 0, + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true + } ) + self.leftBorder = LUI.UIImage.new( { + left = 0, + top = 36, + right = 48, + bottom = -36, + topAnchor = true, + leftAnchor = true, + rightAnchor = false, + bottomAnchor = true, + red = 0, + green = 0, + blue = 1, + alpha = 0.5 + } ) + self:addElement( self.leftBorder ) + self.rightBorder = LUI.UIImage.new( { + left = -48, + top = 36, + right = 0, + bottom = -36, + topAnchor = true, + leftAnchor = false, + rightAnchor = true, + bottomAnchor = true, + red = 0, + green = 0, + blue = 1, + alpha = 0.5 + } ) + self:addElement( self.rightBorder ) + self.topBorder = LUI.UIImage.new( { + left = 0, + top = 0, + right = 0, + bottom = 36, + topAnchor = true, + leftAnchor = true, + rightAnchor = true, + bottomAnchor = false, + red = 0, + green = 0, + blue = 1, + alpha = 0.5 + } ) + self:addElement( self.topBorder ) + self.bottomBorder = LUI.UIImage.new( { + left = 0, + top = -36, + right = 0, + bottom = 0, + topAnchor = false, + leftAnchor = true, + rightAnchor = true, + bottomAnchor = true, + red = 0, + green = 0, + blue = 1, + alpha = 0.5 + } ) + self:addElement( self.bottomBorder ) + return self +end + diff --git a/lui/luiscrollable.dec.lua b/lui/luiscrollable.dec.lua new file mode 100644 index 0000000..0687ba4 --- /dev/null +++ b/lui/luiscrollable.dec.lua @@ -0,0 +1,74 @@ +LUI.UIScrollable = {} +local f0_local0 = function ( f1_arg0, f1_arg1 ) + f1_arg0.container:addElement( f1_arg1 ) +end + +local f0_local1 = function ( f2_arg0, f2_arg1, f2_arg2, f2_arg3, f2_arg4 ) + f2_arg0.container:registerAnimationState( "scroll_target", { + left = f2_arg1, + right = f2_arg1 + f2_arg0.containerWidth, + leftAnchor = true + } ) + f2_arg0.container:animateToState( "scroll_target", f2_arg2, f2_arg3, f2_arg4 ) +end + +local f0_local2 = function ( f3_arg0, f3_arg1, f3_arg2, f3_arg3, f3_arg4 ) + local f3_local0 = f3_arg0:getHeight() + if f3_arg1 > 0 then + f3_arg1 = 0 + elseif f3_arg1 < -f3_arg0.containerHeight + f3_local0 then + f3_arg1 = -f3_arg0.containerHeight + f3_local0 + end + f3_arg0.container:registerAnimationState( "scroll_target", { + top = f3_arg1, + bottom = f3_arg1 + f3_arg0.containerHeight, + topAnchor = true, + bottomAnchor = false + } ) + f3_arg0.container:animateToState( "scroll_target", f3_arg2, f3_arg3, f3_arg4 ) +end + +LUI.UIScrollable.new = function ( f4_arg0, f4_arg1, f4_arg2, f4_arg3 ) + if f4_arg1 == nil or f4_arg2 == nil then + error( "Cannot create scrollable component without valid dimensions!" ) + return + end + local self = LUI.UIElement.new( f4_arg0 ) + self.id = "LUIScrollable" + self:setHandleMouse( true ) + if f4_arg3 == true then + self.container = LUI.UIElement.new( { + left = -f4_arg1 / 2, + top = -f4_arg2 / 2, + right = f4_arg1 / 2, + bottom = f4_arg2 / 2, + leftAnchor = false, + topAnchor = false, + rightAnchor = false, + bottomAnchor = false, + zoom = 0 + } ) + else + self.container = LUI.UIElement.new( { + left = 0, + top = 0, + right = f4_arg1, + bottom = f4_arg2, + leftAnchor = true, + topAnchor = true, + rightAnchor = false, + bottomAnchor = false, + zoom = 0 + } ) + end + self.container.id = "LUIScrollable_Container" + self:setUseStencil( true ) + self.containerWidth = f4_arg1 + self.containerHeight = f4_arg2 + self:addElement( self.container ) + self.addElement = f0_local0 + self.scrollX = f0_local1 + self.scrollY = f0_local2 + return self +end + diff --git a/lui/luiscrollingverticallist.dec.lua b/lui/luiscrollingverticallist.dec.lua new file mode 100644 index 0000000..dbab350 --- /dev/null +++ b/lui/luiscrollingverticallist.dec.lua @@ -0,0 +1,178 @@ +LUI.UIScrollingVerticalList = {} +function RefreshScrollList( f1_arg0, f1_arg1 ) + f1_arg0:closeChildren() + f1_arg0:clearSavedState() + f1_arg0:processEvent( { + name = "menu_refresh" + } ) +end + +function CreateArrowButton( f2_arg0, f2_arg1, f2_arg2, f2_arg3, f2_arg4, f2_arg5, f2_arg6, f2_arg7, f2_arg8 ) + local self = LUI.UIButton.new( { + leftAnchor = false, + rightAnchor = true, + topAnchor = f2_arg3, + bottomAnchor = f2_arg5, + left = -90, + right = -75, + top = f2_arg2, + bottom = f2_arg4, + alpha = 1, + zRot = f2_arg6 + } ) + self.id = f2_arg0 + self.m_requireFocusType = FocusType.MouseOver + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:animateToState( "hidden" ) + self:addEventHandler( "button_action", function ( f3_arg0, f3_arg1 ) + f3_arg0:dispatchEventToRoot( { + name = f2_arg7, + dispatchChildren = true + } ) + end ) + self:addEventHandler( "list_scroll", f2_arg8 ) + local f2_local1 = LUI.UIImage.new() + f2_local1.id = f2_arg0 .. "_image" + f2_local1:registerAnimationState( "default", { + material = RegisterMaterial( "widg_lobby_arrow" ), + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or Colors.frontend_hilite.r, + green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or Colors.frontend_hilite.g, + blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or Colors.frontend_hilite.b + } ) + f2_local1:animateToState( "default" ) + self:addElement( f2_local1 ) + return self +end + +function CreateListDef( f4_arg0, f4_arg1, f4_arg2, f4_arg3 ) + f4_arg0.scrollByChildHeight = true + f4_arg0.disableOutsideChildren = true + f4_arg0.sendScrollEvents = true + return { + type = "UIVerticalList", + id = "scroll_list_vlist", + focusable = true, + properties = f4_arg0, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = f4_arg2, + bottom = -f4_arg3 + } + }, + handlers = { + refresh_scroll_list = RefreshScrollList, + scroll_up = function ( f5_arg0, f5_arg1 ) + f5_arg0:SetVerticalListScrollUp() + end + , + scroll_down = function ( f6_arg0, f6_arg1 ) + f6_arg0:SetVerticalListScrollDown() + end + + }, + childrenFeeder = f4_arg1 + } +end + +function SetChildrenIgnoreMouse( f7_arg0, f7_arg1 ) + local f7_local0 = f7_arg0:getNumChildren() + local f7_local1 = f7_arg0:getFirstChild() + for f7_local2 = 1, f7_local0, 1 do + local f7_local5 = f7_local2 + f7_local1.m_focusLockedByScrolling = f7_arg1.ignore + f7_local1 = f7_local1:getNextSibling() + end +end + +LUI.UIScrollingVerticalList.build = function ( f8_arg0, f8_arg1 ) + return LUI.UIScrollingVerticalList.new( f8_arg0, f8_arg1 ) +end + +LUI.UIScrollingVerticalList.new = function ( menu, controller ) + local self = LUI.UIElement.new() + if not controller then + controller = {} + end + self.id = "UIScrollingVList" + local f9_local1 = menu.childrenFeeder + if menu.childrenFeeder then + menu.childrenFeeder = nil + end + local f9_local2 = 0 + local f9_local3 = 0 + if controller.use_arrows then + local f9_local4 = function ( f10_arg0, f10_arg1 ) + if f10_arg1.show_up_arrow then + f10_arg0:animateToState( "default", 0 ) + f10_arg0:processEvent( { + name = "enable" + } ) + else + f10_arg0:animateToState( "hidden", 0 ) + f10_arg0:processEvent( { + name = "disable" + } ) + end + end + + f9_local2 = 30 + self:addElement( CreateArrowButton( "scroll_list_up_arrow", self, 0, true, 30, false, 90, "scroll_up", f9_local4 ) ) + local f9_local5 = function ( f11_arg0, f11_arg1 ) + if f11_arg1.show_down_arrow then + f11_arg0:animateToState( "default", 0 ) + f11_arg0:processEvent( { + name = "enable" + } ) + else + f11_arg0:animateToState( "hidden", 0 ) + f11_arg0:processEvent( { + name = "disable" + } ) + end + end + + f9_local3 = 30 + self:addElement( CreateArrowButton( "scroll_list_down_arrow", self, -30, false, 0, true, -90, "scroll_down", f9_local5 ) ) + end + local f9_local6 = LUI.MenuBuilder.buildItems( CreateListDef( controller, f9_local1, f9_local2, f9_local3 ), controller, stencil ) + f9_local6:setUseStencil( true ) + self:addElement( f9_local6 ) + f9_local6:registerEventHandler( "set_children_ignore_mouse", SetChildrenIgnoreMouse ) + if controller.use_scrollbar then + self:addElement( LUI.UIVerticalScrollbar.new( f9_local6, controller.bar_width, 1, 1, controller.scrollbar_move_func, controller.bar_color, controller.bar_bg_color, controller.bar_material, controller.bar_bg_material ) ) + end + self.vlist = f9_local6 + self.addElement = LUI.UIScrollingVerticalList.AddElement + self.removeElement = LUI.UIScrollingVerticalList.RemoveElement + self.closeChildren = LUI.UIScrollingVerticalList.CloseChildren + return self +end + +LUI.UIScrollingVerticalList.AddElement = function ( f12_arg0, f12_arg1 ) + f12_arg0.vlist:addElement( f12_arg1 ) +end + +LUI.UIScrollingVerticalList.RemoveElement = function ( f13_arg0, f13_arg1 ) + f13_arg0.vlist:removeElement( f13_arg1 ) +end + +LUI.UIScrollingVerticalList.CloseChildren = function ( f14_arg0 ) + f14_arg0.vlist:closeChildren() +end + diff --git a/lui/luitechydigits.dec.lua b/lui/luitechydigits.dec.lua new file mode 100644 index 0000000..a937b4d --- /dev/null +++ b/lui/luitechydigits.dec.lua @@ -0,0 +1,21 @@ +LUI.UITechyDigits = InheritFrom( LUI.UIText ) +LUI.UITechyDigits.build = function ( f1_arg0, f1_arg1 ) + return LUI.UITechyDigits.new() +end + +LUI.UITechyDigits.new = function ( f2_arg0, f2_arg1, f2_arg2, f2_arg3, f2_arg4, f2_arg5 ) + local self = LUI.UIText.new() + if LUI.UIElement.setupTechyDigits then + self:setupTechyDigits() + end + self.digits = f2_arg0 or 10 + self.longWait = f2_arg1 or 340 + self.shortWaitMin = f2_arg2 or 20 + self.shortWaitMax = f2_arg3 or 60 + self.pulsesMin = f2_arg4 or 3 + self.pulsesMax = f2_arg5 or 7 + self:setClass( LUI.UITechyDigits ) + return self +end + +LUI.UITechyDigits.id = "LUITechyDigits" diff --git a/lui/luitest.dec.lua b/lui/luitest.dec.lua new file mode 100644 index 0000000..599eca1 --- /dev/null +++ b/lui/luitest.dec.lua @@ -0,0 +1,369 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +DebugPrint( "Registering luitest menu" ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + DebugPrint( "Got event " .. f1_arg1.name ) +end + +f0_local1 = function ( f2_arg0 ) + DebugPrint( "push func!" ) +end + +f0_local2 = function ( f3_arg0 ) + DebugPrint( "pop func!" ) +end + +local f0_local3 = function () + return { + table1 = { + key = "value", + key2 = 2 + }, + item = 5 + } +end + +local f0_local4 = function () + DebugPrint( "test function!!!!!!!!!!!!!!!!!!!!" ) + local f5_local0 = f0_local3() + f5_local0.item = 6 + f5_local0.table1.key2 = 5 + local f5_local1 = f0_local3() + DebugPrint( f5_local1.item ) + DebugPrint( f5_local1.table1.key2 ) +end + +local f0_local5 = function () + return { + type = "UIText", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 25, + alignment = LUI.Alignment.Left + } + } + } +end + +local f0_local6 = function () + return { + type = "debugText" + } +end + +debugFocus = true +local f0_local7 = function ( f8_arg0 ) + debugFocus = not debugFocus + return debugFocus +end + +local f0_local8 = function ( f9_arg0 ) + return { + { + type = "debugButton", + id = "button1", + properties = { + text = "Open This Menu", + additional_handlers = { + button_action = MBh.OpenMenu( "luitest", true ) + } + } + }, + { + type = "debugButton", + id = "button2", + properties = { + text = "Open Popup", + defaultDuration = 3000, + additional_handlers = { + button_action = MBh.PopupMenu( "testPopup", true ) + } + } + }, + { + type = "debugButton", + id = "button3", + properties = { + text = "Handles Alt 1 As Well", + additional_handlers = { + button_action = function () + crash = me + end + , + button_alt1 = MBh.HandlePrint( "Button 3 Alt 1" ) + } + }, + disabledFunc = f0_local7 + }, + { + type = "derivedDebugText", + properties = { + text = "Hello" + } + }, + { + type = "derivedDebugText", + properties = { + text = "world" + } + } + } +end + +function debugList() + return { + type = "UIVerticalList", + id = "testMenu", + focusable = true, + states = { + default = { + left = 0, + top = 0, + right = 0, + bottom = 0, + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = true + } + } + } +end + +function debugButton() + return { + type = "UIButton", + id = "debugButtonDefaultId", + properties = { + text = "button", + width = 400, + height = 35, + defaultDuration = 500 + }, + focusable = true, + children = { + { + type = "UIImage", + id = "image", + properties = { + defaultDuration = MBh.Property( "defaultDuration" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + scale = 1 + }, + button_over = MBh.BaseState( "default", { + scale = 0.8 + } ), + pulse_1 = MBh.BaseState( "default" ), + pulse_2 = MBh.BaseState( "default", { + scale = 0.8 + } ) + }, + handlers = { + button_over = MBh.AnimateLoop( { + { + "pulse_1", + 200, + true, + true + }, + { + "pulse_2", + 200, + true, + true + } + } ), + button_up = MBh.AnimateToState( "default", 1000, true, true ), + button_disable = MBh.AnimateToState( "default", 1000, true, true ) + } + }, + { + type = "derivedDebugText", + id = "theText", + properties = { + text = MBh.Property( "text" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 25, + alignment = LUI.Alignment.Left + } + } + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = MBh.Property( "width" ), + top = 0, + bottom = 35, + scale = 1, + alpha = 1 + }, + disabled = { + alpha = 0.5, + scale = 1 + }, + button_over = MBh.BaseState( "default", { + scale = 1.2 + } ) + }, + handlers = { + button_over = MBh.DoMultiple( { + MBh.AnimateToState( "button_over", MBh.Property( "defaultDuration" ), true, true ), + f0_local0 + } ), + button_up = MBh.AnimateToState( "default", 1000, true, true ), + button_disable = MBh.AnimateToState( "disabled", 1000, true, true ) + } + } +end + +local f0_local9 = function () + return { + type = "UIElement", + id = "testDef", + focusable = true, + pushFunc = f0_local1, + popFunc = f0_local2, + properties = { + menu_feeder = MBh.Function( f0_local8 ) + }, + children = { + { + type = "debugList", + id = "debugList", + properties = { + menu_feeder = MBh.Property( "menu_feeder" ) + }, + childrenFeeder = MBh.Property( "menu_feeder" ) + }, + { + type = "backButton", + id = "backButton" + }, + { + type = "UITimer", + properties = { + event = "menu_refresh", + interval = 3000, + disposable = false, + broadcastToRoot = true + } + } + }, + states = { + default = { + left = 100, + top = 100, + right = 0, + bottom = 0, + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = true + } + }, + handlers = { + menu_create = f0_local4, + menu_close = function () + DebugPrint( "menu closed!" ) + end + + } + } +end + +local f0_local10 = function () + return { + type = "UIBindButton", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } +end + +LUI.MenuBuilder.registerDef( "testPopup", function () + return { + type = "UIElement", + focusable = true, + id = "testPopup", + properties = { + text = "Popup text" + }, + children = { + { + type = "derivedDebugText", + properties = { + text = MBh.Property( "text" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + alignment = LUI.Alignment.Left + } + } + }, + { + type = "backButton", + id = "popupBackButton" + } + }, + states = { + default = { + leftAnchor = false, + rightAnchor = false, + topAnchor = false, + bottomAnchor = false, + left = -100, + right = 100, + top = -20, + bottom = 20 + } + } + } +end ) +LUI.MenuBuilder.registerDef( "backButton", f0_local10 ) +LUI.MenuBuilder.registerDef( "debugText", f0_local5 ) +LUI.MenuBuilder.registerDef( "derivedDebugText", f0_local6 ) +LUI.MenuBuilder.registerDef( "debugList", debugList ) +LUI.MenuBuilder.registerDef( "debugButton", debugButton ) +LUI.MenuBuilder.registerDef( "luitest", f0_local9 ) +LockTable( _M ) diff --git a/lui/luitext.dec.lua b/lui/luitext.dec.lua new file mode 100644 index 0000000..94179a5 --- /dev/null +++ b/lui/luitext.dec.lua @@ -0,0 +1,44 @@ +LUI.UIText = InheritFrom( LUI.UIElement ) +LUI.UIText.build = function ( f1_arg0, f1_arg1 ) + return LUI.UIText.new() +end + +LUI.UIText.new = function ( f2_arg0 ) + local self = LUI.UIElement.new( f2_arg0 ) + self:setClass( LUI.UIText ) + self:setupUIText() + return self +end + +LUI.UIText.TransitionComplete_OutState = function ( f3_arg0, f3_arg1 ) + f3_arg0:setText( f3_arg0.replaceContentData.text ) + f3_arg0:registerEventHandler( "transition_complete_" .. f3_arg0.replaceContentData.outState, nil ) + f3_arg0:animateToState( f3_arg0.replaceContentData.inState, f3_arg0.replaceContentData.inDuration ) + f3_arg0.replaceContentData = nil +end + +LUI.UIText.setText = function ( f4_arg0, f4_arg1, f4_arg2, f4_arg3, f4_arg4, f4_arg5 ) + if f4_arg2 ~= nil and f4_arg3 ~= nil then + f4_arg0.replaceContentData = {} + f4_arg0.replaceContentData.outState = f4_arg2 + f4_arg0.replaceContentData.inState = f4_arg3 + f4_arg0.replaceContentData.outDuration = f4_arg4 + f4_arg0.replaceContentData.inDuration = f4_arg5 + f4_arg0.replaceContentData.text = f4_arg1 + f4_arg0:registerEventHandler( "transition_complete_" .. f4_arg2, LUI.UIText.TransitionComplete_OutState ) + f4_arg0:animateToState( f4_arg2, f4_arg4 ) + return + else + f4_arg0:setTextInC( f4_arg1 ) + end +end + +LUI.UIText.setTextStyle = function ( f5_arg0, f5_arg1 ) + f5_arg0.m_textStyle = f5_arg1 +end + +LUI.UIText.setForceLineBreaks = function ( f6_arg0, f6_arg1 ) + f6_arg0.m_forceLineBreaks = f6_arg1 +end + +LUI.UIText.id = "LUIText" diff --git a/lui/luitighttext.dec.lua b/lui/luitighttext.dec.lua new file mode 100644 index 0000000..5acbbd3 --- /dev/null +++ b/lui/luitighttext.dec.lua @@ -0,0 +1,7 @@ +LUI.UITightText = {} +LUI.UITightText.new = function ( f1_arg0 ) + local self = LUI.UIText.new( f1_arg0 ) + self:setupUITightText() + return self +end + diff --git a/lui/luitimer.dec.lua b/lui/luitimer.dec.lua new file mode 100644 index 0000000..87d3779 --- /dev/null +++ b/lui/luitimer.dec.lua @@ -0,0 +1,134 @@ +LUI.UITimer = {} +local f0_local0 = {} +LUI.UITimer.priority = 10000 +Queue = { + new = function () + local f1_local0 = { + first = 0, + last = -1 + } + setmetatable( f1_local0, Queue ) + Queue.__index = Queue + return f1_local0 + end, + push = function ( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg0.last + 1 + f2_arg0.last = f2_local0 + f2_arg0[f2_local0] = f2_arg1 + end, + pop = function ( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg0.first + if f3_arg0.last < f3_local0 then + return nil + else + local f3_local1 = f3_arg0[f3_local0] + f3_arg0[f3_local0] = nil + f3_arg0.first = f3_local0 + 1 + return f3_local1 + end + end +} +LUI.UITimer.build = function ( f4_arg0, f4_arg1 ) + assert( f4_arg1.interval, "No property for interval set for timer" ) + assert( f4_arg1.event, "No property for event set for timer" ) + return LUI.UITimer.new( f4_arg1.interval, f4_arg1.event, f4_arg1.group, f4_arg1.disposable, f4_arg1.eventTarget, f4_arg1.broadcastToRoot, f4_arg1.stopped ) +end + +LUI.UITimer.new = function ( f5_arg0, f5_arg1, f5_arg2, f5_arg3, f5_arg4, f5_arg5, f5_arg6 ) + local self = LUI.UIElement.new( { + left = 0, + top = 0, + right = 1, + bottom = 1, + leftAnchor = true, + topAnchor = true, + rightAnchor = false, + bottomAnchor = false + } ) + self.id = "LUITimer" + self:setPriority( LUI.UITimer.priority ) + self.reset = LUI.UITimer.Reset + self.interval = math.max( 1, f5_arg0 ) + self.disposable = f5_arg3 + self.deferNextFrame = f5_arg5 + if type( f5_arg1 ) == "string" then + self.timerEvent = { + name = f5_arg1, + timer = self + } + else + f5_arg1.timer = self + self.timerEvent = f5_arg1 + end + self.timerEventTarget = f5_arg4 + self.timerGroup = f5_arg2 + local f5_local1 = "TE_" .. (self.timerGroup and self.timerGroup .. "_" or "") .. self.timerEvent.name + self.profileID = profile.lookupusereventid( f5_local1 ) or profile.createuserevent( f5_local1, "duration" ) + if not f5_arg6 then + self:reset() + end + return self +end + +LUI.UITimer.Reset = function ( f6_arg0 ) + f6_arg0:registerEventHandler( "transition_complete_default", nil ) + f6_arg0:animateToState( "default", f6_arg0.interval ) + f6_arg0:registerEventHandler( "transition_complete_default", LUI.UITimer.Tick ) +end + +LUI.UITimer.Stop = function ( f7_arg0 ) + f7_arg0:registerEventHandler( "transition_complete_default", nil ) + f7_arg0:animateToState( "default", 0 ) +end + +LUI.UITimer.Tick = function ( f8_arg0, f8_arg1 ) + local f8_local0 = nil + if f8_arg0.timerEventTarget ~= nil then + f8_local0 = f8_arg0.timerEventTarget + else + f8_local0 = f8_arg0:getParent() + end + local f8_local1 = f8_arg0.timerEvent + f8_local1.timeElapsed = f8_arg0.interval + f8_arg1.lateness + if f8_arg0.timerGroup then + f8_local1.target = f8_local0 + local f8_local2 = f8_arg0:getRootParent() + local f8_local3 = f8_arg0.timerGroup + if not f8_local2.timerGroupQueues[f8_local3] then + f8_local2.timerGroupQueues[f8_local3] = Queue.new() + end + f8_local2.timerGroupQueues[f8_local3]:push( f8_local1 ) + else + if not f8_arg0.deferNextFrame then + profile.beginuserevent( f8_arg0.profileID ) + f8_local0:processEvent( f8_local1 ) + profile.enduserevent( f8_arg0.profileID ) + else + f8_local1.target = f8_local0 + f8_arg0:dispatchEventToRoot( f8_local1 ) + end + if f8_arg0.disposable then + f8_arg0:close() + else + f8_arg0:reset() + end + end +end + +LUI.UITimer.DispatchEventsFromQueue = function ( f9_arg0 ) + for f9_local4, f9_local5 in pairs( f9_arg0.timerGroupQueues ) do + local f9_local6 = f9_local5:pop() + if f9_local6 then + profile.beginuserevent( f9_local6.timer.profileID ) + f9_local6.target:processEvent( f9_local6 ) + profile.enduserevent( f9_local6.timer.profileID ) + local f9_local3 = f9_local6.timer + if f9_local3.disposable then + f9_local3:close() + else + f9_local3:reset() + end + end + end +end + diff --git a/lui/luiverticallist.dec.lua b/lui/luiverticallist.dec.lua new file mode 100644 index 0000000..aa7ce7d --- /dev/null +++ b/lui/luiverticallist.dec.lua @@ -0,0 +1,185 @@ +LUI.UIVerticalList = {} +LUI.UIVerticalNavigator = {} +LUI.UIVerticalList.AddSpacer = function ( f1_arg0, f1_arg1, f1_arg2 ) + local self = LUI.UIElement.new( { + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + topAnchor = true, + bottomAnchor = false, + top = 0, + bottom = f1_arg1 + } ) + self:setPriority( f1_arg2 ) + f1_arg0:addElement( self ) + return self +end + +LUI.UIVerticalList.build = function ( menu, controller ) + local self = LUI.UIVerticalList.new( nil, controller.scrollByChildHeight, controller.disableOutsideChildren, controller.sendScrollEvents ) + LUI.UIVerticalList.SetNoWrap( self, controller.noWrap ) + return self +end + +LUI.UIVerticalList.new = function ( f3_arg0, f3_arg1, f3_arg2, f3_arg3 ) + local self = LUI.UIElement.new( f3_arg0 ) + self.id = "LUIVerticalList" + self:setupUIVerticalList( f3_arg1, f3_arg2, f3_arg3 ) + self.addSpacer = LUI.UIVerticalList.AddSpacer + self.addElement = LUI.UIVerticalList.AddElement + self.removeElement = LUI.UIVerticalList.RemoveElement + self.updateNavigation = LUI.UIVerticalList.UpdateNavigation + self:registerEventHandler( "gain_focus", LUI.UIVerticalList.gainFocus ) + self:registerEventHandler( "update_navigation", function ( element, event ) + element:updateNavigation() + end ) + return self +end + +LUI.UIVerticalList.SetNoWrap = function ( f5_arg0, f5_arg1 ) + f5_arg0.noWrap = f5_arg1 +end + +LUI.UIVerticalNavigator.build = function ( f6_arg0, f6_arg1 ) + return LUI.UIVerticalNavigator.new() +end + +LUI.UIVerticalNavigator.new = function ( f7_arg0 ) + local self = LUI.UIElement.new( f7_arg0 ) + self.id = "LUIVerticalNavigator" + self.addSpacer = LUI.UIVerticalList.AddSpacer + self.addElement = LUI.UIVerticalList.AddElement + self.removeElement = LUI.UIVerticalList.RemoveElement + self.updateNavigation = LUI.UIVerticalList.UpdateNavigation + self:registerEventHandler( "gain_focus", LUI.UIVerticalList.gainFocus ) + self:registerEventHandler( "update_navigation", function ( element, event ) + element:updateNavigation() + end ) + return self +end + +LUI.UIVerticalList.AddElement = function ( f9_arg0, f9_arg1 ) + LUI.UIElement.addElement( f9_arg0, f9_arg1 ) + f9_arg1.navigation = {} + f9_arg0:setLayoutCached( false ) + f9_arg0:updateNavigation() +end + +LUI.UIVerticalList.RemoveElement = function ( f10_arg0, f10_arg1 ) + LUI.UIElement.removeElement( f10_arg0, f10_arg1 ) + f10_arg0:setLayoutCached( false ) + f10_arg0:updateNavigation() +end + +LUI.UIVerticalList.UpdateNavigation = function ( f11_arg0 ) + local f11_local0, f11_local1 = nil + local f11_local2 = f11_arg0:getFirstChild() + while f11_local2 ~= nil do + if f11_local2:canFocus( FocusType.ListSelection ) then + if f11_local0 == nil then + f11_local0 = f11_local2 + end + if f11_local1 ~= nil then + f11_local1.navigation.down = f11_local2 + f11_local2.navigation.up = f11_local1 + else + f11_local2.navigation.up = nil + end + if f11_local2.navigation ~= nil and f11_arg0.navigation ~= nil then + f11_local2.navigation.left = f11_arg0.navigation.left + f11_local2.navigation.right = f11_arg0.navigation.right + end + f11_local1 = f11_local2 + end + f11_local2 = f11_local2:getNextSibling() + end + if f11_local1 ~= nil then + if f11_arg0.navigation ~= nil and f11_arg0.navigation.down ~= nil and f11_arg0.navigation.down:canFocus( FocusType.ListSelection ) == true then + f11_local1.navigation.down = f11_arg0.navigation.down + f11_arg0.navigation.down.navigation.up = f11_local1 + elseif f11_local1 ~= f11_local0 and not f11_arg0.noWrap then + f11_local1.navigation.down = f11_local0 + else + f11_local1.navigation.down = nil + end + if f11_arg0.navigation ~= nil and f11_arg0.navigation.up ~= nil and f11_arg0.navigation.up:canFocus( FocusType.ListSelection ) == true then + f11_local0.navigation.up = f11_arg0.navigation.up + f11_arg0.navigation.up.navigation.down = f11_local0 + elseif f11_local1 ~= f11_local0 and not f11_arg0.noWrap then + f11_local0.navigation.up = f11_local1 + else + f11_local0.navigation.up = nil + end + end +end + +LUI.UIVerticalList.gainFocus = function ( f12_arg0, f12_arg1 ) + local f12_local0, f12_local1 = f12_arg0:restoreState() + if f12_local1 == 0 then + local f12_local2, f12_local3 = nil + local f12_local4 = f12_arg0:getFirstChild() + while f12_local4 ~= nil do + if f12_local4:canFocus( FocusType.ListSelection ) then + if f12_local2 == nil then + f12_local2 = f12_local4 + end + if f12_local3 == nil and f12_local4.listDefaultFocus then + f12_local3 = f12_local4 + end + end + end + if f12_local3 ~= nil then + f12_local3:processEvent( f12_arg1 ) + elseif f12_local2 ~= nil then + f12_local2:processEvent( f12_arg1 ) + else + + end + f12_local4 = f12_local4:getNextSibling() + end +end + +LUI.UIVerticalList.getHeightOfChildren = function ( f13_arg0, f13_arg1 ) + local f13_local0 = f13_arg0:getRect() + local f13_local1 = f13_arg1 or 0 + if f13_local0 then + local f13_local2 = f13_arg0:getFirstChild() + local f13_local3 + if f13_local2 then + f13_local3 = -f13_local1 + if not f13_local3 then + f13_local3 = 0 + while f13_local2 do + local f13_local4 = nil + if f13_local2.getText and f13_local2:getText() then + local f13_local5 = nil + f13_local5, f13_local4 = f13_local2:getElementTextDims() + else + f13_local4 = f13_local2:getHeight() + end + f13_local3 = f13_local3 + f13_local1 + f13_local4 + f13_local2 = f13_local2:getNextSibling() + end + return f13_local3 + end + else + f13_local3 = 0 + while f13_local2 do + local f13_local4 = nil + if f13_local2.getText and f13_local2:getText() then + local f13_local5 = nil + f13_local5, f13_local4 = f13_local2:getElementTextDims() + else + f13_local4 = f13_local2:getHeight() + end + f13_local3 = f13_local3 + f13_local1 + f13_local4 + f13_local2 = f13_local2:getNextSibling() + end + return f13_local3 + end + else + + end +end + diff --git a/lui/luiverticalscrollbar.dec.lua b/lui/luiverticalscrollbar.dec.lua new file mode 100644 index 0000000..6d94df7 --- /dev/null +++ b/lui/luiverticalscrollbar.dec.lua @@ -0,0 +1,261 @@ +LUI.UIVerticalScrollbar = {} +LUI.UIVerticalScrollbar.InactiveDelay = 500 +LUI.UIVerticalScrollbar.InactiveDuration = 250 +function OnMouseMove( f1_arg0, f1_arg1 ) + if f1_arg0.scrolling then + local f1_local0 = f1_arg0:getParent() + local f1_local1 = f1_local0:getHeight() + local f1_local2, f1_local3, f1_local4, f1_local5 = f1_local0:getRect() + local f1_local6, f1_local7 = f1_arg1.root:pixelsToUnits( f1_arg1.x, f1_arg1.y ) + f1_local2, f1_local3 = f1_arg1.root:pixelsToUnits( f1_local2, f1_local3 ) + local f1_local8 = (f1_local7 - f1_local3) / f1_local1 + if f1_local8 < 0 then + f1_local8 = 0 + elseif f1_local8 > 1 then + f1_local8 = 1 + end + if f1_arg0.onMoveFunc then + f1_arg0.onMoveFunc( f1_local0, f1_local0.verticalList, f1_local8, f1_local0.properties ) + end + end +end + +function MouseMoveEvent( f2_arg0, f2_arg1 ) + f2_arg0:applyElementTransform() + local f2_local0, f2_local1 = ProjectRootCoordinate( f2_arg1.rootName, f2_arg1.x, f2_arg1.y ) + OnMouseMove( f2_arg0, { + controller = f2_arg1.controller, + root = f2_arg1.root, + x = f2_local0, + y = f2_local1 + } ) + f2_arg0:undoElementTransform() +end + +function ScrollbarMoved( f3_arg0, f3_arg1, f3_arg2 ) + if not f3_arg1 then + DebugPrint( "Warning: Tried to scroll a scrollbar without a vertical list. Make sure the vertical list was manually added. E.G. scrollBar:setList( )." ) + return + elseif not f3_arg2 then + DebugPrint( "Warning: Tried to scroll a scrollbar without a scroll percentage. This is very bad." ) + return + end + local f3_local0 = f3_arg1:getNumChildren() + local f3_local1 = math.min( math.floor( f3_arg2 * f3_local0 ), f3_local0 - 1 ) + if f3_local1 == f3_arg1.lastFocusIndex then + return + end + f3_arg1.lastFocusIndex = f3_local1 + local f3_local2 = f3_arg1:getFirstChild() + local f3_local3 = nil + for f3_local4 = 0, f3_local0 - 1, 1 do + if f3_local4 == f3_local1 then + f3_local3 = f3_local2 + end + f3_local2:processEvent( { + name = "lose_focus", + immediate = true + } ) + f3_local2 = f3_local2:getNextSibling() + end + if f3_local3 then + f3_local3:processEvent( { + name = "gain_focus", + immediate = true + } ) + end +end + +function OnMouseDown( f4_arg0, f4_arg1 ) + f4_arg0.scrolling = true + local f4_local0 = Engine.SetUsingScrollbar + local f4_local1 = f4_arg1.controller + if not f4_local1 then + f4_local1 = Engine.GetFirstActiveController() + end + f4_local0( f4_local1, true ) + OnMouseMove( f4_arg0, f4_arg1 ) + f4_local0 = f4_arg0:getParent() + if f4_local0.verticalList then + f4_local0.verticalList:processEvent( { + name = "set_children_ignore_mouse", + ignore = true, + immediate = true + } ) + end +end + +function StopScrolling( f5_arg0, f5_arg1 ) + f5_arg0.scrolling = false + local f5_local0 = Engine.SetUsingScrollbar + local f5_local1 = f5_arg1.controller + if not f5_local1 then + f5_local1 = Engine.GetFirstActiveController() + end + f5_local0( f5_local1, false ) + f5_local0 = f5_arg0:getParent() + if f5_local0.verticalList then + f5_local0.verticalList:processEvent( { + name = "set_children_ignore_mouse", + ignore = false, + immediate = true + } ) + end +end + +LUI.UIVerticalScrollbar.build = function ( f6_arg0, f6_arg1 ) + return LUI.UIVerticalScrollbar.new( f6_arg1.vlist, f6_arg1.bar_width, f6_arg1.active_alpha, f6_arg1.inactive_alpha, f6_arg1.on_move_func, f6_arg1.bar_color, f6_arg1.bg_color, f6_arg1.bar_material, f6_arg1.bg_material ) +end + +LUI.UIVerticalScrollbar.new = function ( f7_arg0, f7_arg1, f7_arg2, f7_arg3, f7_arg4, f7_arg5, f7_arg6, f7_arg7, f7_arg8 ) + if not f7_arg1 then + f7_arg1 = 20 + end + if not f7_arg2 then + f7_arg2 = 1 + end + if not f7_arg3 then + f7_arg3 = 1 + end + if not f7_arg4 then + f7_arg4 = ScrollbarMoved + end + if not f7_arg5 then + f7_arg5 = { + red = 0.3, + green = 0.3, + blue = 0.3, + alpha = 1 + } + end + if not f7_arg6 then + f7_arg6 = { + red = 0.05, + green = 0.05, + blue = 0.05, + alpha = 0.6 + } + end + if not f7_arg7 then + f7_arg7 = "white" + end + if not f7_arg8 then + f7_arg8 = "white" + end + local self = LUI.UIElement.new( { + left = 0, + top = 0, + right = f7_arg1, + bottom = 0, + leftAnchor = false, + topAnchor = true, + rightAnchor = true, + bottomAnchor = true, + alpha = f7_arg2 + } ) + self.id = "LUIVerticalScrollbar" + self:registerAnimationState( "inactive", { + left = 0, + right = f7_arg1, + leftAnchor = false, + rightAnchor = true, + alpha = f7_arg3 + } ) + self:registerEventHandler( "list_scroll", LUI.UIVerticalScrollbar.UpdateScrollbar ) + self:registerEventHandler( "focus_changed", LUI.UIVerticalScrollbar.FocusChanged ) + self:registerEventHandler( "inactive", LUI.UIVerticalScrollbar.Inactive ) + self.bgImage = LUI.UIImage.new( { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = true, + red = f7_arg6.red, + green = f7_arg6.green, + blue = f7_arg6.blue, + alpha = f7_arg6.alpha, + material = RegisterMaterial( f7_arg8 ) + } ) + self.bgImage:animateToState( "default" ) + self:addElement( self.bgImage ) + self.scrollButton = LUI.UIButton.new( { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = true + } ) + self.buttonImage = LUI.UIImage.new( { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = false, + red = f7_arg5.red, + green = f7_arg5.green, + blue = f7_arg5.blue, + alpha = f7_arg5.alpha, + material = RegisterMaterial( f7_arg7 ) + } ) + self.scrollButton.onMoveFunc = f7_arg4 + self.scrollButton:registerEventHandler( "leftmousedown", OnMouseDown ) + self.scrollButton:registerEventHandler( "leftmouseup", StopScrolling ) + self.scrollButton:addEventHandler( "popup_active", StopScrolling ) + self.scrollButton:addEventHandler( "mousemove", MouseMoveEvent ) + self.scrollButton:addElement( self.buttonImage ) + self:addElement( self.scrollButton ) + self.setList = LUI.UIVerticalScrollbar.SetVerticalList + self.manualUpdate = LUI.UIVerticalScrollbar.ManualUpdate + self:setList( f7_arg0 ) + return self +end + +LUI.UIVerticalScrollbar.UpdateScrollbar = function ( f8_arg0, f8_arg1 ) + if f8_arg0.verticalList and f8_arg1.list == f8_arg0.verticalList then + f8_arg0.buttonImage:registerAnimationState( "default", { + top = f8_arg1.scrollHandlePosition, + bottom = f8_arg1.scrollHandlePosition + f8_arg1.scrollHandleSize, + topAnchor = true, + bottomAnchor = false + } ) + f8_arg0.buttonImage:animateToState( "default" ) + end + f8_arg0:dispatchEventToChildren( f8_arg1 ) +end + +LUI.UIVerticalScrollbar.FocusChanged = function ( f9_arg0, f9_arg1 ) + f9_arg0:animateToState( "default" ) + if f9_arg0.inactiveTimer then + f9_arg0.inactiveTimer:close() + f9_arg0.inactiveTimer:reset() + f9_arg0:addElement( f9_arg0.inactiveTimer ) + else + f9_arg0.inactiveTimer = LUI.UITimer.new( LUI.UIVerticalScrollbar.InactiveDelay, "inactive", true ) + f9_arg0:addElement( f9_arg0.inactiveTimer ) + end +end + +LUI.UIVerticalScrollbar.Inactive = function ( f10_arg0, f10_arg1 ) + f10_arg0:animateToState( "inactive", LUI.UIVerticalScrollbar.InactiveDuration ) +end + +LUI.UIVerticalScrollbar.SetVerticalList = function ( f11_arg0, f11_arg1 ) + f11_arg0.verticalList = f11_arg1 +end + +LUI.UIVerticalScrollbar.ManualUpdate = function ( f12_arg0, f12_arg1, f12_arg2, f12_arg3, f12_arg4 ) + local f12_local0 = f12_arg0:getHeight() + local f12_local1 = f12_local0 + local f12_local2 = 0 + if f12_arg3 ~= 0 then + f12_local1 = math.min( f12_local0, f12_local0 * f12_arg2 / f12_arg3 ) + if f12_arg3 ~= f12_arg2 then + f12_local2 = LUI.clamp( f12_arg1 / (f12_arg3 - f12_arg2) * (f12_local0 - f12_local1), 0, f12_local0 - f12_local1 ) + end + end + f12_arg0.buttonImage:registerAnimationState( "default", { + top = f12_local2, + bottom = f12_local2 + f12_local1, + topAnchor = true, + bottomAnchor = false + } ) + f12_arg0.buttonImage:animateToState( "default" ) +end + diff --git a/lui/menuautonav.dec.lua b/lui/menuautonav.dec.lua new file mode 100644 index 0000000..edcd6b9 --- /dev/null +++ b/lui/menuautonav.dec.lua @@ -0,0 +1,780 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +INTERVAL_MS = 25 +MAX_COUNTER = 200 +MAX_COUNTER_GOBACK = 20 +MAX_DURATION_COUNTER = 400 +DISABLE_NAVIGATING_OVERLAY = 0 +STATE = { + IDLE = 0, + WORKING_DROPBACK = 1, + WORKING_MOVEFORWARD = 2 +} +LUI.MenuAutoNav.m_menuAutoNav = 0 +s_navTableSP = { + { + destScreen = "resume_campaign", + route = { + { + topScreen = "main_menu", + action = "sp_button" + }, + { + topScreen = "main_campaign", + action = "btn_resume_id" + }, + { + topScreen = "resume_game_menu", + action = "" + } + } + }, + { + destScreen = "mission_select", + route = { + { + topScreen = "main_menu", + action = "sp_button" + }, + { + topScreen = "main_campaign", + action = "btn_mission_select_id" + }, + { + topScreen = "level_select_iw6", + action = "" + } + } + }, + { + destScreen = "mp", + route = { + { + topScreen = "main_menu", + action = "mp_button" + } + }, + routeOverlayDelay = 5000 + }, + { + destScreen = "aliens", + route = { + { + topScreen = "main_menu", + action = "extinction_button" + } + }, + routeOverlayDelay = 5000 + }, + { + destScreen = "squads", + route = { + { + topScreen = "main_menu", + action = "squadvssquad_button" + } + }, + routeOverlayDelay = 5000 + } +} +s_navTableMP = { + { + destScreen = "sp", + route = { + { + topScreen = "mp_main_menu", + action = "button_secondary" + }, + { + topScreen = "main_choose_exe_popup_menu", + action = "main_choose_sp_button" + } + }, + routeOverlayDelay = 5000 + }, + { + destScreen = "mp", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_7" + } + } + }, + { + destScreen = "aliens", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_9" + } + } + }, + { + destScreen = "squads", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_8" + } + } + }, + { + destScreen = "xboxlive", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive", + action = "" + } + } + }, + { + destScreen = "splitscreen", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_1" + }, + { + topScreen = "menu_splitscreensignin", + action = "" + } + } + }, + { + destScreen = "systemlink", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_2" + }, + { + topScreen = "menu_systemlink", + action = "" + } + } + }, + { + destScreen = "options", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_6" + } + } + }, + { + destScreen = "xboxlive_findmatch", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive", + action = "find_match_button_id" + }, + { + topScreen = "playlist_main", + action = "" + } + } + }, + { + destScreen = "xboxlive_privatematch", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive", + action = "private_match_button_id" + }, + { + topScreen = "menu_xboxlive_privatelobby", + action = "" + } + } + }, + { + destScreen = "xboxlive_privatematch_gamesetup", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive", + action = "private_match_button_id" + }, + { + topScreen = "menu_xboxlive_privatelobby", + action = "setup_match_button_id" + }, + { + topScreen = "menu_systemlink_gamesetup_root", + action = "" + } + } + }, + { + destScreen = "xboxlive_create_squad", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive", + action = "create_squad_button_id" + }, + { + topScreen = "cac_edit_main", + action = "" + } + } + }, + { + destScreen = "xboxlive_barracks_leaderboards", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive", + action = "barracks_button_id" + }, + { + topScreen = "menu_barracks", + action = "leaderboard_button_id" + }, + { + topScreen = "leaderboards", + action = "" + } + } + }, + { + destScreen = "xboxlive_aliens_loadout", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive", + action = "aliens_loadout_btn_id" + }, + { + topScreen = "aliens_cac_menu", + action = "" + } + } + }, + { + destScreen = "xboxlive_aliens_leaderboards", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive", + action = "leaderboards_button_id" + }, + { + topScreen = "mp_leaderboard_main", + action = "" + } + } + }, + { + destScreen = "squadvssquad_squad_assault", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive*", + action = "squads_mode_button_squad_assault" + } + } + }, + { + destScreen = "squadvssquad_squad_vs_squad", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive*", + action = "squads_mode_button_squad_vs_squad" + } + } + }, + { + destScreen = "squadvssquad_safeguard", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive*", + action = "squads_mode_button_safeguard" + } + } + }, + { + destScreen = "squadvssquad_wargame", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive*", + action = "squads_mode_button_wargame" + } + } + }, + { + destScreen = "squadvssquad_squad_reports", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_0" + }, + { + topScreen = "menu_xboxlive*", + action = "squads_mode_button_squad_reports" + }, + { + topScreen = "squads_hq_menu*", + action = "squads_mode_button_squad_reports" + } + } + }, + { + destScreen = "squadvssquad_local_play", + route = { + { + topScreen = "mp_main_menu", + action = "btn_MPMain_1" + }, + { + topScreen = "menu_splitscreensignin", + action = "" + } + } + } +} +function new() + local f1_local0 = {} + setmetatable( f1_local0, { + __index = _M + } ) + f1_local0.m_state = STATE.IDLE + f1_local0.m_controller = -1 + f1_local0.m_counter = 0 + f1_local0.m_durationCounter = 0 + f1_local0.m_currentRoute = {} + f1_local0.m_root = 0 + f1_local0.m_timerElement = 0 + return f1_local0 +end + +function Reset() + if LUI.MenuAutoNav.ShouldCloseOverlay() then + LUI.MenuAutoNav.CloseOverlay() + end + local f2_local0 = LUI.MenuAutoNav.GetInstance() + if f2_local0.m_timerElement and f2_local0.m_timerElement ~= 0 and f2_local0.m_root and f2_local0.m_root ~= 0 then + f2_local0.m_root:removeElement( f2_local0.m_timerElement ) + f2_local0.m_timerElement:close() + end + f2_local0.m_state = STATE.IDLE + f2_local0.m_controller = -1 + f2_local0.m_counter = 0 + f2_local0.m_durationCounter = 0 + f2_local0.m_currentRoute = {} + f2_local0.m_root = 0 + f2_local0.m_timerElement = 0 +end + +function GetInstance() + if LUI.MenuAutoNav.m_menuAutoNav == 0 then + LUI.MenuAutoNav.m_menuAutoNav = LUI.MenuAutoNav.new() + end + return LUI.MenuAutoNav.m_menuAutoNav +end + +function IsRunning() + local f4_local0 = LUI.MenuAutoNav.GetInstance() + if f4_local0.m_state ~= STATE.IDLE then + return true + else + return false + end +end + +function Stop() + if IsRunning() then + Reset() + end +end + +function SendButtonPress( f6_arg0, f6_arg1, f6_arg2 ) + local f6_local0 = { + name = "gamepad_button", + immediate = true, + down = true, + button = f6_arg0, + qualifier = f6_arg1, + controller = f6_arg2 + } + local f6_local1 = Engine.GetLuiRoot() + if not f6_local1 then + return false + else + f6_local1:dispatchEventToRoot( f6_local0 ) + return true + end +end + +function FindRouteEntry( f7_arg0 ) + local f7_local0 = LUI.MenuAutoNav.GetInstance() + assert( f7_arg0 ) + local f7_local1 = nil + if Engine.IsMultiplayer() then + f7_local1 = s_navTableMP + else + f7_local1 = s_navTableSP + end + if f7_local1 then + for f7_local5, f7_local6 in ipairs( f7_local1 ) do + if f7_local6.route and string.lower( f7_arg0 ) == string.lower( f7_local6.destScreen ) then + return f7_local6 + end + end + end + return nil +end + +function Yield() + local f8_local0 = LUI.MenuAutoNav.GetInstance() + f8_local0.m_counter = f8_local0.m_counter + 1 + if f8_local0.m_counter > MAX_COUNTER then + DebugPrint( "MenuAutoNav: Timeout!" ) + LUI.MenuAutoNav.Stop() + return + else + + end +end + +function IsMenuInCurrentRoute( f9_arg0 ) + local f9_local0 = LUI.MenuAutoNav.GetInstance() + assert( f9_arg0 ) + local f9_local1 = LUI.MenuAutoNav.GetInstance() + if f9_local1.m_currentRoute then + for f9_local5, f9_local6 in ipairs( f9_local1.m_currentRoute ) do + if string.lower( f9_local6.topScreen ) == string.lower( f9_arg0 ) then + return true, f9_local5 + end + end + end + return false, -1 +end + +function HandleMenuAutoNavOverlayRefresh( f10_arg0, f10_arg1 ) + if LUI.MenuAutoNav.ShouldCloseOverlay() then + LUI.MenuAutoNav.CloseOverlay() + end +end + +function menu_auto_nav_overlay() + return { + type = "UIElement", + id = "menu_auto_nav_overlay_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + handlers = { + menu_auto_nav_overlay_refresh = HandleMenuAutoNavOverlayRefresh + }, + children = { + { + type = "UIImage", + id = "menu_auto_nav_background_id", + states = { + default = CoD.ColorizeState( Swatches.Overlay.Color, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0, + material = RegisterMaterial( "white" ), + alpha = 1 + } ) + }, + children = { + { + type = "generic_loading_widget", + properties = { + message = Engine.Localize( "@SPEECH_NAVIGATING" ) + } + } + } + }, + { + type = "UITimer", + id = "menu_auto_nav_overlay_timer", + properties = { + event = "menu_auto_nav_overlay_refresh", + interval = 25, + disposable = false, + broadcastToRoot = false + } + } + } + } +end + +function OpenOverlay( f12_arg0 ) + if DISABLE_NAVIGATING_OVERLAY ~= 0 then + return + end + local f12_local0 = Engine.GetLuiRoot() + if not f12_local0 then + DebugPrint( "MenuAutoNavOverlay: Error, no root found. Cannot open overlay." ) + return + elseif f12_local0.m_menuAutoNavOverlay then + DebugPrint( "MenuAutoNavOverlay: Ignoring open request because we are already open." ) + return + end + local m_menuAutoNavOverlay = LUI.MenuBuilder.buildItems( menu_auto_nav_overlay(), {}, f12_local0 ) + m_menuAutoNavOverlay:animateToState( "default" ) + m_menuAutoNavOverlay:setPriority( 400 ) + f12_local0:addElement( m_menuAutoNavOverlay ) + f12_local0.m_menuAutoNavOverlay = m_menuAutoNavOverlay + + if f12_arg0 and f12_arg0 > 0 then + f12_local0.m_menuAutoNavOverlayDelay = f12_arg0 + f12_local0.m_menuAutoNavOverlayTimeStamp = 0 + else + f12_local0.m_menuAutoNavOverlayDelay = 0 + f12_local0.m_menuAutoNavOverlayTimeStamp = 0 + end +end + +function CloseOverlay() + local f13_local0 = Engine.GetLuiRoot() + if not f13_local0 then + DebugPrint( "MenuAutoNavOverlay: Error, no root found, therefore we cannot close overlay." ) + return + elseif not f13_local0.m_menuAutoNavOverlay then + DebugPrint( "MenuAutoNavOverlay: Warning, ignoring attempt to close overlay because it is already closed." ) + return + else + f13_local0:removeElement( f13_local0.m_menuAutoNavOverlay ) + f13_local0.m_menuAutoNavOverlay = nil + f13_local0.m_menuAutoNavOverlayDelay = nil + f13_local0.m_menuAutoNavOverlayTimeStamp = nil + end +end + +function ShouldCloseOverlay() + if LUI.MenuAutoNav.IsRunning() then + return false + end + local f14_local0 = Engine.GetLuiRoot() + if not f14_local0 then + return false + elseif not f14_local0.m_menuAutoNavOverlay then + return false + elseif f14_local0.m_menuAutoNavOverlayDelay and f14_local0.m_menuAutoNavOverlayTimeStamp and f14_local0.m_menuAutoNavOverlayDelay > 0 then + local f14_local1 = Engine.GetMilliseconds() + if f14_local0.m_menuAutoNavOverlayTimeStamp == 0 then + f14_local0.m_menuAutoNavOverlayTimeStamp = f14_local1 + f14_local0.m_menuAutoNavOverlayDelay + return false + elseif f14_local1 < f14_local0.m_menuAutoNavOverlayTimeStamp then + return false + end + end + return true +end + +function HandleTimerEvent( f15_arg0, f15_arg1 ) + local f15_local0 = LUI.MenuAutoNav.GetInstance() + if not f15_local0.m_currentRoute then + DebugPrint( "MenuAutoNav: Current route is empty. Bailing" ) + Stop() + return + elseif #f15_local0.m_currentRoute < 1 then + DebugPrint( "MenuAutoNav: Current route is empty. Bailing" ) + Stop() + return + end + f15_local0.m_durationCounter = f15_local0.m_durationCounter + 1 + if f15_local0.m_durationCounter > MAX_DURATION_COUNTER then + DebugPrint( "MenuAutoNav: Max duration counter exceeded. Bailing" ) + Stop() + return + elseif f15_local0.m_state == STATE.WORKING_DROPBACK then + if LUI.FlowManager.IsTopMenuModal() then + DebugPrint( "MenuAutoNav: A modal menu popped up while attempting to find a starting point. We are stopping here." ) + LUI.MenuAutoNav.Stop() + return + end + local f15_local1 = LUI.FlowManager.GetTopOpenAndVisibleMenuName() + if not f15_local1 then + Yield() + return + end + local f15_local2, f15_local3 = nil + f15_local2, f15_local3 = IsMenuInCurrentRoute( f15_local1 ) + if not f15_local2 or f15_local2 ~= true then + f15_local0.m_counter = f15_local0.m_counter + 1 + if f15_local0.m_counter <= MAX_COUNTER_GOBACK then + return + elseif string.lower( f15_local1 ) == string.lower( "main_menu" ) or string.lower( f15_local1 ) == string.lower( "mp_main_menu" ) then + DebugPrint( "MenuAutoNav: Menu we are looking for not found, and we cannot move back any more. Stopping!" ) + LUI.MenuAutoNav.Stop() + return + elseif string.lower( f15_local1 ) == string.lower( "menu_splitscreensignin" ) then + LUI.FlowManager.RequestLeaveMenuByName( "menu_splitscreensignin" ) + f15_local0.m_counter = 0 + elseif LUI.MenuAutoNav.SendButtonPress( "secondary", nil, f15_local0.m_controller ) == true then + f15_local0.m_counter = 0 + end + return + elseif f15_local3 > 1 then + + else + f15_local0.m_state = STATE.WORKING_MOVEFORWARD + f15_local0.m_counter = 0 + end + while f15_local3 > 1 do + table.remove( f15_local0.m_currentRoute, 1 ) + f15_local3 = f15_local3 - 1 + end + f15_local0.m_state = STATE.WORKING_MOVEFORWARD + f15_local0.m_counter = 0 + end + if f15_local0.m_state == STATE.WORKING_MOVEFORWARD then + local f15_local1 = Engine.GetLuiRoot() + if f15_local1 == nil then + DebugPrint( "MenuAutoNav: Error, we have no root! Stopping" ) + Stop() + return + end + local f15_local2 = f15_local0.m_currentRoute[1] + if string.lower( f15_local2.action ) == string.lower( "" ) then + DebugPrint( "MenuAutoNav: Our current route action is empty, therefore we should be at our destination. Done." ) + Stop() + return + elseif string.lower( f15_local2.action ) == string.lower( "button_secondary" ) then + if LUI.MenuAutoNav.SendButtonPress( "secondary", nil, f15_local0.m_controller ) ~= true then + Yield() + return + end + else + local f15_local3 = f15_local1:getFirstDescendentById( f15_local2.action ) + if not f15_local3 then + Yield() + return + elseif f15_local3.disabled and not f15_local3.locked then + Yield() + return + end + f15_local3:processEvent( { + name = "button_action", + controller = f15_local0.m_controller + } ) + f15_local3:processEvent( { + name = "button_down", + controller = f15_local0.m_controller + } ) + end + table.remove( f15_local0.m_currentRoute, 1 ) + if #f15_local0.m_currentRoute >= 1 then + f15_local0.m_counter = 0 + return + end + DebugPrint( "MenuAutoNav: Done!" ) + end + Stop() +end + +function DebugDumpRoute( f16_arg0 ) + local f16_local0 = LUI.MenuAutoNav.GetInstance() + DebugPrint( "----------------------------------------------------------------" ) + DebugPrint( "MenuAutoNav: Route:" ) + for f16_local4, f16_local5 in ipairs( f16_arg0 ) do + DebugPrint( " #" .. tostring( f16_local4 ) .. " : topScreen=\"" .. tostring( f16_local5.topScreen ) .. "\", action=\"" .. tostring( f16_local5.action ) .. "\"" ) + end + DebugPrint( "----------------------------------------------------------------" ) +end + +function Goto( f17_arg0, f17_arg1 ) + assert( f17_arg0 ) + local f17_local0 = LUI.MenuAutoNav.GetInstance() + if IsRunning() then + DebugPrint( "MenuAutoNav: Error, an outstanding auto navigation is still working. Unable to navigate to \"" .. f17_arg0 .. "\"!" ) + return false + end + local f17_local1 = FindRouteEntry( f17_arg0 ) + if not f17_local1 then + DebugPrint( "MenuAutoNav: Error, unable to find a route to \"" .. f17_arg0 .. "\"!" ) + return false + end + local f17_local2 = f17_local1.route + local f17_local3 = f17_local1.routeOverlayDelay or 0 + local f17_local4 = Engine.GetLuiRoot() + if f17_local4 == nil then + DebugPrint( "MenuAutoNav: Error, we do not appear to have a root! Unable to create timer for autonav process!" ) + return false + end + f17_local0.m_controller = f17_arg1 + f17_local0.m_counter = 0 + f17_local0.m_currentRoute = {} + for f17_local8, f17_local9 in ipairs( f17_local2 ) do + table.insert( f17_local0.m_currentRoute, f17_local9 ) + end + f17_local0.m_state = STATE.WORKING_DROPBACK + self = LUI.UITimer.new( INTERVAL_MS, { + name = "menu_auto_nav_timer" + } ) + self.id = "MenuAutoNavTimer" + f17_local4:addElement( self ) + f17_local0.m_root = f17_local4 + f17_local0.m_timerElement = self + DebugPrint( "MenuAutoNav: Goto( \"" .. f17_arg0 .. "\") started" ) + LUI.MenuAutoNav.OpenOverlay( f17_local3 ) + return true +end + +LockTable( _M ) diff --git a/lui/menubuilder.dec.lua b/lui/menubuilder.dec.lua new file mode 100644 index 0000000..171f1da --- /dev/null +++ b/lui/menubuilder.dec.lua @@ -0,0 +1,1182 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +function Property( f1_arg0 ) + local f1_local0 = {} + assert( f1_arg0, "No property name given" ) + f1_local0.propName = f1_arg0 + f1_local0.isProperty = true + f1_local0.func = function ( f2_arg0 ) + assert( f2_arg0[f1_local0.propName] ~= nil, "Could not find property named " .. f1_local0.propName ) + return f2_arg0[f1_local0.propName] + end + + return f1_local0 +end + +function OppositeProperty( f3_arg0 ) + local f3_local0 = {} + assert( f3_arg0, "No property name given" ) + f3_local0.propName = f3_arg0 + f3_local0.isProperty = true + f3_local0.func = function ( f4_arg0 ) + assert( f4_arg0[f3_local0.propName] ~= nil, "Could not find property named " .. f3_local0.propName ) + if type( f4_arg0[f3_local0.propName] ) == "number" then + return -f4_arg0[f3_local0.propName] + elseif type( f4_arg0[f3_local0.propName] ) == "boolean" then + return not f4_arg0[f3_local0.propName] + else + assert( false, "Property " .. f3_local0.propName .. " should be a number or a boolean for use with the OppositeProperty helper" ) + end + end + + return f3_local0 +end + +function HalfProperty( f5_arg0 ) + local f5_local0 = {} + assert( f5_arg0, "No property name given" ) + f5_local0.propName = f5_arg0 + f5_local0.isProperty = true + f5_local0.func = function ( f6_arg0 ) + assert( f6_arg0[f5_local0.propName] ~= nil, "Could not find property named " .. f5_local0.propName ) + if type( f6_arg0[f5_local0.propName] ) == "number" then + return 0.5 * f6_arg0[f5_local0.propName] + else + assert( false, "Property " .. f5_local0.propName .. " should be a number for use with the HalfProperty helper" ) + end + end + + return f5_local0 +end + +function HalfOppositeProperty( f7_arg0 ) + local f7_local0 = {} + assert( f7_arg0, "No property name given" ) + f7_local0.propName = f7_arg0 + f7_local0.isProperty = true + f7_local0.func = function ( f8_arg0 ) + assert( f8_arg0[f7_local0.propName] ~= nil, "Could not find property named " .. f7_local0.propName ) + if type( f8_arg0[f7_local0.propName] ) == "number" then + return -0.5 * f8_arg0[f7_local0.propName] + else + assert( false, "Property " .. f7_local0.propName .. " should be a number for use with the HalfOppositeProperty helper" ) + end + end + + return f7_local0 +end + +function RunPropertyFunc( f9_arg0 ) + return function ( f10_arg0, f10_arg1 ) + if f10_arg0.properties[f9_arg0] and type( f10_arg0.properties[f9_arg0] ) == "function" then + f10_arg0.properties[f9_arg0]( f10_arg0, f10_arg1 ) + end + end + +end + +function ParentProperty( f11_arg0 ) + local f11_local0 = f11_arg0 + return function ( f12_arg0, f12_arg1 ) + assert( f12_arg1, "ParentProperty can only be included inside the property section" ) + return f12_arg1[f11_local0] + end + +end + +function TryProperty( f13_arg0 ) + local f13_local0 = f13_arg0 + return function ( f14_arg0 ) + return f14_arg0[f13_local0] + end + +end + +function Function( f15_arg0 ) + local f15_local0 = f15_arg0 + return function ( f16_arg0 ) + return f15_local0( f16_arg0 ) + end + +end + +function BaseState( f17_arg0, f17_arg1 ) + local f17_local0 = f17_arg0 + local f17_local1 = f17_arg1 + if not f17_local1 then + f17_local1 = {} + end + return function ( f18_arg0 ) + assert( f18_arg0 ) + assert( f18_arg0.states ) + assert( f18_arg0.states[f17_local0], "Could not find base state " .. f17_local0 ) + assert( type( f18_arg0.states[f17_local0] ) == "table", "Must only use BaseState on non-derived states! state = " .. f17_local0 ) + local f18_local0 = {} + for f18_local4, f18_local5 in pairs( f18_arg0.states[f17_local0] ) do + f18_local0[f18_local4] = f18_local5 + end + for f18_local4, f18_local5 in pairs( f17_local1 ) do + f18_local0[f18_local4] = f18_local5 + end + return f18_local0 + end + +end + +function OpenMenu( f19_arg0, f19_arg1, f19_arg2, f19_arg3 ) + local f19_local0 = f19_arg0 + local f19_local1 = f19_arg1 + local f19_local2 = f19_arg2 + local f19_local3 = f19_arg3 + return function ( f20_arg0, f20_arg1 ) + LUI.FlowManager.RequestAddMenu( f20_arg0, f19_local0, f19_local1, f20_arg1.controller, f19_local2, f19_local3 ) + end + +end + +function PopupMenu( f21_arg0, f21_arg1, f21_arg2, f21_arg3 ) + local f21_local0 = f21_arg0 + local f21_local1 = f21_arg1 + local f21_local2 = f21_arg2 + local f21_local3 = f21_arg3 + return function ( f22_arg0, f22_arg1 ) + LUI.FlowManager.RequestPopupMenu( f22_arg0, f21_local0, f21_local1, f22_arg1.controller, f21_local2, f21_local3 ) + end + +end + +function LeaveMenu() + return function ( f24_arg0, f24_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f24_arg0 ) + end + +end + +function RestoreMenu( f25_arg0, f25_arg1, f25_arg2 ) + return function ( f26_arg0, f26_arg1 ) + LUI.FlowManager.RequestRestoreMenu( f26_arg0, f25_arg0, f25_arg1, f26_arg1.controller, f25_arg2 ) + end + +end + +function CloseAllMenus() + return function ( f28_arg0, f28_arg1 ) + LUI.FlowManager.RequestCloseAllMenus( f28_arg0, nil ) + end + +end + +function OpenOldMenu( f29_arg0 ) + local f29_local0 = f29_arg0 + return function ( f30_arg0, f30_arg1 ) + LUI.FlowManager.RequestOldMenu( f30_arg0, f29_local0 ) + end + +end + +function EmitEvent( f31_arg0 ) + local f31_local0 = f31_arg0 + if type( f31_local0 ) == "string" then + f31_local0 = { + name = f31_local0 + } + end + return function ( f32_arg0, f32_arg1 ) + f32_arg0:processEvent( f31_local0 ) + end + +end + +function EmitEventToParent( f33_arg0, f33_arg1 ) + local f33_local0 + if f33_arg1 then + f33_local0 = f33_arg1.saveOriginal + if not f33_local0 then + + else + local f33_local1 = f33_arg0 + if not f33_local0 and type( f33_local1 ) == "string" then + f33_local1 = { + name = f33_local1 + } + end + return function ( f34_arg0, f34_arg1 ) + if f33_local0 then + local f34_local0 = {} + if type( f33_local1 ) == "string" then + f34_local0.name = f33_local1 + else + for f34_local4, f34_local5 in pairs( f33_local1 ) do + f34_local0[f34_local4] = f34_local5 + end + end + f34_local0.original = f34_arg1 + return f34_arg0:dispatchEventToParent( f34_local0 ) + else + return f34_arg0:dispatchEventToParent( f33_local1 ) + end + end + + end + end + f33_local0 = false +end + +function EmitEventToRoot( f35_arg0 ) + local f35_local0 = f35_arg0 + if type( f35_local0 ) == "string" then + f35_local0 = { + name = f35_local0 + } + end + return function ( f36_arg0, f36_arg1 ) + f36_arg0:dispatchEventToRoot( f35_local0 ) + end + +end + +function EmitOmnvarUpdateEventToRoot( f37_arg0 ) + return function ( f38_arg0 ) + f38_arg0:dispatchEventToRoot( { + name = "omnvar_update", + omnvar = f37_arg0, + value = Game.GetOmnvar( f37_arg0 ) + } ) + end + +end + +f0_local0 = function ( f39_arg0, f39_arg1 ) + local f39_local0 = type( f39_arg0 ) + if f39_local0 == "function" then + assert( f39_arg1.properties, "Item built that didn't get it's properties set!" ) + DebugPrint( "defaultDuration is " .. f39_arg0( f39_arg1.properties ) ) + return f39_arg0( f39_arg1.properties ) + elseif f39_local0 == "table" and f39_arg0.isProperty then + assert( f39_arg1.properties, "Item built that didn't get it's properties set!" ) + DebugPrint( "defaultDuration is " .. f39_arg0.func( f39_arg1.properties ) ) + return f39_arg0.func( f39_arg1.properties ) + else + return f39_arg0 + end +end + +function AnimateToStateWithEvent( f40_arg0, f40_arg1, f40_arg2, f40_arg3 ) + local f40_local0 = f40_arg0 + local f40_local1 = f40_arg1 + local f40_local2 = f40_arg2 + local f40_local3 = f40_arg3 + return function ( f41_arg0, f41_arg1 ) + local f41_local0 = f0_local0( f40_local1, f41_arg0 ) + local f41_local1 = f0_local0( f40_local2, f41_arg0 ) + local f41_local2 = f0_local0( f40_local3, f41_arg0 ) + if f41_arg0:hasAnimationState( f40_local0 ) then + if Engine.GetDvarBool( "lui_print_anim_states" ) then + local f41_local3 = "None" + if f41_arg0.id ~= nil then + f41_local3 = f41_arg0.id + end + DebugPrint( "LUI: AnimateToStateWithEvent: id: " .. f41_local3 .. " state: " .. f40_local0 ) + end + f41_arg0:animateToState( f40_local0, f41_local0, f41_local1, f41_local2 ) + end + end + +end + +function AnimateToState( f42_arg0, f42_arg1, f42_arg2, f42_arg3 ) + local f42_local0 = f42_arg0 + local f42_local1 = f42_arg1 + local f42_local2 = f42_arg2 + local f42_local3 = f42_arg3 + return function ( f43_arg0, f43_arg1 ) + f43_arg0:registerEventHandler( LUI.FormatAnimStateFinishEvent( f42_local0 ), nil ) + local f43_local0 = f0_local0( f42_local1, f43_arg0 ) + local f43_local1 = f0_local0( f42_local2, f43_arg0 ) + local f43_local2 = f0_local0( f42_local3, f43_arg0 ) + if f43_arg0:hasAnimationState( f42_local0 ) then + if Engine.GetDvarBool( "lui_print_anim_states" ) then + local f43_local3 = "None" + if f43_arg0.id ~= nil then + f43_local3 = f43_arg0.id + end + DebugPrint( "LUI: AnimateToState: id: " .. f43_local3 .. " state: " .. f42_local0 ) + end + f43_arg0:animateToState( f42_local0, f43_local0, f43_local1, f43_local2 ) + end + end + +end + +function ChooseAnimateToState( f44_arg0, f44_arg1, f44_arg2 ) + local f44_local0 = f44_arg0 + local f44_local1 = f44_arg1 + local f44_local2 = f44_arg2 + return function ( f45_arg0, f45_arg1 ) + local f45_local0 = f44_local2[1] + local f45_local1 = f0_local0( f44_local2[2], f45_arg0 ) + local f45_local2 = f0_local0( f44_local2[3], f45_arg0 ) + local f45_local3 = f0_local0( f44_local2[4], f45_arg0 ) + if f44_local0( f45_arg0, f45_arg1 ) then + f45_local0 = f44_local1[1] + f45_local1 = f0_local0( f44_local1[2], f45_arg0 ) + f45_local2 = f0_local0( f44_local1[3], f45_arg0 ) + f45_local3 = f0_local0( f44_local1[4], f45_arg0 ) + end + if f45_arg0:hasAnimationState( f45_local0 ) then + if Engine.GetDvarBool( "lui_print_anim_states" ) then + local f45_local4 = "None" + if f45_arg0.id ~= nil then + f45_local4 = f45_arg0.id + end + DebugPrint( "LUI: ChooseAnimateToState: id: " .. f45_local4 .. " state: " .. f45_local0 ) + end + f45_arg0:animateToState( f45_local0, f45_local1, f45_local2, f45_local3 ) + end + end + +end + +f0_local1 = function ( f46_arg0, f46_arg1, f46_arg2, f46_arg3 ) + local f46_local0 = f46_arg0 + local f46_local1 = 2 + local f46_local2 = f46_arg1 + local f46_local3 = f46_arg2 + local f46_local4 = f46_arg3 + return function ( f47_arg0, f47_arg1 ) + if #f46_local0 < f46_local1 then + f46_local1 = 1 + if not f46_local3 then + return + end + end + local f47_local0 = f46_local0[f46_local1] + f47_arg0:registerEventHandler( f47_arg1.name, nil ) + if f46_local2 and not f47_arg0:isInFocus() and not f47_arg0:isParentInFocus() then + return + elseif f47_arg1.interrupted then + if Engine.GetDvarBool( "lui_print_anim_states" ) then + local f47_local1 = "None" + if f47_arg0.id ~= nil then + f47_local1 = f47_arg0.id + end + DebugPrint( "LUI: Animation to state '" .. f47_local0[1] .. "' interrupted! id: " .. f47_local1 ) + end + return + end + local f47_local1 = LUI.FormatAnimStateFinishEvent( f47_local0[1] ) + f47_arg0:animateToState( f47_local0[1], f47_local0[2], f47_local0[3], f47_local0[4] ) + if f46_local3 or f46_local1 ~= #f46_local0 and not f46_local3 then + f47_arg0:registerEventHandler( f47_local1, REG9 ) + end + if f46_local1 == #f46_local0 and not f46_local3 and f46_local4 then + f47_arg0:registerEventHandler( f47_local1, function ( element, event ) + element:close() + end ) + end + f46_local1 = f46_local1 + 1 + end + +end + +function AnimateLoop( f49_arg0, f49_arg1 ) + local f49_local0 = f49_arg0 + local f49_local1 = f49_arg1 + return function ( f50_arg0, f50_arg1 ) + if Engine.GetDvarBool( "lui_print_anim_states" ) then + local f50_local0 = "None" + if f50_arg0.id ~= nil then + f50_local0 = f50_arg0.id + end + DebugPrint( "LUI: AnimateLoop: id: " .. f50_local0 ) + end + if Engine.GetDvarBool( "lui_print_anim_states" ) then + for f50_local3, f50_local4 in ipairs( f49_local0 ) do + DebugPrint( "\t->" .. f50_local4[1] ) + end + end + local f50_local0 = assert + local f50_local1 = f49_local0 + if f50_local1 then + f50_local1 = #f49_local0 + end + f50_local0( f50_local1, "AnimateLoop does not have animation states!" ) + f50_local0 = f49_local0[1] + f50_local1 = LUI.FormatAnimStateFinishEvent( f50_local0[1] ) + if #f49_local0 == 1 then + DebugPrint( "LUI Warning: AnimateLoop only has one animation state! " .. f49_local0[1][1] ) + else + f50_arg0:registerEventHandler( f50_local1, f0_local1( f49_local0, f49_local1, true ) ) + end + f50_arg0:animateToState( f50_local0[1], f50_local0[2], f50_local0[3], f50_local0[4] ) + end + +end + +function AnimateSequence( f51_arg0 ) + local f51_local0 = f51_arg0 + local f51_local1 = requireFocus + return function ( f52_arg0, f52_arg1 ) + if Engine.GetDvarBool( "lui_print_anim_states" ) then + local f52_local0 = "None" + if f52_arg0.id ~= nil then + f52_local0 = f52_arg0.id + end + DebugPrint( "LUI: AnimateSequence: id: " .. f52_local0 ) + end + if Engine.GetDvarBool( "lui_print_anim_states" ) then + for f52_local3, f52_local4 in ipairs( f51_local0 ) do + DebugPrint( "\t->" .. f52_local4[1] ) + end + end + local f52_local0 = assert + local f52_local1 = f51_local0 + if f52_local1 then + f52_local1 = #f51_local0 + end + f52_local0( f52_local1, "AnimateSequence does not have animation states!" ) + f52_local0 = f51_local0[1] + f52_local1 = LUI.FormatAnimStateFinishEvent( f52_local0[1] ) + if #f51_local0 == 1 then + DebugPrint( "LUI Warning: AnimateSequence only has one animation state! " .. f51_local0[1][1] ) + else + f52_arg0:registerEventHandler( f52_local1, f0_local1( f51_local0, f51_local1, false ) ) + end + f52_arg0:animateToState( f52_local0[1], f52_local0[2], f52_local0[3], f52_local0[4] ) + end + +end + +function AnimateSequenceAndClose( f53_arg0 ) + local f53_local0 = f53_arg0 + local f53_local1 = requireFocus + return function ( f54_arg0, f54_arg1 ) + if Engine.GetDvarBool( "lui_print_anim_states" ) then + local f54_local0 = "None" + if f54_arg0.id ~= nil then + f54_local0 = f54_arg0.id + end + DebugPrint( "LUI: AnimateSequence: id: " .. f54_local0 ) + end + for f54_local3, f54_local4 in ipairs( f53_local0 ) do + local f54_local5 = LUI.FormatAnimStateFinishEvent( f54_local4[1] ) + if Engine.GetDvarBool( "lui_print_anim_states" ) then + DebugPrint( "\t->" .. f54_local4[1] ) + end + f54_arg0:registerEventHandler( f54_local5, nil ) + end + f54_local0 = assert + f54_local1 = f53_local0 + if f54_local1 then + f54_local1 = #f53_local0 + end + f54_local0( f54_local1, "AnimateSequence does not have animation states!" ) + f54_local0 = f53_local0[1] + f54_local1 = f53_local0[#f53_local0] + f54_local2 = LUI.FormatAnimStateFinishEvent( f54_local0[1] ) + if #f53_local0 == 1 then + DebugPrint( "LUI Warning: AnimateSequence only has one animation state! " .. f53_local0[1][1] ) + else + f54_arg0:registerEventHandler( f54_local2, f0_local1( f53_local0, f53_local1, false, true ) ) + end + f54_arg0:animateToState( f54_local0[1], f54_local0[2], f54_local0[3], f54_local0[4] ) + end + +end + +function DoMultiple( f55_arg0 ) + local f55_local0 = f55_arg0 + return function ( f56_arg0, f56_arg1 ) + for f56_local3, f56_local4 in ipairs( f55_local0 ) do + assert( type( f56_local4 ) == "function" ) + f56_local4( f56_arg0, f56_arg1 ) + end + end + +end + +function HandleSilently( f57_arg0 ) + return function ( f58_arg0, f58_arg1 ) + if not f58_arg1.dispatchChildren then + f58_arg0:dispatchEventToChildren( f58_arg1 ) + end + return f57_arg0( f58_arg0, f58_arg1 ) + end + +end + +function OmnvarUpdateFilter( f59_arg0, f59_arg1 ) + return { + [f59_arg0] = f59_arg1 + } +end + +function HandlePrint( f60_arg0 ) + local f60_local0 = f60_arg0 + return function ( f61_arg0, f61_arg1 ) + DebugPrint( f60_local0 ) + end + +end + +function UpdateTextWithCall( f62_arg0, ... ) + local f62_local0 = { + ... + } + return function ( f63_arg0, f63_arg1 ) + if f62_arg0 ~= nil then + local f63_local0 = f62_arg0( unpack( f62_local0 ) ) + if f63_local0 ~= nil then + f63_arg0:setText( f63_local0 ) + end + end + end + +end + +helpers = { + Property = Property, + OppositeProperty = OppositeProperty, + HalfProperty = HalfProperty, + HalfOppositeProperty = HalfOppositeProperty, + RunPropertyFunc = RunPropertyFunc, + Function = Function, + BaseState = BaseState, + AnimateToState = AnimateToState, + AnimateToStateWithEvent = AnimateToStateWithEvent, + DoMultiple = DoMultiple, + HandleSilently = HandleSilently, + OmnvarUpdateFilter = OmnvarUpdateFilter, + AnimateLoop = AnimateLoop, + AnimateSequence = AnimateSequence, + TryProperty = TryProperty, + ParentProperty = ParentProperty, + OpenMenu = OpenMenu, + PopupMenu = PopupMenu, + LeaveMenu = LeaveMenu, + RestoreMenu = RestoreMenu, + CloseAllMenus = CloseAllMenus, + OpenOldMenu = OpenOldMenu, + HandlePrint = HandlePrint, + UpdateTextWithCall = UpdateTextWithCall, + EmitEvent = EmitEvent, + EmitEventToParent = EmitEventToParent, + EmitEventToRoot = EmitEventToRoot, + EmitOmnvarUpdateEventToRoot = EmitOmnvarUpdateEventToRoot, + ChooseAnimateToState = ChooseAnimateToState, + AnimateSequenceAndClose = AnimateSequenceAndClose +} +f0_local2 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setUseStencil( true ) + return self +end + +local f0_local3 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setupPopulationMap() + return self +end + +local f0_local4 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setupLeakyWatermark() + return self +end + +local f0_local5 = function ( menu, controller ) + local self = LUI.UIElement.new() + local f67_local1 = nil + if controller then + f67_local1 = controller.compassType + end + self:setupMinimap( f67_local1 ) + return self +end + +local f0_local6 = function ( menu, controller ) + local self = LUI.UIElement.new() + local f68_local1 = nil + if controller then + f68_local1 = controller.compassType + end + self:setupMinimapIcons( f68_local1 ) + return self +end + +local f0_local7 = function ( f69_arg0, f69_arg1 ) + if not LUI.UIElement.setupCompass then + return LUI.UIImage.new( f69_arg0, f69_arg1 ) + else + local self = LUI.UIElement.new() + self:setupCompass() + return self + end +end + +local f0_local8 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setupUIBindText( controller.dataSource, controller.textFormat, controller.param1 or 0 ) + self:setClass( LUI.UIText ) + return self +end + +local f0_local9 = function ( menu, controller ) + local self = LUI.UIImage.new() + self:setupUIBindImage( controller.dataSource, controller.param1 or 0 ) + return self +end + +local f0_local10 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setupUIIntWatch( controller.dataSource, controller.param1 or 0 ) + return self +end + +local f0_local11 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setupUIScorebar( controller.dataSource ) + self.m_maxWidth = controller.maxWidth + self.m_maxScore = controller.maxScore + return self +end + +local f0_local12 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setupWorldBlur() + return self +end + +local f0_local13 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setupScreenshotViewer() + return self +end + +local f0_local14 = function ( menu, controller ) + local self = LUI.UIElement.new() + self:setupScreenshotViewer() + return self +end + +function buildOwnerDraw( menu, controller ) + local self = LUI.UIElement.new() + self:setupOwnerdraw( controller.ownerDraw, controller.ownerDrawTextScale, controller.ownerDrawTextStyle ) + return self +end + +function buildTextEdit( menu, controller ) + local self = LUI.UIElement.new() + self:setupTextEdit( controller.max_length, controller.password_field, controller.use_auto_align ) + if controller.use_auto_align then + self:setUseStencil( true ) + end + return self +end + +function buildLoadingDots( menu, controller ) + local self = LUI.UIElement.new() + if self.setLoadingDots then + self:setLoadingDots() + end + return self +end + +function buildContentServerImage( menu, controller ) + local self = LUI.UIElement.new() + self:setupContentServerImage() + self.setFileId = function ( f81_arg0, f81_arg1, f81_arg2 ) + f81_arg0.m_fileId = f81_arg1 or "" + f81_arg0.m_waitingForDownload = true + f81_arg0.m_thumbName = f81_arg2 or "" + end + + self:setFileId( controller.file_id, controller.thumbName ) + return self +end + +m_types = { + UIElement = LUI.UIElement.build, + UIText = LUI.UIText.build, + UIBindText = f0_local8, + UIBindImage = f0_local9, + UIIntWatch = f0_local10, + UIImage = LUI.UIImage.build, + UILitImage = LUI.UILitImage.build, + UIButton = LUI.UIButton.build, + UITimer = LUI.UITimer.build, + UIStencil = f0_local2, + UIVerticalList = LUI.UIVerticalList.build, + UIScrollingVerticalList = LUI.UIScrollingVerticalList.build, + UIVerticalScrollbar = LUI.UIVerticalScrollbar.build, + UIHorizontalList = LUI.UIHorizontalList.build, + UIBarrelList = LUI.UIBarrelList.build, + UIGrid = LUI.UIGrid.build, + UIVerticalNavigator = LUI.UIVerticalNavigator.build, + UIHorizontalNavigator = LUI.UIHorizontalNavigator.build, + UICountdown = LUI.UICountdown.build, + UILongCountdown = LUI.UILongCountdown.build, + UITechyDigits = LUI.UITechyDigits.build, + UIBindButton = LUI.UIBindButton.build, + UILoadingDots = buildLoadingDots, + UIPopulationMap = f0_local3, + UILeakyWatermark = f0_local4, + UIMinimap = f0_local5, + UIMinimapIcons = f0_local6, + UICompass = f0_local7, + UIScorebar = f0_local11, + UIWorldBlur = f0_local12, + UIScreenshotViewer = f0_local13, + UICharacterWindow = LUI.UICharacterWindow.build, + UIOwnerdraw = buildOwnerDraw, + UITextEdit = buildTextEdit, + ContentServerImage = buildContentServerImage +} +m_definitions = {} +m_debugData = { + requstedMenu = "", + currentDef = {}, + definitionStack = {} +} +baseAssert = assert +local f0_local15 = function ( f82_arg0, f82_arg1 ) + m_debugData.currentDef = f82_arg0 + m_debugData.definitionStack[#m_debugData.definitionStack + 1] = { + type = f82_arg0.type, + id = f82_arg0.id, + childNum = f82_arg1 + } +end + +local f0_local16 = function () + m_debugData.definitionStack[#m_debugData.definitionStack] = nil +end + +local f0_local17 = function () + for f84_local4, f84_local5 in ipairs( m_debugData.definitionStack ) do + local f84_local3 = f84_local4 .. ") type: " .. f84_local5.type + if f84_local5.id then + f84_local3 = f84_local3 .. " id: " .. f84_local5.id + end + if f84_local5.childNum then + f84_local3 = f84_local3 .. " childNum: " .. f84_local5.childNum + end + DebugPrint( f84_local3 ) + end + DebugPrint( "Current itemDef: " ) + defPrint( m_debugData.currentDef ) +end + +local f0_local18 = function ( f85_arg0, f85_arg1, ... ) + if not f85_arg0 then + if type( f85_arg1 ) == "string" then + DebugPrint( "Error: " .. string.format( f85_arg1, ... ) ) + end + DebugPrint( "Error Making Menu: " .. m_debugData.requstedMenu ) + f0_local17() + baseAssert( f85_arg0, ... ) + end +end + +function defPrint( f86_arg0, f86_arg1 ) + if not f86_arg1 then + f86_arg1 = 0 + end + for f86_local4, f86_local5 in pairs( f86_arg0 ) do + local f86_local6 = string.rep( " ", f86_arg1 ) .. f86_local4 .. ": " + if type( f86_local5 ) == "table" then + DebugPrint( f86_local6 ) + defPrint( f86_local5, f86_arg1 + 1 ) + else + DebugPrint( f86_local6 .. tostring( f86_local5 ) ) + end + local f86_local3 = getmetatable( f86_arg0 ) + if f86_local3 and f86_local3.__index then + DebugPrint( f86_local6 .. "__index" ) + defPrint( f86_local3.__index, f86_arg1 + 1 ) + end + end +end + +assert = f0_local18 +function registerDef( f87_arg0, f87_arg1 ) + assert( m_definitions[f87_arg0] == nil, "This type has already been registered! " .. f87_arg0 ) + assert( m_types[f87_arg0] == nil, "This type is a basic element type that has been registered! " .. f87_arg0 ) + assert( type( f87_arg1 ) == "function", "Attempting to register old style type definition! See wiki for info on how to update your def. def = " .. f87_arg0 ) + m_definitions[f87_arg0] = f87_arg1 +end + +function registerType( f88_arg0, f88_arg1 ) + assert( m_definitions[f88_arg0] == nil, "This type has already been registered! " .. f88_arg0 ) + assert( m_types[f88_arg0] == nil, "This type is a basic element type that has been registered! " .. f88_arg0 ) + assert( type( f88_arg1 ) == "function", "The buildFunction for this type is not a function! typeName = " .. f88_arg0 ) + m_types[f88_arg0] = f88_arg1 +end + +g_keyWordList = hashset( { + "properties", + "children", + "childrenFeeder", + "states", + "id", + "type", + "handlers" +} ) +local f0_local19 = function ( f89_arg0 ) + if g_keyWordList[f89_arg0] then + assert( false, "It appears that you are using the keyword '" .. f89_arg0 .. "' as a member name, are you sure this is set up correctly?" ) + end +end + +validateName = f0_local19 +f0_local19 = function ( f90_arg0, f90_arg1, f90_arg2 ) + local f90_local0 = type( f90_arg0 ) + if f90_local0 == "function" then + return f0_local19( f90_arg0( f90_arg1, f90_arg2 ), f90_arg1, f90_arg2 ) + end + assert( f90_local0 == "table", "Current state is not a table, did you forget {}?" ) + for f90_local5, f90_local6 in pairs( f90_arg0 ) do + validateName( f90_local5 ) + if f90_arg1.type ~= "UIImage" and f90_arg1.type ~= "UILitImage" and f90_arg1.type ~= "UIScorebar" and f90_arg1.type ~= "UICompass" and f90_local5 == "material" then + DebugPrint( "LUI Warning: It appears that you are assigning material as a state member in an element that is not of type UIImage, is this intentional?" ) + end + local f90_local4 = type( f90_local6 ) + if f90_local4 == "function" then + f90_arg0[f90_local5] = f90_local6( f90_arg2 ) + end + if f90_local4 == "table" and f90_local6.isProperty then + f90_arg0[f90_local5] = f90_local6.func( f90_arg2 ) + else + f90_arg0[f90_local5] = f90_local6 + end + end + return f90_arg0 +end + +local f0_local20 = function ( f91_arg0, f91_arg1, f91_arg2, f91_arg3 ) + if f91_arg1.states then + assert( f91_arg1.states.default, "No default state provided for element definition" ) + for f91_local3, f91_local4 in pairs( f91_arg1.states ) do + validateName( f91_local3 ) + f91_local4 = f0_local19( f91_local4, f91_arg1, f91_arg2 ) + if f91_arg1.debug or f91_arg2 and f91_arg2.debug then + DebugPrint( "Printing out formatted state:" ) + defPrint( builtState ) + end + f91_arg0:registerAnimationState( f91_local3, f91_local4 ) + if not (f91_local3 ~= "default" or f91_arg3) or f91_local4.animateOnRefresh then + f91_arg0:animateToState( f91_local3 ) + end + end + end +end + +function buildChildren( f92_arg0, f92_arg1, f92_arg2 ) + assert( not f92_arg2.type, "It appears that the children list is not a list but instead is a single element definition." ) + for f92_local3, f92_local4 in ipairs( f92_arg2 ) do + local f92_local5 = buildItems( f92_local4, f92_arg1, f92_arg0, f92_local3 ) + f92_local5:close() + f92_arg0:addElement( f92_local5 ) + end +end + +local f0_local21 = function ( f93_arg0, f93_arg1 ) + if type( f93_arg0 ) == "table" and f93_arg0.isProperty then + return f93_arg0.func( f93_arg1 ) + else + return f93_arg0 + end +end + +function buildItems( f94_arg0, f94_arg1, f94_arg2, f94_arg3 ) + assert( f94_arg0.type, "No type in itemDef!" ) + f0_local15( f94_arg0, f94_arg3 ) + Memory.CheckLow() + if m_definitions[f94_arg0.type] then + local f94_local0 = nil + if type( m_definitions[f94_arg0.type] ) == "function" then + f94_local0 = m_definitions[f94_arg0.type]() + else + f94_local0 = m_definitions[f94_arg0.type] + end + f94_arg0.type = nil + if not f94_local0.properties then + f94_local0.properties = {} + end + if f94_arg0.properties and f94_local0.properties then + for f94_local4, f94_local5 in pairs( f94_arg0.properties ) do + validateName( f94_local4 ) + f94_local0.properties[f94_local4] = f94_local5 + end + f94_arg0.properties = nil + end + for f94_local4, f94_local5 in pairs( f94_arg0 ) do + f94_local0[f94_local4] = f94_local5 + end + f94_local1 = buildItems( f94_local0, f94_arg1, f94_arg2 ) + if f94_local1 and f94_local1.properties then + f94_local1.m_ownerController = f94_local1.properties.exclusiveController + end + f0_local16() + return f94_local1 + else + assert( m_types[f94_arg0.type], "Unknown type for element definition: " .. f94_arg0.type ) + local f94_local0 = f94_arg0.properties or f94_arg1 + if f94_local0 then + for f94_local4, f94_local5 in pairs( f94_local0 ) do + validateName( f94_local4 ) + if type( f94_local5 ) == "table" and f94_local5.isProperty then + f94_local0[f94_local4] = f94_local5.func( f94_arg1 ) + end + end + end + local f94_local1 = nil + local f94_local2 = true + if f94_arg2 and f94_arg0.id then + f94_local1 = f94_arg2:getChildById( f94_arg0.id ) + end + if not f94_local1 then + f94_local2 = false + f94_local1 = m_types[f94_arg0.type]( f94_arg0, f94_local0, f94_arg3 ) + end + f94_local1._marked = true + f94_local1._fromMenuBuilder = true + f94_local1._isRefresh = f94_local2 + if f94_arg1 and f94_arg1.exclusiveController then + f94_local1.m_ownerController = f94_arg1.exclusiveController + f94_local0.exclusiveController = f94_arg1.exclusiveController + end + if not (not f94_local0 or not f94_local0.debug) or f94_arg0.debug then + DebugPrint( "Printing out item Props:" ) + defPrint( f94_local0 ) + DebugPrint( "Printing out item Def:" ) + defPrint( f94_arg0 ) + f94_local0.debug = nil + f94_arg0.debug = nil + end + if f94_arg0.focusable == true then + f94_local1:makeFocusable() + elseif f94_arg0.focusable == false then + f94_local1:makeNotFocusable() + end + if f94_arg0.ignoreMouseFocus then + f94_local1:makeFocusable() + f94_local1.m_ignoreMouseFocus = true + end + f94_local1.m_outsideParentList = f94_local1.m_outsideParentList or false + f94_local1.m_requireFocusType = f94_arg0.requireFocusType + if f94_arg0.disableNavigation then + f94_local1.m_disableNavigation = true + end + if f94_local1.setText and f94_local0 and f94_local0.text then + f94_local1:setText( f94_local0.text ) + end + if f94_local1.setTextStyle and f94_local0 and f94_local0.textStyle then + f94_local1:setTextStyle( f94_local0.textStyle ) + end + local f94_local3 = f94_local1.disabled + if not f94_local3 then + f94_local3 = false + end + f94_local1.disabled = false + if f94_arg0.disabledFunc then + f94_local1.disabled = f94_arg0.disabledFunc( f94_local1, f94_local0 ) + end + if f94_arg0.disabled then + f94_local1.disabled = true + end + if f94_local3 ~= f94_local1.disabled then + f94_local1.disabledStateChange = true + else + f94_local1.disabledStateChange = false + end + if f94_arg0.audio then + if f94_local1.setGainFocusSFX and f94_arg0.audio.button_over then + f94_local1:setGainFocusSFX( f94_arg0.audio.button_over ) + end + if f94_local1.setActionSFX and f94_arg0.audio.button_action then + f94_local1:setActionSFX( f94_arg0.audio.button_action ) + end + end + if f94_arg0.childrenFeeder then + local f94_local4 = f94_arg0.childrenFeeder + if type( f94_local4 ) == "table" and f94_local4.isProperty then + f94_local4 = f94_arg0.childrenFeeder.func( f94_local0 ) + end + assert( type( f94_local4 ) == "function", "Feeders must be a function or referenced by the MBh.Property helper" ) + f94_arg0.children = f94_local4( f94_local0 ) + f94_local1.childrenFeeder = f94_local4 + f94_local1:registerEventHandler( "menu_refresh", HandleMenuRefresh ) + end + if f94_arg0.children then + for f94_local7, f94_local8 in ipairs( f94_arg0.children ) do + if f94_local8.disabledFunc then + f94_local1:registerEventHandler( "menu_refresh", HandleMenuRefresh ) + f94_local1.children = f94_arg0.children + break + end + end + end + if f94_arg0.id then + f94_local1.id = f94_arg0.id + end + if f94_arg0.listDefaultFocus then + f94_local1.listDefaultFocus = true + end + assert( not f94_arg0.additionalHandlers, "The additional_handlers must be specified inside the 'properties' tables, not in the main definition" ) + f0_local20( f94_local1, f94_arg0, f94_local0, f94_local2 ) + if f94_arg0.handlers then + for f94_local7, f94_local8 in pairs( f94_arg0.handlers ) do + if f94_local7 == "omnvar_update" then + assert( type( f94_local8 ) == "table", "omnvar_update should be a table of handlers for specific omnvars" ) + local f94_local9 = f94_local1:getRootParent() + f94_local9 = f94_local9.eventCatcher + for f94_local13, f94_local14 in pairs( f94_local8 ) do + f94_local9:registerOmnvarHandler( f94_local1, f94_local13, f0_local21( f94_local14, f94_local0 ) ) + end + end + if f94_local7 == "dvar_update" then + assert( type( f94_local8 ) == "table", "dvar_update should be a table of handlers for specific dvars" ) + local f94_local9 = f94_local1:getRootParent() + f94_local9 = f94_local9.eventCatcher + for f94_local13, f94_local14 in pairs( f94_local8 ) do + f94_local9:registerDvarHandler( f94_local1, f94_local13, f0_local21( f94_local14, f94_local0 ) ) + end + end + f94_local1:registerEventHandler( f94_local7, f0_local21( f94_local8, f94_local0 ) ) + end + else + f94_arg0.handlers = {} + end + if f94_local0 and f94_local0.additional_handlers then + assert( not f94_local0.additional_handlers.omnvar_update, "Omnvar_update events don't support being an 'additional_handler'" ) + assert( not f94_local0.additional_handlers.dvar_update, "Dvar_update events don't support being an 'additional_handler'" ) + for f94_local7, f94_local8 in pairs( f94_local0.additional_handlers ) do + if not (not f94_local2 or not f94_arg0.handlers[f94_local7]) or not f94_local2 then + f94_local1:addEventHandler( f94_local7, f94_local8 ) + end + end + f94_local0.additional_handlers = nil + end + f94_local1.properties = f94_local0 + if f94_arg0.children then + buildChildren( f94_local1, f94_local0, f94_arg0.children ) + end + if f94_local1.disabledStateChange then + if f94_local1.disabled then + f94_local1:processEvent( { + name = "disable" + } ) + else + f94_local1:processEvent( { + name = "enable" + } ) + end + end + if f94_arg0.isSignInMenu then + f94_local1.isSignInMenu = f94_arg0.isSignInMenu + end + f0_local16() + return f94_local1 + end +end + +function buildMenu( f95_arg0, f95_arg1 ) + m_debugData.requstedMenu = f95_arg0 + m_debugData.definitionStack = {} + if not f95_arg1 then + f95_arg1 = {} + end + local f95_local0 = buildItems( { + type = f95_arg0, + properties = f95_arg1 + }, {}, nil ) + m_debugData.requstedMenu = nil + m_debugData.definitionStack = {} + m_debugData.currentDef = {} + return f95_local0 +end + +function unmarkChildren( f96_arg0 ) + local f96_local0 = f96_arg0:getFirstChild() + while f96_local0 ~= nil do + local f96_local1 = f96_local0:getNextSibling() + f96_local0._marked = false + unmarkChildren( f96_local0 ) + f96_local0 = f96_local1 + end +end + +function closeUnmarkedChildren( f97_arg0 ) + local f97_local0 = f97_arg0:getFirstChild() + while f97_local0 ~= nil do + local f97_local1 = f97_local0:getNextSibling() + if f97_local0._fromMenuBuilder and not f97_local0._marked then + f97_local0:close() + else + closeUnmarkedChildren( f97_local0 ) + end + f97_local0 = f97_local1 + end +end + +function HandleMenuRefresh( f98_arg0, f98_arg1 ) + unmarkChildren( f98_arg0 ) + local f98_local0 = f98_arg0.children + if f98_arg0.childrenFeeder then + f98_local0 = f98_arg0.childrenFeeder( f98_arg0.properties ) + end + local f98_local1 = f98_arg0:getAllFocusedChildren() + if #f98_local1 > 0 then + f98_arg0:saveState() + end + m_debugData.requstedMenu = "menuRefreshEvent" + m_debugData.definitionStack = {} + buildChildren( f98_arg0, f98_arg0.properties, f98_local0 ) + m_debugData.requstedMenu = nil + m_debugData.definitionStack = {} + m_debugData.currentDef = {} + closeUnmarkedChildren( f98_arg0 ) + if #f98_local1 > 0 then + local f98_local2, f98_local3 = f98_arg0:restoreState( true ) + if f98_local3 == 0 then + f98_arg0:clearSavedState() + f98_arg0:processEvent( { + name = "gain_focus" + } ) + end + end + f98_arg0:processEvent( { + name = "element_refresh", + dispatchChildren = true + } ) +end + +function BuildAddChild( f99_arg0, f99_arg1 ) + local f99_local0 = nil + if type( f99_arg1 ) == "table" then + f99_local0 = buildItems( f99_arg1, f99_arg0.properties, f99_arg0 ) + else + f99_local0 = f99_arg1 + end + m_debugData.requstedMenu = nil + m_debugData.definitionStack = {} + m_debugData.currentDef = {} + f99_arg0:addElement( f99_local0 ) + return f99_local0 +end + +function BuildRegisteredType( f100_arg0, f100_arg1 ) + assert( type( f100_arg0 ) == "string" ) + assert( m_types[f100_arg0], "Could not find a constructor for " .. f100_arg0 .. "." .. (m_definitions[f100_arg0] and " Use 'LUI.MenuBuilder.BuildAddChild' to build elements registered using the deprecated MenuBuilder" or "") ) + return m_types[f100_arg0]( nil, f100_arg1 ) +end + +function AnimStateBasedOn( f101_arg0, f101_arg1 ) + return setmetatable( f101_arg1, { + __index = f101_arg0 + } ) +end + +LockTable( _M ) diff --git a/lui/menugenericbuttons.dec.lua b/lui/menugenericbuttons.dec.lua new file mode 100644 index 0000000..448bba8 --- /dev/null +++ b/lui/menugenericbuttons.dec.lua @@ -0,0 +1,2027 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +DebugPrint( "Registering " .. _NAME ) +LUI.UIGenericButton = {} +f0_local0 = function ( f1_arg0, f1_arg1 ) + if f1_arg1 then + if f1_arg1.itemProps and f1_arg1.itemProps[f1_arg0] ~= nil then + return f1_arg1.itemProps[f1_arg0] + elseif f1_arg1.substyle and f1_arg1.substyle[f1_arg0] ~= nil then + return f1_arg1.substyle[f1_arg0] + elseif f1_arg1.style and f1_arg1.style[f1_arg0] ~= nil then + return f1_arg1.style[f1_arg0] + elseif GenericButtonSettings.Common[f1_arg0] ~= nil then + return GenericButtonSettings.Common[f1_arg0] + end + end + DebugPrint( "WARNING: MenuGenericButtons tried to read a setting that does not exist (" .. f1_arg0 .. "). You should be worried." ) +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg0.align + if not f2_local0 then + f2_local0 = LUI.Alignment.Right + end + local f2_local1 = f2_arg0.padding or 0 + local f2_local2 = f2_arg0.yOffset or 0 + local f2_local3 = f2_local0 == LUI.Alignment.Right + local f2_local4 = f2_local0 == LUI.Alignment.Left + local f2_local5 = LUI.UIText.new + local f2_local6 = CoD.ColorizeState + local f2_local7 = f2_arg0.text_default_color + local f2_local8 = { + alignment = f2_local0, + font = CoD.TextSettings.NormalFont.Font, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = not f2_local4 + } + if f2_local4 then + local f2_local9 = f2_local1 + end + f2_local8.left = f2_local9 or 0 + local f2_local10 + if f2_local3 then + f2_local10 = -f2_local1 + if not f2_local10 then + + else + f2_local8.right = f2_local10 + f2_local8.top = f2_local2 - CoD.TextSettings.NormalFont.Height / 2 + f2_local8.bottom = f2_local2 + CoD.TextSettings.NormalFont.Height / 2 + f2_local5 = f2_local5( f2_local6( f2_local7, f2_local8 ) ) + f2_local5.id = "text_label" + f2_local5:registerAnimationState( "focus", CoD.ColorizeState( f2_arg0.text_focus_color ) ) + f2_local5:registerAnimationState( "locked", CoD.ColorizeState( f2_arg0.text_lock_color ) ) + f2_local5:registerAnimationState( "disabled", CoD.ColorizeState( f2_arg0.text_disabled_color ) ) + f2_local5:registerAnimationState( "over_disabled", CoD.ColorizeState( f2_arg0.text_over_disabled_color ) ) + f2_local5:registerAnimationState( "over_disabled_pulse", CoD.ColorizeState( f2_arg0.text_over_disabled_pulse_color ) ) + f2_local5:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f2_local5:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f2_local5:registerEventHandler( "button_over_disable", MBh.AnimateLoop( { + { + "over_disabled", + 0 + }, + { + "over_disabled_pulse", + f2_arg0.overDisabledAnimationDuration + }, + { + "over_disabled", + f2_arg0.overDisabledAnimationDuration + } + } ) ) + f2_local5:registerEventHandler( "button_disable", MBh.AnimateToState( "disabled" ) ) + f2_local5:registerEventHandler( "change_text_default_color", function ( element, event ) + element:registerAnimationState( "default", CoD.ColorizeState( event.color ) ) + end ) + if f2_arg0.additional_handlers then + for f2_local10, f2_local11 in pairs( f2_arg0.additional_handlers ) do + f2_local5:addEventHandler( f2_local10, f2_local11 ) + end + end + if f2_arg1 then + f2_local5:setText( f2_arg1 ) + end + return f2_local5 + end + end + f2_local10 = 0 +end + +f0_local2 = function ( f4_arg0, f4_arg1 ) + if f4_arg0.properties and f4_arg0.properties.button_display_func then + local f4_local0 = f4_arg0.properties:button_display_func( f4_arg1 ) + if f4_local0 then + f4_arg0:setText( f4_local0 ) + end + end +end + +local f0_local3 = function ( f5_arg0, f5_arg1 ) + local f5_local0 = f5_arg0.width or 160 + local f5_local1 = f5_arg0.margin or 0 + local f5_local2 = f5_arg0.useText + local f5_local3 = f5_arg0.yOffset or 0 + local f5_local4 = f5_arg0.useBackground + local f5_local5 = f5_arg0.backgroundMarginTop or 0 + local f5_local6 = f5_arg0.backgroundMarginBottom or 0 + local f5_local7 = f5_arg0.useArrows + local f5_local8 = f5_arg0.arrowsMargin + local f5_local9 = f5_arg0.useSlider + local f5_local10 = f5_arg0.sliderWidth + local f5_local11 = f5_arg0.sliderHeight + local f5_local12 = f5_arg0.useInput + local f5_local13 = f5_arg0.field_edited_func or nil + local f5_local14 = f5_arg0.max_length or 20 + local f5_local15 = f5_arg0.password_field or false + local f5_local16 = f5_arg0.text_alignment + if not f5_local16 then + f5_local16 = LUI.Alignment.Left + end + local f5_local17 = f5_arg0.filter_profanity or false + local f5_local18 = f5_arg0.keyboard_type + if not f5_local18 then + f5_local18 = CoD.KeyboardInputTypes.Normal + end + local f5_local19 = f5_arg0.field_name or "Placeholder Field Name" + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -f5_local1 - f5_local0, + right = -f5_local1 + } ) + self.id = "button_value" + self.properties = f5_arg1 or {} + if f5_local4 then + local f5_local21 = LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + red = 0, + green = 0, + blue = 0, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = f5_local5, + bottom = -f5_local6, + left = 0, + right = 0, + alpha = 0 + } ) + f5_local21.id = "background" + f5_local21:registerAnimationState( "focus", { + alpha = 1 + } ) + f5_local21:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f5_local21:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f5_local21:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + self:addElement( f5_local21 ) + end + local f5_local21 = function ( f6_arg0, f6_arg1 ) + if self.properties.button_left_func then + self.properties:button_left_func( f6_arg1 ) + end + f6_arg0:processEvent( { + name = "content_arrow_left" + } ) + self:processEvent( { + name = "content_refresh" + } ) + end + + local f5_local22 = function ( f7_arg0, f7_arg1 ) + if self.properties.button_right_func then + self.properties:button_right_func( f7_arg1 ) + end + self:processEvent( { + name = "content_refresh" + } ) + f7_arg0:processEvent( { + name = "content_arrow_right" + } ) + end + + if f5_local7 then + local f5_local23 = function ( f8_arg0, f8_arg1 ) + local f8_local0 = LUI.UIImage.new + local f8_local1 = { + material = RegisterMaterial( "widg_lobby_arrow" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 9, + bottom = -9 + } + local f8_local2 + if f8_arg1 then + f8_local2 = 17 + if not f8_local2 then + + else + f8_local1.left = f8_local2 + if f8_arg1 then + f8_local2 = 5 + if not f8_local2 then + + else + f8_local1.right = f8_local2 + f8_local1.alpha = 0 + f8_local0 = f8_local0( f8_local1 ) + f8_local0.id = "arrow_gfx" + f8_local0:registerAnimationState( "focus", CoD.ColorizeState( Engine.IsAliensMode() and Colors.alien_frontend_hilite or Colors.frontend_hilite ) ) + f8_local0:registerAnimationState( "pulse", { + red = 1, + green = 1, + blue = 1 + } ) + f8_local2 = f8_local0 + f8_local1 = f8_local0.registerEventHandler + local f8_local3 = "content_arrow_" + local self + if f8_arg1 then + self = "left" + if not self then + + else + f8_local1( f8_local2, f8_local3 .. self, function ( f9_arg0, f9_arg1 ) + if f5_local9 then + Engine.PlaySound( CoD.SFX.AdjustSlider ) + else + Engine.PlaySound( CoD.SFX.OtherAdjust ) + end + local f9_local0 = MBh.AnimateSequence( { + { + "pulse", + 100 + }, + { + "focus", + 200 + } + } ) + f9_local0( f9_arg0, f9_arg1 ) + end ) + f8_local1 = LUI.UIButton.new + f8_local2 = { + material = RegisterMaterial( "widg_lobby_arrow" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = f8_arg1, + rightAnchor = not f8_arg1, + top = f5_local3 - 15, + bottom = f5_local3 + 15 + } + f8_local3 = f5_local8 + if f8_arg1 then + self = 1 + if not self then + + else + f8_local3 = f8_local3 * self + if f8_arg1 then + self = 0 + if not self then + + else + f8_local2.left = f8_local3 + 12 * self - 5 + f8_local3 = f5_local8 + if f8_arg1 then + self = 1 + if not self then + + else + f8_local3 = f8_local3 * self + if f8_arg1 then + self = 1 + if not self then + + else + f8_local2.right = f8_local3 + 12 * self + 5 + f8_local1 = f8_local1( f8_local2 ) + f8_local1.id = "arrow_" .. f8_arg0 + f8_local1.m_requireFocusType = FocusType.MouseOver + f8_local1:registerEventHandler( "hide_arrows", function ( element, event ) + f8_local0:animateToState( "default" ) + element.gainFocusSFX = nil + end ) + f8_local1:registerEventHandler( "show_arrows", function ( element, event ) + f8_local0:animateToState( "focus" ) + element.gainFocusSFX = CoD.SFX.MouseOver + end ) + f8_local1:processEvent( { + name = "hide_arrows" + } ) + f8_local1:addElement( f8_local0 ) + if f8_arg1 then + f8_local2 = "left" + if not f8_local2 then + + else + if f8_arg1 then + f8_local3 = f5_local21 + if not f8_local3 then + + else + self:registerEventHandler( "button_" .. f8_local2, f8_local3 ) + if not Engine.IsConsoleGame() then + f8_local1:registerEventHandler( "button_action", f8_local3 ) + self = LUI.UIButtonRepeater.new( "leftmouse", "button_action", f8_local1 ) + self:disable() + self:registerEventHandler( "button_up", self.disable ) + self:registerEventHandler( "button_over", self.enable ) + self:registerEventHandler( "button_over_disable", self.disable ) + f8_local1:addElement( self ) + local f8_local5 = LUI.UIButtonRepeater.new( f8_local2, "button_" .. f8_local2, self ) + f8_local5.id = f8_local2 .. "_repeater" + f8_local5:disable() + f8_local5:registerEventHandler( "button_up", f8_local5.disable ) + f8_local5:registerEventHandler( "button_over", f8_local5.enable ) + f8_local5:registerEventHandler( "button_over_disable", f8_local5.disable ) + self:addElement( f8_local5 ) + if f5_local2 then + self:setMinDelay( 240 ) + f8_local5:setMinDelay( 240 ) + end + end + return f8_local1 + end + end + f8_local3 = f5_local22 + end + end + f8_local2 = "right" + end + end + self = 0 + end + end + self = -1 + end + end + self = -1 + end + end + self = -1 + end + end + self = "right" + end + end + f8_local2 = 17 + end + end + f8_local2 = 5 + end + + self:addElement( f5_local23( "left", true ) ) + self:addElement( f5_local23( "right", false ) ) + if f5_arg1.button_left_func then + self.properties.button_left_func = f5_arg1.button_left_func + end + if f5_arg1.button_right_func then + self.properties.button_right_func = f5_arg1.button_right_func + end + end + if f5_local2 then + local f5_local23 = LUI.UIText.new + local f5_local24 = CoD.ColorizeState + local f5_local25 = f5_arg0.content_default_color + local f5_local26 = {} + local f5_local27 = f5_arg0.labelAlign + if not f5_local27 then + f5_local27 = LUI.Alignment.Center + end + f5_local26.alignment = f5_local27 + f5_local26.font = CoD.TextSettings.NormalFont.Font + f5_local26.topAnchor = false + f5_local26.bottomAnchor = false + f5_local26.leftAnchor = false + f5_local26.rightAnchor = false + f5_local26.left = -f5_local0 / 2 + f5_local26.right = f5_local0 / 2 + f5_local26.top = f5_local3 - CoD.TextSettings.NormalFont.Height / 2 + f5_local26.bottom = f5_local3 + CoD.TextSettings.NormalFont.Height / 2 + f5_local23 = f5_local23( f5_local24( f5_local25, f5_local26 ) ) + f5_local23.id = "content_text_label" + f5_local23:setText( "Placeholder" ) + if f5_local4 then + f5_local24 = f5_arg0.content_focus_color + if not f5_local24 then + + else + f5_local23:registerAnimationState( "focus", CoD.ColorizeState( f5_local24 ) ) + f5_local23:registerAnimationState( "locked", CoD.ColorizeState( f5_arg0.content_lock_color ) ) + f5_local23:registerAnimationState( "disabled", CoD.ColorizeState( f5_arg0.text_disabled_color ) ) + f5_local23:registerAnimationState( "over_disabled", CoD.ColorizeState( f5_arg0.text_over_disabled_pulse_color ) ) + f5_local23:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f5_local23:registerEventHandler( "button_lock", MBh.AnimateToState( "locked" ) ) + f5_local23:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f5_local23:registerEventHandler( "button_over_disable", MBh.AnimateToState( "disabled" ) ) + f5_local23:registerEventHandler( "button_disable", MBh.AnimateToState( "disabled" ) ) + if not f5_local4 then + f5_local23:registerEventHandler( "button_over_disable", MBh.AnimateToState( "over_disabled" ) ) + end + f5_local23:registerEventHandler( "content_refresh", f0_local2 ) + f5_local23:registerEventHandler( "menu_create", f0_local2 ) + if f5_arg1.button_display_func then + f5_local23.properties = f5_arg1 or {} + f5_local23.properties.button_display_func = f5_arg1.button_display_func + f0_local2( f5_local23, {} ) + end + self:addElement( f5_local23 ) + end + end + f5_local24 = f5_arg0.content_focus_color_without_bg + end + if f5_local9 then + local f5_local23 = LUI.UIElement.new( { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = f5_local3 - f5_local11 / 2, + bottom = f5_local3 + f5_local11 / 2, + left = -f5_local10 / 2, + right = f5_local10 / 2 + } ) + f5_local23.id = "slider" + local f5_local24 = LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + red = Colors.generic_menu_frame_color.r, + green = Colors.generic_menu_frame_color.g, + blue = Colors.generic_menu_frame_color.b, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -1, + bottom = 1, + left = -2, + right = 2 + } ) + f5_local24.id = "border" + f5_local23:addElement( f5_local24 ) + local f5_local25 = LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = -1, + right = 1, + red = 0, + green = 0, + blue = 0 + } ) + f5_local25.id = "background" + f5_local25:setHandleMouseButton( not Engine.IsConsoleGame() ) + f5_local23:addElement( f5_local25 ) + local f5_local26 = LUI.UIImage.new( { + material = RegisterMaterial( "widg_weapon_slider_mid" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f5_local10 + } ) + f5_local26.id = "fill" + f5_local23:addElement( f5_local26 ) + local f5_local27 = function ( f12_arg0, f12_arg1 ) + if f12_arg0.properties and f12_arg0.properties.button_display_func and f12_arg0.properties.slider_width then + local f12_local0 = f12_arg0.properties.button_display_func() + if f12_local0 == nil then + f12_local0 = 0 + end + f5_local26:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = -1 * f12_arg0.properties.slider_width * (1 - f12_local0), + top = 0, + bottom = 0, + material = RegisterMaterial( "widg_weapon_slider_mid" ) + } ) + f5_local26:animateToState( "default", 0 ) + end + end + + if not Engine.IsConsoleGame() and f5_arg1.button_display_func then + f5_local25:registerEventHandler( "leftmousedown", function ( element, event ) + if not element.disabled then + local f13_local0 = element:getWidth() + local f13_local1, f13_local2, f13_local3, f13_local4 = element:getRect() + f13_local1, f13_local2 = event.root:pixelsToUnits( f13_local1, f13_local2 ) + local f13_local5, f13_local6 = event.root:pixelsToUnits( event.x, event.y ) + local f13_local7 = (f13_local5 - f13_local1) / f13_local0 + local f13_local8 = f5_arg1.button_display_func() + local f13_local9 + if f13_local8 < f13_local7 then + f13_local9 = self.properties.button_right_func + if not f13_local9 then + + else + local f13_local10 = f13_local8 + local f13_local11 = nil + while (f13_local7 - f13_local8) * (f13_local7 - f13_local10) > 0 do + f13_local9( self, event ) + f13_local11 = f13_local10 + f13_local10 = f5_arg1.button_display_func() + if f13_local11 == f13_local10 then + break + end + end + self:processEvent( { + name = "content_refresh" + }, event ) + end + end + f13_local9 = self.properties.button_left_func + end + end ) + f5_local25:registerEventHandler( "button_disable", function ( element, event ) + element.disabled = true + end ) + f5_local25:registerEventHandler( "button_up", function ( element, event ) + element.disabled = false + end ) + end + f5_local23:registerEventHandler( "content_refresh", f5_local27 ) + f5_local23:registerEventHandler( "menu_create", f5_local27 ) + if f5_arg1.button_display_func then + f5_local23.properties = f5_arg1 or {} + f5_local23.properties.slider_width = f5_local10 + f5_local23.properties.button_display_func = f5_arg1.button_display_func + f5_local27( f5_local23, {} ) + end + self:addElement( f5_local23 ) + end + if f5_local12 then + local f5_local24 = LUI.MenuBuilder.buildItems( { + type = "generic_input_field", + properties = { + textLeft = 0, + textAlign = LUI.Alignment.Center, + field_edited_func = f5_local13, + max_length = f5_local14, + password_field = f5_local15, + verify_string = false, + filter_profanity = f5_local17, + help_value = "", + field_name = f5_local19, + keyboard_type = f5_local18, + text_alignment = f5_local16 + } + }, {} ) + f5_local24.id = "input" + local f5_local26 = f5_local24 + local f5_local25 = f5_local24.registerAnimationState + local f5_local27 = "default" + local f5_local28 = {} + local f5_local29 = f5_arg0.labelAlign + if not f5_local29 then + f5_local29 = LUI.Alignment.Center + end + f5_local28.alignment = f5_local29 + f5_local28.font = CoD.TextSettings.NormalFont.Font + f5_local28.topAnchor = false + f5_local28.bottomAnchor = false + f5_local28.leftAnchor = false + f5_local28.rightAnchor = false + f5_local28.left = -f5_local0 / 2 + f5_local28.right = f5_local0 / 2 + f5_local28.top = f5_local3 - CoD.TextSettings.NormalFont.Height / 2 + f5_local28.bottom = f5_local3 + CoD.TextSettings.NormalFont.Height / 2 + f5_local28.alpha = 1 + f5_local25( f5_local26, f5_local27, f5_local28 ) + f5_local24:animateToState( "default" ) + f5_local24:registerEventHandler( "button_over", function ( element, event ) + MBh.AnimateToState( "focus" ) + element:processEvent( { + name = "colorize", + red = f5_arg0.content_focus_color.r, + green = f5_arg0.content_focus_color.g, + blue = f5_arg0.content_focus_color.b + } ) + end ) + f5_local24:registerEventHandler( "button_up", function ( element, event ) + MBh.AnimateToState( "default" ) + element:processEvent( { + name = "colorize", + red = f5_arg0.content_default_color.r, + green = f5_arg0.content_default_color.g, + blue = f5_arg0.content_default_color.b + } ) + element:processEvent( { + name = "edit_unfocus" + } ) + end ) + self:addElement( f5_local24 ) + end + return self +end + +local f0_local4 = function ( f18_arg0, f18_arg1 ) + local f18_local0 = f18_arg0.checkboxMargin or 0 + local f18_local1 = f18_arg0.yOffset or 0 + local self = LUI.UIImage.new( { + material = RegisterMaterial( "box_empty" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = f18_local1 - 6, + bottom = f18_local1 + 6, + left = -f18_local0 - 10, + right = -f18_local0, + alpha = 1 + } ) + self.id = "checkbox" + self.properties = { + isVisible = true + } + self:registerAnimationState( "hidden", { + alpha = 0 + } ) + self:registerEventHandler( "show_checkbox", function ( element, event ) + element.properties.isVisible = true + if event.showBox ~= nil then + element.properties.isVisible = event.showBox + end + element:animateToState( element.properties.isVisible and "default" or "hidden", 0 ) + end ) + local f18_local3 = LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + red = Colors.frontend_hilite.r, + green = Colors.frontend_hilite.g, + blue = Colors.frontend_hilite.b, + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 2, + bottom = -2, + left = 2, + right = -2, + alpha = 0 + } ) + f18_local3.id = "checkmark" + f18_local3.properties = { + isChecked = false + } + f18_local3:registerAnimationState( "checked", { + alpha = 1 + } ) + f18_local3:registerEventHandler( "toggle_checked", function ( element, event ) + event.name = "set_checked" + event.checkBox = not element.properties.isChecked + element:processEvent( event ) + end ) + f18_local3:registerEventHandler( "set_checked", function ( element, event ) + element.properties.isChecked = true + if event.checkBox ~= nil then + element.properties.isChecked = event.checkBox + end + element:animateToState( element.properties.isChecked and "checked" or "default", 0 ) + end ) + self:addElement( f18_local3 ) + return self +end + +local f0_local5 = function ( f22_arg0 ) + local f22_local0 = f22_arg0.useActionButton + local self = LUI.UIImage.new( { + material = RegisterMaterial( "btn_00a_ltcap" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f0_local0( "lt_cap_width", f22_arg0 ) + } ) + self.id = "bgLeftCap" + self:registerAnimationState( "focus", { + material = Engine.IsAliensMode() and RegisterMaterial( "btn_alien_00a_ltcap_f" ) or RegisterMaterial( "btn_00a_ltcap_f" ) + } ) + self:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + self:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + self:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + self:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + local f22_local2 = LUI.UIImage.new( { + material = RegisterMaterial( "btn_00a_rtcap" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -f0_local0( "rt_cap_width", f22_arg0 ), + right = 0 + } ) + f22_local2.id = "bgRightCap" + f22_local2:registerAnimationState( "disabled", { + material = RegisterMaterial( f22_arg0.disablePadlock and "btn_00a_rtcap" or "btn_00a_rtcap_d" ) + } ) + if f22_local0 then + f22_local2:registerAnimationState( "focus", { + material = Engine.IsAliensMode() and RegisterMaterial( "btn_alien_00a_rtcap_f" ) or RegisterMaterial( "btn_00a_rtcap_f" ) + } ) + f22_local2:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + else + f22_local2:registerAnimationState( "focus", { + material = Engine.IsAliensMode() and RegisterMaterial( "btn_alien_00a_rtcap_f_pc" ) or RegisterMaterial( "btn_00a_rtcap_f_pc" ) + } ) + f22_local2:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + end + f22_local2:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f22_local2:registerEventHandler( "button_disable", MBh.AnimateToState( "disabled" ) ) + f22_local2:registerEventHandler( "button_over_disable", MBh.AnimateToState( "disabled" ) ) + if Engine.IsAliensMode() then + local f22_local3 = LUI.UIImage.new( { + material = RegisterMaterial( "btn_alien_overlay" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -44, + bottom = 16, + left = -208, + right = -48, + alpha = 0 + } ) + f22_local3.id = "blood_splat_glow" + f22_local3:registerAnimationState( "glow", { + alpha = f0_local0( "focus_action_button_glow_max_alpha", f22_arg0 ) + } ) + f22_local3:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f22_local3:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f22_local3:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + local f22_local4 = f22_local3 + local f22_local5 = f22_local3.registerEventHandler + local f22_local6 = "button_over" + local f22_local7 = MBh.AnimateLoop + local f22_local8 = {} + local f22_local9 = {} + local f22_local10 = "glow" + local f22_local11 = f0_local0( "focus_glow_animation_duration", f22_arg0 ) + f22_local9 = f22_local10 + f22_local10 = {} + f22_local11 = "default" + local f22_local12 = f0_local0( "focus_glow_animation_duration", f22_arg0 ) + f22_local10 = f22_local11 + f22_local8[1] = f22_local9 + f22_local8[2] = f22_local10 + f22_local5( f22_local4, f22_local6, f22_local7( f22_local8 ) ) + f22_local2:addElement( f22_local3 ) + f22_local5 = LUI.UIImage.new( { + material = RegisterMaterial( "btn_alien_overlay_02" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -28, + bottom = 32, + left = -208, + right = -48, + alpha = 0 + } ) + f22_local5.id = "blood_splat_glow_02" + f22_local5:registerAnimationState( "glow", { + alpha = f0_local0( "focus_alien_action_button_glow_max_alpha", f22_arg0 ) + } ) + f22_local5:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f22_local5:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f22_local5:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + f22_local6 = f22_local5 + f22_local4 = f22_local5.registerEventHandler + f22_local7 = "button_over" + f22_local8 = MBh.AnimateLoop + f22_local9 = {} + f22_local10 = {} + f22_local11 = "glow" + f22_local12 = f0_local0( "focus_alien_glow_animation_duration", f22_arg0 ) + f22_local10 = f22_local11 + f22_local11 = {} + f22_local12 = "default" + local f22_local13 = f0_local0( "focus_alien_glow_animation_duration", f22_arg0 ) + f22_local11 = f22_local12 + f22_local9[1] = f22_local10 + f22_local9[2] = f22_local11 + f22_local4( f22_local6, f22_local7, f22_local8( f22_local9 ) ) + f22_local2:addElement( f22_local5 ) + end + if f22_local0 then + local f22_local3 = LUI.UIText.new( { + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.NormalFont.Font, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = -f22_arg0.actionButtonMargin, + top = f0_local0( "y_offset", f22_arg0 ) - 16, + bottom = f0_local0( "y_offset", f22_arg0 ) + 16, + alpha = 0 + } ) + f22_local3.id = "action_button" + f22_local3:setText( Engine.Localize( ButtonMap.button_action.string ) ) + f22_local3:registerAnimationState( "focus", { + alpha = 1 + } ) + f22_local3:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f22_local3:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f22_local3:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + f22_local3:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f22_local2:addElement( f22_local3 ) + end + local f22_local3 = LUI.UIImage.new( { + material = RegisterMaterial( "btn_00a_mid" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = f0_local0( "lt_cap_width", f22_arg0 ), + right = -f0_local0( "rt_cap_width", f22_arg0 ) + } ) + f22_local3.id = "bgMid" + f22_local3:registerAnimationState( "focus", { + material = Engine.IsAliensMode() and RegisterMaterial( "btn_alien_00a_mid_f" ) or RegisterMaterial( "btn_00a_mid_f" ) + } ) + f22_local3:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f22_local3:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f22_local3:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + f22_local3:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + local f22_local5 = LUI.UIElement.new( { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } ) + f22_local5.id = "hlist" + if f22_arg0.extendOnFocus then + f22_local5:registerAnimationState( "extended", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = f0_local0( "focus_animation_distance", f22_arg0 ), + top = 0, + bottom = 0 + } ) + f22_local5:registerEventHandler( "button_over", MBh.AnimateToState( "extended", f0_local0( "focus_animation_duration", f22_arg0 ) ) ) + f22_local5:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f22_local5:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f22_local5:registerEventHandler( "button_over_disable", MBh.AnimateToState( "extended", f0_local0( "focus_animation_duration", f22_arg0 ) ) ) + end + f22_local5:addElement( self ) + f22_local5:addElement( f22_local3 ) + f22_local5:addElement( f22_local2 ) + local f22_local4 = LUI.UIImage.new( { + material = RegisterMaterial( "btn_00a_glow" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + red = 0, + green = 0, + blue = 0, + alpha = 0 + } ) + f22_local4.id = "selection_glow" + f22_local4:registerAnimationState( "glow", { + alpha = f0_local0( "focus_glow_max_alpha", f22_arg0 ) + } ) + f22_local4:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + local f22_local7 = f22_local4 + local f22_local6 = f22_local4.registerEventHandler + local f22_local8 = "button_over" + local f22_local9 = MBh.AnimateLoop + local f22_local10 = {} + local f22_local11 = {} + local f22_local12 = "default" + local f22_local13 = f0_local0( "focus_glow_animation_duration", f22_arg0 ) + f22_local11 = f22_local12 + f22_local12 = {} + f22_local13 = "glow" + local f22_local14 = f0_local0( "focus_glow_animation_duration", f22_arg0 ) + f22_local12 = f22_local13 + f22_local10[1] = f22_local11 + f22_local10[2] = f22_local12 + f22_local6( f22_local7, f22_local8, f22_local9( f22_local10 ) ) + f22_local6 = LUI.UIElement.new( { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } ) + f22_local6.id = "background" + f22_local6:addElement( f22_local5 ) + f22_local6:addElement( f22_local4 ) + return f22_local6 +end + +local f0_local6 = function ( f23_arg0 ) + local f23_local0 = f23_arg0.useActionButton + local f23_local1 = f0_local0( "submenu_substyle", f23_arg0 ) + local f23_local2 = f0_local0( "border_height", f23_arg0 ) + local f23_local3 = f0_local0( "border_padding", f23_arg0 ) + local f23_local4 = not f0_local0( "disable_border", f23_arg0 ) + local self = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self.id = "container" + if not f23_local4 or not f23_local2 then + f23_local2 = 0 + end + if not f23_local4 or not f23_local3 then + f23_local3 = 0 + end + if f23_local4 then + local f23_local6 = LUI.UIImage.new( CoD.ColorizeState( f0_local0( "border_color", f23_arg0 ), { + material = RegisterMaterial( "white" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -f23_local2, + bottom = 0, + left = 0, + right = 0 + } ) ) + f23_local6.id = "border" + self:addElement( f23_local6 ) + end + local f23_local6 = LUI.UIElement.new( { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = f0_local0( "background_padding", f23_arg0 ), + bottom = -f23_local3 - f23_local2, + left = 0, + right = 0 + } ) + f23_local6.id = "background" + self:addElement( f23_local6 ) + local f23_local7 = LUI.UIImage.new( { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0 + } ) + f23_local7.id = "flat" + if f23_local1 then + local f23_local8 = f0_local0( "anim_interval", f23_arg0 ) + local f23_local9 = f0_local0( "anim_1_alpha", f23_arg0 ) + local f23_local10 = f0_local0( "anim_2_alpha", f23_arg0 ) + f23_local7:registerAnimationState( "anim_1", { + alpha = f23_local9 + } ) + f23_local7:registerAnimationState( "anim_2", { + alpha = f23_local10 + } ) + f23_local7:registerEventHandler( "button_over", MBh.AnimateLoop( { + { + "anim_1", + 0, + true, + true + }, + { + "anim_1", + 350, + true, + true + }, + { + "anim_2", + f23_local8, + true, + true + }, + { + "anim_1", + f23_local8, + true, + true + } + } ) ) + else + f23_local7:registerAnimationState( "focus", { + red = 1, + green = 1, + blue = 1, + alpha = 0.5 + } ) + f23_local7:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + end + f23_local7:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f23_local7:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f23_local6:addElement( f23_local7 ) + if not f23_arg0.disablePadlock then + local f23_local8 = LUI.UIImage.new( CoD.ColorizeState( Colors.frontend_hilite, { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = 0 + } ) ) + f23_local8.id = "lock" + f23_local8:registerAnimationState( "visible", { + alpha = 1 + } ) + f23_local8:registerEventHandler( "button_lock", MBh.AnimateToState( "visible" ) ) + f23_local8:registerEventHandler( "button_unlock", MBh.AnimateToState( "default" ) ) + f23_local6:addElement( f23_local8 ) + end + if f23_local0 and not f23_local1 then + local f23_local8 = LUI.UIImage.new( { + material = RegisterMaterial( "btn_cas_end_f" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -f0_local0( "prompt_width", f23_arg0 ), + right = 0, + alpha = 0 + } ) + f23_local8.id = "promptBG" + f23_local8:registerAnimationState( "focus", { + alpha = 1 + } ) + f23_local8:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f23_local8:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f23_local8:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + f23_local8:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f23_local6:addElement( f23_local8 ) + if Engine.IsConsoleGame() or 1 == Engine.IsGamepadEnabled() then + local f23_local9 = LUI.UIText.new( { + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.NormalFont.Font, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = -f23_arg0.actionButtonMargin, + top = -16, + bottom = 16, + alpha = 0 + } ) + f23_local9.id = "action_button" + f23_local9:setText( Engine.Localize( ButtonMap.button_action.string ) ) + f23_local9:registerAnimationState( "focus", { + alpha = 1 + } ) + f23_local9:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f23_local9:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f23_local9:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + f23_local9:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f23_local6:addElement( f23_local9 ) + end + end + return self +end + +local f0_local7 = function ( f24_arg0 ) + local f24_local0 = f24_arg0.useActionButton + local f24_local1 = f0_local0( "popup_substyle", f24_arg0 ) + local f24_local2 = f0_local0( "submenu_substyle", f24_arg0 ) + local f24_local3 = f0_local0( "border_height", f24_arg0 ) + local f24_local4 = f0_local0( "border_padding", f24_arg0 ) + local f24_local5 = not f0_local0( "disable_border", f24_arg0 ) + local self = LUI.UIElement.new() + self.id = "container" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = f0_local0( "ghost_height", f24_arg0 ), + left = 0, + right = f0_local0( "ghost_width", f24_arg0 ) + } ) + self:animateToState( "default" ) + if not f24_local5 or not f24_local3 then + f24_local3 = 0 + end + if not f24_local5 or not f24_local4 then + f24_local4 = 0 + end + if f24_local5 then + local f24_local7 = LUI.UIImage.new() + f24_local7.id = "border" + f24_local7:registerAnimationState( "default", CoD.ColorizeState( f0_local0( "border_color", f24_arg0 ), { + material = RegisterMaterial( "white" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + height = f24_local3, + bottom = -f24_local4, + left = 0, + right = -f0_local0( "ghost_width", f24_arg0 ), + alpha = 1 + } ) ) + f24_local7:registerAnimationState( "focus", { + alpha = 0 + } ) + f24_local7:animateToState( "default" ) + f24_local7:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f24_local7:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f24_local7:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + f24_local7:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + self:addElement( f24_local7 ) + end + local f24_local7 = LUI.UIImage.new() + f24_local7.id = "bgLeftCap" + f24_local7:registerAnimationState( "default", { + material = RegisterMaterial( "btn_00d_ltcap_f" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = f0_local0( "lt_cap_width", f24_arg0 ), + alpha = 0 + } ) + f24_local7:animateToState( "default" ) + if f24_local1 or f24_local2 then + f24_local7:registerAnimationState( "anim_1", { + alpha = f0_local0( "anim_1_alpha", f24_arg0 ) + } ) + f24_local7:registerAnimationState( "anim_2", { + alpha = f0_local0( "anim_2_alpha", f24_arg0 ) + } ) + f24_local7:registerEventHandler( "button_over", MBh.AnimateLoop( { + { + "anim_1", + 0, + true, + true + }, + { + "anim_1", + 350, + true, + true + }, + { + "anim_2", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + }, + { + "anim_1", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + } + } ) ) + f24_local7:registerEventHandler( "button_over_disable", MBh.AnimateLoop( { + { + "anim_1", + 0, + true, + true + }, + { + "anim_1", + 350, + true, + true + }, + { + "anim_2", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + }, + { + "anim_1", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + } + } ) ) + else + f24_local7:registerAnimationState( "focus", { + alpha = 1 + } ) + f24_local7:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f24_local7:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + end + f24_local7:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f24_local7:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + self:addElement( f24_local7 ) + local f24_local8 = LUI.UIImage.new() + f24_local8.id = "bgMid" + local f24_local9 = f24_local8 + local f24_local10 = f24_local8.registerAnimationState + local f24_local11 = "default" + local f24_local12 = { + material = RegisterMaterial( "btn_00d_mid_f" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = f0_local0( "lt_cap_width", f24_arg0 ) + } + local f24_local13 + if f24_local1 or f24_local2 then + f24_local13 = -1 * (f0_local0( "lt_cap_width", f24_arg0 ) + f0_local0( "ghost_width", f24_arg0 )) + if not f24_local13 then + + else + f24_local12.right = f24_local13 + f24_local12.alpha = 0 + f24_local10( f24_local9, f24_local11, f24_local12 ) + f24_local8:animateToState( "default" ) + if f24_local1 or f24_local2 then + f24_local8:registerAnimationState( "anim_1", { + alpha = f0_local0( "anim_1_alpha", f24_arg0 ) + } ) + f24_local8:registerAnimationState( "anim_2", { + alpha = f0_local0( "anim_2_alpha", f24_arg0 ) + } ) + f24_local8:registerEventHandler( "button_over", MBh.AnimateLoop( { + { + "anim_1", + 0, + true, + true + }, + { + "anim_1", + 350, + true, + true + }, + { + "anim_2", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + }, + { + "anim_1", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + } + } ) ) + f24_local8:registerEventHandler( "button_over_disable", MBh.AnimateLoop( { + { + "anim_1", + 0, + true, + true + }, + { + "anim_1", + 350, + true, + true + }, + { + "anim_2", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + }, + { + "anim_1", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + } + } ) ) + else + f24_local8:registerAnimationState( "focus", { + alpha = 1 + } ) + f24_local8:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f24_local8:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + end + f24_local8:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f24_local8:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + self:addElement( f24_local8 ) + f24_local10 = LUI.UIImage.new() + f24_local10.id = "bgRightCap" + if f24_local1 or f24_local2 then + f24_local10:registerAnimationState( "default", { + material = RegisterMaterial( "btn_00d_rtcap_f_alt" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -1 * (f0_local0( "lt_cap_width", f24_arg0 ) + f0_local0( "ghost_width", f24_arg0 )), + right = -f0_local0( "ghost_width", f24_arg0 ), + alpha = 0 + } ) + f24_local10:animateToState( "default" ) + f24_local10:registerAnimationState( "anim_1", { + alpha = f0_local0( "anim_1_alpha", f24_arg0 ) + } ) + f24_local10:registerAnimationState( "anim_2", { + alpha = f0_local0( "anim_2_alpha", f24_arg0 ) + } ) + f24_local10:registerEventHandler( "button_over", MBh.AnimateLoop( { + { + "anim_1", + 0, + true, + true + }, + { + "anim_1", + 350, + true, + true + }, + { + "anim_2", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + }, + { + "anim_1", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + } + } ) ) + f24_local10:registerEventHandler( "button_over_disable", MBh.AnimateLoop( { + { + "anim_1", + 0, + true, + true + }, + { + "anim_1", + 350, + true, + true + }, + { + "anim_2", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + }, + { + "anim_1", + f0_local0( "anim_interval", f24_arg0 ), + true, + true + } + } ) ) + else + f24_local11 = f24_local10 + f24_local9 = f24_local10.registerAnimationState + f24_local12 = "default" + f24_local13 = {} + local f24_local14 = RegisterMaterial + local f24_local15 + if f24_local0 then + f24_local15 = "btn_00d_rtcap_f" + if not f24_local15 then + + else + f24_local13.material = f24_local14( f24_local15 ) + f24_local13.topAnchor = true + f24_local13.bottomAnchor = true + f24_local13.leftAnchor = false + f24_local13.rightAnchor = true + f24_local13.top = 0 + f24_local13.bottom = 0 + f24_local13.left = -f0_local0( "rt_cap_width", f24_arg0 ) + f24_local13.right = 0 + f24_local13.alpha = 0 + f24_local9( f24_local11, f24_local12, f24_local13 ) + f24_local10:animateToState( "default" ) + f24_local10:registerAnimationState( "focus", { + alpha = 1 + } ) + f24_local10:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f24_local10:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + end + end + f24_local15 = "btn_00d_rtcap_f_pc" + end + f24_local10:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f24_local10:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + self:addElement( f24_local10 ) + f24_local9 = LUI.UIImage.new() + f24_local9.id = "lock" + f24_local9:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = -f0_local0( "lock_padding", f24_arg0 ), + left = 0, + right = -f0_local0( "ghost_width", f24_arg0 ), + alpha = 0 + } ) ) + f24_local9:registerAnimationState( "visible", { + alpha = 1 + } ) + f24_local9:animateToState( "default" ) + f24_local9:registerEventHandler( "button_lock", MBh.AnimateToState( "visible" ) ) + f24_local9:registerEventHandler( "button_unlock", MBh.AnimateToState( "default" ) ) + self:addElement( f24_local9 ) + if f24_local0 then + f24_local11 = LUI.UIText.new() + f24_local11.id = "action_button" + f24_local11:setText( Engine.Localize( ButtonMap.button_action.string ) ) + f24_local11:registerAnimationState( "default", { + alignment = LUI.Alignment.Right, + font = CoD.TextSettings.NormalFont.Font, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = -f24_arg0.actionButtonMargin, + top = f0_local0( "height", f24_arg0 ) / 2 + f0_local0( "y_offset", f24_arg0 ) - 16, + bottom = f0_local0( "height", f24_arg0 ) / 2 + f0_local0( "y_offset", f24_arg0 ) + 16, + alpha = 0 + } ) + f24_local11:animateToState( "default" ) + f24_local11:registerAnimationState( "focus", { + alpha = 1 + } ) + f24_local11:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f24_local11:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) ) + f24_local11:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) ) + f24_local11:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) ) + f24_local10:addElement( f24_local11 ) + end + if not f24_arg0.disablePadlock then + f24_local11 = LUI.UIImage.new() + f24_local11.id = "padlock" + f24_local11:registerAnimationState( "default", { + material = RegisterMaterial( "icon_lock_mini" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + left = -f0_local0( "padlock_margin", f24_arg0 ) - f0_local0( "padlock_width", f24_arg0 ), + right = -f0_local0( "padlock_margin", f24_arg0 ), + top = f0_local0( "height", f24_arg0 ) / 2 + f0_local0( "y_offset", f24_arg0 ) - f0_local0( "padlock_height", f24_arg0 ) / 2, + bottom = f0_local0( "height", f24_arg0 ) / 2 + f0_local0( "y_offset", f24_arg0 ) + f0_local0( "padlock_height", f24_arg0 ) / 2, + alpha = 0 + } ) + f24_local11:animateToState( "default" ) + f24_local11:registerAnimationState( "visible", { + alpha = 1, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } ) + f24_local11:registerAnimationState( "visible_over", { + alpha = 1, + red = Colors.black.r, + green = Colors.black.g, + blue = Colors.black.b + } ) + f24_local11:registerEventHandler( "button_over", MBh.AnimateToState( "default" ) ) + f24_local11:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) ) + f24_local11:registerEventHandler( "button_disable", MBh.AnimateToState( "visible" ) ) + f24_local11:registerEventHandler( "button_over_disable", MBh.AnimateToState( "visible_over" ) ) + self:addElement( f24_local11 ) + end + return self + end + end + f24_local13 = -f0_local0( "rt_cap_width", f24_arg0 ) +end + +function CreateGenericButtonBackground( f25_arg0, f25_arg1, f25_arg2, f25_arg3, f25_arg4, f25_arg5, f25_arg6 ) + local f25_local0 = { + style = f25_arg0, + substyle = f25_arg1, + itemProps = f25_arg2 + } + local f25_local1 = nil + f25_local0.useActionButton = f25_arg4 or f25_arg3 or f25_arg5 + local f25_local2 = assert + local f25_local3 + if f0_local0( "force_disable_action_button", f25_arg6 ) then + f25_local3 = not f0_local0( "force_enable_action_button", f25_arg6 ) + else + f25_local3 = true + end + f25_local2( f25_local3, "Trying to force enable and force disable the button prompt." ) + f25_local2 = f25_local0.useActionButton + if f25_local2 then + f25_local2 = not f0_local0( "force_disable_action_button", f25_arg6 ) + end + f25_local0.useActionButton = f25_local2 + f25_local2 = f25_local0.useActionButton + if not f25_local2 then + f25_local2 = f0_local0( "force_enable_action_button", f25_arg6 ) + end + f25_local0.useActionButton = f25_local2 + f25_local2 = f25_local0.useActionButton + if f25_local2 then + f25_local2 = Engine.IsConsoleGame() + if not f25_local2 then + f25_local2 = Engine.IsGamepadEnabled() == 1 + end + end + f25_local0.useActionButton = f25_local2 + if not f25_arg3 and not f25_arg4 and not f25_arg5 then + f25_local2 = f0_local0( "force_enable_action_button", f25_arg6 ) + if f25_local2 then + + else + f25_local0.extendOnFocus = f25_local2 + f25_local0.disablePadlock = f0_local0( "disable_padlock", f25_arg6 ) + f25_local0.actionButtonMargin = f0_local0( "action_button_margin", f25_arg6 ) + if f25_arg0 == GenericButtonSettings.Styles.GradientButton then + f25_local1 = f0_local5( f25_local0 ) + elseif f25_arg0 == GenericButtonSettings.Styles.FlatButton then + f25_local1 = f0_local6( f25_local0 ) + elseif f25_arg0 == GenericButtonSettings.Styles.GlassButton then + f25_local1 = f0_local7( f25_local0 ) + end + if f25_local1 then + f25_local1:setPriority( -1000 ) + end + return f25_local1 + end + end + f25_local2 = not f0_local0( "force_disable_action_button", f25_arg6 ) +end + +function UpdateButtonText( f26_arg0, f26_arg1 ) + f26_arg0.textLabel:setText( f26_arg1 ) +end + +function UpdateDescText( f27_arg0, f27_arg1 ) + if f27_arg0.properties.desc_text then + local f27_local0 = "" + if type( f27_arg0.properties.desc_text ) == "string" then + f27_local0 = f27_arg0.properties.desc_text + elseif type( f27_arg0.properties.desc_text ) == "function" then + f27_local0 = f27_arg0.properties:desc_text( f27_arg1 ) + assert( type( f27_local0 ) == "string" ) + end + f27_arg0:dispatchEventToRoot( { + name = "set_button_info_text", + text = f27_local0 + } ) + end +end + +LUI.UIGenericButton.new = function ( f28_arg0, f28_arg1, f28_arg2 ) + if not f28_arg1 then + f28_arg1 = {} + end + local f28_local0 = f28_arg1.childNum + if not f28_arg2 then + f28_arg2 = f28_local0 or 0 + end + local f28_local1 = nil + local f28_local2 = f28_arg1.style + if not f28_local2 then + f28_local2 = GenericButtonSettings.Styles.GradientButton + end + local f28_local3 = f28_arg1.variant + if not f28_local3 then + f28_local3 = GenericButtonSettings.Variants.Plain + end + local f28_local4 = f28_local3 == GenericButtonSettings.Variants.Checkbox + local f28_local5 = f28_local3 == GenericButtonSettings.Variants.Plain + local f28_local6 = f28_local3 == GenericButtonSettings.Variants.Info + local f28_local7 = f28_local3 == GenericButtonSettings.Variants.Select + local f28_local8 = f28_local3 == GenericButtonSettings.Variants.Slider + local f28_local9 = f28_local3 == GenericButtonSettings.Variants.Input + local f28_local10 = f28_local8 or f28_local7 or f28_local6 or f28_local9 + local f28_local11 + if f28_local2 == GenericButtonSettings.Styles.GradientButton then + f28_local11 = not f28_arg1.disableAnimation + else + f28_local11 = false + end + if f28_local2 == GenericButtonSettings.Styles.FlatButton then + f28_local1 = f28_arg1.substyle or GenericButtonSettings.Styles.FlatButton.SubStyles.Default + elseif f28_local2 == GenericButtonSettings.Styles.GlassButton then + f28_local1 = f28_arg1.substyle or GenericButtonSettings.Styles.GlassButton.SubStyles.Default + end + if not f28_local1 then + f28_local1 = {} + end + local f28_local12 = { + style = f28_local2, + substyle = f28_local1, + itemProps = f28_arg1 + } + local f28_local13 = LUI.UIButton.new + local self = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + top = 0, + bottom = f0_local0( "height", f28_local12 ) + } + local f28_local15 + if f28_local2 == GenericButtonSettings.Styles.GradientButton then + f28_local15 = -f0_local0( "focus_animation_distance", f28_local12 ) + if not f28_local15 then + + else + self.right = f28_local15 + self.left = 0 + f28_local13 = f28_local13( self ) + f28_local13.id = "UIGenericButton" + f28_local13.properties = f28_local13.properties or {} + self = LUI.UIElement.new() + self.id = "button" + f28_local13:addElement( self ) + f28_local15 = not f0_local0( "disable_height_guard", f28_local12 ) + if f28_local11 then + local f28_local16 = self + local f28_local17 = self.registerAnimationState + local f28_local18 = "default" + local f28_local19 = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = not f28_local15, + top = 0 + } + local f28_local20 + if f28_local15 then + f28_local20 = f0_local0( "height", f28_local12 ) + if not f28_local20 then + + else + f28_local19.bottom = f28_local20 + f28_local19.left = -f0_local0( "lt_cap_width", f28_local12 ) - f0_local0( "rt_cap_width", f28_local12 ) + f28_local19.right = 0 + f28_local17( f28_local16, f28_local18, f28_local19 ) + f28_local16 = self + f28_local17 = self.registerAnimationState + f28_local18 = "ready" + f28_local19 = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = not f28_local15, + left = 0, + right = 0, + top = 0 + } + if f28_local15 then + f28_local20 = f0_local0( "height", f28_local12 ) + if not f28_local20 then + + else + f28_local19.bottom = f28_local20 + f28_local17( f28_local16, f28_local18, f28_local19 ) + f28_local16 = MBh.AnimateSequence( { + { + "default", + 0, + false, + false + }, + { + "ready", + f0_local0( "slide_in_min_duration", f28_local12 ) + f0_local0( "slide_in_duration_step", f28_local12 ) * f28_arg2, + false, + true + } + } ) + f28_local16( self, {} ) + if f28_arg2 == 1 then + Engine.PlaySound( CoD.SFX.ChangeScreen ) + end + end + end + f28_local20 = 0 + end + end + f28_local20 = 0 + else + local f28_local16 = self + local f28_local17 = self.registerAnimationState + local f28_local18 = "default" + local f28_local19 = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = not f28_local15, + left = 0, + right = 0, + top = 0 + } + local f28_local20 + if f28_local15 then + f28_local20 = f0_local0( "height", f28_local12 ) + if not f28_local20 then + + else + f28_local19.bottom = f28_local20 + f28_local17( f28_local16, f28_local18, f28_local19 ) + self:animateToState( "default" ) + end + end + f28_local20 = 0 + end + self.background = CreateGenericButtonBackground( f28_local2, f28_local1, f28_arg1, f28_local5, f28_local6, f28_local9, f28_local12 ) + self:addElement( self.background ) + self:registerEventHandler( "refresh_button_background", function ( element, event ) + element.background:close() + element.background = CreateGenericButtonBackground( f28_local2, f28_local1, f28_arg1, f28_local5, f28_local6, f28_local9, f28_local12 ) + self:addElement( self.background ) + end ) + local f28_local17 = { + yOffset = f0_local0( "y_offset", f28_local12 ), + text_focus_color = f0_local0( "text_focus_color", f28_local12 ), + text_lock_color = f0_local0( "text_lock_color", f28_local12 ), + text_default_color = f0_local0( "text_default_color", f28_local12 ), + text_disabled_color = f0_local0( "text_disabled_color", f28_local12 ), + text_over_disabled_color = f0_local0( "text_over_disabled_color", f28_local12 ), + text_over_disabled_pulse_color = f0_local0( "text_over_disabled_pulse_color", f28_local12 ), + overDisabledAnimationDuration = f0_local0( "over_disabled_animation_duration", f28_local12 ) + } + if f28_local10 then + f28_local17.padding = f0_local0( "text_padding_with_content", f28_local12 ) + f28_local17.align = f0_local0( "text_align_with_content", f28_local12 ) + else + f28_local17.padding = f0_local0( "text_padding_without_content", f28_local12 ) + f28_local17.align = f0_local0( "text_align_without_content", f28_local12 ) + end + if f28_local2 == GenericButtonSettings.Styles.FlatButton or f28_local2 == GenericButtonSettings.Styles.GlassButton then + f28_local17.additional_handlers = { + button_lock = function ( f30_arg0, f30_arg1 ) + if not Engine.IsConsoleGame() then + f28_local13.m_ignoreMouseFocus = true + if Engine.IsGamepadEnabled() ~= 1 then + f28_local13:processEvent( { + name = "lose_focus", + immediate = true + } ) + f28_local13.m_ignoreMouseFocus = true + f28_local13.m_mouseOver = nil + end + end + f30_arg0:animateToState( "locked" ) + end, + button_unlock = function ( f31_arg0, f31_arg1 ) + if not f31_arg1.graphicsOnly then + f31_arg0:animateToState( "default" ) + if not Engine.IsConsoleGame() then + f28_local13.m_ignoreMouseFocus = false + if Engine.IsGamepadEnabled() ~= 1 then + f28_local13.m_focusable = true + end + end + f28_local13:processEvent( { + name = "button_up", + immediate = true, + dispatchChildren = true + } ) + end + end + } + end + f28_local13.textLabel = f0_local1( f28_local17, f28_arg1.button_text ) + f28_local13.setText = UpdateButtonText + self:addElement( f28_local13.textLabel ) + if f28_local10 then + local f28_local16 = {} + local f28_local18 + if not f28_local8 then + f28_local18 = not f28_local9 + else + f28_local18 = false + end + f28_local16.useText = f28_local18 + f28_local16.useInput = f28_local9 + f28_local16.field_edited_func = f0_local0( "field_edited_func", f28_local12 ) + f28_local16.max_length = f0_local0( "max_length", f28_local12 ) + f28_local16.password_field = f0_local0( "password_field", f28_local12 ) + f28_local16.filter_profanity = f0_local0( "filter_profanity", f28_local12 ) + f28_local16.keyboard_type = f0_local0( "keyboard_type", f28_local12 ) + f28_local16.field_name = f0_local0( "field_name", f28_local12 ) + f28_local16.text_alignment = f0_local0( "text_alignment", f28_local12 ) + f28_local16.useBackground = not f28_local6 + if not f28_local6 then + f28_local18 = not f28_local9 + else + f28_local18 = false + end + f28_local16.useArrows = f28_local18 + f28_local16.arrowsMargin = f0_local0( "content_arrows_margin", f28_local12 ) + f28_local16.useSlider = f28_local8 + f28_local16.sliderWidth = f0_local0( "content_slider_width", f28_local12 ) + f28_local16.sliderHeight = f0_local0( "content_slider_height", f28_local12 ) + f28_local16.margin = f0_local0( "content_margin", f28_local12 ) + f28_local16.width = f0_local0( "content_width", f28_local12 ) + f28_local16.yOffset = f0_local0( "y_offset", f28_local12 ) + f28_local16.backgroundMarginTop = f0_local0( "content_background_margin_top", f28_local12 ) + f28_local16.backgroundMarginBottom = f0_local0( "content_background_margin_bottom", f28_local12 ) + f28_local16.labelAlign = f0_local0( "label_align", f28_local12 ) + f28_local16.text_focus_color = f0_local0( "text_focus_color", f28_local12 ) + f28_local16.content_default_color = f0_local0( "content_default_color", f28_local12 ) + f28_local16.content_lock_color = f0_local0( "content_lock_color", f28_local12 ) + f28_local16.content_focus_color = f0_local0( "content_focus_color", f28_local12 ) + f28_local16.content_focus_color_without_bg = f0_local0( "content_focus_color_without_bg", f28_local12 ) + f28_local16.text_disabled_color = f0_local0( "text_disabled_color", f28_local12 ) + f28_local16.text_over_disabled_color = f0_local0( "text_over_disabled_color", f28_local12 ) + f28_local16.text_over_disabled_pulse_color = f0_local0( "text_over_disabled_pulse_color", f28_local12 ) + self:addElement( f0_local3( f28_local16, f28_arg1 ) ) + elseif f28_local4 then + self:addElement( f0_local4( { + checkboxMargin = f0_local0( "checkbox_margin", f28_local12 ), + yOffset = f0_local0( "y_offset", f28_local12 ) + }, f28_arg1 ) ) + end + if Engine.InFrontend() then + local f28_local16 = f0_local0( "newIconSize", f28_local12 ) + local f28_local20 = LUI.UIImage.new( { + material = RegisterMaterial( "icon_new_2" ), + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = f0_local0( "y_offset", f28_local12 ) - f28_local16 / 2, + height = f28_local16, + left = f0_local0( "newIconIndent", f28_local12 ), + width = f28_local16, + alpha = 0 + } ) + f28_local20.id = "newIcon" + f28_local20:registerAnimationState( "visible", { + alpha = 1 + } ) + f28_local20:registerAnimationState( "darker", { + alpha = 0.5 + } ) + f28_local20:registerEventHandler( "show_new_icon", MBh.AnimateToState( "visible" ) ) + f28_local20:registerEventHandler( "hide_new_icon", MBh.AnimateToState( "default", 50 ) ) + f28_local20:registerEventHandler( "flash_new_icon", MBh.AnimateLoop( { + { + "visible", + 0 + }, + { + "darker", + 300 + }, + { + "visible", + 300 + } + } ) ) + self:addElement( f28_local20 ) + end + f28_local13.properties.desc_text = f28_arg1.desc_text + f28_local13.properties.button_over_func = f28_arg1.button_over_func + f28_local13:registerEventHandler( "button_over", function ( element, event ) + UpdateDescText( element, event ) + if element.properties.button_over_func then + element.properties:button_over_func( event ) + end + if f28_local10 and not f28_local6 then + element:processEvent( { + name = "show_arrows" + } ) + end + end ) + f28_local13.properties.button_up_func = f28_arg1.button_up_func + f28_local13:registerEventHandler( "button_up", function ( element, event ) + if element.properties.button_up_func then + element.properties:button_up_func( event ) + end + if f28_local10 and not f28_local6 then + element:processEvent( { + name = "hide_arrows" + } ) + end + end ) + f28_local13.properties.button_action_func = f28_arg1.button_action_func + f28_local13:registerEventHandler( "button_action", function ( element, event ) + if f28_local4 then + element:processEvent( { + name = "toggle_checked" + } ) + end + if f28_local9 and not event.mouse then + element:dispatchEventToChildren( event ) + end + if element.properties.button_action_func then + element.properties:button_action_func( event ) + if f28_local2 == GenericButtonSettings.Styles.FlatButton and f0_local0( "use_locking", f28_local12 ) then + element:processEvent( { + name = "button_lock", + dispatchChildren = true + } ) + end + end + end ) + if f28_arg1.button_disable_func then + f28_local13.properties.button_disable_func = f28_arg1.button_disable_func + f28_local13:registerEventHandler( "button_disable", function ( element, event ) + if element.properties.button_disable_func then + element.properties:button_disable_func( event ) + end + end ) + end + if f28_arg1.button_action_disable_func then + f28_local13.properties.button_action_disable_func = f28_arg1.button_action_disable_func + f28_local13:registerEventHandler( "button_action_disable", function ( element, event ) + if element.properties.button_action_disable_func then + element.properties:button_action_disable_func( event ) + end + end ) + end + f28_local13.properties.button_over_disable_func = f28_arg1.button_over_disable_func + f28_local13:registerEventHandler( "button_over_disable", function ( element, event ) + UpdateDescText( element, event ) + if element.properties.button_over_disable_func then + element.properties:button_over_disable_func( event ) + end + if f28_local10 and not f28_local6 then + element:processEvent( { + name = "hide_arrows" + } ) + end + end ) + if f28_local2 == GenericButtonSettings.Styles.FlatButton and f0_local0( "use_locking", f28_local12 ) then + f28_local13:registerEventHandler( "restore_focus", function ( element, event ) + element:processEvent( { + name = "button_unlock", + dispatchChildren = true + } ) + return LUI.UIElement.restoreFocus( element, event ) + end ) + end + if f28_arg1.additional_children_func then + assert( type( f28_arg1.additional_children_func ) == "function" ) + local f28_local16 = f28_arg1:additional_children_func() + assert( istable( f28_local16 ) ) + for f28_local21, f28_local22 in ipairs( f28_local16 ) do + assert( istable( f28_local22 ) ) + LUI.MenuBuilder.BuildAddChild( self, f28_local22 ) + end + end + return f28_local13 + end + end + f28_local15 = 0 +end + +LUI.MenuBuilder.registerType( "UIGenericButton", LUI.UIGenericButton.new ) +LockTable( _M ) diff --git a/lui/menugenerics.dec.lua b/lui/menugenerics.dec.lua new file mode 100644 index 0000000..bfa089e --- /dev/null +++ b/lui/menugenerics.dec.lua @@ -0,0 +1,2341 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( "Registering " .. _NAME ) +if Engine.InFrontend() then + function InputFieldOpensVirtualKeyboard( f1_arg0 ) + return Engine.IsConsoleGame() or f1_arg0 + end + + function InputFieldAction( f2_arg0, f2_arg1 ) + local f2_local0 = Engine.GetDvarString( f2_arg0.properties.dvar_hook ) + local f2_local1 + if not Engine.IsConsoleGame() and not f2_arg1.mouse then + f2_local1 = not f2_arg1.keyboard + else + f2_local1 = false + end + f2_arg0.properties.isPCGamepad = f2_local1 + if InputFieldOpensVirtualKeyboard( f2_local1 ) then + f2_arg0.properties.active = true + local f2_local2 = Engine.OpenScreenKeyboard + local f2_local3 = f2_arg1.controller + if not f2_local3 then + f2_local3 = Engine.GetFirstActiveController() + end + local f2_local4 = f2_arg0.properties.field_name + if f2_local0 then + local f2_local5 = f2_local0 + end + f2_local2( f2_local3, f2_local4, f2_local5 or "", f2_arg0.properties.max_length, f2_arg0.properties.verify_string, f2_arg0.properties.filter_profanity, f2_arg0.properties.keyboard_type ) + elseif f2_arg0.properties.active then + f2_arg0:processEvent( { + name = "finish_editing" + } ) + f2_arg0.properties.active = false + else + local f2_local2 = f2_arg0:getChildById( "input_text" ) + f2_local2:setTextEditActive() + f2_arg0.properties.active = true + end + end + + function InputFieldUpdateText( f3_arg0, f3_arg1 ) + if f3_arg1.text then + local f3_local0 = f3_arg0.properties.password_field and string.rep( "*", #f3_arg1.text ) or f3_arg1.text + local f3_local1 = f3_arg0:getChildById( "input_text" ) + f3_local1:setTextEditText( f3_local0 ) + Engine.SetDvarString( f3_arg0.properties.dvar_hook, f3_arg1.text ) + end + end + + function InitField( f4_arg0, f4_arg1 ) + f4_arg0:setTextEditText( f4_arg0.properties.text ) + local f4_local0 = Engine.GetDvarString( f4_arg0.properties.dvar_hook ) + if f4_local0 ~= nil and f4_local0 ~= "" then + f4_arg0:setTextEditText( f4_arg0.properties.password_field and string.rep( "*", #f4_local0 ) or f4_local0 ) + end + end + + function DefaultFieldEditedAction() + + end + + function generic_input_field() + return { + type = "UIButton", + id = "generic_input_field_id", + focusable = true, + properties = { + help_value = "Placeholder field help", + field_name = "Placeholder Field name", + dvar_hook = "override_this_with_a_DVarString_name", + max_length = 16, + password_field = false, + use_auto_align = false, + active = false, + isPCGamepad = false, + field_edited_func = DefaultFieldEditedAction, + verify_string = false, + filter_profanity = false, + keyboard_type = CoD.KeyboardInputTypes.Normal, + text_alignment = LUI.Alignment.Left + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = GenericButtonDims.button_height, + alpha = 0.5 + }, + over = { + alpha = 1 + } + }, + handlers = { + button_over = MBh.AnimateToState( "over", 0 ), + button_up = MBh.AnimateToState( "default", 0 ), + button_action = InputFieldAction, + text_edit_complete = function ( f7_arg0, f7_arg1 ) + if not InputFieldOpensVirtualKeyboard( f7_arg0.properties.isPCGamepad ) and f7_arg0.properties.active then + f7_arg1.text = f7_arg0.properties:field_edited_func( f7_arg1 ) or f7_arg1.text + InputFieldUpdateText( f7_arg0, f7_arg1 ) + end + end + , + text_input_complete = function ( f8_arg0, f8_arg1 ) + if InputFieldOpensVirtualKeyboard( f8_arg0.properties.isPCGamepad ) and f8_arg0.properties.active then + f8_arg1.text = f8_arg0.properties:field_edited_func( f8_arg1 ) or f8_arg1.text + InputFieldUpdateText( f8_arg0, f8_arg1 ) + f8_arg0.properties.active = false + end + end + , + edit_unfocus = function ( f9_arg0, f9_arg1 ) + if not InputFieldOpensVirtualKeyboard( f9_arg0.properties.isPCGamepad ) and f9_arg0.properties.active then + f9_arg0:processEvent( { + name = "finish_editing" + } ) + f9_arg0.properties.active = false + end + end + + }, + children = { + { + type = "UITextEdit", + id = "input_text", + properties = { + text = MBh.Property( "help_value" ), + max_length = MBh.Property( "max_length" ), + dvar_hook = MBh.Property( "dvar_hook" ), + password_field = MBh.Property( "password_field" ), + use_auto_align = MBh.Property( "use_auto_align" ), + text_alignment = MBh.Property( "text_alignment" ) + }, + handlers = { + menu_create = InitField, + finish_editing = function ( f10_arg0, f10_arg1 ) + f10_arg0:setTextEditActive( false ) + end + , + colorize = function ( f11_arg0, f11_arg1 ) + f11_arg0:registerAnimationState( "colorized", { + red = f11_arg1.red, + green = f11_arg1.green, + blue = f11_arg1.blue + } ) + f11_arg0:animateToState( "colorized" ) + end + + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = CoD.TextSettings.SmallFont.Height, + font = CoD.TextSettings.SmallFont.Font, + alignment = MBh.Property( "text_alignment" ) + } + } + } + } + } + end + + function AutoUpdateDescText( f12_arg0, f12_arg1 ) + if f12_arg0.properties.desc_text then + local f12_local0 = "" + if type( f12_arg0.properties.desc_text ) == "string" then + f12_local0 = f12_arg0.properties.desc_text + elseif type( f12_arg0.properties.desc_text ) == "function" then + f12_local0 = f12_arg0.properties:desc_text( f12_arg1 ) + assert( type( f12_local0 ) == "string" ) + end + f12_arg0:dispatchEventToRoot( { + name = "set_button_info_text", + text = f12_local0, + [1] = immediate + } ) + end + end + +end +function generic_back_button() + local self = LUI.UIBindButton.new() + self.id = "generic_back_button" + self:registerEventHandler( "button_secondary", MBh.LeaveMenu() ) + return self +end + +f0_local0 = function ( f14_arg0, f14_arg1 ) + if f14_arg1.string then + f14_arg0:setText( f14_arg1.string ) + end +end + +function HandleMenuTitleShow( f15_arg0, f15_arg1 ) + local f15_local0 = f15_arg1.preAnimTime or 0 + local f15_local1 = f15_arg1.animTime or 0 + if f15_arg0.properties.isHidden then + local f15_local2 = MBh.AnimateSequence( { + { + "hidden", + f15_local0 + }, + { + "shown", + f15_local1 + } + } ) + f15_local2( f15_arg0 ) + f15_arg0.properties.isHidden = false + end +end + +function HandleMenuTitleHide( f16_arg0, f16_arg1 ) + local f16_local0 = f16_arg1.preAnimTime or 0 + local f16_local1 = f16_arg1.animTime or 0 + if not f16_arg0.properties.isHidden then + local f16_local2 = MBh.AnimateSequence( { + { + "shown", + f16_local0 + }, + { + "hidden", + f16_local1 + } + } ) + f16_local2( f16_arg0 ) + f16_arg0.properties.isHidden = true + end +end + +function generic_menu_title( f17_arg0, f17_arg1 ) + local f17_local0 = 100 + local f17_local1 = 52 + if not f17_arg1 then + f17_arg1 = {} + end + local self = LUI.UIElement.new() + self.id = "generic_menu_title_container_id" + self:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 128 + } ) + self:registerAnimationState( "hidden", { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = -128, + bottom = 0 + } ) + self:animateToState( "default" ) + local f17_local3 = LUI.UIImage.new( { + leftAnchor = true, + topAnchor = true, + rightAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + bottom = 0, + height = 300, + red = 0, + green = 0, + blue = 0, + alpha = 1, + material = RegisterMaterial( "white" ) + } ) + f17_local3.id = "black_bar" + f17_local3:setPriority( 10 ) + self:addElement( f17_local3 ) + local f17_local4 = LUI.UIImage.new() + f17_local4.id = "generic_menu_title_background_id" + f17_local4:registerAnimationState( "default", { + material = RegisterMaterial( "bkgd_title_bar" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -10, + bottom = 118, + left = 0, + right = 0, + alpha = 0.75 + } ) + f17_local4:animateToState( "default" ) + self:addElement( f17_local4 ) + if Engine.IsAliensMode() then + local f17_local5 = LUI.UIImage.new() + f17_local5.id = "generic_menu_title_flare_id" + f17_local5:registerAnimationState( "default", { + material = RegisterMaterial( "box_alien_header_footer" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 72, + bottom = 102, + left = 0, + right = 0, + alpha = 1 + } ) + f17_local5:animateToState( "default" ) + self:addElement( f17_local5 ) + end + local f17_local5 = LUI.UIElement.new() + f17_local5.id = "generic_menu_title_id" + f17_local5.properties = { + isHidden = false + } + f17_local5:registerAnimationState( "default", { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = f17_local1, + bottom = f17_local1 + CoD.TextSettings.ExtraBigFont.Height, + left = f17_local0, + right = 1280 - f17_local0 + } ) + f17_local5:registerAnimationState( "hidden", { + alpha = 0 + } ) + f17_local5:registerAnimationState( "shown", { + alpha = 1 + } ) + f17_local5:animateToState( "default" ) + f17_local5:registerEventHandler( "menu_title_show", HandleMenuTitleShow ) + f17_local5:registerEventHandler( "menu_title_hide", HandleMenuTitleHide ) + self:addElement( f17_local5 ) + local f17_local6 = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 16, + right = 530, + top = 0, + bottom = CoD.TextSettings.ExtraBigFont.Height, + font = CoD.TextSettings.ExtraBigFont.Font, + alignment = LUI.Alignment.Left + } + local f17_local7 = LUI.UIMarqueeText.new( f17_local6 ) + f17_local7.id = "header_text" + f17_local7:setText( f17_arg1.menu_title or "TITLE" ) + f17_local7:registerAnimationState( "default", f17_local6 ) + f17_local7:registerEventHandler( "update_header_text", f0_local0 ) + f17_local7:animateToState( "default" ) + f17_local5:addElement( f17_local7 ) + local f17_local8 = LUI.UIImage.new() + f17_local8.id = "header_left_box" + f17_local8:registerAnimationState( "default", CoD.ColorizeState( Engine.IsAliensMode() and Colors.alien_frontend_hilite or Colors.frontend_hilite, { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 6, + top = 5, + bottom = 22, + material = RegisterMaterial( "white" ) + } ) ) + f17_local8:animateToState( "default" ) + f17_local5:addElement( f17_local8 ) + if IsPublicMatch and IsPublicMatch() and not f17_arg1.disableLobbyStatus and package.loaded["LUI.mp_menus.mpLobbyWidgets"] and LUI.mp_menus.mpLobbyWidgets.lobby_status then + self:addElement( LUI.mp_menus.mpLobbyWidgets.lobby_status( {}, {} ) ) + end + local f17_local9 = MLG + if f17_local9 then + f17_local9 = MLG.IsFeatureAvailable + if f17_local9 then + f17_local9 = MLG.IsFeatureAvailable() + end + end + if not f17_arg1.disableMLGRulesVersionNumber and Engine.InFrontend() and f17_local9 then + local f17_local10 = LUI.UIText.new() + f17_local10.id = "codEsportText" + f17_local10:setText( Engine.Localize( "PATCH_MENU_MLG_RULES_VERSION", MLG.GetRulesVersionNumber() ) ) + f17_local10:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, { + font = CoD.TextSettings.SmallFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + bottom = 0, + right = 0, + height = CoD.TextSettings.SmallFont.Height, + alpha = 0 + } ) ) + f17_local10:registerAnimationState( "visible", { + alpha = 1 + } ) + f17_local10:registerEventHandler( "mlg_disabled", MBh.AnimateToState( "default" ) ) + f17_local10:registerEventHandler( "mlg_enabled", function ( element, event ) + element:setText( Engine.Localize( "PATCH_MENU_MLG_RULES_VERSION", MLG.GetRulesVersionNumber() ) ) + element:animateToState( "visible", 0 ) + end ) + f17_local10:registerEventHandler( "menu_create", function ( element, event ) + if MLG.AreMLGRulesEnabled() then + element:processEvent( { + name = "mlg_enabled" + } ) + else + element:processEvent( { + name = "mlg_disabled" + } ) + end + end ) + f17_local10:animateToState( "default" ) + f17_local5:addElement( f17_local10 ) + end + return self +end + +function left_header() + local f20_local0 = 35 + return { + type = "UIElement", + id = "left_header_id", + properties = { + text = "Placement Text" + }, + children = { + { + type = "UIText", + id = "header_text", + properties = { + text = MBh.Property( "text" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = -GenericButtonDims.pad_button_width, + top = 0, + bottom = CoD.TextSettings.BigFont.Height, + font = CoD.TextSettings.BigFont.Font, + alignment = LUI.Alignment.Right + } + }, + handlers = { + update_header_text = f0_local0 + } + }, + { + type = "UIImage", + id = "sep_image", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = f20_local0 - GenericButtonDims.button_height / 4, + bottom = f20_local0 + GenericButtonDims.button_height / 4, + material = RegisterMaterial( "navbar_tick" ) + } + } + } + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = 60, + left = 0, + bottom = 60 + f20_local0, + right = 450, + font = CoD.TextSettings.NormalFont.Font + } + } + } +end + +function generic_border( f21_arg0, f21_arg1 ) + local f21_local0 = false + if f21_arg1.inner ~= nil then + f21_local0 = f21_arg1.inner + end + local f21_local1 = f21_arg1.thickness + if not f21_local1 then + f21_local1 = 1 + end + local f21_local2 = f21_arg1.border_red + if not f21_local2 then + f21_local2 = 1 + end + local f21_local3 = f21_arg1.border_green + if not f21_local3 then + f21_local3 = 1 + end + local f21_local4 = f21_arg1.border_blue + if not f21_local4 then + f21_local4 = 1 + end + local f21_local5 = f21_arg1.border_alpha + if not f21_local5 then + f21_local5 = 1 + end + local f21_local6 = f21_arg1.hide_bottom + if not f21_local6 then + f21_local6 = false + end + local self = LUI.UIElement.new() + local f21_local8 = self + local f21_local9 = self.registerAnimationState + local f21_local10 = "default" + local f21_local11 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true + } + if f21_local0 then + local f21_local12 = f21_local1 + end + f21_local11.top = f21_local12 or 0 + local f21_local13 + if f21_local0 then + f21_local13 = -f21_local1 + if not f21_local13 then + + else + f21_local11.bottom = f21_local13 + if f21_local0 then + local f21_local14 = f21_local1 + end + f21_local11.left = f21_local14 or 0 + if f21_local0 then + f21_local13 = -f21_local1 + if not f21_local13 then + + else + f21_local11.right = f21_local13 + f21_local9( f21_local8, f21_local10, f21_local11 ) + self:animateToState( "default" ) + f21_local9 = LUI.UIImage.new() + f21_local9.id = "top" + f21_local9:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -f21_local1, + bottom = 0, + left = 0, + right = 0 + } ) + f21_local9:animateToState( "default" ) + self:addElement( f21_local9 ) + f21_local8 = nil + if not f21_local6 then + f21_local8 = LUI.UIImage.new() + f21_local8.id = "bottom" + f21_local8:registerAnimationState( "default", { + material = RegisterMaterial( "white" ), + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = f21_local1 or 0, + left = 0, + right = 0 + } ) + f21_local8:animateToState( "default" ) + self:addElement( f21_local8 ) + end + f21_local10 = LUI.UIImage.new() + f21_local10.id = "left" + f21_local13 = f21_local10 + f21_local11 = f21_local10.registerAnimationState + local f21_local15 = "default" + local f21_local16 = { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -f21_local1 + } + if not f21_local6 then + local f21_local17 = f21_local1 + end + f21_local16.bottom = f21_local17 or 0 + f21_local16.left = -f21_local1 + f21_local16.right = 0 + f21_local11( f21_local13, f21_local15, f21_local16 ) + f21_local10:animateToState( "default" ) + self:addElement( f21_local10 ) + f21_local11 = LUI.UIImage.new() + f21_local11.id = "right" + f21_local15 = f21_local11 + f21_local13 = f21_local11.registerAnimationState + f21_local16 = "default" + local f21_local18 = { + material = RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = -f21_local1 + } + if not f21_local6 then + local f21_local19 = f21_local1 + end + f21_local18.bottom = f21_local19 or 0 + f21_local18.left = 0 + f21_local18.right = f21_local1 + f21_local13( f21_local15, f21_local16, f21_local18 ) + f21_local11:animateToState( "default" ) + self:addElement( f21_local11 ) + self.colorize = function ( f22_arg0, f22_arg1, f22_arg2, f22_arg3 ) + for f22_local3, f22_local4 in ipairs( { + f21_local9, + f21_local11, + f21_local10, + f21_local8 + } ) do + f22_local4:registerAnimationState( "current", { + red = f22_arg0, + green = f22_arg1, + blue = f22_arg2, + alpha = f22_arg3 + } ) + f22_local4:animateToState( "current" ) + end + end + + self.colorize( f21_local2, f21_local3, f21_local4, f21_local5 ) + self:registerEventHandler( "updateBorderColor", function ( element, event ) + element.colorize( event.red, event.green, event.blue, event.alpha ) + end ) + return self + end + end + f21_local13 = 0 + end + end + f21_local13 = 0 +end + +function generic_drop_shadow( f24_arg0, f24_arg1 ) + local f24_local0 = f24_arg1.alpha or 0.75 + local f24_local1 = f24_arg1.offset_shadow or -8 + local self = LUI.UIElement.new() + self.id = "generic_drop_shadow" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alpha = f24_local0 + } ) + self:animateToState( "default" ) + local f24_local3 = LUI.UIElement.new() + f24_local3.id = "container" + f24_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = f24_local1, + left = 0, + right = f24_local1 + } ) + f24_local3:animateToState( "default" ) + local f24_local4 = LUI.UIImage.new() + f24_local4:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = -12, + bottom = 20, + left = 0, + right = 32, + material = RegisterMaterial( "box_dropshadow_ltcap" ) + } ) + f24_local4:animateToState( "default" ) + f24_local3:addElement( f24_local4 ) + local f24_local5 = LUI.UIImage.new() + f24_local5:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -12, + bottom = 20, + left = 32, + right = -11, + material = RegisterMaterial( "box_dropshadow_hori_spacer" ) + } ) + f24_local5:animateToState( "default" ) + f24_local3:addElement( f24_local5 ) + local f24_local6 = LUI.UIImage.new() + f24_local6:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = -12, + bottom = 20, + left = -11, + right = 21, + material = RegisterMaterial( "box_dropshadow_midcap" ) + } ) + f24_local6:animateToState( "default" ) + f24_local3:addElement( f24_local6 ) + local f24_local7 = LUI.UIImage.new() + f24_local7:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 32, + bottom = -12, + left = -11, + right = 21, + material = RegisterMaterial( "box_dropshadow_vert_spacer" ) + } ) + f24_local7:animateToState( "default" ) + f24_local3:addElement( f24_local7 ) + local f24_local8 = LUI.UIImage.new() + f24_local8:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 32, + left = -11, + right = 21, + material = RegisterMaterial( "box_dropshadow_rtcap" ) + } ) + f24_local8:animateToState( "default" ) + f24_local3:addElement( f24_local8 ) + self:addElement( f24_local3 ) + return self +end + +function generic_drop_shadow_withfade( f25_arg0, f25_arg1 ) + local f25_local0 = f25_arg1.alpha or 0.75 + local f25_local1 = f25_arg1.fade_height or 150 + local f25_local2 = f25_arg1.top_offset or 0 + local self = LUI.UIElement.new() + self.id = "generic_drop_shadow_withfade" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = f25_local2, + bottom = 0, + left = 0, + right = 0, + alpha = f25_local0 + } ) + self:animateToState( "default" ) + local f25_local4 = LUI.UIImage.new() + f25_local4:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 32, + left = -11, + right = 21, + material = RegisterMaterial( "box_dropshadow_rtcap" ) + } ) + f25_local4:animateToState( "default" ) + self:addElement( f25_local4 ) + local f25_local5 = LUI.UIImage.new() + f25_local5:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 32, + bottom = -f25_local1, + left = -11, + right = 21, + material = RegisterMaterial( "box_dropshadow_vert_spacer" ) + } ) + f25_local5:animateToState( "default" ) + self:addElement( f25_local5 ) + local f25_local6 = LUI.UIImage.new() + f25_local6:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = -f25_local1, + bottom = 0, + left = -11, + right = 21, + material = RegisterMaterial( "box_dropshadow_vert_footer" ) + } ) + f25_local6:animateToState( "default" ) + self:addElement( f25_local6 ) + return self +end + +function generic_popup_message() + return { + type = "UIElement", + id = "generic_test_id", + properties = { + message_text = "message text" + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + material = RegisterMaterial( "white" ), + red = 0.1, + green = 0.14, + blue = 0.16, + alpha = 0.85 + } + } + }, + { + type = "UIElement", + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + top = -75, + left = -200, + right = 200, + height = 85 + } + }, + children = { + { + type = "live_dialog_popup_background" + }, + { + type = "UIText", + properties = { + text = MBh.Property( "message_text" ) + }, + states = { + default = { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Center, + red = Colors.secondary_text_color.r, + green = Colors.secondary_text_color.g, + blue = Colors.secondary_text_color.b + } + } + } + } + } + } + } +end + +f0_local1 = function () + return { + type = "UIElement", + id = "spacer", + states = { + default = { + leftAnchor = true, + rightAnchor = true, + topAnchor = true, + bottomAnchor = false, + left = 0, + right = 0, + top = 0, + bottom = 12 + } + } + } +end + +f0_local2 = function ( f28_arg0, f28_arg1 ) + f28_arg0:setText( f28_arg1.message_text ) + f28_arg0:dispatchEventToRoot( { + name = "resize_popup" + } ) +end + +function generic_confirmation_popup() + return { + type = "generic_selectionList_popup", + id = "confirmation_popup_id", + properties = { + message_text_alignment = LUI.Alignment.Center, + popup_title = "", + message_text = "", + button_text = Engine.Localize( "@MENU_EXIT" ), + confirmation_action = function ( f30_arg0, f30_arg1 ) + DebugPrint( "Running generic_confirmation_popup default action" ) + end + , + callback_params = {}, + padding_top = 12, + cancel_will_close = true, + popup_childfeeder = function () + return { + { + type = "UIText", + id = "message_text_id", + properties = { + text = MBh.Property( "message_text" ), + message_text_alignment = MBh.Property( "message_text_alignment" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + left = 12, + right = -12, + alignment = MBh.Property( "message_text_alignment" ), + font = CoD.TextSettings.NormalFont.Font, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + }, + handlers = { + update_message = f0_local2 + } + }, + f0_local1(), + { + type = "UIGenericButton", + id = "exit_button_id", + properties = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup, + text = MBh.Property( "button_text" ), + confirmation_action = MBh.Property( "confirmation_action" ), + button_action_func = function ( f32_arg0, f32_arg1 ) + f32_arg0.properties:confirmation_action( f32_arg1 ) + LUI.FlowManager.RequestLeaveMenu( f32_arg0 ) + end + , + callback_params = MBh.Property( "callback_params" ) + } + } + } + end + + }, + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + } + } +end + +function CreatePurchasePopupRow( f33_arg0, f33_arg1, f33_arg2, f33_arg3, f33_arg4 ) + local f33_local0 = 15 + local f33_local1 = 16 + return { + type = "UIHorizontalList", + id = "yesno_message_" .. f33_arg0 .. "_hl_id", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 12 + f33_arg1, + right = -32, + height = CoD.TextSettings.NormalFont.Height + } + }, + children = { + { + type = "UIText", + id = "yesno_message_" .. f33_arg0 .. "_text_id", + properties = { + text = MBh.Property( f33_arg2 ) + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + right = -(f33_local1 + 32 + f33_local0), + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Right, + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + }, + { + type = "UIElement", + id = "yesno_message_" .. f33_arg0 .. "_spacer", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = false, + top = 0, + left = 0, + width = f33_local0 + } + } + }, + { + type = "UIImage", + id = "yesno_message_" .. f33_arg0 .. "_image_id", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -f33_local1 * 0.5, + left = -f33_local1 * 0.5, + bottom = f33_local1 * 0.5, + right = f33_local1 * 0.5, + material = f33_arg3 + } + } + }, + { + type = "UIText", + id = "yesno_message_" .. f33_arg0 .. "_id", + properties = { + text = MBh.Property( f33_arg4 ) + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + right = -12, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + red = Colors.white.r, + green = Colors.white.g, + blue = Colors.white.b + } + } + } + } + } +end + +function YesNoFeeder( f34_arg0 ) + local f34_local0 = {} + if not f34_arg0.message_image then + f34_local0[#f34_local0 + 1] = { + type = "UIText", + id = "yesno_message_text_id", + properties = { + text = MBh.Property( "message_text" ), + message_text_alignment = MBh.Property( "message_text_alignment" ) + }, + states = { + default = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = CoD.TextSettings.NormalFont.Height, + left = 12, + right = -12, + font = CoD.TextSettings.NormalFont.Font, + alignment = MBh.Property( "message_text_alignment" ), + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + }, + handlers = { + update_message = f0_local2 + } + } + else + f34_local0[#f34_local0 + 1] = { + type = "UIElement", + id = "yesno_message_container_id", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 12, + right = -12, + height = 0 + } + }, + children = { + { + type = "UIImage", + id = "yesno_message_image_id", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = f34_arg0.message_image_top, + left = f34_arg0.message_image_left, + height = f34_arg0.message_image_height, + width = f34_arg0.message_image_width, + material = f34_arg0.message_image + } + } + } + } + } + if f34_arg0.message_text then + f34_local0[#f34_local0 + 1] = { + type = "UIText", + id = "yesno_message_text_id", + properties = { + text = MBh.Property( "message_text" ), + message_text_alignment = MBh.Property( "message_text_alignment" ) + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 12 + f34_arg0.message_image_width + 20, + right = -12, + height = CoD.TextSettings.NormalFont.Height, + font = CoD.TextSettings.NormalFont.Font, + alignment = MBh.Property( "message_text_alignment" ), + red = Colors.primary_text_color.r, + green = Colors.primary_text_color.g, + blue = Colors.primary_text_color.b + } + } + } + else + if f34_arg0.message_required_rank_image then + f34_local0[#f34_local0 + 1] = CreatePurchasePopupRow( "required_rank", f34_arg0.message_image_width, "message_required_rank_text", f34_arg0.message_required_rank_image, "message_required_rank" ) + f34_local0[#f34_local0 + 1] = CreatePurchasePopupRow( "current_rank", f34_arg0.message_image_width, "message_current_rank_text", f34_arg0.message_current_rank_image, "message_current_rank" ) + f34_local0[#f34_local0 + 1] = { + type = "UIElement", + id = "yesno_message_separator_container_id", + states = { + default = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 0, + right = 0, + height = 5, + width = 300 + } + }, + children = { + { + type = "UIImage", + id = "yesno_message_separator_image_id", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 2, + left = 0, + height = 1, + material = RegisterMaterial( "white" ), + alpha = 0.1 + } + } + } + } + } + end + if f34_arg0.message_cost_image then + f34_local0[#f34_local0 + 1] = CreatePurchasePopupRow( "cost", f34_arg0.message_image_width, "message_cost_text", f34_arg0.message_cost_image, "message_cost" ) + f34_local0[#f34_local0 + 1] = CreatePurchasePopupRow( "squad_points", f34_arg0.message_image_width, "message_squad_points_text", f34_arg0.message_squad_points_image, "message_squad_points" ) + end + end + end + f34_local0[#f34_local0 + 1] = f0_local1() + if f34_arg0.yes_text then + local f34_local1 = #f34_local0 + 1 + local f34_local2 = { + type = "UIGenericButton", + id = "yes_button_id", + audio = { + button_over = CoD.SFX.SubMenuMouseOver + } + } + local f34_local3 = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.YesNoPopup, + text = MBh.Property( "yes_text" ), + action = MBh.Property( "yes_action" ) + } + local f34_local4 = MBh.DoMultiple + local f34_local5 = {} + local f34_local6 = MBh.RunPropertyFunc( "action" ) + local f34_local7 = MBh.LeaveMenu() + f34_local3.button_action_func = f34_local4( f34_local6 ) + f34_local3.callback_params = MBh.Property( "callback_params" ) + f34_local2.properties = f34_local3 + f34_local0[f34_local1] = f34_local2 + end + local f34_local1 = #f34_local0 + 1 + local f34_local2 = { + type = "UIGenericButton", + id = "no_button_id", + audio = { + button_over = CoD.SFX.SubMenuMouseOver + } + } + local f34_local3 = { + style = GenericButtonSettings.Styles.GlassButton, + substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.YesNoPopup, + text = MBh.Property( "no_text" ), + action = MBh.Property( "no_action" ) + } + local f34_local4 = MBh.DoMultiple + local f34_local5 = {} + local f34_local6 = MBh.RunPropertyFunc( "action" ) + local f34_local7 = MBh.LeaveMenu() + f34_local3.button_action_func = f34_local4( f34_local6 ) + f34_local3.callback_params = MBh.Property( "callback_params" ) + f34_local2.properties = f34_local3 + f34_local0[f34_local1] = f34_local2 + if f34_arg0.default_focus_index then + f34_local1 = assert + if f34_arg0.default_focus_index <= 0 or f34_arg0.default_focus_index > #f34_local0 then + f34_local2 = false + else + f34_local2 = true + end + f34_local1( f34_local2 ) + f34_local1 = #f34_local0 - 2 + f34_local0[#f34_local0 - 2 + f34_arg0.default_focus_index].listDefaultFocus = true + end + return f34_local0 +end + +function generic_yesno_popup() + return { + type = "generic_selectionList_popup", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + properties = { + message_text_alignment = LUI.Alignment.Center, + popup_title = "", + message_text = "", + padding_top = 12, + cancel_means_no = true, + yes_action = function ( f36_arg0, f36_arg1 ) + DebugPrint( "Running generic_confirmation_popup yes action" ) + end + , + no_action = function ( f37_arg0, f37_arg1 ) + DebugPrint( "Running generic_confirmation_popup no action" ) + end + , + yes_text = Engine.Localize( "@LUA_MENU_YES" ), + no_text = Engine.Localize( "@LUA_MENU_NO" ), + callback_params = {}, + default_focus_index = 2, + popup_childfeeder = YesNoFeeder + }, + handlers = { + popup_back = function ( f38_arg0, f38_arg1 ) + if f38_arg0.properties.cancel_means_no then + f38_arg0.properties:no_action( f38_arg1 ) + end + end + , + menu_create = function ( f39_arg0, f39_arg1 ) + f39_arg0:clearSavedState() + end + + } + } +end + +function generic_yesno_with_image_popup() + return { + type = "generic_selectionList_popup", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = 0, + bottom = 0 + } + }, + properties = { + message_text_alignment = LUI.Alignment.Left, + popup_title = "", + message_image = nil, + message_text = nil, + message_required_rank_text = nil, + message_required_rank_image = nil, + message_required_rank = nil, + message_current_rank_text = nil, + message_current_rank_image = nil, + message_current_rank = nil, + message_cost_text = nil, + message_cost_image = nil, + message_cost = nil, + message_squad_points_text = nil, + message_squad_points_image = nil, + message_squad_points = nil, + message_image_top = 0, + message_image_left = 5, + message_image_height = 64, + message_image_width = 64, + purchase_cost = 0, + padding_top = 20, + cancel_means_no = true, + yes_action = function ( f41_arg0, f41_arg1 ) + DebugPrint( "Running generic_confirmation_popup yes action" ) + end + , + no_action = function ( f42_arg0, f42_arg1 ) + DebugPrint( "Running generic_confirmation_popup no action" ) + end + , + yes_text = nil, + no_text = nil, + callback_params = {}, + default_focus_index = 2, + popup_childfeeder = YesNoFeeder + }, + handlers = { + popup_back = function ( f43_arg0, f43_arg1 ) + if f43_arg0.properties.cancel_means_no then + f43_arg0.properties:no_action( f43_arg1 ) + end + end + , + menu_create = function ( f44_arg0, f44_arg1 ) + f44_arg0:clearSavedState() + end + + } + } +end + +local f0_local3 = function ( f45_arg0 ) + return { + { + type = "UIGenericButton", + id = "selection_button_confirm", + properties = { + text = Engine.Localize( "@LUA_MENU_YES" ), + button_action_func = function ( f46_arg0, f46_arg1 ) + DebugPrint( "Running generic_selectionList_popup confirm/yes action" ) + LUI.FlowManager.RequestLeaveMenu( f46_arg0 ) + end + + } + }, + { + type = "UIGenericButton", + id = "selection_button_cancel", + properties = { + text = Engine.Localize( "@LUA_MENU_NO" ), + button_action_func = function ( f47_arg0, f47_arg1 ) + DebugPrint( "Running generic_selectionList_popup cancel/no action" ) + LUI.FlowManager.RequestLeaveMenu( f47_arg0 ) + end + + } + } + } +end + +local f0_local4 = function ( f48_arg0, f48_arg1, f48_arg2, f48_arg3, f48_arg4 ) + local f48_local0 = 30 + if f48_arg0:getRect() then + local f48_local1 = f48_arg1:getNumChildren() + local f48_local2 = GenericTitleBarDims.TitleBarHeight + f48_arg3 + f48_arg4 + local f48_local3 = f48_arg1:getFirstChild() + while f48_local3 do + local f48_local4 = nil + if f48_local3.getText and f48_local3:getText() then + local f48_local5 = nil + f48_local5, f48_local4 = f48_local3:getElementTextDims() + else + f48_local4 = f48_local3:getHeight() + end + end + if f48_arg0.animateIn then + f48_arg0:registerAnimationState( "initState", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = -f48_arg2 / 2 - 500, + right = f48_arg2 / 2 - 500, + top = -(f48_local2 / 2 + f48_local0), + bottom = f48_local2 / 2 - f48_local0, + alpha = 0 + } ) + f48_arg0:animateToState( "initState" ) + end + f48_arg0:registerAnimationState( "newState", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = false, + rightAnchor = false, + left = -f48_arg2 / 2, + right = f48_arg2 / 2, + top = -(f48_local2 / 2 + f48_local0), + bottom = f48_local2 / 2 - f48_local0, + alpha = 1 + } ) + if f48_arg0.animateIn then + f48_arg0:animateToState( "newState", 75, false, true ) + f48_arg0.animateIn = false + else + f48_arg0:animateToState( "newState" ) + end + f48_local2 = f48_local2 + f48_local4 + f48_local3 = f48_local3:getNextSibling() + else + f48_arg0:animateToState( "start", 1 ) + end +end + +function generic_selectionList_popup( f49_arg0, f49_arg1 ) + if not f49_arg1 then + f49_arg1 = {} + end + local f49_local0 = f49_arg1.padding_bottom or 8 + local f49_local1 = f49_arg1.padding_right or 5 + local f49_local2 = f49_arg1.padding_left or 5 + local f49_local3 = f49_arg1.padding_top or 5 + local f49_local4 = f49_arg1.popup_title_alignment + if not f49_local4 then + f49_local4 = LUI.Alignment.Center + end + local f49_local5 = f49_arg1.popup_title or "popup_title property" + local f49_local6 + if f49_arg1.cancel_will_close ~= nil then + f49_local6 = f49_arg1.cancel_will_close + else + f49_local6 = true + end + local f49_local7 = CoD.TextSettings.ExtraBigFont + local f49_local8 = f49_arg1.popup_list_spacing or 0 + local f49_local9 = f49_arg1.popup_stop_background_fade_in or false + local f49_local10, f49_local11, f49_local12, f49_local13 = GetTextDimensions( f49_local5, f49_local7.Font, f49_local7.Height ) + local f49_local14 = f49_arg1.popup_width + if not f49_local14 then + f49_local14 = LUI.clamp( f49_local12 - f49_local10 + 60, 430, 1200 ) + end + local self = LUI.UIElement.new() + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f49_local16 = LUI.UIImage.new() + f49_local16.id = "generic_selectionList_background" + local f49_local17 = f49_local16 + local f49_local18 = f49_local16.registerAnimationState + local f49_local19 = "init" + local f49_local20 = CoD.ColorizeState + local f49_local21 = Swatches.Overlay.Color + local f49_local22 = { + material = Engine.IsAliensMode() and RegisterMaterial( "box_alien_color_tint" ) or RegisterMaterial( "white" ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -200, + bottom = 200, + left = 0, + right = 0 + } + local f49_local23 + if f49_local9 then + f49_local23 = Swatches.Overlay.AlphaMore + if not f49_local23 then + + else + f49_local22.alpha = f49_local23 + f49_local18( f49_local17, f49_local19, f49_local20( f49_local21, f49_local22 ) ) + if not f49_local9 then + f49_local16:registerAnimationState( "default", CoD.ColorizeState( Swatches.Overlay.Color, { + alpha = Swatches.Overlay.AlphaMore + } ) ) + end + f49_local16:animateToState( "init" ) + if not f49_local9 then + f49_local16:animateToState( "default", 100 ) + end + self:addElement( f49_local16 ) + f49_local18 = LUI.UIElement.new() + f49_local18.id = "generic_selectionList_window_id" + f49_local18:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + left = -f49_local14 / 2, + right = f49_local14 / 2, + top = 0, + bottom = 0, + alpha = 0 + } ) + f49_local18:registerAnimationState( "start", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = false, + left = -f49_local14 / 2, + right = f49_local14 / 2, + top = 0, + bottom = 0, + alpha = 0 + } ) + f49_local18:animateToState( "default" ) + f49_local18:animateToState( "start", 1 ) + self:addElement( f49_local18 ) + f49_local18:addElement( generic_drop_shadow( {}, { + offset_shadow = 0 + } ) ) + f49_local19 = generic_menu_background( nil, { + fill_alpha = 1 + } ) + f49_local19:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = 0, + right = 0, + top = GenericTitleBarDims.TitleBarHeight, + bottom = 0 + } ) + f49_local19:animateToState( "default" ) + f49_local18:addElement( f49_local19 ) + f49_local18:addElement( generic_menu_titlebar( nil, { + font = f49_local7, + title_bar_text = f49_local5, + title_bar_alignment = f49_local4, + fill_alpha = 1 + } ) ) + f49_local21 = LUI.UIVerticalList.new() + f49_local21.id = "generic_selectionList_content_id" + f49_local21:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + left = f49_local2, + right = -f49_local1, + top = GenericTitleBarDims.TitleBarHeight + f49_local3, + bottom = -f49_local0, + spacing = f49_local8 + } ) + f49_local21:animateToState( "default" ) + f49_local18:addElement( f49_local21 ) + f49_local22 = function ( f50_arg0, f50_arg1 ) + if f50_arg1.name == "menu_create" then + f50_arg0.animateIn = true + end + f0_local4( f50_arg0, f49_local21, f49_local14, f49_local3, f49_local0 ) + end + + f49_local18:addEventHandler( "menu_create", f49_local22 ) + f49_local18:addEventHandler( "resize_popup", f49_local22 ) + f49_local18:addEventHandler( "transition_complete_start", f49_local22 ) + f49_local23 = f49_arg1.popup_childfeeder or function () + return {} + end + + if type( f49_local23 ) == "table" and f49_local23.isProperty then + f49_local23 = f49_local23.func( f49_arg1 ) + end + assert( type( f49_local23 ) == "function", "Feeders must be a function or referenced by the MBh.Property helper" ) + local f49_local24 = f49_local23( f49_arg1 ) + f49_local21.childrenFeeder = f49_local23 + if f49_local24 then + LUI.MenuBuilder.buildChildren( f49_local21, f49_arg1, f49_local24 ) + end + self.addListElement = function ( f52_arg0 ) + assert( f52_arg0 ) + f49_local21:addElement( f52_arg0 ) + end + + local f49_local25 = LUI.UIBindButton.new() + f49_local25.id = "generic_selectionList_back_id" + f49_local25:registerEventHandler( "button_secondary", function ( element, event ) + self:processEvent( { + name = "popup_back", + controller = event.controller + } ) + if f49_local6 then + LUI.FlowManager.RequestLeaveMenu( element ) + end + end ) + self:addElement( f49_local25 ) + return self + end + end + f49_local23 = 0 +end + +function DebugMessageBox( f54_arg0, f54_arg1, f54_arg2, f54_arg3 ) + if not f54_arg1 or f54_arg1 == -1 then + f54_arg1 = Engine.GetFirstActiveController() + end + if not f54_arg2 then + f54_arg2 = "" + end + if not f54_arg3 then + f54_arg3 = "" + end + Engine.ExecNow( "set LUIDebugMessageBoxTitle " .. f54_arg2 ) + Engine.ExecNow( "set LUIDebugMessageBoxMessage " .. f54_arg3 ) + LUI.FlowManager.RequestPopupMenu( f54_arg0, "generic_debugMessageBox_popup", true, f54_arg1, false ) +end + +function generic_debugMessageBox_popup() + return { + type = "generic_confirmation_popup", + id = "debug_message_box_popup_id", + properties = { + popup_title = Engine.GetDvarString( "LUIDebugMessageBoxTitle" ), + message_text = Engine.GetDvarString( "LUIDebugMessageBoxMessage" ), + button_text = Engine.Localize( "@MENU_OK" ) + } + } +end + +function generic_menu_background( f56_arg0, f56_arg1 ) + if not f56_arg1 then + f56_arg1 = {} + end + local f56_local0 = f56_arg1.bottom_offset or 0 + local f56_local1 = f56_arg1.top_offset + if not f56_local1 then + f56_local1 = GenericTitleBarDims.TitleBarHeight + end + local f56_local2 = f56_arg1.fill_color + if not f56_local2 then + f56_local2 = Swatches.GenericMenu.Background + end + local f56_local3 = f56_arg1.border_color + if not f56_local3 then + f56_local3 = Swatches.GenericMenu.Border + end + local f56_local4 = f56_arg1.fill_alpha + if not f56_local4 then + f56_local4 = Swatches.GenericMenu.BackgroundAlpha + end + local f56_local5 = f56_arg1.border_alpha + if not f56_local5 then + f56_local5 = Swatches.GenericMenu.BorderAlpha + end + local f56_local6 = f56_arg1.background_image or "white" + local f56_local7 = f56_arg1.hide_bottom or false + local self = LUI.UIElement.new() + self.id = "generic_menu_background" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = f56_local1, + bottom = -f56_local0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f56_local9 = LUI.UIImage.new() + f56_local9.id = "generic_menu_background_inner" + f56_local9:registerAnimationState( "default", CoD.ColorizeState( f56_local2, { + material = RegisterMaterial( f56_local6 ), + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 1, + bottom = -1, + left = 1, + right = -1, + alpha = f56_local4 + } ) ) + f56_local9:animateToState( "default" ) + self:addElement( f56_local9 ) + local f56_local10 = generic_border( {}, { + inner = true, + border_red = f56_local3.r, + border_green = f56_local3.g, + border_blue = f56_local3.b, + border_alpha = f56_local5, + hide_bottom = f56_local7 + } ) + f56_local10.id = "generic_menu_background_border" + self:addElement( f56_local10 ) + return self +end + +function generic_menu_background_withfade( f57_arg0, f57_arg1 ) + if not f57_arg1 then + f57_arg1 = {} + end + local f57_local0 = f57_arg1.top_offset + if not f57_local0 then + f57_local0 = GenericTitleBarDims.TitleBarHeight + end + local f57_local1 = f57_arg1.fill_color + if not f57_local1 then + f57_local1 = Swatches.GenericMenu.Background + end + local f57_local2 = f57_arg1.border_color + if not f57_local2 then + f57_local2 = Swatches.GenericMenu.Border + end + local f57_local3 = f57_arg1.fill_alpha + if not f57_local3 then + f57_local3 = Swatches.GenericMenu.BackgroundAlpha + end + local f57_local4 = f57_arg1.border_alpha + if not f57_local4 then + f57_local4 = Swatches.GenericMenu.BorderAlpha + end + local f57_local5 = f57_arg1.shadow_top_offset or 0 + local f57_local6 = f57_arg1.shadow_alpha or 0.75 + local f57_local7 = f57_arg1.hide_shadow or false + local f57_local8 = f57_arg1.fade_height or 150 + local self = LUI.UIElement.new() + self.id = "generic_menu_background_withfade" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + self:addElement( generic_menu_background( {}, { + top_offset = f57_local0, + bottom_offset = f57_local8, + fill_color = f57_local1, + border_color = f57_local2, + fill_alpha = f57_local3, + border_alpha = f57_local4, + hide_bottom = true + } ) ) + local f57_local10 = LUI.UIElement.new() + f57_local10:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = -1 * (1 + f57_local8), + bottom = 0, + left = 0, + right = 0 + } ) + f57_local10:animateToState( "default" ) + local f57_local11 = LUI.UIImage.new() + f57_local11:registerAnimationState( "default", CoD.ColorizeState( f57_local2, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = false, + top = 0, + bottom = 0, + left = 0, + right = 1, + material = RegisterMaterial( "box_white_gradient_top" ), + alpha = f57_local4 + } ) ) + f57_local11:animateToState( "default" ) + f57_local10:addElement( f57_local11 ) + local f57_local12 = LUI.UIImage.new() + f57_local12:registerAnimationState( "default", CoD.ColorizeState( f57_local1, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 1, + right = -1, + material = RegisterMaterial( "box_white_gradient_top" ), + alpha = f57_local3 + } ) ) + f57_local12:animateToState( "default" ) + f57_local10:addElement( f57_local12 ) + local f57_local13 = LUI.UIImage.new() + f57_local13:registerAnimationState( "default", CoD.ColorizeState( f57_local2, { + topAnchor = true, + bottomAnchor = true, + leftAnchor = false, + rightAnchor = true, + top = 0, + bottom = 0, + left = -1, + right = 0, + material = RegisterMaterial( "box_white_gradient_top" ), + alpha = f57_local4 + } ) ) + f57_local13:animateToState( "default" ) + f57_local10:addElement( f57_local13 ) + if not f57_local7 then + self:addElement( generic_drop_shadow_withfade( {}, { + alpha = f57_local6, + fade_height = f57_local8, + top_offset = f57_local5 + } ) ) + end + self:addElement( f57_local10 ) + return self +end + +function generic_menu_titlebar_background( f58_arg0, f58_arg1 ) + if not f58_arg1 then + f58_arg1 = {} + end + local f58_local0 = f58_arg1.fill_color + if not f58_local0 then + f58_local0 = Swatches.GenericMenu.Background + end + local f58_local1 = f58_arg1.border_color + if not f58_local1 then + f58_local1 = Swatches.GenericMenu.Border + end + local f58_local2 = f58_arg1.fill_alpha + if not f58_local2 then + f58_local2 = Swatches.GenericMenu.BackgroundAlpha + end + local f58_local3 = f58_arg1.border_alpha + if not f58_local3 then + f58_local3 = Swatches.GenericMenu.BorderAlpha + end + local f58_local4 = f58_arg1.reversed or false + local self = LUI.UIElement.new() + self.id = "generic_menu_titlebar_background_id" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = GenericTitleBarDims.TitleBarHeight, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f58_local6 = LUI.UIImage.new() + f58_local6.id = "cap_fill" + local f58_local7 = f58_local6 + local f58_local8 = f58_local6.registerAnimationState + local f58_local9 = "default" + local f58_local10 = CoD.ColorizeState + local f58_local11 = f58_local0 + local f58_local12 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = not f58_local4, + rightAnchor = f58_local4, + top = 0, + bottom = 0 + } + local f58_local13 + if f58_local4 then + f58_local13 = -GenericTitleBarDims.TitleBarLCapWidth + if not f58_local13 then + + else + f58_local12.left = f58_local13 + if f58_local4 then + f58_local13 = 0 + if not f58_local13 then + + else + f58_local12.right = f58_local13 + if f58_local4 then + f58_local13 = RegisterMaterial( "box_titlebar_rightcap" ) + if not f58_local13 then + + else + f58_local12.material = f58_local13 + f58_local12.alpha = f58_local2 + f58_local8( f58_local7, f58_local9, f58_local10( f58_local11, f58_local12 ) ) + f58_local6:animateToState( "default" ) + self:addElement( f58_local6 ) + f58_local8 = LUI.UIImage.new() + f58_local8.id = "body_fill" + f58_local9 = f58_local8 + f58_local7 = f58_local8.registerAnimationState + f58_local10 = "default" + f58_local11 = CoD.ColorizeState + f58_local12 = f58_local0 + f58_local13 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 1, + bottom = 0 + } + local f58_local14 + if f58_local4 then + f58_local14 = -1 + if not f58_local14 then + + else + f58_local13.left = f58_local14 + if f58_local4 then + f58_local14 = -GenericTitleBarDims.TitleBarLCapWidth + if not f58_local14 then + + else + f58_local13.right = f58_local14 + f58_local13.material = RegisterMaterial( "white" ) + f58_local13.alpha = f58_local2 + f58_local7( f58_local9, f58_local10, f58_local11( f58_local12, f58_local13 ) ) + f58_local8:animateToState( "default" ) + self:addElement( f58_local8 ) + f58_local7 = LUI.UIImage.new() + f58_local7.id = "cap_border" + f58_local10 = f58_local7 + f58_local9 = f58_local7.registerAnimationState + f58_local11 = "default" + f58_local12 = CoD.ColorizeState + f58_local13 = f58_local1 + f58_local14 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = not f58_local4, + rightAnchor = f58_local4, + top = 0, + bottom = 0 + } + local f58_local15 + if f58_local4 then + f58_local15 = -GenericTitleBarDims.TitleBarLCapWidth + if not f58_local15 then + + else + f58_local14.left = f58_local15 + if f58_local4 then + f58_local15 = 0 + if not f58_local15 then + + else + f58_local14.right = f58_local15 + if f58_local4 then + f58_local15 = RegisterMaterial( "box_titlebar_rightcap_border" ) + if not f58_local15 then + + else + f58_local14.material = f58_local15 + f58_local14.alpha = f58_local3 + f58_local9( f58_local10, f58_local11, f58_local12( f58_local13, f58_local14 ) ) + f58_local7:animateToState( "default" ) + self:addElement( f58_local7 ) + f58_local9 = LUI.UIImage.new() + f58_local9.id = "end_border" + f58_local11 = f58_local9 + f58_local10 = f58_local9.registerAnimationState + f58_local12 = "default" + f58_local13 = CoD.ColorizeState + f58_local14 = f58_local1 + f58_local15 = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = f58_local4, + rightAnchor = not f58_local4, + top = 0, + bottom = 0 + } + local f58_local16 + if f58_local4 then + f58_local16 = 0 + if not f58_local16 then + + else + f58_local15.left = f58_local16 + if f58_local4 then + f58_local16 = 1 + if not f58_local16 then + + else + f58_local15.right = f58_local16 + f58_local15.material = RegisterMaterial( "white" ) + f58_local15.alpha = f58_local3 + f58_local10( f58_local11, f58_local12, f58_local13( f58_local14, f58_local15 ) ) + f58_local9:animateToState( "default" ) + self:addElement( f58_local9 ) + f58_local10 = LUI.UIImage.new() + f58_local10.id = "top_border" + f58_local12 = f58_local10 + f58_local11 = f58_local10.registerAnimationState + f58_local13 = "default" + f58_local14 = CoD.ColorizeState + f58_local15 = f58_local1 + f58_local16 = { + topAnchor = true, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 1 + } + local f58_local17 + if f58_local4 then + f58_local17 = 1 + if not f58_local17 then + + else + f58_local16.left = f58_local17 + if f58_local4 then + f58_local17 = -GenericTitleBarDims.TitleBarLCapWidth + if not f58_local17 then + + else + f58_local16.right = f58_local17 + f58_local16.material = RegisterMaterial( "white" ) + f58_local16.alpha = f58_local3 + f58_local11( f58_local12, f58_local13, f58_local14( f58_local15, f58_local16 ) ) + f58_local10:animateToState( "default" ) + self:addElement( f58_local10 ) + return self + end + end + f58_local17 = -1 + end + end + f58_local17 = GenericTitleBarDims.TitleBarLCapWidth + end + end + f58_local16 = 0 + end + end + f58_local16 = -1 + end + end + f58_local15 = RegisterMaterial( "box_titlebar_leftcap_border" ) + end + end + f58_local15 = GenericTitleBarDims.TitleBarLCapWidth + end + end + f58_local15 = 0 + end + end + f58_local14 = -1 + end + end + f58_local14 = GenericTitleBarDims.TitleBarLCapWidth + end + end + f58_local13 = RegisterMaterial( "box_titlebar_leftcap" ) + end + end + f58_local13 = GenericTitleBarDims.TitleBarLCapWidth + end + end + f58_local13 = 0 +end + +local f0_local5 = function ( f59_arg0, f59_arg1 ) + f59_arg0:setText( f59_arg1.title_text ) +end + +function generic_menu_titlebar( f60_arg0, f60_arg1 ) + local f60_local0 = f60_arg1.title_bar_text_indent or 0 + local f60_local1 = f60_arg1.title_bar_alignment + if not f60_local1 then + f60_local1 = LUI.Alignment.Center + end + local f60_local2 = f60_arg1.title_bar_text or "" + local f60_local3 = generic_menu_titlebar_background( nil, f60_arg1 ) + local f60_local4 = f60_arg1.font + if not f60_local4 then + f60_local4 = CoD.TextSettings.ExtraBigFont + end + local f60_local5 = f60_arg1.vertOffset or 1 + local f60_local6 = f60_arg1.marquee and LUI.UIMarqueeText.new() or LUI.UIText.new() + f60_local6.id = "title" + f60_local6:setText( f60_local2 ) + f60_local6:registerAnimationState( "default", { + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = true, + top = -f60_local4.Height / 2 + f60_local5, + height = f60_local4.Height, + left = f60_local0, + right = 0, + font = f60_local4.Font, + alignment = f60_local1 + } ) + f60_local6:animateToState( "default" ) + f60_local6:registerEventHandler( "update_title", f0_local5 ) + f60_local3:addElement( f60_local6 ) + return f60_local3 +end + +function RefreshScrollList( f61_arg0, f61_arg1 ) + f61_arg0:closeChildren() + f61_arg0:clearSavedState() + f61_arg0:processEvent( { + name = "menu_refresh" + } ) +end + +function generic_loading_widget( f62_arg0, f62_arg1 ) + if not f62_arg1 then + f62_arg1 = {} + end + local f62_local0 = f62_arg1.indent or 15 + local f62_local1 = f62_arg1.message or "" + local self = LUI.UIElement.new() + self.id = "generic_loading_widget" + self:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } ) + self:animateToState( "default" ) + local f62_local3 = LUI.UIHorizontalList.new() + f62_local3:registerAnimationState( "default", { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0, + alignment = LUI.Alignment.Center, + spacing = f62_local0 + } ) + f62_local3:animateToState( "default" ) + self:addElement( f62_local3 ) + local f62_local4 = LUI.MenuBuilder.BuildAddChild( f62_local3, { + type = "live_dialog_processing_widget" + } ) + if #f62_local1 > 0 then + local f62_local5, f62_local6, f62_local7, f62_local8 = GetTextDimensions( f62_local1, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height ) + local f62_local9 = LUI.UIText.new() + f62_local9:setText( f62_local1 ) + f62_local9:registerAnimationState( "default", { + font = CoD.TextSettings.NormalFont.Font, + alignment = LUI.Alignment.Left, + topAnchor = false, + bottomAnchor = false, + leftAnchor = true, + rightAnchor = false, + top = -CoD.TextSettings.NormalFont.Height / 2, + bottom = CoD.TextSettings.NormalFont.Height / 2, + left = 0, + right = f62_local7 - f62_local5 + } ) + f62_local9:animateToState( "default" ) + f62_local3:addElement( f62_local9 ) + end + return self +end + +function generic_separator( menu, controller ) + local self = LUI.UIElement.new( { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + right = 0, + height = 12 + } ) + self.id = "generic_spacer_id" + local f63_local1 = LUI.UIImage.new( { + material = RegisterMaterial( "box_white_gradient_fade_rt" ), + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + right = -GenericButtonSettings.Styles.GradientButton.focus_animation_distance - 7, + top = 2, + left = 0, + height = 2, + alpha = 0.15 + } ) + f63_local1.id = "generic_spacer_image_id" + self:addElement( f63_local1 ) + return self +end + +if Engine.InFrontend() then + LUI.MenuBuilder.registerDef( "generic_input_field", generic_input_field ) +end +LUI.MenuBuilder.registerDef( "generic_debugMessageBox_popup", generic_debugMessageBox_popup ) +LUI.MenuBuilder.registerDef( "generic_header", left_header ) +LUI.MenuBuilder.registerType( "generic_menu_title", generic_menu_title ) +LUI.MenuBuilder.registerType( "generic_border", generic_border ) +LUI.MenuBuilder.registerType( "generic_drop_shadow", generic_drop_shadow ) +LUI.MenuBuilder.registerType( "generic_drop_shadow_withfade", generic_drop_shadow_withfade ) +LUI.MenuBuilder.registerType( "generic_back_button", generic_back_button ) +LUI.MenuBuilder.registerDef( "left_header", left_header ) +LUI.MenuBuilder.registerDef( "generic_popup_message", generic_popup_message ) +LUI.MenuBuilder.registerDef( "generic_confirmation_popup", generic_confirmation_popup ) +LUI.MenuBuilder.registerDef( "generic_yesno_popup", generic_yesno_popup ) +LUI.MenuBuilder.registerDef( "generic_yesno_with_image_popup", generic_yesno_with_image_popup ) +LUI.MenuBuilder.registerType( "generic_menu_background", generic_menu_background ) +LUI.MenuBuilder.registerType( "generic_menu_background_withfade", generic_menu_background_withfade ) +LUI.MenuBuilder.registerType( "generic_menu_titlebar", generic_menu_titlebar ) +LUI.MenuBuilder.registerType( "generic_selectionList_popup", generic_selectionList_popup ) +LUI.MenuBuilder.registerType( "generic_loading_widget", generic_loading_widget ) +LUI.MenuBuilder.registerType( "generic_separator", generic_separator ) +LockTable( _M ) diff --git a/lui/movementcontrols.dec.lua b/lui/movementcontrols.dec.lua new file mode 100644 index 0000000..78b42ec --- /dev/null +++ b/lui/movementcontrols.dec.lua @@ -0,0 +1,164 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +function GetDisplay( f1_arg0 ) + return Engine.GetBinding( f1_arg0 ) +end + +function bindKey( f2_arg0 ) + Engine.BindKey( f2_arg0 ) +end + +function OptionsWindowRefresh( f3_arg0, f3_arg1 ) + if f3_arg1.source_input == "button_action" or f3_arg1.source_input == "key_bound" then + f3_arg0:processEvent( { + name = "menu_refresh" + } ) + f3_arg0:processEvent( { + name = "refresh_content" + } ) + end +end + +function OptionsWindowTriggerRefresh( f4_arg0, f4_arg1 ) + f4_arg0:dispatchEventToRoot( { + name = "options_window_refresh", + source_input = f4_arg1.name, + immediate = true + } ) +end + +function ControlBindFactory( f5_arg0, f5_arg1 ) + return { + type = "UIGenericButton", + id = "bind_" .. f5_arg1, + disabledFunc = shouldBeDisabledFunc or function () + return false + end + , + properties = { + variant = GenericButtonSettings.Variants.Info, + button_text = Engine.Localize( f5_arg0 ), + button_display_func = function ( f7_arg0, f7_arg1 ) + return GetDisplay( f5_arg1 ) + end + , + button_action_func = function ( f8_arg0, f8_arg1 ) + Engine.BindKey( f5_arg1 ) + OptionsWindowTriggerRefresh( f8_arg0, f8_arg1 ) + end + + }, + handlers = { + element_refresh = MBh.EmitEvent( "content_refresh" ), + key_bound = OptionsWindowTriggerRefresh + } + } +end + +function OptionsFeeder( f9_arg0 ) + local f9_local0 = {} + Engine.ExecNow( "profile_menuDvarsSetup" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_FORWARD", "+forward" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_MOVE_BACK", "+back" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_MOVE_LEFT", "+moveleft" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_MOVE_RIGHT", "+moveright" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_STANDJUMP", "+gostand" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_CROUCH", "+togglecrouch" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_PRONE", "toggleprone" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_SPRINT_HOLD_BREATH", "+breath_sprint" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_HOLD_DOWN_CROUCH", "+movedown" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_HOLD_DOWN_PRONE", "+prone" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_CHANGE_STANCE", "+stance" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_SPRINT", "+sprint" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_HOLD_BREATH", "+holdbreath" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_TURN_LEFT", "+left" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_TURN_RIGHT", "+right" ) + f9_local0[#f9_local0 + 1] = ControlBindFactory( "@MENU_STRAFE", "+strafe" ) + return f9_local0 +end + +function OptionsMainCreate( f10_arg0, f10_arg1 ) + f10_arg0:processEvent( LUI.ButtonHelperText.CommonEvents.addBackButton ) +end + +function movement_vlist() + return { + type = "UIScrollingVerticalList", + childrenFeeder = OptionsFeeder, + properties = { + use_arrows = true, + sendScrollEvents = true, + exclusiveController = MBh.Property( "exclusiveController" ) + }, + states = { + default = { + leftAnchor = true, + rightAnchor = false, + topAnchor = true, + bottomAnchor = false, + top = OptionsListDims.menu_top, + bottom = OptionsListDims.menu_bottom, + left = OptionsListDims.menu_left, + right = OptionsListDims.menu_right + } + }, + handlers = { + options_window_refresh = OptionsWindowRefresh + } + } +end + +function movement_controls() + return { + type = "UIElement", + id = "movement_controls_id", + states = { + default = { + topAnchor = true, + bottomAnchor = true, + leftAnchor = true, + rightAnchor = true, + top = 0, + bottom = 0, + left = 0, + right = 0 + } + }, + handlers = { + menu_create = OptionsMainCreate, + menu_close = function ( f13_arg0, f13_arg1 ) + Engine.Exec( "updategamerprofile" ) + end + + }, + children = { + { + type = "generic_menu_title", + properties = { + menu_title = Engine.Localize( "@LUA_MENU_MOVEMENT" ) + } + }, + { + type = "movement_vlist", + id = "movement_vlist_id" + }, + { + type = "button_helper_text_main", + id = "button_helper_text_id" + }, + { + type = "UIBindButton", + id = "back_button", + handlers = { + button_secondary = MBh.LeaveMenu() + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "movement_vlist", movement_vlist ) +LUI.MenuBuilder.registerDef( "movement_controls", movement_controls ) +LockTable( _M ) diff --git a/lui/mp_hud/a10overlayhud.dec.lua b/lui/mp_hud/a10overlayhud.dec.lua new file mode 100644 index 0000000..1599c2e --- /dev/null +++ b/lui/mp_hud/a10overlayhud.dec.lua @@ -0,0 +1,801 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = Engine.Localize( "@LUA_MENU_A10_ALT_LABEL" ) +f0_local1 = Engine.Localize( "@LUA_MENU_A10_CANNON_LABEL" ) +f0_local2 = Engine.Localize( "@LUA_MENU_A10_ROCKET_LABEL" ) +local f0_local3 = "@PLATFORM_A10_CANNON_FIRE" +local f0_local4 = "@PLATFORM_A10_ROCKET_FIRE" +local f0_local5 = function ( f1_arg0, f1_arg1 ) + if f1_arg1.value then + f1_arg0:animateToState( "active", 0 ) + local f1_local0 = f1_arg0:getChildById( "reticleImageId" ) + local f1_local1 = f1_arg0:getChildById( "altitudeBackID" ) + local f1_local2 = f1_arg0:getChildById( "speedBackID" ) + local f1_local3 = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "opening", + 150 + }, + { + "active", + 0 + } + } ) + f1_local3( f1_local0 ) + f1_local3( f1_local1 ) + f1_local3( f1_local2 ) + else + f1_arg0:animateToState( "default", 0 ) + end +end + +local f0_local6 = function ( f2_arg0, f2_arg1, f2_arg2 ) + if f2_arg2 then + if f2_arg0.current_state ~= "flashing" then + f2_arg0.current_state = "flashing" + f2_arg0:processEvent( { + name = "flashing" + } ) + end + elseif f2_arg0.current_state ~= nil then + f2_arg0.current_state = nil + f2_arg0:animateToState( "default", 0 ) + end +end + +local f0_local7 = function ( f3_arg0, f3_arg1 ) + f3_arg0:setText( f3_arg1.value ) + f0_local6( f3_arg0, f3_arg1, f3_arg1.value <= 0 ) +end + +local f0_local8 = function ( f4_arg0, f4_arg1 ) + f4_arg0:setText( f4_arg1.value ) +end + +local f0_local9 = function ( f5_arg0, f5_arg1 ) + f0_local6( f5_arg0, f5_arg1, f5_arg1.value ) +end + +local f0_local10 = function ( f6_arg0, f6_arg1 ) + if f6_arg1.value then + f6_arg0:animateToState( "locked", 0 ) + else + f6_arg0:animateToState( "active", 0 ) + end +end + +local f0_local11 = function () + return { + type = "UIElement", + id = "a10OverlayContainer", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 0 + }, + active = { + alpha = 1 + } + }, + handlers = { + init_overlay = f0_local5, + omnvar_update = { + ui_a10 = f0_local5 + } + }, + children = { + { + type = "reticleImageDef" + }, + { + type = "a10CannonAmmoDef" + }, + { + type = "a10RocketAmmoDef" + }, + { + type = "a10AltimeterDef" + }, + { + type = "altitudeBackDef" + }, + { + type = "speedBackDef" + }, + { + type = "a10MissileHintDef" + }, + { + type = "a10CannonHintDef" + } + } + } +end + +local f0_local12 = function () + local f8_local0 = RegisterMaterial( "ca_a10_altitude_back_mp" ) + local f8_local1 = 512 + local f8_local2 = 128 + local f8_local3 = -320 + local f8_local4 = -448 + return { + type = "UIImage", + id = "altitudeBackID", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f8_local3 * 0.25, + left = f8_local4 * 0.25, + bottom = (f8_local3 + f8_local1) * 0.25, + right = (f8_local4 + f8_local2) * 0.25, + material = f8_local0, + alpha = 0 + }, + opening = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f8_local3 * 0.5, + left = f8_local4 * 0.5, + bottom = (f8_local3 + f8_local1) * 0.5, + right = (f8_local4 + f8_local2) * 0.5, + alpha = 0.5 + }, + active = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f8_local3, + left = f8_local4, + bottom = f8_local3 + f8_local1, + right = f8_local4 + f8_local2, + red = 0, + green = 1, + blue = 0, + alpha = 1 + } + }, + handlers = {} + } +end + +local f0_local13 = function () + local f9_local0 = RegisterMaterial( "ca_a10_speed_back_mp" ) + local f9_local1 = 512 + local f9_local2 = 128 + local f9_local3 = -320 + local f9_local4 = 448 + return { + type = "UIImage", + id = "speedBackID", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f9_local3 * 0.25, + left = (f9_local4 - f9_local2) * 0.25, + bottom = (f9_local3 + f9_local1) * 0.25, + right = f9_local4 * 0.25, + material = f9_local0, + alpha = 0 + }, + opening = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f9_local3 * 0.5, + left = (f9_local4 - f9_local2) * 0.5, + bottom = (f9_local3 + f9_local1) * 0.5, + right = f9_local4 * 0.5, + alpha = 0.5 + }, + active = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f9_local3, + left = f9_local4 - f9_local2, + bottom = f9_local3 + f9_local1, + right = f9_local4, + red = 0, + green = 1, + blue = 0, + alpha = 1 + } + }, + handlers = {} + } +end + +local f0_local14 = function () + local f10_local0 = RegisterMaterial( "ca_a10_left_strip_mp" ) + local f10_local1 = 256 + local f10_local2 = 64 + local f10_local3 = -128 + local f10_local4 = -128 + return { + type = "UIImage", + id = "leftHashMarksID", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f10_local3 * 0.25, + left = f10_local4 * 0.25, + bottom = (f10_local3 + f10_local1) * 0.25, + right = (f10_local4 + f10_local2) * 0.25, + material = f10_local0, + alpha = 0 + }, + opening = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f10_local3 * 0.5, + left = f10_local4 * 0.5, + bottom = (f10_local3 + f10_local1) * 0.5, + right = (f10_local4 + f10_local2) * 0.5, + alpha = 0.5 + }, + active = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f10_local3, + left = f10_local4, + bottom = f10_local3 + f10_local1, + right = f10_local4 + f10_local2, + red = 0, + green = 1, + blue = 0, + alpha = 1 + } + }, + handlers = {} + } +end + +local f0_local15 = function () + local f11_local0 = RegisterMaterial( "ca_a10_right_strip_mp" ) + local f11_local1 = 256 + local f11_local2 = 64 + local f11_local3 = -128 + local f11_local4 = 128 + return { + type = "UIImage", + id = "rightHashMarksID", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f11_local3 * 0.25, + left = (f11_local4 - f11_local2) * 0.25, + bottom = (f11_local3 + f11_local1) * 0.25, + right = f11_local4 * 0.25, + material = f11_local0, + alpha = 0 + }, + opening = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f11_local3 * 0.5, + left = (f11_local4 - f11_local2) * 0.5, + bottom = (f11_local3 + f11_local1) * 0.5, + right = f11_local4 * 0.5, + alpha = 0.5 + }, + active = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f11_local3, + left = f11_local4 - f11_local2, + bottom = f11_local3 + f11_local1, + right = f11_local4, + red = 0, + green = 1, + blue = 0, + alpha = 1 + } + }, + handlers = {} + } +end + +local f0_local16 = function () + local f12_local0 = RegisterMaterial( "ca_a10_reticle_mp" ) + local f12_local1 = 64 + local f12_local2 = 64 + local f12_local3 = -64 + local f12_local4 = -32 + return { + type = "UIImage", + id = "reticleImageId", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f12_local3 + f12_local1 * 0.5, + left = f12_local4 + f12_local2 * 0.5, + bottom = f12_local4 + f12_local2 * 0.5, + right = f12_local3 + f12_local1 * 0.5, + material = f12_local0, + alpha = 0 + }, + opening = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f12_local3 + f12_local1 * 0.5 - 20, + left = f12_local4 + f12_local2 * 0.5 - 20, + bottom = f12_local3 + f12_local1 * 0.5 + 20, + right = f12_local4 + f12_local2 * 0.5 + 20, + alpha = 0.5 + }, + active = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f12_local3, + left = f12_local4, + bottom = f12_local3 + f12_local1, + right = f12_local4 + f12_local2, + red = 0, + green = 1, + blue = 0, + alpha = 1 + }, + locked = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f12_local3, + left = f12_local4, + bottom = f12_local3 + f12_local1, + right = f12_local4 + f12_local2, + red = 1, + green = 0, + blue = 0, + alpha = 1 + } + }, + handlers = { + omnvar_update = { + ui_a10_rocket_lock = f0_local10 + } + } + } +end + +local f0_local17 = function () + return { + type = "UIVerticalList", + id = "a10CannonAmmoId", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 64, + right = 488, + height = 128, + width = 128, + spacing = 0, + alignment = LUI.Alignment.Left + } + }, + children = { + { + type = "UIText", + id = "a10CannonLabelId", + properties = { + text = f0_local1, + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 0.5, + green = 1, + blue = 0.5, + alpha = 1, + alignment = LUI.Alignment.Left + } + } + }, + { + type = "UIText", + id = "a10CannonCounterId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 0.5, + green = 1, + blue = 0.5, + alpha = 1, + alignment = LUI.Alignment.Left + }, + flash1 = { + red = 1, + green = 0, + blue = 0, + alpha = 1 + }, + flash2 = { + red = 1, + green = 0, + blue = 0, + alpha = 0.25 + } + }, + handlers = { + omnvar_update = { + ui_a10_cannon = f0_local7 + }, + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ) + } + } + } + } +end + +local f0_local18 = function () + local f14_local0 = 0 + local f14_local1 = 100 + return { + type = "UIText", + id = "a10CannonHelpTextId", + properties = { + text = Engine.Localize( f0_local3 ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f14_local0, + left = f14_local1, + bottom = f14_local0 + CoD.TextSettings.HudEuroMedSmallFont.Height, + right = f14_local1 + 200, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + } + } + } +end + +local f0_local19 = function () + local f15_local0 = 0 + local f15_local1 = -100 + return { + type = "UIText", + id = "a10RocketHelpTextId", + properties = { + text = Engine.Localize( f0_local4 ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = f15_local0, + left = f15_local1 - 200, + bottom = f15_local0 + CoD.TextSettings.HudEuroMedSmallFont.Height, + right = f15_local1, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + alpha = 1, + alignment = LUI.Alignment.Right + } + } + } +end + +local f0_local20 = function () + return { + type = "UIVerticalList", + id = "a10RocketAmmoId", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = 64, + left = -488, + height = 128, + width = 128, + spacing = 0, + alignment = LUI.Alignment.Right + } + }, + children = { + { + type = "UIText", + id = "a10RocketLabelId", + properties = { + text = f0_local2, + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 0.5, + green = 1, + blue = 0.5, + alpha = 1, + alignment = LUI.Alignment.Right + } + } + }, + { + type = "UIText", + id = "a10RocketCounterId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 0.5, + green = 1, + blue = 0.5, + alpha = 1, + alignment = LUI.Alignment.Right + }, + flash1 = { + red = 1, + green = 0, + blue = 0, + alpha = 1 + }, + flash2 = { + red = 1, + green = 0, + blue = 0, + alpha = 0.25 + } + }, + handlers = { + omnvar_update = { + ui_a10_rocket = f0_local7 + }, + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ) + } + } + } + } +end + +local f0_local21 = function () + return { + type = "UIVerticalList", + id = "a10AltimeterId", + states = { + default = { + topAnchor = false, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = false, + top = -128, + right = 488, + height = 128, + width = 128, + spacing = 0, + alignment = LUI.Alignment.Left + } + }, + children = { + { + type = "UIText", + id = "a10AltimeterLabelId", + properties = { + text = f0_local0, + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 0.5, + green = 1, + blue = 0.5, + alpha = 1, + alignment = LUI.Alignment.Left + }, + flash1 = { + red = 1, + green = 0, + blue = 0, + alpha = 1 + }, + flash2 = { + red = 1, + green = 0, + blue = 0, + alpha = 0.25 + } + }, + handlers = { + omnvar_update = { + ui_a10_alt_warn = f0_local9 + }, + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ) + } + }, + { + type = "UIText", + id = "a10AltimeterCounterId", + properties = { + text = "", + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedSmallFont.Height, + font = CoD.TextSettings.HudEuroMedSmallFont.Font, + red = 0.5, + green = 1, + blue = 0.5, + alpha = 1, + alignment = LUI.Alignment.Left + }, + flash1 = { + red = 1, + green = 0, + blue = 0, + alpha = 1 + }, + flash2 = { + red = 1, + green = 0, + blue = 0, + alpha = 0.25 + } + }, + handlers = { + omnvar_update = { + ui_a10_alt = f0_local8, + ui_a10_alt_warn = f0_local9 + }, + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ) + } + } + } + } +end + +LUI.MenuBuilder.registerDef( "a10OverlayDef", f0_local11 ) +LUI.MenuBuilder.registerDef( "reticleImageDef", f0_local16 ) +LUI.MenuBuilder.registerDef( "altitudeBackDef", f0_local12 ) +LUI.MenuBuilder.registerDef( "speedBackDef", f0_local13 ) +LUI.MenuBuilder.registerDef( "leftHashMarksDef", f0_local14 ) +LUI.MenuBuilder.registerDef( "rightHashMarksDef", f0_local15 ) +LUI.MenuBuilder.registerDef( "a10CannonAmmoDef", f0_local17 ) +LUI.MenuBuilder.registerDef( "a10RocketAmmoDef", f0_local20 ) +LUI.MenuBuilder.registerDef( "a10AltimeterDef", f0_local21 ) +LUI.MenuBuilder.registerDef( "a10CannonHintDef", f0_local18 ) +LUI.MenuBuilder.registerDef( "a10MissileHintDef", f0_local19 ) +LockTable( _M ) diff --git a/lui/mp_hud/ac130overlayhud.dec.lua b/lui/mp_hud/ac130overlayhud.dec.lua new file mode 100644 index 0000000..f3df264 --- /dev/null +++ b/lui/mp_hud/ac130overlayhud.dec.lua @@ -0,0 +1,1244 @@ +local f0_local0 = module +local f0_local1, f0_local2 = ... +f0_local0( f0_local1, package.seeall ) +CoD.PrintModuleLoad( _NAME ) +f0_local0 = function ( f1_arg0, f1_arg1 ) + local f1_local0 = f1_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f1_local1 = f1_local0:getChildById( "ac130OverlaysContainerId" ) + local f1_local2 = f1_local1:getChildById( "ac130Overlay105mmId" ) + local f1_local3 = f1_local1:getChildById( "ac130Overlay40mmId" ) + local f1_local4 = f1_local1:getChildById( "ac130Overlay25mmId" ) + local f1_local5 = f1_local0:getChildById( "ac130OverlayReloadingTextId" ) + local f1_local6 = f1_local0:getChildById( "ac130OverlayWeaponTextListId" ) + local f1_local7 = f1_local6:getChildById( "ac130Overlay105mmTextId" ) + local f1_local8 = f1_local6:getChildById( "ac130Overlay40mmTextId" ) + local f1_local9 = f1_local6:getChildById( "ac130Overlay25mmTextId" ) + if f1_arg1.value == 0 then + f1_local2:animateToState( "active", 0 ) + f1_local3:animateToState( "default", 0 ) + f1_local4:animateToState( "default", 0 ) + f1_local7:processEvent( { + name = "flashing" + } ) + f1_local8:processEvent( { + name = "stop_flashing" + } ) + f1_local9:processEvent( { + name = "stop_flashing" + } ) + if 0 < Game.GetOmnvar( "ui_ac130_105mm_ammo" ) then + f1_local5:processEvent( { + name = "stop_flashing" + } ) + else + f1_local5:processEvent( { + name = "flashing" + } ) + end + elseif f1_arg1.value == 1 then + f1_local2:animateToState( "default", 0 ) + f1_local3:animateToState( "active", 0 ) + f1_local4:animateToState( "default", 0 ) + f1_local7:processEvent( { + name = "stop_flashing" + } ) + f1_local8:processEvent( { + name = "flashing" + } ) + f1_local9:processEvent( { + name = "stop_flashing" + } ) + if 0 < Game.GetOmnvar( "ui_ac130_40mm_ammo" ) then + f1_local5:processEvent( { + name = "stop_flashing" + } ) + else + f1_local5:processEvent( { + name = "flashing" + } ) + end + elseif f1_arg1.value == 2 then + f1_local2:animateToState( "default", 0 ) + f1_local3:animateToState( "default", 0 ) + f1_local4:animateToState( "active", 0 ) + f1_local7:processEvent( { + name = "stop_flashing" + } ) + f1_local8:processEvent( { + name = "stop_flashing" + } ) + f1_local9:processEvent( { + name = "flashing" + } ) + if 0 < Game.GetOmnvar( "ui_ac130_25mm_ammo" ) then + f1_local5:processEvent( { + name = "stop_flashing" + } ) + else + f1_local5:processEvent( { + name = "flashing" + } ) + end + end +end + +f0_local1 = function ( f2_arg0, f2_arg1 ) + local f2_local0 = f2_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f2_local1 = f2_local0:getChildById( "ac130OverlayWeaponTextListId" ) + local f2_local2 = f2_local0:getChildById( "ac130OverlayAmmoTextListId" ) + local f2_local3 = f2_local2:getChildById( "ac130Overlay105mmAmmoTextId" ) + local f2_local4 = f2_local0:getChildById( "ac130OverlayReloadingTextId" ) + local f2_local5 = f2_arg1.value + f2_local3:setText( f2_local5 .. ":1" ) + if f2_local5 > 0 then + if f2_local3.current_state ~= "default" then + f2_local3.current_state = "default" + f2_local3:processEvent( { + name = "stop_flashing" + } ) + f2_local4:processEvent( { + name = "stop_flashing" + } ) + end + elseif f2_local3.current_state ~= "flashing" then + f2_local3.current_state = "flashing" + f2_local3:processEvent( { + name = "flashing" + } ) + f2_local4:processEvent( { + name = "flashing" + } ) + end +end + +f0_local2 = function ( f3_arg0, f3_arg1 ) + local f3_local0 = f3_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f3_local1 = f3_local0:getChildById( "ac130OverlayWeaponTextListId" ) + local f3_local2 = f3_local0:getChildById( "ac130OverlayAmmoTextListId" ) + local f3_local3 = f3_local2:getChildById( "ac130Overlay40mmAmmoTextId" ) + local f3_local4 = f3_local0:getChildById( "ac130OverlayReloadingTextId" ) + local f3_local5 = f3_arg1.value + f3_local3:setText( f3_local5 .. ":4" ) + if f3_local5 > 0 then + if f3_local3.current_state ~= "default" then + f3_local3.current_state = "default" + f3_local3:processEvent( { + name = "stop_flashing" + } ) + f3_local4:processEvent( { + name = "stop_flashing" + } ) + end + elseif f3_local3.current_state ~= "flashing" then + f3_local3.current_state = "flashing" + f3_local3:processEvent( { + name = "flashing" + } ) + f3_local4:processEvent( { + name = "flashing" + } ) + end +end + +local f0_local3 = function ( f4_arg0, f4_arg1 ) + local f4_local0 = f4_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f4_local1 = f4_local0:getChildById( "ac130OverlayWeaponTextListId" ) + local f4_local2 = f4_local0:getChildById( "ac130OverlayAmmoTextListId" ) + local f4_local3 = f4_local2:getChildById( "ac130Overlay25mmAmmoTextId" ) + local f4_local4 = f4_local0:getChildById( "ac130OverlayReloadingTextId" ) + local f4_local5 = f4_arg1.value + f4_local3:setText( f4_local5 .. ":20" ) + if f4_local5 > 0 then + if f4_local3.current_state ~= "default" then + f4_local3.current_state = "default" + f4_local3:processEvent( { + name = "stop_flashing" + } ) + f4_local4:processEvent( { + name = "stop_flashing" + } ) + end + elseif f4_local3.current_state ~= "flashing" then + f4_local3.current_state = "flashing" + f4_local3:processEvent( { + name = "flashing" + } ) + f4_local4:processEvent( { + name = "flashing" + } ) + end +end + +local f0_local4 = function ( f5_arg0, f5_arg1 ) + local f5_local0 = f5_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f5_local1 = f5_local0:getChildById( "ac130OverlayToggleTextListId" ) + local f5_local2 = f5_local1:getChildById( "ac130OverlayTimerTextId" ) + f5_local2:setEndTime( f5_arg1.value ) +end + +local f0_local5 = function ( f6_arg0, f6_arg1 ) + local f6_local0 = f6_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f6_local1 = f6_local0:getChildById( "ac130OverlayOpticsTextId" ) + local f6_local2 = f6_local0:getChildById( "ac130OverlayFLIRTextId" ) + if f6_arg1.value == 0 then + f6_local1:animateToState( "active", 250 ) + f6_local2:animateToState( "inactive", 250 ) + else + f6_local1:animateToState( "inactive", 250 ) + f6_local2:animateToState( "active", 250 ) + end +end + +local f0_local6 = function ( f7_arg0, f7_arg1 ) + local f7_local0 = f7_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f7_local1 = f7_local0:getChildById( "ac130OverlayPlaneModelCoordsListId" ) + local f7_local2 = f7_local1:getChildById( "ac130OverlayPlaneModelCoordsXId" ) + local f7_local3 = f7_local1:getChildById( "ac130OverlayPlaneModelCoordsYId" ) + local f7_local4 = f7_local1:getChildById( "ac130OverlayPlaneModelCoordsZId" ) + local f7_local5 = Game.GetOmnvar( "ui_ac130_coord1_posx" ) + local f7_local6 = Game.GetOmnvar( "ui_ac130_coord1_posy" ) + local f7_local7 = Game.GetOmnvar( "ui_ac130_coord1_posz" ) + f7_local2:setText( f7_local5 ) + f7_local3:setText( f7_local6 ) + f7_local4:setText( f7_local7 ) +end + +local f0_local7 = function ( f8_arg0, f8_arg1 ) + local f8_local0 = f8_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f8_local1 = f8_local0:getChildById( "ac130OverlayPlayerPositionCoordsListId" ) + local f8_local2 = f8_local1:getChildById( "ac130OverlayPlayerPositionCoordsXId" ) + local f8_local3 = f8_local1:getChildById( "ac130OverlayPlayerPositionCoordsYId" ) + local f8_local4 = f8_local1:getChildById( "ac130OverlayPlayerPositionCoordsZId" ) + local f8_local5 = Game.GetOmnvar( "ui_ac130_coord2_posx" ) + local f8_local6 = Game.GetOmnvar( "ui_ac130_coord2_posy" ) + local f8_local7 = Game.GetOmnvar( "ui_ac130_coord2_posz" ) + f8_local2:setText( f8_local5 ) + f8_local3:setText( f8_local6 ) + f8_local4:setText( f8_local7 ) +end + +local f0_local8 = function ( f9_arg0, f9_arg1 ) + local f9_local0 = f9_arg0:getChildById( "ac130OverlayWeaponsId" ) + local f9_local1 = f9_local0:getChildById( "ac130OverlayAimingCoordsListId" ) + local f9_local2 = f9_local1:getChildById( "ac130OverlayAimingCoordsXId" ) + local f9_local3 = f9_local1:getChildById( "ac130OverlayAimingCoordsYId" ) + local f9_local4 = f9_local1:getChildById( "ac130OverlayAimingCoordsZId" ) + local f9_local5 = Game.GetOmnvar( "ui_ac130_coord3_posx" ) + local f9_local6 = Game.GetOmnvar( "ui_ac130_coord3_posy" ) + local f9_local7 = Game.GetOmnvar( "ui_ac130_coord3_posz" ) + f9_local2:setText( f9_local5 ) + f9_local3:setText( f9_local6 ) + f9_local4:setText( f9_local7 ) +end + +local f0_local9 = function ( f10_arg0, f10_arg1 ) + if f10_arg1.value then + local f10_local0 = f10_arg0:getChildById( "ac130OverlayDarkenImageId" ) + f10_local0:processEvent( { + name = "darken" + } ) + end +end + +local f0_local10 = function () + return { + type = "UIElement", + id = "ac130OverlayContainerId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + alpha = 1 + } + }, + handlers = { + dvar_update = { + ui_ac130_thermal = f0_local5 + }, + omnvar_update = { + ui_ac130_weapon = f0_local0, + ui_ac130_105mm_ammo = f0_local1, + ui_ac130_40mm_ammo = f0_local2, + ui_ac130_25mm_ammo = f0_local3, + ui_ac130_use_time = f0_local4, + ui_ac130_coord1_posx = f0_local6, + ui_ac130_coord2_posx = f0_local7, + ui_ac130_coord3_posx = f0_local8, + ui_ac130_darken = f0_local9 + } + }, + children = { + { + type = "ac130OverlayDarkenImageDef" + }, + { + type = "ac130OverlayImageDef" + }, + { + type = "ac130OverlayWeaponsDef" + } + } + } +end + +local f0_local11 = function () + return { + type = "UIImage", + id = "ac130OverlayImageId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = RegisterMaterial( "ac130_overlay_grain" ), + red = 0.9, + green = 1, + blue = 1, + alpha = 0.3 + } + } + } +end + +local f0_local12 = function () + return { + type = "UIImage", + id = "ac130OverlayDarkenImageId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = RegisterMaterial( "black" ), + alpha = 0 + }, + fadein = { + alpha = 0.6 + } + }, + handlers = { + darken = MBh.AnimateSequence( { + { + "default", + 0 + }, + { + "fadein", + 200 + }, + { + "fadein", + 400 + }, + { + "default", + 800 + } + } ) + } + } +end + +local f0_local13 = function () + return { + type = "UIElement", + id = "ac130OverlayWeaponsId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0 + } + }, + children = { + { + type = "ac130OverlaysDef" + }, + { + type = "ac130OverlayWeaponTextListDef" + }, + { + type = "ac130OverlayAmmoTextListDef" + }, + { + type = "ac130OverlayToggleTextListDef" + }, + { + type = "ac130OverlayPlaneModelCoordsListDef" + }, + { + type = "ac130OverlayPlayerPositionCoordsListDef" + }, + { + type = "ac130OverlayAimingCoordsListDef" + }, + { + type = "UIText", + id = "ac130OverlayReloadingTextId", + properties = { + text = Engine.Localize( "@MP_FAVELA_IW6_AC130_RELOADING" ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = false, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + bottom = -230, + height = CoD.TextSettings.HudEuroNormalFont.Height, + font = CoD.TextSettings.HudEuroNormalFont.Font, + alpha = 0 + }, + flash1 = { + alpha = 1 + }, + flash2 = { + alpha = 0.25 + } + }, + handlers = { + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ), + stop_flashing = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIText", + id = "ac130OverlayOpticsTextId", + properties = { + text = Engine.Localize( "@MP_FAVELA_IW6_AC130_HUD_OPTICS" ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 0, + left = 200, + height = CoD.TextSettings.HudEuroExtraBigFont.Height, + width = 128, + font = CoD.TextSettings.HudEuroExtraBigFont.Font, + alpha = 1 + }, + active = { + alpha = 1 + }, + inactive = { + alpha = 0.25 + } + } + }, + { + type = "UIText", + id = "ac130OverlayFLIRTextId", + properties = { + text = Engine.Localize( "@MP_FAVELA_IW6_AC130_HUD_FLIR" ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = false, + bottomAnchor = false, + rightAnchor = true, + top = 0, + right = -200, + height = CoD.TextSettings.HudEuroExtraBigFont.Height, + width = 128, + font = CoD.TextSettings.HudEuroExtraBigFont.Font, + alpha = 0.25 + }, + active = { + alpha = 1 + }, + inactive = { + alpha = 0.25 + } + } + } + } + } +end + +local f0_local14 = function () + return { + type = "UIElement", + id = "ac130OverlaysContainerId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0 + } + }, + children = { + { + type = "UIImage", + id = "ac130Overlay105mmId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = RegisterMaterial( "ac130_overlay_105mm" ), + alpha = 0 + }, + active = { + alpha = 1 + } + } + }, + { + type = "UIImage", + id = "ac130Overlay40mmId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = RegisterMaterial( "ac130_overlay_40mm" ), + alpha = 0 + }, + active = { + alpha = 1 + } + } + }, + { + type = "UIImage", + id = "ac130Overlay25mmId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = true, + rightAnchor = true, + top = 0, + left = 0, + bottom = 0, + right = 0, + material = RegisterMaterial( "ac130_overlay_25mm" ), + alpha = 0 + }, + active = { + alpha = 1 + } + } + } + } + } +end + +local f0_local15 = function () + return { + type = "UIVerticalList", + id = "ac130OverlayWeaponTextListId", + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = false, + top = 150, + left = 310, + height = 128, + width = 128, + spacing = 0, + alignment = LUI.Alignment.Left + } + }, + children = { + { + type = "UIText", + id = "ac130Overlay105mmTextId", + properties = { + text = Engine.Localize( "@MP_FAVELA_IW6_AC130_HUD_WEAPON_105MM" ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + }, + flash1 = { + alpha = 1 + }, + flash2 = { + alpha = 0.25 + } + }, + handlers = { + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ), + stop_flashing = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIText", + id = "ac130Overlay40mmTextId", + properties = { + text = Engine.Localize( "@MP_FAVELA_IW6_AC130_HUD_WEAPON_40MM" ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alpha = 1, + alignment = LUI.Alignment.Left + }, + flash1 = { + alpha = 1 + }, + flash2 = { + alpha = 0.25 + } + }, + handlers = { + flashing = MBh.AnimateLoop( { + { + "flash1", + 250 + }, + { + "flash2", + 250 + } + } ), + stop_flashing = MBh.AnimateToState( "default", 0 ) + } + }, + { + type = "UIText", + id = "ac130Overlay25mmTextId", + properties = { + text = Engine.Localize( "@MP_FAVELA_IW6_AC130_HUD_WEAPON_25MM" ), + textStyle = CoD.TextSettings.Shadowed + }, + states = { + default = { + topAnchor = true, + leftAnchor = true, + bottomAnchor = false, + rightAnchor = true, + top = 0, + left = 0, + height = CoD.TextSettings.HudEuroMedTinyFont.Height, + font = CoD.TextSettings.HudEuroMedTinyFont.Font, + alpha = 1, + alignment = LUI.Alignment.Lef