class hudButtonReminderGameController extends inkHUDGameController
{
	private editable var m_Button1 : inkCompoundRef;
	private editable var m_Button2 : inkCompoundRef;
	private editable var m_Button3 : inkCompoundRef;
	private var m_uiHudButtonHelpBB : weak< IBlackboard >;
	private var m_interactingWithDeviceBBID : CallbackHandle;
	private var m_OnRedrawText_1Callback : CallbackHandle;
	private var m_OnRedrawIcon_1Callback : CallbackHandle;
	private var m_OnRedrawText_2Callback : CallbackHandle;
	private var m_OnRedrawIcon_2Callback : CallbackHandle;
	private var m_OnRedrawText_3Callback : CallbackHandle;
	private var m_OnRedrawIcon_3Callback : CallbackHandle;

	protected event OnInitialize()
	{
		m_uiHudButtonHelpBB = GetBlackboardSystem().Get( GetAllBlackboardDefs().UI_HudButtonHelp );
		if( m_uiHudButtonHelpBB )
		{
			m_OnRedrawText_1Callback = m_uiHudButtonHelpBB.RegisterListenerString( GetAllBlackboardDefs().UI_HudButtonHelp.button1_Text, this, 'OnRedrawText_1' );
			m_OnRedrawIcon_1Callback = m_uiHudButtonHelpBB.RegisterListenerName( GetAllBlackboardDefs().UI_HudButtonHelp.button1_Icon, this, 'OnRedrawIcon_1' );
			m_OnRedrawText_2Callback = m_uiHudButtonHelpBB.RegisterListenerString( GetAllBlackboardDefs().UI_HudButtonHelp.button2_Text, this, 'OnRedrawText_2' );
			m_OnRedrawIcon_2Callback = m_uiHudButtonHelpBB.RegisterListenerName( GetAllBlackboardDefs().UI_HudButtonHelp.button2_Icon, this, 'OnRedrawIcon_2' );
			m_OnRedrawText_3Callback = m_uiHudButtonHelpBB.RegisterListenerString( GetAllBlackboardDefs().UI_HudButtonHelp.button3_Text, this, 'OnRedrawText_3' );
			m_OnRedrawIcon_3Callback = m_uiHudButtonHelpBB.RegisterListenerName( GetAllBlackboardDefs().UI_HudButtonHelp.button3_Icon, this, 'OnRedrawIcon_3' );
		}
		inkCompoundRef.SetVisible( m_Button1, false );
		inkCompoundRef.SetVisible( m_Button2, false );
		inkCompoundRef.SetVisible( m_Button3, false );
	}

	protected event OnPlayerAttach( playerGameObject : GameObject )
	{
		RegisterPSMListeners( playerGameObject );
	}

	protected event OnPlayerDetach( playerGameObject : GameObject )
	{
		UnregisterPSMListeners( playerGameObject );
	}

	protected function RegisterPSMListeners( playerPuppet : GameObject )
	{
		var playerStateMachineBB : IBlackboard;
		playerStateMachineBB = GetPSMBlackboard( playerPuppet );
		if( playerStateMachineBB )
		{
			m_interactingWithDeviceBBID = playerStateMachineBB.RegisterListenerBool( GetAllBlackboardDefs().PlayerStateMachine.IsInteractingWithDevice, this, 'OnInteractingWithDevice' );
		}
	}

	protected function UnregisterPSMListeners( playerPuppet : GameObject )
	{
		var playerStateMachineBB : IBlackboard;
		playerStateMachineBB = GetPSMBlackboard( playerPuppet );
		if( playerStateMachineBB )
		{
			playerStateMachineBB.UnregisterDelayedListener( GetAllBlackboardDefs().PlayerStateMachine.IsInteractingWithDevice, m_interactingWithDeviceBBID );
		}
	}

	private function OnRedrawText_1( const argValue : ref< String > )
	{
		( ( inkText )( inkCompoundRef.GetWidget( m_Button1, 'buttonText' ) ) ).SetText( argValue );
		inkCompoundRef.SetVisible( m_Button1, StrLen( argValue ) );
	}

	private function OnRedrawIcon_1( argValue : CName )
	{
		( ( inkImage )( inkCompoundRef.GetWidget( m_Button1, 'buttonIcon' ) ) ).SetTexturePart( argValue );
	}

	private function OnRedrawText_2( const argValue : ref< String > )
	{
		( ( inkText )( inkCompoundRef.GetWidget( m_Button2, 'buttonText' ) ) ).SetText( argValue );
		inkCompoundRef.SetVisible( m_Button2, StrLen( argValue ) );
	}

	private function OnRedrawIcon_2( argValue : CName )
	{
		( ( inkImage )( inkCompoundRef.GetWidget( m_Button2, 'buttonIcon' ) ) ).SetTexturePart( argValue );
	}

	private function OnRedrawText_3( const argValue : ref< String > )
	{
		( ( inkText )( inkCompoundRef.GetWidget( m_Button3, 'buttonText' ) ) ).SetText( argValue );
		inkCompoundRef.SetVisible( m_Button3, StrLen( argValue ) );
	}

	private function OnRedrawIcon_3( argValue : CName )
	{
		( ( inkImage )( inkCompoundRef.GetWidget( m_Button3, 'buttonIcon' ) ) ).SetTexturePart( argValue );
	}

	protected event OnInteractingWithDevice( value : Bool )
	{
		( ( inkText )( inkCompoundRef.GetWidget( m_Button1, 'buttonText' ) ) ).SetText( "UI-Cyberpunk-Interactions-Leave" );
		( ( inkImage )( inkCompoundRef.GetWidget( m_Button1, 'buttonIcon' ) ) ).SetTexturePart( 'b' );
		inkCompoundRef.SetVisible( m_Button1, value );
	}

}

