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

647 lines
16 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = ""
f0_local1 = 0
f0_local2 = 5
local f0_local3 = function ( f1_arg0, f1_arg1 )
if f1_arg1.value < 1 then
return
else
local f1_local0 = MBh.AnimateSequence( {
{
"active",
50
},
{
"default",
1000
}
} )
f1_local0( f1_arg0 )
end
end
local f0_local4 = function ()
local f2_local0 = Game.GetPlayerWeaponName()
if f2_local0 == "none" then
return f2_local0
end
local f2_local1 = string.find( f2_local0, "_" )
local f2_local2 = string.sub( f2_local0, 1, f2_local1 - 1 )
if f2_local2 == "iw5" or f2_local2 == "iw6" then
f2_local2 = string.sub( f2_local0, 1, string.find( f2_local0, "_", f2_local1 + 1 ) - 1 )
end
return f2_local2
end
local f0_local5 = function ( menu, controller )
local self = LUI.UIElement.new()
self.id = "killstreak_limit"
self:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
bottom = -445
} )
self:animateToState( "default", 0 )
local f3_local1 = LUI.UIText.new()
f3_local1.id = "killstreak_limit_text"
f3_local1:setText( Engine.Localize( "@HORDE_KILLSTREAK_LIMIT" ) )
f3_local1:setTextStyle( CoD.TextStyle.Shadowed )
f3_local1:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
height = CoD.TextSettings.HudIW6BigFont.Height,
font = CoD.TextSettings.HudIW6BigFont.Font,
red = Colors.orange.r,
green = Colors.orange.g,
blue = Colors.orange.b,
alignment = LUI.Alignment.Center,
alpha = 0
} )
f3_local1:registerAnimationState( "active", {
alpha = 1
} )
f3_local1:animateToState( "default", 0 )
f3_local1:registerOmnvarHandler( "ui_killstreak_limit", f0_local3 )
self:addElement( f3_local1 )
return self
end
local f0_local6 = function ( f4_arg0, f4_arg1 )
local f4_local0 = f4_arg0:getChildById( "point" .. f0_local1 )
if f4_local0 ~= nil then
local f4_local1 = f4_local0:getFirstChild()
if f4_local1 ~= nil then
f4_local1:setText( "+" .. f4_arg1.value )
f4_local0:registerAnimationState( "large", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
left = math.random( 140, 290 ),
top = math.random( 40, 190 ),
width = 102,
height = CoD.TextSettings.HudEuroMedSmallFont.Height * 1.5,
alpha = 1
} )
local f4_local2 = MBh.AnimateSequence( {
{
"large",
0
},
{
"default",
1000
}
} )
f4_local2( f4_local0, nil )
end
end
f0_local1 = (f0_local1 + 1) % f0_local2
end
local f0_local7 = function ( f5_arg0 )
local self = LUI.UIElement.new()
self.id = "point" .. f5_arg0
self:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
left = 180,
top = 60,
width = 128,
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
alpha = 0
} )
self:animateToState( "default", 0 )
local f5_local1 = LUI.UIText.new()
f5_local1.id = "point_text"
f5_local1:setText( "+" .. math.random( 10, 60 ) )
f5_local1:setTextStyle( CoD.TextStyle.Shadowed )
f5_local1:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alignment = LUI.Alignment.Center
} )
f5_local1:animateToState( "default", 0 )
self:addElement( f5_local1 )
return self
end
local f0_local8 = function ( f6_arg0, f6_arg1 )
local f6_local0 = f0_local4()
local f6_local1 = Engine.TableLookup( HordeIconsTable.File, HordeIconsTable.Cols.Ref, f6_local0, HordeIconsTable.Cols.Image )
local f6_local2 = Engine.TableLookup( HordeIconsTable.File, HordeIconsTable.Cols.Ref, f6_local0, HordeIconsTable.Cols.Misc )
local f6_local3 = RegisterMaterial( f6_local1 )
local f6_local4 = f6_arg0:getChildById( "weaponImage" )
if f6_local1 ~= "" then
CoD.SetMaterial( f6_local4, f6_local3 )
if f6_local2 == "weapon_pistol" then
if f6_local0 == "iw6_magnumhorde" then
f6_local4:animateToState( "magnum", 0 )
else
f6_local4:animateToState( "pistol", 0 )
end
elseif f6_local2 == "weapon_sniper" or f6_local2 == "weapon_shotgun" then
f6_local4:animateToState( "sniper_shot", 0 )
elseif f6_local2 == "weapon_lmg" then
f6_local4:animateToState( "lmg", 0 )
else
f6_local4:animateToState( "other", 0 )
end
end
end
local f0_local9 = function ( f7_arg0, f7_arg1 )
f0_local8( f7_arg0, f7_arg1 )
end
local f0_local10 = function ( f8_arg0, f8_arg1 )
local f8_local0 = f8_arg0:getFirstDescendentById( "middle" )
f8_local0:registerAnimationState( "move_bar", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = 0,
width = f8_arg1.value / 100 * f8_local0.m_width,
height = f8_local0.m_height
} )
f8_local0:animateToState( "move_bar", 150 )
end
local f0_local11 = function ( f9_arg0, f9_arg1, f9_arg2, f9_arg3, f9_arg4, f9_arg5, f9_arg6, f9_arg7, f9_arg8 )
local f9_local0 = RegisterMaterial( f9_arg6 )
local f9_local1 = RegisterMaterial( f9_arg7 )
local self = LUI.UIHorizontalList.new()
self.id = f9_arg0
self:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = f9_arg2,
left = f9_arg1,
height = f9_arg5,
width = f9_arg4,
alignment = LUI.Alignment.Left,
alpha = 1
} )
self:animateToState( "default", 0 )
self:registerOmnvarHandler( f9_arg8, f0_local10 )
local f9_local3 = LUI.UIImage.new()
f9_local3.id = "middle"
f9_local3.m_width = f9_arg4
f9_local3.m_height = f9_arg5
f9_local3:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = 0,
height = f9_arg5,
width = 0,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
material = f9_local0,
alpha = 1
} )
f9_local3:registerAnimationState( "full", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = 0,
height = f9_arg5,
width = f9_arg4,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
material = f9_local0,
alpha = 1
} )
f9_local3:animateToState( "default", 0 )
local f9_local4 = LUI.UIImage.new()
f9_local4.id = "end"
f9_local4:registerAnimationState( "default", {
topAnchor = true,
rightAnchor = true,
top = 0,
right = 0,
height = f9_arg5,
width = f9_arg3,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
material = f9_local1,
alpha = 1
} )
f9_local4:animateToState( "default", 0 )
self:addElement( f9_local3 )
self:addElement( f9_local4 )
return self
end
local f0_local12 = function ( f10_arg0, f10_arg1 )
f10_arg0:setText( f10_arg1.value )
end
local f0_local13 = function ( f11_arg0, f11_arg1 )
f11_arg0:setText( f11_arg1.value )
end
local f0_local14 = function ()
local f12_local0 = 56
local f12_local1 = 206
local f12_local2 = CoD.TextSettings.HudEuroMedSmallFont
local f12_local3 = CoD.TextSettings.HudDigitalExtraBigFont
local f12_local4 = 250
local f12_local5 = RegisterMaterial( "hud_safeguard_roundback" )
local self = LUI.UIElement.new()
self.id = "horde_hud_round"
self:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
left = 10,
bottom = -10,
height = f12_local0,
width = f12_local1
} )
self:animateToState( "default", 0 )
local f12_local7 = LUI.UIImage.new()
f12_local7.id = "round_bg"
f12_local7:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = 0,
height = f12_local0,
width = f12_local1,
material = f12_local5,
alpha = 0.7
} )
f12_local7:animateToState( "default", 0 )
local f12_local8 = LUI.UIText.new()
f12_local8.id = "round_text"
f12_local8:setTextStyle( CoD.TextStyle.Shadowed )
f12_local8:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 6,
left = 10,
width = 64,
height = f12_local2.Height,
font = f12_local2.Font,
alignment = LUI.Alignment.Left,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = 0
} )
f12_local8:registerAnimationState( "active", {
alpha = 1
} )
f12_local8:animateToState( "default", 0 )
f12_local8:registerEventHandler( "hud_on", MBh.AnimateSequence( {
{
"default",
0
},
{
"active",
500
}
} ) )
f12_local8:setText( Engine.Localize( "@MP_HORDE_ROUND_NUM" ) )
local f12_local9 = LUI.UIText.new()
f12_local9.id = "round_number_bg"
f12_local9:setText( "888" )
f12_local9:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
left = 79,
bottom = -6,
height = f12_local3.Height,
width = 80,
font = f12_local3.Font,
alignment = LUI.Alignment.Right,
red = 0,
green = 0,
blue = 0,
alpha = 0
} )
f12_local9:registerAnimationState( "active", {
alpha = 0.25
} )
f12_local9:animateToState( "default", 0 )
f12_local9:registerEventHandler( "hud_on", MBh.AnimateSequence( {
{
"default",
0
},
{
"active",
500
}
} ) )
local f12_local10 = LUI.UIText.new()
f12_local10.id = "round_number"
f12_local10:setText( "1" )
f12_local10:setTextStyle( CoD.TextStyle.Shadowed )
f12_local10:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
left = 79,
bottom = -6,
height = f12_local3.Height,
width = 80,
font = f12_local3.Font,
alignment = LUI.Alignment.Right,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = 0
} )
f12_local10:registerAnimationState( "active", {
alpha = 1
} )
f12_local10:animateToState( "default", 0 )
f12_local10:registerEventHandler( "hud_on", MBh.AnimateSequence( {
{
"default",
0
},
{
"active",
500
}
} ) )
f12_local10:registerOmnvarHandler( "ui_horde_round_number", f0_local13 )
self:addElement( f12_local7 )
self:addElement( f12_local8 )
self:addElement( f12_local9 )
self:addElement( f12_local10 )
return self
end
LUI.MenuBuilder.registerType( "hordeHudDef", function ()
local f13_local0 = 64
local f13_local1 = 500
local f13_local2 = CoD.TextSettings.HudDigitalExtraBigFont
local f13_local3 = 250
local f13_local4 = RegisterMaterial( "hud_safeguard_levelback" )
local self = LUI.UIElement.new()
self.id = "horde_hud"
self:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0
} )
self:animateToState( "default", 0 )
local f13_local6 = LUI.UIElement.new()
f13_local6.id = "horde_hud_weapon_support"
f13_local6:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 20,
left = 10,
height = 400,
width = 400
} )
f13_local6:animateToState( "default", 0 )
f13_local6:registerEventHandler( "weapon_change", f0_local8 )
f13_local6:registerOmnvarHandler( "ui_horde_award_points", f0_local6 )
f13_local6:registerEventHandler( "menu_create", f0_local9 )
local f13_local7 = LUI.UIImage.new()
f13_local7.id = "bar_bg"
f13_local7:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = 0,
height = f13_local0,
width = f13_local1,
red = 1,
blue = 1,
green = 1,
material = f13_local4,
alpha = 0.7
} )
f13_local7:animateToState( "default", 0 )
local f13_local8 = LUI.UIText.new()
f13_local8.id = "supportDropText"
f13_local8:setText( Engine.Localize( "@MP_HORDE_NEXT_AIR_DROP" ) )
f13_local8:setTextStyle( CoD.TextStyle.Shadowed )
f13_local8:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 64,
left = 0,
width = 128,
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
alignment = LUI.Alignment.Left,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = 0
} )
f13_local8:registerAnimationState( "active", {
alpha = 1
} )
f13_local8:animateToState( "default", 0 )
f13_local8:registerEventHandler( "hud_on", MBh.AnimateSequence( {
{
"default",
0
},
{
"active",
500
}
} ) )
local f13_local9 = LUI.UIText.new()
f13_local9.id = "weaponLevelTextBG"
f13_local9:setText( "888" )
f13_local9:setTextStyle( CoD.TextStyle.Shadowed )
f13_local9:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 3,
left = 3,
width = 75,
height = f13_local2.Height,
font = f13_local2.Font,
alignment = LUI.Alignment.Right,
red = 0,
green = 0,
blue = 0,
alpha = 0
} )
f13_local9:registerAnimationState( "active", {
alpha = 0.1
} )
f13_local9:animateToState( "default", 0 )
f13_local9:registerEventHandler( "hud_on", MBh.AnimateSequence( {
{
"default",
0
},
{
"active",
500
}
} ) )
local f13_local10 = LUI.UIText.new()
f13_local10.id = "weaponLevelText"
f13_local10:setText( "1" )
f13_local10:setTextStyle( CoD.TextStyle.Shadowed )
f13_local10:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 3,
left = 3,
width = 75,
height = f13_local2.Height,
font = f13_local2.Font,
alignment = LUI.Alignment.Right,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = 0
} )
f13_local10:registerAnimationState( "active", {
alpha = 1
} )
f13_local10:animateToState( "default", 0 )
f13_local10:registerEventHandler( "hud_on", MBh.AnimateSequence( {
{
"default",
0
},
{
"active",
500
}
} ) )
f13_local10:registerOmnvarHandler( "ui_horde_weapon_level", f0_local12 )
local f13_local11 = LUI.UIImage.new()
f13_local11.id = "weaponImage"
f13_local11:registerAnimationState( "pistol", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = -10,
left = 175,
height = 64,
width = -128,
alpha = 1
} )
f13_local11:registerAnimationState( "magnum", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = -10,
left = 195,
height = 64,
width = -128,
alpha = 1
} )
f13_local11:registerAnimationState( "sniper_shot", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = -16,
left = 210,
height = 64,
width = -128,
alpha = 1
} )
f13_local11:registerAnimationState( "lmg", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = -15,
left = 210,
height = 64,
width = -128,
alpha = 1
} )
f13_local11:registerAnimationState( "other", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = -12,
left = 210,
height = 64,
width = -128,
alpha = 1
} )
f13_local11:animateToState( "pistol", 0 )
f13_local6:addElement( f13_local7 )
f13_local6:addElement( f0_local11( "weaponLevel", 105, 24, 26, 168, 25, "hud_safeguard_weapon_bar", "hud_safeguard_weapon_end", "ui_horde_weapon_progress" ) )
f13_local6:addElement( f0_local11( "supportDrop", 9, 50, 16, 268, 12, "hud_safeguard_support_bar", "hud_safeguard_support_end", "ui_horde_support_drop_progress" ) )
for f13_local12 = 0, f0_local2 - 1, 1 do
f13_local6:addElement( f0_local7( f13_local12 ) )
end
f13_local6:addElement( f13_local8 )
f13_local6:addElement( f13_local9 )
f13_local6:addElement( f13_local10 )
f13_local6:addElement( f13_local11 )
f13_local6:addElement( LUI.MenuBuilder.buildItems( {
type = "talkerHudDef"
}, f13_local6.properties, f13_local6 ) )
self:addElement( f13_local6 )
self:addElement( f0_local5() )
return self
end )
LUI.MenuBuilder.registerType( "hordeRoundHudDef", f0_local14 )
LockTable( _M )