struct FactTextStruct
{
	const editable var m_locKeyList : array< CName >;
	editable var m_description : inkTextRef;
	editable var m_factName : CName;
}

class FactTextGameController extends inkGameController
{
	private const editable var m_factTextArray : array< FactTextStruct >;

	protected event OnInitialize()
	{
		var factTextIteration : FactTextStruct;
		var locKeyNum : Int32;
		var i : Int32;
		for( i = 0; i < m_factTextArray.Size(); i += 1 )
		{
			factTextIteration = m_factTextArray[ i ];
			locKeyNum = GetFact( GetPlayerControlledObject().GetGame(), factTextIteration.m_factName );
			if( locKeyNum != -1 )
			{
				if( factTextIteration.m_locKeyList.Size() <= locKeyNum )
				{
					if( !( IsFinal() ) )
					{
						inkTextRef.SetVisible( factTextIteration.m_description, true );
						inkTextRef.SetText( factTextIteration.m_description, "ERROR: The fact's index is bigger than the array's length" );
					}
					else
					{
						inkTextRef.SetVisible( factTextIteration.m_description, false );
					}
				}
				else
				{
					inkTextRef.SetLocalizedText( factTextIteration.m_description, factTextIteration.m_locKeyList[ locKeyNum ] );
					inkTextRef.SetVisible( factTextIteration.m_description, true );
				}
			}
			else
			{
				inkTextRef.SetVisible( factTextIteration.m_description, false );
			}
		}
	}

}

