315 lines
		
	
	
		
			7.9 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
			
		
		
	
	
			315 lines
		
	
	
		
			7.9 KiB
		
	
	
	
		
			Lua
		
	
	
	
	
	
local f0_local0 = module
 | 
						|
local f0_local1, f0_local2 = ...
 | 
						|
f0_local0( f0_local1, package.seeall )
 | 
						|
CoD.PrintModuleLoad( _NAME )
 | 
						|
f0_local0 = {
 | 
						|
	"icon_perks_ready_up",
 | 
						|
	"icon_perks_sleight_of_hand",
 | 
						|
	"icon_perks_agility",
 | 
						|
	"icon_perks_marathon",
 | 
						|
	"icon_perks_stalker",
 | 
						|
	"icon_perks_strong_arm",
 | 
						|
	"icon_perks_on_the_go",
 | 
						|
	"icon_perks_reflex",
 | 
						|
	"icon_perks_steady_aim",
 | 
						|
	"icon_perks_quickdraw",
 | 
						|
	"icon_perks_takedown",
 | 
						|
	"icon_perks_blind_eye",
 | 
						|
	"icon_perks_dead_silence",
 | 
						|
	"icon_perks_incog",
 | 
						|
	"icon_perks_assassin",
 | 
						|
	"icon_perks_recon",
 | 
						|
	"icon_perks_scavenger",
 | 
						|
	"icon_perks_sitrep",
 | 
						|
	"icon_perks_amplifier",
 | 
						|
	"icon_perks_com_link",
 | 
						|
	"icon_perks_resiliance",
 | 
						|
	"icon_perks_icu",
 | 
						|
	"icon_perks_focus",
 | 
						|
	"icon_perks_tac_resist",
 | 
						|
	"icon_perks_blast_shield",
 | 
						|
	"icon_perks_danger_close",
 | 
						|
	"icon_perks_ping",
 | 
						|
	"icon_perks_deadeye"
 | 
						|
}
 | 
						|
f0_local1 = function ( f1_arg0, f1_arg1 )
 | 
						|
	if f1_arg1.value == -1 then
 | 
						|
		f1_arg0:animateToState( "finished", 0 )
 | 
						|
	elseif f1_arg1.value == 1 then
 | 
						|
		local f1_local0 = f1_arg0:getChildById( "digHudPerkTextContainer" )
 | 
						|
		local f1_local1 = f1_arg0:getChildById( "digHudPerkRow" )
 | 
						|
		local f1_local2 = MBh.AnimateSequence( {
 | 
						|
			{
 | 
						|
				"active",
 | 
						|
				0
 | 
						|
			},
 | 
						|
			{
 | 
						|
				"active",
 | 
						|
				3500
 | 
						|
			},
 | 
						|
			{
 | 
						|
				"finished",
 | 
						|
				500
 | 
						|
			}
 | 
						|
		} )
 | 
						|
		f1_local2( f1_arg0 )
 | 
						|
		local f1_local3 = MBh.AnimateSequence( {
 | 
						|
			{
 | 
						|
				"opening",
 | 
						|
				50
 | 
						|
			},
 | 
						|
			{
 | 
						|
				"active",
 | 
						|
				100
 | 
						|
			},
 | 
						|
			{
 | 
						|
				"active",
 | 
						|
				3850
 | 
						|
			},
 | 
						|
			{
 | 
						|
				"default",
 | 
						|
				0
 | 
						|
			}
 | 
						|
		} )
 | 
						|
		f1_local3( f1_local0 )
 | 
						|
		f1_local1:processEvent( {
 | 
						|
			name = "start_scroll",
 | 
						|
			slowScrollCount = 7,
 | 
						|
			slowScrollTime = 175,
 | 
						|
			fastScrollTime = 60,
 | 
						|
			immediate = true
 | 
						|
		} )
 | 
						|
	end
 | 
						|
end
 | 
						|
 | 
						|
