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

438 lines
10 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 = 32
local f1_local1 = 32
local f1_local2, f1_local3, f1_local4, f1_local5, f1_local6, f1_local7 = nil
if f1_arg1.value > 0 then
f1_local3 = Engine.TableLookup( HordeIconsTable.File, HordeIconsTable.Cols.Index, f1_arg1.value, HordeIconsTable.Cols.Image )
f1_local4 = Engine.TableLookup( HordeIconsTable.File, HordeIconsTable.Cols.Index, f1_arg1.value, HordeIconsTable.Cols.Name )
f1_local5 = f1_arg0:getChildById( "horde_hud_perk_container_" .. f1_local4 )
if f1_local5 then
f1_local6 = f1_local5:getChildById( "horde_hud_perk_image_bg" .. f1_local4 )
f1_local7 = f1_local5:getChildById( "horde_hud_perk_image_" .. f1_local4 )
end
f1_local2 = RegisterMaterial( f1_local3 )
elseif f1_arg1.value < 0 then
f1_local4 = Engine.TableLookup( HordeIconsTable.File, HordeIconsTable.Cols.Index, f1_arg1.value * -1, HordeIconsTable.Cols.Name )
f1_local5 = f1_arg0:getChildById( "horde_hud_perk_container_" .. f1_local4 )
if f1_local5 then
f1_local6 = f1_local5:getChildById( "horde_hud_perk_image_bg" .. f1_local4 )
f1_local7 = f1_local5:getChildById( "horde_hud_perk_image_" .. f1_local4 )
end
end
if f1_arg1.value > 0 and not f1_local7 then
local self = LUI.UIElement.new()
self.id = "horde_hud_perk_container_" .. f1_local4
self:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
bottom = 0,
left = 0,
height = f1_local0,
width = f1_local1,
material = f1_local2,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = 1
} )
self:animateToState( "default", 0 )
local f1_local9 = LUI.UIImage.new()
f1_local9.id = "horde_hud_perk_image_bg" .. f1_local4
f1_local9:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f1_local0 / 2.1,
left = -f1_local1 / 2.1,
bottom = f1_local0 / 1.9,
right = f1_local1 / 1.9,
material = f1_local2,
red = Colors.black.r,
green = Colors.black.g,
blue = Colors.black.b,
alpha = 0
} )
f1_local9:registerAnimationState( "opening", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f1_local0 / 1.4,
left = -f1_local1 / 1.4,
bottom = f1_local0 / 1.2,
right = f1_local1 / 1.2,
material = f1_local2,
red = Colors.black.r,
green = Colors.black.g,
blue = Colors.black.b,
alpha = 0.1
} )
f1_local9:registerAnimationState( "active", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f1_local0 / 2.1,
left = -f1_local1 / 2.1,
bottom = f1_local0 / 1.9,
right = f1_local1 / 1.9,
material = f1_local2,
red = Colors.black.r,
green = Colors.black.g,
blue = Colors.black.b,
alpha = 0.5
} )
f1_local9:registerAnimationState( "flash", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f1_local0 / 1.6,
left = -f1_local1 / 1.6,
bottom = f1_local0 / 1.4,
right = f1_local1 / 1.4,
red = Colors.black.r,
green = Colors.black.g,
blue = Colors.black.b,
alpha = 0.3
} )
f1_local9:animateToState( "default", 0 )
local f1_local10 = LUI.UIImage.new()
f1_local10.id = "horde_hud_perk_image_" .. f1_local4
f1_local10:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f1_local0 / 2,
left = -f1_local1 / 2,
bottom = f1_local0 / 2,
right = f1_local1 / 2,
material = f1_local2,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = 0
} )
f1_local10:registerAnimationState( "opening", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f1_local0 / 1.3,
left = -f1_local1 / 1.3,
bottom = f1_local0 / 1.3,
right = f1_local1 / 1.3,
material = f1_local2,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = 0.5
} )
f1_local10:registerAnimationState( "active", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f1_local0 / 2,
left = -f1_local1 / 2,
bottom = f1_local0 / 2,
right = f1_local1 / 2,
material = f1_local2,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = 1
} )
f1_local10:registerAnimationState( "flash", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f1_local0 / 1.5,
left = -f1_local1 / 1.5,
bottom = f1_local0 / 1.5,
right = f1_local1 / 1.5,
red = Colors.orange.r,
green = Colors.orange.g,
blue = Colors.orange.b,
alpha = 0.8
} )
f1_local10:animateToState( "default", 0 )
self:addElement( f1_local9 )
self:addElement( f1_local10 )
f1_arg0:addElement( self )
local f1_local11 = MBh.AnimateSequence( {
{
"default",
0
},
{
"opening",
100
},
{
"active",
50
}
} )
f1_local11( f1_local9 )
f1_local11 = MBh.AnimateSequence( {
{
"default",
0
},
{
"opening",
100
},
{
"active",
50
}
} )
f1_local11( f1_local10 )
elseif f1_local7 then
if f1_arg1.value > 0 and not f1_local7.isFlashing then
local self = MBh.AnimateLoop( {
{
"flash",
300
},
{
"active",
700
}
} )
self( f1_local6 )
self = MBh.AnimateLoop( {
{
"flash",
300
},
{
"active",
700
}
} )
self( f1_local7 )
f1_local7.isFlashing = true
elseif f1_arg1.value > 0 and f1_local7.isFlashing == true then
local self = MBh.AnimateToState( "active" )
self( f1_local6 )
self = MBh.AnimateToState( "active" )
self( f1_local7 )
f1_local7.isFlashing = false
elseif f1_arg1.value < 0 then
f1_local5:close()
end
else
f1_local5 = f1_arg0:getFirstChild()
while f1_local5 ~= nil do
local self = f1_local5:getNextSibling()
f1_local5:close()
f1_local5 = self
end
end
end
f0_local1 = function ( f2_arg0, f2_arg1 )
local f2_local0 = f2_arg0:getChildById( "horde_hud_exp_ammo_image" )
if f2_arg1.value > 0 and not f2_local0.shown then
local f2_local1 = MBh.AnimateSequence( {
{
"default",
0
},
{
"opening",
100
},
{
"active",
50
}
} )
f2_local1( f2_arg0 )
f2_local0.shown = true
elseif f2_arg1.value > 0 and not f2_local0.flashing then
local f2_local1 = MBh.AnimateLoop( {
{
"flash",
300
},
{
"default",
700
}
} )
f2_local1( f2_local0 )
f2_local0.flashing = true
else
f2_local0.shown = false
f2_local0.flashing = false
local f2_local1 = MBh.AnimateToState( "default" )
f2_local1( f2_local0 )
f2_arg0:animateToState( "default", 0 )
end
end
f0_local2 = function ()
local self = LUI.UIHorizontalList.new()
self.id = "horde_hud_perks"
self:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
spacing = 0
} )
self:animateToState( "default", 0 )
self:registerOmnvarHandler( "ui_horde_update_perk", f0_local0 )
return self
end
local f0_local3 = function ()
local f4_local0 = 250
local f4_local1 = 32
local f4_local2 = 416
local f4_local3 = 12
local f4_local4 = 205
local self = LUI.UIElement.new()
self.id = "horde_hud_perks_container"
self:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
bottom = -f4_local3,
left = f4_local3 + f4_local4,
height = f4_local1,
width = 0
} )
self:registerAnimationState( "active", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
bottom = -f4_local3,
left = f4_local3 + f4_local4,
height = f4_local1,
width = f4_local2,
alpha = 1
} )
self:registerAnimationState( "opening", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
bottom = -f4_local3,
left = f4_local3 + f4_local4,
height = f4_local1,
width = f4_local2 + 40,
alpha = 1
} )
self:animateToState( "default", 0 )
self:registerEventHandler( "hud_on", MBh.AnimateSequence( {
{
"default",
0
},
{
"opening",
f4_local0 / 2
},
{
"active",
f4_local0 / 2
}
} ) )
self:addElement( f0_local2() )
return self
end
local f0_local4 = function ()
local f5_local0 = 40
local f5_local1 = 40
local f5_local2 = 250
local f5_local3 = Engine.TableLookup( HordeIconsTable.File, HordeIconsTable.Cols.Ref, "specialty_explosivebullets", HordeIconsTable.Cols.Image )
local self = LUI.UIElement.new()
self.id = "horde_hud_exp_ammo_container"
self:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = true,
bottom = -65,
right = -175,
height = f5_local0,
width = f5_local1,
alpha = 0
} )
self:registerAnimationState( "active", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = true,
bottom = -65,
right = -175,
height = f5_local0,
width = f5_local1,
alpha = 1
} )
self:registerAnimationState( "opening", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = true,
bottom = -25,
right = -135,
height = f5_local0 * 3,
width = f5_local1 * 3,
alpha = 0.5
} )
self:animateToState( "default", 0 )
self:registerOmnvarHandler( "ui_horde_update_explosive", f0_local1 )
local f5_local5 = LUI.UIImage.new()
f5_local5.id = "horde_hud_exp_ammo_image"
f5_local5:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
material = RegisterMaterial( f5_local3 ),
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = 1
} )
f5_local5:registerAnimationState( "flash", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -f5_local0 / 1.5,
left = -f5_local0 / 1.5,
bottom = f5_local0 / 1.5,
right = f5_local0 / 1.5,
red = Colors.orange.r,
green = Colors.orange.g,
blue = Colors.orange.b,
alpha = 0.8
} )
f5_local5:animateToState( "default", 0 )
self:addElement( f5_local5 )
return self
end
LUI.MenuBuilder.registerType( "hordePerksHudDef", f0_local3 )
LUI.MenuBuilder.registerType( "hordeExpAmmoHudDef", f0_local4 )
LockTable( _M )