class StatsMenuUserData extends inkUserData
{
	var m_menuVisited : Bool;
}

class CharacterCreationStatsMenu extends BaseCharacterCreationController
{
	editable var m_attribute_01 : inkWidgetRef;
	editable var m_attribute_02 : inkWidgetRef;
	editable var m_attribute_03 : inkWidgetRef;
	editable var m_attribute_04 : inkWidgetRef;
	editable var m_attribute_05 : inkWidgetRef;
	editable var m_pointsLabel : inkWidgetRef;
	editable var m_tooltipSlot : inkWidgetRef;
	editable var m_skillPointLabel : inkTextRef;
	private editable var m_reset : inkWidgetRef;
	editable var m_nextMenuConfirmation : inkWidgetRef;
	editable var m_nextMenukConfirmationLibraryWidget : inkWidgetRef;
	editable var m_ConfirmationConfirmBtn : inkWidgetRef;
	editable var m_ConfirmationCloseBtn : inkWidgetRef;
	private editable var m_TooltipsManagerRef : inkWidgetRef;
	editable var m_previousPageBtn : inkWidgetRef;
	editable var m_navigationButtons : inkWidgetRef;
	editable var m_optionSwitchHint : inkWidgetRef;
	private var m_attributesControllers : array< weak< characterCreationStatsAttributeBtn > >;
	private var m_attributePointsAvailable : Int32;
	private var m_startingAttributePoints : Int32;
	private var m_TooltipsManager : weak< gameuiTooltipsManager >;
	private var m_toolTipOffset : inkMargin;
	private var m_animationProxy : inkAnimProxy;
	private var m_confirmAnimationProxy : inkAnimProxy;
	private var m_hoverdWidget : weak< inkWidget >;
	private var m_menuVisited : Bool;

	protected event OnSetUserData( userData : IScriptable )
	{
		var statsMenuUserData : StatsMenuUserData;
		statsMenuUserData = ( ( StatsMenuUserData )( userData ) );
		m_menuVisited = statsMenuUserData && statsMenuUserData.m_menuVisited;
	}

