class hudCorpoController extends inkHUDGameController
{
	private editable var m_ScrollText : inkTextRef;
	private editable var m_ScrollTextWidget : inkWidgetRef;
	private editable var m_root_canvas : inkWidgetRef;
	private var m_root : weak< inkCompoundWidget >;
	private var m_questsSystem : weak< QuestsSystem >;
	private var m_fact1ListenerId : Uint32;
	private var m_fact2ListenerId : Uint32;
	private var m_fact3ListenerId : Uint32;
	private var m_fact4ListenerId : Uint32;
	private var m_fact5ListenerId : Uint32;

	protected event OnInitialize()
	{
		var ownerObject : GameObject;
		ownerObject = ( ( GameObject )( GetOwnerEntity() ) );
		m_questsSystem = GameInstance.GetQuestsSystem( ownerObject.GetGame() );
		m_fact1ListenerId = m_questsSystem.RegisterListener( 'q000_corpo_scrollbar_mirror', this, 'OnQ000_corpo_scrollbar_mirror' );
		OnQ000_corpo_scrollbar_mirror( m_questsSystem.GetFact( 'q000_corpo_scrollbar_mirror' ) );
		m_fact2ListenerId = m_questsSystem.RegisterListener( 'q000_corpo_scrollbar_office', this, 'OnQ000_corpo_scrollbar_office' );
		OnQ000_corpo_scrollbar_office( m_questsSystem.GetFact( 'q000_corpo_scrollbar_office' ) );
		m_fact3ListenerId = m_questsSystem.RegisterListener( 'q000_corpo_scrollbar_after_meeting', this, 'OnQ000_corpo_scrollbar_after_meeting' );
		OnQ000_corpo_scrollbar_after_meeting( m_questsSystem.GetFact( 'q000_corpo_scrollbar_after_meeting' ) );
		m_fact4ListenerId = m_questsSystem.RegisterListener( 'q000_corpo_scrollbar_disconnect', this, 'OnQ000_corpo_scrollbar_disconnect' );
		OnQ000_corpo_scrollbar_disconnect( m_questsSystem.GetFact( 'q000_corpo_scrollbar_disconnect' ) );
		m_fact5ListenerId = m_questsSystem.RegisterListener( 'q000_var_arasaka_ui_on', this, 'OnQ000_var_arasaka_ui_on' );
		OnQ000_var_arasaka_ui_on( m_questsSystem.GetFact( 'q000_var_arasaka_ui_on' ) );
		m_root = ( ( inkCompoundWidget )( GetRootWidget() ) );
		inkWidgetRef.SetVisible( m_ScrollTextWidget, false );
	}

	protected event OnUninitialize()
	{
		m_questsSystem.UnregisterListener( 'q000_corpo_scrollbar_mirror', m_fact1ListenerId );
		m_questsSystem.UnregisterListener( 'q000_corpo_scrollbar_office', m_fact2ListenerId );
		m_questsSystem.UnregisterListener( 'q000_corpo_scrollbar_after_meeting', m_fact3ListenerId );
		m_questsSystem.UnregisterListener( 'q000_corpo_scrollbar_disconnect', m_fact4ListenerId );
		m_questsSystem.UnregisterListener( 'q000_var_arasaka_ui_on', m_fact5ListenerId );
	}

	public export function OnQ000_corpo_scrollbar_mirror( val : Int32 )
	{
		inkWidgetRef.SetVisible( m_ScrollTextWidget, false );
		if( val > 0 )
		{
			inkWidgetRef.SetVisible( m_ScrollTextWidget, true );
			inkTextRef.SetText( m_ScrollText, "LocKey#46993" );
		}
	}

	public function OnQ000_corpo_scrollbar_office( val : Int32 )
	{
		inkWidgetRef.SetVisible( m_ScrollTextWidget, false );
		if( val > 0 )
		{
			inkWidgetRef.SetVisible( m_ScrollTextWidget, true );
			inkTextRef.SetText( m_ScrollText, "LocKey#46994" );
		}
	}

	public function OnQ000_corpo_scrollbar_after_meeting( val : Int32 )
	{
		inkWidgetRef.SetVisible( m_ScrollTextWidget, false );
		if( val > 0 )
		{
			inkWidgetRef.SetVisible( m_ScrollTextWidget, true );
			inkTextRef.SetText( m_ScrollText, "LocKey#47000" );
		}
	}

	public function OnQ000_corpo_scrollbar_disconnect( val : Int32 )
	{
		inkWidgetRef.SetVisible( m_ScrollTextWidget, false );
		if( val > 0 )
		{
			inkWidgetRef.SetVisible( m_ScrollTextWidget, true );
			inkTextRef.SetText( m_ScrollText, "LocKey#47003" );
		}
	}

	public export function OnQ000_var_arasaka_ui_on( val : Int32 )
	{
		if( val > 0 )
		{
			m_root.SetVisible( true );
			inkWidgetRef.SetVisible( m_root_canvas, true );
		}
		else
		{
			if( m_root )
			{
				m_root.SetVisible( false );
			}
			inkWidgetRef.SetVisible( m_root_canvas, false );
		}
	}

}

