class WallScreen extends TV
{
	default m_controllerTypeName = 'WallScreenController';
	private instanceeditable var m_movementPattern : SMovementPattern;
	private instanceeditable var m_factOnFullyOpened : CName;
	private var m_objectMover : ObjectMoverComponent;

	protected event OnRequestComponents( ri : EntityRequestComponentsInterface )
	{
		EntityRequestComponentsInterface.RequestComponent( ri, 'object_mover', 'ObjectMoverComponent', false );
		EntityRequestComponentsInterface.RequestComponent( ri, 'tv', 'PhysicalMeshComponent', false );
		super.OnRequestComponents( ri );
	}

	protected event OnTakeControl( ri : EntityResolveComponentsInterface )
	{
		m_objectMover = ( ( ObjectMoverComponent )( EntityResolveComponentsInterface.GetComponent( ri, 'object_mover' ) ) );
		super.OnTakeControl( ri );
		m_controller = ( ( WallScreenController )( EntityResolveComponentsInterface.GetComponent( ri, 'controller' ) ) );
	}

	private const override function GetController() : WallScreenController
	{
		return ( ( WallScreenController )( m_controller ) );
	}

	public const override function GetDevicePS() : WallScreenControllerPS
	{
		return GetController().GetPS();
	}

	protected event OnMovementFinished( movementStatus : ObjectMoverStatus )
	{
		if( movementStatus.direction == m_movementPattern.direction && IsNameValid( m_factOnFullyOpened ) )
		{
			SetFactValue( GetGame(), m_factOnFullyOpened, 1 );
		}
		GameObject.PlaySoundEvent( this, 'dev_doors_hidden_stop' );
	}

	protected event OnToggleSecureShow( evt : ToggleShow )
	{
		if( ( ( WallScreenControllerPS )( GetDevicePS() ) ).IsShown() )
		{
			Move();
		}
		else
		{
			MoveBack();
		}
	}

	private function Move()
	{
		UpdateDeviceState();
	}

	private function MoveBack()
	{
		UpdateDeviceState();
	}

}

