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

520 lines
12 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 )
if f1_arg1.value and f1_arg0.current_state ~= "active" then
f1_arg0:animateToState( "active", 0 )
f1_arg0.current_state = "active"
elseif not f1_arg1.value and f1_arg0.current_state ~= "default" then
f1_arg0:animateToState( "default", 0 )
f1_arg0.current_state = "default"
end
end
f0_local1 = function ( f2_arg0, f2_arg1, f2_arg2, f2_arg3 )
local f2_local0 = 128
local self = LUI.UIImage.new()
self.id = "predText" .. tostring( f2_arg0 ) .. "id"
self:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = true,
top = f2_arg2 - f2_local0 / 2,
right = f2_arg1,
zRot = f2_arg3,
width = f2_local0,
height = f2_local0,
material = RegisterMaterial( "ui_predator_text01" ),
alpha = 1
} )
self:registerAnimationState( "1", {
material = RegisterMaterial( "ui_predator_text01" )
} )
self:registerAnimationState( "2", {
material = RegisterMaterial( "ui_predator_text02" )
} )
self:registerAnimationState( "3", {
material = RegisterMaterial( "ui_predator_text03" )
} )
self:registerAnimationState( "4", {
material = RegisterMaterial( "ui_predator_text04" )
} )
self:animateToState( "default", 0 )
local f2_local2 = 250
local f2_local3 = 750
local f2_local4 = 4
local f2_local5 = 11 + 2 * (f2_arg0 - 1)
local f2_local6 = {}
for f2_local7 = 1, f2_local5, 1 do
local f2_local10 = f2_local7
table.insert( f2_local6, {
tostring( math.random( f2_local4 ) ),
math.random( f2_local2, f2_local3 )
} )
end
local f2_local8 = MBh.AnimateLoop( f2_local6 )
f2_local8( self )
return self
end
f0_local2 = function ()
local f3_local0 = GameX.IsSplitscreen() and 192 or 384
local self = LUI.UIImage.new()
self.id = "predatorGraphId"
self:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = -0.5 * f3_local0,
left = 0,
width = 0.5 * f3_local0,
height = f3_local0,
material = RegisterMaterial( "ui_predator_graph_01" ),
alpha = 1
} )
self:registerAnimationState( "1", {
material = RegisterMaterial( "ui_predator_graph_02" )
} )
self:registerAnimationState( "2", {
material = RegisterMaterial( "ui_predator_graph_03" )
} )
self:registerAnimationState( "3", {
material = RegisterMaterial( "ui_predator_graph_04" )
} )
self:animateToState( "default", 0 )
local f3_local2 = MBh.AnimateLoop( {
{
"3",
100
},
{
"1",
100
},
{
"2",
50
},
{
"3",
50
},
{
"2",
100
},
{
"default",
3000
}
} )
f3_local2( self )
return self
end
local f0_local3 = function ()
local f4_local0 = 192
local self = LUI.UIImage.new()
self.id = "predatorScanlineId"
self:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
top = 0,
left = -f4_local0,
right = undefined,
width = f4_local0,
material = RegisterMaterial( "ui_predator_wipe" ),
alpha = 1
} )
self:registerAnimationState( "swipe", {
leftAnchor = false,
rightAnchor = true,
left = undefined,
right = f4_local0
} )
self:registerOmnvarHandler( "ui_predator_hud_scanline", function ( f5_arg0, f5_arg1 )
if f5_arg1.value then
self:animateToState( "default", 0 )
self:animateToState( "swipe", 125 )
else
self:animateToState( "default", 0 )
end
end )
self:animateToState( "default", 0 )
return self
end
local f0_local4 = function ( f6_arg0, f6_arg1 )
if f6_arg1.value == 0 then
f6_arg0:animateToState( "default", 0 )
LUI.UITimer.Stop( f6_arg0.positionTimer )
elseif f6_arg1.value == 2 then
f6_arg0:dispatchEventToChildren( {
name = "reticleLocked"
} )
elseif f6_arg1.value == 1 then
f6_arg0:animateToState( "active", 0 )
LUI.UITimer.Reset( f6_arg0.positionTimer )
f6_arg0:dispatchEventToChildren( {
name = "reticleZoom"
} )
end
end
local f0_local5 = function ( f7_arg0, f7_arg1, f7_arg2, f7_arg3, f7_arg4, f7_arg5, f7_arg6, f7_arg7 )
local self = LUI.UIImage.new()
self.id = f7_arg0
self:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = f7_arg2,
left = f7_arg3,
height = 128,
width = 128,
material = RegisterMaterial( f7_arg1 ),
zRot = f7_arg4,
alpha = 0
} )
self:registerAnimationState( "on", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = f7_arg2,
left = f7_arg3,
height = 128,
width = 128,
zRot = f7_arg4,
alpha = 1
} )
self:registerAnimationState( "dim", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = f7_arg2,
left = f7_arg3,
height = 128,
width = 128,
zRot = f7_arg4,
alpha = 0.25
} )
self:registerAnimationState( "large", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
top = f7_arg6,
left = f7_arg7,
height = 500,
width = 500,
zRot = f7_arg4,
alpha = 1
} )
local f7_local1 = 50
self:animateToState( "default", 0 )
self:registerEventHandler( "reticleLocked", MBh.AnimateSequence( {
{
"dim",
f7_local1
},
{
"on",
f7_local1
},
{
"dim",
f7_local1
},
{
"on",
f7_local1
},
{
"dim",
f7_local1
},
{
"on",
f7_local1
}
} ) )
self:registerEventHandler( "reticleZoom", MBh.AnimateSequence( {
{
"default",
0
},
{
"large",
0
},
{
"on",
f7_arg5
}
} ) )
return self
end
local f0_local6 = function ()
local self = LUI.UIElement.new()
self.id = "predatorReticleConainterId"
self:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 0,
left = 0,
width = 1,
height = 1,
alpha = 0
} )
self:registerAnimationState( "active", {
alpha = 1
} )
self:animateToState( "default", 0 )
local f8_local1 = LUI.UITimer.new( 16, "updateTargetPos", nil, false, false, false, true )
f8_local1.id = "predatorReticleTimerId"
self.positionTimer = f8_local1
self:addElement( f8_local1 )
self:registerEventHandler( "updateTargetPos", function ( element, event )
local f9_local0 = Game.GetOmnvar( "ui_predator_target_ent" )
if f9_local0 > -1 then
local f9_local1, f9_local2 = Game.GetScreenLocation( f9_local0, "j_spineupper" )
if f9_local1 and f9_local2 then
local f9_local3, f9_local4 = nil
local f9_local5 = ScreenResolution[currentScreenResolution]
element:registerAnimationState( "position", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = LUI.clamp( f9_local2, 0, f9_local5.height ),
left = LUI.clamp( f9_local1, 0, f9_local5.width ),
width = 0,
height = 0,
alpha = 1
} )
element:animateToState( "position", 0 )
end
end
end )
self:registerOmnvarHandler( "ui_predator_hud_reticle", f0_local4 )
for f8_local5, f8_local6 in pairs( {
{
elementName = "predatorReticleBottomId",
imageName = "ui_predator_reticle_bottom",
vertOffset = -50,
horizOffset = -60,
zRot = 0,
zoomInTime = 375,
zoomInVert = 500,
zoomInHoriz = -60
},
{
elementName = "predatorReticleRightId",
imageName = "ui_predator_reticle_side",
vertOffset = -82,
horizOffset = -46,
zRot = 0,
zoomInTime = 375,
zoomInVert = -800,
zoomInHoriz = 800
},
{
elementName = "predatorReticleLeftId",
imageName = "ui_predator_reticle_side",
vertOffset = -76,
horizOffset = -84,
zRot = 122,
zoomInTime = 375,
zoomInVert = -800,
zoomInHoriz = -800
}
} ) do
self:addElement( f0_local5( f8_local6.elementName, f8_local6.imageName, f8_local6.vertOffset, f8_local6.horizOffset, f8_local6.zRot, f8_local6.zoomInTime, f8_local6.zoomInVert, f8_local6.zoomInHoriz ) )
end
return self
end
local f0_local7 = function ( f10_arg0, f10_arg1, f10_arg2 )
local self = LUI.UIText.new()
self.id = f10_arg0
self:setText( Engine.Localize( f10_arg1 ) )
self:setTextStyle( CoD.TextStyle.Shadowed )
self:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
bottom = 0,
left = 0,
right = 0,
height = CoD.TextSettings.HudEuroMedSmallFont.Height,
font = CoD.TextSettings.HudEuroMedSmallFont.Font,
red = 1,
green = 1,
blue = 1,
alignment = f10_arg2,
alpha = 1
} )
self:animateToState( "default", 0 )
self:registerAnimationState( "flash1", {
red = 1,
green = 0,
blue = 0,
alpha = 0.5
} )
self:registerAnimationState( "flash2", {
red = 1,
green = 1,
blue = 1,
alpha = 0.25
} )
self:registerEventHandler( "flashing", MBh.AnimateLoop( {
{
"flash1",
250
},
{
"flash2",
250
}
} ) )
self:registerEventHandler( "stop_flashing", MBh.AnimateToState( "default", 0 ) )
return self
end
local f0_local8 = function ( f11_arg0, f11_arg1, f11_arg2, f11_arg3, f11_arg4 )
local f11_local0 = "Right"
local f11_local1 = LUI.Alignment.Left
local f11_local2 = 600
local f11_local3 = undefined
local f11_local4 = f11_local2
if f11_arg3 then
f11_local0 = "Left"
f11_local1 = LUI.Alignment.Right
f11_local3 = -f11_local2
f11_local4 = undefined
end
local f11_local5 = f11_arg0 .. f11_local0
local self = LUI.UIElement.new()
self.id = f11_local5
self:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = false,
rightAnchor = false,
left = f11_local3,
right = f11_local4,
top = f11_arg4,
bottom = f11_arg4 + 64,
width = 512,
alpha = 0
} )
self:registerAnimationState( "active", {
alpha = 1
} )
self:registerAnimationState( "blink", {
alpha = 0.5
} )
self:animateToState( "default", 0 )
local f11_local7 = LUI.UIVerticalList.new()
f11_local7.id = f11_local5 .. "vList"
f11_local7:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
spacing = 20
} )
f11_local7:animateToState( "default", 0 )
f11_local7:addElement( f0_local7( f11_local5 .. "Trigger", f11_arg2, f11_local1 ) )
self:addElement( f11_local7 )
return self
end
LUI.MenuBuilder.registerType( "juggPredatorOverlayDef", function ()
local self = LUI.UIElement.new()
self.id = "juggPredatorOverlayContainerId"
self:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
alpha = 1
} )
self:animateToState( "default", 0 )
self:registerAnimationState( "active", {
alpha = 1
} )
self:registerOmnvarHandler( "ui_predator_hud_graph", f0_local0 )
self:registerEventHandler( "init_overlay", f0_local0 )
local f12_local1 = LUI.UIImage.new()
f12_local1.id = "juggPredatorOverlayImgId"
f12_local1:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
material = RegisterMaterial( "ui_predator_overlay" ),
alpha = 1
} )
f12_local1:animateToState( "default", 0 )
self:addElement( f12_local1 )
local f12_local2 = 128
if GameX.IsSplitscreen() then
f12_local2 = 36
end
local f12_local3 = f0_local8( "predatorControls", "@MP_JUGG_PREDATOR_UI_CLOAK", "@MP_JUGG_PREDATOR_UI_VISION", true, f12_local2 )
self:addElement( f12_local3 )
f12_local3:animateToState( "active" )
local f12_local4 = f0_local8( "predatorControls", "@MP_JUGG_PREDATOR_UI_VISION", "@MP_JUGG_PREDATOR_UI_FIRE", false, f12_local2 )
f12_local4:registerOmnvarHandler( "ui_predator_hud_reticle", function ( f13_arg0, f13_arg1 )
if f13_arg1.value == 0 then
f13_arg0:animateToState( "default", 0 )
elseif f13_arg1.value == 2 then
f13_arg0:animateToState( "active", 1 )
elseif f13_arg1.value == 3 then
local f13_local0 = MBh.AnimateLoop( {
{
"blink",
250
},
{
"active",
250
}
} )
f13_local0( f13_arg0, f13_arg1 )
end
end )
self:addElement( f12_local4 )
self:addElement( f0_local2() )
local f12_local5 = nil
if not GameX.IsSplitscreen() then
self:addElement( f0_local1( 0, -45, -120, 25 ) )
self:addElement( f0_local1( 3, -45, 110, -50 ) )
end
self:addElement( f0_local1( 1, -20, -50, 0 ) )
self:addElement( f0_local1( 2, -20, 30, 0 ) )
self:addElement( f0_local6() )
self:addElement( f0_local3() )
return self
end )
LockTable( _M )