class HoloAudioCallLogicController extends inkLogicController
{
	private editable var m_AvatarControllerRef : inkWidgetRef;
	private editable var m_Holder : inkWidgetRef;
	private var m_AvatarController : weak< HudPhoneAvatarController >;
	private var m_Owner : weak< GameObject >;

	protected event OnInitialize()
	{
		Hide();
		m_AvatarController = ( ( HudPhoneAvatarController )( inkWidgetRef.GetController( m_AvatarControllerRef ) ) );
		if( m_AvatarController )
		{
			m_AvatarController.SetHolder( m_Holder );
		}
		inkWidgetRef.RegisterToCallback( m_AvatarControllerRef, 'OnAvatarControllerHidden', this, 'OnAvatarControllerHidden' );
	}

	protected event OnUninitialize()
	{
		inkWidgetRef.UnregisterFromCallback( m_AvatarControllerRef, 'OnAvatarControllerHidden', this, 'OnAvatarControllerHidden' );
	}

	protected event OnAvatarControllerHidden( target : weak< inkWidget > )
	{
		GetRootWidget().CallCustomCallback( 'OnHoloAudioCallFinished' );
	}

	public function ShowIncomingContact( avatarID : TweakDBID, const contactName : ref< String > )
	{
		if( m_AvatarController )
		{
			m_AvatarController.ShowIncomingContact( avatarID, contactName );
		}
	}

	public function ShowEndCallContact( avatarID : TweakDBID, const contactName : ref< String > )
	{
		if( m_AvatarController )
		{
			m_AvatarController.ShowEndCallContact( avatarID, contactName );
		}
	}

	public function StartAudiocall( avatarID : TweakDBID, const contactName : ref< String >, showAvatar : Bool )
	{
		if( m_AvatarController )
		{
			m_AvatarController.StartAudiocall( avatarID, contactName, showAvatar );
		}
	}

	public function StartHolocall( avatarID : TweakDBID, const contactName : ref< String > )
	{
		if( m_AvatarController )
		{
			m_AvatarController.StartHolocall( avatarID, contactName );
		}
	}

	public function ChangeMinimized( minimized : Bool )
	{
		if( m_AvatarController )
		{
			m_AvatarController.ChangeMinimized( minimized );
		}
	}

	public function SetStatusText( const statusText : ref< String > )
	{
		if( m_AvatarController )
		{
			m_AvatarController.SetStatusText( statusText );
		}
	}

	public function Show()
	{
		GetRootWidget().SetVisible( true );
		inkWidgetRef.SetVisible( m_Holder, true );
	}

	public function Hide()
	{
		GetRootWidget().SetVisible( false );
		inkWidgetRef.SetVisible( m_Holder, false );
	}

	public function Interrupt( value : Bool )
	{
		var anim : inkAnimDef;
		var interop : inkAnimTransparency;
		anim = new inkAnimDef;
		interop = new inkAnimTransparency;
		interop.SetStartTransparency( ( ( value ) ? ( 1.0 ) : ( 0.0 ) ) );
		interop.SetEndTransparency( ( ( value ) ? ( 0.0 ) : ( 1.0 ) ) );
		interop.SetDuration( 0.2 );
		anim.AddInterpolator( interop );
		GetRootWidget().PlayAnimation( anim );
		inkWidgetRef.PlayAnimation( m_Holder, anim );
		ChangeMinimized( value );
	}

}

