private static MenuStateInfo LoadMenuState(XElement node, string basePath) { var info = new MenuStateInfo(); info.Name = node.RequireAttribute("name").Value; info.Fade = node.TryAttribute <bool>("fade"); var startNode = node.Element("SelectOption"); if (startNode != null) { var startNameAttr = startNode.Attribute("name"); var startVarAttr = startNode.Attribute("var"); if (startNameAttr != null) { info.StartOptionName = startNameAttr.Value; } if (startVarAttr != null) { info.StartOptionVar = startVarAttr.Value; } } info.Commands = LoadCommands(node, basePath); return(info); }
private void WriteState(MenuStateInfo info, XmlWriter writer) { writer.WriteStartElement("State"); writer.WriteAttributeString("name", info.Name); foreach (var command in info.Commands) { _commandWriter.Write(command, writer); } if (info.StartOptionName != null || info.StartOptionVar != null) { writer.WriteStartElement("SelectOption"); if (info.StartOptionName != null) { writer.WriteAttributeString("name", info.StartOptionName); } if (info.StartOptionVar != null) { writer.WriteAttributeString("var", info.StartOptionVar); } } writer.WriteEndElement(); }
private MenuStateInfo LoadMenuState(XElement node, string basePath) { var info = new MenuStateInfo(); info.Name = node.RequireAttribute("name").Value; info.Fade = node.TryAttribute<bool>("fade"); var startNode = node.Element("SelectOption"); if (startNode != null) { var startNameAttr = startNode.Attribute("name"); var startVarAttr = startNode.Attribute("var"); if (startNameAttr != null) { info.StartOptionName = startNameAttr.Value; } if (startVarAttr != null) { info.StartOptionVar = startVarAttr.Value; } } info.Commands = _commandReader.LoadCommands(node, basePath); return info; }
public override void StartHandler(IEntityPool entityPool) { base.StartHandler(entityPool); this.state = this.info.States[0]; RunCommands(this.state.Commands); ResetState(); }