275 lines
		
	
	
		
			7.6 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
			
		
		
	
	
			275 lines
		
	
	
		
			7.6 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 Engine.IsConsoleGame() then
 | |
| 		local f1_local0 = f1_arg0:getChildById( "predatorMissileControlsVLId" )
 | |
| 		local f1_local1 = f1_local0:getChildById( "steeringTextId" )
 | |
| 		if IsCurrentSticksLayoutSouthpaw() then
 | |
| 			f1_local1:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_AIM_SOUTHPAW" ) )
 | |
| 		elseif IsCurrentSticksLayoutLegacy() or IsCurrentSticksLayoutLegacySouthpaw() then
 | |
| 			f1_local1:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_AIM_LEGACY" ) )
 | |
| 		else
 | |
| 			f1_local1:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_AIM" ) )
 | |
| 		end
 | |
| 	end
 | |
| 	if f1_arg1.value == 1 then
 | |
| 		f1_arg0:animateToState( "active", 0 )
 | |
| 		local f1_local0 = f1_arg0:getChildById( "predatorMissileReticleImageId" )
 | |
| 		local f1_local2 = MBh.AnimateSequence( {
 | |
| 			{
 | |
| 				"default",
 | |
| 				0
 | |
| 			},
 | |
| 			{
 | |
| 				"opening",
 | |
| 				150
 | |
| 			},
 | |
| 			{
 | |
| 				"active",
 | |
| 				0
 | |
| 			}
 | |
| 		} )
 | |
| 		f1_local2( f1_local0 )
 | |
| 		f1_local2 = f1_arg0:getChildById( "predatorMissileControlsVLId" )
 | |
| 		local f1_local3 = MBh.AnimateSequence( {
 | |
| 			{
 | |
| 				"default",
 | |
| 				0
 | |
| 			},
 | |
| 			{
 | |
| 				"active",
 | |
| 				150
 | |
| 			}
 | |
| 		} )
 | |
| 		f1_local3( f1_local2 )
 | |
| 	elseif f1_arg1.value == 2 then
 | |
| 		local f1_local0 = f1_arg0:getChildById( "predatorMissileStaticId" )
 | |
| 		f1_local0:animateToState( "active", 0 )
 | |
| 		local f1_local1 = f1_arg0:getChildById( "predatorMissileReticleImageId" )
 | |
| 		f1_local1:animateToState( "default", 0 )
 | |
| 		local f1_local2 = f1_arg0:getChildById( "predatorMissileControlsVLId" )
 | |
| 		f1_local2:animateToState( "default", 0 )
 | |
| 	else
 | |
| 		f1_arg0:animateToState( "default", 0 )
 | |
| 		local f1_local0 = f1_arg0:getChildById( "predatorMissileStaticId" )
 | |
| 		f1_local0:animateToState( "default", 0 )
 | |
| 	end
 | |
| end
 | |
| 
 | |
| f0_local1 = function ( f2_arg0, f2_arg1 )
 | |
| 	local f2_local0 = f2_arg0:getChildById( "predatorMissileControlsVLId" )
 | |
| 	local f2_local1 = f2_local0:getChildById( "steeringTextId" )
 | |
| 	local f2_local2 = f2_local0:getChildById( "boostTextId" )
 | |
| 	f2_local1:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_AIM" ) )
 | |
| 	if Game.GetOmnvar( "ui_predator_missiles_left" ) > 0 then
 | |
| 		f2_local2:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_FIRE" ) )
 | |
| 	end
 | |
| 	f2_local2:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_BOOST" ) )
 | |
| end
 | |
| 
 | |
| function predatorMissileOverlayDef()
 | |
| 	local f3_local0 = RegisterMaterial( "white" )
 | |
| 	local f3_local1 = RegisterMaterial( "ac130_overlay_grain" )
 | |
| 	local f3_local2 = RegisterMaterial( "missilecam_reticle" )
 | |
| 	local f3_local3, f3_local4 = GameX.GetScreenDims()
 | |
| 	local self = LUI.UIElement.new()
 | |
| 	self.id = "predatorMissileOverlayContainerId"
 | |
| 	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_predator_missile", f0_local0 )
 | |
| 	self:registerEventHandler( "init_overlay", f0_local0 )
 | |
| 	self:registerEventHandler( "refresh_controls", f0_local1 )
 | |
