Пример #1
0
 public override void StartSave(GameXmlWriter writer, Element e)
 {
     writer.WriteStartElement("turnscript");
     if (writer.Mode == SaveMode.SavedGame || !e.Fields[FieldDefinitions.Anonymous])
     {
         writer.WriteAttributeString("name", e.Name);
     }
     ObjectSaver.SaveFields(writer, e);
 }
Пример #2
0
            public void Save(GameXmlWriter writer, WorldModel worldModel)
            {
                ObjectSaver elementSaver = new ObjectSaver();
                elementSaver.GameSaver = GameSaver;

                IEnumerable<Element> allObjects = worldModel.Elements.GetElements(ElementType.Object).OrderBy(o => o.MetaFields[MetaFieldDefinitions.SortIndex]);

                foreach (Element e in allObjects.Where(e => e.Parent == null && GameSaver.CanSave(e)))
                {
                    SaveObjectAndChildren(writer, allObjects, e, elementSaver);
                }
            }
Пример #3
0
            public void Save(GameXmlWriter writer, WorldModel worldModel)
            {
                ObjectSaver elementSaver = new ObjectSaver();

                elementSaver.GameSaver = GameSaver;

                IEnumerable <Element> allObjects = worldModel.Elements.GetElements(ElementType.Object).OrderBy(o => o.MetaFields[MetaFieldDefinitions.SortIndex]);

                foreach (Element e in allObjects.Where(e => e.Parent == null && GameSaver.CanSave(e)))
                {
                    SaveObjectAndChildren(writer, allObjects, e, elementSaver);
                }
            }
Пример #4
0
            private void SaveObjectAndChildren(GameXmlWriter writer, IEnumerable<Element> allObjects, Element e, ObjectSaver saver)
            {
                saver.StartSave(writer, e);
                IEnumerable<Element> orderedChildren = from child in allObjects
                                                       where child.Parent == e
                                                       orderby child.MetaFields[MetaFieldDefinitions.SortIndex]
                                                       select child;

                foreach (Element child in orderedChildren)
                {
                    SaveObjectAndChildren(writer, allObjects, child, saver);
                }

                saver.EndSave(writer, e);
            }
Пример #5
0
 public override void StartSave(GameXmlWriter writer, Element e)
 {
     if (e.Fields[FieldDefinitions.IsVerb])
     {
         writer.WriteStartElement("verb");
     }
     else
     {
         writer.WriteStartElement("command");
     }
     if (writer.Mode == SaveMode.SavedGame || !e.Fields[FieldDefinitions.Anonymous])
     {
         writer.WriteAttributeString("name", e.Name);
     }
     ObjectSaver.SaveFields(writer, e);
 }
Пример #6
0
 public override void StartSave(GameXmlWriter writer, Element e)
 {
     writer.WriteStartElement("exit");
     if (writer.Mode == SaveMode.SavedGame || !e.Fields[FieldDefinitions.Anonymous])
     {
         writer.WriteAttributeString("name", e.Name);
     }
     if (!string.IsNullOrEmpty(e.Fields[FieldDefinitions.Alias]))
     {
         writer.WriteAttributeString("alias", e.Fields[FieldDefinitions.Alias]);
     }
     if (e.Fields[FieldDefinitions.To] != null)
     {
         writer.WriteAttributeString("to", e.Fields[FieldDefinitions.To].Name);
     }
     ObjectSaver.SaveFields(writer, e);
 }
Пример #7
0
            private void SaveObjectAndChildren(GameXmlWriter writer, IEnumerable <Element> allObjects, Element e, ObjectSaver saver)
            {
                saver.StartSave(writer, e);
                IEnumerable <Element> orderedChildren = from child in allObjects
                                                        where child.Parent == e
                                                        orderby child.MetaFields[MetaFieldDefinitions.SortIndex]
                                                        select child;

                foreach (Element child in orderedChildren)
                {
                    SaveObjectAndChildren(writer, allObjects, child, saver);
                }

                saver.EndSave(writer, e);
            }
Пример #8
0
 public override void StartSave(GameXmlWriter writer, Element e)
 {
     writer.WriteStartElement("game");
     writer.WriteAttributeString("name", e.Fields.GetString("gamename"));
     ObjectSaver.SaveFields(writer, e);
 }