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

2342 lines
65 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( "Registering " .. _NAME )
if Engine.InFrontend() then
function InputFieldOpensVirtualKeyboard( f1_arg0 )
return Engine.IsConsoleGame() or f1_arg0
end
function InputFieldAction( f2_arg0, f2_arg1 )
local f2_local0 = Engine.GetDvarString( f2_arg0.properties.dvar_hook )
local f2_local1
if not Engine.IsConsoleGame() and not f2_arg1.mouse then
f2_local1 = not f2_arg1.keyboard
else
f2_local1 = false
end
f2_arg0.properties.isPCGamepad = f2_local1
if InputFieldOpensVirtualKeyboard( f2_local1 ) then
f2_arg0.properties.active = true
local f2_local2 = Engine.OpenScreenKeyboard
local f2_local3 = f2_arg1.controller
if not f2_local3 then
f2_local3 = Engine.GetFirstActiveController()
end
local f2_local4 = f2_arg0.properties.field_name
if f2_local0 then
local f2_local5 = f2_local0
end
f2_local2( f2_local3, f2_local4, f2_local5 or "", f2_arg0.properties.max_length, f2_arg0.properties.verify_string, f2_arg0.properties.filter_profanity, f2_arg0.properties.keyboard_type )
elseif f2_arg0.properties.active then
f2_arg0:processEvent( {
name = "finish_editing"
} )
f2_arg0.properties.active = false
else
local f2_local2 = f2_arg0:getChildById( "input_text" )
f2_local2:setTextEditActive()
f2_arg0.properties.active = true
end
end
function InputFieldUpdateText( f3_arg0, f3_arg1 )
if f3_arg1.text then
local f3_local0 = f3_arg0.properties.password_field and string.rep( "*", #f3_arg1.text ) or f3_arg1.text
local f3_local1 = f3_arg0:getChildById( "input_text" )
f3_local1:setTextEditText( f3_local0 )
Engine.SetDvarString( f3_arg0.properties.dvar_hook, f3_arg1.text )
end
end
function InitField( f4_arg0, f4_arg1 )
f4_arg0:setTextEditText( f4_arg0.properties.text )
local f4_local0 = Engine.GetDvarString( f4_arg0.properties.dvar_hook )
if f4_local0 ~= nil and f4_local0 ~= "" then
f4_arg0:setTextEditText( f4_arg0.properties.password_field and string.rep( "*", #f4_local0 ) or f4_local0 )
end
end
function DefaultFieldEditedAction()
end
function generic_input_field()
return {
type = "UIButton",
id = "generic_input_field_id",
focusable = true,
properties = {
help_value = "Placeholder field help",
field_name = "Placeholder Field name",
dvar_hook = "override_this_with_a_DVarString_name",
max_length = 16,
password_field = false,
use_auto_align = false,
active = false,
isPCGamepad = false,
field_edited_func = DefaultFieldEditedAction,
verify_string = false,
filter_profanity = false,
keyboard_type = CoD.KeyboardInputTypes.Normal,
text_alignment = LUI.Alignment.Left
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = GenericButtonDims.button_height,
alpha = 0.5
},
over = {
alpha = 1
}
},
handlers = {
button_over = MBh.AnimateToState( "over", 0 ),
button_up = MBh.AnimateToState( "default", 0 ),
button_action = InputFieldAction,
text_edit_complete = function ( f7_arg0, f7_arg1 )
if not InputFieldOpensVirtualKeyboard( f7_arg0.properties.isPCGamepad ) and f7_arg0.properties.active then
f7_arg1.text = f7_arg0.properties:field_edited_func( f7_arg1 ) or f7_arg1.text
InputFieldUpdateText( f7_arg0, f7_arg1 )
end
end
,
text_input_complete = function ( f8_arg0, f8_arg1 )
if InputFieldOpensVirtualKeyboard( f8_arg0.properties.isPCGamepad ) and f8_arg0.properties.active then
f8_arg1.text = f8_arg0.properties:field_edited_func( f8_arg1 ) or f8_arg1.text
InputFieldUpdateText( f8_arg0, f8_arg1 )
f8_arg0.properties.active = false
end
end
,
edit_unfocus = function ( f9_arg0, f9_arg1 )
if not InputFieldOpensVirtualKeyboard( f9_arg0.properties.isPCGamepad ) and f9_arg0.properties.active then
f9_arg0:processEvent( {
name = "finish_editing"
} )
f9_arg0.properties.active = false
end
end
},
children = {
{
type = "UITextEdit",
id = "input_text",
properties = {
text = MBh.Property( "help_value" ),
max_length = MBh.Property( "max_length" ),
dvar_hook = MBh.Property( "dvar_hook" ),
password_field = MBh.Property( "password_field" ),
use_auto_align = MBh.Property( "use_auto_align" ),
text_alignment = MBh.Property( "text_alignment" )
},
handlers = {
menu_create = InitField,
finish_editing = function ( f10_arg0, f10_arg1 )
f10_arg0:setTextEditActive( false )
end
,
colorize = function ( f11_arg0, f11_arg1 )
f11_arg0:registerAnimationState( "colorized", {
red = f11_arg1.red,
green = f11_arg1.green,
blue = f11_arg1.blue
} )
f11_arg0:animateToState( "colorized" )
end
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = CoD.TextSettings.SmallFont.Height,
font = CoD.TextSettings.SmallFont.Font,
alignment = MBh.Property( "text_alignment" )
}
}
}
}
}
end
function AutoUpdateDescText( f12_arg0, f12_arg1 )
if f12_arg0.properties.desc_text then
local f12_local0 = ""
if type( f12_arg0.properties.desc_text ) == "string" then
f12_local0 = f12_arg0.properties.desc_text
elseif type( f12_arg0.properties.desc_text ) == "function" then
f12_local0 = f12_arg0.properties:desc_text( f12_arg1 )
assert( type( f12_local0 ) == "string" )
end
f12_arg0:dispatchEventToRoot( {
name = "set_button_info_text",
text = f12_local0,
[1] = immediate
} )
end
end
end
function generic_back_button()
local self = LUI.UIBindButton.new()
self.id = "generic_back_button"
self:registerEventHandler( "button_secondary", MBh.LeaveMenu() )
return self
end
f0_local0 = function ( f14_arg0, f14_arg1 )
if f14_arg1.string then
f14_arg0:setText( f14_arg1.string )
end
end
function HandleMenuTitleShow( f15_arg0, f15_arg1 )
local f15_local0 = f15_arg1.preAnimTime or 0
local f15_local1 = f15_arg1.animTime or 0
if f15_arg0.properties.isHidden then
local f15_local2 = MBh.AnimateSequence( {
{
"hidden",
f15_local0
},
{
"shown",
f15_local1
}
} )
f15_local2( f15_arg0 )
f15_arg0.properties.isHidden = false
end
end
function HandleMenuTitleHide( f16_arg0, f16_arg1 )
local f16_local0 = f16_arg1.preAnimTime or 0
local f16_local1 = f16_arg1.animTime or 0
if not f16_arg0.properties.isHidden then
local f16_local2 = MBh.AnimateSequence( {
{
"shown",
f16_local0
},
{
"hidden",
f16_local1
}
} )
f16_local2( f16_arg0 )
f16_arg0.properties.isHidden = true
end
end
function generic_menu_title( f17_arg0, f17_arg1 )
local f17_local0 = 100
local f17_local1 = 52
if not f17_arg1 then
f17_arg1 = {}
end
local self = LUI.UIElement.new()
self.id = "generic_menu_title_container_id"
self:registerAnimationState( "default", {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = 128
} )
self:registerAnimationState( "hidden", {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = -128,
bottom = 0
} )
self:animateToState( "default" )
local f17_local3 = LUI.UIImage.new( {
leftAnchor = true,
topAnchor = true,
rightAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
bottom = 0,
height = 300,
red = 0,
green = 0,
blue = 0,
alpha = 1,
material = RegisterMaterial( "white" )
} )
f17_local3.id = "black_bar"
f17_local3:setPriority( 10 )
self:addElement( f17_local3 )
local f17_local4 = LUI.UIImage.new()
f17_local4.id = "generic_menu_title_background_id"
f17_local4:registerAnimationState( "default", {
material = RegisterMaterial( "bkgd_title_bar" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = -10,
bottom = 118,
left = 0,
right = 0,
alpha = 0.75
} )
f17_local4:animateToState( "default" )
self:addElement( f17_local4 )
if Engine.IsAliensMode() then
local f17_local5 = LUI.UIImage.new()
f17_local5.id = "generic_menu_title_flare_id"
f17_local5:registerAnimationState( "default", {
material = RegisterMaterial( "box_alien_header_footer" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 72,
bottom = 102,
left = 0,
right = 0,
alpha = 1
} )
f17_local5:animateToState( "default" )
self:addElement( f17_local5 )
end
local f17_local5 = LUI.UIElement.new()
f17_local5.id = "generic_menu_title_id"
f17_local5.properties = {
isHidden = false
}
f17_local5:registerAnimationState( "default", {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
top = f17_local1,
bottom = f17_local1 + CoD.TextSettings.ExtraBigFont.Height,
left = f17_local0,
right = 1280 - f17_local0
} )
f17_local5:registerAnimationState( "hidden", {
alpha = 0
} )
f17_local5:registerAnimationState( "shown", {
alpha = 1
} )
f17_local5:animateToState( "default" )
f17_local5:registerEventHandler( "menu_title_show", HandleMenuTitleShow )
f17_local5:registerEventHandler( "menu_title_hide", HandleMenuTitleHide )
self:addElement( f17_local5 )
local f17_local6 = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = 16,
right = 530,
top = 0,
bottom = CoD.TextSettings.ExtraBigFont.Height,
font = CoD.TextSettings.ExtraBigFont.Font,
alignment = LUI.Alignment.Left
}
local f17_local7 = LUI.UIMarqueeText.new( f17_local6 )
f17_local7.id = "header_text"
f17_local7:setText( f17_arg1.menu_title or "TITLE" )
f17_local7:registerAnimationState( "default", f17_local6 )
f17_local7:registerEventHandler( "update_header_text", f0_local0 )
f17_local7:animateToState( "default" )
f17_local5:addElement( f17_local7 )
local f17_local8 = LUI.UIImage.new()
f17_local8.id = "header_left_box"
f17_local8:registerAnimationState( "default", CoD.ColorizeState( Engine.IsAliensMode() and Colors.alien_frontend_hilite or Colors.frontend_hilite, {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 6,
top = 5,
bottom = 22,
material = RegisterMaterial( "white" )
} ) )
f17_local8:animateToState( "default" )
f17_local5:addElement( f17_local8 )
if IsPublicMatch and IsPublicMatch() and not f17_arg1.disableLobbyStatus and package.loaded["LUI.mp_menus.mpLobbyWidgets"] and LUI.mp_menus.mpLobbyWidgets.lobby_status then
self:addElement( LUI.mp_menus.mpLobbyWidgets.lobby_status( {}, {} ) )
end
local f17_local9 = MLG
if f17_local9 then
f17_local9 = MLG.IsFeatureAvailable
if f17_local9 then
f17_local9 = MLG.IsFeatureAvailable()
end
end
if not f17_arg1.disableMLGRulesVersionNumber and Engine.InFrontend() and f17_local9 then
local f17_local10 = LUI.UIText.new()
f17_local10.id = "codEsportText"
f17_local10:setText( Engine.Localize( "PATCH_MENU_MLG_RULES_VERSION", MLG.GetRulesVersionNumber() ) )
f17_local10:registerAnimationState( "default", CoD.ColorizeState( Colors.primary_text_color, {
font = CoD.TextSettings.SmallFont.Font,
alignment = LUI.Alignment.Left,
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 0,
bottom = 0,
right = 0,
height = CoD.TextSettings.SmallFont.Height,
alpha = 0
} ) )
f17_local10:registerAnimationState( "visible", {
alpha = 1
} )
f17_local10:registerEventHandler( "mlg_disabled", MBh.AnimateToState( "default" ) )
f17_local10:registerEventHandler( "mlg_enabled", function ( element, event )
element:setText( Engine.Localize( "PATCH_MENU_MLG_RULES_VERSION", MLG.GetRulesVersionNumber() ) )
element:animateToState( "visible", 0 )
end )
f17_local10:registerEventHandler( "menu_create", function ( element, event )
if MLG.AreMLGRulesEnabled() then
element:processEvent( {
name = "mlg_enabled"
} )
else
element:processEvent( {
name = "mlg_disabled"
} )
end
end )
f17_local10:animateToState( "default" )
f17_local5:addElement( f17_local10 )
end
return self
end
function left_header()
local f20_local0 = 35
return {
type = "UIElement",
id = "left_header_id",
properties = {
text = "Placement Text"
},
children = {
{
type = "UIText",
id = "header_text",
properties = {
text = MBh.Property( "text" )
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = -GenericButtonDims.pad_button_width,
top = 0,
bottom = CoD.TextSettings.BigFont.Height,
font = CoD.TextSettings.BigFont.Font,
alignment = LUI.Alignment.Right
}
},
handlers = {
update_header_text = f0_local0
}
},
{
type = "UIImage",
id = "sep_image",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = f20_local0 - GenericButtonDims.button_height / 4,
bottom = f20_local0 + GenericButtonDims.button_height / 4,
material = RegisterMaterial( "navbar_tick" )
}
}
}
},
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
top = 60,
left = 0,
bottom = 60 + f20_local0,
right = 450,
font = CoD.TextSettings.NormalFont.Font
}
}
}
end
function generic_border( f21_arg0, f21_arg1 )
local f21_local0 = false
if f21_arg1.inner ~= nil then
f21_local0 = f21_arg1.inner
end
local f21_local1 = f21_arg1.thickness
if not f21_local1 then
f21_local1 = 1
end
local f21_local2 = f21_arg1.border_red
if not f21_local2 then
f21_local2 = 1
end
local f21_local3 = f21_arg1.border_green
if not f21_local3 then
f21_local3 = 1
end
local f21_local4 = f21_arg1.border_blue
if not f21_local4 then
f21_local4 = 1
end
local f21_local5 = f21_arg1.border_alpha
if not f21_local5 then
f21_local5 = 1
end
local f21_local6 = f21_arg1.hide_bottom
if not f21_local6 then
f21_local6 = false
end
local self = LUI.UIElement.new()
local f21_local8 = self
local f21_local9 = self.registerAnimationState
local f21_local10 = "default"
local f21_local11 = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true
}
if f21_local0 then
local f21_local12 = f21_local1
end
f21_local11.top = f21_local12 or 0
local f21_local13
if f21_local0 then
f21_local13 = -f21_local1
if not f21_local13 then
else
f21_local11.bottom = f21_local13
if f21_local0 then
local f21_local14 = f21_local1
end
f21_local11.left = f21_local14 or 0
if f21_local0 then
f21_local13 = -f21_local1
if not f21_local13 then
else
f21_local11.right = f21_local13
f21_local9( f21_local8, f21_local10, f21_local11 )
self:animateToState( "default" )
f21_local9 = LUI.UIImage.new()
f21_local9.id = "top"
f21_local9:registerAnimationState( "default", {
material = RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = -f21_local1,
bottom = 0,
left = 0,
right = 0
} )
f21_local9:animateToState( "default" )
self:addElement( f21_local9 )
f21_local8 = nil
if not f21_local6 then
f21_local8 = LUI.UIImage.new()
f21_local8.id = "bottom"
f21_local8:registerAnimationState( "default", {
material = RegisterMaterial( "white" ),
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = f21_local1 or 0,
left = 0,
right = 0
} )
f21_local8:animateToState( "default" )
self:addElement( f21_local8 )
end
f21_local10 = LUI.UIImage.new()
f21_local10.id = "left"
f21_local13 = f21_local10
f21_local11 = f21_local10.registerAnimationState
local f21_local15 = "default"
local f21_local16 = {
material = RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = -f21_local1
}
if not f21_local6 then
local f21_local17 = f21_local1
end
f21_local16.bottom = f21_local17 or 0
f21_local16.left = -f21_local1
f21_local16.right = 0
f21_local11( f21_local13, f21_local15, f21_local16 )
f21_local10:animateToState( "default" )
self:addElement( f21_local10 )
f21_local11 = LUI.UIImage.new()
f21_local11.id = "right"
f21_local15 = f21_local11
f21_local13 = f21_local11.registerAnimationState
f21_local16 = "default"
local f21_local18 = {
material = RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = -f21_local1
}
if not f21_local6 then
local f21_local19 = f21_local1
end
f21_local18.bottom = f21_local19 or 0
f21_local18.left = 0
f21_local18.right = f21_local1
f21_local13( f21_local15, f21_local16, f21_local18 )
f21_local11:animateToState( "default" )
self:addElement( f21_local11 )
self.colorize = function ( f22_arg0, f22_arg1, f22_arg2, f22_arg3 )
for f22_local3, f22_local4 in ipairs( {
f21_local9,
f21_local11,
f21_local10,
f21_local8
} ) do
f22_local4:registerAnimationState( "current", {
red = f22_arg0,
green = f22_arg1,
blue = f22_arg2,
alpha = f22_arg3
} )
f22_local4:animateToState( "current" )
end
end
self.colorize( f21_local2, f21_local3, f21_local4, f21_local5 )
self:registerEventHandler( "updateBorderColor", function ( element, event )
element.colorize( event.red, event.green, event.blue, event.alpha )
end )
return self
end
end
f21_local13 = 0
end
end
f21_local13 = 0
end
function generic_drop_shadow( f24_arg0, f24_arg1 )
local f24_local0 = f24_arg1.alpha or 0.75
local f24_local1 = f24_arg1.offset_shadow or -8
local self = LUI.UIElement.new()
self.id = "generic_drop_shadow"
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = f24_local0
} )
self:animateToState( "default" )
local f24_local3 = LUI.UIElement.new()
f24_local3.id = "container"
f24_local3:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = f24_local1,
left = 0,
right = f24_local1
} )
f24_local3:animateToState( "default" )
local f24_local4 = LUI.UIImage.new()
f24_local4:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = -12,
bottom = 20,
left = 0,
right = 32,
material = RegisterMaterial( "box_dropshadow_ltcap" )
} )
f24_local4:animateToState( "default" )
f24_local3:addElement( f24_local4 )
local f24_local5 = LUI.UIImage.new()
f24_local5:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = -12,
bottom = 20,
left = 32,
right = -11,
material = RegisterMaterial( "box_dropshadow_hori_spacer" )
} )
f24_local5:animateToState( "default" )
f24_local3:addElement( f24_local5 )
local f24_local6 = LUI.UIImage.new()
f24_local6:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = -12,
bottom = 20,
left = -11,
right = 21,
material = RegisterMaterial( "box_dropshadow_midcap" )
} )
f24_local6:animateToState( "default" )
f24_local3:addElement( f24_local6 )
local f24_local7 = LUI.UIImage.new()
f24_local7:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 32,
bottom = -12,
left = -11,
right = 21,
material = RegisterMaterial( "box_dropshadow_vert_spacer" )
} )
f24_local7:animateToState( "default" )
f24_local3:addElement( f24_local7 )
local f24_local8 = LUI.UIImage.new()
f24_local8:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 32,
left = -11,
right = 21,
material = RegisterMaterial( "box_dropshadow_rtcap" )
} )
f24_local8:animateToState( "default" )
f24_local3:addElement( f24_local8 )
self:addElement( f24_local3 )
return self
end
function generic_drop_shadow_withfade( f25_arg0, f25_arg1 )
local f25_local0 = f25_arg1.alpha or 0.75
local f25_local1 = f25_arg1.fade_height or 150
local f25_local2 = f25_arg1.top_offset or 0
local self = LUI.UIElement.new()
self.id = "generic_drop_shadow_withfade"
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = f25_local2,
bottom = 0,
left = 0,
right = 0,
alpha = f25_local0
} )
self:animateToState( "default" )
local f25_local4 = LUI.UIImage.new()
f25_local4:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 32,
left = -11,
right = 21,
material = RegisterMaterial( "box_dropshadow_rtcap" )
} )
f25_local4:animateToState( "default" )
self:addElement( f25_local4 )
local f25_local5 = LUI.UIImage.new()
f25_local5:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 32,
bottom = -f25_local1,
left = -11,
right = 21,
material = RegisterMaterial( "box_dropshadow_vert_spacer" )
} )
f25_local5:animateToState( "default" )
self:addElement( f25_local5 )
local f25_local6 = LUI.UIImage.new()
f25_local6:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = -f25_local1,
bottom = 0,
left = -11,
right = 21,
material = RegisterMaterial( "box_dropshadow_vert_footer" )
} )
f25_local6:animateToState( "default" )
self:addElement( f25_local6 )
return self
end
function generic_popup_message()
return {
type = "UIElement",
id = "generic_test_id",
properties = {
message_text = "message text"
},
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
children = {
{
type = "UIImage",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
material = RegisterMaterial( "white" ),
red = 0.1,
green = 0.14,
blue = 0.16,
alpha = 0.85
}
}
},
{
type = "UIElement",
states = {
default = {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = -75,
left = -200,
right = 200,
height = 85
}
},
children = {
{
type = "live_dialog_popup_background"
},
{
type = "UIText",
properties = {
text = MBh.Property( "message_text" )
},
states = {
default = {
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 0,
right = 0,
height = CoD.TextSettings.NormalFont.Height,
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
}
}
}
}
}
}
}
end
f0_local1 = function ()
return {
type = "UIElement",
id = "spacer",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = 12
}
}
}
end
f0_local2 = function ( f28_arg0, f28_arg1 )
f28_arg0:setText( f28_arg1.message_text )
f28_arg0:dispatchEventToRoot( {
name = "resize_popup"
} )
end
function generic_confirmation_popup()
return {
type = "generic_selectionList_popup",
id = "confirmation_popup_id",
properties = {
message_text_alignment = LUI.Alignment.Center,
popup_title = "",
message_text = "",
button_text = Engine.Localize( "@MENU_EXIT" ),
confirmation_action = function ( f30_arg0, f30_arg1 )
DebugPrint( "Running generic_confirmation_popup default action" )
end
,
callback_params = {},
padding_top = 12,
cancel_will_close = true,
popup_childfeeder = function ()
return {
{
type = "UIText",
id = "message_text_id",
properties = {
text = MBh.Property( "message_text" ),
message_text_alignment = MBh.Property( "message_text_alignment" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = CoD.TextSettings.NormalFont.Height,
left = 12,
right = -12,
alignment = MBh.Property( "message_text_alignment" ),
font = CoD.TextSettings.NormalFont.Font,
red = Colors.primary_text_color.r,
green = Colors.primary_text_color.g,
blue = Colors.primary_text_color.b
}
},
handlers = {
update_message = f0_local2
}
},
f0_local1(),
{
type = "UIGenericButton",
id = "exit_button_id",
properties = {
style = GenericButtonSettings.Styles.GlassButton,
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.Popup,
text = MBh.Property( "button_text" ),
confirmation_action = MBh.Property( "confirmation_action" ),
button_action_func = function ( f32_arg0, f32_arg1 )
f32_arg0.properties:confirmation_action( f32_arg1 )
LUI.FlowManager.RequestLeaveMenu( f32_arg0 )
end
,
callback_params = MBh.Property( "callback_params" )
}
}
}
end
},
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0
}
}
}
end
function CreatePurchasePopupRow( f33_arg0, f33_arg1, f33_arg2, f33_arg3, f33_arg4 )
local f33_local0 = 15
local f33_local1 = 16
return {
type = "UIHorizontalList",
id = "yesno_message_" .. f33_arg0 .. "_hl_id",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 0,
left = 12 + f33_arg1,
right = -32,
height = CoD.TextSettings.NormalFont.Height
}
},
children = {
{
type = "UIText",
id = "yesno_message_" .. f33_arg0 .. "_text_id",
properties = {
text = MBh.Property( f33_arg2 )
},
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 0,
left = 0,
right = -(f33_local1 + 32 + f33_local0),
height = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Right,
red = Colors.primary_text_color.r,
green = Colors.primary_text_color.g,
blue = Colors.primary_text_color.b
}
}
},
{
type = "UIElement",
id = "yesno_message_" .. f33_arg0 .. "_spacer",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
top = 0,
left = 0,
width = f33_local0
}
}
},
{
type = "UIImage",
id = "yesno_message_" .. f33_arg0 .. "_image_id",
states = {
default = {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f33_local1 * 0.5,
left = -f33_local1 * 0.5,
bottom = f33_local1 * 0.5,
right = f33_local1 * 0.5,
material = f33_arg3
}
}
},
{
type = "UIText",
id = "yesno_message_" .. f33_arg0 .. "_id",
properties = {
text = MBh.Property( f33_arg4 )
},
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 0,
left = 0,
right = -12,
height = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b
}
}
}
}
}
end
function YesNoFeeder( f34_arg0 )
local f34_local0 = {}
if not f34_arg0.message_image then
f34_local0[#f34_local0 + 1] = {
type = "UIText",
id = "yesno_message_text_id",
properties = {
text = MBh.Property( "message_text" ),
message_text_alignment = MBh.Property( "message_text_alignment" )
},
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = CoD.TextSettings.NormalFont.Height,
left = 12,
right = -12,
font = CoD.TextSettings.NormalFont.Font,
alignment = MBh.Property( "message_text_alignment" ),
red = Colors.primary_text_color.r,
green = Colors.primary_text_color.g,
blue = Colors.primary_text_color.b
}
},
handlers = {
update_message = f0_local2
}
}
else
f34_local0[#f34_local0 + 1] = {
type = "UIElement",
id = "yesno_message_container_id",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 0,
left = 12,
right = -12,
height = 0
}
},
children = {
{
type = "UIImage",
id = "yesno_message_image_id",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = f34_arg0.message_image_top,
left = f34_arg0.message_image_left,
height = f34_arg0.message_image_height,
width = f34_arg0.message_image_width,
material = f34_arg0.message_image
}
}
}
}
}
if f34_arg0.message_text then
f34_local0[#f34_local0 + 1] = {
type = "UIText",
id = "yesno_message_text_id",
properties = {
text = MBh.Property( "message_text" ),
message_text_alignment = MBh.Property( "message_text_alignment" )
},
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 0,
left = 12 + f34_arg0.message_image_width + 20,
right = -12,
height = CoD.TextSettings.NormalFont.Height,
font = CoD.TextSettings.NormalFont.Font,
alignment = MBh.Property( "message_text_alignment" ),
red = Colors.primary_text_color.r,
green = Colors.primary_text_color.g,
blue = Colors.primary_text_color.b
}
}
}
else
if f34_arg0.message_required_rank_image then
f34_local0[#f34_local0 + 1] = CreatePurchasePopupRow( "required_rank", f34_arg0.message_image_width, "message_required_rank_text", f34_arg0.message_required_rank_image, "message_required_rank" )
f34_local0[#f34_local0 + 1] = CreatePurchasePopupRow( "current_rank", f34_arg0.message_image_width, "message_current_rank_text", f34_arg0.message_current_rank_image, "message_current_rank" )
f34_local0[#f34_local0 + 1] = {
type = "UIElement",
id = "yesno_message_separator_container_id",
states = {
default = {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = 0,
right = 0,
height = 5,
width = 300
}
},
children = {
{
type = "UIImage",
id = "yesno_message_separator_image_id",
states = {
default = {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 2,
left = 0,
height = 1,
material = RegisterMaterial( "white" ),
alpha = 0.1
}
}
}
}
}
end
if f34_arg0.message_cost_image then
f34_local0[#f34_local0 + 1] = CreatePurchasePopupRow( "cost", f34_arg0.message_image_width, "message_cost_text", f34_arg0.message_cost_image, "message_cost" )
f34_local0[#f34_local0 + 1] = CreatePurchasePopupRow( "squad_points", f34_arg0.message_image_width, "message_squad_points_text", f34_arg0.message_squad_points_image, "message_squad_points" )
end
end
end
f34_local0[#f34_local0 + 1] = f0_local1()
if f34_arg0.yes_text then
local f34_local1 = #f34_local0 + 1
local f34_local2 = {
type = "UIGenericButton",
id = "yes_button_id",
audio = {
button_over = CoD.SFX.SubMenuMouseOver
}
}
local f34_local3 = {
style = GenericButtonSettings.Styles.GlassButton,
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.YesNoPopup,
text = MBh.Property( "yes_text" ),
action = MBh.Property( "yes_action" )
}
local f34_local4 = MBh.DoMultiple
local f34_local5 = {}
local f34_local6 = MBh.RunPropertyFunc( "action" )
local f34_local7 = MBh.LeaveMenu()
f34_local3.button_action_func = f34_local4( f34_local6 )
f34_local3.callback_params = MBh.Property( "callback_params" )
f34_local2.properties = f34_local3
f34_local0[f34_local1] = f34_local2
end
local f34_local1 = #f34_local0 + 1
local f34_local2 = {
type = "UIGenericButton",
id = "no_button_id",
audio = {
button_over = CoD.SFX.SubMenuMouseOver
}
}
local f34_local3 = {
style = GenericButtonSettings.Styles.GlassButton,
substyle = GenericButtonSettings.Styles.GlassButton.SubStyles.YesNoPopup,
text = MBh.Property( "no_text" ),
action = MBh.Property( "no_action" )
}
local f34_local4 = MBh.DoMultiple
local f34_local5 = {}
local f34_local6 = MBh.RunPropertyFunc( "action" )
local f34_local7 = MBh.LeaveMenu()
f34_local3.button_action_func = f34_local4( f34_local6 )
f34_local3.callback_params = MBh.Property( "callback_params" )
f34_local2.properties = f34_local3
f34_local0[f34_local1] = f34_local2
if f34_arg0.default_focus_index then
f34_local1 = assert
if f34_arg0.default_focus_index <= 0 or f34_arg0.default_focus_index > #f34_local0 then
f34_local2 = false
else
f34_local2 = true
end
f34_local1( f34_local2 )
f34_local1 = #f34_local0 - 2
f34_local0[#f34_local0 - 2 + f34_arg0.default_focus_index].listDefaultFocus = true
end
return f34_local0
end
function generic_yesno_popup()
return {
type = "generic_selectionList_popup",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0
}
},
properties = {
message_text_alignment = LUI.Alignment.Center,
popup_title = "",
message_text = "",
padding_top = 12,
cancel_means_no = true,
yes_action = function ( f36_arg0, f36_arg1 )
DebugPrint( "Running generic_confirmation_popup yes action" )
end
,
no_action = function ( f37_arg0, f37_arg1 )
DebugPrint( "Running generic_confirmation_popup no action" )
end
,
yes_text = Engine.Localize( "@LUA_MENU_YES" ),
no_text = Engine.Localize( "@LUA_MENU_NO" ),
callback_params = {},
default_focus_index = 2,
popup_childfeeder = YesNoFeeder
},
handlers = {
popup_back = function ( f38_arg0, f38_arg1 )
if f38_arg0.properties.cancel_means_no then
f38_arg0.properties:no_action( f38_arg1 )
end
end
,
menu_create = function ( f39_arg0, f39_arg1 )
f39_arg0:clearSavedState()
end
}
}
end
function generic_yesno_with_image_popup()
return {
type = "generic_selectionList_popup",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0
}
},
properties = {
message_text_alignment = LUI.Alignment.Left,
popup_title = "",
message_image = nil,
message_text = nil,
message_required_rank_text = nil,
message_required_rank_image = nil,
message_required_rank = nil,
message_current_rank_text = nil,
message_current_rank_image = nil,
message_current_rank = nil,
message_cost_text = nil,
message_cost_image = nil,
message_cost = nil,
message_squad_points_text = nil,
message_squad_points_image = nil,
message_squad_points = nil,
message_image_top = 0,
message_image_left = 5,
message_image_height = 64,
message_image_width = 64,
purchase_cost = 0,
padding_top = 20,
cancel_means_no = true,
yes_action = function ( f41_arg0, f41_arg1 )
DebugPrint( "Running generic_confirmation_popup yes action" )
end
,
no_action = function ( f42_arg0, f42_arg1 )
DebugPrint( "Running generic_confirmation_popup no action" )
end
,
yes_text = nil,
no_text = nil,
callback_params = {},
default_focus_index = 2,
popup_childfeeder = YesNoFeeder
},
handlers = {
popup_back = function ( f43_arg0, f43_arg1 )
if f43_arg0.properties.cancel_means_no then
f43_arg0.properties:no_action( f43_arg1 )
end
end
,
menu_create = function ( f44_arg0, f44_arg1 )
f44_arg0:clearSavedState()
end
}
}
end
local f0_local3 = function ( f45_arg0 )
return {
{
type = "UIGenericButton",
id = "selection_button_confirm",
properties = {
text = Engine.Localize( "@LUA_MENU_YES" ),
button_action_func = function ( f46_arg0, f46_arg1 )
DebugPrint( "Running generic_selectionList_popup confirm/yes action" )
LUI.FlowManager.RequestLeaveMenu( f46_arg0 )
end
}
},
{
type = "UIGenericButton",
id = "selection_button_cancel",
properties = {
text = Engine.Localize( "@LUA_MENU_NO" ),
button_action_func = function ( f47_arg0, f47_arg1 )
DebugPrint( "Running generic_selectionList_popup cancel/no action" )
LUI.FlowManager.RequestLeaveMenu( f47_arg0 )
end
}
}
}
end
local f0_local4 = function ( f48_arg0, f48_arg1, f48_arg2, f48_arg3, f48_arg4 )
local f48_local0 = 30
if f48_arg0:getRect() then
local f48_local1 = f48_arg1:getNumChildren()
local f48_local2 = GenericTitleBarDims.TitleBarHeight + f48_arg3 + f48_arg4
local f48_local3 = f48_arg1:getFirstChild()
while f48_local3 do
local f48_local4 = nil
if f48_local3.getText and f48_local3:getText() then
local f48_local5 = nil
f48_local5, f48_local4 = f48_local3:getElementTextDims()
else
f48_local4 = f48_local3:getHeight()
end
end
if f48_arg0.animateIn then
f48_arg0:registerAnimationState( "initState", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
left = -f48_arg2 / 2 - 500,
right = f48_arg2 / 2 - 500,
top = -(f48_local2 / 2 + f48_local0),
bottom = f48_local2 / 2 - f48_local0,
alpha = 0
} )
f48_arg0:animateToState( "initState" )
end
f48_arg0:registerAnimationState( "newState", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
left = -f48_arg2 / 2,
right = f48_arg2 / 2,
top = -(f48_local2 / 2 + f48_local0),
bottom = f48_local2 / 2 - f48_local0,
alpha = 1
} )
if f48_arg0.animateIn then
f48_arg0:animateToState( "newState", 75, false, true )
f48_arg0.animateIn = false
else
f48_arg0:animateToState( "newState" )
end
f48_local2 = f48_local2 + f48_local4
f48_local3 = f48_local3:getNextSibling()
else
f48_arg0:animateToState( "start", 1 )
end
end
function generic_selectionList_popup( f49_arg0, f49_arg1 )
if not f49_arg1 then
f49_arg1 = {}
end
local f49_local0 = f49_arg1.padding_bottom or 8
local f49_local1 = f49_arg1.padding_right or 5
local f49_local2 = f49_arg1.padding_left or 5
local f49_local3 = f49_arg1.padding_top or 5
local f49_local4 = f49_arg1.popup_title_alignment
if not f49_local4 then
f49_local4 = LUI.Alignment.Center
end
local f49_local5 = f49_arg1.popup_title or "popup_title property"
local f49_local6
if f49_arg1.cancel_will_close ~= nil then
f49_local6 = f49_arg1.cancel_will_close
else
f49_local6 = true
end
local f49_local7 = CoD.TextSettings.ExtraBigFont
local f49_local8 = f49_arg1.popup_list_spacing or 0
local f49_local9 = f49_arg1.popup_stop_background_fade_in or false
local f49_local10, f49_local11, f49_local12, f49_local13 = GetTextDimensions( f49_local5, f49_local7.Font, f49_local7.Height )
local f49_local14 = f49_arg1.popup_width
if not f49_local14 then
f49_local14 = LUI.clamp( f49_local12 - f49_local10 + 60, 430, 1200 )
end
local self = LUI.UIElement.new()
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
} )
self:animateToState( "default" )
local f49_local16 = LUI.UIImage.new()
f49_local16.id = "generic_selectionList_background"
local f49_local17 = f49_local16
local f49_local18 = f49_local16.registerAnimationState
local f49_local19 = "init"
local f49_local20 = CoD.ColorizeState
local f49_local21 = Swatches.Overlay.Color
local f49_local22 = {
material = Engine.IsAliensMode() and RegisterMaterial( "box_alien_color_tint" ) or RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = -200,
bottom = 200,
left = 0,
right = 0
}
local f49_local23
if f49_local9 then
f49_local23 = Swatches.Overlay.AlphaMore
if not f49_local23 then
else
f49_local22.alpha = f49_local23
f49_local18( f49_local17, f49_local19, f49_local20( f49_local21, f49_local22 ) )
if not f49_local9 then
f49_local16:registerAnimationState( "default", CoD.ColorizeState( Swatches.Overlay.Color, {
alpha = Swatches.Overlay.AlphaMore
} ) )
end
f49_local16:animateToState( "init" )
if not f49_local9 then
f49_local16:animateToState( "default", 100 )
end
self:addElement( f49_local16 )
f49_local18 = LUI.UIElement.new()
f49_local18.id = "generic_selectionList_window_id"
f49_local18:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = false,
left = -f49_local14 / 2,
right = f49_local14 / 2,
top = 0,
bottom = 0,
alpha = 0
} )
f49_local18:registerAnimationState( "start", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = false,
left = -f49_local14 / 2,
right = f49_local14 / 2,
top = 0,
bottom = 0,
alpha = 0
} )
f49_local18:animateToState( "default" )
f49_local18:animateToState( "start", 1 )
self:addElement( f49_local18 )
f49_local18:addElement( generic_drop_shadow( {}, {
offset_shadow = 0
} ) )
f49_local19 = generic_menu_background( nil, {
fill_alpha = 1
} )
f49_local19:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
left = 0,
right = 0,
top = GenericTitleBarDims.TitleBarHeight,
bottom = 0
} )
f49_local19:animateToState( "default" )
f49_local18:addElement( f49_local19 )
f49_local18:addElement( generic_menu_titlebar( nil, {
font = f49_local7,
title_bar_text = f49_local5,
title_bar_alignment = f49_local4,
fill_alpha = 1
} ) )
f49_local21 = LUI.UIVerticalList.new()
f49_local21.id = "generic_selectionList_content_id"
f49_local21:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
left = f49_local2,
right = -f49_local1,
top = GenericTitleBarDims.TitleBarHeight + f49_local3,
bottom = -f49_local0,
spacing = f49_local8
} )
f49_local21:animateToState( "default" )
f49_local18:addElement( f49_local21 )
f49_local22 = function ( f50_arg0, f50_arg1 )
if f50_arg1.name == "menu_create" then
f50_arg0.animateIn = true
end
f0_local4( f50_arg0, f49_local21, f49_local14, f49_local3, f49_local0 )
end
f49_local18:addEventHandler( "menu_create", f49_local22 )
f49_local18:addEventHandler( "resize_popup", f49_local22 )
f49_local18:addEventHandler( "transition_complete_start", f49_local22 )
f49_local23 = f49_arg1.popup_childfeeder or function ()
return {}
end
if type( f49_local23 ) == "table" and f49_local23.isProperty then
f49_local23 = f49_local23.func( f49_arg1 )
end
assert( type( f49_local23 ) == "function", "Feeders must be a function or referenced by the MBh.Property helper" )
local f49_local24 = f49_local23( f49_arg1 )
f49_local21.childrenFeeder = f49_local23
if f49_local24 then
LUI.MenuBuilder.buildChildren( f49_local21, f49_arg1, f49_local24 )
end
self.addListElement = function ( f52_arg0 )
assert( f52_arg0 )
f49_local21:addElement( f52_arg0 )
end
local f49_local25 = LUI.UIBindButton.new()
f49_local25.id = "generic_selectionList_back_id"
f49_local25:registerEventHandler( "button_secondary", function ( element, event )
self:processEvent( {
name = "popup_back",
controller = event.controller
} )
if f49_local6 then
LUI.FlowManager.RequestLeaveMenu( element )
end
end )
self:addElement( f49_local25 )
return self
end
end
f49_local23 = 0
end
function DebugMessageBox( f54_arg0, f54_arg1, f54_arg2, f54_arg3 )
if not f54_arg1 or f54_arg1 == -1 then
f54_arg1 = Engine.GetFirstActiveController()
end
if not f54_arg2 then
f54_arg2 = ""
end
if not f54_arg3 then
f54_arg3 = ""
end
Engine.ExecNow( "set LUIDebugMessageBoxTitle " .. f54_arg2 )
Engine.ExecNow( "set LUIDebugMessageBoxMessage " .. f54_arg3 )
LUI.FlowManager.RequestPopupMenu( f54_arg0, "generic_debugMessageBox_popup", true, f54_arg1, false )
end
function generic_debugMessageBox_popup()
return {
type = "generic_confirmation_popup",
id = "debug_message_box_popup_id",
properties = {
popup_title = Engine.GetDvarString( "LUIDebugMessageBoxTitle" ),
message_text = Engine.GetDvarString( "LUIDebugMessageBoxMessage" ),
button_text = Engine.Localize( "@MENU_OK" )
}
}
end
function generic_menu_background( f56_arg0, f56_arg1 )
if not f56_arg1 then
f56_arg1 = {}
end
local f56_local0 = f56_arg1.bottom_offset or 0
local f56_local1 = f56_arg1.top_offset
if not f56_local1 then
f56_local1 = GenericTitleBarDims.TitleBarHeight
end
local f56_local2 = f56_arg1.fill_color
if not f56_local2 then
f56_local2 = Swatches.GenericMenu.Background
end
local f56_local3 = f56_arg1.border_color
if not f56_local3 then
f56_local3 = Swatches.GenericMenu.Border
end
local f56_local4 = f56_arg1.fill_alpha
if not f56_local4 then
f56_local4 = Swatches.GenericMenu.BackgroundAlpha
end
local f56_local5 = f56_arg1.border_alpha
if not f56_local5 then
f56_local5 = Swatches.GenericMenu.BorderAlpha
end
local f56_local6 = f56_arg1.background_image or "white"
local f56_local7 = f56_arg1.hide_bottom or false
local self = LUI.UIElement.new()
self.id = "generic_menu_background"
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = f56_local1,
bottom = -f56_local0,
left = 0,
right = 0
} )
self:animateToState( "default" )
local f56_local9 = LUI.UIImage.new()
f56_local9.id = "generic_menu_background_inner"
f56_local9:registerAnimationState( "default", CoD.ColorizeState( f56_local2, {
material = RegisterMaterial( f56_local6 ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 1,
bottom = -1,
left = 1,
right = -1,
alpha = f56_local4
} ) )
f56_local9:animateToState( "default" )
self:addElement( f56_local9 )
local f56_local10 = generic_border( {}, {
inner = true,
border_red = f56_local3.r,
border_green = f56_local3.g,
border_blue = f56_local3.b,
border_alpha = f56_local5,
hide_bottom = f56_local7
} )
f56_local10.id = "generic_menu_background_border"
self:addElement( f56_local10 )
return self
end
function generic_menu_background_withfade( f57_arg0, f57_arg1 )
if not f57_arg1 then
f57_arg1 = {}
end
local f57_local0 = f57_arg1.top_offset
if not f57_local0 then
f57_local0 = GenericTitleBarDims.TitleBarHeight
end
local f57_local1 = f57_arg1.fill_color
if not f57_local1 then
f57_local1 = Swatches.GenericMenu.Background
end
local f57_local2 = f57_arg1.border_color
if not f57_local2 then
f57_local2 = Swatches.GenericMenu.Border
end
local f57_local3 = f57_arg1.fill_alpha
if not f57_local3 then
f57_local3 = Swatches.GenericMenu.BackgroundAlpha
end
local f57_local4 = f57_arg1.border_alpha
if not f57_local4 then
f57_local4 = Swatches.GenericMenu.BorderAlpha
end
local f57_local5 = f57_arg1.shadow_top_offset or 0
local f57_local6 = f57_arg1.shadow_alpha or 0.75
local f57_local7 = f57_arg1.hide_shadow or false
local f57_local8 = f57_arg1.fade_height or 150
local self = LUI.UIElement.new()
self.id = "generic_menu_background_withfade"
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
} )
self:animateToState( "default" )
self:addElement( generic_menu_background( {}, {
top_offset = f57_local0,
bottom_offset = f57_local8,
fill_color = f57_local1,
border_color = f57_local2,
fill_alpha = f57_local3,
border_alpha = f57_local4,
hide_bottom = true
} ) )
local f57_local10 = LUI.UIElement.new()
f57_local10:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = -1 * (1 + f57_local8),
bottom = 0,
left = 0,
right = 0
} )
f57_local10:animateToState( "default" )
local f57_local11 = LUI.UIImage.new()
f57_local11:registerAnimationState( "default", CoD.ColorizeState( f57_local2, {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 0,
left = 0,
right = 1,
material = RegisterMaterial( "box_white_gradient_top" ),
alpha = f57_local4
} ) )
f57_local11:animateToState( "default" )
f57_local10:addElement( f57_local11 )
local f57_local12 = LUI.UIImage.new()
f57_local12:registerAnimationState( "default", CoD.ColorizeState( f57_local1, {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 1,
right = -1,
material = RegisterMaterial( "box_white_gradient_top" ),
alpha = f57_local3
} ) )
f57_local12:animateToState( "default" )
f57_local10:addElement( f57_local12 )
local f57_local13 = LUI.UIImage.new()
f57_local13:registerAnimationState( "default", CoD.ColorizeState( f57_local2, {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 0,
left = -1,
right = 0,
material = RegisterMaterial( "box_white_gradient_top" ),
alpha = f57_local4
} ) )
f57_local13:animateToState( "default" )
f57_local10:addElement( f57_local13 )
if not f57_local7 then
self:addElement( generic_drop_shadow_withfade( {}, {
alpha = f57_local6,
fade_height = f57_local8,
top_offset = f57_local5
} ) )
end
self:addElement( f57_local10 )
return self
end
function generic_menu_titlebar_background( f58_arg0, f58_arg1 )
if not f58_arg1 then
f58_arg1 = {}
end
local f58_local0 = f58_arg1.fill_color
if not f58_local0 then
f58_local0 = Swatches.GenericMenu.Background
end
local f58_local1 = f58_arg1.border_color
if not f58_local1 then
f58_local1 = Swatches.GenericMenu.Border
end
local f58_local2 = f58_arg1.fill_alpha
if not f58_local2 then
f58_local2 = Swatches.GenericMenu.BackgroundAlpha
end
local f58_local3 = f58_arg1.border_alpha
if not f58_local3 then
f58_local3 = Swatches.GenericMenu.BorderAlpha
end
local f58_local4 = f58_arg1.reversed or false
local self = LUI.UIElement.new()
self.id = "generic_menu_titlebar_background_id"
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = GenericTitleBarDims.TitleBarHeight,
left = 0,
right = 0
} )
self:animateToState( "default" )
local f58_local6 = LUI.UIImage.new()
f58_local6.id = "cap_fill"
local f58_local7 = f58_local6
local f58_local8 = f58_local6.registerAnimationState
local f58_local9 = "default"
local f58_local10 = CoD.ColorizeState
local f58_local11 = f58_local0
local f58_local12 = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = not f58_local4,
rightAnchor = f58_local4,
top = 0,
bottom = 0
}
local f58_local13
if f58_local4 then
f58_local13 = -GenericTitleBarDims.TitleBarLCapWidth
if not f58_local13 then
else
f58_local12.left = f58_local13
if f58_local4 then
f58_local13 = 0
if not f58_local13 then
else
f58_local12.right = f58_local13
if f58_local4 then
f58_local13 = RegisterMaterial( "box_titlebar_rightcap" )
if not f58_local13 then
else
f58_local12.material = f58_local13
f58_local12.alpha = f58_local2
f58_local8( f58_local7, f58_local9, f58_local10( f58_local11, f58_local12 ) )
f58_local6:animateToState( "default" )
self:addElement( f58_local6 )
f58_local8 = LUI.UIImage.new()
f58_local8.id = "body_fill"
f58_local9 = f58_local8
f58_local7 = f58_local8.registerAnimationState
f58_local10 = "default"
f58_local11 = CoD.ColorizeState
f58_local12 = f58_local0
f58_local13 = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 1,
bottom = 0
}
local f58_local14
if f58_local4 then
f58_local14 = -1
if not f58_local14 then
else
f58_local13.left = f58_local14
if f58_local4 then
f58_local14 = -GenericTitleBarDims.TitleBarLCapWidth
if not f58_local14 then
else
f58_local13.right = f58_local14
f58_local13.material = RegisterMaterial( "white" )
f58_local13.alpha = f58_local2
f58_local7( f58_local9, f58_local10, f58_local11( f58_local12, f58_local13 ) )
f58_local8:animateToState( "default" )
self:addElement( f58_local8 )
f58_local7 = LUI.UIImage.new()
f58_local7.id = "cap_border"
f58_local10 = f58_local7
f58_local9 = f58_local7.registerAnimationState
f58_local11 = "default"
f58_local12 = CoD.ColorizeState
f58_local13 = f58_local1
f58_local14 = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = not f58_local4,
rightAnchor = f58_local4,
top = 0,
bottom = 0
}
local f58_local15
if f58_local4 then
f58_local15 = -GenericTitleBarDims.TitleBarLCapWidth
if not f58_local15 then
else
f58_local14.left = f58_local15
if f58_local4 then
f58_local15 = 0
if not f58_local15 then
else
f58_local14.right = f58_local15
if f58_local4 then
f58_local15 = RegisterMaterial( "box_titlebar_rightcap_border" )
if not f58_local15 then
else
f58_local14.material = f58_local15
f58_local14.alpha = f58_local3
f58_local9( f58_local10, f58_local11, f58_local12( f58_local13, f58_local14 ) )
f58_local7:animateToState( "default" )
self:addElement( f58_local7 )
f58_local9 = LUI.UIImage.new()
f58_local9.id = "end_border"
f58_local11 = f58_local9
f58_local10 = f58_local9.registerAnimationState
f58_local12 = "default"
f58_local13 = CoD.ColorizeState
f58_local14 = f58_local1
f58_local15 = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = f58_local4,
rightAnchor = not f58_local4,
top = 0,
bottom = 0
}
local f58_local16
if f58_local4 then
f58_local16 = 0
if not f58_local16 then
else
f58_local15.left = f58_local16
if f58_local4 then
f58_local16 = 1
if not f58_local16 then
else
f58_local15.right = f58_local16
f58_local15.material = RegisterMaterial( "white" )
f58_local15.alpha = f58_local3
f58_local10( f58_local11, f58_local12, f58_local13( f58_local14, f58_local15 ) )
f58_local9:animateToState( "default" )
self:addElement( f58_local9 )
f58_local10 = LUI.UIImage.new()
f58_local10.id = "top_border"
f58_local12 = f58_local10
f58_local11 = f58_local10.registerAnimationState
f58_local13 = "default"
f58_local14 = CoD.ColorizeState
f58_local15 = f58_local1
f58_local16 = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 1
}
local f58_local17
if f58_local4 then
f58_local17 = 1
if not f58_local17 then
else
f58_local16.left = f58_local17
if f58_local4 then
f58_local17 = -GenericTitleBarDims.TitleBarLCapWidth
if not f58_local17 then
else
f58_local16.right = f58_local17
f58_local16.material = RegisterMaterial( "white" )
f58_local16.alpha = f58_local3
f58_local11( f58_local12, f58_local13, f58_local14( f58_local15, f58_local16 ) )
f58_local10:animateToState( "default" )
self:addElement( f58_local10 )
return self
end
end
f58_local17 = -1
end
end
f58_local17 = GenericTitleBarDims.TitleBarLCapWidth
end
end
f58_local16 = 0
end
end
f58_local16 = -1
end
end
f58_local15 = RegisterMaterial( "box_titlebar_leftcap_border" )
end
end
f58_local15 = GenericTitleBarDims.TitleBarLCapWidth
end
end
f58_local15 = 0
end
end
f58_local14 = -1
end
end
f58_local14 = GenericTitleBarDims.TitleBarLCapWidth
end
end
f58_local13 = RegisterMaterial( "box_titlebar_leftcap" )
end
end
f58_local13 = GenericTitleBarDims.TitleBarLCapWidth
end
end
f58_local13 = 0
end
local f0_local5 = function ( f59_arg0, f59_arg1 )
f59_arg0:setText( f59_arg1.title_text )
end
function generic_menu_titlebar( f60_arg0, f60_arg1 )
local f60_local0 = f60_arg1.title_bar_text_indent or 0
local f60_local1 = f60_arg1.title_bar_alignment
if not f60_local1 then
f60_local1 = LUI.Alignment.Center
end
local f60_local2 = f60_arg1.title_bar_text or ""
local f60_local3 = generic_menu_titlebar_background( nil, f60_arg1 )
local f60_local4 = f60_arg1.font
if not f60_local4 then
f60_local4 = CoD.TextSettings.ExtraBigFont
end
local f60_local5 = f60_arg1.vertOffset or 1
local f60_local6 = f60_arg1.marquee and LUI.UIMarqueeText.new() or LUI.UIText.new()
f60_local6.id = "title"
f60_local6:setText( f60_local2 )
f60_local6:registerAnimationState( "default", {
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = -f60_local4.Height / 2 + f60_local5,
height = f60_local4.Height,
left = f60_local0,
right = 0,
font = f60_local4.Font,
alignment = f60_local1
} )
f60_local6:animateToState( "default" )
f60_local6:registerEventHandler( "update_title", f0_local5 )
f60_local3:addElement( f60_local6 )
return f60_local3
end
function RefreshScrollList( f61_arg0, f61_arg1 )
f61_arg0:closeChildren()
f61_arg0:clearSavedState()
f61_arg0:processEvent( {
name = "menu_refresh"
} )
end
function generic_loading_widget( f62_arg0, f62_arg1 )
if not f62_arg1 then
f62_arg1 = {}
end
local f62_local0 = f62_arg1.indent or 15
local f62_local1 = f62_arg1.message or ""
local self = LUI.UIElement.new()
self.id = "generic_loading_widget"
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
} )
self:animateToState( "default" )
local f62_local3 = LUI.UIHorizontalList.new()
f62_local3:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alignment = LUI.Alignment.Center,
spacing = f62_local0
} )
f62_local3:animateToState( "default" )
self:addElement( f62_local3 )
local f62_local4 = LUI.MenuBuilder.BuildAddChild( f62_local3, {
type = "live_dialog_processing_widget"
} )
if #f62_local1 > 0 then
local f62_local5, f62_local6, f62_local7, f62_local8 = GetTextDimensions( f62_local1, CoD.TextSettings.NormalFont.Font, CoD.TextSettings.NormalFont.Height )
local f62_local9 = LUI.UIText.new()
f62_local9:setText( f62_local1 )
f62_local9:registerAnimationState( "default", {
font = CoD.TextSettings.NormalFont.Font,
alignment = LUI.Alignment.Left,
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = -CoD.TextSettings.NormalFont.Height / 2,
bottom = CoD.TextSettings.NormalFont.Height / 2,
left = 0,
right = f62_local7 - f62_local5
} )
f62_local9:animateToState( "default" )
f62_local3:addElement( f62_local9 )
end
return self
end
function generic_separator( menu, controller )
local self = LUI.UIElement.new( {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 0,
left = 0,
right = 0,
height = 12
} )
self.id = "generic_spacer_id"
local f63_local1 = LUI.UIImage.new( {
material = RegisterMaterial( "box_white_gradient_fade_rt" ),
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
right = -GenericButtonSettings.Styles.GradientButton.focus_animation_distance - 7,
top = 2,
left = 0,
height = 2,
alpha = 0.15
} )
f63_local1.id = "generic_spacer_image_id"
self:addElement( f63_local1 )
return self
end
if Engine.InFrontend() then
LUI.MenuBuilder.registerDef( "generic_input_field", generic_input_field )
end
LUI.MenuBuilder.registerDef( "generic_debugMessageBox_popup", generic_debugMessageBox_popup )
LUI.MenuBuilder.registerDef( "generic_header", left_header )
LUI.MenuBuilder.registerType( "generic_menu_title", generic_menu_title )
LUI.MenuBuilder.registerType( "generic_border", generic_border )
LUI.MenuBuilder.registerType( "generic_drop_shadow", generic_drop_shadow )
LUI.MenuBuilder.registerType( "generic_drop_shadow_withfade", generic_drop_shadow_withfade )
LUI.MenuBuilder.registerType( "generic_back_button", generic_back_button )
LUI.MenuBuilder.registerDef( "left_header", left_header )
LUI.MenuBuilder.registerDef( "generic_popup_message", generic_popup_message )
LUI.MenuBuilder.registerDef( "generic_confirmation_popup", generic_confirmation_popup )
LUI.MenuBuilder.registerDef( "generic_yesno_popup", generic_yesno_popup )
LUI.MenuBuilder.registerDef( "generic_yesno_with_image_popup", generic_yesno_with_image_popup )
LUI.MenuBuilder.registerType( "generic_menu_background", generic_menu_background )
LUI.MenuBuilder.registerType( "generic_menu_background_withfade", generic_menu_background_withfade )
LUI.MenuBuilder.registerType( "generic_menu_titlebar", generic_menu_titlebar )
LUI.MenuBuilder.registerType( "generic_selectionList_popup", generic_selectionList_popup )
LUI.MenuBuilder.registerType( "generic_loading_widget", generic_loading_widget )
LUI.MenuBuilder.registerType( "generic_separator", generic_separator )
LockTable( _M )