//The function is given new messages from the Game1 class as a new event is raised
        //It also reactivates the chatbox
        //This is the event's text that was requested; no other events are brought in
        public static void SetNewInfo(List<String> myList)
        {
            uninterpretedMessages = myList;

            actorArray = new Actor[4];
            speakerName = "";
            messageLines = new string[maxLines];

            chatboxes = new List<ChatBox>();

            for (int line = 0; line < uninterpretedMessages.Count; line++)
            {
                //We found a new chatbox
                if (uninterpretedMessages[line].Contains(" ; "))
                {
                    string[] chatboxParameters = uninterpretedMessages[line].Split(new string[] { " ; " }, StringSplitOptions.None);

                    Actor[] tempActorArray = new Actor[4];

                    string tempSpeakerName = "";

                    //Creating the actors array and the speaker for the chatbox
                    for (int p = 0; p < 4; p++)
                    {
                        string[] characterInfo = chatboxParameters[p].Split(new string[] { " , " }, StringSplitOptions.None);
                        if (characterInfo[0] != "None")
                        {
                            if (ConvertDirectionToNumber(chatboxParameters[4]) == p)
                            {
                                tempActorArray[p] = new Actor(portraitDictionary[characterInfo[0]],
                                    (Emotion)Enum.Parse(typeof(Emotion), characterInfo[1]), p, actorPositions, true);

                                tempSpeakerName = characterInfo[0];
                            }
                            else
                            {
                                tempActorArray[p] = new Actor(portraitDictionary[characterInfo[0]],
                                    (Emotion)Enum.Parse(typeof(Emotion), characterInfo[1]), p, actorPositions, false);
                            }
                        }
                    }

                    string tempMessage = "";

                    //We are fetching the message of the chatbox here
                    for (int messageIndex = line + 1; messageIndex < uninterpretedMessages.Count; messageIndex++)
                    {
                        if (messageIndex < uninterpretedMessages.Count)
                        {
                            if (uninterpretedMessages[messageIndex].Contains(" ; "))
                            {
                                //If we reach the next chatbox we stop what we are doing
                                break;
                            }
                            //TODO: FIX THE ERROR
                            tempMessage += uninterpretedMessages[messageIndex] + " ";
                        }
                    }

                    int charactersUsedOnCurrentLine = 0;
                    string[] tempMessageWords = tempMessage.Split(' ');

                    string[] chatboxSpecificMessageLines = new string[maxLines];
                    int currentLine = 0;

                    //Go through everyword and put it on a line
                    for (int w = 0; w < tempMessageWords.Length; w++)
                    {
                        //OK we have to add a space at the end of every word, make dealings
                        if (charactersUsedOnCurrentLine + tempMessageWords[w].ToCharArray().Length + 1 <= maxCharactersPerLine)
                        {
                            //If we can fit the word on the line put it in
                            chatboxSpecificMessageLines[currentLine] += tempMessageWords[w] + " ";

                            charactersUsedOnCurrentLine += tempMessageWords[w].ToCharArray().Length;
                            charactersUsedOnCurrentLine++;//The space
                        }
                        else//What happens when the word we are adding puts us over the line limit
                        {
                            currentLine++;//Go to the next line and clear the numuber of chars used
                            charactersUsedOnCurrentLine = 0;

                            if (currentLine < maxLines)
                            {
                                //The word is placed on the next lien
                                chatboxSpecificMessageLines[currentLine] += tempMessageWords[w] + " ";

                                charactersUsedOnCurrentLine += tempMessageWords[w].ToCharArray().Length;
                                charactersUsedOnCurrentLine++;
                            }
                            else//We would normally go to the next line, but low and behold, we are out of lines!
                            {
                                currentLine = 0;
                                //Create a new chatbox, we're at the extent of this one
                                ChatBox box = new ChatBox(tempSpeakerName, tempActorArray, chatboxSpecificMessageLines);
                                chatboxes.Add(box);
                                chatboxSpecificMessageLines = new string[maxLines];

                                chatboxSpecificMessageLines[currentLine] += tempMessageWords[w] + " ";

                                charactersUsedOnCurrentLine += tempMessageWords[w].ToCharArray().Length;
                                charactersUsedOnCurrentLine++;

                            }
                        }
                    }
                    if (charactersUsedOnCurrentLine != 0)
                    {
                        ChatBox box = new ChatBox(tempSpeakerName, tempActorArray, chatboxSpecificMessageLines);
                        chatboxes.Add(box);
                    }
                }
            }
            currentWritten = new string[maxLines];
            active = true;
            status = ChatboxStatus.Writing;
        }
        public static void Update(GameTime myTime)
        {
            if (active)
            {
                if (status == ChatboxStatus.Writing)
                {
                    currentChatbox = chatboxes[currentChatboxIndex];
                    if (currentChatbox.GetMessageLine(currentLine) != null)
                    {
                        messageCharacters = currentChatbox.GetMessageLine(currentLine).ToCharArray();

                        speakerName = currentChatbox.GetSpeaker();

                        timeSinceLastCharacter += (float)myTime.ElapsedGameTime.TotalMilliseconds;

                        if (timeSinceLastCharacter > currentTypingSpeed)
                        {
                            timeSinceLastCharacter -= currentTypingSpeed;

                            if (currentCharacterOfLine < messageCharacters.Length)
                            {
                                currentWritten[currentLine] += messageCharacters[currentCharacterOfLine];
                                currentCharacterOfLine++;
                            }
                            else
                            {
                                currentCharacterOfLine = 0;
                                currentLine++;
                                if (currentLine < maxLines)
                                {

                                    if (currentChatbox.GetMessageLine(currentLine) != null)
                                    {
                                        messageCharacters = currentChatbox.GetMessageLine(currentLine).ToCharArray();
                                    }
                                }
                                else
                                {
                                    //We have reached the end of the lines, time to click next
                                    currentLine = 0;
                                    status = ChatboxStatus.WaitingInput;
                                }
                            }
                        }
                    }
                    else//If the line is null
                    {
                        currentLine = 0;
                        status = ChatboxStatus.WaitingInput;
                    }
                }
                else if (status == ChatboxStatus.WaitingInput)
                {
                    //Wait for the input
                    //Blink cursor?
                }
            }
        }
        public static void Instawrite()
        {
            currentChatbox = chatboxes[currentChatboxIndex];
            currentWritten = new string[maxLines];

            for (int l = 0; l < maxLines; l++)
            {

                if (currentChatbox.GetMessageLine(l) != null)
                {
                    speakerName = currentChatbox.GetSpeaker();
                    currentWritten[l] = currentChatbox.GetMessageLine(l);
                }
            }

            currentLine = 0;
            status = ChatboxStatus.WaitingInput;
        }