	protected event OnInitialize()
	{
		var attribute01Controller : characterCreationStatsAttributeBtn;
		var attribute02Controller : characterCreationStatsAttributeBtn;
		var attribute03Controller : characterCreationStatsAttributeBtn;
		var attribute04Controller : characterCreationStatsAttributeBtn;
		var attribute05Controller : characterCreationStatsAttributeBtn;
		var attributeType : gamedataStatType;
		super.OnInitialize();
		RequestCameraChange( 'Summary_Preview' );
		if( m_characterCustomizationState.IsExpansionStandalone() )
		{
			SkipStatsMenu();
		}
		attributeType = gamedataStatType.Strength;
		attribute01Controller = ( ( characterCreationStatsAttributeBtn )( inkWidgetRef.GetController( m_attribute_01 ) ) );
		attribute01Controller.SetData( attributeType, ( ( Int32 )( m_characterCustomizationState.GetAttribute( attributeType ) ) ) );
		attributeType = gamedataStatType.Intelligence;
		attribute02Controller = ( ( characterCreationStatsAttributeBtn )( inkWidgetRef.GetController( m_attribute_02 ) ) );
		attribute02Controller.SetData( attributeType, ( ( Int32 )( m_characterCustomizationState.GetAttribute( attributeType ) ) ) );
		attributeType = gamedataStatType.Reflexes;
		attribute03Controller = ( ( characterCreationStatsAttributeBtn )( inkWidgetRef.GetController( m_attribute_03 ) ) );
		attribute03Controller.SetData( attributeType, ( ( Int32 )( m_characterCustomizationState.GetAttribute( attributeType ) ) ) );
		attributeType = gamedataStatType.TechnicalAbility;
		attribute04Controller = ( ( characterCreationStatsAttributeBtn )( inkWidgetRef.GetController( m_attribute_04 ) ) );
		attribute04Controller.SetData( attributeType, ( ( Int32 )( m_characterCustomizationState.GetAttribute( attributeType ) ) ) );
		attributeType = gamedataStatType.Cool;
		attribute05Controller = ( ( characterCreationStatsAttributeBtn )( inkWidgetRef.GetController( m_attribute_05 ) ) );
		attribute05Controller.SetData( attributeType, ( ( Int32 )( m_characterCustomizationState.GetAttribute( attributeType ) ) ) );
		m_attributesControllers.Clear();
		m_attributesControllers.PushBack( attribute01Controller );
		m_attributesControllers.PushBack( attribute02Controller );
		m_attributesControllers.PushBack( attribute03Controller );
		m_attributesControllers.PushBack( attribute04Controller );
		m_attributesControllers.PushBack( attribute05Controller );
		inkWidgetRef.RegisterToCallback( m_attribute_01, 'OnValueIncremented', this, 'OnValueIncremented' );
		inkWidgetRef.RegisterToCallback( m_attribute_01, 'OnValueDecremented', this, 'OnValueDecremented' );
		inkWidgetRef.RegisterToCallback( m_attribute_02, 'OnValueIncremented', this, 'OnValueIncremented' );
		inkWidgetRef.RegisterToCallback( m_attribute_02, 'OnValueDecremented', this, 'OnValueDecremented' );
		inkWidgetRef.RegisterToCallback( m_attribute_03, 'OnValueIncremented', this, 'OnValueIncremented' );
		inkWidgetRef.RegisterToCallback( m_attribute_03, 'OnValueDecremented', this, 'OnValueDecremented' );
		inkWidgetRef.RegisterToCallback( m_attribute_04, 'OnValueIncremented', this, 'OnValueIncremented' );
		inkWidgetRef.RegisterToCallback( m_attribute_04, 'OnValueDecremented', this, 'OnValueDecremented' );
		inkWidgetRef.RegisterToCallback( m_attribute_05, 'OnValueIncremented', this, 'OnValueIncremented' );
		inkWidgetRef.RegisterToCallback( m_attribute_05, 'OnValueDecremented', this, 'OnValueDecremented' );
		inkWidgetRef.RegisterToCallback( m_attribute_01, 'OnBtnHoverOver', this, 'OnBtnHoverOver' );
		inkWidgetRef.RegisterToCallback( m_attribute_02, 'OnBtnHoverOver', this, 'OnBtnHoverOver' );
		inkWidgetRef.RegisterToCallback( m_attribute_03, 'OnBtnHoverOver', this, 'OnBtnHoverOver' );
		inkWidgetRef.RegisterToCallback( m_attribute_04, 'OnBtnHoverOver', this, 'OnBtnHoverOver' );
		inkWidgetRef.RegisterToCallback( m_attribute_05, 'OnBtnHoverOver', this, 'OnBtnHoverOver' );
		inkWidgetRef.RegisterToCallback( m_attribute_01, 'OnBtnHoverOut', this, 'OnBtnHoverOut' );
		inkWidgetRef.RegisterToCallback( m_attribute_02, 'OnBtnHoverOut', this, 'OnBtnHoverOut' );
		inkWidgetRef.RegisterToCallback( m_attribute_03, 'OnBtnHoverOut', this, 'OnBtnHoverOut' );
		inkWidgetRef.RegisterToCallback( m_attribute_04, 'OnBtnHoverOut', this, 'OnBtnHoverOut' );
		inkWidgetRef.RegisterToCallback( m_attribute_05, 'OnBtnHoverOut', this, 'OnBtnHoverOut' );
		RegisterToGlobalInputCallback( 'OnPostOnRelease', this, 'OnShortcutPress' );
		RegisterToCallback( 'OnEnter', this, 'OnHoverOverWidget' );
		RegisterToCallback( 'OnLeave', this, 'OnHoverOutWidget' );
		inkWidgetRef.RegisterToCallback( m_previousPageBtn, 'OnRelease', this, 'OnPreviousButton' );
		inkWidgetRef.RegisterToCallback( m_ConfirmationConfirmBtn, 'OnRelease', this, 'OnConfirmationConfirm' );
		inkWidgetRef.RegisterToCallback( m_ConfirmationCloseBtn, 'OnRelease', this, 'OnConfirmationClose' );
		RefreshControllers();
		PrepareTooltips();
		SetDefaultTooltip();
		m_toolTipOffset.left = 60.0;
		m_toolTipOffset.top = 5.0;
		m_attributePointsAvailable = ( ( Int32 )( m_characterCustomizationState.GetAttributePointsAvailable() ) );
		inkTextRef.SetText( m_skillPointLabel, ( ( String )( m_attributePointsAvailable ) ) );
		RefreshPointsLabel();
		ManageAllButtonsVisibility();
		GetTelemetrySystem().LogInitialChoiceSetStatege( telemetryInitalChoiceStage.Attributes );
		inkWidgetRef.SetVisible( m_optionSwitchHint, false );
		OnIntro();
	}

