public void EndSave(GameXmlWriter writer, Element e) { IObjectSaver saver; if (GetSaver(writer, e, out saver)) { saver.EndSave(writer, e); } }
public override void Save(GameXmlWriter writer, Element e) { IObjectSaver saver; if (GetSaver(writer, e, out saver)) { saver.StartSave(writer, e); saver.EndSave(writer, e); } }
public override void Save(GameXmlWriter writer, Element e) { // only save the delegate definition, not the individual implementations - they are just fields on objects if (!e.MetaFields[MetaFieldDefinitions.DelegateImplementation]) { writer.WriteStartElement("delegate"); writer.WriteAttributeString("name", e.Name); writer.WriteAttributeString("parameters", string.Join(", ", e.Fields[FieldDefinitions.ParamNames].ToArray())); writer.WriteAttributeString("type", e.Fields[FieldDefinitions.ReturnType]); writer.WriteEndElement(); } }
public void Save(GameXmlWriter writer, Element element, string attribute, object value) { if (value == null) return; IFieldSaver saver; if (TryGetSaver(value.GetType(), out saver)) { saver.Save(writer, element, attribute, value); } else { throw new Exception(string.Format("ERROR: No FieldSaver for attribute {0}, type: {1}", attribute, value.GetType().ToString())); } }
public override void Save(GameXmlWriter writer, Element e) { writer.WriteStartElement("dynamictemplate"); writer.WriteAttributeString("name", e.Name); if (!GameSaver.m_worldModel.EditMode) { writer.WriteString(e.Fields[FieldDefinitions.Function].Save()); } else { writer.WriteString(e.Fields[FieldDefinitions.Text]); } writer.WriteEndElement(); }
public override void Save(GameXmlWriter writer, Element e) { writer.WriteStartElement("timer"); writer.WriteAttributeString("name", e.Name); base.SaveFields(writer, e); writer.WriteEndElement(); }
public void EndSave(GameXmlWriter writer, Element e) { writer.WriteEndElement(); }
public override void Save(GameXmlWriter writer, Element e) { // Resource elements should never need to be saved. They can only // be defined by the Core library and are there for information only // (specifying which additional files to include in a .quest file) }
public override void Save(GameXmlWriter writer, Element e) { writer.WriteStartElement("template"); writer.WriteAttributeString("name", e.Fields[FieldDefinitions.TemplateName]); writer.WriteString(e.Fields[FieldDefinitions.Text]); writer.WriteEndElement(); }
public void Save(GameXmlWriter writer, WorldModel worldModel) { ObjectSaver elementSaver = new ObjectSaver(); elementSaver.GameSaver = GameSaver; IEnumerable<Element> allObjects = worldModel.Elements.GetElements(ElementType.Object); foreach (Element e in allObjects.Where(e => e.Parent == null && GameSaver.CanSave(e))) { SaveObjectAndChildren(writer, allObjects, e, elementSaver); } }
public override void StartSave(GameXmlWriter writer, Element e) { writer.WriteStartElement("object"); writer.WriteAttributeString("name", e.Name); ObjectSaver.SaveFields(writer, e); }
private void SaveElementAndChildren(GameXmlWriter writer, WorldModel worldModel, Element walkThrough) { m_walkthroughSaver.StartSave(writer, walkThrough); foreach (Element child in worldModel.Elements.GetElements(ElementType.Walkthrough).Where(e => e.Parent == walkThrough)) { SaveElementAndChildren(writer, worldModel, child); } m_walkthroughSaver.EndSave(writer, walkThrough); }
public void Save(GameXmlWriter writer, WorldModel worldModel) { foreach (Element walkThrough in worldModel.Elements.GetElements(ElementType.Walkthrough).Where(e => e.Parent == null)) { SaveElementAndChildren(writer, worldModel, walkThrough); } }
public override void StartSave(GameXmlWriter writer, Element e) { writer.WriteStartElement("turnscript"); if (!e.Fields[FieldDefinitions.Anonymous]) { writer.WriteAttributeString("name", e.Name); } ObjectSaver.SaveFields(writer, e); }
public void StartSave(GameXmlWriter writer, Element e) { writer.WriteStartElement("tab"); base.SaveFields(writer, e); }
public override void Save(GameXmlWriter writer, Element e) { throw new NotImplementedException(); }
public void Save(GameXmlWriter writer, WorldModel worldModel) { IEnumerable<Element> allEditors = worldModel.Elements.GetElements(ElementType.Editor); IEnumerable<Element> allTabs = worldModel.Elements.GetElements(ElementType.EditorTab); IEnumerable<Element> allControls = worldModel.Elements.GetElements(ElementType.EditorControl); foreach (Element editor in allEditors.Where(e => !e.MetaFields[MetaFieldDefinitions.Library])) { m_editorSaver.StartSave(writer, editor); foreach (Element tab in allTabs.Where(t => t.Parent == editor)) { m_tabSaver.StartSave(writer, tab); foreach (Element control in allControls.Where(c => c.Parent == tab)) { m_controlSaver.Save(writer, control); } m_tabSaver.EndSave(writer, tab); } m_editorSaver.EndSave(writer, editor); } }
public override void Save(GameXmlWriter writer, Element e) { writer.WriteStartElement("control"); base.SaveFields(writer, e); writer.WriteEndElement(); }
public override void Save(GameXmlWriter writer, Element e) { StartSave(writer, e); EndSave(writer, e); }
public string SaveScript(GameXmlWriter writer, IScript script, int indent) { return IndentScript(script.Save(), writer.IndentLevel + indent, writer.IndentChars); }
public void StartSave(GameXmlWriter writer, Element e) { writer.WriteStartElement("walkthrough"); writer.WriteAttributeString("name", e.Name); QuestList<string> steps = e.Fields[FieldDefinitions.Steps]; if (steps != null && steps.Count > 0) { string result = string.Empty; string indent = GameSaver.GetIndentChars(writer.IndentLevel + 1, writer.IndentChars); foreach (string step in steps) { result += Environment.NewLine + indent + step; } result += Environment.NewLine; writer.WriteStartElement("steps"); writer.WriteString(result); writer.WriteEndElement(); } }
protected virtual bool CanSaveTypeName(GameXmlWriter writer, string type, Element e) { if (writer.Mode == SaveMode.Package) { if (e.WorldModel.Elements.Get(ElementType.ObjectType, type).MetaFields[MetaFieldDefinitions.EditorLibrary]) { return false; } } return !WorldModel.DefaultTypeNames.ContainsValue(type); }
public override void Save(GameXmlWriter writer, Element e) { writer.WriteStartElement("function"); writer.WriteAttributeString("name", e.Name); if (e.Fields[FieldDefinitions.ParamNames] != null && e.Fields[FieldDefinitions.ParamNames].Count > 0) { writer.WriteAttributeString("parameters", string.Join(", ", e.Fields[FieldDefinitions.ParamNames].ToArray())); } if (!string.IsNullOrEmpty(e.Fields[FieldDefinitions.ReturnType])) { writer.WriteAttributeString("type", e.Fields[FieldDefinitions.ReturnType]); } if (e.Fields[FieldDefinitions.Script] != null) { writer.WriteString(GameSaver.SaveScript(writer, e.Fields[FieldDefinitions.Script], 0)); } writer.WriteEndElement(); }
private void SaveObjectAndChildren(GameXmlWriter writer, IEnumerable<Element> allObjects, Element e, ObjectSaver saver) { saver.StartSave(writer, e); foreach (Element child in allObjects) { if (child.Parent == e) { SaveObjectAndChildren(writer, allObjects, child, saver); } } saver.EndSave(writer, e); }
public string Save(SaveMode mode) { m_mode = mode; GameXmlWriter writer = new GameXmlWriter(mode); UpdateImpliedTypesCache(); writer.WriteComment("Saved by Quest Editor v5.0"); writer.WriteStartElement("asl"); writer.WriteAttributeString("version", "500"); if (mode == SaveMode.SavedGame) { writer.WriteAttributeString("original", m_worldModel.Filename); } foreach (ElementType t in Enum.GetValues(typeof(ElementType))) { if (m_elementsSavers.ContainsKey(t)) { // We have an IElementsSaver which saves all elements of a particular type at once m_elementsSavers[t].Save(writer, m_worldModel); } else { // Save the elements individually IElementSaver saver; if (m_elementSavers.TryGetValue(t, out saver)) { if (saver.AutoSave) { foreach (Element e in m_worldModel.Elements.GetElements(t).Where(e => CanSave(e))) { saver.Save(writer, e); } } } else { throw new Exception("ERROR: No ElementSaver for type " + t.ToString()); } } } writer.WriteEndElement(); writer.Close(); return writer.ToString(); }
public override void Save(GameXmlWriter writer, Element e) { writer.WriteStartElement("implied"); writer.WriteAttributeString("element", e.Fields[FieldDefinitions.Element]); writer.WriteAttributeString("property", e.Fields[FieldDefinitions.Property]); writer.WriteAttributeString("type", e.Fields[FieldDefinitions.Type]); writer.WriteEndElement(); }
public abstract void Save(GameXmlWriter writer, Element e);
public override void Save(GameXmlWriter writer, Element e) { writer.WriteStartElement("include"); writer.WriteAttributeString("ref", e.Fields[FieldDefinitions.Filename]); writer.WriteEndElement(); }
protected void SaveFields(GameXmlWriter writer, Element e) { foreach (Element includedType in e.Fields.Types) { if (CanSaveTypeName(writer, includedType.Name, e)) { writer.WriteStartElement("inherit"); writer.WriteAttributeString("name", includedType.Name); writer.WriteEndElement(); } } foreach (string attribute in e.Fields.FieldNames) { if (CanSaveAttribute(attribute, e)) { object value = e.Fields.Get(attribute); m_fieldSaver.Save(writer, e, attribute, value); } } }
public override void Save(GameXmlWriter writer, Element e) { writer.WriteStartElement("javascript"); writer.WriteAttributeString("src", e.Fields[FieldDefinitions.Src]); writer.WriteEndElement(); }