| 	local f3_local6 = LUI.UIImage.new()
 | |
| 	f3_local6.id = "predatorMissileOverlayImageId"
 | |
| 	f3_local6:registerAnimationState( "default", {
 | |
| 		topAnchor = true,
 | |
| 		leftAnchor = true,
 | |
| 		bottomAnchor = true,
 | |
| 		rightAnchor = true,
 | |
| 		top = 0,
 | |
| 		left = 0,
 | |
| 		bottom = 0,
 | |
| 		right = 0,
 | |
| 		material = f3_local1,
 | |
| 		red = 0.9,
 | |
| 		green = 1,
 | |
| 		blue = 1,
 | |
| 		alpha = 0.3
 | |
| 	} )
 | |
| 	f3_local6:animateToState( "default", 0 )
 | |
| 	local f3_local7 = LUI.UIImage.new()
 | |
| 	f3_local7.id = "predatorMissileReticleImageId"
 | |
| 	f3_local7:registerAnimationState( "default", {
 | |
| 		topAnchor = false,
 | |
| 		leftAnchor = false,
 | |
| 		bottomAnchor = false,
 | |
| 		rightAnchor = false,
 | |
| 		top = 0,
 | |
| 		left = 0,
 | |
| 		bottom = 0,
 | |
| 		right = 0,
 | |
| 		material = f3_local2,
 | |
| 		alpha = 0
 | |
| 	} )
 | |
| 	f3_local7:animateToState( "default", 0 )
 | |
| 	f3_local7:registerAnimationState( "opening", {
 | |
| 		topAnchor = false,
 | |
| 		leftAnchor = false,
 | |
| 		bottomAnchor = false,
 | |
| 		rightAnchor = false,
 | |
| 		top = -(f3_local4 * 0.5) - 80,
 | |
| 		left = -(f3_local3 * 0.5) - 80,
 | |
| 		bottom = f3_local4 * 0.5 + 80,
 | |
| 		right = f3_local3 * 0.5 + 80,
 | |
| 		material = f3_local2,
 | |
| 		alpha = 0.5
 | |
| 	} )
 | |
| 	f3_local7:registerAnimationState( "active", {
 | |
| 		topAnchor = false,
 | |
| 		leftAnchor = false,
 | |
| 		bottomAnchor = false,
 | |
| 		rightAnchor = false,
 | |
| 		top = -f3_local4 * 0.5,
 | |
| 		left = -f3_local3 * 0.5,
 | |
| 		bottom = f3_local4 * 0.5,
 | |
| 		right = f3_local3 * 0.5,
 | |
| 		material = f3_local2,
 | |
| 		alpha = 1
 | |
| 	} )
 | |
| 	local f3_local8 = LUI.UIVerticalList.new()
 | |
| 	f3_local8.id = "predatorMissileControlsVLId"
 | |
| 	f3_local8:registerAnimationState( "default", {
 | |
| 		topAnchor = false,
 | |
| 		leftAnchor = false,
 | |
| 		bottomAnchor = true,
 | |
| 		rightAnchor = false,
 | |
| 		bottom = -80,
 | |
| 		left = -256,
 | |
| 		right = 256,
 | |
| 		height = 64,
 | |
| 		alpha = 0,
 | |
| 		spacing = 0
 | |
| 	} )
 | |
| 	f3_local8:animateToState( "default", 0 )
 | |
| 	f3_local8:registerAnimationState( "active", {
 | |
| 		alpha = 1
 | |
| 	} )
 | |
| 	local f3_local9 = LUI.UIText.new()
 | |
| 	f3_local9.id = "steeringTextId"
 | |