	protected event OnUninitialize()
	{
		super.OnUninitialize();
		UnregisterFromGlobalInputCallback( 'OnPostOnRelease', this, 'OnShortcutPress' );
		UnregisterFromCallback( 'OnHoverOver', this, 'OnHoverOverWidget' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_01, 'OnValueIncremented', this, 'OnValueIncremented' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_01, 'OnValueDecremented', this, 'OnValueDecremented' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_02, 'OnValueIncremented', this, 'OnValueIncremented' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_02, 'OnValueDecremented', this, 'OnValueDecremented' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_03, 'OnValueIncremented', this, 'OnValueIncremented' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_03, 'OnValueDecremented', this, 'OnValueDecremented' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_04, 'OnValueIncremented', this, 'OnValueIncremented' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_04, 'OnValueDecremented', this, 'OnValueDecremented' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_05, 'OnValueIncremented', this, 'OnValueIncremented' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_05, 'OnValueDecremented', this, 'OnValueDecremented' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_01, 'OnBtnHoverOver', this, 'OnBtnHoverOver' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_02, 'OnBtnHoverOver', this, 'OnBtnHoverOver' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_03, 'OnBtnHoverOver', this, 'OnBtnHoverOver' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_04, 'OnBtnHoverOver', this, 'OnBtnHoverOver' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_05, 'OnBtnHoverOver', this, 'OnBtnHoverOver' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_01, 'OnBtnHoverOut', this, 'OnBtnHoverOut' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_02, 'OnBtnHoverOut', this, 'OnBtnHoverOut' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_03, 'OnBtnHoverOut', this, 'OnBtnHoverOut' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_04, 'OnBtnHoverOut', this, 'OnBtnHoverOut' );
		inkWidgetRef.UnregisterFromCallback( m_attribute_05, 'OnBtnHoverOut', this, 'OnBtnHoverOut' );
		inkWidgetRef.UnregisterFromCallback( m_previousPageBtn, 'OnRelease', this, 'OnPreviousButton' );
		inkWidgetRef.UnregisterFromCallback( m_ConfirmationConfirmBtn, 'OnRelease', this, 'OnConfirmationConfirm' );
		inkWidgetRef.UnregisterFromCallback( m_ConfirmationCloseBtn, 'OnRelease', this, 'OnConfirmationClose' );
	}

	public function RefreshControllers()
	{
		var i : Int32;
		for( i = 0; i < m_attributesControllers.Size(); i += 1 )
		{
			m_attributesControllers[ i ].Refresh();
		}
	}

