Exemple #1
0
        // Returns the text of a speech text key in list format
        public static List<String> getTextArray(SpeechTextState key, int lineLimit)
        {
            List<String> textList = new List<String>();
            int counter = 0;

            if (gameText.ContainsKey(key))
            {
                String text = gameText[key];
                while(counter < text.Length){
                    int length = lineLimit;

                    // Checks if the text is near the end
                    if (counter + lineLimit > text.Length)
                    {
                        length = text.Length - counter;
                    }
                    else{
                        // Adds the text up to the last space accrding to the limit of the text per line
                        int lastSpaceIndex = text.LastIndexOf(" ", counter + length, length);
                        length = lastSpaceIndex - counter;
                    }
                    textList.Add(text.Substring(counter, length));

                    counter += length;
                }
                return textList;
            }
            return null;
        }
Exemple #2
0
 // Returns the text of a speech text key
 public static String getText(SpeechTextState key)
 {
     if(gameText.ContainsKey(key)){
         return gameText[key];
     }
     return "";
 }