local f0_local0 = module local f0_local1, f0_local2 = ... f0_local0( f0_local1, package.seeall ) CoD.PrintModuleLoad( _NAME ) function AltButtonPressed( f1_arg0, f1_arg1 ) local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 ) if f1_local0.overrideAltButtonPressed then f1_arg1.itemType = f1_local0.currentHighlightedType Engine.PlaySound( CoD.SFX.RestrictClass ) f1_local0.overrideAltButtonPressed( f1_arg0, f1_arg1 ) end end function defaultActionToAvoidAssert( f2_arg0, f2_arg1 ) DebugPrint( "[WARNING] CacEditPopup.lua: defaultActionToAvoidAssert() triggered." ) end function OnMenuCreate( f3_arg0, f3_arg1 ) local f3_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f3_arg0 ) f3_local0.squadLocation = f3_arg0.properties.squadLocation assert( f3_local0.squadLocation, "Cac: No squad location specified, something went wrong" ) f3_local0.squadMemberIndex = f3_arg0.properties.squadMemberIndex if not f3_local0.squadMemberIndex then DebugPrint( "[WARNING] CAC: using squad member index 0, this is only ok if you are editing a menu" ) f3_local0.squadMemberIndex = 0 end f3_local0.slot = f3_arg0.properties.slot if not f3_local0.slot then DebugPrint( "[WARNING] CAC: using cac slot index 0, this is only ok if you are editing a menu" ) f3_local0.slot = 0 end f3_local0.classLocation = f3_arg0.properties.classLocation assert( f3_local0.classLocation, "Cac: No class location specified, something went wrong" ) f3_local0.itemIndex = f3_arg0.properties.itemIndex f3_local0.buttonFeeder = f3_arg0.properties.buttonFeeder f3_local0.customTop = f3_arg0.properties.customTop f3_local0.customLeft = f3_arg0.properties.customLeft f3_local0.customRight = f3_arg0.properties.customRight f3_local0.customBottom = f3_arg0.properties.customBottom f3_local0.overrideChooseAction = f3_arg0.properties.overrideChooseAction f3_local0.disableSetDefaultFocus = f3_arg0.properties.disableSetDefaultFocus f3_local0.overrideChooseDisableCheck = f3_arg0.properties.overrideChooseDisableCheck f3_arg0:processEvent( { name = "update_title", title_text = f3_arg0.properties.titleBarText } ) if f3_local0.overrideAltButtonPressed and not MLG.AreMLGRulesEnabled() then f3_arg0:dispatchEventToRoot( { name = "add_button_helper_text", button_ref = "button_alt1", helper_text = Engine.Localize( "@MPUI_RULES_EXCLUDE_CATEGORY" ), side = "right", clickable = true, immediate = true } ) end f3_arg0:processEvent( { name = "menu_refresh" } ) f3_arg0:processEvent( { name = "gain_focus" } ) end function OnMenuClose( f4_arg0, f4_arg1 ) local f4_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f4_arg0 ) if f4_local0.overrideAltButtonPressed then f4_arg0:dispatchEventToRoot( { name = "add_button_helper_text", button_ref = "button_alt1", helper_text = "", side = "right", immediate = true } ) end end function cac_edit_popup_main() return { type = "UIElement", id = "cac_edit_popup_root", properties = { squadLocation = "privateMatchSquadMembers", squadMemberIndex = 0, slot = 0, classLocation = "privateMatchCustomClasses", itemIndex = 0, buttonFeeder = function () end , titleBarText = "", overrideChooseAction = nil, disableSetDefaultFocus = false, overrideChooseDisableCheck = nil, customTop = 0, customLeft = 0, customRight = 0, customBottom = 0 }, handlers = { menu_create = OnMenuCreate, menu_close = OnMenuClose, hide_cac_edit_popup = function ( f7_arg0, f7_arg1 ) f7_arg0:animateToState( "hidden", 0 ) end , show_cac_edit_popup = function ( f8_arg0, f8_arg1 ) f8_arg0:animateToState( "default", 0 ) end }, states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = MBh.Property( "customTop" ), bottom = MBh.Property( "customBottom" ), left = MBh.Property( "customLeft" ), right = MBh.Property( "customRight" ), alpha = 1 }, hidden = { alpha = 0 } }, children = { { type = "UIElement", id = "edit_weapon_list", states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, left = Cac.Layout.ChooseDialog.left, top = Cac.Layout.ChooseDialog.top, width = 305, height = 540 } }, properties = { play_intro_anim = 1, buttonFeeder = MBh.Property( "buttonFeeder" ) }, children = { { type = "generic_menu_titlebar", id = "cac_weapon_types_titlebar", properties = { title_bar_text = genericTitle, font = CoD.TextSettings.BoldFont, title_bar_text_indent = 25, title_bar_alignment = LUI.Alignment.Left } }, { type = "generic_menu_background_withfade", id = "cac_weapon_background_id", properties = { fade_height = 100, shadow_alpha = Cac.Swatches.Alphas.cac_panel_background_shadow } }, { type = "UIVerticalList", id = "cac_weapon_types_list", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = GenericTitleBarDims.TitleBarHeight + 4, bottom = 0, left = 4, right = -4, spacing = 4 } }, childrenFeeder = MBh.Property( "buttonFeeder" ) } } }, { type = "UIBindButton", id = "cac_edit_weapon_button_bind_id", handlers = { button_alt1 = AltButtonPressed, button_secondary = function ( f9_arg0, f9_arg1 ) local f9_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f9_arg0 ) if f9_local0.OnMenuBack then f9_local0.OnMenuBack( f9_arg0, f9_arg1 ) end if f9_local0.editPopupOpenMenuOnClose then LUI.FlowManager.RequestPopupMenu( f9_arg0, f9_local0.editPopupOpenMenuOnClose.menu, true, f9_arg1.controller, true, f9_local0.editPopupOpenMenuOnClose ) else LUI.FlowManager.RequestLeaveMenu( f9_arg0 ) end end } } } } end LUI.MenuBuilder.registerDef( "cac_edit_popup_main", cac_edit_popup_main ) LUI.MenuBuilder.registerDef( "cac_edit_popup_main_second", cac_edit_popup_main ) LockTable( _M )