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

450 lines
12 KiB
Lua

local f0_local0 = module
local f0_local1, f0_local2 = ...
f0_local0( f0_local1, package.seeall )
CoD.PrintModuleLoad( _NAME )
f0_local0 = 1
f0_local1 = 64 * f0_local0
f0_local2 = 256 * f0_local0
local f0_local3 = 16 * f0_local0
local f0_local4 = 210 * f0_local0
local f0_local5 = 256 * f0_local0
local f0_local6 = 16 * f0_local0
local f0_local7 = 16 * f0_local0
local f0_local8 = false
local f0_local9 = function ( f1_arg0, f1_arg1 )
local f1_local0 = f1_arg0
local f1_local1 = f1_arg0:getFirstDescendentById( "capturing_bar" )
local f1_local2 = f1_arg0:getFirstDescendentById( "capturing_refresh_timer" )
local f1_local3 = f1_arg0:getFirstDescendentById( "capturing_text" )
local f1_local4 = f1_arg0:getFirstDescendentById( "capturing_bar_bg" )
local f1_local5 = f1_arg0:getFirstDescendentById( "capturing_bar_hl" )
local f1_local6 = f1_local5:getFirstDescendentById( "start_cap" )
local f1_local7 = f1_local5:getFirstDescendentById( "middle" )
local f1_local8 = f1_local5:getFirstDescendentById( "end_cap" )
f0_local8 = false
if Game.GetOmnvar( "ui_securing_progress" ) > 0.9 and not f0_local8 then
f0_local8 = true
end
if f1_local4.current_state ~= "default" then
f1_local4:animateToState( "default", 0 )
f1_local4.current_state = "default"
end
if f0_local8 then
if f1_local1.current_state ~= "secured" then
local f1_local9 = MBh.AnimateSequence( {
{
"active",
500
},
{
"blink_off",
150
}
} )
f1_local9( f1_local1 )
f1_local1.current_state = "secured"
end
if f1_local3.current_state ~= "secured" then
local f1_local9 = MBh.AnimateSequence( {
{
"default",
0
},
{
"opening",
250
},
{
"secured",
0
}
} )
f1_local9( f1_local3 )
f1_local3.current_state = "secured"
end
if f1_local6.current_state ~= "secured" then
f1_local6:animateToState( "secured" )
f1_local6.current_state = "secured"
end
if f1_local7.current_state ~= "secured" then
f1_local7:animateToState( "secured" )
f1_local7.current_state = "secured"
end
if f1_local8.current_state ~= "secured" then
f1_local8:animateToState( "secured" )
f1_local8.current_state = "secured"
end
else
if f1_local1.current_state ~= "default" then
f1_local1:animateToState( "default", 0 )
f1_local1.current_state = "default"
end
if f1_local5.current_state ~= "default" then
f1_local5:animateToState( "default", 0 )
f1_local5.current_state = "default"
end
if f1_local3.current_state ~= "default" then
f1_local3:animateToState( "default", 0 )
f1_local3.current_state = "default"
end
if f1_local7.current_state ~= "default" then
f1_local7:animateToState( "default", 0 )
f1_local7.current_state = "default"
end
end
end
local f0_local10 = function ( f2_arg0, f2_arg1 )
local f2_local0 = f2_arg0
local f2_local1 = f2_arg0:getFirstDescendentById( "capturing_refresh_timer" )
local f2_local2 = f2_arg0:getFirstDescendentById( "capturing_text" )
local f2_local3 = f2_arg0:getFirstDescendentById( "capturing_bar_bg" )
local f2_local4 = f2_arg0:getFirstDescendentById( "capturing_bar_hl" )
local f2_local5 = f2_local4:getFirstDescendentById( "start_cap" )
local f2_local6 = f2_local4:getFirstDescendentById( "middle" )
local f2_local7 = f2_local4:getFirstDescendentById( "end_cap" )
local f2_local8 = f2_local1.value
local f2_local9 = ""
if f2_local8 == 0 then
LUI.UITimer.Stop( f2_local1 )
return
elseif f2_local8 == 1 then
f2_local9 = Engine.Localize( "@ALIEN_COLLECTIBLES_SEARCHING" )
elseif f2_local8 == 2 then
f2_local9 = Engine.Localize( "@ALIEN_COLLECTIBLES_REPAIR_DRILL" )
elseif f2_local8 == 3 then
f2_local9 = Engine.Localize( "@MPUI_REVIVING" )
elseif f2_local8 == 4 then
f2_local9 = Engine.Localize( "@MPUI_BEING_REVIVED" )
elseif f2_local8 == 5 then
f2_local9 = Engine.Localize( "@MP_ALIEN_DESCENT_REPAIR_TERMINAL" )
elseif f2_local8 == 6 then
f2_local9 = Engine.Localize( "@MP_ALIEN_DESCENT_ACTIVATE_CORTEX" )
elseif f2_local8 == 7 then
f2_local9 = Engine.Localize( "@MP_ALIEN_LAST_CONDUIT_REPAIR" )
end
if f2_local0.current_state ~= "active" then
f2_local0:animateToState( "active", 250 )
f2_local0.current_state = "active"
end
if f2_local3.current_state ~= "active" then
f2_local3:animateToState( "active", 250 )
f2_local3.current_state = "active"
end
if f2_local4.current_state ~= "active" then
f2_local4:animateToState( "active", 250 )
f2_local4.current_state = "active"
end
if f2_local5.current_state ~= "default" then
f2_local5:animateToState( "default" )
f2_local5.current_state = "default"
end
if f2_local6.current_state ~= "default" then
f2_local6:animateToState( "default" )
f2_local6.current_state = "default"
end
if f2_local7.current_state ~= "default" then
f2_local7:animateToState( "default" )
f2_local7.current_state = "default"
end
if f2_local2.current_state ~= "securing" then
f2_local2:setText( f2_local9 )
local f2_local10 = MBh.AnimateSequence( {
{
"default",
0
},
{
"opening",
250
},
{
"active",
0
}
} )
f2_local10( f2_local2 )
f2_local2.current_state = "securing"
end
f2_local6:registerAnimationState( "move_bar", {
right = f2_local6.m_maxWidth * Game.GetOmnvar( "ui_securing_progress" )
} )
f2_local6:animateToState( "move_bar", 150 )
end
local f0_local11 = function ( f3_arg0, f3_arg1 )
local f3_local0 = f3_arg0:getFirstDescendentById( "capturing_refresh_timer" )
if f3_arg1.value > 0 then
LUI.UITimer.Reset( f3_local0 )
else
LUI.UITimer.Stop( f3_local0 )
f0_local9( f3_arg0, f3_arg1 )
end
f3_local0.value = f3_arg1.value
end
local f0_local12 = function ( f4_arg0 )
local f4_local0 = RegisterMaterial( "capturing_bg_mp" )
local f4_local1 = RegisterMaterial( "capturing_bar_end_mp" )
local f4_local2 = RegisterMaterial( "capturing_bar_mp" )
local f4_local3 = RegisterMaterial( "capturing_bar_start_mp" )
local self = LUI.UIElement.new()
self.id = "capturing_bar"
self:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = -(f0_local1 / 2),
left = -(f0_local2 / 2),
height = f0_local1,
width = f0_local2,
alpha = 0
} )
self:animateToState( "default", 0 )
self:registerAnimationState( "active", {
alpha = 1
} )
self:registerAnimationState( "blink_on", {
alpha = 1
} )
self:registerAnimationState( "blink_off", {
alpha = 0
} )
self:registerEventHandler( "capture_refresh", f4_arg0 )
local f4_local5 = LUI.UITimer.new( 100, "capture_refresh", nil, false, false, false, true )
f4_local5.id = "capturing_refresh_timer"
f4_local5.value = 0
local f4_local6 = LUI.UIImage.new()
f4_local6.id = "capturing_bar_bg"
f4_local6:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
material = f4_local0
} )
f4_local6:animateToState( "default", 0 )
local f4_local7 = LUI.UIHorizontalList.new()
f4_local7.id = "capturing_bar_hl"
f4_local7:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
bottom = -33,
left = 27,
height = f0_local3,
width = f0_local4,
alignment = LUI.Alignment.Left,
spacing = 0,
alpha = 0
} )
f4_local7:animateToState( "default", 0 )
f4_local7:registerAnimationState( "active", {
alpha = 1
} )
local f4_local8 = LUI.UIImage.new()
f4_local8.id = "start_cap"
f4_local8:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = 0,
height = f0_local3,
width = f0_local7,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
material = f4_local3
} )
f4_local8:animateToState( "default", 0 )
f4_local8:registerAnimationState( "secured", {
red = Colors.cyan.r,
green = Colors.cyan.g,
blue = Colors.cyan.b
} )
f4_local8:registerAnimationState( "contested", {
red = Colors.yellow.r,
green = Colors.yellow.g,
blue = Colors.yellow.b
} )
local f4_local9 = LUI.UIImage.new()
f4_local9.id = "middle"
f4_local9.m_maxWidth = f0_local4 - f0_local7 - f0_local7
f4_local9:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = 0,
height = f0_local3,
width = 0,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
material = f4_local2
} )
f4_local9:animateToState( "default", 0 )
f4_local9:registerAnimationState( "secured", {
red = Colors.cyan.r,
green = Colors.cyan.g,
blue = Colors.cyan.b
} )
f4_local9:registerAnimationState( "contested", {
red = Colors.yellow.r,
green = Colors.yellow.g,
blue = Colors.yellow.b
} )
local f4_local10 = LUI.UIImage.new()
f4_local10.id = "end_cap"
f4_local10:registerAnimationState( "default", {
topAnchor = true,
rightAnchor = true,
top = 0,
right = 0,
height = f0_local3,
width = f0_local7,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
material = f4_local1
} )
f4_local10:animateToState( "default", 0 )
f4_local10:registerAnimationState( "secured", {
red = Colors.cyan.r,
green = Colors.cyan.g,
blue = Colors.cyan.b
} )
f4_local10:registerAnimationState( "contested", {
red = Colors.yellow.r,
green = Colors.yellow.g,
blue = Colors.yellow.b
} )
f4_local7:addElement( f4_local8 )
f4_local7:addElement( f4_local9 )
f4_local7:addElement( f4_local10 )
local f4_local11 = LUI.UIText.new()
f4_local11.id = "capturing_text"
f4_local11:setText( "" )
f4_local11:setTextStyle( CoD.TextStyle.Shadowed )
f4_local11:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = -400,
height = CoD.TextSettings.HudEuroMedTinyFont.Height,
width = f0_local5,
font = CoD.TextSettings.HudEuroMedTinyFont.Font,
alignment = LUI.Alignment.Right,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = 0
} )
f4_local11:animateToState( "default", 0 )
local f4_local12 = -50
f4_local11:registerAnimationState( "opening", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = f4_local12,
height = CoD.TextSettings.HudEuroMedTinyFont.Height,
width = f0_local5,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = 1
} )
f4_local11:registerAnimationState( "active", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = f4_local12,
height = CoD.TextSettings.HudEuroMedTinyFont.Height,
width = f0_local5,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = 1
} )
f4_local11:registerAnimationState( "secured", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = f4_local12,
height = CoD.TextSettings.HudEuroMedTinyFont.Height,
width = f0_local5,
red = Colors.cyan.r,
green = Colors.cyan.g,
blue = Colors.cyan.b,
alpha = 1
} )
f4_local11:registerAnimationState( "contested", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = f4_local12,
height = CoD.TextSettings.HudEuroMedTinyFont.Height,
width = f0_local5,
red = Colors.yellow.r,
green = Colors.yellow.g,
blue = Colors.yellow.b,
alpha = 1
} )
f4_local11:registerAnimationState( "contested_off_for_loop", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = f4_local12,
height = CoD.TextSettings.HudEuroMedTinyFont.Height,
width = f0_local5,
red = Colors.yellow.r,
green = Colors.yellow.g,
blue = Colors.yellow.b,
alpha = 0
} )
f4_local6:addElement( f4_local7 )
f4_local6:addElement( f4_local11 )
self:addElement( f4_local5 )
self:addElement( f4_local6 )
return self
end
function captureHudDef()
local self = LUI.UIElement.new()
self.id = "capture_hud"
self:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
bottom = 250,
left = -(f0_local2 / 2),
height = f0_local1,
width = f0_local2
} )
self:animateToState( "default", 0 )
self:registerOmnvarHandler( "ui_securing", f0_local11 )
self:addElement( f0_local12( f0_local10 ) )
return self
end
LUI.MenuBuilder.registerType( "captureHudDef", captureHudDef )
LockTable( _M )