public Option(Parser.Item root) { name = new List <Tuple <LocalisationLink, Trigger> >(); command = new Command(); foreach (Parser.Item item in root.GetChilderen()) { switch (item.name) { case "name": if (item.IsValue()) { name.Add(new Tuple <LocalisationLink, Trigger>(LocalisationLink.FromTag(item.GetString()), null)); } else { name.Add(new Tuple <LocalisationLink, Trigger>(LocalisationLink.FromTag(item.GetString("text")), new Trigger(item.GetItem("trigger")))); } break; case "trigger": trigger = new Trigger(item); break; default: command.Add(item); break; } } }
// sound ?? public TriggeredDescription(Parser.Item root) { if (root.IsValue()) { text = LocalisationLink.FromTag(root.GetString()); } else { foreach (Parser.Item item in root.GetChilderen()) { switch (item.name) { case "trigger": trigger = new Trigger(item); break; case "text": text = LocalisationLink.FromTag(item.GetString()); break; case "picture": picture = GFX_Link.FromTag(item.GetString()); break; case "sound": // ??????? break; default: throw new Parser.Item.BadModException(item, "Did not recognise tag " + item.name); } } } }
public void Add(Parser.Item root) { if (iscomplex == false && simpleTitle == null && root.IsValue()) { simpleTitle = LocalisationLink.FromTag(root.GetString()); } else if (iscomplex == false && simpleTitle != null && root.IsValue()) { iscomplex = true; titles = new List <Tuple <LocalisationLink, Trigger> >() { new Tuple <LocalisationLink, Trigger>(simpleTitle, null), new Tuple <LocalisationLink, Trigger>(LocalisationLink.FromTag(root.GetString()), null) }; } else if (iscomplex == false && simpleTitle == null && root.IsValue() == false) { iscomplex = true; titles = new List <Tuple <LocalisationLink, Trigger> >() { new Tuple <LocalisationLink, Trigger>(LocalisationLink.FromTag(root.GetString("text")), new Trigger(root.GetItem("trigger"))) }; } else if (iscomplex == false && simpleTitle != null && root.IsValue() == false) { iscomplex = true; titles = new List <Tuple <LocalisationLink, Trigger> >() { new Tuple <LocalisationLink, Trigger>(simpleTitle, null), new Tuple <LocalisationLink, Trigger>(LocalisationLink.FromTag(root.GetString("text")), new Trigger(root.GetItem("trigger"))) }; } else if (iscomplex && root.IsValue()) { titles.Add(new Tuple <LocalisationLink, Trigger>(LocalisationLink.FromTag(root.GetString()), null)); } else { titles.Add(new Tuple <LocalisationLink, Trigger>(LocalisationLink.FromTag(root.GetString("text")), new Trigger(root.GetItem("trigger")))); } }