Beispiel #1
0
        private void SaveCameras(Map map, List <SerialisedObject> list)
        {
            var cams = map.Data.OfType <Camera>().ToList();

            if (!cams.Any())
            {
                return;
            }

            var so = new SerialisedObject("cameras");

            for (var i = 0; i < cams.Count; i++)
            {
                var camera = cams[i];
                if (camera.IsActive)
                {
                    so.Set("activecamera", i);
                }

                var vgo = new SerialisedObject("camera");
                vgo.Set("position", $"[{FormatVector3(camera.EyePosition)}]");
                vgo.Set("look", $"[{FormatVector3(camera.LookPosition)}]");
                so.Children.Add(vgo);
            }

            list.Add(so);
        }
Beispiel #2
0
        public SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject("DisplayFlags");

            so.Set("HideNullTextures", HideNullTextures);
            so.Set("HideDisplacementSolids", HideDisplacementSolids);
            return(so);
        }
        public SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject("TransformationFlags");

            so.Set("TextureLock", TextureLock);
            so.Set("TextureScaleLock", TextureScaleLock);
            return(so);
        }
Beispiel #4
0
        public SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject("Camera");

            so.Set("EyePosition", EyePosition);
            so.Set("LookPosition", LookPosition);
            so.Set("IsActive", IsActive);
            return(so);
        }
        public SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject("CordonBounds");

            so.Set("Enabled", Enabled);
            so.Set("Start", Box.Start);
            so.Set("End", Box.End);
            return(so);
        }
Beispiel #6
0
        public SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject("Path");

            so.Set("Name", Name);
            so.Set("Type", Type);
            so.Set("Direction", Direction);
            so.Children.AddRange(Nodes.Select(x => x.ToSerialisedObject()));
            return(so);
        }
Beispiel #7
0
        public SerialisedObject ToSerialisedObject()
        {
            var v = new SerialisedObject("visgroup");

            v.Set("ID", ID);
            v.Set("Name", Name);
            v.Set("Visible", Visible);
            v.SetColor("Colour", Colour);
            return(v);
        }
Beispiel #8
0
        public SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject(nameof(EntitySprite));

            so.Set(nameof(Name), Name);
            so.Set(nameof(Scale), Scale);
            so.SetColor(nameof(Color), Color);
            so.Set("Width", Size.Width);
            so.Set("Height", Size.Height);
            return(so);
        }
        public SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject("EntityData");

            foreach (var p in Properties)
            {
                so.Set(p.Key, p.Value);
            }
            so.Set("Name", Name);
            so.Set("Flags", Flags);
            return(so);
        }
Beispiel #10
0
        public SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject("Pointfile");

            foreach (var line in Lines)
            {
                var l = new SerialisedObject("Line");
                l.Set("Start", line.Start);
                l.Set("End", line.End);
                so.Children.Add(l);
            }
            return(so);
        }
Beispiel #11
0
        private void SaveVisgroups(Map map, List <SerialisedObject> list)
        {
            var so = new SerialisedObject("visgroups");

            foreach (var visgroup in map.Data.OfType <Visgroup>())
            {
                var vgo = new SerialisedObject("visgroup");
                vgo.Set("name", visgroup.Name);
                vgo.Set("visgroupid", visgroup.ID);
                vgo.SetColor("color", visgroup.Colour);
                so.Children.Add(vgo);
            }
            list.Add(so);
        }
Beispiel #12
0
            public SerialisedObject ToSerialisedObject()
            {
                var so = new SerialisedObject("PathNode");

                foreach (var kv in Properties)
                {
                    so.Set(kv.Key, kv.Value);
                }

                so.Set("ID", ID);
                so.Set("Name", Name);
                so.Set("Position", Position);

                return(so);
            }
Beispiel #13
0
        public SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject("Origin");

            so.Set("Location", Location);
            return(so);
        }
Beispiel #14
0
        public SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject("VisgroupID");

            so.Set("ID", ID);
            return(so);
        }
Beispiel #15
0
        public SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject("VisgroupHidden");

            so.Set("IsHidden", IsHidden);
            return(so);
        }
Beispiel #16
0
        public SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject("Grid");

            so.Set("SnapToGrid", SnapToGrid);
            return(so);
        }
        public SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject("HideFaceMask");

            so.Set("Hidden", Hidden);
            return(so);
        }
Beispiel #18
0
        public SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject("ActiveTexture");

            so.Set("Name", Name);
            return(so);
        }
Beispiel #19
0
        public SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject("Selection");

            so.Set("SelectedObjects", String.Join(",", _selectedObjects.Select(x => Convert.ToString(x.ID, CultureInfo.InvariantCulture))));
            return(so);
        }