LUI.MenuBuilder.registerType( "digKillstreakHudDef", function ()
 | 
						|
	local f2_local0 = 64
 | 
						|
	local f2_local1 = 64
 | 
						|
	local f2_local2 = 8
 | 
						|
	local f2_local3 = f2_local1 * f2_local2
 | 
						|
	local self = LUI.UIElement.new()
 | 
						|
	self.id = "digHud"
 | 
						|
	self:registerAnimationState( "default", {
 | 
						|
		topAnchor = true,
 | 
						|
		bottomAnchor = true,
 | 
						|
		leftAnchor = true,
 | 
						|
		rightAnchor = true,
 | 
						|
		top = 0,
 | 
						|
		bottom = 0,
 | 
						|
		left = 0,
 | 
						|
		right = 0
 | 
						|
	} )
 | 
						|
	self:animateToState( "default" )
 | 
						|
	local f2_local5 = LUI.UIElement.new()
 | 
						|
	f2_local5.id = "digHudContainer"
 | 
						|
	f2_local5:registerAnimationState( "default", {
 | 
						|
		topAnchor = true,
 | 
						|
		bottomAnchor = false,
 | 
						|
		leftAnchor = false,
 | 
						|
		rightAnchor = false,
 | 
						|
		top = 40,
 | 
						|
		bottom = 80,
 | 
						|
		left = -200,
 | 
						|
		right = 200,
 | 
						|
		alpha = 0
 | 
						|
	} )
 | 
						|
	f2_local5:registerAnimationState( "active", {
 | 
						|
		alpha = 1
 | 
						|
	} )
 | 
						|
	f2_local5:registerAnimationState( "inactive", {
 | 
						|
		alpha = 0
 | 
						|
	} )
 | 
						|
	f2_local5:registerAnimationState( "finished", {
 | 
						|
		alpha = 0
 | 
						|
	} )
 | 
						|
	f2_local5:animateToState( "default" )
 | 
						|
	f2_local5:registerOmnvarHandler( "ui_dig_killstreak_show", f0_local1 )
 | 
						|
	f2_local5:registerEventHandler( "transition_complete_finished", function ( element, event )
 | 
						|
		element:dispatchEventToChildren( {
 | 
						|
			name = "request_stop_scroll"
 | 
						|
		} )
 | 
						|
	end )
 | 
						|
	local f2_local6 = LUI.UIHorizontalList.new()
 | 
						|
	f2_local6.id = "digHudPerkRow"
 | 
						|
	f2_local6:registerAnimationState( "default", {
 | 
						|
		topAnchor = true,
 | 
						|
		bottomAnchor = true,
 | 
						|
		leftAnchor = false,
 | 
						|
		rightAnchor = false,
 | 
						|
		top = 0,
 | 
						|
		bottom = 0,
 | 
						|
		left = -f2_local3 * 0.5 + f2_local1 * 0.5,
 | 
						|
		width = f2_local3,
 | 
						|
		alignment = LUI.Alignment.Left,
 | 
						|
		alpha = 1
 | 
						|
	} )
 | 
						|
	f2_local6:registerAnimationState( "scrolled", {
 | 
						|
		topAnchor = true,
 | 
						|
		bottomAnchor = true,
 | 
						|
		leftAnchor = false,
 | 
						|
		rightAnchor = false,
 | 
						|
		top = 0,
 | 
						|
		bottom = 0,
 | 
						|
		left = -f2_local3 * 0.5 - f2_local1 * 0.5,
 | 
						|
		width = f2_local3,
 | 
						|
		alpha = 1
 | 
						|
	} )
 | 
						|
	f2_local6:animateToState( "default" )
 | 
						|
	f2_local6:registerEventHandler( "start_scroll", function ( element, event )
 | 
						|
		element:animateToState( "default", 0 )
 | 
						|
		element.scrollCount = 0
 | 
						|
		element.slowScrollCount = event.slowScrollCount
 | 
						|
		element.slowScrollTime = event.slowScrollTime
 | 
						|
		element.fastScrollTime = event.fastScrollTime
 | 
						|
		element:processEvent( {
 | 
						|
			name = "next_scroll",
 | 
						|
			immediate = true
 | 
						|
		} )
 | 
						|
	end )
 | 
						|
	f2_local6:registerEventHandler( "next_scroll", function ( element, event )
 | 
						|
		local f5_local0 = element.scrollCount
 | 
						|
		local f5_local1 = element.slowScrollCount
 | 
						|
		f5_local0 = REG7 and element.slowScrollTime or element.fastScrollTime
 | 
						|
		element:animateToState( "scrolled", f5_local0 )
 | 
						|
		element:dispatchEventToChildren( {
 | 
						|
			name = "start_scroll",
 | 
						|
			scrollTime = f5_local0,
 | 
						|
			immediate = true
 | 
						|
		} )
 | 
						|
	end )
 | 
						|
	f2_local6:registerEventHandler( "transition_complete_scrolled", function ( element, event )
 | 
						|
		if element.requestStopScroll then
 | 
						|
			element.requestStopScroll = nil
 | 
						|
			element.scrollCount = nil
 | 
						|
		else
 | 
						|
			element.scrollCount = element.scrollCount + 1
 | 
						|
			element:animateToState( "default", 0 )
 | 
						|
			element:dispatchEventToChildren( {
 | 
						|
				name = "cycle_material",
 | 
						|
				immediate = true
 | 
						|
			} )
 | 
						|
			element:processEvent( {
 | 
						|
				name = "next_scroll",
 | 
						|
				immediate = true
 | 
						|
			} )
 | 
						|
		end
 | 
						|
	end )
 | 
						|
	f2_local6:registerEventHandler( "request_stop_scroll", function ( element, event )
 | 
						|
		if element.scrollCount then
 | 
						|
			element.requestStopScroll = true
 | 
						|
		end
 | 
						|
	end )
 | 
						|
	for f2_local7 = 1, f2_local2, 1 do
 | 
						|
		local f2_local10 = f2_local7
 | 
						|
		local f2_local11 = LUI.UIElement.new()
 | 
						|
		f2_local11.id = "digHudPerkIconContainer" .. f2_local10
 | 
						|
		f2_local11:registerAnimationState( "default", {
 | 
						|
			topAnchor = false,
 | 
						|
			leftAnchor = false,
 | 
						|
			bottomAnchor = false,
 | 
						|
			rightAnchor = false,
 | 
						|
			top = -f2_local0 / 2,
 | 
						|
			left = -f2_local1 / 2,
 | 
						|
			bottom = f2_local0 / 2,
 | 
						|
			right = f2_local1 / 2,
 | 
						|
			alpha = 1
 | 
						|
		} )
 | 
						|
		f2_local11:registerAnimationState( "hidden", {
 | 
						|
			alpha = 0
 | 
						|
		} )
 | 
						|
		f2_local11:animateToState( "default" )
 | 
						|
		f2_local11:registerEventHandler( "start_scroll", function ( element, event )
 | 
						|
			if f2_local10 == 1 then
 | 
						|
				element:animateToState( "default", 0 )
 | 
						|
				element:animateToState( "hidden", event.scrollTime )
 | 
						|
			elseif f2_local10 == f2_local2 then
 | 
						|
				element:animateToState( "hidden", 0 )
 | 
						|
				element:animateToState( "default", event.scrollTime )
 | 
						|
			end
 | 
						|
		end )
 | 
						|
		f2_local6:addElement( f2_local11 )
 | 
						|
		local f2_local12 = LUI.UIImage.new()
 | 
						|
		f2_local12.id = "digHudPerkIcon" .. f2_local10
 | 
						|
		f2_local12.materialID = f2_local10
 | 
						|
		f2_local12:registerAnimationState( "default", {
 | 
						|
			topAnchor = true,
 | 
						|
			leftAnchor = true,
 | 
						|
			bottomAnchor = true,
 | 
						|
			rightAnchor = true,
 | 
						|
			top = 0,
 | 
						|
			left = 0,
 | 
						|
			bottom = 0,
 | 
						|
			right = 0,
 | 
						|
			material = RegisterMaterial( f0_local0[f2_local12.materialID] )
 | 
						|
		} )
 | 
						|
		f2_local12:animateToState( "default" )
 | 
						|
		f2_local12:registerEventHandler( "cycle_material", function ( element, event )
 | 
						|
			element.materialID = element.materialID + 1
 | 
						|
			if #f0_local0 < element.materialID then
 | 
						|
				element.materialID = 1
 | 
						|
			end
 | 
						|
			element:registerAnimationState( "updatedMaterial", {
 | 
						|
				material = RegisterMaterial( f0_local0[element.materialID] )
 | 
						|
			} )
 | 
						|
			element:animateToState( "updatedMaterial", 0 )
 | 
						|
		end )
 | 
						|
		f2_local11:addElement( f2_local12 )
 | 
						|
	end
 | 
						|
	local f2_local7 = LUI.UIElement.new()
 | 
						|
	f2_local7.id = "digHudPerkTextContainer"
 | 
						|
	f2_local7:registerAnimationState( "default", {
 | 
						|
		topAnchor = true,
 | 
						|
		bottomAnchor = false,
 | 
						|
		leftAnchor = false,
 | 
						|
		rightAnchor = false,
 | 
						|
		bottom = 80,
 | 
						|
		height = 20,
 | 
						|
		width = 200,
 | 
						|
		alpha = 0
 | 
						|
	} )
 | 
						|
	f2_local7:registerAnimationState( "opening", {
 | 
						|
		topAnchor = true,
 | 
						|
		bottomAnchor = false,
 | 
						|
		leftAnchor = false,
 | 
						|
		rightAnchor = false,
 | 
						|
		bottom = 80,
 | 
						|
		height = 40,
 | 
						|
		width = 400,
 | 
						|
		alpha = 1
 | 
						|
	} )
 | 
						|
	f2_local7:registerAnimationState( "active", {
 | 
						|
		topAnchor = true,
 | 
						|
		bottomAnchor = false,
 | 
						|
		leftAnchor = false,
 | 
						|
		rightAnchor = false,
 | 
						|
		bottom = 80,
 | 
						|
		height = 20,
 | 
						|
		width = 200,
 | 
						|
		alpha = 1
 | 
						|
	} )
 | 
						|
	f2_local7:animateToState( "default" )
 | 
						|
	local f2_local8 = LUI.UIText.new()
 | 
						|
	f2_local8.id = "digHudPerkText"
 | 
						|
	f2_local8:registerAnimationState( "default", {
 | 
						|
		topAnchor = true,
 | 
						|
		bottomAnchor = true,
 | 
						|
		leftAnchor = true,
 | 
						|
		rightAnchor = true,
 | 
						|
		font = CoD.TextSettings.NormalFont.Font,
 | 
						|
		alignment = LUI.Alignment.Center,
 | 
						|
		red = Colors.white.r,
 | 
						|
		green = Colors.white.g,
 | 
						|
		blue = Colors.white.b,
 | 
						|
		alpha = 1
 | 
						|
	} )
 | 
						|
	f2_local8:animateToState( "default" )
 | 
						|
	f2_local8:setText( Engine.Localize( "@MP_DIG_LEVEL_KILLSTREAK_ACTIVATED" ) )
 | 
						|
	f2_local8:setTextStyle( CoD.TextStyle.Shadowed )
 | 
						|
	f2_local7:addElement( f2_local8 )
 | 
						|
	f2_local5:addElement( f2_local6 )
 | 
						|
	f2_local5:addElement( f2_local7 )
 | 
						|
	self:addElement( f2_local5 )
 | 
						|
	return self
 | 
						|
end )
 | 
						|
LockTable( _M )
 |