iw6-lui/lui/mp_menus/aarmain.dec.lua
2024-09-12 17:25:45 +02:00

315 lines
7.6 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
function AARSummaryMainCreate( f1_arg0, f1_arg1 )
local f1_local0 = LUI.FlowManager.GetMenuScopedDataFromElement( f1_arg0 )
local f1_local1 = f1_local0.controller
if IsPublicMatch() or Engine.IsAliensMode() then
TryForceOpenUnlocksScreens( f1_arg0, f1_arg1, f1_local1 )
end
f1_arg0:dispatchEventToRoot( {
name = "lobby_slide_disable",
dispatchChildren = true
} )
end
function toggleScreen( f2_arg0, f2_arg1, f2_arg2 )
if #f2_arg0.properties.screens > 1 then
if f2_arg2 == "right" then
if f2_arg0.properties.screen_idx < #f2_arg0.properties.screens then
f2_arg0.properties.screen_idx = f2_arg0.properties.screen_idx + 1
f2_arg0:dispatchEventToRoot( {
name = "toggle_next_aar_screen"
} )
end
elseif f2_arg2 == "left" and f2_arg0.properties.screen_idx > 1 then
f2_arg0.properties.screen_idx = f2_arg0.properties.screen_idx - 1
f2_arg0:dispatchEventToRoot( {
name = "toggle_next_aar_screen"
} )
end
if #f2_arg0.properties.screens <= f2_arg0.properties.screen_idx then
f2_arg0:dispatchEventToRoot( {
name = "disable_right_arrow"
} )
else
f2_arg0:dispatchEventToRoot( {
name = "enable_right_arrow"
} )
end
if f2_arg0.properties.screen_idx <= 1 then
f2_arg0:dispatchEventToRoot( {
name = "disable_left_arrow"
} )
else
f2_arg0:dispatchEventToRoot( {
name = "enable_left_arrow"
} )
end
end
end
function aarMainChildFeeder( f3_arg0 )
local f3_local0 = {
"mp_scoreboard_main"
}
local f3_local1 = 0
if IsPublicMatch() then
local f3_local2 = Engine.GetPlayerDataEx
local f3_local3 = f3_arg0.exclusiveController
if not f3_local3 then
f3_local3 = Engine.GetFirstActiveController()
end
f3_local1 = f3_local2( f3_local3, CoD.StatsGroup.Common, "round", "squadMode" )
if f3_local1 == 0 then
f3_local0 = {
"aar_match_summary_main",
"mp_opprogress_main",
"mp_scoreboard_main"
}
else
f3_local0 = {
"aar_match_summary_main",
"mp_scoreboard_main"
}
end
end
if Engine.IsAliensMode() then
f3_local0 = {
"aar_match_summary_main",
"mp_scoreboard_main"
}
end
f3_arg0.screens = f3_local0
local f3_local2 = {
{
type = "UIImage",
id = "darken_behind_popup_id",
states = {
default = {
material = RegisterMaterial( "white" ),
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
red = 0.1,
green = 0.14,
blue = 0.16,
alpha = 0.85
}
}
}
}
local f3_local3 = f3_arg0.screen_idx
local f3_local4 = f3_arg0.screens
if f3_local3 > 0 then
assert( f3_local4[f3_local3] )
f3_local2[#f3_local2 + 1] = {
type = f3_local4[f3_local3],
id = "aar_screen_" .. f3_local4[f3_local3] .. "_id",
properties = {
page_idx = f3_local3,
num_pages = #f3_local4,
controller = f3_arg0.exclusiveController,
squadMode = f3_local1
}
}
end
if #f3_local4 > 1 then
f3_local2[#f3_local2 + 1] = {
type = "aar_nav_arrows",
id = "aar_nav_arrows_id"
}
f3_local2[#f3_local2 + 1] = {
type = "UIBindButton",
id = "aar_summary_main_bind_btn_id",
handlers = {
button_right = function ( f4_arg0, f4_arg1 )
toggleScreen( f4_arg0, f4_arg1, "right" )
end,
button_left = function ( f5_arg0, f5_arg1 )
toggleScreen( f5_arg0, f5_arg1, "left" )
end,
toggle_aar_right = function ( f6_arg0, f6_arg1 )
toggleScreen( f6_arg0, f6_arg1, "right" )
end,
toggle_aar_left = function ( f7_arg0, f7_arg1 )
toggleScreen( f7_arg0, f7_arg1, "left" )
end
}
}
end
return f3_local2
end
function aar_summary_main()
return {
type = "UIElement",
id = "aar_main_container_id",
properties = {
screen_idx = 1
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0
}
},
childrenFeeder = aarMainChildFeeder,
handlers = {
toggle_next_aar_screen = MBh.EmitEvent( "menu_refresh" ),
menu_create = AARSummaryMainCreate,
open_after_action_report_unlocks = OpenUnlockScreens
}
}
end
function aar_nav_arrows()
return {
type = "UIElement",
focusable = true,
requireFocusType = FocusType.MouseOver,
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = false,
left = 0,
right = 0,
top = -30,
bottom = 30,
alpha = 1
},
hidden = {
alpha = 0
}
},
handlers = {
popup_active = MBh.AnimateToState( "hidden" ),
popup_inactive = MBh.AnimateToState( "default" )
},
children = {
{
type = "UIButton",
id = "left_nav_arrow_button_id",
requireFocusType = FocusType.MouseOver,
states = {
default = {
leftAnchor = false,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = AAR.Layout.Width / -2 - 10 - 30,
right = AAR.Layout.Width / -2 - 10,
top = 0,
bottom = 0
}
},
handlers = {
button_action = MBh.EmitEventToRoot( {
name = "toggle_aar_left"
} )
},
children = {
{
type = "UIImage",
id = "left_nav_arrow_image_id",
states = {
default = {
material = RegisterMaterial( "widg_margin_arrow_lt" ),
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
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,
alpha = 0
},
bright = {
alpha = 1
}
},
handlers = {
disable_left_arrow = MBh.AnimateToState( "default", 0 ),
enable_left_arrow = MBh.AnimateToState( "bright", 0 )
}
}
}
},
{
type = "UIButton",
id = "right_nav_arrow_button_id",
requireFocusType = FocusType.MouseOver,
states = {
default = {
leftAnchor = false,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = AAR.Layout.Width / 2 + 10,
right = AAR.Layout.Width / 2 + 10 + 30,
top = 0,
bottom = 0
}
},
handlers = {
button_action = MBh.EmitEventToRoot( {
name = "toggle_aar_right"
} )
},
children = {
{
type = "UIImage",
id = "right_nav_arrow_image_id",
states = {
default = {
material = RegisterMaterial( "widg_margin_arrow_rt" ),
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
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,
alpha = 1
},
dim = {
alpha = 0
}
},
handlers = {
disable_right_arrow = MBh.AnimateToState( "dim", 0 ),
enable_right_arrow = MBh.AnimateToState( "default", 0 )
}
}
}
}
}
}
end
LUI.MenuBuilder.registerDef( "aar_nav_arrows", aar_nav_arrows )
LUI.MenuBuilder.registerDef( "aar_summary_main", aar_summary_main )
LockTable( _M )