422 lines
13 KiB
Lua
422 lines
13 KiB
Lua
function FiltersPopupClose( f1_arg0, f1_arg1 )
|
|
local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 )
|
|
local f1_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" )
|
|
local f1_local2 = f1_local1.leaderboardType
|
|
if f1_local2 and f1_local2 ~= "" then
|
|
Leaderboards.OpenLeaderboard( f1_arg0, f1_local2, f1_local0.filterKey, f1_local1.filterDurationKey, f1_local1.isHardcore )
|
|
end
|
|
end
|
|
|
|
function LeaderboardFilterGetGroupKeys( f2_arg0 )
|
|
local f2_local0 = {
|
|
[#f2_local0 + 1] = "None",
|
|
[#f2_local0 + 1] = "Friends"
|
|
}
|
|
local f2_local1 = f2_arg0.properties.exclusiveController
|
|
if not f2_local1 then
|
|
f2_local1 = Engine.GetFirstActiveController()
|
|
end
|
|
if f2_local1 then
|
|
if Friends.IsEliteClanAllowed( f2_local1 ) and Friends.EliteClanIsMember( f2_local1 ) then
|
|
f2_local0[#f2_local0 + 1] = "Clan"
|
|
end
|
|
if Engine.GetDvarInt( "party_matchedPlayerCount" ) <= Engine.GetDvarInt( "party_partyPlayerCountNum" ) then
|
|
f2_local0[#f2_local0 + 1] = "LobbyMembers"
|
|
end
|
|
end
|
|
return f2_local0
|
|
end
|
|
|
|
function LeaderboardActionsFeeder( f3_arg0 )
|
|
local f3_local0 = {}
|
|
local f3_local1 = Engine.IsXbox360()
|
|
if not f3_local1 then
|
|
f3_local1 = Engine.IsXB3()
|
|
end
|
|
if f3_local1 then
|
|
f3_local0[#f3_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 ( f4_arg0, f4_arg1 )
|
|
Leaderboards.ShowGamercard( f4_arg1.controller )
|
|
end
|
|
}
|
|
}
|
|
end
|
|
if not Engine.IsPS4() and not Engine.IsPS3() then
|
|
local f3_local2 = #f3_local0 + 1
|
|
local f3_local3 = {
|
|
type = "UIGenericButton",
|
|
id = "friendrequest"
|
|
}
|
|
local f3_local4 = Leaderboards.IsPlayerMe( f3_arg0.exclusiveController )
|
|
if not f3_local4 then
|
|
f3_local4 = Leaderboards.IsPlayerAFriend( f3_arg0.exclusiveController )
|
|
end
|
|
f3_local3.disabled = f3_local4
|
|
f3_local3.properties = {
|
|
style = GenericButtonSettings.Styles.GlassButton,
|
|
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
|
|
button_text = Engine.Localize( "@MENU_FRIEND_REQUEST" ),
|
|
button_action_func = function ( f5_arg0, f5_arg1 )
|
|
Leaderboards.SendFriendRequest( f5_arg1.controller )
|
|
end
|
|
}
|
|
f3_local0[f3_local2] = f3_local3
|
|
end
|
|
return f3_local0
|
|
end
|
|
|
|
function PushLeaderboardFilter()
|
|
local f6_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_filters_popup" )
|
|
f6_local0.filterKey = "None"
|
|
for f6_local4, f6_local5 in pairs( Leaderboards.Filters ) do
|
|
if f6_local5.Value == Engine.GetDvarString( "lb_filter" ) then
|
|
f6_local0.filterKey = f6_local4
|
|
break
|
|
end
|
|
end
|
|
end
|
|
|
|
function LeaderboardFiltersPopupItems( f7_arg0 )
|
|
local f7_local0 = {
|
|
[#f7_local0 + 1] = {
|
|
type = "UIGenericButton",
|
|
id = "leaderboard_filters_1",
|
|
properties = {
|
|
style = GenericButtonSettings.Styles.GlassButton,
|
|
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu,
|
|
variant = GenericButtonSettings.Variants.Select,
|
|
button_text = Engine.Localize( "@LUA_MENU_GROUP_CAPS" ),
|
|
button_display_func = function ( f8_arg0, f8_arg1 )
|
|
local f8_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f8_arg0 )
|
|
return Engine.Localize( Leaderboards.GetLeaderboardFilterOptionText( f8_local0.filterKey ) )
|
|
end,
|
|
button_left_func = function ( f9_arg0, f9_arg1 )
|
|
local f9_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f9_arg0 )
|
|
local f9_local1 = LeaderboardFilterGetGroupKeys( f9_arg0 )
|
|
local f9_local2 = 1
|
|
for f9_local3 = 1, #f9_local1, 1 do
|
|
if f9_local1[f9_local3] == f9_local0.filterKey then
|
|
f9_local2 = f9_local3
|
|
break
|
|
end
|
|
end
|
|
f9_local2 = f9_local2 - 1
|
|
if f9_local2 < 1 then
|
|
f9_local0.filterKey = f9_local1[#f9_local1]
|
|
else
|
|
f9_local0.filterKey = f9_local1[f9_local2]
|
|
end
|
|
end,
|
|
button_right_func = function ( f10_arg0, f10_arg1 )
|
|
local f10_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f10_arg0 )
|
|
local f10_local1 = LeaderboardFilterGetGroupKeys( f10_arg0 )
|
|
local f10_local2 = 1
|
|
for f10_local3 = 1, #f10_local1, 1 do
|
|
if f10_local1[f10_local3] == f10_local0.filterKey then
|
|
f10_local2 = f10_local3
|
|
break
|
|
end
|
|
end
|
|
f10_local2 = f10_local2 + 1
|
|
if #f10_local1 < f10_local2 then
|
|
f10_local0.filterKey = f10_local1[1]
|
|
else
|
|
f10_local0.filterKey = f10_local1[f10_local2]
|
|
end
|
|
end
|
|
}
|
|
},
|
|
[#f7_local0 + 1] = {
|
|
type = "UIGenericButton",
|
|
id = "leaderboard_filters_2",
|
|
properties = {
|
|
style = GenericButtonSettings.Styles.GlassButton,
|
|
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.SubMenu,
|
|
variant = GenericButtonSettings.Variants.Select,
|
|
button_text = Engine.Localize( "@LUA_MENU_DURATION_CAPS" ),
|
|
button_display_func = function ( f11_arg0, f11_arg1 )
|
|
local f11_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f11_arg0 )
|
|
local f11_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" )
|
|
local f11_local2 = f11_local1.leaderboardType
|
|
if f11_local2 == nil or f11_local2 == "" then
|
|
return Engine.Localize( Leaderboards.DurationDefs.Alltime.OptionText )
|
|
else
|
|
local f11_local3 = Leaderboards.GetLeaderboardDurationDef( f11_local2, f11_local1.filterDurationKey )
|
|
if f11_local3 then
|
|
return Engine.Localize( f11_local3.OptionText )
|
|
else
|
|
assert( false, "Leaderboard Filter Duration not found" )
|
|
return Engine.Localize( "@LUA_MENU_DURATION_CAPS" )
|
|
end
|
|
end
|
|
end,
|
|
button_left_func = function ( f12_arg0, f12_arg1 )
|
|
local f12_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f12_arg0 )
|
|
local f12_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" )
|
|
local f12_local2 = f12_local1.leaderboardType
|
|
if f12_local2 and f12_local2 ~= "" then
|
|
local f12_local3 = Leaderboards.LeaderboardFilterGetDurationKeys( f12_local2 )
|
|
local f12_local4 = 1
|
|
for f12_local5 = 1, #f12_local3, 1 do
|
|
if f12_local3[f12_local5] == f12_local1.filterDurationKey then
|
|
f12_local4 = f12_local5
|
|
break
|
|
end
|
|
end
|
|
f12_local4 = f12_local4 - 1
|
|
if f12_local4 < 1 then
|
|
f12_local1.filterDurationKey = f12_local3[#f12_local3]
|
|
end
|
|
f12_local1.filterDurationKey = f12_local3[f12_local4]
|
|
end
|
|
end,
|
|
button_right_func = function ( f13_arg0, f13_arg1 )
|
|
local f13_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f13_arg0 )
|
|
local f13_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" )
|
|
local f13_local2 = f13_local1.leaderboardType
|
|
if f13_local2 and f13_local2 ~= "" then
|
|
local f13_local3 = Leaderboards.LeaderboardFilterGetDurationKeys( f13_local2 )
|
|
local f13_local4 = 1
|
|
for f13_local5 = 1, #f13_local3, 1 do
|
|
if f13_local3[f13_local5] == f13_local1.filterDurationKey then
|
|
f13_local4 = f13_local5
|
|
break
|
|
end
|
|
end
|
|
f13_local4 = f13_local4 + 1
|
|
if #f13_local3 < f13_local4 then
|
|
f13_local1.filterDurationKey = f13_local3[1]
|
|
end
|
|
f13_local1.filterDurationKey = f13_local3[f13_local4]
|
|
end
|
|
end
|
|
}
|
|
}
|
|
}
|
|
if Engine.GetDvarBool( "extinction_hardcore_enabled" ) and not SvS.IsSvS() then
|
|
local f7_local1 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" )
|
|
if Leaderboards.GetLeaderboardHasHardcoreMode( f7_local1.leaderboardType ) then
|
|
f7_local0[#f7_local0 + 1] = {
|
|
type = "UIGenericButton",
|
|
id = "leaderboard_filters_3",
|
|
properties = {
|
|
style = GenericButtonSettings.Styles.GlassButton,
|
|
variant = GenericButtonSettings.Variants.Select,
|
|
button_text = Engine.Localize( "@LUA_MENU_HARDCORE_CAPS" ),
|
|
button_display_func = function ( f14_arg0, f14_arg1 )
|
|
local f14_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" )
|
|
return f14_local0.isHardcore and Engine.Localize( "@MENU_ON" ) or Engine.Localize( "@MENU_OFF" )
|
|
end,
|
|
button_left_func = function ( f15_arg0, f15_arg1 )
|
|
local f15_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" )
|
|
f15_local0.isHardcore = not f15_local0.isHardcore
|
|
end,
|
|
button_right_func = function ( f16_arg0, f16_arg1 )
|
|
local f16_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" )
|
|
f16_local0.isHardcore = not f16_local0.isHardcore
|
|
end
|
|
}
|
|
}
|
|
end
|
|
end
|
|
return f7_local0
|
|
end
|
|
|
|
function mp_leaderboard_actions_popup()
|
|
local f17_local0 = LUI.FlowManager.GetMenuScopedDataByMenuName( "mp_leaderboard_main" )
|
|
local f17_local1 = f17_local0.selectedRowIndex or 0
|
|
local f17_local2 = f17_local0.exclusiveControllerIndex
|
|
if not f17_local2 then
|
|
f17_local2 = Engine.GetFirstActiveController()
|
|
end
|
|
return {
|
|
type = "generic_selectionList_popup",
|
|
id = "mp_leaderboard_actions_popup_id",
|
|
handlers = {
|
|
close_actions = MBh.LeaveMenu()
|
|
},
|
|
properties = {
|
|
popup_title = Leaderboards.GetValue( f17_local2, f17_local1, 3 ),
|
|
popup_childfeeder = LeaderboardActionsFeeder
|
|
},
|
|
states = {
|
|
default = {
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
left = 0,
|
|
right = 0,
|
|
top = 0,
|
|
bottom = 0
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function mp_leaderboard_filters_popup_page()
|
|
return {
|
|
type = "UIElement",
|
|
id = "mp_leaderboard_filters_popup_page_id",
|
|
properties = {},
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
top = AAR.Layout.TitleBarHeight + 1,
|
|
bottom = -1,
|
|
left = 1,
|
|
right = -1
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "UIText",
|
|
id = "leaderboard_filters_instruction",
|
|
properties = {
|
|
text = Engine.Localize( "@LUA_MENU_FILTER_POPUP_INSTR" )
|
|
},
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = false,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
top = 10,
|
|
bottom = 10 + CoD.TextSettings.NormalFont.Height,
|
|
left = 75,
|
|
right = -75,
|
|
alignment = LUI.Alignment.Center,
|
|
font = CoD.TextSettings.NormalFont.Font,
|
|
red = Colors.white.r,
|
|
green = Colors.white.g,
|
|
blue = Colors.white.b
|
|
}
|
|
}
|
|
},
|
|
{
|
|
type = "UIVerticalList",
|
|
id = "leaderboard_filters_popup_vlist",
|
|
properties = {},
|
|
states = {
|
|
default = {
|
|
topAnchor = false,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
top = -90,
|
|
bottom = 0,
|
|
left = 2,
|
|
right = -2,
|
|
spacing = 2
|
|
}
|
|
},
|
|
childrenFeeder = LeaderboardFiltersPopupItems
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
function mp_leaderboard_filters_popup()
|
|
return {
|
|
type = "UIElement",
|
|
id = "mp_leaderboard_filters_popup_container_id",
|
|
states = {
|
|
default = {
|
|
topAnchor = true,
|
|
bottomAnchor = true,
|
|
leftAnchor = true,
|
|
rightAnchor = true,
|
|
top = 0,
|
|
bottom = 0,
|
|
left = 0,
|
|
right = 0
|
|
}
|
|
},
|
|
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_filters_popup_id",
|
|
states = {
|
|
default = {
|
|
topAnchor = false,
|
|
bottomAnchor = false,
|
|
leftAnchor = false,
|
|
rightAnchor = false,
|
|
top = -1 * Leaderboards.Layout.FilterHeight * 0.6,
|
|
width = Leaderboards.Layout.FilterWidth,
|
|
height = Leaderboards.Layout.FilterHeight
|
|
}
|
|
},
|
|
children = {
|
|
{
|
|
type = "generic_drop_shadow",
|
|
properties = {
|
|
offset_shadow = 0
|
|
}
|
|
},
|
|
{
|
|
type = "generic_menu_titlebar",
|
|
id = "leaderboard_filters_popup_title_bar_id",
|
|
properties = {
|
|
title_bar_text = Engine.Localize( "@LUA_MENU_FILTER_CAPS" ),
|
|
fill_alpha = 1
|
|
}
|
|
},
|
|
{
|
|
type = "generic_menu_background",
|
|
id = "leaderboard_filters_popup_background",
|
|
properties = {
|
|
fill_alpha = 1
|
|
}
|
|
},
|
|
{
|
|
type = "mp_leaderboard_filters_popup_page"
|
|
},
|
|
{
|
|
type = "UIBindButton",
|
|
id = "filters_popup_back_button",
|
|
handlers = {
|
|
button_secondary = MBh.DoMultiple( {
|
|
MBh.LeaveMenu(),
|
|
FiltersPopupClose
|
|
} )
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
end
|
|
|
|
LUI.MenuBuilder.registerDef( "mp_leaderboard_actions_popup", mp_leaderboard_actions_popup )
|
|
LUI.MenuBuilder.registerDef( "mp_leaderboard_filters_popup", mp_leaderboard_filters_popup )
|
|
LUI.MenuBuilder.registerDef( "mp_leaderboard_filters_popup_page", mp_leaderboard_filters_popup_page )
|
|
LUI.FlowManager.RegisterStackPushBehaviour( "mp_leaderboard_filters_popup", PushLeaderboardFilter )
|