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

76 lines
2.0 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( "Registering " .. _NAME )
LUI.ButtonDescText = {}
LUI.ButtonDescText.new = function ( f1_arg0, f1_arg1 )
if not f1_arg1 then
f1_arg1 = {}
end
local f1_local0 = f1_arg1.lines or 2
local self = LUI.UIElement.new()
self.id = "generic_button_desc_text_id"
self:registerAnimationState( "default", {
leftAnchor = true,
rightAnchor = true,
topAnchor = true,
bottomAnchor = false,
left = 0,
right = 0,
top = 0,
bottom = f1_local0 * CoD.TextSettings.SmallFont.Height
} )
self:animateToState( "default" )
local f1_local2 = LUI.UIImage.new()
f1_local2.id = "left_bullet_point"
f1_local2:registerAnimationState( "default", {
material = RegisterMaterial( "white" ),
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = false,
top = 3,
left = 100,
height = 13,
width = 5,
alpha = 0.6
} )
f1_local2:animateToState( "default" )
self:addElement( f1_local2 )
local f1_local3 = LUI.UIMarqueeText.new()
f1_local3.id = "desc_text"
f1_local3:SetUseTextWrapping( true )
f1_local3:SetTextHeight( CoD.TextSettings.SmallFont.Height )
f1_local3:registerAnimationState( "default", {
alignment = LUI.Alignment.Left,
font = CoD.TextSettings.SmallFont.Font,
topAnchor = true,
bottomAnchor = false,
leftAnchor = true,
rightAnchor = true,
top = 0,
bottom = f1_local0 * CoD.TextSettings.SmallFont.Height,
left = 111,
right = -23,
red = Colors.primary_text_color.r,
green = Colors.primary_text_color.g,
blue = Colors.primary_text_color.b,
alpha = 1
} )
f1_local3:animateToState( "default" )
f1_local3:registerEventHandler( "set_button_info_text", function ( element, event )
if event.text then
element:setText( event.text )
end
end )
self:addElement( f1_local3 )
return self
end
LUI.ButtonDescText.build = function ( f3_arg0, f3_arg1, f3_arg2 )
return LUI.ButtonDescText.new( f3_arg0, f3_arg1 )
end
LUI.MenuBuilder.registerType( "button_desc_text", LUI.ButtonDescText.build )
LockTable( _M )