namespace mgaia.Utils.Text
{
    /// <summary>
    /// Interpretador padrão de texto, retorna caractere a caractere
    /// </summary>
    /// <owner>Victor</owner>
    public class NormalTextInterpreter : ITextInterpreter
    {
        private string mText;
        private int mCurrentIdx;

        public void Begin(string text)
        {
            mText = text;
            mCurrentIdx = 0;
        }

        public int GetTextSize()
        {
            return mText.Length;
        }

        public string GetNextFragmentToWrite()
        {
            if (mCurrentIdx < mText.Length)
            {
                return mText[mCurrentIdx++].ToString();
            }
            else
            {
                return null;
            }
        }
    }
}