public static ChoiceOption LoadFromJSON(string json)
        {
            ChoiceOption co = new ChoiceOption(IO.JsonLoader.LoadObject(json));

            co.LogIssues(json);
            return(co);
        }
Example #2
0
        public Text(Dictionary <string, string> tmp)
        {
            if (tmp.ContainsKey("lines"))
            {
                lines  = tmp["lines"];
                _lines = TextLine.LoadManyFromJSON(lines);
            }
            else
            {
                lines  = "";
                _lines = new TextLine[0];
            }
            if (tmp.ContainsKey("choices"))
            {
                _choices = ChoiceOption.LoadManyFromJSON(tmp["choices"]);
            }
            else
            {
                _choices = new ChoiceOption[0];
            }

            if (tmp.ContainsKey("actor"))
            {
                actor = tmp["actor"];
            }
            if (tmp.ContainsKey("delay"))
            {
                try
                {
                    delay = float.Parse(tmp["delay"]);
                }
                catch (System.FormatException)
                {
                    delay = -1;
                }
            }
            else
            {
                delay = 0f;
            }
        }
 public static ChoiceOption[] LoadManyFromJSON(string json)
 {
     return(IO.JsonLoader.LoadArr(json).Select(e => ChoiceOption.LoadFromJSON(e)).ToArray());
 }