local f0_local0 = module local f0_local1, f0_local2 = ... f0_local0( f0_local1, package.seeall ) CoD.PrintModuleLoad( _NAME ) function EmitPlaylistSelectionUpdate( f1_arg0, f1_arg1 ) local f1_local0 = f1_arg0.properties.category local f1_local1 = f1_arg0.properties.index f1_arg0:dispatchEventToRoot( { name = "playlist_selection_update", index = f1_local1, category = f1_local0, dispatchChildren = true, immediate = true } ) f1_arg0:dispatchEventToRoot( { name = "update_players_in_playlist", category = f1_local0, index = f1_local1, dispatchChildren = true, immediate = true } ) local f1_local2 = Playlist.WillCXPBeAwarded() local f1_local3 = f1_arg0 local f1_local4 = f1_arg0.dispatchEventToRoot local f1_local5 = {} local f1_local6 if f1_local2 then f1_local6 = "show_cxp_notification" if not f1_local6 then else f1_local5.name = f1_local6 f1_local5.dispatchChildren = true f1_local5.immediate = true f1_local4( f1_local3, f1_local5 ) end end f1_local6 = "hide_cxp_notification" end function PlaylistHasClanModifiers( f2_arg0, f2_arg1, f2_arg2 ) if not Clan.IsEnabled() then return false else local f2_local0 if not Clan.GetModifierForPlaylist or Clan.GetModifierForPlaylist( f2_arg0, f2_arg1, f2_arg2 ) <= 0 then f2_local0 = false else f2_local0 = true end end return f2_local0 end function DoesAnyPlayerHaveClanModifier( f3_arg0, f3_arg1 ) for f3_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do if PlaylistHasClanModifiers( f3_local0, f3_arg0, f3_arg1 ) then return true end end return false end function GetModifierText( f4_arg0, f4_arg1 ) local f4_local0 = "" local f4_local1 = nil if not Clan.GetModifierForPlaylist then return f4_local0 end for f4_local2 = 0, Engine.GetMaxControllerCount() - 1, 1 do f4_local1 = math.floor( Clan.GetModifierForPlaylist( f4_local2, f4_arg0, f4_arg1 ) * 100 + 0.5 ) if f4_local1 > 0 then f4_local0 = Engine.Localize( "@CLANS_PLAYLIST_MODIFIER", f4_local1, Engine.MarkLocalized( Clan.GetName( f4_local2 ) ) ) break end end return f4_local0 end function PlaylistChooseCategory( f5_arg0, f5_arg1 ) if f5_arg0.properties and f5_arg0.properties.category and f5_arg0.properties.index and Playlist.GetItemEnabled( f5_arg0.properties.category, f5_arg0.properties.index ) then LUI.FlowManager.RequestPopupMenu( f5_arg0, "playlist_sub_menu", false, f5_arg1.controller, false, { category = f5_arg0.properties.index + 1, subtitle_text = Playlist.GetItemName( f5_arg0.properties.category, f5_arg0.properties.index ) } ) else f5_arg0:dispatchEventToParent( { name = "menu_refresh" } ) end end function PlaylistCategoryFeeder( f6_arg0 ) local f6_local0 = {} local f6_local1 = 2 if Engine.IsAliensMode() then f6_local1 = 3 elseif Engine.IsSquadVsSquadMode() then f6_local1 = 4 end local f6_local2 = Playlist.GetPreselectedCategory and Playlist.GetPreselectedCategory() or 0 local f6_local3 = f6_arg0.category local f6_local4 = Playlist.GetCategoryCount( f6_local3 ) for f6_local5 = 0, f6_local4 - 1, 1 do local f6_local8 = { type = "UIGenericButton", id = "playlist_cat_button_" .. f6_local5, audio = { button_over = CoD.SFX.SubMenuMouseOver }, disabled = not Playlist.GetItemEnabled( f6_local3, f6_local5 ), listDefaultFocus = f6_local5 + 1 == f6_local2, properties = { style = GenericButtonSettings.Styles.GlassButton, substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, index = f6_local5, category = f6_local3, button_text = Playlist.GetItemName( f6_local3, f6_local5 ), button_action_func = PlaylistChooseCategory, button_over_func = EmitPlaylistSelectionUpdate, button_over_disable_func = EmitPlaylistSelectionUpdate } } local f6_local9 = Playlist.GetItemCategoryClass( f6_local3, f6_local5 ) if (f6_local9 == -1 or f6_local9 == 1 or f6_local9 == f6_local1) and Playlist.GetCanShowItem( f6_local3, f6_local5 ) == true then f6_local0[#f6_local0 + 1] = f6_local8 end end return f6_local0 end function PlaylistMatchmake( f7_arg0, f7_arg1 ) if f7_arg0.properties and f7_arg0.properties.category and f7_arg0.properties.index and Playlist.GetItemEnabled( f7_arg0.properties.category, f7_arg0.properties.index ) then local f7_local0 = Playlist.GetItemVideo( f7_arg0.properties.category, f7_arg0.properties.index ) if f7_local0 and f7_local0 ~= "" and not LUI.mp_menus.Aliens.HasSeenVideo( f7_arg1.controller, f7_local0 ) and not f7_arg1.skipVideo then local f7_local1 = { name = "button_action", target = f7_arg0, controller = f7_arg1.controller, skipVideo = true } LUI.mp_menus.Aliens.SetHasSeenVideo( f7_arg1.controller, f7_local0 ) LUI.mp_menus.Aliens.AliensPlayVideo( f7_arg1.controller, f7_local0, f7_local1 ) elseif Playlist.DoAction( f7_arg0.properties.category, f7_arg0.properties.index, false, false ) then local f7_local1 = false local f7_local2 = false local f7_local3 = {} if Engine.GetDvarBool( "squad_match" ) then Squad.StartMatch( f7_arg1.controller, true ) Engine.SetDvarBool( "squad_find_match", true ) end LUI.FlowManager.RequestAddMenu( f7_arg0, "menu_xboxlive_lobby", f7_local2, f7_arg1.controller, f7_local1, f7_local3 ) end end end function PlaylistSubMenuFeeder( f8_arg0 ) local f8_local0 = {} local f8_local1 = Playlist.GetPreselectedCategory and Playlist.GetPreselectedCategory() or 0 local f8_local2 = Playlist.GetPreselectedIndexInCategory and Playlist.GetPreselectedIndexInCategory() or 0 local f8_local3 = f8_arg0.category local f8_local4 = Playlist.GetCategoryCount( f8_local3 ) for f8_local5 = 0, f8_local4 - 1, 1 do local f8_local8 = f8_local5 local f8_local9 = { type = "UIGenericButton", id = "playlist_button_" .. f8_local8, audio = { button_over = CoD.SFX.SubMenuMouseOver }, disabled = not Playlist.GetItemEnabled( f8_local3, f8_local8 ) } local f8_local10 if f8_local3 ~= f8_local1 or f8_local8 ~= f8_local2 then f8_local10 = false else f8_local10 = true end f8_local9.listDefaultFocus = f8_local10 f8_local9.properties = { index = f8_local8, category = f8_local3, style = GenericButtonSettings.Styles.GlassButton, substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu, button_text = Playlist.GetItemName( f8_local3, f8_local8 ), button_action_func = PlaylistMatchmake, button_over_func = EmitPlaylistSelectionUpdate, button_over_disable_func = EmitPlaylistSelectionUpdate, additional_handlers = { playlist_button_disabled = function ( f9_arg0, f9_arg1 ) if Playlist.GetItemEnabled( f8_local3, f8_local8 ) then f9_arg0:processEvent( { name = "enable" } ) else f9_arg0:processEvent( { name = "disable" } ) end end } } f8_local9.children = { { type = "UITimer", id = "find_match_playlist_refresh_timer_id", properties = { event = "playlist_button_disabled", interval = 100, disposable = false, broadcastToRoot = false } } } if DoesAnyPlayerHaveClanModifier( f8_local3, f8_local8 ) then f8_local9.children = { { type = "UIImage", id = "playerlist_button_clan_modifier_image", states = { default = { material = RegisterMaterial( "white" ), red = Colors.frontend_hilite.r, green = Colors.frontend_hilite.g, blue = Colors.frontend_hilite.b, topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 0, bottom = 12, left = 0, right = 12 } } } } end if Playlist.GetCanShowItem( f8_local3, f8_local8 ) == true then f8_local0[#f8_local0 + 1] = f8_local9 end end return f8_local0 end f0_local0 = function ( f10_arg0, f10_arg1 ) local f10_local0 = nil if f10_arg1.category == 0 then f10_local0 = Playlist.GetActivePlayersCountForCategory( f10_arg1.index + 1 ) else f10_local0 = Playlist.GetActivePlayersCount( f10_arg1.category, f10_arg1.index ) end f10_arg0:setText( f10_local0 ) end f0_local1 = function ( f11_arg0, f11_arg1 ) f11_arg0:setText( GetPlayersOnlineText() ) end function playlist_vlist() return { type = "UIVerticalList", focusable = true, states = { default = { alignment = LUI.Alignment.Top, leftAnchor = true, rightAnchor = false, topAnchor = true, bottomAnchor = false, left = 0, right = 150, top = GenericMenuDims.menu_top, bottom = GenericMenuDims.menu_bottom } } } end function playlist_detailsWidget() return { type = "UIElement", properties = { headerText = "", messageText = "" }, children = { { type = "UIText", properties = { text = MBh.Property( "headerText" ) }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, bottom = CoD.TextSettings.SmallFont.Height, left = 0, right = 0, font = CoD.TextSettings.SmallFont.Font, alignment = LUI.Alignment.Center, red = Colors.primary_text_color.r, green = Colors.primary_text_color.g, blue = Colors.primary_text_color.b, alpha = 1 } } }, { type = "UIText", properties = { text = MBh.Property( "messageText" ) }, states = { default = { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = -1 * CoD.TextSettings.SmallFont.Height, bottom = 0, left = 0, right = 0, font = CoD.TextSettings.SmallFont.Font, alignment = LUI.Alignment.Center, red = Colors.secondary_text_color.r, green = Colors.secondary_text_color.g, blue = Colors.secondary_text_color.b, alpha = 1 } }, handlers = { update_players_in_playlist_text = f0_local0, update_players_online_text = f0_local1 } } }, states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } } } end function UpdatePlaylistIcon( f14_arg0, f14_arg1 ) f14_arg0:setImage( RegisterMaterial( Playlist.GetItemImage( f14_arg1.category, f14_arg1.index ) ) ) end function UpdatePlaylistHeader( f15_arg0, f15_arg1 ) f15_arg0:setText( Playlist.GetItemName( f15_arg1.category, f15_arg1.index ) ) end function UpdatePlaylistDescription( f16_arg0, f16_arg1 ) f16_arg0:setText( Playlist.GetItemDesc( f16_arg1.category, f16_arg1.index ) ) end function GetPlayersOnlineText() return tostring( Playlist.GetTotalActivePlayersCount() ) end function PropagatePlayersInPlaylistUpdate( f18_arg0, f18_arg1 ) f18_arg0:processEvent( { name = "update_players_in_playlist_text", category = f18_arg1.category, index = f18_arg1.index, dispatchChildren = true } ) end function PropagatePlayersOnlineUpdate( f19_arg0, f19_arg1 ) f19_arg0:processEvent( { name = "update_players_online_text", category = f19_arg1.category, index = f19_arg1.index, dispatchChildren = true } ) end function playlist_detailsPanel() return { type = "UIElement", properties = { headerText = "", descriptionText = "" }, children = { { type = "UIImage", states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = -25, bottom = 231, left = -128, right = 128, material = RegisterMaterial( "icon_playlist_generic" ) } }, handlers = { playlist_selection_update = UpdatePlaylistIcon } }, { type = "UIText", properties = { text = "" }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 231, bottom = 231 + CoD.TextSettings.NormalFont.Height, left = 5, right = -5, 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, alpha = 1 } }, handlers = { playlist_selection_update = UpdatePlaylistHeader } }, { type = "UIText", properties = { text = "" }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 231 + CoD.TextSettings.NormalFont.Height, bottom = 231 + CoD.TextSettings.NormalFont.Height * 2, left = 5, right = -5, 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, alpha = 1 } }, handlers = { playlist_selection_update = UpdatePlaylistDescription } }, { type = "UIText", properties = { text = Engine.Localize( "@CLANS_CXP_AWARDED" ) }, states = { default = { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = -135, bottom = -135 + CoD.TextSettings.SmallFont.Height, left = 5, right = -5, font = CoD.TextSettings.SmallFont.Font, alignment = LUI.Alignment.Center, red = Colors.primary_text_color.r, green = Colors.primary_text_color.g, blue = Colors.primary_text_color.b, alpha = 0 }, visible = { alpha = 1 } }, handlers = { show_cxp_notification = MBh.AnimateToState( "visible", 0 ), hide_cxp_notification = MBh.AnimateToState( "default", 0 ) } }, { type = "playlist_detailsWidget", properties = { headerText = Engine.Localize( "@LUA_MENU_PLAYERS_IN_PLAYLIST" ), messageText = "" }, states = { default = { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = -110, bottom = -70, left = 5, right = -5 } }, handlers = { update_players_in_playlist = PropagatePlayersInPlaylistUpdate } }, { type = "playlist_detailsWidget", properties = { headerText = Engine.Localize( "@LUA_MENU_PLAYERS_ONLINE" ), messageText = GetPlayersOnlineText() }, states = { default = { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = -60, bottom = -20, left = 5, right = -5 } }, handlers = { update_players_in_playlist = PropagatePlayersOnlineUpdate } } }, states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } } } end function playlist_titleBar() return { type = "UIElement", properties = { title_text = "", subtitle_text = "" }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, bottom = GenericTitleBarDims.TitleBarHeight, left = 0, right = 0 } }, children = { { type = "generic_menu_titlebar", properties = { font = CoD.TextSettings.ExtraBigFont, title_bar_text = MBh.Property( "title_text" ), title_bar_text_indent = 50, title_bar_alignment = LUI.Alignment.Left, fill_alpha = 1, reversed = true } }, { type = "UIText", id = "bar_subtitle", properties = { text = MBh.Property( "subtitle_text" ) }, states = { default = CoD.ColorizeState( Colors.secondary_text_color, { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = true, right = -35, width = 200, height = CoD.TextSettings.SmallFont.Height, font = CoD.TextSettings.SmallFont.Font, alignment = LUI.Alignment.Center } ) } } } } end function playlist_main() return { type = "UIElement", id = "playlist_container", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } }, properties = { category = 0 }, children = { { type = "UIImage", id = "playlist_background_overlay", states = { default = CoD.ColorizeState( Swatches.Overlay.Color, { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, material = RegisterMaterial( "white" ), alpha = Swatches.Overlay.AlphaMore } ) } }, { type = "UIElement", id = "playlist_menu", states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 85, height = 600, left = -690, right = -50 }, onScreen = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 85, height = 600, left = 0, right = 640, alpha = 1 }, hidden = { alpha = 0 } }, properties = { category = MBh.Property( "category" ), title_text = Engine.Localize( "@PLATFORM_FIND_GAME_CAPS" ), subtitle_text = "" }, handlers = { menu_create = function ( f23_arg0, f23_arg1 ) f23_arg0:animateToState( "onScreen", 200 ) end , playlist_submenu_open = MBh.AnimateToState( "hidden" ), playlist_submenu_close = MBh.AnimateToState( "onScreen" ) }, children = { { type = "playlist_titleBar", id = "playlist_main_title_bar", properties = { title_text = MBh.Property( "title_text" ), subtitle_text = MBh.Property( "subtitle_text" ) } }, { type = "generic_menu_background_withfade", properties = { shadow_top_offset = 15, shadow_alpha = 0.5, fill_alpha = 1 } }, { type = "UIElement", id = "playlist_main_container", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 50, bottom = 0, left = 65, right = -260 } }, children = { { type = "UIImage", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, material = RegisterMaterial( "box_white_gradient_top" ), red = 0, green = 0, blue = 0, alpha = 0.45 } } }, { type = "playlist_vlist", id = "playlist_list", properties = { category = MBh.Property( "category" ) }, childrenFeeder = PlaylistCategoryFeeder, states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, spacing = 3 } }, handlers = { popup_inactive = function ( f24_arg0, f24_arg1 ) f24_arg0:processEvent( { name = "menu_refresh" } ) end } } } }, { type = "playlist_detailsPanel", id = "playlist_main_details", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = false, rightAnchor = true, top = 40, bottom = 0, left = -256, right = 0 } } } } }, { type = "UIBindButton", id = "playlist_back_button", handlers = { button_secondary = MBh.LeaveMenu() } } } } end function playlist_sub_menu() return { type = "UIElement", id = "playlist_sub_menu_container", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } }, properties = { category = 0, subtitle_text = "" }, handlers = { menu_create = MBh.EmitEventToRoot( "playlist_submenu_open" ), menu_close = MBh.EmitEventToRoot( "playlist_submenu_close" ) }, children = { { type = "UIElement", id = "playlist_sub_menu", states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = false, top = 85, height = 600, left = 0, right = 640 } }, properties = { category = MBh.Property( "category" ), title_text = Engine.Localize( "@MENU_PLAYERMATCH_PLAYLISTS" ), subtitle_text = MBh.Property( "subtitle_text" ), barHeight = 32 }, children = { { type = "playlist_titleBar", id = "playlist_sub_title_bar", properties = { title_text = MBh.Property( "title_text" ), subtitle_text = MBh.Property( "subtitle_text" ) } }, { type = "generic_menu_background_withfade", properties = { shadow_top_offset = 15, shadow_alpha = 0.5, fill_alpha = 1 } }, { type = "UIElement", id = "playlist_sub_container", children = { { type = "UIImage", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, material = RegisterMaterial( "gradient_top" ), alpha = 0.45 } } }, { type = "playlist_vlist", id = "playlist_list", properties = { category = MBh.Property( "category" ) }, childrenFeeder = PlaylistSubMenuFeeder, states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = -30, left = 0, right = 0, spacing = 3 } } }, { type = "UIImage", id = "clan_modifier_desc_background", states = { default = { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = -30, bottom = 0, left = 0, right = 0, material = RegisterMaterial( "white" ), red = Colors.frontend_hilite.r, green = Colors.frontend_hilite.g, blue = Colors.frontend_hilite.b, alpha = 0.8 }, hidden = { alpha = 0 } }, handlers = { playlist_selection_update = function ( f26_arg0, f26_arg1 ) if DoesAnyPlayerHaveClanModifier( f26_arg1.category, f26_arg1.index ) then f26_arg0:animateToState( "default", 0 ) else f26_arg0:animateToState( "hidden", 0 ) end end }, children = { { type = "UIMarqueeText", id = "clan_modifier_desc_text", properties = { text = "", scrollSpeed = 60 }, states = { default = { topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = CoD.TextSettings.NormalFont.Height * -0.5, bottom = CoD.TextSettings.NormalFont.Height * 0.5, left = 10, right = -10, font = CoD.TextSettings.NormalFont.Font, alignment = LUI.Alignment.Center } }, handlers = { playlist_selection_update = function ( f27_arg0, f27_arg1 ) f27_arg0:setText( GetModifierText( f27_arg1.category, f27_arg1.index ) ) end } } } } }, states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 50, bottom = 0, left = 65, right = -260 } } }, { type = "playlist_detailsPanel", id = "playlist_sub_details", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = false, rightAnchor = true, top = 40, bottom = 0, left = -256, right = 0 } } } } }, { type = "UIBindButton", id = "playlist_back_button", handlers = { button_secondary = function ( f28_arg0, f28_arg1 ) LUI.FlowManager.RequestLeaveMenu( f28_arg0, true ) end } } } } end LUI.MenuBuilder.registerDef( "playlist_detailsWidget", playlist_detailsWidget ) LUI.MenuBuilder.registerDef( "playlist_detailsPanel", playlist_detailsPanel ) LUI.MenuBuilder.registerDef( "playlist_main", playlist_main ) LUI.MenuBuilder.registerDef( "playlist_sub_menu", playlist_sub_menu ) LUI.MenuBuilder.registerDef( "playlist_vlist", playlist_vlist ) LUI.MenuBuilder.registerDef( "playlist_titleBar", playlist_titleBar ) LockTable( _M )