importonly struct LevelUpData
{
	import var lvl : Int32;
	import var type : gamedataProficiencyType;
	import var perkPoints : Int32;
	import var attributePoints : Int32;
	import var espionagePoints : Int32;
	import var disableAction : Bool;
}

class LevelUpGameController extends inkHUDGameController
{
	private editable var m_value : inkTextRef;
	private editable var m_proficencyLabel : inkTextRef;
	private var m_animationProxy : inkAnimProxy;
	private var m_data : LevelUpUserData;

	protected event OnInitialize()
	{
		m_data = ( ( LevelUpUserData )( GetRootWidget().GetUserData( 'LevelUpUserData' ) ) );
		Setup();
	}

	protected event OnUninitialize() {}

	private function Setup()
	{
		var levelInfo : LevelUpData;
		var proficiencyRecord : Proficiency_Record;
		var profString : String;
		levelInfo = m_data.data;
		profString = EnumValueToString( "gamedataProficiencyType", ( ( Int32 )( levelInfo.type ) ) );
		proficiencyRecord = TweakDBInterface.GetProficiencyRecord( TDBID.Create( "Proficiencies." + profString ) );
		if( levelInfo.type != gamedataProficiencyType.Level && levelInfo.type != gamedataProficiencyType.StreetCred )
		{
			inkTextRef.SetLetterCase( m_proficencyLabel, textLetterCase.UpperCase );
			inkTextRef.SetText( m_proficencyLabel, proficiencyRecord.Loc_name_key() );
			inkTextRef.SetText( m_value, IntToString( levelInfo.lvl ) );
			PlayIntroAnimation();
		}
	}

	private function PlayIntroAnimation()
	{
		m_animationProxy = PlayLibraryAnimation( 'level_up' );
		m_animationProxy.RegisterToCallback( inkanimEventType.OnFinish, this, 'OnOutroAnimFinished' );
	}

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

}

