class RipperdocPerkController extends inkLogicController
{
	private editable var m_icon : inkImageRef;
	private var m_perkData : RipperdocPerkData;
	private var m_hoverEvent : RipperdocPerkHoverEvent;

	protected event OnInitialize()
	{
		inkImageRef.RegisterToCallback( m_icon, 'OnHoverOver', this, 'OnPerkHover' );
		inkImageRef.RegisterToCallback( m_icon, 'OnHoverOut', this, 'OnPerkUnhover' );
		m_hoverEvent = new RipperdocPerkHoverEvent;
	}

	protected event OnPerkHover( evt : inkPointerEvent )
	{
		m_hoverEvent.IsHover = true;
		QueueEvent( m_hoverEvent );
		inkImageRef.SetOpacity( m_icon, 1.0 );
	}

	protected event OnPerkUnhover( evt : inkPointerEvent )
	{
		m_hoverEvent.IsHover = false;
		QueueEvent( m_hoverEvent );
		inkImageRef.SetOpacity( m_icon, 0.5 );
	}

	public function Configure( data : RipperdocPerkData )
	{
		var perkRecord : NewPerk_Record;
		var iconRecord : UIIcon_Record;
		m_perkData = data;
		perkRecord = TweakDBInterface.GetNewPerkRecord( data.Perk );
		iconRecord = perkRecord.PerkIconHandle();
		inkImageRef.SetAtlasResource( m_icon, iconRecord.AtlasResourcePath() );
		inkImageRef.SetTexturePart( m_icon, iconRecord.AtlasPartName() );
		inkImageRef.SetState( m_icon, ( ( data.Level == 0 ) ? ( 'NotActive' ) : ( 'Active' ) ) );
		inkImageRef.SetOpacity( m_icon, 0.5 );
		m_hoverEvent.Area = data.Area;
		m_hoverEvent.Type = perkRecord.Type();
		m_hoverEvent.AttributeID = perkRecord.Attribute().GetID();
	}

}

class RipperdocPerkData extends IScriptable
{
	var Perk : TweakDBID;
	var Area : gamedataNewPerkSlotType;
	var Level : Int32;
}

class RipperdocPerkHoverEvent extends Event
{
	var IsHover : Bool;
	var Area : gamedataNewPerkSlotType;
	var Type : gamedataNewPerkType;
	var AttributeID : TweakDBID;
}