Beispiel #20
0
        public SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject("SelectionOptions");

            so.Set("IgnoreGrouping", IgnoreGrouping);
            return(so);
        }
Beispiel #21
0
        public SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject(nameof(EntityDecal));

            so.Set(nameof(Name), Name);
            return(so);
        }
Beispiel #22
0
        private void SaveCordon(Map map, List <SerialisedObject> list)
        {
            var cordon = map.Data.GetOne <CordonBounds>();

            if (cordon == null)
            {
                return;
            }

            var so = new SerialisedObject("cordon");

            so.Set("mins", $"({FormatVector3(cordon.Box.Start)})");
            so.Set("maxs", $"({FormatVector3(cordon.Box.End)})");
            so.Set("active", cordon.Enabled ? 1 : 0);

            list.Add(so);
        }
Beispiel #23
0
        public override SerialisedObject ToSerialisedObject()
        {
            SerialisedObject so = new SerialisedObject(SerialisedObjectName);

            so.Set("id", 1);
            so.Set("classname", ClassName);
            if (SpawnFlags > 0)
            {
                so.Set("spawnflags", SpawnFlags);
            }
            foreach (KeyValuePair <string, string> prop in Properties)
            {
                so.Properties.Add(new KeyValuePair <string, string>(prop.Key, prop.Value));
            }

            return(so);
        }
Beispiel #24
0
            public override SerialisedObject ToSerialisedObject()
            {
                var so = new SerialisedObject("solid");

                so.Set("id", ID);
                so.Children.AddRange(Sides.Select(x => x.ToSerialisedObject()));
                so.Children.Add(Editor.ToSerialisedObject());
                return(so);
            }
Beispiel #25
0
        public virtual SerialisedObject ToSerialisedObject()
        {
            var obj = new SerialisedObject(SerialisedName);

            obj.Set("ID", ID);
            obj.Set("IsSelected", IsSelected);
            obj.Set("ParentID", Hierarchy.Parent?.ID);
            AddCustomSerialisedData(obj);
            foreach (var data in Data)
            {
                obj.Children.Add(data.ToSerialisedObject());
            }
            foreach (var child in Hierarchy)
            {
                obj.Children.Add(child.ToSerialisedObject());
            }
            return(obj);
        }
Beispiel #26
0
            public override SerialisedObject ToSerialisedObject()
            {
                var so = new SerialisedObject("group");

                so.Set("id", ID);

                so.Children.Add(Editor.ToSerialisedObject());

                return(so);
            }
Beispiel #27
0
        public override SerialisedObject ToSerialisedObject()
        {
            var so = new SerialisedObject(SerialisedObjectName);

            so.Set("id", ID);
            so.Set("classname", ClassName);
            if (SpawnFlags > 0)
            {
                so.Set("spawnflags", SpawnFlags);
            }
            foreach (var prop in Properties)
            {
                so.Properties.Add(new KeyValuePair <string, string>(prop.Key, prop.Value));
            }

            so.Children.Add(Editor.ToSerialisedObject());

            return(so);
        }
Beispiel #28
0
        public SerialisedObject ToSerialisedObject()
        {
            SerialisedObject so = new SerialisedObject("editor");

            so.SetColor("color", Color);
            if (GroupID > 0)
            {
                so.Set("groupid", GroupID);
            }
            foreach (KeyValuePair <string, string> kv in Properties)
            {
                so.Set(kv.Key, kv.Value);
            }
            foreach (int id in VisgroupIDs.Distinct())
            {
                so.Properties.Add(new KeyValuePair <string, string>("visgroupid", Convert.ToString(id, CultureInfo.InvariantCulture)));
            }
            return(so);
        }
Beispiel #29
0
            public override SerialisedObject ToSerialisedObject()
            {
                var so = new SerialisedObject(SerialisedObjectName);

                so.Set("id", ID);
                so.Set("classname", EntityData.Name);
                so.Set("spawnflags", EntityData.Flags);
                if (Origin != null)
                {
                    so.Set("origin", Origin);
                }
                foreach (var prop in EntityData.Properties)
                {
                    so.Properties.Add(new KeyValuePair <string, string>(prop.Key, prop.Value));
                }

                so.Children.Add(Editor.ToSerialisedObject());

                return(so);
            }
Beispiel #30
0
 private void SaveVisgroups(IEnumerable <Visgroup> visgroups, SerialisedObject parent)
 {
     foreach (var visgroup in visgroups)
     {
         var vgo = new SerialisedObject("visgroup");
         vgo.Set("visgroupid", visgroup.ID);
         vgo.SetColor("color", visgroup.Color);
         SaveVisgroups(visgroup.Children, vgo);
         parent.Children.Add(vgo);
     }
 }