	public function RandomizeAttributes()
	{
		var i : Int32;
		var tempAttributesBtn : weak< characterCreationStatsAttributeBtn >;
		ResetAllBtnBackToBaseline();
		for( i = 0; i < m_startingAttributePoints; i += 1 )
		{
			tempAttributesBtn = m_attributesControllers[ RandRange( 0, m_attributesControllers.Size() ) ];
			tempAttributesBtn.data.value += 1;
			tempAttributesBtn.Refresh();
		}
	}

	private function ResetAllBtnBackToBaseline()
	{
		var i : Int32;
		for( i = 0; i < m_attributesControllers.Size(); i += 1 )
		{
			m_attributesControllers[ i ].data.SetValue( 3 );
			m_attributesControllers[ i ].Refresh();
		}
		m_startingAttributePoints = 7;
		m_attributePointsAvailable = m_startingAttributePoints;
		inkTextRef.SetText( m_skillPointLabel, ( ( String )( m_attributePointsAvailable ) ) );
		RefreshPointsLabel();
		ManageAllButtonsVisibility();
	}

	private function SaveChanges()
	{
		var i : Int32;
		m_characterCustomizationState.SetAttributePointsAvailable( ( ( Uint32 )( m_attributePointsAvailable ) ) );
		for( i = 0; i < m_attributesControllers.Size(); i += 1 )
		{
			m_characterCustomizationState.SetAttribute( m_attributesControllers[ i ].data.attribute, ( ( Uint32 )( m_attributesControllers[ i ].data.value ) ) );
		}
	}

	public function DisableInputBelowConfirmationPopup( disabled : Bool )
	{
		var i : Int32;
		var puppetPreviewGameController : weak< inkCharacterCreationPuppetPreviewGameController >;
		for( i = 0; i < m_attributesControllers.Size(); i += 1 )
		{
			m_attributesControllers[ i ].SetInputDisabled( disabled );
		}
		puppetPreviewGameController = GetCharacterCustomizationSystem().GetPuppetPreviewGameController();
		if( puppetPreviewGameController )
		{
			puppetPreviewGameController.SetInputDisabled( disabled );
		}
	}

	public function ShowConfirmation()
	{
		PlaySound( 'MapPin', 'OnDelete' );
		inkWidgetRef.SetVisible( m_nextMenuConfirmation, true );
		inkWidgetRef.SetVisible( m_navigationButtons, false );
		m_animationProxy = inkWidgetRef.GetController( m_nextMenukConfirmationLibraryWidget ).PlayLibraryAnimation( 'confirmation_intro' );
		m_confirmAnimationProxy = inkWidgetRef.GetController( m_nextMenuConfirmation ).PlayLibraryAnimation( 'confirmation_popup_btns' );
		DisableInputBelowConfirmationPopup( true );
	}

	public function HideConfirmation()
	{
		inkWidgetRef.SetVisible( m_nextMenuConfirmation, false );
		inkWidgetRef.SetVisible( m_navigationButtons, true );
		DisableInputBelowConfirmationPopup( false );
	}

	protected event OnButtonRelease( evt : inkPointerEvent )
	{
		if( !( evt.IsHandled() ) )
		{
			if( evt.IsAction( 'back' ) && !( inkWidgetRef.IsVisible( m_nextMenuConfirmation ) ) )
			{
				PlaySound( 'Button', 'OnPress' );
				evt.Handle();
				PriorMenu();
			}
			else if( evt.IsAction( 'back' ) && inkWidgetRef.IsVisible( m_nextMenuConfirmation ) )
			{
				PlaySound( 'Button', 'OnPress' );
				HideConfirmation();
			}
			else if( ( evt.IsAction( 'one_click_confirm' ) && !( inkWidgetRef.IsVisible( m_nextMenuConfirmation ) ) ) && ( StringToInt( inkTextRef.GetText( m_skillPointLabel ) ) > 0 ) )
			{
				PlaySound( 'Button', 'OnPress' );
				ShowConfirmation();
			}
			else if( ( evt.IsAction( 'one_click_confirm' ) && !( inkWidgetRef.IsVisible( m_nextMenuConfirmation ) ) ) && ( StringToInt( inkTextRef.GetText( m_skillPointLabel ) ) == 0 ) )
			{
				PlaySound( 'Button', 'OnPress' );
				evt.Handle();
				NextMenu();
			}
			else if( evt.IsAction( 'system_notification_confirm' ) && inkWidgetRef.IsVisible( m_nextMenuConfirmation ) )
			{
				PlaySound( 'Button', 'OnPress' );
				evt.Handle();
				DisableInputBelowConfirmationPopup( false );
				NextMenu();
			}
			else
			{
				return false;
			}
			evt.Handle();
		}
	}

