class characterCreationGenderBackstoryBtn extends inkButtonController
{
	editable var m_selector : inkWidgetRef;
	editable var m_fluffText : inkWidgetRef;

	protected event OnInitialize()
	{
		inkWidgetRef.SetVisible( m_selector, false );
		inkWidgetRef.SetVisible( m_fluffText, true );
		RegisterToCallback( 'OnHoverOver', this, 'OnHoverOver' );
		RegisterToCallback( 'OnHoverOut', this, 'OnHoverOut' );
	}

	public function Refresh( const newName : ref< String >, gender : Bool ) {}

	protected event OnHoverOver( e : inkPointerEvent )
	{
		inkWidgetRef.SetVisible( m_selector, true );
		inkWidgetRef.SetVisible( m_fluffText, false );
	}

	protected event OnHoverOut( e : inkPointerEvent )
	{
		inkWidgetRef.SetVisible( m_fluffText, true );
	}

}

class characterCreationLifePathBtn extends inkButtonController
{
	editable var m_selector : inkWidgetRef;
	editable var m_desc : inkTextRef;
	editable var m_image : inkImageRef;
	editable var m_label : inkTextRef;
	editable var m_video : inkVideoRef;
	private var m_animationProxy : inkAnimProxy;
	private var m_root : weak< inkWidget >;
	private var translationAnimationCtrl : weak< inkTextReplaceController >;
	private var localizedText : String;

	protected event OnInitialize()
	{
		inkWidgetRef.SetVisible( m_selector, false );
		inkTextRef.SetVisible( m_desc, false );
		RegisterToCallback( 'OnHoverOver', this, 'OnHoverOver' );
		RegisterToCallback( 'OnHoverOut', this, 'OnHoverOut' );
		m_root = GetRootWidget();
		inkVideoRef.Stop( m_video );
	}

	public function SetDescription( desc : CName, imagePath : CName, videoPath : ResRef, label : CName )
	{
		localizedText = GetLocalizedText( NameToString( desc ) );
		inkImageRef.SetTexturePart( m_image, imagePath );
		inkTextRef.SetText( m_label, GetLocalizedText( NameToString( label ) ) );
		inkVideoRef.SetVideoPath( m_video, videoPath );
	}

	protected event OnHoverOver( e : inkPointerEvent )
	{
		inkWidgetRef.SetVisible( m_selector, true );
		inkTextRef.SetVisible( m_desc, true );
		PlayAnim( 'life_path_btn_highlight_intro' );
		translationAnimationCtrl.SetBaseText( "..." );
		translationAnimationCtrl = ( ( inkTextReplaceController )( inkTextRef.GetController( m_desc ) ) );
		translationAnimationCtrl.SetTargetText( localizedText );
		translationAnimationCtrl.PlaySetAnimation();
		inkVideoRef.Play( m_video );
	}

	protected event OnHoverOut( e : inkPointerEvent )
	{
		inkTextRef.SetVisible( m_desc, false );
		PlayAnim( 'life_path_btn_highlight_outro' );
		inkVideoRef.Stop( m_video );
	}

	public function PlayAnim( animName : CName, optional callBack : CName )
	{
		if( m_animationProxy.IsPlaying() )
		{
			m_animationProxy.Stop();
		}
		m_animationProxy = PlayLibraryAnimation( animName );
		if( m_animationProxy )
		{
			m_animationProxy.RegisterToCallback( inkanimEventType.OnFinish, this, callBack );
		}
	}

}

