Ejemplo n.º 1
0
            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();
            }
Ejemplo n.º 2
0
            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();
                }
            }
Ejemplo n.º 3
0
 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();
 }
Ejemplo n.º 4
0
 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();
 }
Ejemplo n.º 5
0
            public void Save(GameXmlWriter writer, Element element, string attribute, object value)
            {
                writer.WriteStartElement(attribute);
                if (!GameSaver.IsImpliedType(element, attribute, "scriptdictionary"))
                {
                    writer.WriteAttributeString("type", "scriptdictionary");
                }

                QuestDictionary<IScript> dictionary = (QuestDictionary<IScript>)value;

                foreach (var item in dictionary)
                {
                    writer.WriteStartElement("item");
                    writer.WriteAttributeString("key", item.Key);
                    writer.WriteString(GameSaver.SaveScript(writer, item.Value, 0));
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
            }
Ejemplo n.º 6
0
 protected void WriteAttribute(GameXmlWriter writer, Element element, string attribute, string type, string value)
 {
     writer.WriteStartElement(attribute);
     if (!GameSaver.IsImpliedType(element, attribute, type) || value.Length == 0)
     {
         writer.WriteAttributeString("type", type);
     }
     writer.WriteString(value);
     writer.WriteEndElement();
 }