	protected override function PriorMenu()
	{
		SaveChanges();
		super.PriorMenu();
	}

	protected override function NextMenu()
	{
		SaveChanges();
		OnOutro();
	}

	private function SkipStatsMenu()
	{
		if( m_menuVisited )
		{
			super.PriorMenu();
		}
		else
		{
			NextMenu();
		}
	}

	protected event OnConfirmationClose( e : inkPointerEvent )
	{
		if( e.IsAction( 'click' ) )
		{
			HideConfirmation();
			PlaySound( 'Button', 'OnPress' );
		}
	}

	protected event OnConfirmationConfirm( e : inkPointerEvent )
	{
		if( e.IsAction( 'click' ) )
		{
			DisableInputBelowConfirmationPopup( false );
			NextMenu();
			PlaySound( 'Button', 'OnPress' );
		}
	}

	protected event OnPreviousButton( e : inkPointerEvent )
	{
		if( e.IsAction( 'click' ) )
		{
			this.PriorMenu();
			PlaySound( 'Button', 'OnPress' );
		}
	}

	protected event OnRelease( e : inkPointerEvent )
	{
		var target : weak< inkWidget >;
		target = e.GetTarget();
		if( e.IsAction( 'click' ) )
		{
			PlaySound( 'Button', 'OnPress' );
			if( target == inkWidgetRef.Get( m_reset ) )
			{
				ResetAllBtnBackToBaseline();
			}
			if( ( target == inkWidgetRef.Get( m_nextPageHitArea ) ) && ( StringToInt( inkTextRef.GetText( m_skillPointLabel ) ) == 0 ) )
			{
				NextMenu();
			}
			else if( ( target == inkWidgetRef.Get( m_nextPageHitArea ) ) && ( StringToInt( inkTextRef.GetText( m_skillPointLabel ) ) > 0 ) )
			{
				ShowConfirmation();
			}
		}
	}

	protected event OnValueIncremented( e : weak< inkWidget > )
	{
		Add( e );
	}

	protected event OnValueDecremented( e : weak< inkWidget > )
	{
		Subtract( e );
	}

	protected event OnShortcutPress( e : inkPointerEvent )
	{
		if( m_hoverdWidget )
		{
			if( e.IsAction( 'option_switch_prev' ) )
			{
				PlaySound( 'Button', 'OnPress' );
				Subtract( m_hoverdWidget );
			}
			else if( e.IsAction( 'option_switch_next' ) )
			{
				PlaySound( 'Button', 'OnPress' );
				Add( m_hoverdWidget );
			}
		}
	}

	private function Add( targetWidget : weak< inkWidget > )
	{
		var tempController : weak< characterCreationStatsAttributeBtn >;
		tempController = ( ( characterCreationStatsAttributeBtn )( targetWidget.GetController() ) );
		if( CanBeIncremented( tempController.data.value ) )
		{
			tempController.data.SetValue( tempController.data.value + 1 );
			tempController.Refresh();
			m_attributePointsAvailable -= 1;
			inkTextRef.SetText( m_skillPointLabel, ( ( String )( m_attributePointsAvailable ) ) );
			RefreshPointsLabel();
			GetTelemetrySystem().LogInitialChoiceAttributeChanged( tempController.data.attribute );
			ManageAllButtonsVisibility();
			SetUpTooltipData( tempController );
			PlaySound( 'Button', 'OnPress' );
		}
	}

