Ejemplo n.º 1
0
    public void Register()
    {
        CharactersByID.Add(CharacterID, this);
        foreach (var s in SpriteList)
        {
            string parsable = s.name;
            if (s.name.Contains("."))
            {
                parsable = s.name.Split('.')[0];
            }
            s.name = parsable;
            try
            {
                MoodTypes m = (MoodTypes)System.Enum.Parse(typeof(MoodTypes), parsable);
                SpriteDictionary.Add(m, s);
            }
            catch
            {
                Debug.LogError("Failed to parse Sprite Name to MoodTypes  " + CharacterName + " " + parsable);
            }
        }
        StringBuilder sb = new StringBuilder();

        sb.Append(CharacterName + " contains these Sprites: ");
        foreach (var s in SpriteDictionary.Values)
        {
            sb.Append(s.name + ", ");
        }
        Debug.Log(sb.ToString());
    }
Ejemplo n.º 2
0
 public Sprite GetSprite(MoodTypes m)
 {
     if (SpriteDictionary.ContainsKey(m))
     {
         return(SpriteDictionary[m]);
     }
     return(null);
 }
Ejemplo n.º 3
0
        }//end of PopulateDialogLines

        /// <summary>
        /// Parses kvps from text file into kvp string,MoodTypes. Being as this method is called at the end of each chunk being built, it can be used in the future for additional/broader parsing
        /// </summary>
        /// <param name="targetMoods">list of raw strings from text files</param>
        /// <param name="buffer">buffer ref used to add parsed kvps to</param>
        static void ParseTargetIDMoodPairs(List<string> targetMoods, DialogLine buffer)
        {
            foreach (string targetMood in targetMoods)
            {
                int separatorIndex = targetMood.IndexOf('|');
                string target = targetMood.Substring(0, separatorIndex);
                MoodTypes mood = (MoodTypes)Enum.Parse(typeof(MoodTypes), targetMood.Substring(separatorIndex + 1));
                buffer.TargetMoods.Add(new KeyValuePair<string, MoodTypes>(target, mood));
            }
            //string targetID = line.Substring()
        }//end of ParseTargetIDMoodPairs