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

649 lines
13 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
menupos_left = 100
menupos_right = 750
menupos_top = 100
menupos_bottom = 308
wide_amount = 200
spacer_height = 1
cap_width = 32
cap_height = 32
button_height = 40
text_height = 26
function ability_button_template()
return {
type = "UIButton",
focusable = true,
properties = {
button_text_alignment = LUI.Alignment.Center,
button_text = "Button Text ",
action_func = function ()
DebugPrint( "Button Action Func: Override me in specific button instances" )
end
},
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = button_height
}
},
handlers = {
button_action = MBh.Property( "action_func" )
},
children = {
{
type = "ability_button"
}
}
}
end
function ability_button()
return {
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 0,
left = 2,
right = menupos_right - 112
}
},
children = {
{
type = "UIImage",
id = "button_texture",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = 0,
left = 2,
right = menupos_right - 112,
red = 1,
green = 1,
blue = 1,
alpha = 0,
material = RegisterMaterial( "btn_cas_fill_f" )
},
dim = {
red = 0.8,
green = 0.8,
blue = 0.8,
alpha = 1
},
brite = {
red = 1,
green = 1,
blue = 1,
alpha = 1
}
},
handlers = {
button_over = MBh.AnimateLoop( {
{
"dim",
800
},
{
"brite",
800
}
} ),
button_up = MBh.AnimateToState( "default", 0 )
}
},
{
type = "UIImage",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 1,
bottom = -1,
left = menupos_right - 152,
right = menupos_right - 100,
material = RegisterMaterial( "btn_cas_end_f" ),
alpha = 0
},
over = {
alpha = 1
}
},
handlers = {
button_over = MBh.AnimateToState( "over", 0 ),
button_up = MBh.AnimateToState( "default", 0 )
},
children = {}
},
{
type = "UIImage",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 0,
bottom = -18,
left = 2,
right = menupos_right - 102,
material = RegisterMaterial( "white" ),
alpha = 0
},
over = {
alpha = 0.15
}
},
handlers = {
button_over = MBh.AnimateToState( "over", 0 ),
button_up = MBh.AnimateToState( "default", 0 )
}
},
{
type = "UIImage",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = false,
top = 12,
bottom = -12,
left = menupos_right - 142,
right = menupos_right - 110,
material = RegisterMaterial( "fluff_arrow_outline" ),
alpha = 1
},
button_over = {
alpha = 0
}
},
handlers = {
button_over = MBh.AnimateToState( "button_over" ),
button_up = MBh.AnimateToState( "default" )
}
}
}
}
end
function ability_horizontal_spacer()
return {
type = "UIImage",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = false,
left = 10,
right = -10,
top = 0,
bottom = spacer_height,
material = RegisterMaterial( "white" ),
red = 0,
green = 0,
blue = 0,
alpha = 0.8
}
},
children = {
{
type = "UIImage",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = false,
bottomAnchor = false,
left = 0,
right = 0,
top = 1,
bottom = spacer_height + 1,
material = RegisterMaterial( "white" ),
red = 0.35,
green = 0.35,
blue = 0.35,
alpha = 1
}
}
}
}
}
end
function ability_button_design_template_list()
return {
type = "UIVerticalList",
focusable = true,
states = {
default = {
alignment = LUI.Alignment.Top,
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = menupos_left,
right = menupos_right,
top = menupos_top,
bottom = menupos_bottom,
spacing = 0
}
}
}
end
function CasAbilityButton()
return {
type = "UIElement",
id = "ability_button_template_main_id",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 0,
left = 0,
right = 0
}
},
children = {
{
type = "UIImage",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
red = 1,
green = 1,
blue = 1,
alpha = 1,
material = RegisterMaterial( "white" )
}
}
},
{
type = "UIVerticalList",
states = {
default = {
alignment = LUI.Alignment.Top,
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = menupos_left,
right = menupos_right,
top = menupos_top,
bottom = menupos_bottom
}
},
children = {
{
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = 24,
left = 0,
right = 0
}
},
children = {
{
type = "UIHorizontalList",
id = "title_box_list",
states = {
default = {
alignment = LUI.Alignment.Left,
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 200,
top = 0,
bottom = 24
}
},
children = {
{
type = "UIImage",
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 32,
top = 0,
bottom = 0,
red = 1,
green = 1,
blue = 1,
alpha = 1,
material = RegisterMaterial( "box_titlebar_angle_lt" )
}
}
},
{
type = "UIImage",
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 492,
top = 0,
bottom = 0,
red = 1,
green = 1,
blue = 1,
alpha = 1,
material = RegisterMaterial( "box_titlebar_angle_mid" )
}
}
},
{
type = "UIImage",
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 64,
top = 0,
bottom = 0,
red = 1,
green = 1,
blue = 1,
alpha = 1,
material = RegisterMaterial( "box_titlebar_angle_rt" )
}
}
}
}
},
{
type = "UIHorizontalList",
id = "title_text_list",
states = {
default = {
alignment = LUI.Alignment.Left,
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = false,
left = 10,
right = 200,
top = -2,
bottom = 24,
spacing = 5
}
},
children = {
{
type = "UIText",
id = "ability_title_text",
properties = {
text = "ABILITIES"
},
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 10,
right = 400,
top = 0,
bottom = 0,
red = 1,
green = 1,
blue = 1,
alpha = 1,
font = RegisterFont( "fonts/smallfont" )
}
}
},
{
type = "UIImage",
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 29,
top = 2,
bottom = -2,
red = 1,
green = 1,
blue = 1,
alpha = 1,
material = RegisterMaterial( "box_number" )
}
},
children = {
{
type = "UIText",
id = "slot_unlock_text",
properties = {
text = "0"
},
states = {
default = {
alignment = LUI.Alignment.Center,
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = -1,
bottom = -1,
red = 1,
green = 0.29,
blue = 0.24,
alpha = 1,
font = RegisterFont( "fonts/smallfont" )
}
}
}
}
},
{
type = "UIText",
id = "slot_unlock_title",
properties = {
text = "Slot Unlocks"
},
states = {
default = {
leftAnchor = true,
rightAnchor = false,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 42,
top = 3,
bottom = -3,
red = 1,
green = 1,
blue = 1,
alpha = 1,
font = RegisterFont( "fonts/smallfont" )
}
}
}
}
}
}
},
{
type = "UIImage",
id = "list_backround_texure",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = 0,
right = 0,
top = 0,
bottom = 0,
red = 0.3,
green = 0.3,
blue = 0.3,
alpha = 1,
material = RegisterMaterial( "white" )
}
},
children = {
{
type = "UIImage",
states = {
default = {
topAnchor = true,
rightAnchor = true,
leftAnchor = true,
bottomAnchor = true,
top = 2,
bottom = -2,
left = 2,
right = -2,
material = RegisterMaterial( "box_gradient_fill" )
}
}
},
{
type = "UIImage",
states = {
default = {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = true,
left = -9,
right = 16,
top = -9,
bottom = 16,
red = 1,
green = 1,
blue = 1,
alpha = 1,
material = RegisterMaterial( "box_ability_shadow" )
}
}
}
}
}
}
},
{
type = "UIElement",
states = {
default = {
topAnchor = true,
bottomAnchor = true,
leftAnchor = true,
rightAnchor = true,
top = 25,
bottom = 0,
left = 0,
right = 0
}
},
children = {
{
type = "ability_button_design_template_list",
id = "button_list_id",
children = {
{
type = "ability_button_template",
id = "button_0"
},
{
type = "ability_horizontal_spacer",
id = "spacer_0"
},
{
type = "ability_button_template",
id = "button_1"
},
{
type = "ability_horizontal_spacer",
id = "spacer_1"
},
{
type = "ability_button_template",
id = "button_2"
},
{
type = "ability_horizontal_spacer",
id = "spacer_3"
},
{
type = "ability_button_template",
id = "button_3"
},
{
type = "ability_horizontal_spacer",
id = "spacer_4"
},
{
type = "ability_button_template",
id = "button_4"
}
}
}
}
}
}
}
end
LUI.MenuBuilder.registerDef( "ability_button_template", ability_button_template )
LUI.MenuBuilder.registerDef( "ability_button", ability_button )
LUI.MenuBuilder.registerDef( "ability_horizontal_spacer", ability_horizontal_spacer )
LUI.MenuBuilder.registerDef( "ability_button_design_template_list", ability_button_design_template_list )
LUI.MenuBuilder.registerDef( "CasAbilityButton", CasAbilityButton )
LockTable( _M )