class InventoryWeaponSlot extends InventoryEquipmentSlot
{
	protected editable var m_DamageIndicatorRef : inkWidgetRef;
	protected editable var m_DPSRef : inkWidgetRef;
	protected editable var m_DPSValueLabel : inkTextRef;
	private var m_DamageTypeIndicator : weak< DamageTypeIndicator >;
	private var m_IntroPlayed : Bool;
	default m_IntroPlayed = false;

	protected event OnInitialize()
	{
		super.OnInitialize();
		m_DamageTypeIndicator = ( ( DamageTypeIndicator )( inkWidgetRef.GetControllerByType( m_DamageIndicatorRef, 'DamageTypeIndicator' ) ) );
	}

	public override function Setup( itemData : InventoryItemData, equipmentArea : gamedataEquipmentArea, optional slotName : String, optional slotIndex : Int32, optional ownerEntity : Entity )
	{
		var stats : array< StatViewData >;
		var limit : Int32;
		super.Setup( itemData, equipmentArea, slotName, slotIndex, ownerEntity );
		stats = InventoryItemData.GetPrimaryStats( itemData );
		limit = stats.Size();
		if( limit > 0 )
		{
			inkTextRef.SetText( m_DPSValueLabel, IntToString( stats[ 0 ].value ) );
		}
		if( m_DamageTypeIndicator )
		{
			m_DamageTypeIndicator.Setup( InventoryItemData.GetDamageType( itemData ) );
		}
		if( InventoryItemData.IsEmpty( itemData ) )
		{
			inkWidgetRef.SetVisible( m_DPSRef, false );
			inkWidgetRef.SetVisible( m_DamageIndicatorRef, false );
		}
		else
		{
			inkWidgetRef.SetVisible( m_DPSRef, true );
			inkWidgetRef.SetVisible( m_DamageIndicatorRef, true );
		}
	}

	private function PlayIntroAnimation( framesDelay : Int32 )
	{
		var animaionDef : inkAnimDef;
		var scaleInterp : inkAnimScale;
		animaionDef = new inkAnimDef;
		scaleInterp = new inkAnimScale;
		scaleInterp.SetStartScale( Vector2( 0.0, 0.0 ) );
		scaleInterp.SetEndScale( Vector2( 1.0, 1.0 ) );
		scaleInterp.SetMode( inkanimInterpolationMode.EasyInOut );
		scaleInterp.SetType( inkanimInterpolationType.Sinusoidal );
		scaleInterp.SetDirection( inkanimInterpolationDirection.FromTo );
		scaleInterp.SetDuration( 0.25 );
		scaleInterp.SetStartDelay( 0.03 * ( ( Float )( framesDelay ) ) );
		animaionDef.AddInterpolator( scaleInterp );
		GetRootWidget().PlayAnimation( animaionDef );
	}

	private override function RefreshUI()
	{
		super.RefreshUI();
	}

}

