class EquipmentAreaCategoryCreated extends Event
{
	var categoryController : weak< InventoryItemDisplayCategoryArea >;
	var equipmentAreasControllers : array< weak< InventoryItemDisplayEquipmentArea > >;
}

class InventoryItemDisplayCategoryArea extends inkLogicController
{
	protected const editable var m_areasToHide : array< inkWidgetRef >;
	protected const editable var m_equipmentAreas : array< inkCompoundRef >;
	protected editable var m_newItemsWrapper : inkWidgetRef;
	protected editable var m_newItemsCounter : inkTextRef;
	protected var m_categoryAreas : array< weak< InventoryItemDisplayEquipmentArea > >;

	protected event OnInitialize()
	{
		var i : Int32;
		var equipmentAreaCategoryCreated : EquipmentAreaCategoryCreated;
		inkWidgetRef.SetVisible( m_newItemsWrapper, false );
		m_categoryAreas.Clear();
		for( i = 0; i < m_equipmentAreas.Size(); i += 1 )
		{
			m_categoryAreas.PushBack( ( ( InventoryItemDisplayEquipmentArea )( inkCompoundRef.GetController( m_equipmentAreas[ i ] ) ) ) );
		}
		equipmentAreaCategoryCreated = new EquipmentAreaCategoryCreated;
		equipmentAreaCategoryCreated.categoryController = this;
		equipmentAreaCategoryCreated.equipmentAreasControllers = m_categoryAreas;
		QueueEvent( equipmentAreaCategoryCreated );
	}

	public function SetNewItemsCounter( value : Int32 )
	{
		inkTextRef.SetText( m_newItemsCounter, IntToString( value ) );
		inkWidgetRef.SetVisible( m_newItemsWrapper, value > 0 );
	}

	public function GetAreasToHide() : array< inkWidgetRef >
	{
		return m_areasToHide;
	}

	public function GetCategoryAreas() : array< weak< InventoryItemDisplayEquipmentArea > >
	{
		return m_categoryAreas;
	}

}

class InventoryItemDisplayEquipmentArea extends inkLogicController
{
	protected const editable var m_equipmentAreas : array< gamedataEquipmentArea >;
	protected editable var m_numberOfSlots : Int32;

	public static function GetEquipmentAreaByName( const categoryName : ref< String > ) : gamedataEquipmentArea
	{
		switch( categoryName )
		{
			case "Head":
				return gamedataEquipmentArea.Head;
			case "Face":
				return gamedataEquipmentArea.Face;
			case "OuterChest":
				return gamedataEquipmentArea.OuterChest;
			case "InnerChest":
				return gamedataEquipmentArea.InnerChest;
			case "Legs":
				return gamedataEquipmentArea.Legs;
			case "Feet":
				return gamedataEquipmentArea.Feet;
			case "Weapon":
				return gamedataEquipmentArea.Weapon;
			case "QuickSlot":
				return gamedataEquipmentArea.QuickSlot;
			case "Consumable":
				return gamedataEquipmentArea.Consumable;
			case "Consumable":
				return gamedataEquipmentArea.Consumable;
		}
		return gamedataEquipmentArea.Invalid;
	}

	public function GetNumberOfSlots() : Int32
	{
		return m_numberOfSlots;
	}

	public function GetEquipmentAreas() : array< gamedataEquipmentArea >
	{
		return m_equipmentAreas;
	}

}