	private function Subtract( targetWidget : weak< inkWidget > )
	{
		var tempController : weak< characterCreationStatsAttributeBtn >;
		tempController = ( ( characterCreationStatsAttributeBtn )( targetWidget.GetController() ) );
		if( CanBeDecremented( tempController.data.value ) )
		{
			tempController.data.SetValue( tempController.data.value - 1 );
			tempController.Refresh();
			m_attributePointsAvailable += 1;
			inkTextRef.SetText( m_skillPointLabel, ( ( String )( m_attributePointsAvailable ) ) );
			RefreshPointsLabel();
			GetTelemetrySystem().LogInitialChoiceAttributeChanged( tempController.data.attribute );
			ManageAllButtonsVisibility();
			SetUpTooltipData( tempController );
			PlaySound( 'Button', 'OnPress' );
		}
	}

	protected event OnHoverOverWidget( e : inkPointerEvent )
	{
		var tempController : weak< characterCreationStatsAttributeBtn >;
		tempController = ( ( characterCreationStatsAttributeBtn )( e.GetTarget().GetController() ) );
		if( tempController )
		{
			m_hoverdWidget = e.GetTarget();
			inkWidgetRef.SetVisible( m_optionSwitchHint, true );
		}
	}

	protected event OnHoverOutWidget( e : inkPointerEvent )
	{
		m_hoverdWidget = NULL;
		inkWidgetRef.SetVisible( m_optionSwitchHint, false );
	}

	private function ManageAllButtonsVisibility()
	{
		var i : Int32;
		var canBeDecremented : Bool;
		var canBeIncremented : Bool;
		var hasReachedTheLimit : Bool;
		for( i = 0; i < m_attributesControllers.Size(); i += 1 )
		{
			canBeDecremented = CanBeDecremented( m_attributesControllers[ i ].data.value );
			canBeIncremented = CanBeIncremented( m_attributesControllers[ i ].data.value );
			hasReachedTheLimit = ReachedLimit( m_attributesControllers[ i ].data.value );
			m_attributesControllers[ i ].ManageBtnVisibility( canBeIncremented, canBeDecremented );
			m_attributesControllers[ i ].data.SetMaxed( !( hasReachedTheLimit ) );
			m_attributesControllers[ i ].data.SetAtMinimum( !( canBeDecremented ) );
			m_attributesControllers[ i ].ManageLabel( !( canBeDecremented ), !( hasReachedTheLimit ) );
		}
	}

	private function CanBeIncremented( currValue : Int32 ) : Bool
	{
		var maxLimit : Int32;
		maxLimit = TweakDBInterface.GetInt( T"UICharacterCreationGeneral.BaseValues.maxAttributeValue", 0 );
		return ( currValue < maxLimit ) && ( m_attributePointsAvailable > 0 );
	}

	private function ReachedLimit( currValue : Int32 ) : Bool
	{
		var maxLimit : Int32;
		maxLimit = TweakDBInterface.GetInt( T"UICharacterCreationGeneral.BaseValues.maxAttributeValue", 0 );
		return currValue < maxLimit;
	}

	private function CanBeDecremented( currValue : Int32 ) : Bool
	{
		var minLimit : Int32;
		minLimit = TweakDBInterface.GetInt( T"UICharacterCreationGeneral.BaseValues.minAttributeValue", 0 );
		return currValue > minLimit;
	}

	private function FillAttributeData( const label : ref< String >, value : Int32, const desc : ref< String > ) : CharacterCreationAttributeData
	{
		var newItem : CharacterCreationAttributeData;
		newItem = new CharacterCreationAttributeData;
		newItem.label = label;
		newItem.value = value;
		newItem.desc = desc;
		return newItem;
	}

