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

2028 lines
65 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
DebugPrint( "Registering " .. _NAME )
LUI.UIGenericButton = {}
f0_local0 = function ( f1_arg0, f1_arg1 )
if f1_arg1 then
if f1_arg1.itemProps and f1_arg1.itemProps[f1_arg0] ~= nil then
return f1_arg1.itemProps[f1_arg0]
elseif f1_arg1.substyle and f1_arg1.substyle[f1_arg0] ~= nil then
return f1_arg1.substyle[f1_arg0]
elseif f1_arg1.style and f1_arg1.style[f1_arg0] ~= nil then
return f1_arg1.style[f1_arg0]
elseif GenericButtonSettings.Common[f1_arg0] ~= nil then
return GenericButtonSettings.Common[f1_arg0]
end
end
DebugPrint( "WARNING: MenuGenericButtons tried to read a setting that does not exist (" .. f1_arg0 .. "). You should be worried." )
end
f0_local1 = function ( f2_arg0, f2_arg1 )
local f2_local0 = f2_arg0.align
if not f2_local0 then
f2_local0 = LUI.Alignment.Right
end
local f2_local1 = f2_arg0.padding or 0
local f2_local2 = f2_arg0.yOffset or 0
local f2_local3 = f2_local0 == LUI.Alignment.Right
local f2_local4 = f2_local0 == LUI.Alignment.Left
local f2_local5 = LUI.UIText.new
local f2_local6 = CoD.ColorizeState
local f2_local7 = f2_arg0.text_default_color
local f2_local8 = {
alignment = f2_local0,
font = CoD.TextSettings.NormalFont.Font,
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = not f2_local4
}
if f2_local4 then
local f2_local9 = f2_local1
end
f2_local8.left = f2_local9 or 0
local f2_local10
if f2_local3 then
f2_local10 = -f2_local1
if not f2_local10 then
else
f2_local8.right = f2_local10
f2_local8.top = f2_local2 - CoD.TextSettings.NormalFont.Height / 2
f2_local8.bottom = f2_local2 + CoD.TextSettings.NormalFont.Height / 2
f2_local5 = f2_local5( f2_local6( f2_local7, f2_local8 ) )
f2_local5.id = "text_label"
f2_local5:registerAnimationState( "focus", CoD.ColorizeState( f2_arg0.text_focus_color ) )
f2_local5:registerAnimationState( "locked", CoD.ColorizeState( f2_arg0.text_lock_color ) )
f2_local5:registerAnimationState( "disabled", CoD.ColorizeState( f2_arg0.text_disabled_color ) )
f2_local5:registerAnimationState( "over_disabled", CoD.ColorizeState( f2_arg0.text_over_disabled_color ) )
f2_local5:registerAnimationState( "over_disabled_pulse", CoD.ColorizeState( f2_arg0.text_over_disabled_pulse_color ) )
f2_local5:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
f2_local5:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f2_local5:registerEventHandler( "button_over_disable", MBh.AnimateLoop( {
{
"over_disabled",
0
},
{
"over_disabled_pulse",
f2_arg0.overDisabledAnimationDuration
},
{
"over_disabled",
f2_arg0.overDisabledAnimationDuration
}
} ) )
f2_local5:registerEventHandler( "button_disable", MBh.AnimateToState( "disabled" ) )
f2_local5:registerEventHandler( "change_text_default_color", function ( element, event )
element:registerAnimationState( "default", CoD.ColorizeState( event.color ) )
end )
if f2_arg0.additional_handlers then
for f2_local10, f2_local11 in pairs( f2_arg0.additional_handlers ) do
f2_local5:addEventHandler( f2_local10, f2_local11 )
end
end
if f2_arg1 then
f2_local5:setText( f2_arg1 )
end
return f2_local5
end
end
f2_local10 = 0
end
f0_local2 = function ( f4_arg0, f4_arg1 )
if f4_arg0.properties and f4_arg0.properties.button_display_func then
local f4_local0 = f4_arg0.properties:button_display_func( f4_arg1 )
if f4_local0 then
f4_arg0:setText( f4_local0 )
end
end
end
local f0_local3 = function ( f5_arg0, f5_arg1 )
local f5_local0 = f5_arg0.width or 160
local f5_local1 = f5_arg0.margin or 0
local f5_local2 = f5_arg0.useText
local f5_local3 = f5_arg0.yOffset or 0
local f5_local4 = f5_arg0.useBackground
local f5_local5 = f5_arg0.backgroundMarginTop or 0
local f5_local6 = f5_arg0.backgroundMarginBottom or 0
local f5_local7 = f5_arg0.useArrows
local f5_local8 = f5_arg0.arrowsMargin
local f5_local9 = f5_arg0.useSlider
local f5_local10 = f5_arg0.sliderWidth
local f5_local11 = f5_arg0.sliderHeight
local f5_local12 = f5_arg0.useInput
local f5_local13 = f5_arg0.field_edited_func or nil
local f5_local14 = f5_arg0.max_length or 20
local f5_local15 = f5_arg0.password_field or false
local f5_local16 = f5_arg0.text_alignment
if not f5_local16 then
f5_local16 = LUI.Alignment.Left
end
local f5_local17 = f5_arg0.filter_profanity or false
local f5_local18 = f5_arg0.keyboard_type
if not f5_local18 then
f5_local18 = CoD.KeyboardInputTypes.Normal
end
local f5_local19 = f5_arg0.field_name or "Placeholder Field Name"
local self = LUI.UIElement.new( {
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 0,
left = -f5_local1 - f5_local0,
right = -f5_local1
} )
self.id = "button_value"
self.properties = f5_arg1 or {}
if f5_local4 then
local f5_local21 = LUI.UIImage.new( {
material = RegisterMaterial( "white" ),
red = 0,
green = 0,
blue = 0,
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = f5_local5,
bottom = -f5_local6,
left = 0,
right = 0,
alpha = 0
} )
f5_local21.id = "background"
f5_local21:registerAnimationState( "focus", {
alpha = 1
} )
f5_local21:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f5_local21:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
f5_local21:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) )
self:addElement( f5_local21 )
end
local f5_local21 = function ( f6_arg0, f6_arg1 )
if self.properties.button_left_func then
self.properties:button_left_func( f6_arg1 )
end
f6_arg0:processEvent( {
name = "content_arrow_left"
} )
self:processEvent( {
name = "content_refresh"
} )
end
local f5_local22 = function ( f7_arg0, f7_arg1 )
if self.properties.button_right_func then
self.properties:button_right_func( f7_arg1 )
end
self:processEvent( {
name = "content_refresh"
} )
f7_arg0:processEvent( {
name = "content_arrow_right"
} )
end
if f5_local7 then
local f5_local23 = function ( f8_arg0, f8_arg1 )
local f8_local0 = LUI.UIImage.new
local f8_local1 = {
material = RegisterMaterial( "widg_lobby_arrow" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 9,
bottom = -9
}
local f8_local2
if f8_arg1 then
f8_local2 = 17
if not f8_local2 then
else
f8_local1.left = f8_local2
if f8_arg1 then
f8_local2 = 5
if not f8_local2 then
else
f8_local1.right = f8_local2
f8_local1.alpha = 0
f8_local0 = f8_local0( f8_local1 )
f8_local0.id = "arrow_gfx"
f8_local0:registerAnimationState( "focus", CoD.ColorizeState( Engine.IsAliensMode() and Colors.alien_frontend_hilite or Colors.frontend_hilite ) )
f8_local0:registerAnimationState( "pulse", {
red = 1,
green = 1,
blue = 1
} )
f8_local2 = f8_local0
f8_local1 = f8_local0.registerEventHandler
local f8_local3 = "content_arrow_"
local self
if f8_arg1 then
self = "left"
if not self then
else
f8_local1( f8_local2, f8_local3 .. self, function ( f9_arg0, f9_arg1 )
if f5_local9 then
Engine.PlaySound( CoD.SFX.AdjustSlider )
else
Engine.PlaySound( CoD.SFX.OtherAdjust )
end
local f9_local0 = MBh.AnimateSequence( {
{
"pulse",
100
},
{
"focus",
200
}
} )
f9_local0( f9_arg0, f9_arg1 )
end )
f8_local1 = LUI.UIButton.new
f8_local2 = {
material = RegisterMaterial( "widg_lobby_arrow" ),
topAnchor = false,
bottomAnchor = false,
leftAnchor = f8_arg1,
rightAnchor = not f8_arg1,
top = f5_local3 - 15,
bottom = f5_local3 + 15
}
f8_local3 = f5_local8
if f8_arg1 then
self = 1
if not self then
else
f8_local3 = f8_local3 * self
if f8_arg1 then
self = 0
if not self then
else
f8_local2.left = f8_local3 + 12 * self - 5
f8_local3 = f5_local8
if f8_arg1 then
self = 1
if not self then
else
f8_local3 = f8_local3 * self
if f8_arg1 then
self = 1
if not self then
else
f8_local2.right = f8_local3 + 12 * self + 5
f8_local1 = f8_local1( f8_local2 )
f8_local1.id = "arrow_" .. f8_arg0
f8_local1.m_requireFocusType = FocusType.MouseOver
f8_local1:registerEventHandler( "hide_arrows", function ( element, event )
f8_local0:animateToState( "default" )
element.gainFocusSFX = nil
end )
f8_local1:registerEventHandler( "show_arrows", function ( element, event )
f8_local0:animateToState( "focus" )
element.gainFocusSFX = CoD.SFX.MouseOver
end )
f8_local1:processEvent( {
name = "hide_arrows"
} )
f8_local1:addElement( f8_local0 )
if f8_arg1 then
f8_local2 = "left"
if not f8_local2 then
else
if f8_arg1 then
f8_local3 = f5_local21
if not f8_local3 then
else
self:registerEventHandler( "button_" .. f8_local2, f8_local3 )
if not Engine.IsConsoleGame() then
f8_local1:registerEventHandler( "button_action", f8_local3 )
self = LUI.UIButtonRepeater.new( "leftmouse", "button_action", f8_local1 )
self:disable()
self:registerEventHandler( "button_up", self.disable )
self:registerEventHandler( "button_over", self.enable )
self:registerEventHandler( "button_over_disable", self.disable )
f8_local1:addElement( self )
local f8_local5 = LUI.UIButtonRepeater.new( f8_local2, "button_" .. f8_local2, self )
f8_local5.id = f8_local2 .. "_repeater"
f8_local5:disable()
f8_local5:registerEventHandler( "button_up", f8_local5.disable )
f8_local5:registerEventHandler( "button_over", f8_local5.enable )
f8_local5:registerEventHandler( "button_over_disable", f8_local5.disable )
self:addElement( f8_local5 )
if f5_local2 then
self:setMinDelay( 240 )
f8_local5:setMinDelay( 240 )
end
end
return f8_local1
end
end
f8_local3 = f5_local22
end
end
f8_local2 = "right"
end
end
self = 0
end
end
self = -1
end
end
self = -1
end
end
self = -1
end
end
self = "right"
end
end
f8_local2 = 17
end
end
f8_local2 = 5
end
self:addElement( f5_local23( "left", true ) )
self:addElement( f5_local23( "right", false ) )
if f5_arg1.button_left_func then
self.properties.button_left_func = f5_arg1.button_left_func
end
if f5_arg1.button_right_func then
self.properties.button_right_func = f5_arg1.button_right_func
end
end
if f5_local2 then
local f5_local23 = LUI.UIText.new
local f5_local24 = CoD.ColorizeState
local f5_local25 = f5_arg0.content_default_color
local f5_local26 = {}
local f5_local27 = f5_arg0.labelAlign
if not f5_local27 then
f5_local27 = LUI.Alignment.Center
end
f5_local26.alignment = f5_local27
f5_local26.font = CoD.TextSettings.NormalFont.Font
f5_local26.topAnchor = false
f5_local26.bottomAnchor = false
f5_local26.leftAnchor = false
f5_local26.rightAnchor = false
f5_local26.left = -f5_local0 / 2
f5_local26.right = f5_local0 / 2
f5_local26.top = f5_local3 - CoD.TextSettings.NormalFont.Height / 2
f5_local26.bottom = f5_local3 + CoD.TextSettings.NormalFont.Height / 2
f5_local23 = f5_local23( f5_local24( f5_local25, f5_local26 ) )
f5_local23.id = "content_text_label"
f5_local23:setText( "Placeholder" )
if f5_local4 then
f5_local24 = f5_arg0.content_focus_color
if not f5_local24 then
else
f5_local23:registerAnimationState( "focus", CoD.ColorizeState( f5_local24 ) )
f5_local23:registerAnimationState( "locked", CoD.ColorizeState( f5_arg0.content_lock_color ) )
f5_local23:registerAnimationState( "disabled", CoD.ColorizeState( f5_arg0.text_disabled_color ) )
f5_local23:registerAnimationState( "over_disabled", CoD.ColorizeState( f5_arg0.text_over_disabled_pulse_color ) )
f5_local23:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
f5_local23:registerEventHandler( "button_lock", MBh.AnimateToState( "locked" ) )
f5_local23:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f5_local23:registerEventHandler( "button_over_disable", MBh.AnimateToState( "disabled" ) )
f5_local23:registerEventHandler( "button_disable", MBh.AnimateToState( "disabled" ) )
if not f5_local4 then
f5_local23:registerEventHandler( "button_over_disable", MBh.AnimateToState( "over_disabled" ) )
end
f5_local23:registerEventHandler( "content_refresh", f0_local2 )
f5_local23:registerEventHandler( "menu_create", f0_local2 )
if f5_arg1.button_display_func then
f5_local23.properties = f5_arg1 or {}
f5_local23.properties.button_display_func = f5_arg1.button_display_func
f0_local2( f5_local23, {} )
end
self:addElement( f5_local23 )
end
end
f5_local24 = f5_arg0.content_focus_color_without_bg
end
if f5_local9 then
local f5_local23 = LUI.UIElement.new( {
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = false,
top = f5_local3 - f5_local11 / 2,
bottom = f5_local3 + f5_local11 / 2,
left = -f5_local10 / 2,
right = f5_local10 / 2
} )
f5_local23.id = "slider"
local f5_local24 = LUI.UIImage.new( {
material = RegisterMaterial( "white" ),
red = Colors.generic_menu_frame_color.r,
green = Colors.generic_menu_frame_color.g,
blue = Colors.generic_menu_frame_color.b,
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = -1,
bottom = 1,
left = -2,
right = 2
} )
f5_local24.id = "border"
f5_local23:addElement( f5_local24 )
local f5_local25 = LUI.UIImage.new( {
material = RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = -1,
right = 1,
red = 0,
green = 0,
blue = 0
} )
f5_local25.id = "background"
f5_local25:setHandleMouseButton( not Engine.IsConsoleGame() )
f5_local23:addElement( f5_local25 )
local f5_local26 = LUI.UIImage.new( {
material = RegisterMaterial( "widg_weapon_slider_mid" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 0,
left = 0,
right = f5_local10
} )
f5_local26.id = "fill"
f5_local23:addElement( f5_local26 )
local f5_local27 = function ( f12_arg0, f12_arg1 )
if f12_arg0.properties and f12_arg0.properties.button_display_func and f12_arg0.properties.slider_width then
local f12_local0 = f12_arg0.properties.button_display_func()
if f12_local0 == nil then
f12_local0 = 0
end
f5_local26:registerAnimationState( "default", {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = -1 * f12_arg0.properties.slider_width * (1 - f12_local0),
top = 0,
bottom = 0,
material = RegisterMaterial( "widg_weapon_slider_mid" )
} )
f5_local26:animateToState( "default", 0 )
end
end
if not Engine.IsConsoleGame() and f5_arg1.button_display_func then
f5_local25:registerEventHandler( "leftmousedown", function ( element, event )
if not element.disabled then
local f13_local0 = element:getWidth()
local f13_local1, f13_local2, f13_local3, f13_local4 = element:getRect()
f13_local1, f13_local2 = event.root:pixelsToUnits( f13_local1, f13_local2 )
local f13_local5, f13_local6 = event.root:pixelsToUnits( event.x, event.y )
local f13_local7 = (f13_local5 - f13_local1) / f13_local0
local f13_local8 = f5_arg1.button_display_func()
local f13_local9
if f13_local8 < f13_local7 then
f13_local9 = self.properties.button_right_func
if not f13_local9 then
else
local f13_local10 = f13_local8
local f13_local11 = nil
while (f13_local7 - f13_local8) * (f13_local7 - f13_local10) > 0 do
f13_local9( self, event )
f13_local11 = f13_local10
f13_local10 = f5_arg1.button_display_func()
if f13_local11 == f13_local10 then
break
end
end
self:processEvent( {
name = "content_refresh"
}, event )
end
end
f13_local9 = self.properties.button_left_func
end
end )
f5_local25:registerEventHandler( "button_disable", function ( element, event )
element.disabled = true
end )
f5_local25:registerEventHandler( "button_up", function ( element, event )
element.disabled = false
end )
end
f5_local23:registerEventHandler( "content_refresh", f5_local27 )
f5_local23:registerEventHandler( "menu_create", f5_local27 )
if f5_arg1.button_display_func then
f5_local23.properties = f5_arg1 or {}
f5_local23.properties.slider_width = f5_local10
f5_local23.properties.button_display_func = f5_arg1.button_display_func
f5_local27( f5_local23, {} )
end
self:addElement( f5_local23 )
end
if f5_local12 then
local f5_local24 = LUI.MenuBuilder.buildItems( {
type = "generic_input_field",
properties = {
textLeft = 0,
textAlign = LUI.Alignment.Center,
field_edited_func = f5_local13,
max_length = f5_local14,
password_field = f5_local15,
verify_string = false,
filter_profanity = f5_local17,
help_value = "",
field_name = f5_local19,
keyboard_type = f5_local18,
text_alignment = f5_local16
}
}, {} )
f5_local24.id = "input"
local f5_local26 = f5_local24
local f5_local25 = f5_local24.registerAnimationState
local f5_local27 = "default"
local f5_local28 = {}
local f5_local29 = f5_arg0.labelAlign
if not f5_local29 then
f5_local29 = LUI.Alignment.Center
end
f5_local28.alignment = f5_local29
f5_local28.font = CoD.TextSettings.NormalFont.Font
f5_local28.topAnchor = false
f5_local28.bottomAnchor = false
f5_local28.leftAnchor = false
f5_local28.rightAnchor = false
f5_local28.left = -f5_local0 / 2
f5_local28.right = f5_local0 / 2
f5_local28.top = f5_local3 - CoD.TextSettings.NormalFont.Height / 2
f5_local28.bottom = f5_local3 + CoD.TextSettings.NormalFont.Height / 2
f5_local28.alpha = 1
f5_local25( f5_local26, f5_local27, f5_local28 )
f5_local24:animateToState( "default" )
f5_local24:registerEventHandler( "button_over", function ( element, event )
MBh.AnimateToState( "focus" )
element:processEvent( {
name = "colorize",
red = f5_arg0.content_focus_color.r,
green = f5_arg0.content_focus_color.g,
blue = f5_arg0.content_focus_color.b
} )
end )
f5_local24:registerEventHandler( "button_up", function ( element, event )
MBh.AnimateToState( "default" )
element:processEvent( {
name = "colorize",
red = f5_arg0.content_default_color.r,
green = f5_arg0.content_default_color.g,
blue = f5_arg0.content_default_color.b
} )
element:processEvent( {
name = "edit_unfocus"
} )
end )
self:addElement( f5_local24 )
end
return self
end
local f0_local4 = function ( f18_arg0, f18_arg1 )
local f18_local0 = f18_arg0.checkboxMargin or 0
local f18_local1 = f18_arg0.yOffset or 0
local self = LUI.UIImage.new( {
material = RegisterMaterial( "box_empty" ),
topAnchor = false,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
top = f18_local1 - 6,
bottom = f18_local1 + 6,
left = -f18_local0 - 10,
right = -f18_local0,
alpha = 1
} )
self.id = "checkbox"
self.properties = {
isVisible = true
}
self:registerAnimationState( "hidden", {
alpha = 0
} )
self:registerEventHandler( "show_checkbox", function ( element, event )
element.properties.isVisible = true
if event.showBox ~= nil then
element.properties.isVisible = event.showBox
end
element:animateToState( element.properties.isVisible and "default" or "hidden", 0 )
end )
local f18_local3 = LUI.UIImage.new( {
material = RegisterMaterial( "white" ),
red = Colors.frontend_hilite.r,
green = Colors.frontend_hilite.g,
blue = Colors.frontend_hilite.b,
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 2,
bottom = -2,
left = 2,
right = -2,
alpha = 0
} )
f18_local3.id = "checkmark"
f18_local3.properties = {
isChecked = false
}
f18_local3:registerAnimationState( "checked", {
alpha = 1
} )
f18_local3:registerEventHandler( "toggle_checked", function ( element, event )
event.name = "set_checked"
event.checkBox = not element.properties.isChecked
element:processEvent( event )
end )
f18_local3:registerEventHandler( "set_checked", function ( element, event )
element.properties.isChecked = true
if event.checkBox ~= nil then
element.properties.isChecked = event.checkBox
end
element:animateToState( element.properties.isChecked and "checked" or "default", 0 )
end )
self:addElement( f18_local3 )
return self
end
local f0_local5 = function ( f22_arg0 )
local f22_local0 = f22_arg0.useActionButton
local self = LUI.UIImage.new( {
material = RegisterMaterial( "btn_00a_ltcap" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 0,
left = 0,
right = f0_local0( "lt_cap_width", f22_arg0 )
} )
self.id = "bgLeftCap"
self:registerAnimationState( "focus", {
material = Engine.IsAliensMode() and RegisterMaterial( "btn_alien_00a_ltcap_f" ) or RegisterMaterial( "btn_00a_ltcap_f" )
} )
self:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
self:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) )
self:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) )
self:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
local f22_local2 = LUI.UIImage.new( {
material = RegisterMaterial( "btn_00a_rtcap" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 0,
left = -f0_local0( "rt_cap_width", f22_arg0 ),
right = 0
} )
f22_local2.id = "bgRightCap"
f22_local2:registerAnimationState( "disabled", {
material = RegisterMaterial( f22_arg0.disablePadlock and "btn_00a_rtcap" or "btn_00a_rtcap_d" )
} )
if f22_local0 then
f22_local2:registerAnimationState( "focus", {
material = Engine.IsAliensMode() and RegisterMaterial( "btn_alien_00a_rtcap_f" ) or RegisterMaterial( "btn_00a_rtcap_f" )
} )
f22_local2:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
else
f22_local2:registerAnimationState( "focus", {
material = Engine.IsAliensMode() and RegisterMaterial( "btn_alien_00a_rtcap_f_pc" ) or RegisterMaterial( "btn_00a_rtcap_f_pc" )
} )
f22_local2:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
end
f22_local2:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f22_local2:registerEventHandler( "button_disable", MBh.AnimateToState( "disabled" ) )
f22_local2:registerEventHandler( "button_over_disable", MBh.AnimateToState( "disabled" ) )
if Engine.IsAliensMode() then
local f22_local3 = LUI.UIImage.new( {
material = RegisterMaterial( "btn_alien_overlay" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = -44,
bottom = 16,
left = -208,
right = -48,
alpha = 0
} )
f22_local3.id = "blood_splat_glow"
f22_local3:registerAnimationState( "glow", {
alpha = f0_local0( "focus_action_button_glow_max_alpha", f22_arg0 )
} )
f22_local3:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f22_local3:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) )
f22_local3:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) )
local f22_local4 = f22_local3
local f22_local5 = f22_local3.registerEventHandler
local f22_local6 = "button_over"
local f22_local7 = MBh.AnimateLoop
local f22_local8 = {}
local f22_local9 = {}
local f22_local10 = "glow"
local f22_local11 = f0_local0( "focus_glow_animation_duration", f22_arg0 )
f22_local9 = f22_local10
f22_local10 = {}
f22_local11 = "default"
local f22_local12 = f0_local0( "focus_glow_animation_duration", f22_arg0 )
f22_local10 = f22_local11
f22_local8[1] = f22_local9
f22_local8[2] = f22_local10
f22_local5( f22_local4, f22_local6, f22_local7( f22_local8 ) )
f22_local2:addElement( f22_local3 )
f22_local5 = LUI.UIImage.new( {
material = RegisterMaterial( "btn_alien_overlay_02" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = -28,
bottom = 32,
left = -208,
right = -48,
alpha = 0
} )
f22_local5.id = "blood_splat_glow_02"
f22_local5:registerAnimationState( "glow", {
alpha = f0_local0( "focus_alien_action_button_glow_max_alpha", f22_arg0 )
} )
f22_local5:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f22_local5:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) )
f22_local5:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) )
f22_local6 = f22_local5
f22_local4 = f22_local5.registerEventHandler
f22_local7 = "button_over"
f22_local8 = MBh.AnimateLoop
f22_local9 = {}
f22_local10 = {}
f22_local11 = "glow"
f22_local12 = f0_local0( "focus_alien_glow_animation_duration", f22_arg0 )
f22_local10 = f22_local11
f22_local11 = {}
f22_local12 = "default"
local f22_local13 = f0_local0( "focus_alien_glow_animation_duration", f22_arg0 )
f22_local11 = f22_local12
f22_local9[1] = f22_local10
f22_local9[2] = f22_local11
f22_local4( f22_local6, f22_local7, f22_local8( f22_local9 ) )
f22_local2:addElement( f22_local5 )
end
if f22_local0 then
local f22_local3 = LUI.UIText.new( {
alignment = LUI.Alignment.Right,
font = CoD.TextSettings.NormalFont.Font,
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 0,
right = -f22_arg0.actionButtonMargin,
top = f0_local0( "y_offset", f22_arg0 ) - 16,
bottom = f0_local0( "y_offset", f22_arg0 ) + 16,
alpha = 0
} )
f22_local3.id = "action_button"
f22_local3:setText( Engine.Localize( ButtonMap.button_action.string ) )
f22_local3:registerAnimationState( "focus", {
alpha = 1
} )
f22_local3:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f22_local3:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) )
f22_local3:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) )
f22_local3:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
f22_local2:addElement( f22_local3 )
end
local f22_local3 = LUI.UIImage.new( {
material = RegisterMaterial( "btn_00a_mid" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = f0_local0( "lt_cap_width", f22_arg0 ),
right = -f0_local0( "rt_cap_width", f22_arg0 )
} )
f22_local3.id = "bgMid"
f22_local3:registerAnimationState( "focus", {
material = Engine.IsAliensMode() and RegisterMaterial( "btn_alien_00a_mid_f" ) or RegisterMaterial( "btn_00a_mid_f" )
} )
f22_local3:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
f22_local3:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f22_local3:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) )
f22_local3:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) )
local f22_local5 = LUI.UIElement.new( {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0
} )
f22_local5.id = "hlist"
if f22_arg0.extendOnFocus then
f22_local5:registerAnimationState( "extended", {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = f0_local0( "focus_animation_distance", f22_arg0 ),
top = 0,
bottom = 0
} )
f22_local5:registerEventHandler( "button_over", MBh.AnimateToState( "extended", f0_local0( "focus_animation_duration", f22_arg0 ) ) )
f22_local5:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f22_local5:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) )
f22_local5:registerEventHandler( "button_over_disable", MBh.AnimateToState( "extended", f0_local0( "focus_animation_duration", f22_arg0 ) ) )
end
f22_local5:addElement( self )
f22_local5:addElement( f22_local3 )
f22_local5:addElement( f22_local2 )
local f22_local4 = LUI.UIImage.new( {
material = RegisterMaterial( "btn_00a_glow" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
red = 0,
green = 0,
blue = 0,
alpha = 0
} )
f22_local4.id = "selection_glow"
f22_local4:registerAnimationState( "glow", {
alpha = f0_local0( "focus_glow_max_alpha", f22_arg0 )
} )
f22_local4:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
local f22_local7 = f22_local4
local f22_local6 = f22_local4.registerEventHandler
local f22_local8 = "button_over"
local f22_local9 = MBh.AnimateLoop
local f22_local10 = {}
local f22_local11 = {}
local f22_local12 = "default"
local f22_local13 = f0_local0( "focus_glow_animation_duration", f22_arg0 )
f22_local11 = f22_local12
f22_local12 = {}
f22_local13 = "glow"
local f22_local14 = f0_local0( "focus_glow_animation_duration", f22_arg0 )
f22_local12 = f22_local13
f22_local10[1] = f22_local11
f22_local10[2] = f22_local12
f22_local6( f22_local7, f22_local8, f22_local9( f22_local10 ) )
f22_local6 = LUI.UIElement.new( {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0
} )
f22_local6.id = "background"
f22_local6:addElement( f22_local5 )
f22_local6:addElement( f22_local4 )
return f22_local6
end
local f0_local6 = function ( f23_arg0 )
local f23_local0 = f23_arg0.useActionButton
local f23_local1 = f0_local0( "submenu_substyle", f23_arg0 )
local f23_local2 = f0_local0( "border_height", f23_arg0 )
local f23_local3 = f0_local0( "border_padding", f23_arg0 )
local f23_local4 = not f0_local0( "disable_border", f23_arg0 )
local self = LUI.UIElement.new( {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
} )
self.id = "container"
if not f23_local4 or not f23_local2 then
f23_local2 = 0
end
if not f23_local4 or not f23_local3 then
f23_local3 = 0
end
if f23_local4 then
local f23_local6 = LUI.UIImage.new( CoD.ColorizeState( f0_local0( "border_color", f23_arg0 ), {
material = RegisterMaterial( "white" ),
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = -f23_local2,
bottom = 0,
left = 0,
right = 0
} ) )
f23_local6.id = "border"
self:addElement( f23_local6 )
end
local f23_local6 = LUI.UIElement.new( {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = f0_local0( "background_padding", f23_arg0 ),
bottom = -f23_local3 - f23_local2,
left = 0,
right = 0
} )
f23_local6.id = "background"
self:addElement( f23_local6 )
local f23_local7 = LUI.UIImage.new( {
material = RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 0
} )
f23_local7.id = "flat"
if f23_local1 then
local f23_local8 = f0_local0( "anim_interval", f23_arg0 )
local f23_local9 = f0_local0( "anim_1_alpha", f23_arg0 )
local f23_local10 = f0_local0( "anim_2_alpha", f23_arg0 )
f23_local7:registerAnimationState( "anim_1", {
alpha = f23_local9
} )
f23_local7:registerAnimationState( "anim_2", {
alpha = f23_local10
} )
f23_local7:registerEventHandler( "button_over", MBh.AnimateLoop( {
{
"anim_1",
0,
true,
true
},
{
"anim_1",
350,
true,
true
},
{
"anim_2",
f23_local8,
true,
true
},
{
"anim_1",
f23_local8,
true,
true
}
} ) )
else
f23_local7:registerAnimationState( "focus", {
red = 1,
green = 1,
blue = 1,
alpha = 0.5
} )
f23_local7:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
end
f23_local7:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f23_local7:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) )
f23_local6:addElement( f23_local7 )
if not f23_arg0.disablePadlock then
local f23_local8 = LUI.UIImage.new( CoD.ColorizeState( Colors.frontend_hilite, {
material = RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0,
alpha = 0
} ) )
f23_local8.id = "lock"
f23_local8:registerAnimationState( "visible", {
alpha = 1
} )
f23_local8:registerEventHandler( "button_lock", MBh.AnimateToState( "visible" ) )
f23_local8:registerEventHandler( "button_unlock", MBh.AnimateToState( "default" ) )
f23_local6:addElement( f23_local8 )
end
if f23_local0 and not f23_local1 then
local f23_local8 = LUI.UIImage.new( {
material = RegisterMaterial( "btn_cas_end_f" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 0,
left = -f0_local0( "prompt_width", f23_arg0 ),
right = 0,
alpha = 0
} )
f23_local8.id = "promptBG"
f23_local8:registerAnimationState( "focus", {
alpha = 1
} )
f23_local8:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f23_local8:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) )
f23_local8:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) )
f23_local8:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
f23_local6:addElement( f23_local8 )
if Engine.IsConsoleGame() or 1 == Engine.IsGamepadEnabled() then
local f23_local9 = LUI.UIText.new( {
alignment = LUI.Alignment.Right,
font = CoD.TextSettings.NormalFont.Font,
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 0,
right = -f23_arg0.actionButtonMargin,
top = -16,
bottom = 16,
alpha = 0
} )
f23_local9.id = "action_button"
f23_local9:setText( Engine.Localize( ButtonMap.button_action.string ) )
f23_local9:registerAnimationState( "focus", {
alpha = 1
} )
f23_local9:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f23_local9:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) )
f23_local9:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) )
f23_local9:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
f23_local6:addElement( f23_local9 )
end
end
return self
end
local f0_local7 = function ( f24_arg0 )
local f24_local0 = f24_arg0.useActionButton
local f24_local1 = f0_local0( "popup_substyle", f24_arg0 )
local f24_local2 = f0_local0( "submenu_substyle", f24_arg0 )
local f24_local3 = f0_local0( "border_height", f24_arg0 )
local f24_local4 = f0_local0( "border_padding", f24_arg0 )
local f24_local5 = not f0_local0( "disable_border", f24_arg0 )
local self = LUI.UIElement.new()
self.id = "container"
self:registerAnimationState( "default", {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = f0_local0( "ghost_height", f24_arg0 ),
left = 0,
right = f0_local0( "ghost_width", f24_arg0 )
} )
self:animateToState( "default" )
if not f24_local5 or not f24_local3 then
f24_local3 = 0
end
if not f24_local5 or not f24_local4 then
f24_local4 = 0
end
if f24_local5 then
local f24_local7 = LUI.UIImage.new()
f24_local7.id = "border"
f24_local7:registerAnimationState( "default", CoD.ColorizeState( f0_local0( "border_color", f24_arg0 ), {
material = RegisterMaterial( "white" ),
topAnchor = false,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
height = f24_local3,
bottom = -f24_local4,
left = 0,
right = -f0_local0( "ghost_width", f24_arg0 ),
alpha = 1
} ) )
f24_local7:registerAnimationState( "focus", {
alpha = 0
} )
f24_local7:animateToState( "default" )
f24_local7:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f24_local7:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) )
f24_local7:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) )
f24_local7:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
self:addElement( f24_local7 )
end
local f24_local7 = LUI.UIImage.new()
f24_local7.id = "bgLeftCap"
f24_local7:registerAnimationState( "default", {
material = RegisterMaterial( "btn_00d_ltcap_f" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 0,
left = 0,
right = f0_local0( "lt_cap_width", f24_arg0 ),
alpha = 0
} )
f24_local7:animateToState( "default" )
if f24_local1 or f24_local2 then
f24_local7:registerAnimationState( "anim_1", {
alpha = f0_local0( "anim_1_alpha", f24_arg0 )
} )
f24_local7:registerAnimationState( "anim_2", {
alpha = f0_local0( "anim_2_alpha", f24_arg0 )
} )
f24_local7:registerEventHandler( "button_over", MBh.AnimateLoop( {
{
"anim_1",
0,
true,
true
},
{
"anim_1",
350,
true,
true
},
{
"anim_2",
f0_local0( "anim_interval", f24_arg0 ),
true,
true
},
{
"anim_1",
f0_local0( "anim_interval", f24_arg0 ),
true,
true
}
} ) )
f24_local7:registerEventHandler( "button_over_disable", MBh.AnimateLoop( {
{
"anim_1",
0,
true,
true
},
{
"anim_1",
350,
true,
true
},
{
"anim_2",
f0_local0( "anim_interval", f24_arg0 ),
true,
true
},
{
"anim_1",
f0_local0( "anim_interval", f24_arg0 ),
true,
true
}
} ) )
else
f24_local7:registerAnimationState( "focus", {
alpha = 1
} )
f24_local7:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
f24_local7:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) )
end
f24_local7:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f24_local7:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) )
self:addElement( f24_local7 )
local f24_local8 = LUI.UIImage.new()
f24_local8.id = "bgMid"
local f24_local9 = f24_local8
local f24_local10 = f24_local8.registerAnimationState
local f24_local11 = "default"
local f24_local12 = {
material = RegisterMaterial( "btn_00d_mid_f" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = f0_local0( "lt_cap_width", f24_arg0 )
}
local f24_local13
if f24_local1 or f24_local2 then
f24_local13 = -1 * (f0_local0( "lt_cap_width", f24_arg0 ) + f0_local0( "ghost_width", f24_arg0 ))
if not f24_local13 then
else
f24_local12.right = f24_local13
f24_local12.alpha = 0
f24_local10( f24_local9, f24_local11, f24_local12 )
f24_local8:animateToState( "default" )
if f24_local1 or f24_local2 then
f24_local8:registerAnimationState( "anim_1", {
alpha = f0_local0( "anim_1_alpha", f24_arg0 )
} )
f24_local8:registerAnimationState( "anim_2", {
alpha = f0_local0( "anim_2_alpha", f24_arg0 )
} )
f24_local8:registerEventHandler( "button_over", MBh.AnimateLoop( {
{
"anim_1",
0,
true,
true
},
{
"anim_1",
350,
true,
true
},
{
"anim_2",
f0_local0( "anim_interval", f24_arg0 ),
true,
true
},
{
"anim_1",
f0_local0( "anim_interval", f24_arg0 ),
true,
true
}
} ) )
f24_local8:registerEventHandler( "button_over_disable", MBh.AnimateLoop( {
{
"anim_1",
0,
true,
true
},
{
"anim_1",
350,
true,
true
},
{
"anim_2",
f0_local0( "anim_interval", f24_arg0 ),
true,
true
},
{
"anim_1",
f0_local0( "anim_interval", f24_arg0 ),
true,
true
}
} ) )
else
f24_local8:registerAnimationState( "focus", {
alpha = 1
} )
f24_local8:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
f24_local8:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) )
end
f24_local8:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f24_local8:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) )
self:addElement( f24_local8 )
f24_local10 = LUI.UIImage.new()
f24_local10.id = "bgRightCap"
if f24_local1 or f24_local2 then
f24_local10:registerAnimationState( "default", {
material = RegisterMaterial( "btn_00d_rtcap_f_alt" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = false,
rightAnchor = true,
top = 0,
bottom = 0,
left = -1 * (f0_local0( "lt_cap_width", f24_arg0 ) + f0_local0( "ghost_width", f24_arg0 )),
right = -f0_local0( "ghost_width", f24_arg0 ),
alpha = 0
} )
f24_local10:animateToState( "default" )
f24_local10:registerAnimationState( "anim_1", {
alpha = f0_local0( "anim_1_alpha", f24_arg0 )
} )
f24_local10:registerAnimationState( "anim_2", {
alpha = f0_local0( "anim_2_alpha", f24_arg0 )
} )
f24_local10:registerEventHandler( "button_over", MBh.AnimateLoop( {
{
"anim_1",
0,
true,
true
},
{
"anim_1",
350,
true,
true
},
{
"anim_2",
f0_local0( "anim_interval", f24_arg0 ),
true,
true
},
{
"anim_1",
f0_local0( "anim_interval", f24_arg0 ),
true,
true
}
} ) )
f24_local10:registerEventHandler( "button_over_disable", MBh.AnimateLoop( {
{
"anim_1",
0,
true,
true
},
{
"anim_1",
350,
true,
true
},
{
"anim_2",
f0_local0( "anim_interval", f24_arg0 ),
true,
true
},
{
"anim_1",
f0_local0( "anim_interval", f24_arg0 ),
true,
true
}
} ) )
else
f24_local11 = f24_local10
f24_local9 = f24_local10.registerAnimationState
f24_local12 = "default"
f24_local13 = {}
local f24_local14 = RegisterMaterial
local f24_local15
if f24_local0 then
f24_local15 = "btn_00d_rtcap_f"
if not f24_local15 then
else
f24_local13.material = f24_local14( f24_local15 )
f24_local13.topAnchor = true
f24_local13.bottomAnchor = true
f24_local13.leftAnchor = false
f24_local13.rightAnchor = true
f24_local13.top = 0
f24_local13.bottom = 0
f24_local13.left = -f0_local0( "rt_cap_width", f24_arg0 )
f24_local13.right = 0
f24_local13.alpha = 0
f24_local9( f24_local11, f24_local12, f24_local13 )
f24_local10:animateToState( "default" )
f24_local10:registerAnimationState( "focus", {
alpha = 1
} )
f24_local10:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
f24_local10:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) )
end
end
f24_local15 = "btn_00d_rtcap_f_pc"
end
f24_local10:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f24_local10:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) )
self:addElement( f24_local10 )
f24_local9 = LUI.UIImage.new()
f24_local9.id = "lock"
f24_local9:registerAnimationState( "default", CoD.ColorizeState( Colors.frontend_hilite, {
material = RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = -f0_local0( "lock_padding", f24_arg0 ),
left = 0,
right = -f0_local0( "ghost_width", f24_arg0 ),
alpha = 0
} ) )
f24_local9:registerAnimationState( "visible", {
alpha = 1
} )
f24_local9:animateToState( "default" )
f24_local9:registerEventHandler( "button_lock", MBh.AnimateToState( "visible" ) )
f24_local9:registerEventHandler( "button_unlock", MBh.AnimateToState( "default" ) )
self:addElement( f24_local9 )
if f24_local0 then
f24_local11 = LUI.UIText.new()
f24_local11.id = "action_button"
f24_local11:setText( Engine.Localize( ButtonMap.button_action.string ) )
f24_local11:registerAnimationState( "default", {
alignment = LUI.Alignment.Right,
font = CoD.TextSettings.NormalFont.Font,
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
left = 0,
right = -f24_arg0.actionButtonMargin,
top = f0_local0( "height", f24_arg0 ) / 2 + f0_local0( "y_offset", f24_arg0 ) - 16,
bottom = f0_local0( "height", f24_arg0 ) / 2 + f0_local0( "y_offset", f24_arg0 ) + 16,
alpha = 0
} )
f24_local11:animateToState( "default" )
f24_local11:registerAnimationState( "focus", {
alpha = 1
} )
f24_local11:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f24_local11:registerEventHandler( "button_disable", MBh.AnimateToState( "default" ) )
f24_local11:registerEventHandler( "button_over_disable", MBh.AnimateToState( "default" ) )
f24_local11:registerEventHandler( "button_over", MBh.AnimateToState( "focus" ) )
f24_local10:addElement( f24_local11 )
end
if not f24_arg0.disablePadlock then
f24_local11 = LUI.UIImage.new()
f24_local11.id = "padlock"
f24_local11:registerAnimationState( "default", {
material = RegisterMaterial( "icon_lock_mini" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = false,
rightAnchor = true,
left = -f0_local0( "padlock_margin", f24_arg0 ) - f0_local0( "padlock_width", f24_arg0 ),
right = -f0_local0( "padlock_margin", f24_arg0 ),
top = f0_local0( "height", f24_arg0 ) / 2 + f0_local0( "y_offset", f24_arg0 ) - f0_local0( "padlock_height", f24_arg0 ) / 2,
bottom = f0_local0( "height", f24_arg0 ) / 2 + f0_local0( "y_offset", f24_arg0 ) + f0_local0( "padlock_height", f24_arg0 ) / 2,
alpha = 0
} )
f24_local11:animateToState( "default" )
f24_local11:registerAnimationState( "visible", {
alpha = 1,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b
} )
f24_local11:registerAnimationState( "visible_over", {
alpha = 1,
red = Colors.black.r,
green = Colors.black.g,
blue = Colors.black.b
} )
f24_local11:registerEventHandler( "button_over", MBh.AnimateToState( "default" ) )
f24_local11:registerEventHandler( "button_up", MBh.AnimateToState( "default" ) )
f24_local11:registerEventHandler( "button_disable", MBh.AnimateToState( "visible" ) )
f24_local11:registerEventHandler( "button_over_disable", MBh.AnimateToState( "visible_over" ) )
self:addElement( f24_local11 )
end
return self
end
end
f24_local13 = -f0_local0( "rt_cap_width", f24_arg0 )
end
function CreateGenericButtonBackground( f25_arg0, f25_arg1, f25_arg2, f25_arg3, f25_arg4, f25_arg5, f25_arg6 )
local f25_local0 = {
style = f25_arg0,
substyle = f25_arg1,
itemProps = f25_arg2
}
local f25_local1 = nil
f25_local0.useActionButton = f25_arg4 or f25_arg3 or f25_arg5
local f25_local2 = assert
local f25_local3
if f0_local0( "force_disable_action_button", f25_arg6 ) then
f25_local3 = not f0_local0( "force_enable_action_button", f25_arg6 )
else
f25_local3 = true
end
f25_local2( f25_local3, "Trying to force enable and force disable the button prompt." )
f25_local2 = f25_local0.useActionButton
if f25_local2 then
f25_local2 = not f0_local0( "force_disable_action_button", f25_arg6 )
end
f25_local0.useActionButton = f25_local2
f25_local2 = f25_local0.useActionButton
if not f25_local2 then
f25_local2 = f0_local0( "force_enable_action_button", f25_arg6 )
end
f25_local0.useActionButton = f25_local2
f25_local2 = f25_local0.useActionButton
if f25_local2 then
f25_local2 = Engine.IsConsoleGame()
if not f25_local2 then
f25_local2 = Engine.IsGamepadEnabled() == 1
end
end
f25_local0.useActionButton = f25_local2
if not f25_arg3 and not f25_arg4 and not f25_arg5 then
f25_local2 = f0_local0( "force_enable_action_button", f25_arg6 )
if f25_local2 then
else
f25_local0.extendOnFocus = f25_local2
f25_local0.disablePadlock = f0_local0( "disable_padlock", f25_arg6 )
f25_local0.actionButtonMargin = f0_local0( "action_button_margin", f25_arg6 )
if f25_arg0 == GenericButtonSettings.Styles.GradientButton then
f25_local1 = f0_local5( f25_local0 )
elseif f25_arg0 == GenericButtonSettings.Styles.FlatButton then
f25_local1 = f0_local6( f25_local0 )
elseif f25_arg0 == GenericButtonSettings.Styles.GlassButton then
f25_local1 = f0_local7( f25_local0 )
end
if f25_local1 then
f25_local1:setPriority( -1000 )
end
return f25_local1
end
end
f25_local2 = not f0_local0( "force_disable_action_button", f25_arg6 )
end
function UpdateButtonText( f26_arg0, f26_arg1 )
f26_arg0.textLabel:setText( f26_arg1 )
end
function UpdateDescText( f27_arg0, f27_arg1 )
if f27_arg0.properties.desc_text then
local f27_local0 = ""
if type( f27_arg0.properties.desc_text ) == "string" then
f27_local0 = f27_arg0.properties.desc_text
elseif type( f27_arg0.properties.desc_text ) == "function" then
f27_local0 = f27_arg0.properties:desc_text( f27_arg1 )
assert( type( f27_local0 ) == "string" )
end
f27_arg0:dispatchEventToRoot( {
name = "set_button_info_text",
text = f27_local0
} )
end
end
LUI.UIGenericButton.new = function ( f28_arg0, f28_arg1, f28_arg2 )
if not f28_arg1 then
f28_arg1 = {}
end
local f28_local0 = f28_arg1.childNum
if not f28_arg2 then
f28_arg2 = f28_local0 or 0
end
local f28_local1 = nil
local f28_local2 = f28_arg1.style
if not f28_local2 then
f28_local2 = GenericButtonSettings.Styles.GradientButton
end
local f28_local3 = f28_arg1.variant
if not f28_local3 then
f28_local3 = GenericButtonSettings.Variants.Plain
end
local f28_local4 = f28_local3 == GenericButtonSettings.Variants.Checkbox
local f28_local5 = f28_local3 == GenericButtonSettings.Variants.Plain
local f28_local6 = f28_local3 == GenericButtonSettings.Variants.Info
local f28_local7 = f28_local3 == GenericButtonSettings.Variants.Select
local f28_local8 = f28_local3 == GenericButtonSettings.Variants.Slider
local f28_local9 = f28_local3 == GenericButtonSettings.Variants.Input
local f28_local10 = f28_local8 or f28_local7 or f28_local6 or f28_local9
local f28_local11
if f28_local2 == GenericButtonSettings.Styles.GradientButton then
f28_local11 = not f28_arg1.disableAnimation
else
f28_local11 = false
end
if f28_local2 == GenericButtonSettings.Styles.FlatButton then
f28_local1 = f28_arg1.substyle or GenericButtonSettings.Styles.FlatButton.SubStyles.Default
elseif f28_local2 == GenericButtonSettings.Styles.GlassButton then
f28_local1 = f28_arg1.substyle or GenericButtonSettings.Styles.GlassButton.SubStyles.Default
end
if not f28_local1 then
f28_local1 = {}
end
local f28_local12 = {
style = f28_local2,
substyle = f28_local1,
itemProps = f28_arg1
}
local f28_local13 = LUI.UIButton.new
local self = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
top = 0,
bottom = f0_local0( "height", f28_local12 )
}
local f28_local15
if f28_local2 == GenericButtonSettings.Styles.GradientButton then
f28_local15 = -f0_local0( "focus_animation_distance", f28_local12 )
if not f28_local15 then
else
self.right = f28_local15
self.left = 0
f28_local13 = f28_local13( self )
f28_local13.id = "UIGenericButton"
f28_local13.properties = f28_local13.properties or {}
self = LUI.UIElement.new()
self.id = "button"
f28_local13:addElement( self )
f28_local15 = not f0_local0( "disable_height_guard", f28_local12 )
if f28_local11 then
local f28_local16 = self
local f28_local17 = self.registerAnimationState
local f28_local18 = "default"
local f28_local19 = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = not f28_local15,
top = 0
}
local f28_local20
if f28_local15 then
f28_local20 = f0_local0( "height", f28_local12 )
if not f28_local20 then
else
f28_local19.bottom = f28_local20
f28_local19.left = -f0_local0( "lt_cap_width", f28_local12 ) - f0_local0( "rt_cap_width", f28_local12 )
f28_local19.right = 0
f28_local17( f28_local16, f28_local18, f28_local19 )
f28_local16 = self
f28_local17 = self.registerAnimationState
f28_local18 = "ready"
f28_local19 = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = not f28_local15,
left = 0,
right = 0,
top = 0
}
if f28_local15 then
f28_local20 = f0_local0( "height", f28_local12 )
if not f28_local20 then
else
f28_local19.bottom = f28_local20
f28_local17( f28_local16, f28_local18, f28_local19 )
f28_local16 = MBh.AnimateSequence( {
{
"default",
0,
false,
false
},
{
"ready",
f0_local0( "slide_in_min_duration", f28_local12 ) + f0_local0( "slide_in_duration_step", f28_local12 ) * f28_arg2,
false,
true
}
} )
f28_local16( self, {} )
if f28_arg2 == 1 then
Engine.PlaySound( CoD.SFX.ChangeScreen )
end
end
end
f28_local20 = 0
end
end
f28_local20 = 0
else
local f28_local16 = self
local f28_local17 = self.registerAnimationState
local f28_local18 = "default"
local f28_local19 = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = not f28_local15,
left = 0,
right = 0,
top = 0
}
local f28_local20
if f28_local15 then
f28_local20 = f0_local0( "height", f28_local12 )
if not f28_local20 then
else
f28_local19.bottom = f28_local20
f28_local17( f28_local16, f28_local18, f28_local19 )
self:animateToState( "default" )
end
end
f28_local20 = 0
end
self.background = CreateGenericButtonBackground( f28_local2, f28_local1, f28_arg1, f28_local5, f28_local6, f28_local9, f28_local12 )
self:addElement( self.background )
self:registerEventHandler( "refresh_button_background", function ( element, event )
element.background:close()
element.background = CreateGenericButtonBackground( f28_local2, f28_local1, f28_arg1, f28_local5, f28_local6, f28_local9, f28_local12 )
self:addElement( self.background )
end )
local f28_local17 = {
yOffset = f0_local0( "y_offset", f28_local12 ),
text_focus_color = f0_local0( "text_focus_color", f28_local12 ),
text_lock_color = f0_local0( "text_lock_color", f28_local12 ),
text_default_color = f0_local0( "text_default_color", f28_local12 ),
text_disabled_color = f0_local0( "text_disabled_color", f28_local12 ),
text_over_disabled_color = f0_local0( "text_over_disabled_color", f28_local12 ),
text_over_disabled_pulse_color = f0_local0( "text_over_disabled_pulse_color", f28_local12 ),
overDisabledAnimationDuration = f0_local0( "over_disabled_animation_duration", f28_local12 )
}
if f28_local10 then
f28_local17.padding = f0_local0( "text_padding_with_content", f28_local12 )
f28_local17.align = f0_local0( "text_align_with_content", f28_local12 )
else
f28_local17.padding = f0_local0( "text_padding_without_content", f28_local12 )
f28_local17.align = f0_local0( "text_align_without_content", f28_local12 )
end
if f28_local2 == GenericButtonSettings.Styles.FlatButton or f28_local2 == GenericButtonSettings.Styles.GlassButton then
f28_local17.additional_handlers = {
button_lock = function ( f30_arg0, f30_arg1 )
if not Engine.IsConsoleGame() then
f28_local13.m_ignoreMouseFocus = true
if Engine.IsGamepadEnabled() ~= 1 then
f28_local13:processEvent( {
name = "lose_focus",
immediate = true
} )
f28_local13.m_ignoreMouseFocus = true
f28_local13.m_mouseOver = nil
end
end
f30_arg0:animateToState( "locked" )
end,
button_unlock = function ( f31_arg0, f31_arg1 )
if not f31_arg1.graphicsOnly then
f31_arg0:animateToState( "default" )
if not Engine.IsConsoleGame() then
f28_local13.m_ignoreMouseFocus = false
if Engine.IsGamepadEnabled() ~= 1 then
f28_local13.m_focusable = true
end
end
f28_local13:processEvent( {
name = "button_up",
immediate = true,
dispatchChildren = true
} )
end
end
}
end
f28_local13.textLabel = f0_local1( f28_local17, f28_arg1.button_text )
f28_local13.setText = UpdateButtonText
self:addElement( f28_local13.textLabel )
if f28_local10 then
local f28_local16 = {}
local f28_local18
if not f28_local8 then
f28_local18 = not f28_local9
else
f28_local18 = false
end
f28_local16.useText = f28_local18
f28_local16.useInput = f28_local9
f28_local16.field_edited_func = f0_local0( "field_edited_func", f28_local12 )
f28_local16.max_length = f0_local0( "max_length", f28_local12 )
f28_local16.password_field = f0_local0( "password_field", f28_local12 )
f28_local16.filter_profanity = f0_local0( "filter_profanity", f28_local12 )
f28_local16.keyboard_type = f0_local0( "keyboard_type", f28_local12 )
f28_local16.field_name = f0_local0( "field_name", f28_local12 )
f28_local16.text_alignment = f0_local0( "text_alignment", f28_local12 )
f28_local16.useBackground = not f28_local6
if not f28_local6 then
f28_local18 = not f28_local9
else
f28_local18 = false
end
f28_local16.useArrows = f28_local18
f28_local16.arrowsMargin = f0_local0( "content_arrows_margin", f28_local12 )
f28_local16.useSlider = f28_local8
f28_local16.sliderWidth = f0_local0( "content_slider_width", f28_local12 )
f28_local16.sliderHeight = f0_local0( "content_slider_height", f28_local12 )
f28_local16.margin = f0_local0( "content_margin", f28_local12 )
f28_local16.width = f0_local0( "content_width", f28_local12 )
f28_local16.yOffset = f0_local0( "y_offset", f28_local12 )
f28_local16.backgroundMarginTop = f0_local0( "content_background_margin_top", f28_local12 )
f28_local16.backgroundMarginBottom = f0_local0( "content_background_margin_bottom", f28_local12 )
f28_local16.labelAlign = f0_local0( "label_align", f28_local12 )
f28_local16.text_focus_color = f0_local0( "text_focus_color", f28_local12 )
f28_local16.content_default_color = f0_local0( "content_default_color", f28_local12 )
f28_local16.content_lock_color = f0_local0( "content_lock_color", f28_local12 )
f28_local16.content_focus_color = f0_local0( "content_focus_color", f28_local12 )
f28_local16.content_focus_color_without_bg = f0_local0( "content_focus_color_without_bg", f28_local12 )
f28_local16.text_disabled_color = f0_local0( "text_disabled_color", f28_local12 )
f28_local16.text_over_disabled_color = f0_local0( "text_over_disabled_color", f28_local12 )
f28_local16.text_over_disabled_pulse_color = f0_local0( "text_over_disabled_pulse_color", f28_local12 )
self:addElement( f0_local3( f28_local16, f28_arg1 ) )
elseif f28_local4 then
self:addElement( f0_local4( {
checkboxMargin = f0_local0( "checkbox_margin", f28_local12 ),
yOffset = f0_local0( "y_offset", f28_local12 )
}, f28_arg1 ) )
end
if Engine.InFrontend() then
local f28_local16 = f0_local0( "newIconSize", f28_local12 )
local f28_local20 = LUI.UIImage.new( {
material = RegisterMaterial( "icon_new_2" ),
topAnchor = false,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = f0_local0( "y_offset", f28_local12 ) - f28_local16 / 2,
height = f28_local16,
left = f0_local0( "newIconIndent", f28_local12 ),
width = f28_local16,
alpha = 0
} )
f28_local20.id = "newIcon"
f28_local20:registerAnimationState( "visible", {
alpha = 1
} )
f28_local20:registerAnimationState( "darker", {
alpha = 0.5
} )
f28_local20:registerEventHandler( "show_new_icon", MBh.AnimateToState( "visible" ) )
f28_local20:registerEventHandler( "hide_new_icon", MBh.AnimateToState( "default", 50 ) )
f28_local20:registerEventHandler( "flash_new_icon", MBh.AnimateLoop( {
{
"visible",
0
},
{
"darker",
300
},
{
"visible",
300
}
} ) )
self:addElement( f28_local20 )
end
f28_local13.properties.desc_text = f28_arg1.desc_text
f28_local13.properties.button_over_func = f28_arg1.button_over_func
f28_local13:registerEventHandler( "button_over", function ( element, event )
UpdateDescText( element, event )
if element.properties.button_over_func then
element.properties:button_over_func( event )
end
if f28_local10 and not f28_local6 then
element:processEvent( {
name = "show_arrows"
} )
end
end )
f28_local13.properties.button_up_func = f28_arg1.button_up_func
f28_local13:registerEventHandler( "button_up", function ( element, event )
if element.properties.button_up_func then
element.properties:button_up_func( event )
end
if f28_local10 and not f28_local6 then
element:processEvent( {
name = "hide_arrows"
} )
end
end )
f28_local13.properties.button_action_func = f28_arg1.button_action_func
f28_local13:registerEventHandler( "button_action", function ( element, event )
if f28_local4 then
element:processEvent( {
name = "toggle_checked"
} )
end
if f28_local9 and not event.mouse then
element:dispatchEventToChildren( event )
end
if element.properties.button_action_func then
element.properties:button_action_func( event )
if f28_local2 == GenericButtonSettings.Styles.FlatButton and f0_local0( "use_locking", f28_local12 ) then
element:processEvent( {
name = "button_lock",
dispatchChildren = true
} )
end
end
end )
if f28_arg1.button_disable_func then
f28_local13.properties.button_disable_func = f28_arg1.button_disable_func
f28_local13:registerEventHandler( "button_disable", function ( element, event )
if element.properties.button_disable_func then
element.properties:button_disable_func( event )
end
end )
end
if f28_arg1.button_action_disable_func then
f28_local13.properties.button_action_disable_func = f28_arg1.button_action_disable_func
f28_local13:registerEventHandler( "button_action_disable", function ( element, event )
if element.properties.button_action_disable_func then
element.properties:button_action_disable_func( event )
end
end )
end
f28_local13.properties.button_over_disable_func = f28_arg1.button_over_disable_func
f28_local13:registerEventHandler( "button_over_disable", function ( element, event )
UpdateDescText( element, event )
if element.properties.button_over_disable_func then
element.properties:button_over_disable_func( event )
end
if f28_local10 and not f28_local6 then
element:processEvent( {
name = "hide_arrows"
} )
end
end )
if f28_local2 == GenericButtonSettings.Styles.FlatButton and f0_local0( "use_locking", f28_local12 ) then
f28_local13:registerEventHandler( "restore_focus", function ( element, event )
element:processEvent( {
name = "button_unlock",
dispatchChildren = true
} )
return LUI.UIElement.restoreFocus( element, event )
end )
end
if f28_arg1.additional_children_func then
assert( type( f28_arg1.additional_children_func ) == "function" )
local f28_local16 = f28_arg1:additional_children_func()
assert( istable( f28_local16 ) )
for f28_local21, f28_local22 in ipairs( f28_local16 ) do
assert( istable( f28_local22 ) )
LUI.MenuBuilder.BuildAddChild( self, f28_local22 )
end
end
return f28_local13
end
end
f28_local15 = 0
end
LUI.MenuBuilder.registerType( "UIGenericButton", LUI.UIGenericButton.new )
LockTable( _M )