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

198 lines
5.4 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = function ( f1_arg0, f1_arg1 )
local f1_local0 = MBh.AnimateSequence( {
{
"default",
0
},
{
"opening",
250
},
{
"active",
0
},
{
"active",
3000
},
{
"default",
250
}
} )
f1_local0( f1_arg0 )
end
f0_local1 = function ( f2_arg0, f2_arg1 )
if f2_arg1.value == 1 then
f2_arg0:closeChildren()
local f2_local0 = {}
local f2_local1 = Game.GetOmnvar( "ui_spawn_abilities1" )
local f2_local2 = Game.GetOmnvar( "ui_spawn_abilities2" )
for f2_local3 = 1, 24, 1 do
f2_local0[f2_local3] = hasbit( f2_local1, bit( f2_local3 ) )
f2_local0[f2_local3 + 24] = hasbit( f2_local2, bit( f2_local3 ) )
end
for f2_local3 = 1, #f2_local0, 1 do
if f2_local0[f2_local3] then
local f2_local6 = Engine.TableLookup( KillCamAbilitiesBitMaskTable.File, KillCamAbilitiesBitMaskTable.Cols.Index, f2_local3, KillCamAbilitiesBitMaskTable.Cols.Ref )
local f2_local7 = Engine.TableLookup( PerkTable.File, PerkTable.Cols.Ref, f2_local6, PerkTable.Cols.Cost )
local f2_local8 = Engine.TableLookup( PerkTable.File, PerkTable.Cols.Ref, f2_local6, PerkTable.Cols.Image )
local f2_local9 = RegisterMaterial( "white" )
local f2_local10 = RegisterMaterial( f2_local8 )
local f2_local11 = Engine.TableLookup( PerkTable.File, PerkTable.Cols.Ref, f2_local6, PerkTable.Cols.Name )
local f2_local12 = nil
local f2_local13 = false
for self = 1, Cac.Abilities.Settings.AbilitiesNumCategories, 1 do
for f2_local17 = 1, Cac.Abilities.Settings.AbilitiesPerCategory, 1 do
if Cac.GetAbilitySlotRef( Cac.GetAbilityRef( self - 1 ), f2_local17 ) == f2_local6 then
f2_local13 = true
break
end
end
if f2_local13 == true then
end
end
local self = LUI.UIElement.new()
self.id = "perk_container" .. f2_local3
self:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = -16,
left = 0,
bottom = 18,
width = 32
} )
self:animateToState( "default", 0 )
local f2_local15 = LUI.UIImage.new()
f2_local15.id = "perk_bg" .. f2_local3
f2_local15:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
red = 1,
green = 1,
blue = 1,
material = f2_local9
} )
f2_local15:animateToState( "default", 0 )
local f2_local16 = LUI.UIImage.new()
f2_local16.id = "perk_bar" .. f2_local3
f2_local16:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 31,
height = 3,
red = Colors.cac_ability[f2_local12].r,
green = Colors.cac_ability[f2_local12].g,
blue = Colors.cac_ability[f2_local12].b,
material = f2_local9
} )
f2_local16:animateToState( "default", 0 )
local f2_local20 = LUI.UIImage.new()
f2_local20.id = "perk_image" .. f2_local3
f2_local20:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 0,
height = 32,
red = 0,
green = 0,
blue = 0,
material = f2_local10
} )
f2_local20:animateToState( "default", 0 )
local f2_local17 = LUI.UIText.new()
f2_local17.id = "perk_text" .. f2_local3
f2_local17:setText( Engine.Localize( "@" .. f2_local11 ) )
f2_local17:setTextStyle( CoD.TextStyle.Shadowed )
f2_local17:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -CoD.TextSettings.HudEuroMedSmallFont.Height / 2,
left = 35,
bottom = CoD.TextSettings.HudEuroMedSmallFont.Height / 2,
right = 547,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Left
} )
f2_local17:animateToState( "default", 0 )
self:addElement( f2_local15 )
self:addElement( f2_local16 )
self:addElement( f2_local20 )
self:addElement( f2_local17 )
f2_arg0:addElement( self )
end
end
f0_local0( f2_arg0:getParent(), f2_arg1 )
end
end
LUI.MenuBuilder.registerType( "perksOnSpawnHudDef", function ()
local self = LUI.UIElement.new()
self.id = "perks_on_spawn_hud"
self:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 250,
left = -500,
height = 456,
width = 512,
alpha = 0
} )
self:animateToState( "default", 0 )
self:registerAnimationState( "opening", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 250,
left = 30,
height = 456,
width = 512,
alpha = 1
} )
self:registerAnimationState( "active", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 250,
left = 10,
height = 456,
width = 512,
alpha = 1
} )
local f3_local1 = LUI.UIVerticalList.new()
f3_local1.id = "perks_on_spawn_vl"
f3_local1:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
spacing = 1
} )
f3_local1:animateToState( "default", 0 )
f3_local1:registerOmnvarHandler( "ui_spawn_abilities_show", f0_local1 )
self:addElement( f3_local1 )
return self
end )
LockTable( _M )