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

546 lines
16 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 == 1 then
local f1_local0 = f1_arg0:getChildById( "vanguardWarning" )
f1_local0:animateToState( "default", 0 )
f1_local0.isBlinking = nil
f1_arg0:animateToState( "active", 100 )
local f1_local1 = f1_arg0:getChildById( "vanguardReticleImageId" )
f1_local1:animateToState( "active", 100 )
local f1_local2 = f1_arg0:getChildById( "vanguardStaticId" )
f1_local2:animateToState( "default", 100 )
local f1_local3 = f1_arg0:getChildById( "bar1" )
if not f1_local3.spinning then
local f1_local4 = MBh.AnimateLoop( {
{
"blink_on",
1000
},
{
"blink_off",
500
},
{
"blink_off",
500
}
} )
f1_local4( f1_local3 )
f1_local3.spinning = true
end
elseif f1_arg1.value >= 2 then
local f1_local0 = f1_arg0:getChildById( "vanguardStaticId" )
local f1_local1 = f1_arg0:getChildById( "vanguardReticleImageId" )
local f1_local2 = f1_arg0:getChildById( "vanguardWarning" )
if f1_arg1.value >= 10 then
f1_local0:animateToState( "active10", 200 )
f1_local1:animateToState( "default", 0 )
elseif f1_arg1.value >= 9 then
f1_local0:animateToState( "active9", 200 )
f1_local1:animateToState( "default", 0 )
elseif f1_arg1.value >= 8 then
f1_local0:animateToState( "active8", 200 )
f1_local1:animateToState( "default", 0 )
elseif f1_arg1.value >= 7 then
f1_local0:animateToState( "active7", 200 )
f1_local1:animateToState( "default", 0 )
elseif f1_arg1.value >= 6 then
f1_local0:animateToState( "active6", 200 )
f1_local1:animateToState( "active", 0 )
elseif f1_arg1.value >= 5 then
f1_local0:animateToState( "active5", 200 )
f1_local1:animateToState( "active", 0 )
elseif f1_arg1.value >= 4 then
f1_local0:animateToState( "active4", 200 )
f1_local1:animateToState( "active", 0 )
elseif f1_arg1.value >= 3 then
f1_local0:animateToState( "active3", 200 )
f1_local1:animateToState( "active", 0 )
else
f1_local0:animateToState( "active2", 200 )
f1_local1:animateToState( "active", 0 )
if not f1_local2.isBlinking then
f1_local2.isBlinking = true
local f1_local3 = MBh.AnimateLoop( {
{
"showing",
500
},
{
"blink",
500
}
} )
f1_local3( f1_local2 )
end
end
else
f1_arg0:animateToState( "default", 0 )
local f1_local0 = f1_arg0:getChildById( "vanguardStaticId" )
f1_local0:animateToState( "default", 0 )
end
end
f0_local1 = function ( f2_arg0, f2_arg1 )
local f2_local0 = f2_arg0:getChildById( "vanguardHeadingId" )
f2_local0:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_HEADING_LABEL", Game.GetOmnvar( "ui_vanguard_heading" ) ) )
local f2_local1 = f2_arg0:getChildById( "vanguardAltitudeId" )
f2_local1:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_ALT_LABEL", Game.GetOmnvar( "ui_vanguard_altitude" ) ) )
local f2_local2 = f2_arg0:getChildById( "vanguardRangeId" )
f2_local2:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_RANGE", Game.GetOmnvar( "ui_vanguard_range" ) ) )
end
f0_local2 = function ( f3_arg0, f3_arg1 )
local f3_local0 = f3_arg0:getChildById( "vanguardWeaponId" )
local f3_local1 = "@KILLSTREAKS_VANGUARD_WEAPON_STATUS_READY"
if f3_arg1.value < 0 then
f3_local1 = "@KILLSTREAKS_VANGUARD_WEAPON_STATUS_RELOAD"
local f3_local2 = f3_arg0:getChildById( "vanguardOverlayImageId" )
local f3_local3 = MBh.AnimateSequence( {
{
"default",
0
},
{
"active",
100
},
{
"default",
500
}
} )
f3_local3( f3_local2 )
f3_local0:animateToState( "reload", 0 )
else
f3_local0:animateToState( "default", 0 )
end
f3_local0:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_WEAPON_STATUS_LABEL", Engine.Localize( f3_local1 ) ) )
end
local f0_local3 = function ( f4_arg0, f4_arg1 )
local f4_local0 = f4_arg0:getChildById( "vanguardControlsVLId" )
local f4_local1 = f4_local0:getChildById( "steeringTextId" )
local f4_local2 = f4_local0:getChildById( "steeringText2Id" )
local f4_local3 = f4_local0:getChildById( "fireTextId" )
if CoD.UsingController() then
f4_local1:setText( Engine.Localize( "@KILLSTREAKS_REMOTE_UAV_ASCEND" ) )
f4_local2:setText( Engine.Localize( "@KILLSTREAKS_REMOTE_UAV_DESCEND" ) )
else
f4_local1:setText( Engine.Localize( "@PLATFORM_REMOTE_UAV_ASCEND" ) )
f4_local2:setText( Engine.Localize( "@PLATFORM_REMOTE_UAV_DESCEND" ) )
end
f4_local3:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_FIRE" ) )
end
function vanguardOverlayDef()
local f5_local0 = RegisterMaterial( "ac130_overlay_grain" )
local f5_local1 = RegisterMaterial( "gryphon_hud_mp" )
local f5_local2 = RegisterMaterial( "white" )
local f5_local3, f5_local4 = GameX.GetScreenDims()
local f5_local5, f5_local6 = nil
local self = LUI.UIElement.new()
self.id = "vanguardOverlayContainerId"
self:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
alpha = 0
} )
self:animateToState( "default", 0 )
self:registerAnimationState( "active", {
alpha = 1
} )
self:registerOmnvarHandler( "ui_vanguard", f0_local0 )
self:registerEventHandler( "init_overlay", f0_local0 )
self:registerEventHandler( "refresh_controls", f0_local3 )
self:registerOmnvarHandler( "ui_vanguard_heading", f0_local1 )
self:registerOmnvarHandler( "ui_vanguard_ammo", f0_local2 )
local f5_local8 = LUI.UIImage.new()
f5_local8.id = "vanguardOverlayImageId"
f5_local8:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
material = f5_local0,
red = 0.9,
green = 1,
blue = 1,
alpha = 0.45
} )
f5_local8:animateToState( "default", 0 )
f5_local8:registerAnimationState( "active", {
alpha = 1
} )
self:addElement( f5_local8 )
local f5_local9 = LUI.UIImage.new()
f5_local9.id = "vanguardReticleImageId"
f5_local9:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
material = f5_local1,
alpha = 0
} )
f5_local9:animateToState( "default", 0 )
f5_local9:registerAnimationState( "active", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
material = f5_local1,
alpha = 1
} )
self:addElement( f5_local9 )
local f5_local10 = LUI.UIText.new()
f5_local10.id = "vanguardWarning"
f5_local10:setText( Engine.Localize( "@KILLSTREAKS_REMOTE_UAV_OUT_OF_RANGE" ) )
f5_local10:setTextStyle( CoD.TextStyle.None )
f5_local10:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = true,
top = 256,
height = CoD.TextSettings.HudEuroBigFont.Height,
font = CoD.TextSettings.HudEuroBigFont.Font,
alignment = LUI.Alignment.Center,
red = Colors.red.r,
green = Colors.red.g,
blue = Colors.red.b,
alpha = 0
} )
f5_local10:animateToState( "default", 0 )
f5_local10:registerAnimationState( "showing", {
red = Colors.red.r,
alpha = 1
} )
f5_local10:registerAnimationState( "blink", {
red = 0.5,
alpha = 0.5
} )
if not MLG.IsMLGSpectator() then
f5_local6 = LUI.UIHorizontalList.new()
f5_local6.id = "vanguardControlsVLId"
f5_local6:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = false,
bottom = -66,
left = -384,
right = 384,
height = 64,
alpha = 1,
spacing = 0
} )
f5_local6:animateToState( "default", 0 )
local f5_local11 = LUI.UIText.new()
f5_local11.id = "steeringTextId"
local f5_local12 = nil
if CoD.UsingController() then
f5_local12 = "@KILLSTREAKS_REMOTE_UAV_ASCEND"
else
f5_local12 = "@PLATFORM_REMOTE_UAV_ASCEND"
end
f5_local11:setText( Engine.Localize( f5_local12 ) )
f5_local11:setTextStyle( CoD.TextStyle.Shadowed )
f5_local11:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = false,
bottom = 0,
width = 256,
height = CoD.TextSettings.HudEuroNormalFont.Height,
font = CoD.TextSettings.HudEuroNormalFont.Font,
alignment = LUI.Alignment.Center
} )
f5_local11:animateToState( "default", 0 )
local f5_local13 = LUI.UIText.new()
f5_local13.id = "steeringText2Id"
if CoD.UsingController() then
f5_local12 = "@KILLSTREAKS_REMOTE_UAV_DESCEND"
else
f5_local12 = "@PLATFORM_REMOTE_UAV_DESCEND"
end
f5_local13:setText( Engine.Localize( f5_local12 ) )
f5_local13:setTextStyle( CoD.TextStyle.Shadowed )
f5_local13:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = false,
bottom = 0,
width = 256,
height = CoD.TextSettings.HudEuroNormalFont.Height,
font = CoD.TextSettings.HudEuroNormalFont.Font,
alignment = LUI.Alignment.Center
} )
f5_local13:animateToState( "default", 0 )
local f5_local14 = LUI.UIText.new()
f5_local14.id = "fireTextId"
f5_local14:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_FIRE" ) )
f5_local14:setTextStyle( CoD.TextStyle.Shadowed )
f5_local14:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = false,
bottom = 0,
width = 256,
height = CoD.TextSettings.HudEuroNormalFont.Height,
font = CoD.TextSettings.HudEuroNormalFont.Font,
alignment = LUI.Alignment.Center
} )
f5_local14:animateToState( "default", 0 )
f5_local6:addElement( f5_local13 )
f5_local6:addElement( f5_local14 )
f5_local6:addElement( f5_local11 )
end
if not MLG.IsMLGSpectator() then
f5_local5 = LUI.UIText.new()
f5_local5.id = "vanguardTitleId"
f5_local5:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_TITLE" ) )
f5_local5:setTextStyle( CoD.TextStyle.None )
f5_local5:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 72,
left = 130,
height = CoD.TextSettings.HudEuroConRegSmallFont.Height,
font = CoD.TextSettings.HudEuroConRegSmallFont.Font,
alignment = LUI.Alignment.Left
} )
f5_local5:animateToState( "default", 0 )
self:addElement( f5_local5 )
end
local f5_local11 = RegisterMaterial( "apache_ammo_mp" )
local f5_local12 = LUI.UIImage.new()
f5_local12.id = "bar1"
f5_local12:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = false,
rightAnchor = false,
top = 72,
right = 128,
height = 16,
width = 16,
material = f5_local11,
alpha = 1,
zRot = 90
} )
f5_local12:animateToState( "default", 0 )
f5_local12:registerAnimationState( "blink_on", {
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = 1
} )
f5_local12:registerAnimationState( "blink_off", {
red = Colors.grey_2.r,
green = Colors.grey_2.g,
blue = Colors.grey_2.b,
alpha = 0.25
} )
self:addElement( f5_local12 )
f5_local5 = LUI.UIText.new()
f5_local5.id = "vanguardFlightModeId"
f5_local5:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_FLIGHT_MODE" ) )
f5_local5:setTextStyle( CoD.TextStyle.None )
f5_local5:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
bottom = -144,
left = 160,
height = CoD.TextSettings.HudEuroConRegSmallFont.Height,
font = CoD.TextSettings.HudEuroConRegSmallFont.Font,
alignment = LUI.Alignment.Left
} )
f5_local5:animateToState( "default", 0 )
self:addElement( f5_local5 )
f5_local5 = LUI.UIText.new()
f5_local5.id = "vanguardHeadingId"
f5_local5:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_HEADING_LABEL" ) )
f5_local5:setTextStyle( CoD.TextStyle.None )
f5_local5:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
bottom = -122,
left = 160,
height = CoD.TextSettings.HudEuroConRegSmallFont.Height,
font = CoD.TextSettings.HudEuroConRegSmallFont.Font,
alignment = LUI.Alignment.Left
} )
f5_local5:animateToState( "default", 0 )
self:addElement( f5_local5 )
f5_local5 = LUI.UIText.new()
f5_local5.id = "vanguardAltitudeId"
f5_local5:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_ALT_LABEL" ) )
f5_local5:setTextStyle( CoD.TextStyle.None )
f5_local5:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = false,
bottom = -100,
left = 160,
height = CoD.TextSettings.HudEuroConRegSmallFont.Height,
font = CoD.TextSettings.HudEuroConRegSmallFont.Font,
alignment = LUI.Alignment.Left
} )
f5_local5:animateToState( "default", 0 )
self:addElement( f5_local5 )
f5_local5 = LUI.UIText.new()
f5_local5.id = "vanguardWeaponId"
f5_local5:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_WEAPON_STATUS_LABEL", Engine.Localize( "@KILLSTREAKS_VANGUARD_WEAPON_STATUS_READY" ) ) )
f5_local5:setTextStyle( CoD.TextStyle.None )
f5_local5:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = true,
bottom = -144,
right = -165,
height = CoD.TextSettings.HudEuroConRegSmallFont.Height,
font = CoD.TextSettings.HudEuroConRegSmallFont.Font,
alignment = LUI.Alignment.Right,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = 1
} )
f5_local5:animateToState( "default", 0 )
f5_local5:registerAnimationState( "reload", {
red = Colors.md_grey.r,
green = Colors.md_grey.g,
blue = Colors.md_grey.b
} )
self:addElement( f5_local5 )
f5_local5 = LUI.UIText.new()
f5_local5.id = "vanguardRangeId"
f5_local5:setText( Engine.Localize( "@KILLSTREAKS_VANGUARD_RANGE", 0 ) )
f5_local5:setTextStyle( CoD.TextStyle.None )
f5_local5:registerAnimationState( "default", {
topAnchor = false,
leftAnchor = false,
bottomAnchor = true,
rightAnchor = true,
bottom = -122,
right = -165,
height = CoD.TextSettings.HudEuroConRegSmallFont.Height,
font = CoD.TextSettings.HudEuroConRegSmallFont.Font,
alignment = LUI.Alignment.Right,
red = Colors.white.r,
green = Colors.white.g,
blue = Colors.white.b,
alpha = 1
} )
f5_local5:animateToState( "default", 0 )
self:addElement( f5_local5 )
local f5_local13 = LUI.UIElement.new()
f5_local13.id = "vanguardStaticId"
f5_local13:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
alpha = 0
} )
f5_local13:animateToState( "default", 0 )
f5_local13:registerAnimationState( "active", {
alpha = 0.1
} )
f5_local13:registerAnimationState( "active2", {
alpha = 0.2
} )
f5_local13:registerAnimationState( "active3", {
alpha = 0.3
} )
f5_local13:registerAnimationState( "active4", {
alpha = 0.4
} )
f5_local13:registerAnimationState( "active5", {
alpha = 0.5
} )
f5_local13:registerAnimationState( "active6", {
alpha = 0.6
} )
f5_local13:registerAnimationState( "active7", {
alpha = 0.7
} )
f5_local13:registerAnimationState( "active8", {
alpha = 0.8
} )
f5_local13:registerAnimationState( "active9", {
alpha = 0.9
} )
f5_local13:registerAnimationState( "active10", {
alpha = 1
} )
local f5_local14 = LUI.UIImage.new()
f5_local14.id = "vanguardWhiteImageId"
f5_local14:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
material = f5_local2
} )
f5_local14:animateToState( "default", 0 )
local f5_local15 = LUI.UIImage.new()
f5_local15.id = "vanguardStaticImageId"
f5_local15:registerAnimationState( "default", {
topAnchor = true,
leftAnchor = true,
bottomAnchor = true,
rightAnchor = true,
top = 0,
left = 0,
bottom = 0,
right = 0,
material = f5_local0
} )
f5_local15:animateToState( "default", 0 )
f5_local13:addElement( f5_local14 )
f5_local13:addElement( f5_local15 )
if not MLG.IsMLGSpectator() then
self:addElement( f5_local6 )
end
self:addElement( f5_local13 )
self:addElement( f5_local10 )
return self
end
LUI.MenuBuilder.registerType( "vanguardOverlayDef", vanguardOverlayDef )
LockTable( _M )