Exemplo n.º 1
0
        public void SaveToXElement(XElement element)
        {
            element.Add(new XAttribute("name", name));
            element.Add(new XAttribute("description", Description == null ? "" : Description));

            element.Add(new XAttribute("tags", tags.ToString()));

            foreach (MapEntity e in MapEntity.mapEntityList)
            {
                if (e.MoveWithLevel || e.Submarine != this)
                {
                    continue;
                }
                e.Save(element);
            }
        }
Exemplo n.º 2
0
        public void SaveToXElement(XElement element)
        {
            element.Add(new XAttribute("name", name));
            element.Add(new XAttribute("description", Description ?? ""));
            element.Add(new XAttribute("tags", tags.ToString()));

            Rectangle dimensions = CalculateDimensions();

            element.Add(new XAttribute("dimensions", XMLExtensions.Vector2ToString(dimensions.Size.ToVector2())));
            element.Add(new XAttribute("recommendedcrewsizemin", RecommendedCrewSizeMin));
            element.Add(new XAttribute("recommendedcrewsizemax", RecommendedCrewSizeMax));
            element.Add(new XAttribute("recommendedcrewexperience", RecommendedCrewExperience ?? ""));
            element.Add(new XAttribute("compatiblecontentpackages", string.Join(", ", CompatibleContentPackages)));

            foreach (MapEntity e in MapEntity.mapEntityList)
            {
                if (e.linkedTo == null)
                {
                    continue;
                }
                for (int i = e.linkedTo.Count - 1; i >= 0; i--)
                {
                    if (!e.linkedTo[i].ShouldBeSaved)
                    {
                        e.linkedTo.RemoveAt(i);
                    }
                }
            }

            foreach (MapEntity e in MapEntity.mapEntityList)
            {
                if (e.MoveWithLevel || e.Submarine != this || !e.ShouldBeSaved)
                {
                    continue;
                }
                e.Save(element);
            }
        }