local f0_local0 = module local f0_local1, f0_local2 = ... f0_local0( f0_local1, package.seeall ) CoD.PrintModuleLoad( _NAME ) function cac_weapon_stats_full_pane() return { type = "UIElement", id = "cac_weapon_stats_full_pane_id", states = { default = { leftAnchor = true, rightAnchor = true, topAnchor = true, bottomAnchor = true, left = 0, right = 0, top = 0, bottom = 0, alpha = 0 }, hidden = { alpha = 0 }, visible = { alpha = 1 } }, children = { { type = "cac_basic_info_pane_header", id = "cac_info_pane_header_stats", properties = { titleText = Engine.Localize( "LUA_MENU_WEAPON_STATS_CAPS" ) } }, { type = "cac_basic_info_pane_background" }, { type = "cac_weapon_info_pane_stats_page", id = "cac_weapon_info_pane_stats" } } } end function cac_performance_stats_full_pane( f2_arg0 ) return function () return { type = "UIElement", id = "cac_performance_stats_full_pane_" .. f2_arg0, states = { default = { leftAnchor = true, rightAnchor = true, topAnchor = true, bottomAnchor = true, left = 0, right = 0, top = 0, bottom = 0, alpha = 0 }, hidden = { alpha = 0 }, visible = { alpha = 1 } }, handlers = { refresh_info_pane = function ( f4_arg0, f4_arg1 ) if f4_arg1.selection_id == "edit_lethal" and f2_arg0 == "cac_weapon_info_pane_performance_page_lethal" then local f4_local0 = false for f4_local9, f4_local10 in pairs( Cac.Indices.Weapons ) do local f4_local4 if f4_local10 == Cac.Indices.Weapons.Primary then f4_local4 = 2 if not f4_local4 then else for f4_local5 = 0, f4_local4, 1 do local f4_local8 = Cac.GetAttachment( f4_arg1.controller, f4_arg1.squadLocation, f4_arg1.squadMemberIndex, f4_arg1.classLocation, f4_arg1.slot, f4_local10, f4_local5 ) if f4_local8 == "shotgun" or f4_local8 == "gl" then f4_arg0:animateToState( "hidden" ) f4_local0 = true end end end end f4_local4 = 1 end if not f4_local0 then f4_arg0:animateToState( "visible" ) end end end }, children = { { type = "cac_basic_info_pane_header", id = "cac_info_pane_header_performance", properties = { titleText = Engine.Localize( "LUA_MENU_PERFORMANCE_CAPS" ) } }, { type = "cac_basic_info_pane_background" }, { type = f2_arg0, id = "cac_weapon_info_performance_stats" } } } end end function CacRefreshInfoPaneHeaderTitle( f5_arg0, f5_arg1 ) if f5_arg1.header ~= nil then f5_arg0:setText( f5_arg1.header ) end end function cac_basic_info_pane_background() return { type = "generic_menu_background_withfade", properties = { fade_height = 100, shadow_alpha = Cac.Swatches.Alphas.cac_panel_background_shadow, top_offset = Cac.Layout.InfoPane.header_height - 1 }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, left = 0, right = 0, height = 180 } } } end function cac_basic_info_pane_header( f7_arg0, f7_arg1 ) local f7_local0 = f7_arg1.titleText or "" local f7_local1 = f7_arg1.backgroundAlpha or 1 local f7_local2 = f7_arg1.width if not f7_local2 then f7_local2 = Cac.Layout.CacEditPanel.right - Cac.Layout.CacEditPanel.left end local f7_local3 = f7_arg1.height if not f7_local3 then f7_local3 = Cac.Layout.InfoPane.header_height end local f7_local4 = Engine.IsConsoleGame() if not f7_local4 then f7_local4 = 1 == Engine.IsGamepadEnabled() end local self = LUI.UIElement.new() self:registerAnimationState( "default", { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 0, left = 0, width = f7_local2, height = f7_local3 } ) self:animateToState( "default" ) local f7_local6 = LUI.MenuGenerics.generic_menu_background( {}, { hide_bottom = true } ) f7_local6:registerAnimationState( "default", { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, left = 0, right = 0, height = f7_local3 } ) f7_local6:animateToState( "default" ) self:addElement( f7_local6 ) local f7_local7 = LUI.UIText.new() f7_local7.id = "info_pane_header_text" f7_local7:setText( f7_local0 ) f7_local7:registerAnimationState( "default", { topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = true, left = 0, right = 0, height = CoD.TextSettings.BoldFont.Height, alignment = LUI.Alignment.Center, font = CoD.TextSettings.BoldFont.Font, red = Colors.window_title_text_color.r, green = Colors.window_title_text_color.g, blue = Colors.window_title_text_color.b } ) f7_local7:animateToState( "default" ) f7_local7:registerEventHandler( "menu_create", CacRefreshInfoPaneHeaderTitle ) f7_local7:registerEventHandler( "refresh_info_pane_header", CacRefreshInfoPaneHeaderTitle ) self:addElement( f7_local7 ) local f7_local8 if f7_local4 then f7_local8 = 40 if not f7_local8 then else local f7_local9 if f7_local4 then f7_local9 = 20 if not f7_local9 then else if IsOnlineMatch() then local f7_local10 = LUI.UIButton.new() f7_local10.id = "info_pane_header_page_lt_btn" f7_local10.m_requireFocusType = FocusType.MouseOver f7_local10:registerAnimationState( "default", { topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = false, left = 5, width = f7_local8, height = f7_local9, alpha = 0 } ) f7_local10:registerAnimationState( "visible", { alpha = 1 } ) f7_local10:animateToState( "default" ) f7_local10:registerEventHandler( "show_lt", MBh.AnimateToState( "visible" ) ) f7_local10:registerEventHandler( "hide_lt", MBh.AnimateToState( "default" ) ) f7_local10:registerEventHandler( "button_action", MBh.EmitEventToParent( "info_panel_go_left" ) ) f7_local10:registerEventHandler( "popup_active", nil ) self:addElement( f7_local10 ) local f7_local11 = nil if f7_local4 then f7_local11 = LUI.UIText.new() f7_local11:setText( Engine.Localize( ButtonMap.button_shoulderl.string ) ) f7_local11:registerAnimationState( "default", { alignment = LUI.Alignment.Center, font = CoD.TextSettings.ExtraBigFont.Font, topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = -CoD.TextSettings.ExtraBigFont.Height / 2, bottom = CoD.TextSettings.ExtraBigFont.Height / 2, left = 0, right = 0 } ) else f7_local11 = LUI.UIImage.new() f7_local11:registerAnimationState( "default", { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = f7_local8, right = -f7_local8, material = RegisterMaterial( "widg_lobby_arrow" ) } ) end f7_local11:animateToState( "default" ) f7_local10:addElement( f7_local11 ) local f7_local12 = LUI.UIButton.new() f7_local12.id = "info_pane_header_page_rt_btn" f7_local12.m_requireFocusType = FocusType.MouseOver f7_local12:registerAnimationState( "default", { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = true, right = -5, width = f7_local8, height = f7_local9, alpha = 0 } ) f7_local12:registerAnimationState( "visible", { alpha = 1 } ) f7_local12:animateToState( "default" ) f7_local12:registerEventHandler( "show_rt", MBh.AnimateToState( "visible" ) ) f7_local12:registerEventHandler( "hide_rt", MBh.AnimateToState( "default" ) ) f7_local12:registerEventHandler( "button_action", MBh.EmitEventToParent( "info_panel_go_right" ) ) f7_local12:registerEventHandler( "popup_active", nil ) self:addElement( f7_local12 ) local f7_local13 = nil if f7_local4 then f7_local13 = LUI.UIText.new() f7_local13:setText( Engine.Localize( ButtonMap.button_shoulderr.string ) ) f7_local13:registerAnimationState( "default", { alignment = LUI.Alignment.Center, font = CoD.TextSettings.ExtraBigFont.Font, topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = -CoD.TextSettings.ExtraBigFont.Height / 2, bottom = CoD.TextSettings.ExtraBigFont.Height / 2, left = 0, right = 0 } ) else f7_local13 = LUI.UIImage.new() f7_local13:registerAnimationState( "default", { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, material = RegisterMaterial( "widg_lobby_arrow" ) } ) end f7_local13:animateToState( "default" ) f7_local12:addElement( f7_local13 ) end return self end end f7_local9 = 16 end end f7_local8 = 16 end function cac_abilities_perks_info_pane_header() return { type = "UIElement", properties = { titleText = "Title", header_height = GenericButtonDims.button_height, left_cap_width = GenericButtonDims.button_height, right_cap_width = 4 }, states = { default = { leftAnchor = true, rightAnchor = true, topAnchor = true, bottomAnchor = false, left = 1, right = -1, top = 0, bottom = MBh.Property( "header_height" ) } }, children = { { type = "UIElement", id = "choose_item_box_header_container_id", properties = { left_cap_width = MBh.Property( "left_cap_width" ), right_cap_width = MBh.Property( "right_cap_width" ) }, states = { default = { leftAnchor = true, rightAnchor = true, topAnchor = true, bottomAnchor = true, left = 0, right = -4, top = 0, bottom = 0 } }, children = { { type = "UIImage", id = "lefty_cap", properties = { left_cap_width = MBh.Property( "left_cap_width" ) }, states = { default = { material = RegisterMaterial( "white" ), leftAnchor = true, rightAnchor = false, topAnchor = true, bottomAnchor = true, left = 0, right = MBh.Property( "left_cap_width" ), top = 0, bottom = 0, red = 0.3, green = 0.3, blue = 0.3, alpha = 0.5 } } }, { type = "UIImage", id = "middy_seg", properties = { left_cap_width = MBh.Property( "left_cap_width" ), right_cap_width = MBh.Property( "right_cap_width" ) }, states = { default = { material = RegisterMaterial( "white" ), leftAnchor = true, rightAnchor = true, topAnchor = true, bottomAnchor = true, left = MBh.Property( "left_cap_width" ), right = MBh.Property( "right_cap_width" ), top = 0, bottom = 0, red = 0.3, green = 0.3, blue = 0.3, alpha = 0.5 } } } } }, { type = "UIText", id = "info_pane_header_text", properties = { text = MBh.Property( "titleText" ), button_text_indent = 30 }, states = { default = { alignment = LUI.Alignment.Left, leftAnchor = true, rightAnchor = true, topAnchor = false, bottomAnchor = false, left = MBh.Property( "button_text_indent" ), right = 0, top = -0.5 * CoD.TextSettings.BoldFont.Height, bottom = 0.5 * CoD.TextSettings.BoldFont.Height, font = CoD.TextSettings.BoldFont.Font, red = Colors.window_title_text_color.r, green = Colors.window_title_text_color.g, blue = Colors.window_title_text_color.b } }, handlers = { menu_create = CacRefreshInfoPaneHeaderTitle, refresh_info_pane_header = CacRefreshInfoPaneHeaderTitle } } } } end function cac_basic_info_pane_page() return { type = "UIElement", states = { default = { leftAnchor = true, rightAnchor = true, topAnchor = true, bottomAnchor = false, left = 1, right = -1, top = Cac.Layout.InfoPane.header_height, bottom = Cac.Layout.InfoPane.height } } } end function InfoPaneHandleRightBumper( f10_arg0, f10_arg1 ) assert( f10_arg0.properties.selection_id ) assert( f10_arg0.properties.currentPaneIndex ) assert( f10_arg0.properties.currentPaneId ) assert( f10_arg0.properties.InfoPaneMap[f10_arg0.properties.selection_id] ) local f10_local0 = f10_arg0.properties.selection_id local f10_local1 = f10_arg0.properties.currentPaneIndex local f10_local2 = f10_arg0.properties.currentPaneId local f10_local3 = f10_arg0.properties.InfoPaneMap[f10_arg0.properties.selection_id] if #f10_local3 >= 1 then local f10_local4 = f10_local1 + 1 if #f10_local3 < f10_local4 then f10_local4 = 1 end f10_arg0.properties.currentPaneIndex = f10_local4 f10_arg0.properties.currentPaneId = f10_local3[f10_local4] .. "_id" f10_arg0.properties.LastOpenPane[f10_local0] = f10_local4 f10_arg0:dispatchEventToRoot( { name = "refresh_info_pane_view", immediate = true } ) end end function InfoPaneHandleLeftBumper( f11_arg0, f11_arg1 ) assert( f11_arg0.properties.selection_id ) assert( f11_arg0.properties.currentPaneIndex ) assert( f11_arg0.properties.currentPaneId ) assert( f11_arg0.properties.InfoPaneMap[f11_arg0.properties.selection_id] ) local f11_local0 = f11_arg0.properties.selection_id local f11_local1 = f11_arg0.properties.currentPaneIndex local f11_local2 = f11_arg0.properties.currentPaneId local f11_local3 = f11_arg0.properties.InfoPaneMap[f11_arg0.properties.selection_id] if #f11_local3 >= 1 then local f11_local4 = f11_local1 - 1 if f11_local4 <= 0 then f11_local4 = #f11_local3 end f11_arg0.properties.currentPaneIndex = f11_local4 f11_arg0.properties.currentPaneId = f11_local3[f11_local4] .. "_id" f11_arg0.properties.LastOpenPane[f11_local0] = f11_local4 f11_arg0:dispatchEventToRoot( { name = "refresh_info_pane_view", immediate = true } ) end end function UpdateSelectionId( f12_arg0, f12_arg1 ) assert( f12_arg1.selection_id ) assert( f12_arg1.classLocation ) assert( f12_arg1.slot ) assert( f12_arg1.controller ) assert( f12_arg0.properties.InfoPaneMap[f12_arg1.selection_id] ) assert( f12_arg0.properties.PaneList ) assert( f12_arg0.properties.currentPaneId ) assert( f12_arg0.properties.selection_id ) local f12_local0 = f12_arg1.selection_id f12_arg0.properties.selection_id = f12_local0 local f12_local1 = f12_arg0.properties.currentPaneId local f12_local2 = f12_arg0.properties.InfoPaneMap[f12_arg1.selection_id] local f12_local3 = f12_arg0.properties.PaneList local f12_local4 = true for f12_local5 = 1, #f12_local3, 1 do local f12_local8 = f12_local3[f12_local5] local f12_local9 = f12_local3[f12_local5] .. "_id" local f12_local10 = false local f12_local11 = 0 for f12_local12 = 1, #f12_local2, 1 do if f12_local3[f12_local5] == f12_local2[f12_local12] then f12_local10 = true f12_local11 = f12_local12 break end end local f12_local12 = f12_arg0:getChildById( f12_local9 ) if f12_local10 then if f12_local12 ~= nil and f12_local12.id == f12_local1 then f12_local4 = false f12_arg0.properties.LastOpenPane[f12_local0] = f12_local11 end if f12_local12 == nil then local f12_local14 = LUI.MenuBuilder.buildMenu( f12_local8, { exclusiveController = f12_arg0.properties.exclusiveController } ) f12_local14.id = f12_local9 f12_arg0:addElement( f12_local14 ) end end if f12_local12 then f12_local12:close() end end if f12_local4 then if #f12_local2 >= 1 then f12_arg0.properties.currentPaneIndex = f12_arg0.properties.LastOpenPane[f12_local0] f12_arg0.properties.currentPaneId = f12_local2[f12_arg0.properties.currentPaneIndex] .. "_id" f12_arg0:dispatchEventToRoot( { name = "refresh_info_pane_view", immediate = true } ) else f12_arg0.properties.currentPaneIndex = 0 f12_arg0.properties.currentPaneId = "" end end end function refreshInfoPaneView( f13_arg0, f13_arg1 ) assert( f13_arg0.properties.selection_id ) assert( f13_arg0.properties.currentPaneIndex ) assert( f13_arg0.properties.currentPaneId ) assert( f13_arg0.properties.InfoPaneMap[f13_arg0.properties.selection_id] ) local f13_local0 = f13_arg0.properties.selection_id local f13_local1 = f13_arg0.properties.currentPaneIndex local f13_local2 = f13_arg0.properties.currentPaneId local f13_local3 = f13_arg0.properties.InfoPaneMap[f13_arg0.properties.selection_id] for f13_local4 = 1, #f13_local3, 1 do local f13_local7 = f13_local3[f13_local4] .. "_id" local f13_local8 = f13_arg0:getChildById( f13_local7 ) if f13_local8 then if f13_local7 == f13_local2 then f13_local8:animateToState( "visible", 0 ) f13_local8.m_ignoreMouseFocus = nil else f13_local8:animateToState( "default", 0 ) f13_local8.m_ignoreMouseFocus = true end end end end function ReEnable( f14_arg0, f14_arg1 ) f14_arg0:processEvent( { name = "enable" } ) end function cac_basic_info_pane_container() local f15_local0 = { "cac_weapon_stats_full_pane", "cac_performance_stats_full_pane_weapon" } local f15_local1 = { "cac_performance_stats_full_pane_lethal" } local f15_local2 = { "cac_performance_stats_full_pane_tactical" } if not IsOnlineMatch() or Engine.GetDvarBool( "xblive_privatematch" ) then f15_local0 = { "cac_weapon_stats_full_pane" } f15_local1 = {} f15_local2 = {} end return { type = "UIBindButton", properties = { selection_id = "edit_weapon_primary", slot = 0, classLocation = "", currentPaneIndex = 1, currentPaneId = "", InfoPaneMap = { edit_weapon_primary = f15_local0, edit_weapon_primary_attach1 = f15_local0, edit_weapon_primary_attach2 = f15_local0, edit_weapon_primary_attach3 = f15_local0, edit_weapon_primary_camo = f15_local0, edit_weapon_primary_reticle = f15_local0, edit_weapon_secondary = f15_local0, edit_weapon_secondary_attach = f15_local0, edit_weapon_secondary_attach1 = f15_local0, edit_weapon_secondary_attach2 = f15_local0, edit_lethal = f15_local1, edit_tactical = f15_local2, edit_killstreaks = {}, edit_abilities = {}, edit_perk1 = {}, edit_perk2 = {}, edit_perk3 = {} }, LastOpenPane = { edit_weapon_primary = 1, edit_weapon_primary_attach1 = 1, edit_weapon_primary_attach2 = 1, edit_weapon_primary_attach3 = 1, edit_weapon_primary_camo = 1, edit_weapon_primary_reticle = 1, edit_weapon_secondary = 1, edit_weapon_secondary_attach1 = 1, edit_weapon_secondary_attach2 = 1, edit_lethal = 1, edit_tactical = 1, edit_killstreaks = 0, edit_abilities = 0, edit_perk1 = 0, edit_perk2 = 0, edit_perk3 = 0 }, PaneList = { "cac_weapon_stats_full_pane", "cac_performance_stats_full_pane_weapon", "cac_performance_stats_full_pane_lethal", "cac_performance_stats_full_pane_tactical" } }, states = { default = { leftAnchor = true, rightAnchor = true, topAnchor = true, bottomAnchor = false, left = 0, right = 0, top = 0, bottom = Cac.Layout.InfoPane.height, alpha = 1 }, shown = { alpha = 1 }, hidden = { alpha = 0 } }, handlers = { show_info_pane = MBh.AnimateToState( "shown", 0 ), hide_info_pane = MBh.AnimateToState( "hidden", 0 ), button_shoulderr = InfoPaneHandleRightBumper, button_shoulderl = InfoPaneHandleLeftBumper, info_panel_go_right = InfoPaneHandleRightBumper, info_panel_go_left = InfoPaneHandleLeftBumper, update_selection_info = UpdateSelectionId, refresh_info_pane_view = refreshInfoPaneView, popup_active = ReEnable }, children = {} } end LUI.MenuBuilder.registerDef( "cac_basic_info_pane_page", cac_basic_info_pane_page ) LUI.MenuBuilder.registerType( "cac_basic_info_pane_header", cac_basic_info_pane_header ) LUI.MenuBuilder.registerDef( "cac_basic_info_pane_container", cac_basic_info_pane_container ) LUI.MenuBuilder.registerDef( "cac_basic_info_pane_background", cac_basic_info_pane_background ) LUI.MenuBuilder.registerDef( "cac_weapon_stats_full_pane", cac_weapon_stats_full_pane ) LUI.MenuBuilder.registerDef( "cac_performance_stats_full_pane", cac_performance_stats_full_pane ) LUI.MenuBuilder.registerDef( "cac_performance_stats_full_pane_weapon", cac_performance_stats_full_pane( "cac_weapon_info_pane_performance_page_weapon" ) ) LUI.MenuBuilder.registerDef( "cac_performance_stats_full_pane_tactical", cac_performance_stats_full_pane( "cac_weapon_info_pane_performance_page_tactical" ) ) LUI.MenuBuilder.registerDef( "cac_performance_stats_full_pane_lethal", cac_performance_stats_full_pane( "cac_weapon_info_pane_performance_page_lethal" ) ) LUI.MenuBuilder.registerDef( "cac_abilities_perks_info_pane_header", cac_abilities_perks_info_pane_header ) LockTable( _M )