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

450 lines
10 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
function aar_title_bar()
return {
type = "UIElement",
id = "aar_title_bar_id",
properties = {
title_text = Engine.Localize( "@LUA_MENU_GAME_SUMMARY_CAPS" ),
subtitle_text = "GAMETYPE - Map Name",
subtitle_banner_width = AAR.Layout.SubTitleBannerWidth,
fill_alpha = 1,
border_alpha = Swatches.GenericMenu.BorderAlpha
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = AAR.Layout.TitleBarHeight + AAR.Layout.SubTitleBarHeight,
left = 0,
right = 0
}
},
children = {
{
type = "UIVerticalList",
id = "title_vert_list",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
children = {
{
type = "generic_menu_titlebar",
id = "top_title_bar_id",
properties = {
title_bar_text = MBh.Property( "title_text" ),
fill_alpha = MBh.Property( "fill_alpha" ),
border_alpha = MBh.Property( "border_alpha" )
}
},
{
type = "aar_subtitle_bar",
id = "bottom_title_bar_id",
properties = {
subtitle_text = MBh.Property( "subtitle_text" ),
banner_width = MBh.Property( "subtitle_banner_width" )
}
}
}
}
}
}
end
function aar_title_bar_top()
return {
type = "UIElement",
properties = {
title_text = "TITLE TEXT"
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = AAR.Layout.TitleBarHeight,
left = 0,
right = 0
}
},
children = {
{
type = "UIImage",
id = "bar_background",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 33,
right = -5,
material = RegisterMaterial( "box_popup_titlebar_mid" )
}
}
},
{
type = "UIImage",
id = "bar_corner_left",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 0,
left = 0,
right = 33,
material = RegisterMaterial( "box_popup_titlebar_lt" )
}
}
},
{
type = "UIImage",
id = "bar_corner_right",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 0,
left = -5,
right = 0,
material = RegisterMaterial( "box_popup_titlebar_rt" )
}
}
},
{
type = "UIText",
id = "bar_title",
properties = {
text = MBh.Property( "title_text" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 2,
bottom = 2 + CoD.TextSettings.ExtraBigFont.Height,
left = 0,
right = 0,
font = CoD.TextSettings.ExtraBigFont.Font,
alignment = LUI.Alignment.Center,
red = 1,
green = 1,
blue = 1,
alpha = 1
}
},
handlers = {
aar_set_title_text = function ( f3_arg0, f3_arg1 )
assert( f3_arg1.new_text )
f3_arg0:setText( f3_arg1.new_text )
end
}
}
}
}
end
function aar_subtitle_bar()
return {
type = "UIElement",
properties = {
subtitle_text = "GAMETYPE - Map Name",
banner_width = AAR.Layout.SubTitleBannerWidth
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = AAR.Layout.SubTitleBarHeight,
left = 0,
right = 0
}
},
children = {
{
type = "UIImage",
id = "text_bkg_center",
states = {
default = CoD.ColorizeState( Swatches.GenericMenu.Border, {
material = RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = false,
top = 1,
bottom = -6,
left = MBh.HalfOppositeProperty( "banner_width" ),
right = MBh.HalfProperty( "banner_width" ),
alpha = Swatches.GenericMenu.BorderAlpha
} )
},
children = {
{
type = "UIImage",
id = "text_bkg_left",
states = {
default = CoD.ColorizeState( Swatches.GenericMenu.Border, {
material = RegisterMaterial( "box_angle_ltcap" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 0,
left = -1 * AAR.Layout.SubTitleCapWidth,
right = 0
} )
}
},
{
type = "UIImage",
id = "text_bkg_right",
states = {
default = CoD.ColorizeState( Swatches.GenericMenu.Border, {
material = RegisterMaterial( "box_angle_rtcap" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = AAR.Layout.SubTitleCapWidth
} )
}
}
}
},
{
type = "UIText",
id = "bar_title",
properties = {
text = MBh.Property( "subtitle_text" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 2,
left = 0,
right = 0,
height = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Center,
red = 0,
green = 0,
blue = 0,
alpha = 1
}
},
handlers = {
aar_set_subtitle_text = function ( f5_arg0, f5_arg1 )
assert( f5_arg1.new_text )
f5_arg0:setText( f5_arg1.new_text )
end
}
}
}
}
end
function ExitAAR( f6_arg0, f6_arg1 )
f6_arg0:dispatchEventToRoot( {
name = "lobby_slide_enable",
dispatchChildren = true
} )
LUI.FlowManager.RequestLeaveMenu( f6_arg0 )
end
function aar_footer_bar()
local self = nil
if Engine.IsConsoleGame() then
self = LUI.UIButton.new()
self:registerEventHandler( "button_action", ExitAAR )
else
self = LUI.UIElement.new()
end
self.id = "aar_footer_bar_id"
self:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = -AAR.Layout.FooterHeight,
bottom = 0,
left = 0,
right = 0,
red = 0,
green = 0,
blue = 0
} )
self:animateToState( "default" )
local f7_local1 = LUI.UIImage.new()
f7_local1.id = "aar_footer_bkg"
f7_local1:registerAnimationState( "default", CoD.ColorizeState( Swatches.GenericMenu.Border, {
material = RegisterMaterial( "white" ),
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 1,
right = -1,
top = 0,
bottom = 1,
alpha = Swatches.GenericMenu.BorderAlpha
} ) )
f7_local1:animateToState( "default" )
self:addElement( f7_local1 )
local f7_local2 = LUI.UIBindButton.new()
f7_local2.id = "aar_buttons_handler_id"
f7_local2:registerEventHandler( "button_secondary", ExitAAR )
f7_local2:registerEventHandler( "button_select", ExitAAR )
self:addElement( f7_local2 )
if Engine.IsConsoleGame() then
local f7_local3 = LUI.UIText.new()
f7_local3.id = "aar_footer_text"
f7_local3:setText( Engine.Localize( "@LUA_MENU_AAR_FOOTER_TEXT" ) )
local f7_local4 = CoD.TextSettings.BoldFont.Height + 5
f7_local3:registerAnimationState( "default", CoD.ColorizeState( Colors.cac_label_text, {
font = CoD.TextSettings.BoldFont.Font,
alignment = LUI.Alignment.Left,
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = false,
top = -f7_local4 / 2,
bottom = f7_local4 / 2,
left = 10,
right = 0
} ) )
f7_local3:animateToState( "default" )
self:addElement( f7_local3 )
else
local f7_local3 = LUI.ButtonHelperText.helper_text_item( ButtonMap.button_secondary, Engine.Localize( "@LUA_MENU_CLOSE" ), nil, nil, nil )
f7_local3.triggers_event = "button_secondary"
f7_local3.id = "aar_helper_text_id"
local f7_local4 = LUI.UIHorizontalList.new()
f7_local4.id = "aar_footer_hlist"
f7_local4:registerAnimationState( "default", {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 10,
right = 0,
top = 0,
bottom = 0,
alignment = LUI.Alignment.Left
} )
f7_local4:animateToState( "default" )
f7_local4:addElement( f7_local3 )
self:addElement( f7_local4 )
end
return self
end
function aar_dots()
return {
type = "UIHorizontalList",
id = "page_dots",
focusable = false,
properties = {
num_dots = 3,
curr_dot = 1
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = 67,
bottom = 79,
left = -100,
right = 100,
alignment = LUI.Alignment.Center,
alpha = 1,
spacing = 4
}
},
childrenFeeder = function ( f9_arg0 )
local f9_local0 = f9_arg0.num_dots
local f9_local1 = f9_arg0.curr_dot
local f9_local2 = {}
for f9_local3 = 1, f9_local0, 1 do
local f9_local6 = #f9_local2 + 1
local f9_local7 = {
type = "UIImage",
id = "nav_dot_" .. f9_local3
}
local f9_local8 = {}
local f9_local9 = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 12,
top = 0,
bottom = 12
}
local f9_local10
if f9_local3 == f9_local1 then
f9_local10 = RegisterMaterial( "widg_circle_fill" )
if not f9_local10 then
else
f9_local9.material = f9_local10
f9_local8.default = f9_local9
f9_local7.states = f9_local8
f9_local2[f9_local6] = f9_local7
end
end
f9_local10 = RegisterMaterial( "widg_circle_empty" )
end
return f9_local2
end
}
end
LUI.MenuBuilder.registerDef( "aar_title_bar", aar_title_bar )
LUI.MenuBuilder.registerDef( "aar_title_bar_top", aar_title_bar_top )
LUI.MenuBuilder.registerDef( "aar_subtitle_bar", aar_subtitle_bar )
LUI.MenuBuilder.registerType( "aar_footer_bar", aar_footer_bar )
LUI.MenuBuilder.registerDef( "aar_dots", aar_dots )
LockTable( _M )