| 	f3_local9:setText( Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_AIM" ) )
 | |
| 	f3_local9:setTextStyle( CoD.TextStyle.Shadowed )
 | |
| 	f3_local9:registerAnimationState( "default", {
 | |
| 		topAnchor = false,
 | |
| 		leftAnchor = true,
 | |
| 		bottomAnchor = true,
 | |
| 		rightAnchor = true,
 | |
| 		bottom = 0,
 | |
| 		left = 0,
 | |
| 		right = 0,
 | |
| 		height = CoD.TextSettings.HudEuroBigFont.Height,
 | |
| 		font = CoD.TextSettings.HudEuroBigFont.Font,
 | |
| 		alignment = LUI.Alignment.Center
 | |
| 	} )
 | |
| 	f3_local9:animateToState( "default", 0 )
 | |
| 	local f3_local10 = function ()
 | |
| 		if Game.GetOmnvar( "ui_predator_missiles_left" ) > 0 then
 | |
| 			return Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_FIRE" )
 | |
| 		else
 | |
| 			return Engine.Localize( "@PLATFORM_PREDATOR_MISSILE_BOOST" )
 | |
| 		end
 | |
| 	end
 | |
| 	
 | |
| 	local f3_local11 = LUI.UIText.new()
 | |
| 	f3_local11.id = "boostTextId"
 | |
| 	f3_local11:setText( f3_local10() )
 | |
| 	f3_local11:setTextStyle( CoD.TextStyle.Shadowed )
 | |
| 	f3_local11:registerAnimationState( "default", {
 | |
| 		topAnchor = false,
 | |
| 		leftAnchor = true,
 | |
| 		bottomAnchor = true,
 | |
| 		rightAnchor = true,
 | |
| 		bottom = 0,
 | |
| 		left = 0,
 | |
| 		right = 0,
 | |
| 		height = CoD.TextSettings.HudEuroBigFont.Height,
 | |
| 		font = CoD.TextSettings.HudEuroBigFont.Font,
 | |
| 		alignment = LUI.Alignment.Center
 | |
| 	} )
 | |
| 	f3_local11:animateToState( "default", 0 )
 | |
| 	f3_local11:registerOmnvarHandler( "ui_predator_missiles_left", function ( f5_arg0, f5_arg1 )
 | |
| 		f5_arg0:setText( f3_local10() )
 | |
| 	end )
 | |
| 	f3_local8:addElement( f3_local9 )
 | |
| 	f3_local8:addElement( f3_local11 )
 | |
| 	local f3_local12 = LUI.UIElement.new()
 | |
| 	f3_local12.id = "predatorMissileStaticId"
 | |
| 	f3_local12:registerAnimationState( "default", {
 | |
| 		topAnchor = true,
 | |
| 		leftAnchor = true,
 | |
| 		bottomAnchor = true,
 | |
| 		rightAnchor = true,
 | |
| 		top = 0,
 | |
| 		left = 0,
 | |
| 		bottom = 0,
 | |
| 		right = 0,
 | |
| 		alpha = 0
 | |
| 	} )
 | |
| 	f3_local12:animateToState( "default", 0 )
 | |
| 	f3_local12:registerAnimationState( "active", {
 | |
| 		alpha = 1
 | |
| 	} )
 | |
| 	local f3_local13 = LUI.UIImage.new()
 | |
| 	f3_local13.id = "predatorMissileWhiteImageId"
 | |
| 	f3_local13:registerAnimationState( "default", {
 | |
| 		topAnchor = true,
 | |
| 		leftAnchor = true,
 | |
| 		bottomAnchor = true,
 | |
| 		rightAnchor = true,
 | |
| 		top = 0,
 | |
| 		left = 0,
 | |
| 		bottom = 0,
 | |
| 		right = 0,
 | |
| 		material = f3_local0
 | |
| 	} )
 | |
| 	f3_local13:animateToState( "default", 0 )
 | |
| 	local f3_local14 = LUI.UIImage.new()
 | |
| 	f3_local14.id = "predatorMissileStaticImageId"
 | |
| 	f3_local14:registerAnimationState( "default", {
 | |
| 		topAnchor = true,
 | |
| 		leftAnchor = true,
 | |
| 		bottomAnchor = true,
 | |
| 		rightAnchor = true,
 | |
| 		top = 0,
 | |
| 		left = 0,
 | |
| 		bottom = 0,
 | |
| 		right = 0,
 | |
| 		material = f3_local1
 | |
| 	} )
 | |
| 	f3_local14:animateToState( "default", 0 )
 | |
| 	f3_local12:addElement( f3_local13 )
 | |
| 	f3_local12:addElement( f3_local14 )
 | |
| 	self:addElement( f3_local6 )
 | |
| 	self:addElement( f3_local7 )
 | |
| 	self:addElement( f3_local8 )
 | |
| 	self:addElement( f3_local12 )
 | |
| 	return self
 | |
| end
 | |
| 
 | |
| LUI.MenuBuilder.registerType( "predatorMissileOverlayDef", predatorMissileOverlayDef )
 | |
| LockTable( _M )
 |