	private function PrepareTooltips()
	{
		m_TooltipsManager = ( ( gameuiTooltipsManager )( inkWidgetRef.GetControllerByType( m_TooltipsManagerRef, 'gameuiTooltipsManager' ) ) );
		m_TooltipsManager.Setup( ETooltipsStyle.Menus );
	}

	protected event OnBtnHoverOver( e : weak< inkWidget > )
	{
		SetUpTooltipData( ( ( characterCreationStatsAttributeBtn )( e.GetController() ) ) );
	}

	protected event OnBtnHoverOut( e : weak< inkWidget > )
	{
		SetDefaultTooltip();
	}

	public function SetDefaultTooltip()
	{
		var toolTipData : CharacterCreationTooltipData;
		toolTipData = new CharacterCreationTooltipData;
		toolTipData.Title = "LocKey#19686";
		toolTipData.Description = "LocKey#19687";
		toolTipData.attribiuteLevel = "";
		m_TooltipsManager.ShowTooltipInSlot( 0, toolTipData, GetRootWidget() );
	}

	public function SetUpTooltipData( attribiuteController : weak< characterCreationStatsAttributeBtn > )
	{
		var toolTipData : CharacterCreationTooltipData;
		toolTipData = new CharacterCreationTooltipData;
		toolTipData.Title = attribiuteController.data.label;
		toolTipData.Description = attribiuteController.data.desc;
		toolTipData.attribiuteLevel = ( ( String )( attribiuteController.data.value ) );
		if( attribiuteController.data.maxed )
		{
			toolTipData.maxedOrMinimumLabelText = "LocKey#42807";
		}
		else if( attribiuteController.data.atMinimum )
		{
			toolTipData.maxedOrMinimumLabelText = "LocKey#42808";
		}
		else
		{
			toolTipData.maxedOrMinimumLabelText = "";
		}
		m_TooltipsManager.ShowTooltipInSlot( 0, toolTipData, GetRootWidget() );
	}

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

	public function RefreshPointsLabel()
	{
		if( StringToInt( inkTextRef.GetText( m_skillPointLabel ) ) > 0 )
		{
			inkWidgetRef.SetState( m_pointsLabel, 'PointsAvailable' );
		}
		else
		{
			inkWidgetRef.SetState( m_pointsLabel, 'ZeroPoints' );
		}
	}

	private function OnIntro()
	{
		PlayAnim( 'intro' );
	}

	private function OnOutro()
	{
		PlayAnim( 'outro', 'OnOutroComplete' );
	}

	protected event OnOutroComplete( anim : inkAnimProxy )
	{
		super.NextMenu();
	}

}

class CharacterCreationTooltip extends MessageTooltip
{
	protected editable var m_attribiuteLevel : inkTextRef;
	protected editable var m_maxedOrMinimumLabelText : inkTextRef;
	protected editable var m_maxedOrMinimumLabel : inkWidgetRef;
	protected editable var m_attribiuteLevelLabel : inkWidgetRef;

	public override function SetData( tooltipData : ATooltipData )
	{
		var messageData : CharacterCreationTooltipData;
		super.SetData( tooltipData );
		messageData = ( ( CharacterCreationTooltipData )( tooltipData ) );
		if( messageData )
		{
			inkTextRef.SetText( m_maxedOrMinimumLabelText, messageData.maxedOrMinimumLabelText );
			inkWidgetRef.SetVisible( m_maxedOrMinimumLabel, messageData.maxedOrMinimumLabelText != "" );
			inkTextRef.SetText( m_attribiuteLevel, messageData.attribiuteLevel );
			inkWidgetRef.SetVisible( m_attribiuteLevelLabel, messageData.attribiuteLevel != "" );
		}
	}

}

class CharacterCreationTooltipData extends MessageTooltipData
{
	var attribiuteLevel : String;
	var maxedOrMinimumLabelText : String;
}

