class InventoryStatsList extends inkLogicController
{
	private var m_titleText : weak< inkText >;
	private var m_containerWidget : weak< inkCompoundWidget >;
	private var m_widgtesList : array< weak< inkWidget > >;

	protected event OnInitialize()
	{
		m_titleText = ( ( inkText )( GetWidget( 'title\text' ) ) );
		m_containerWidget = ( ( inkCompoundWidget )( GetWidget( 'container' ) ) );
		m_titleText.SetText( "UI-Cyberpunk-Inventory-PersonalStats" );
	}

	public function SetData( const data : ref< array< StatViewData > > )
	{
		var i, count : Int32;
		var currentItem : weak< inkWidget >;
		var currentController : weak< InventoryStatItem >;
		count = data.Size();
		while( m_widgtesList.Size() > count )
		{
			currentItem = m_widgtesList.PopBack();
			m_containerWidget.RemoveChild( currentItem );
		}
		while( m_widgtesList.Size() < count )
		{
			currentItem = SpawnFromLocal( m_containerWidget, 'playerStatsItem' );
			m_widgtesList.PushBack( currentItem );
		}
		for( i = 0; i < count; i += 1 )
		{
			currentItem = m_widgtesList[ i ];
			currentController = ( ( InventoryStatItem )( currentItem.GetController() ) );
			currentController.SetData( data[ i ] );
		}
	}

}

class InventoryStatItem extends inkLogicController
{
	private var m_label : weak< inkText >;
	private var m_value : weak< inkText >;

	protected event OnInitialize()
	{
		m_label = ( ( inkText )( GetWidget( 'container/label' ) ) );
		m_value = ( ( inkText )( GetWidget( 'container/value' ) ) );
	}

	public function SetData( const data : ref< StatViewData > )
	{
		m_label.SetLetterCase( textLetterCase.UpperCase );
		m_label.SetText( EnumValueToString( "gamedataStatType", ( ( Int64 )( data.type ) ) ) );
		m_value.SetText( IntToString( data.value ) );
	}

}

