local f0_local0 = module local f0_local1, f0_local2 = ... f0_local0( f0_local1, package.seeall ) CoD.PrintModuleLoad( _NAME ) function LeaderboardPop() Leaderboards.Clear() end function LeaderboardButtonSetFocusable( f2_arg0, f2_arg1 ) if f2_arg0.properties.focusable then f2_arg0:makeFocusable() else f2_arg0:makeNotFocusable() end end function LeaderboardListRowFeeder( f3_arg0 ) local f3_local0 = { [#f3_local0 + 1] = { type = "UIImage", id = "leaderboard_header_bg", states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, bottom = Leaderboards.Layout.HeaderHeight, left = 0, right = 0, material = RegisterMaterial( "white" ), alpha = 0.05 } } } } for f3_local1 = 1, Leaderboards.Layout.NumRows, 1 do local f3_local4 = 0.15 if f3_local1 % 2 == 1 then f3_local4 = 0 end f3_local0[#f3_local0 + 1] = { type = "UIImage", id = "leaderboard_row_bg_" .. f3_local1, states = { default = CoD.ColorizeState( Colors.black, { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, bottom = Leaderboards.Layout.RowHeight, left = 0, right = 0, material = RegisterMaterial( "white" ), alpha = f3_local4 } ) }, id = "leaderboard_line_button_" .. f3_local1 } end return f3_local0 end function LeaderboardHeaderRowFeeder( f4_arg0 ) local f4_local0 = {} local f4_local1 = Leaderboards.GetLeaderboardNumColumns( "Common" ) local f4_local2 = f4_local1 + Leaderboards.GetLeaderboardNumColumns( f4_arg0.leaderboardType ) local f4_local3 = {} for f4_local4 = 1, f4_local1, 1 do f4_local3[f4_local4] = Engine.Localize( Leaderboards.GetLeaderboardHeaderName( "Common", f4_local4 ) ) end for f4_local4 = 1, Leaderboards.GetLeaderboardNumColumns( f4_arg0.leaderboardType ), 1 do f4_local3[f4_local1 + f4_local4] = Engine.Localize( Leaderboards.GetLeaderboardHeaderName( f4_arg0.leaderboardType, f4_local4 ) ) end local f4_local4 = {} for f4_local5 = 1, f4_local1, 1 do f4_local4[f4_local5] = Leaderboards.GetLeaderboardColumnWidth( "Common", f4_local5 ) end for f4_local5 = 1, Leaderboards.GetLeaderboardNumColumns( f4_arg0.leaderboardType ), 1 do f4_local4[f4_local1 + f4_local5] = Leaderboards.GetLeaderboardColumnWidth( f4_arg0.leaderboardType, f4_local5 ) end for f4_local5 = 1, f4_local2, 1 do f4_local0[#f4_local0 + 1] = { type = "UIText", id = "leaderboard_header_name_" .. f4_local5, properties = { text = f4_local3[f4_local5] }, states = { default = { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = false, top = -CoD.TextSettings.SmallFont.Height - 10, bottom = -10, left = 0, right = f4_local4[f4_local5], alignment = LUI.Alignment.Left, font = CoD.TextSettings.SmallFont.Font, red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b } } } end return f4_local0 end function LeaderboardPlayerRowFeeder( f5_arg0 ) local f5_local0 = {} local f5_local1 = Leaderboards.GetLeaderboardNumColumns( "Common" ) local f5_local2 = f5_local1 + Leaderboards.GetLeaderboardNumColumns( f5_arg0.leaderboardType ) local f5_local3 = {} for f5_local4 = 1, f5_local1, 1 do f5_local3[f5_local4] = Leaderboards.GetLeaderboardColumnWidth( "Common", f5_local4 ) end for f5_local4 = 1, Leaderboards.GetLeaderboardNumColumns( f5_arg0.leaderboardType ), 1 do f5_local3[f5_local1 + f5_local4] = Leaderboards.GetLeaderboardColumnWidth( f5_arg0.leaderboardType, f5_local4 ) end local f5_local4 = {} for f5_local5 = 1, f5_local1, 1 do f5_local4[f5_local5] = Leaderboards.GetLeaderboardDataColumnIndex( "Common", f5_local5 ) end for f5_local5 = 1, Leaderboards.GetLeaderboardNumColumns( f5_arg0.leaderboardType ), 1 do f5_local4[f5_local1 + f5_local5] = Leaderboards.GetLeaderboardDataColumnIndex( f5_arg0.leaderboardType, f5_local5 ) end for f5_local5 = 1, f5_local2, 1 do local f5_local8 = {} if f5_local4[f5_local5] == 1 then local f5_local9 = f5_arg0.exclusiveController if not f5_local9 then f5_local9 = Engine.GetFirstActiveController() end local f5_local10 = Leaderboards.GetPlayerValue( f5_local9, f5_local4[f5_local5] ) local f5_local11 = Leaderboards.GetPlayerValue( f5_local9, f5_local4[f5_local5] + 1 ) if f5_local11 == nil then f5_local11 = "" end f5_local0[#f5_local0 + 1] = { type = "UIText", id = "leaderboard_cell_value_player_rank_" .. f5_local5, properties = { text = f5_local11 }, states = { default = { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = false, top = -CoD.TextSettings.NormalFont.Height, bottom = 0, left = 0, right = 0.5 * f5_local3[f5_local5], alignment = LUI.Alignment.Left, font = CoD.TextSettings.NormalFont.Font, 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 } } } local f5_local12 = 1 if f5_local10 == nil or f5_local10 == "" then f5_local12 = 0 end f5_local0[#f5_local0 + 1] = { type = "UIImage", id = "leaderboard_cell_value_player_rankicon_" .. f5_local5, properties = { columnIndex = f5_local4[f5_local5] }, states = { default = { topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = false, left = 0, width = 24, height = 24, material = RegisterMaterial( f5_local10 ), animateOnRefresh = true, alpha = f5_local12 } } } f5_local0[#f5_local0 + 1] = { type = "UIImage", states = { default = { topAnchor = true, bottomAnchor = treu, leftAnchor = true, rightAnchor = false, top = 0, bottom = 0, left = 0, right = f5_local3[f5_local5] * 0.5 - 24, alpha = 0 } } } end local f5_local9 = f5_arg0.exclusiveController if not f5_local9 then f5_local9 = Engine.GetFirstActiveController() end local f5_local10 = Leaderboards.GetPlayerValue( f5_local9, f5_local4[f5_local5] ) if f5_local10 == nil then f5_local10 = "" end local f5_local11 = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or Colors.frontend_hilite.r local f5_local13 = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or Colors.frontend_hilite.g local f5_local12 = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or Colors.frontend_hilite.b if f5_local4[f5_local5] == 3 then f5_local0[#f5_local0 + 1] = { type = "mp_leaderboard_cell_marquee_value", id = "leaderboard_cell_value_player_" .. f5_local5, properties = { text = f5_local10, columnWidth = f5_local3[f5_local5] - 10, red = f5_local11, green = f5_local13, blue = f5_local12 } } f5_local0[#f5_local0 + 1] = { type = "UIImage", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = false, top = 0, bottom = 0, left = 0, right = 10, alpha = 0 } } } else f5_local0[#f5_local0 + 1] = { type = "mp_leaderboard_cell_value", id = "leaderboard_cell_value_player_" .. f5_local5, properties = { text = f5_local10, columnWidth = f5_local3[f5_local5], red = f5_local11, green = f5_local13, blue = f5_local12 } } end end return f5_local0 end function mp_leaderboard_cell_value() return { type = "UIText", id = "mp_leaderboard_cell_value", properties = { text = "", columnWidth = 100, red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b }, states = { default = { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = false, top = -CoD.TextSettings.NormalFont.Height, bottom = 0, left = 0, right = MBh.Property( "columnWidth" ), alignment = LUI.Alignment.Left, font = CoD.TextSettings.NormalFont.Font, red = MBh.Property( "red" ), green = MBh.Property( "green" ), blue = MBh.Property( "blue" ) }, hilite = { red = 0, green = 0, blue = 0 } }, handlers = { button_over = MBh.AnimateToState( "hilite" ), button_up = MBh.AnimateToState( "default" ) } } end function HandleLeaderboardCellMarqueeSetHilite( f7_arg0, f7_arg1 ) f7_arg0:SetColor( 0, 0, 0 ) end function HandleLeaderboardCellMarqueeSetNotHilite( f8_arg0, f8_arg1 ) local f8_local0 = f8_arg0.properties f8_arg0:SetColor( f8_local0.red, f8_local0.green, f8_local0.blue ) end function mp_leaderboard_cell_marquee_value() return { type = "UIMarqueeText", id = "mp_leaderboard_cell_marquee_value", properties = { text = "", columnWidth = 100, red = Colors.white.r, green = Colors.white.g, blue = Colors.white.b }, states = { default = { topAnchor = false, bottomAnchor = true, leftAnchor = true, rightAnchor = false, top = -CoD.TextSettings.NormalFont.Height, bottom = 0, left = 0, right = MBh.Property( "columnWidth" ), alignment = LUI.Alignment.Left, font = CoD.TextSettings.NormalFont.Font, red = MBh.Property( "red" ), green = MBh.Property( "green" ), blue = MBh.Property( "blue" ) } }, handlers = { button_over = HandleLeaderboardCellMarqueeSetHilite, button_up = HandleLeaderboardCellMarqueeSetNotHilite } } end f0_local0 = function ( f10_arg0, f10_arg1 ) local f10_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f10_arg0 ) f10_arg0:processEvent( { name = "lose_focus" } ) f10_arg0:clearSavedState() local f10_local1 = false local f10_local2 = f10_arg0:getFirstChild() while f10_local2 do local self = f10_local2:getNextSibling() if f10_local2.properties and f10_local2.properties.rankIndex and f10_local2.properties.rankIndex == f10_local0.newRankIndex then f10_local1 = true f10_local2.listDefaultFocus = true else f10_local2.listDefaultFocus = false end f10_local2 = self end if not f10_local1 then local self = f10_arg0:getFirstChild() while self do local f10_local4 = self:getNextSibling() if self.properties and self.properties.rowIndex and self.properties.rowIndex == 1 then self.listDefaultFocus = true else self.listDefaultFocus = false end self = f10_local4 end end Leaderboards.UpdateCurrentIndex( f10_arg1.controller, f10_local0.newRankIndex ) Leaderboards.UpdateLeaderboard( f10_arg1.controller, f10_local0.newRankIndex ) if f10_local0.readDelayFail then if f10_arg0:getChildById( "leaderboard_changeindex_timer_id" ) == nil then local self = LUI.UITimer.new( 50, { name = "try_change_index", controller = f10_arg1.controller } ) self.id = "leaderboard_changeindex_timer_id" f10_arg0:addElement( self ) end f10_local0.readDelayFail = false else local self = f10_arg0:getChildById( "leaderboard_changeindex_timer_id" ) if self then self:close() end f10_arg0:processEvent( { name = "leaderboard_refresh" } ) end end f0_local1 = function ( f11_arg0, f11_arg1, f11_arg2, f11_arg3 ) local f11_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f11_arg0 ) f11_local0.currentRankIndex = f11_arg3 f11_local0.newRankIndex = f11_arg2 f11_arg0:processEvent( { name = "try_change_index", controller = f11_arg1 } ) end function HandleLeaderboardWrap( f12_arg0, f12_arg1 ) local f12_local0 = f12_arg0.properties.exclusiveController if not f12_local0 then f12_local0 = Engine.GetFirstActiveController() end f0_local1( f12_arg0:getParent(), f12_local0, f12_arg0.properties.index, Leaderboards.GetCurrentIndex( f12_local0 ) ) end function LeaderboardSelectAction( f13_arg0, f13_arg1 ) if Engine.IsPS3() or Engine.IsPS4() then return end local f13_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" ) f13_local0.selectedRowIndex = f13_arg0.properties.rankIndex local f13_local1 = f13_arg0.properties.exclusiveController if not f13_local1 then f13_local1 = Engine.GetFirstActiveController() end Leaderboards.UpdateCurrentIndex( f13_local1, f13_arg0.properties.rankIndex ) Leaderboards.OnSelect( f13_local1 ) end f0_local2 = function ( f14_arg0, f14_arg1 ) local f14_local0 = Engine.GetLuiRoot() local f14_local1 = "" if f14_local0 then local f14_local2 = LUI.FlowManager.GetTopMenuInfo( f14_local0.flowManager.menuInfoStack ) if f14_local2 and f14_local2.name then f14_local1 = f14_local2.name end end if f14_local1 == "mp_leaderboard_main" and f14_arg1.down == true then local f14_local2 = f14_arg0.properties.exclusiveController if not f14_local2 then f14_local2 = Engine.GetFirstActiveController() end local f14_local3 = Leaderboards.GetCurrentIndex( f14_local2 ) local f14_local4 = Leaderboards.GetPlayerCount() local f14_local5 if f14_arg1.button ~= "dpad_up" and f14_arg1.button ~= "page_up" and (f14_arg1.button ~= "up" or f14_arg1.qualifier ~= "dpad") then f14_local5 = false else f14_local5 = true end local f14_local6 if f14_arg1.button ~= "dpad_down" and f14_arg1.button ~= "page_down" and (f14_arg1.button ~= "down" or f14_arg1.qualifier ~= "dpad") then f14_local6 = false else f14_local6 = true end if f14_local5 then if Leaderboards.IsUpdating and Leaderboards.IsUpdating() then return true elseif f14_local4 <= 0 then return true elseif f14_local3 == 0 then return true end local self = f14_local3 - Leaderboards.Layout.NumRows - 1 if self < 0 then self = 0 end f0_local1( f14_arg0, f14_local2, self, f14_local3 ) return true elseif f14_local6 then if Leaderboards.IsUpdating and Leaderboards.IsUpdating() then return true elseif f14_local4 <= 0 then return true elseif f14_local3 == f14_local4 - 1 then return true end local self = f14_local3 + Leaderboards.Layout.NumRows - 1 if f14_local4 - 1 < self then self = f14_local4 - 1 end f0_local1( f14_arg0, f14_local2, self, f14_local3 ) return true elseif f14_arg1.button == "up" then if Leaderboards.IsUpdating and Leaderboards.IsUpdating() then return true elseif f14_local4 <= 0 then return true elseif f14_arg0:getChildById( "leaderboard_scrolldelay_timer_id" ) then return true end local self = LUI.UITimer.new( 50, { name = "scroll_delay_complete" }, nil, true ) self.id = "leaderboard_scrolldelay_timer_id" f14_arg0:addElement( self ) local f14_local8 = f14_local3 - 1 if f14_local8 < 0 then f14_local8 = f14_local4 - 1 end f0_local1( f14_arg0, f14_local2, f14_local8, f14_local3 ) return true elseif f14_arg1.button == "down" then if Leaderboards.IsUpdating and Leaderboards.IsUpdating() then return true elseif f14_local4 <= 0 then return true elseif f14_arg0:getChildById( "leaderboard_scrolldelay_timer_id" ) then return true end local self = LUI.UITimer.new( 50, { name = "scroll_delay_complete" }, nil, true ) self.id = "leaderboard_scrolldelay_timer_id" f14_arg0:addElement( self ) local f14_local8 = f14_local3 + 1 if f14_local4 - 1 < f14_local8 then f14_local8 = 0 end f0_local1( f14_arg0, f14_local2, f14_local8, f14_local3 ) return true elseif f14_arg1.button == "home" then f0_local1( f14_arg0, f14_local2, 0, f14_local3 ) return true end end return LUI.UIButton.GamepadButton( f14_arg0, f14_arg1 ) end function LeaderboardRankIconRefresh( f15_arg0, f15_arg1 ) local f15_local0 = f15_arg0.properties local f15_local1 = f15_arg0.properties.exclusiveController if not f15_local1 then f15_local1 = Engine.GetFirstActiveController() end local f15_local2 = Leaderboards.GetValue( f15_local1, f15_local0.rankIndex, f15_local0.columnIndex ) if f15_local2 == nil or f15_local2 == "" then f15_arg0:animateToState( "hidden" ) else f15_arg0:setImage( RegisterMaterial( f15_local2 ) ) if f15_arg0.properties.focusable then f15_arg0:animateToState( "default" ) else f15_arg0:animateToState( "hidden" ) end end end function LeaderboardLineButtonFeeder( f16_arg0 ) local f16_local0 = {} local f16_local1 = Leaderboards.GetLeaderboardNumColumns( "Common" ) local f16_local2 = f16_local1 + Leaderboards.GetLeaderboardNumColumns( f16_arg0.leaderboardType ) local f16_local3 = {} for f16_local4 = 1, f16_local1, 1 do f16_local3[f16_local4] = Leaderboards.GetLeaderboardColumnWidth( "Common", f16_local4 ) end for f16_local4 = 1, Leaderboards.GetLeaderboardNumColumns( f16_arg0.leaderboardType ), 1 do f16_local3[f16_local1 + f16_local4] = Leaderboards.GetLeaderboardColumnWidth( f16_arg0.leaderboardType, f16_local4 ) end local f16_local4 = {} for f16_local5 = 1, f16_local1, 1 do f16_local4[f16_local5] = Leaderboards.GetLeaderboardDataColumnIndex( "Common", f16_local5 ) end for f16_local5 = 1, Leaderboards.GetLeaderboardNumColumns( f16_arg0.leaderboardType ), 1 do f16_local4[f16_local1 + f16_local5] = Leaderboards.GetLeaderboardDataColumnIndex( f16_arg0.leaderboardType, f16_local5 ) end for f16_local5 = 1, f16_local2, 1 do if f16_local4[f16_local5] == 1 then local f16_local8 = f16_arg0.exclusiveController if not f16_local8 then f16_local8 = Engine.GetFirstActiveController() end local f16_local9 = Leaderboards.GetValue( f16_local8, f16_arg0.rankIndex, f16_local4[f16_local5] ) local f16_local10 = Leaderboards.GetValue( f16_local8, f16_arg0.rankIndex, f16_local4[f16_local5] + 1 ) if f16_arg0.memTest == true then f16_local10 = "99" f16_local9 = "rank_pvt1" end f16_local0[#f16_local0 + 1] = { type = "mp_leaderboard_cell_value", id = "leaderboard_cell_value_rank_" .. f16_local5, properties = { text = f16_local10, columnWidth = 0.5 * f16_local3[f16_local5] } } local f16_local11 = RegisterMaterial( f16_local9 ) f16_local0[#f16_local0 + 1] = { type = "UIImage", id = "leaderboard_cell_value_rankicon_" .. f16_local5, properties = { rankIndex = f16_arg0.rankIndex, columnIndex = f16_local4[f16_local5], focusable = f16_arg0.focusable }, states = { default = { topAnchor = false, bottomAnchor = false, leftAnchor = true, rightAnchor = false, left = 0, width = 24, height = 24, alpha = 1 }, hidden = { alpha = 0 } }, handlers = { leaderboard_update_elements = LeaderboardRankIconRefresh, menu_create = LeaderboardRankIconRefresh } } f16_local0[#f16_local0 + 1] = { type = "UIImage", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = false, top = 0, bottom = 0, left = 0, right = f16_local3[f16_local5] * 0.5 - 24, alpha = 0 } } } end local f16_local8 = "0" if f16_arg0.memTest == true then if f16_local4[f16_local5] == 0 then f16_local8 = "00000000" elseif f16_local4[f16_local5] == 3 then f16_local8 = "WWWWWWWWWWWWWWWW" end else local f16_local9 = f16_arg0.exclusiveController if not f16_local9 then f16_local9 = Engine.GetFirstActiveController() end f16_local8 = Leaderboards.GetValue( f16_local9, f16_arg0.rankIndex, f16_local4[f16_local5] ) end if f16_local4[f16_local5] == 3 then f16_local0[#f16_local0 + 1] = { type = "mp_leaderboard_cell_marquee_value", id = "leaderboard_cell_value_" .. f16_local5, properties = { text = f16_local8, columnWidth = f16_local3[f16_local5] - 10 } } f16_local0[#f16_local0 + 1] = { type = "UIImage", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = false, top = 0, bottom = 0, left = 0, right = 10, alpha = 0 } } } else f16_local0[#f16_local0 + 1] = { type = "mp_leaderboard_cell_value", id = "leaderboard_cell_value_" .. f16_local5, properties = { text = f16_local8, columnWidth = f16_local3[f16_local5] } } end end return f16_local0 end function mp_leaderboard_line_button() return { type = "UIButton", id = "mp_leaderboard_line_button", properties = { rankIndex = 0, leaderboardType = "Kills", memTest = false, focusable = false }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, bottom = Leaderboards.Layout.RowHeight, left = 0, right = 0 } }, handlers = { button_action = LeaderboardSelectAction, leaderboard_update_elements = LeaderboardButtonSetFocusable }, children = { { type = "UIImage", id = "leaderboard_row_hilite", states = { default = CoD.ColorizeState( Colors.white, { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0, red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or 1, green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or 1, blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or 1, material = RegisterMaterial( "white" ), alpha = 0 } ), dim = { red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or 1, green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or 1, blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or 1, alpha = 0.5 }, focus = { red = Engine.IsAliensMode() and Colors.alien_frontend_hilite.r or 1, green = Engine.IsAliensMode() and Colors.alien_frontend_hilite.g or 1, blue = Engine.IsAliensMode() and Colors.alien_frontend_hilite.b or 1, alpha = 0.8 } }, handlers = { button_over = MBh.AnimateLoop( { { "focus", 0 }, { "dim", 750 }, { "focus", 750 } } ), button_up = MBh.AnimateToState( "default" ), lose_focus = MBh.AnimateToState( "default" ) } }, { type = "UIHorizontalList", id = "leaderboard_row", properties = { rankIndex = MBh.Property( "rankIndex" ), leaderboardType = MBh.Property( "leaderboardType" ), memTest = MBh.Property( "memTest" ), focusable = MBh.Property( "focusable" ) }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, bottom = Leaderboards.Layout.RowHeight, left = 5, right = 0 } }, childrenFeeder = LeaderboardLineButtonFeeder } } } end local f0_local3 = function ( f18_arg0, f18_arg1, f18_arg2 ) local f18_local0 = Leaderboards.GetOffset( f18_arg0 ) local f18_local1 = 0 if f18_arg2 <= Leaderboards.Layout.NumRows - 1 then f18_local1 = 0 else f18_local1 = f18_arg1 - Leaderboards.Layout.NumRows / 2 - 1 if f18_local1 < f18_local0 then f18_local1 = f18_local0 elseif f18_arg2 - Leaderboards.Layout.NumRows - 1 < f18_local1 then f18_local1 = f18_arg2 - Leaderboards.Layout.NumRows - 1 end end return f18_local1 end function LeaderboardDataListRowFeeder( f19_arg0 ) local f19_local0 = {} local f19_local1 = 0 local f19_local2 = 0 local f19_local3 = 0 if f19_arg0.memTest == true then f19_local1 = 200 f19_local2 = 0 f19_local3 = 25 else f19_local1 = Leaderboards.GetPlayerCount() local f19_local4 = f19_arg0.exclusiveController if not f19_local4 then f19_local4 = Engine.GetFirstActiveController() end f19_local3 = Leaderboards.GetCurrentIndex( f19_local4 ) f19_local2 = f0_local3( f19_local4, f19_local3, f19_local1 ) end for f19_local4 = 1, Leaderboards.Layout.NumRows - 1, 1 do local f19_local7 = f19_local2 + f19_local4 - 1 local f19_local8 = f19_local7 < f19_local1 local f19_local9 = nil if f19_local7 == f19_local3 then f19_local9 = true end f19_local0[#f19_local0 + 1] = { type = "mp_leaderboard_line_button", id = "leaderboard_button_" .. f19_local4, listDefaultFocus = f19_local9, focusable = f19_local8, disabled = not f19_local8, properties = { rowIndex = f19_local4, rankIndex = f19_local7, leaderboardType = f19_arg0.leaderboardType, memTest = f19_arg0.memTest, focusable = f19_local8 } } end return f19_local0 end function LeaderboardVertStripeFeeder( f20_arg0 ) local f20_local0 = {} local f20_local1 = Leaderboards.GetLeaderboardNumColumns( "Common" ) local f20_local2 = f20_local1 + Leaderboards.GetLeaderboardNumColumns( f20_arg0.leaderboardType ) local f20_local3 = {} for f20_local4 = 1, f20_local1, 1 do f20_local3[f20_local4] = Leaderboards.GetLeaderboardColumnWidth( "Common", f20_local4 ) end for f20_local4 = 1, Leaderboards.GetLeaderboardNumColumns( f20_arg0.leaderboardType ), 1 do f20_local3[f20_local1 + f20_local4] = Leaderboards.GetLeaderboardColumnWidth( f20_arg0.leaderboardType, f20_local4 ) end local f20_local4 = {} for f20_local5 = 1, f20_local2, 1 do local f20_local8 = 0 if f20_local5 % 2 == 0 then f20_local8 = 0.15 end f20_local0[#f20_local0 + 1] = { type = "UIImage", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = false, top = 0, bottom = 0, left = 0, right = f20_local3[f20_local5], material = RegisterMaterial( "white" ), red = 0, green = 0, blue = 0, alpha = f20_local8 } }, id = "vert_stripe_" .. f20_local5 } end return f20_local0 end function mp_leaderboard_page_bg() return { type = "UIVerticalList", id = "mp_leaderboard_page_bg_id", states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, bottom = Leaderboards.Layout.HeaderHeight + Leaderboards.Layout.RowHeight * Leaderboards.Layout.NumRows, left = 1, right = -1 } }, childrenFeeder = LeaderboardListRowFeeder } end function mp_leaderboard_page_vert_stripes() return { type = "UIHorizontalList", id = "mp_leaderboard_page_vert_stripes_id", properties = { leaderboardType = "Kills" }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, bottom = Leaderboards.Layout.HeaderHeight + Leaderboards.Layout.RowHeight * Leaderboards.Layout.NumRows, left = 1, right = -1 } }, childrenFeeder = LeaderboardVertStripeFeeder } end local f0_local4 = function ( f23_arg0, f23_arg1 ) f23_arg0:clearSavedState() end local f0_local5 = function ( f24_arg0, f24_arg1 ) local f24_local0 = f24_arg0:getFirstChild() while f24_local0 do local f24_local1 = f24_local0:getNextSibling() f24_local0.listDefaultFocus = false if f24_local0.properties and f24_local0.properties.rowIndex == 1 then f24_local0.listDefaultFocus = true end f24_local0 = f24_local1 end end local f0_local6 = function ( f25_arg0, f25_arg1 ) collectgarbage( "collect" ) local f25_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f25_arg0 ) f25_local0.readDelayFail = false f25_arg0:processEvent( { name = "lose_focus" } ) f25_arg0:processEvent( { name = "menu_refresh" } ) f25_arg0:processEvent( { name = "leaderboard_update_elements", dispatchChildren = true } ) f25_arg0:processEvent( { name = "update_navigation", dispatchChildren = true } ) local f25_local1 = f25_arg0.properties.exclusiveController if not f25_local1 then f25_local1 = Engine.GetFirstActiveController() end local f25_local2 = Leaderboards.GetCurrentIndex( f25_local1 ) local f25_local3 = f25_arg0:getFirstChild() while f25_local3 do local f25_local4 = f25_local3:getNextSibling() f25_local3.listDefaultFocus = false if f25_local3:isInFocus() then f25_local3:processEvent( { name = "lose_focus" } ) end if f25_local3.properties and f25_local3.properties.rankIndex == f25_local2 then f25_local3:processEvent( { name = "gain_focus" } ) f25_local3.listDefaultFocus = true end f25_local3 = f25_local4 end if f25_local0.scrollbar then local f25_local4 = Leaderboards.GetPlayerCount() local f25_local5 = f0_local3( f25_local1, Leaderboards.GetCurrentIndex( f25_local1 ), f25_local4 ) if f25_local4 <= Leaderboards.Layout.NumRows then f25_local0.scrollbar:processEvent( { name = "hide_scrollbar", immediate = true } ) else f25_local0.scrollbar:processEvent( { name = "show_scrollbar", immediate = true } ) f25_local0.scrollbar:manualUpdate( f25_local5, Leaderboards.Layout.NumRows, f25_local4, Leaderboards.Layout.RowHeight ) end end end function LeaderboardClose( f26_arg0, f26_arg1 ) if Leaderboards.Clear then Leaderboards.Clear() end LUI.FlowManager.RequestLeaveMenu( f26_arg0 ) end function mp_leaderboard_page_data() return { type = "UIElement", id = "mp_leaderboard_page_data_id", properties = { leaderboardType = "Kills", filterType = "Friends", memTest = false }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, bottom = Leaderboards.Layout.HeaderHeight + Leaderboards.Layout.RowHeight * Leaderboards.Layout.NumRows, left = 1, right = -1 } }, handlers = { menu_create = function ( f28_arg0, f28_arg1 ) if f28_arg0.properties and not f28_arg0.properties.memTest then local f28_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f28_arg0 ) f28_local0.scrollbar = f28_arg0:getFirstDescendentById( "scrollbar" ) f28_local0.leaderboardType = f28_arg0.properties.leaderboardType local f28_local1 = Leaderboards.GetLeaderboardDefaultDurationKey( f28_arg0.properties.leaderboardType ) if f28_local1 == nil or f28_local1 == "" then local f28_local2 = Leaderboards.LeaderboardFilterGetDurationKeys( f28_arg0.properties.leaderboardType ) if #f28_local2 > 0 then f28_local1 = f28_local2[1] else f28_local1 = "" end end local f28_local2 = false if Engine.GetDvarBool( "g_hardcore" ) and Leaderboards.GetLeaderboardHasHardcoreMode( f28_arg0.properties.leaderboardType ) then f28_local2 = true end if f28_local0.isPublicLobbyLeaderboard and Engine.IsAliensMode() and Leaderboards.GetLeaderboardHasHardcoreMode( f28_arg0.properties.leaderboardType ) and LUI.mp_menus.Aliens.ExtinctionDetermineDifficulty() == LUI.mp_menus.Aliens.ExtinctionDifficluty.Hard then f28_local2 = true end Leaderboards.OpenLeaderboard( f28_arg0, f28_arg0.properties.leaderboardType, f28_arg0.properties.filterType, f28_local1, f28_local2 ) Leaderboards.Refresh() end end }, children = { { type = "UIHorizontalList", id = "mp_leaderboard_page_header_id", properties = { leaderboardType = MBh.Property( "leaderboardType" ) }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, bottom = Leaderboards.Layout.HeaderHeight, left = 0, right = 0 } }, handlers = { leaderboard_refresh = MBh.EmitEvent( "menu_refresh" ) }, childrenFeeder = LeaderboardHeaderRowFeeder }, { type = "UIHorizontalList", id = "mp_leaderboard_page_player_id", properties = { leaderboardType = MBh.Property( "leaderboardType" ) }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = Leaderboards.Layout.HeaderHeight, bottom = Leaderboards.Layout.HeaderHeight + Leaderboards.Layout.RowHeight, left = 5, right = -10 } }, handlers = { leaderboard_refresh = MBh.EmitEvent( "menu_refresh" ) }, childrenFeeder = LeaderboardPlayerRowFeeder }, { type = "UIStencil", id = "mp_leaderboard_page_stencil_id", properties = { leaderboardType = MBh.Property( "leaderboardType" ), memTest = MBh.Property( "memTest" ) }, states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = Leaderboards.Layout.HeaderHeight + Leaderboards.Layout.RowHeight, bottom = 0, left = 0, right = -10 } }, children = { { type = "UIVerticalList", id = "mp_leaderboard_page_list_id", properties = { leaderboardType = MBh.Property( "leaderboardType" ), memTest = MBh.Property( "memTest" ), disableOutsideChildren = true }, states = { default = { topAnchor = true, bottomAnchor = false, leftAnchor = true, rightAnchor = true, top = 0, bottom = Leaderboards.Layout.RowHeight * (Leaderboards.Layout.NumRows - 1), left = 0, right = -10 } }, handlers = { leaderboard_clear = f0_local5, leaderboard_refresh = f0_local6, leaderboard_read_delayfail = function ( f29_arg0, f29_arg1 ) local f29_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f29_arg0 ) f29_local0.readDelayFail = true end , menu_create = function ( f30_arg0, f30_arg1 ) local f30_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f30_arg0 ) f30_local0.readDelayFail = false f30_local0.leaderboardList = f30_arg0 end , try_change_index = f0_local0, gamepad_button = f0_local2 }, childrenFeeder = LeaderboardDataListRowFeeder } } }, { type = "UIVerticalScrollbar", id = "scrollbar", properties = { on_move_func = function ( f31_arg0, f31_arg1, f31_arg2, f31_arg3 ) local f31_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f31_arg0 ) local f31_local1 = Leaderboards.GetPlayerCount() local f31_local2 = LUI.clamp( math.floor( f31_arg2 * f31_local1 ), 0, math.max( 0, f31_local1 - Leaderboards.Layout.NumRows ) ) local f31_local3 = f31_arg3.exclusiveController if not f31_local3 then f31_local3 = Engine.GetFirstActiveController() end f0_local1( f31_local0.leaderboardList, f31_local3, f31_local2, Leaderboards.GetCurrentIndex( f31_local3 ) ) end }, states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = false, rightAnchor = true, top = Leaderboards.Layout.HeaderHeight, bottom = 0, left = -14, right = -2, alpha = 1 }, visible = { alpha = 1 }, hidden = { alpha = 0 } }, handlers = { hide_scrollbar = MBh.AnimateToState( "hidden", 0 ), show_scrollbar = MBh.AnimateToState( "visible", 0 ), init_scrollbar = function ( f32_arg0, f32_arg1 ) local f32_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f32_arg0 ) f32_arg0:manualUpdate( 0, Leaderboards.Layout.NumRows, 100, Leaderboards.Layout.RowHeight ) end }, children = { { type = "UITimer", properties = { event = "init_scrollbar", interval = 1, disposable = true, deferNextFrame = true } } } } } } end function LeaderboardGoToTop( f33_arg0, f33_arg1 ) local f33_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f33_arg0 ) local f33_local1 = f33_arg0.properties.exclusiveController if not f33_local1 then f33_local1 = Engine.GetFirstActiveController() end f0_local1( f33_local0.leaderboardList, f33_local1, 0, Leaderboards.GetCurrentIndex( f33_local1 ) ) end function LeaderboardPageUp( f34_arg0, f34_arg1 ) local f34_local0 = f34_arg0.properties.exclusiveController if not f34_local0 then f34_local0 = Engine.GetFirstActiveController() end local f34_local1 = Leaderboards.GetCurrentIndex( f34_local0 ) if f34_local1 == 0 then return end local f34_local2 = f34_local1 - Leaderboards.Layout.NumRows - 1 if f34_local2 < 0 then f34_local2 = 0 end f0_local1( scoped.leaderboardList, f34_local0, f34_local2, f34_local1 ) end function LeaderboardPageDown( f35_arg0, f35_arg1 ) local f35_local0 = f35_arg0.properties.exclusiveController if not f35_local0 then f35_local0 = Engine.GetFirstActiveController() end local f35_local1 = Leaderboards.GetCurrentIndex( f35_local0 ) if f35_local1 == count - 1 then return end newIdx = f35_local1 + Leaderboards.Layout.NumRows - 1 if count - 1 < newIdx then newIdx = count - 1 end f0_local1( scoped.leaderboardList, f35_local0, newIdx, f35_local1 ) end function LeaderboardOpenFiltersMenu( f36_arg0, f36_arg1 ) LUI.FlowManager.RequestPopupMenu( f36_arg0, "mp_leaderboard_filters_popup", true, f36_arg1.controller, false, {} ) end function LeaderboardMainFeeder( f37_arg0 ) local f37_local0 = { [#f37_local0 + 1] = { type = "generic_drop_shadow", properties = { offset_shadow = 0 } }, [#f37_local0 + 1] = { type = "generic_menu_background", id = "leaderboard_border", properties = { fill_alpha = 1 } }, [#f37_local0 + 1] = { type = "aar_title_bar", id = "leaderboard_title_bar_id", properties = { title_text = Engine.Localize( "@LUA_MENU_LEADERBOARDS_CAPS" ), subtitle_text = Engine.Localize( Leaderboards.GetLeaderboardFilterTitle( f37_arg0.filterType ), Engine.Localize( Leaderboards.GetLeaderboardTitle( f37_arg0.leaderboardType ) ) ), subtitle_banner_width = Leaderboards.Layout.SubtitleBannerWidth } }, [#f37_local0 + 1] = { type = "UIElement", states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = AAR.Layout.TitleBarHeight + AAR.Layout.SubTitleBarHeight, bottom = 0, left = 1, right = -1 } }, children = { { type = "mp_leaderboard_page_bg" }, { type = "mp_leaderboard_page_vert_stripes", properties = { leaderboardType = f37_arg0.leaderboardType } }, { type = "mp_leaderboard_page_data", properties = { leaderboardType = f37_arg0.leaderboardType, filterType = f37_arg0.filterType } }, { type = "button_helper_text_main", id = "help_texts", properties = { left_inset = 10, top_margin = GenericFooterDims.TopMargin_WithoutBackground, background_alpha = 0, height = AAR.Layout.FooterHeight - 1, spacing = 65 } }, { type = "UIBindButton", id = "leaderboard_bind_buttons_id", handlers = { button_secondary = LeaderboardClose, button_alt1 = LeaderboardGoToTop, button_alt2 = LeaderboardOpenFiltersMenu, button_dpad_up = LeaderboardPageUp, button_dpad_down = LeaderboardPageDown } } } } } return f37_local0 end function LeaderboardMainCreate( f38_arg0, f38_arg1 ) f38_arg0:processEvent( { name = "add_button_helper_text", button_ref = "button_secondary", helper_text = Engine.Localize( "@LUA_MENU_BACK" ), side = "left", clickable = true } ) if Engine.IsGamepadEnabled() == 1 and not Engine.IsPS3() and not Engine.IsPS4() then f38_arg0:processEvent( { name = "add_button_helper_text", button_ref = "button_action", helper_text = Engine.Localize( "@LUA_MENU_SELECT" ), side = "left", clickable = true } ) end f38_arg0:processEvent( { name = "add_button_helper_text", button_ref = "button_alt2", helper_text = Engine.Localize( "@LUA_MENU_FILTER" ), side = "left", clickable = true } ) if Engine.IsConsoleGame() or Engine.IsGamepadEnabled() == 1 then f38_arg0:processEvent( { name = "add_button_helper_text", button_ref = "button_alt1", helper_text = Engine.Localize( "@LUA_MENU_TOP" ), side = "left", clickable = true } ) f38_arg0:processEvent( { name = "add_button_helper_text", button_ref = "button_dpad_up", helper_text = Engine.Localize( "@LUA_MENU_PAGE_UP" ), side = "left", clickable = true } ) f38_arg0:processEvent( { name = "add_button_helper_text", button_ref = "button_dpad_down", helper_text = Engine.Localize( "@LUA_MENU_PAGE_DOWN" ), side = "left", clickable = true } ) else f38_arg0:processEvent( { name = "add_button_helper_text", button_ref = "button_home", helper_text = Engine.Localize( "@LUA_MENU_TOP" ), side = "left", clickable = true } ) f38_arg0:processEvent( { name = "add_button_helper_text", button_ref = "button_page_up", helper_text = Engine.Localize( "@LUA_MENU_PAGE_UP" ), side = "left", clickable = true } ) f38_arg0:processEvent( { name = "add_button_helper_text", button_ref = "button_page_down", helper_text = Engine.Localize( "@LUA_MENU_PAGE_DOWN" ), side = "left", clickable = true } ) end end function mp_leaderboard_main() return { type = "UIElement", id = "mp_leaderboard_main_id", properties = { leaderboardType = "Kills", filterType = "Friends" }, states = { default = { topAnchor = true, bottomAnchor = true, leftAnchor = true, rightAnchor = true, top = 0, bottom = 0, left = 0, right = 0 } }, handlers = { leaderboard_clear = f0_local4 }, children = { { type = "UIImage", id = "darken_bg", 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 = "mp_leaderboard_main_popup_id", properties = { leaderboardType = MBh.Property( "leaderboardType" ), filterType = MBh.Property( "filterType" ) }, states = { default = { topAnchor = false, bottomAnchor = false, leftAnchor = false, rightAnchor = false, top = -1 * (AAR.Layout.TitleBarHeight + AAR.Layout.SubTitleBarHeight + Leaderboards.Layout.HeaderHeight + Leaderboards.Layout.RowHeight * Leaderboards.Layout.NumRows + AAR.Layout.FooterHeight) * 0.5, bottom = (AAR.Layout.TitleBarHeight + AAR.Layout.SubTitleBarHeight + Leaderboards.Layout.HeaderHeight + Leaderboards.Layout.RowHeight * Leaderboards.Layout.NumRows + AAR.Layout.FooterHeight) * 0.5, left = -1 * Leaderboards.Layout.Width * 0.5, right = Leaderboards.Layout.Width * 0.5 } }, handlers = { menu_create = LeaderboardMainCreate }, childrenFeeder = LeaderboardMainFeeder } } } end LUI.MenuBuilder.registerDef( "mp_leaderboard_main", mp_leaderboard_main ) LUI.FlowManager.RegisterStackPopBehaviour( "mp_leaderboard_main", LeaderboardPop ) LUI.MenuBuilder.registerDef( "mp_leaderboard_page_bg", mp_leaderboard_page_bg ) LUI.MenuBuilder.registerDef( "mp_leaderboard_page_vert_stripes", mp_leaderboard_page_vert_stripes ) LUI.MenuBuilder.registerDef( "mp_leaderboard_page_data", mp_leaderboard_page_data ) LUI.MenuBuilder.registerDef( "mp_leaderboard_cell_value", mp_leaderboard_cell_value ) LUI.MenuBuilder.registerDef( "mp_leaderboard_cell_marquee_value", mp_leaderboard_cell_marquee_value ) LUI.MenuBuilder.registerDef( "mp_leaderboard_line_button", mp_leaderboard_line_button ) LockTable( _M )