class QuestUpdateGameController extends inkHUDGameController
{
	private editable var m_header : inkTextRef;
	private editable var m_label : inkTextRef;
	private editable var m_icon : inkImageRef;
	private var m_animationProxy : inkAnimProxy;
	private var m_data : QuestUpdateUserData;
	private var m_owner : weak< GameObject >;
	private var m_journalMgr : weak< JournalManager >;

	protected event OnInitialize()
	{
		m_owner = ( ( GameObject )( GetOwnerEntity() ) );
		m_journalMgr = GameInstance.GetJournalManager( m_owner.GetGame() );
		RegisterToGlobalInputCallback( 'OnPostOnRelease', this, 'OnButtonRelease' );
		m_data = ( ( QuestUpdateUserData )( GetRootWidget().GetUserData( 'QuestUpdateUserData' ) ) );
		Setup();
	}

	protected event OnUninitialize()
	{
		UnregisterFromGlobalInputCallback( 'OnPostOnRelease', this, 'OnButtonRelease' );
	}

	private function Setup()
	{
		var questEntry : JournalQuest;
		var questEntryState : gameJournalEntryState;
		questEntry = m_data.data;
		questEntryState = m_journalMgr.GetEntryState( questEntry );
		if( questEntryState == gameJournalEntryState.Active )
		{
			inkTextRef.SetText( m_header, "UI-Cyberpunk-QUEST_ADDED" );
			inkTextRef.SetText( m_label, questEntry.GetTitle( m_journalMgr ) );
			PlayAnimation( 'quest_added' );
		}
		else if( questEntryState == gameJournalEntryState.Succeeded )
		{
			inkTextRef.SetText( m_header, "UI-Cyberpunk-QUEST_COMPLETED" );
			inkTextRef.SetText( m_label, questEntry.GetTitle( m_journalMgr ) );
			PlayAnimation( 'quest_success' );
		}
	}

	protected event OnButtonRelease( evt : inkPointerEvent )
	{
		if( evt.IsAction( 'ToggleHubMenu' ) )
		{
		}
	}

	private function OpenQuestMenu()
	{
		var menuEvent : inkMenuInstance_SpawnEvent;
		menuEvent = new inkMenuInstance_SpawnEvent;
		menuEvent.Init( 'OnSwitchToQuestLog' );
		QueueEvent( menuEvent );
	}

	private function PlayAnimation( animName : CName )
	{
		m_animationProxy = PlayLibraryAnimation( animName );
		m_animationProxy.RegisterToCallback( inkanimEventType.OnFinish, this, 'OnOutroAnimFinished' );
	}

	protected event OnOutroAnimFinished( anim : inkAnimProxy )
	{
		var fakeData : inkGameNotificationData;
		m_data.token.TriggerCallback( fakeData );
	}

}

