internal static void Write(ContentWriter writer, LayerSettingsContent content)
 {
     if (content is GridLayerSettingsContent)
     {
         GridLayerSettingsContent gContent = content as GridLayerSettingsContent;
         writer.Write("g");
         writer.Write(gContent.GridColor);
         writer.Write(gContent.GridDrawSize);
         writer.Write(gContent.GridSize);
         writer.Write(gContent.Name);
         writer.Write(gContent.ExportAsObjects);
         writer.Write(gContent.NewLine);
     }
     else if (content is ObjectLayerSettingsContent)
     {
         ObjectLayerSettingsContent oContent = content as ObjectLayerSettingsContent;
         writer.Write("o");
         writer.Write(oContent.GridColor);
         writer.Write(oContent.GridDrawSize);
         writer.Write(oContent.GridSize);
         writer.Write(oContent.Name);
     }
     else if (content is TileLayerSettingsContent)
     {
         TileLayerSettingsContent tContent = content as TileLayerSettingsContent;
         writer.Write("t");
         writer.Write(tContent.GridColor);
         writer.Write(tContent.GridDrawSize);
         writer.Write(tContent.GridSize);
         writer.Write(tContent.Name);
         writer.Write(tContent.ExportTileIDs);
         writer.Write(tContent.ExportTileSize);
         writer.Write(tContent.MultipleTilesets);
     }
 }
        private void WriteAnimationClips(ContentWriter output)
        {
            output.Write(animationClips.Count);
            foreach (AnimationClipContent animationClipContent in animationClips.Values)
                output.WriteSharedResource(animationClipContent);

            /*
            foreach (AnimationClipContent animationTrack in animationClips.Values)
            {
                output.Write(animationTrack.Name);
                output.WriteObject<TimeSpan>(animationTrack.Duration);

                output.Write(animationTrack.Channels.Count);
                foreach (KeyValuePair<string, AnimationChannelContent> pairKeyChannel in
                    animationTrack.Channels)
                {
                    output.Write(pairKeyChannel.Key);
                    output.Write(pairKeyChannel.Value.Count);
                    foreach (AnimationKeyframeContent keyframe in pairKeyChannel.Value)
                    {
                        output.WriteObject<TimeSpan>(keyframe.Time);
                        output.Write(keyframe.Transform);
                    }
                }
            }
             */
        }
 internal static void Write(ContentWriter writer, ValueContent content)
 {
     if (content is BooleanValueContent)
     {
         BooleanValueContent bContent = content as BooleanValueContent;
         writer.Write("b");
         writer.Write(bContent.Name);
         writer.Write(bContent.Value);
     }
     else if (content is IntegerValueContent)
     {
         IntegerValueContent iContent = content as IntegerValueContent;
         writer.Write("i");
         writer.Write(iContent.Name);
         writer.Write(iContent.Value);
     }
     else if (content is NumberValueContent)
     {
         NumberValueContent nContent = content as NumberValueContent;
         writer.Write("n");
         writer.Write(nContent.Name);
         writer.Write(nContent.Value);
     }
     else if (content is StringValueContent)
     {
         StringValueContent sContent = content as StringValueContent;
         writer.Write("s");
         writer.Write(sContent.Name);
         writer.Write(sContent.Value);
     }
 }
        internal void Write(ContentWriter output)
        {
            output.Write(name);
            output.WriteObject<TimeSpan>(duration);

            // Write animation clip channels
            output.Write(channels.Count);
            foreach (KeyValuePair<string, AnimationChannelContent> pair in channels)
            {
                output.Write(pair.Key);
                AnimationChannelContent animationChannel = pair.Value;

                // Write the animation channel keyframes
                output.Write(animationChannel.Count);
                foreach (AnimationKeyframeContent keyframe in animationChannel)
                {
                    output.WriteObject<TimeSpan>(keyframe.Time);

                    // Write pose
                    output.Write(keyframe.Pose.Translation);
                    output.Write(keyframe.Pose.Orientation);
                    output.Write(keyframe.Pose.Scale);
                }
            }
        }
Ejemplo n.º 5
0
 private void WriteAnimationClips(ContentWriter output)
 {
     output.Write(animationClips.Count);
     foreach (AnimationClipContent animationClipContent in animationClips.Values)
     {
         output.WriteSharedResource(animationClipContent);
     }
 }
Ejemplo n.º 6
0
 private void WriteMeshes(ContentWriter output)
 {
     output.Write(meshes.Count);
     for (int i = 0; i < meshes.Count; i++)
     {
         output.WriteObject<SkinnedModelMeshContent>(meshes[i]);
     }
 }
Ejemplo n.º 7
0
 internal void Write(ContentWriter output)
 {
     output.Write(numVertices);
     output.Write(numTriangles);
     output.WriteObject<VertexBufferContent>(vertices);
     output.WriteObject<IndexCollection>(indices);
     output.WriteObject<MaterialContent>(material);
 }
Ejemplo n.º 8
0
 private void WriteBones(ContentWriter output)
 {
     output.Write(skeleton.Count);
     foreach (SkinnedModelBoneContent bone in skeleton)
     {
         output.WriteSharedResource(bone);
     }
 }
Ejemplo n.º 9
0
 public void write(ContentWriter output)
 {
     output.Write(m_width);
     output.Write(m_height);
     for (int x = 0; x < m_width; x++) {
         for (int y = 0; y < m_height; y++) {
             output.Write(m_verts[x, y]);
         }
     }
 }
Ejemplo n.º 10
0
 //Simple helper method for handling developer IDs
 public void DeveloperIDWriter(ContentWriter output, object obj)
 {
     if (obj != null && Did.ContainsKey(obj))
     {
         output.Write(true);
         output.Write(Did[obj]);
     }
     else
     {
         output.Write(false);
     }
 }
Ejemplo n.º 11
0
        public static void WritePropertyBlock(ContentWriter output, IEnumerable<Property> properties)
        {
            short pcount = 0;
            foreach (Property p in properties) {
                pcount++;
            }

            output.Write((short)pcount);
            foreach (Property p in properties) {
                output.Write(p.Name);
                output.Write(p.ToString());
            }
        }
        private void WriteBones(ContentWriter output)
        {
            output.Write(skeleton.Count);
            foreach (SkinnedModelBoneContent bone in skeleton)
                //{
                output.WriteSharedResource(bone);
            /*
                output.Write(skeleton[i].Name);
                output.Write(skeleton[i].BindPoseTransform);
                output.Write(skeleton[i].InverseBindPoseTransform);

                output.WriteSharedResource(skeleton[i].Parent);

                // Write children
                output.Write(skeleton[i].Children.Count);
                for (int j = 0; j < skeleton.Count; j++)
                {
                    output.WriteSharedResource(skeleton[i].Children[j]);
                }
                 */
            //}
            /*
            // Write root bone
            output.Write(rootBoneContent.Name);

            // Write each bone
            output.Write(skinnedModelBoneContentDictionary.Values.Count);
            foreach (SkinnedModelBoneContent bone in skinnedModelBoneContentDictionary.Values)
            {
                output.Write(bone.Name);
                output.Write(bone.Transform);
                output.Write(bone.AbsoluteTransform);
                output.Write(bone.InverseBindPoseTransform);
            }

            // Write the parent and children of each bone
            foreach (SkinnedModelBoneContent bone in skinnedModelBoneContentDictionary.Values)
            {
                string parentBoneName = null;
                if (bone.Parent != null)
                    parentBoneName = bone.Parent.Name;
                output.WriteObject<string>(parentBoneName);

                // Children
                output.Write(bone.Children.Count);
                foreach (SkinnedModelBoneContent childBbone in bone.Children)
                    output.Write(childBbone.Name);
            }
             */
        }
        /// <summary>
        /// Saves instanced model data into an XNB file.
        /// </summary>
        public void Write(ContentWriter output)
        {
            output.Write(modelParts.Count);

            foreach (ModelPart modelPart in modelParts)
            {
                output.Write(modelPart.IndexCount);
                output.Write(modelPart.VertexCount);
                output.Write(modelPart.VertexStride);

                output.WriteObject(modelPart.VertexElements);
                output.WriteObject(modelPart.VertexBufferContent);
                output.WriteObject(modelPart.IndexCollection);

                output.WriteSharedResource(modelPart.MaterialContent);
            }
        }
        internal void Write(ContentWriter output)
        {
            output.Write(index);
            output.Write(name);

            // Write bind pose
            output.Write(bindPose.Translation);
            output.Write(bindPose.Orientation);
            output.Write(bindPose.Scale);

            output.Write(inverseBindPoseTransform);

            // Write parent and children
            output.WriteSharedResource(parent);
            output.Write(children.Count);
            foreach (SkinnedModelBoneContent childBone in children)
                output.WriteSharedResource(childBone);
        }
Ejemplo n.º 15
0
        protected override void Write(ContentWriter writer, TexturePackerProcessorResult result)
        {
            var data     = result.Data;
            var metadata = data.Metadata;

            var assetName = Path.GetFileNameWithoutExtension(metadata.Image);

            Debug.Assert(assetName != null, "assetName != null");

            writer.Write(assetName);
            writer.Write(data.Regions.Count);

            foreach (var region in data.Regions)
            {
                var regionName = Path.ChangeExtension(region.Filename, null);
                Debug.Assert(regionName != null, "regionName != null");

                writer.Write(regionName);
                writer.Write(region.Frame.X);
                writer.Write(region.Frame.Y);
                writer.Write(region.Frame.Width);
                writer.Write(region.Frame.Height);
            }
        }
        /// <summary>
        /// Renders the contents of the supplied Stream to the Page at the position specified by the provided Rectangle
        /// </summary>
        /// <param name="stream"></param>
        /// <param name="rect"></param>
        protected virtual void RenderContentStream(PdfStream stream, PdfRectangle rect)
        {
            if (stream == null)
            {
                return;
            }
            var content = ContentReader.ReadContent(stream.UnfilteredValue);
            var matrix  = new XMatrix();

            matrix.TranslateAppend(rect.X1, rect.Y1);
            var matElements = matrix.GetElements();
            var matrixOp    = OpCodes.OperatorFromName("cm");

            foreach (var el in matElements)
            {
                matrixOp.Operands.Add(new CReal {
                    Value = el
                });
            }
            content.Insert(0, matrixOp);

            // Save and restore Graphics state
            content.Insert(0, OpCodes.OperatorFromName("q"));
            content.Add(OpCodes.OperatorFromName("Q"));
            var appendedContent = Page.Contents.AppendContent();

            using (var ms = new MemoryStream())
            {
                var cw = new ContentWriter(ms);
                foreach (var obj in content)
                {
                    obj.WriteObject(cw);
                }
                appendedContent.CreateStream(ms.ToArray());
            }
        }
Ejemplo n.º 17
0
        void writeMainItem(ContentWriter writer, MainItemVO item, SceneVO scene)
        {
            writer.Write(item.uniqueId);
            writer.Write(item.itemIdentifier);
            writer.Write(item.itemName);
            writer.Write(item.customVars);
            writer.Write(item.x * scene.pixelToWorld);
            writer.Write(-item.y * scene.pixelToWorld);
            writer.Write(item.scaleX);
            writer.Write(item.scaleY);
            writer.Write(item.originX * scene.pixelToWorld);
            writer.Write(-item.originY * scene.pixelToWorld);
            writer.Write(item.rotation);
            writer.Write(item.zIndex);
            writer.Write(item.layerDepth);
            writer.Write(item.layerName);
            writer.Write(new Color(item.tint[0], item.tint[1], item.tint[2], item.tint[3]));

            // not implemented for main item
//			public String[] tags;
//			public String shaderName;
//			public ShapeVO shape;
//			public PhysicsBodyDataVO physics;
        }
Ejemplo n.º 18
0
        // ReSharper disable once SuggestBaseTypeForParameter
        private static void WriteModel(ContentWriter output, TiledMapLayerModelContent model)
        {
            output.Write(model.LayerName);
            output.Write(model.TextureAssetName);

            var vertexCount = model.Vertices.Count;

            output.Write(vertexCount);
            foreach (var vertex in model.Vertices)
            {
                output.Write(vertex.Position.X);
                output.Write(vertex.Position.Y);
                output.Write(vertex.TextureCoordinate.X);
                output.Write(vertex.TextureCoordinate.Y);
            }

            var indexCount = model.Indices.Count;

            output.Write(indexCount);
            foreach (var index in model.Indices)
            {
                output.Write(index);
            }
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Writes a ModelInfo object into XNB data
        /// </summary>
        /// <param name="output">The stream that contains the written data</param>
        /// <param name="value">The instance to be serialized</param>
        protected override void Write(ContentWriter output, AnimationContentDictionary value)
        {
            AnimationContentDictionary animations = value;

            output.Write(animations.Count);

            foreach (KeyValuePair <string, AnimationContent> k in animations)
            {
                output.Write(k.Key);

                output.Write(k.Value.Channels.Count);
                foreach (KeyValuePair <string, AnimationChannel> chan in k.Value.Channels)
                {
                    output.Write(chan.Key);
                    output.Write(chan.Value.Count);

                    foreach (AnimationKeyframe keyframe in chan.Value)
                    {
                        output.Write(keyframe.Transform);
                        output.Write(keyframe.Time.Ticks);
                    }
                }
            }
        }
Ejemplo n.º 20
0
        protected override void Render(ContentWriter cw, Vector2D offset)
        {
            var size  = Size;
            var width = Math.Abs(size.X.Value(UnitsOfMeasure.Centimeters));

            if (width < 1)
            {
                size.X = Vector1D.Zero;
            }

            var p1 = offset + new Vector2D(Vector1D.Zero, size.Y);
            var p2 = offset + new Vector2D(Vector1D.Zero, size.Y / 2);
            var p3 = offset + new Vector2D(size.X, size.Y / 2);
            var p4 = offset + new Vector2D(size.X, Vector1D.Zero);

            cw.MoveTo(centerX, offset.Y + size.Y + Node.GateHeight + Node.Margin);
            cw.LineTo(centerX, offset.Y + size.Y + Node.GateHeight / 2);

            cw.MoveTo(offset.X, offset.Y + size.Y + Node.GateHeight / 2);
            cw.LineTo(p1);
            cw.LineTo(p2);
            cw.LineTo(p3);
            cw.LineTo(p4);
        }
Ejemplo n.º 21
0
        protected override void Write(ContentWriter output, ChunkContent value)
        {
            output.Write(value.SizeX);
            output.Write(value.SizeY);
            output.Write(value.SizeZ);
            output.Write(value.Position);
            output.Write(value.BlockCount);
            output.Write(value.ActiveBlocks);

            for (var i = 0; i < value.BlockCount; i++)
            {
                var b = value.Blocks[i];
                output.Write(b.X);
                output.Write(b.Y);
                output.Write(b.Z);
                output.Write(b.Index);
            }

            // write the palette
            foreach (var c in value.Palette)
            {
                output.Write(c);
            }
        }
Ejemplo n.º 22
0
        protected override void Write(ContentWriter output, HeightField value)
        {
            output.Write(value.OriginX);
            output.Write(value.OriginZ);
            output.Write(value.WidthX);
            output.Write(value.WidthZ);
            output.Write(value.Depth);
            output.Write(value.NumberOfSamplesX);
            output.Write(value.NumberOfSamplesZ);

            int numberOfElements = value.NumberOfSamplesX * value.NumberOfSamplesZ;

            if (numberOfElements > value.Samples.Length)
            {
                throw new InvalidContentException("HeightField.Samples array has less than NumberOfSamplesX x NumberOfSamplesZ elements.");
            }

            var samples = value.Samples;

            for (int i = 0; i < numberOfElements; i++)
            {
                output.Write(samples[i]);
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Saves custom model data into an XNB file.
        /// </summary>
        public void Write( ContentWriter output )
        {
            output.Write( modelParts.Count );

              foreach ( ModelPart modelPart in modelParts )
              {
            // Simple data types like integers can be written directly.
            output.Write( modelPart.TriangleCount );
            output.Write( modelPart.VertexCount );
            output.Write( modelPart.VertexStride );

            // These design time graphics types will be automatically translated
            // into actual GPU data types when they are loaded back in at runtime.
            output.WriteObject( modelPart.VertexElements );
            output.WriteObject( modelPart.VertexBufferContent );
            output.WriteObject( modelPart.IndexCollection );

            // A single material instance may be shared by more than one ModelPart,
            // in which case we only want to write a single copy of the material
            // data into the XNB file. The WriteSharedResource method takes care
            // of this merging for us.
            output.WriteSharedResource( modelPart.MaterialContent );
              }
        }
Ejemplo n.º 24
0
 protected override void Write(ContentWriter output, ConeShape value)
 {
     output.Write(value.Radius);
     output.Write(value.Height);
 }
        protected override void Write(ContentWriter writer, LibGdxAtlasProcessorResult result)
        {
            var data = result.data;

            LibGdxAtlasProcessor.logger.LogMessage("Writing {0} pages", data.pages.Count);
            writer.Write(data.pages.Count);
            foreach (var page in data.pages)
            {
                LibGdxAtlasProcessor.logger.LogMessage("Writing page: {0}", page.textureFile);
                writer.Write(Path.GetFileNameWithoutExtension(page.textureFile));
                int count = 0;
                foreach (var region in data.regions)
                {
                    if (region.page == page.textureFile)
                    {
                        count++;
                    }
                }

                LibGdxAtlasProcessor.logger.LogMessage("Writing {0} regions", count);
                writer.Write(count);
                foreach (var region in data.regions)
                {
                    if (region.page == page.textureFile)
                    {
                        LibGdxAtlasProcessor.logger.LogMessage("Writing region: {0} {1}", region.name, region.index == -1 ? string.Empty : $"(index {region.index})");
                        writer.Write(region.name);
                        writer.Write(region.sourceRectangle.x);
                        writer.Write(region.sourceRectangle.y);
                        writer.Write(region.sourceRectangle.w);
                        writer.Write(region.sourceRectangle.h);

                        if (region.splits == null)
                        {
                            writer.Write(false);
                        }
                        else
                        {
                            writer.Write(true);
                            writer.Write(region.splits[0]);
                            writer.Write(region.splits[1]);
                            writer.Write(region.splits[2]);
                            writer.Write(region.splits[3]);
                            LibGdxAtlasProcessor.logger.LogMessage("Writing splits for region: {0}", region.name);
                        }

                        if (region.pads == null)
                        {
                            writer.Write(false);
                        }
                        else
                        {
                            writer.Write(true);
                            writer.Write(region.pads[0]);
                            writer.Write(region.pads[1]);
                            writer.Write(region.pads[2]);
                            writer.Write(region.pads[3]);
                            LibGdxAtlasProcessor.logger.LogMessage("Writing pads for region: {0}", region.name);
                        }

                        writer.Write(region.index);
                    }
                }
            }
        }
Ejemplo n.º 26
0
 protected override void Write(ContentWriter writer, BitmapFontContent data)
 {
     writer.Write(data.Data);
 }
 public void Write(ContentWriter writer)
 {
     writer.WriteObject(this.texture);
     writer.WriteObject(this.animations);
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Write the static model to a content pipeline data file.
 /// </summary>
 /// <param name="output">The ContentWriter for the data file.</param>
 public void Write(ContentWriter output)
 {
     output.WriteObject <VertexBufferContent>(vertexContent);
     output.WriteObject <IndexCollection>(indexContent);
 }
Ejemplo n.º 29
0
 protected override void Write(ContentWriter output, TWrite value)
 {
     output.Write(value.Filename);
     output.WriteObject <MD5Joint[]>(value.Joints);
     output.WriteObject <MD5Submesh[]>(value.Submeshes);
 }
Ejemplo n.º 30
0
 public JsonObjectWriter(ContentWriter writer, ValueProvider valueProvider)
 {
     _writer = writer;
     _valueProvider = valueProvider;
 }
 internal void Write(ContentWriter output)
 {
     output.WriteObject<ModelContent>(model);
     WriteBones(output);
     WriteAnimationClips(output);
 }
Ejemplo n.º 32
0
 protected override void Write(ContentWriter output, AnimationClip value)
 {
     output.WriteObject(value.Duration);
     output.WriteObject(value.Keyframes);
 }
Ejemplo n.º 33
0
 protected override void Write(ContentWriter output, DRModelNodeContent value)
 {
     // Use the SceneNodeWriter.
     output.WriteRawObject <DRSceneNodeContent>(value);
 }
Ejemplo n.º 34
0
        private byte[] WriteTypeReadersData(IList<ContentTypeWriter> usedTypeWriters)
        {
            byte[] data = null;
            List<string> typeReaderNames = usedTypeWriters.Select(w => w.GetReaderTypeName()).ToList();

            using (MemoryStream stream = new MemoryStream())
            {
                using (ContentWriter writer = new ContentWriter(stream, this))
                {
                    writer.WriteEncodedInt32(typeReaderNames.Count);

                    foreach (var typeReader in typeReaderNames)
                    {
                        writer.Write(typeReader.ToString());
                        writer.Write(0);
                    }

                    data = stream.GetBuffer().Take((int)stream.Length).ToArray();
                }
            }

            return data;
        }
Ejemplo n.º 35
0
        private List<byte[]> WriteSharedResourcesData(out byte[] sharedResourcesCountData)
        {
            List<byte[]> shareResourcesData = new List<byte[]>();

            using (MemoryStream stream = new MemoryStream())
            {
                using (ContentWriter writer = new ContentWriter(stream, this))
                {
                    writer.WriteEncodedInt32(sharedResources.Count);
                    writer.Flush();

                    stream.Flush();
                    sharedResourcesCountData = stream.GetBuffer().Take((int)stream.Length).ToArray();
                }
            }

            // TODO: Support shared resources
            return shareResourcesData;
        }
Ejemplo n.º 36
0
        private byte[] WriteRootObjectData(object rootObject)
        {
            byte[] rootObjectData = null;

            using (MemoryStream stream = new MemoryStream())
            {
                using (ContentWriter writer = new ContentWriter(stream, this))
                {
                    writer.WriteObject<object>(rootObject);
                    writer.Flush();

                    stream.Flush();
                    rootObjectData = stream.GetBuffer().Take((int)stream.Length).ToArray();
                }
            }

            return rootObjectData;
        }
Ejemplo n.º 37
0
 public abstract void Write(ContentWriter writer, object value);
Ejemplo n.º 38
0
 public static void Write(this ContentWriter output, Sprite sprite)
 {
     output.Write(sprite.TexturePath);
     output.Write(sprite.SourceRectangle);
     output.Write(sprite.Origin);
 }
Ejemplo n.º 39
0
 /// <summary>
 /// Write the content to a XNB file.
 /// </summary>
 /// <param name="stream">The stream to write the XNB file to.</param>
 /// <param name="content">The content to write to the XNB file.</param>
 /// <param name="targetPlatform">The platform the XNB is intended for.</param>
 /// <param name="targetProfile">The graphics profile of the target.</param>
 /// <param name="compress">True if the content should be compressed.</param>
 /// <param name="rootDirectory">The root directory of the content.</param>
 /// <param name="referenceRelocationPath">The path of the XNB file, used to calculate relative paths for external references.</param>
 public void Compile(Stream stream, object content, TargetPlatform targetPlatform, GraphicsProfile targetProfile, bool compressContent, string rootDirectory, string referenceRelocationPath)
 {
     using (var writer = new ContentWriter(this, stream, targetPlatform, targetProfile, compressContent, rootDirectory, referenceRelocationPath))
     {
         writer.WriteObject(content);
         writer.Flush();
     }
 }
Ejemplo n.º 40
0
 protected override void Render(ContentWriter cw, Vector2D offset)
 {
     cw.Arc(offset, offset + Size, startangle, extent);
 }
Ejemplo n.º 41
0
        protected override void Write(ContentWriter output, DefaultAnimatedDynamicVertexBufferContent buffer)
        {
            WriteVertexBuffer(output, buffer);

            output.Write(buffer.IsWriteOnly);
        }
Ejemplo n.º 42
0
 internal override void WriteObject(ContentWriter writer)
 {
   writer.WriteRaw(ToString());
 }
Ejemplo n.º 43
0
 protected override void Write(ContentWriter output, TiledMapData value)
 {
     char[] valArr = value.Data.ToCharArray();
     output.Write(valArr);
 }
Ejemplo n.º 44
0
 internal override void WriteObject(ContentWriter writer)
 {
   int count = this.seqence != null ? this.seqence.Count : 0;
   for (int idx = 0; idx < count; idx++)
     this.seqence[idx].WriteObject(writer);
   writer.WriteLineRaw(ToString());
 }
Ejemplo n.º 45
0
 protected override void Write(ContentWriter output, MapData value)
 {
     output.WriteObject <string>(value.mapName);
     output.WriteObject <int>(value.numberOfCastles);
     output.WriteObject <List <string> >(value.allies);
 }
Ejemplo n.º 46
0
 /// <summary>
 /// 
 /// </summary>
 internal abstract void WriteObject(ContentWriter writer);
Ejemplo n.º 47
0
 protected override void Write(ContentWriter writer, JsonContentProcessorResult result)
 {
     _runtimeType = result.ContentType;
     writer.Write(result.Json);
 }
Ejemplo n.º 48
0
 protected override void Write(ContentWriter output, AabbTree <T> value)
 {
     output.Write(value.EnableSelfOverlaps);
     output.Write(value.BottomUpBuildThreshold);
     output.WriteSharedResource(value.Filter);
 }
Ejemplo n.º 49
0
 protected override void Write(ContentWriter output, T value)
 {
     output.WriteObject(value.Colour);
 }
Ejemplo n.º 50
0
 protected override void Write(ContentWriter output, AlignedBox3 value)
 {
     output.WriteObject <Vector3>(value.Min);
     output.WriteObject <Vector3>(value.Max);
 }
Ejemplo n.º 51
0
 protected override void Write(ContentWriter output, LoonFileContent value)
 {
     output.Write(value.content);
 }
Ejemplo n.º 52
0
        protected void WriteValue(ContentWriter output, PlistObjectBase value)
        {
            if (value is PlistArray)
            {
                output.Write((byte)PlistDocument.ValueType.Array);

                var array = (PlistArray)value;
                output.Write(array.Count);
                for (int i = 0; i < array.Count; i++)
                {
                    WriteValue(output, array[i]);
                }
            }
            else if (value is PlistBoolean)
            {
                output.Write((byte)PlistDocument.ValueType.Bool);
                output.Write(value.AsBool);
            }
            else if (value is PlistData)
            {
                output.Write((byte)PlistDocument.ValueType.Data);
                output.Write(value.AsBinary);
            }
            else if (value is PlistDate)
            {
                output.Write((byte)PlistDocument.ValueType.Date);
                output.WriteObject(value.AsDate);
            }
            else if (value is PlistDictionary)
            {
                output.Write((byte)PlistDocument.ValueType.Dictionary);

                var dict = (PlistDictionary)value;
                output.Write(dict.Count);
                foreach (var pair in dict)
                {
                    int index = _stringPool[pair.Key];
                    output.Write(index);
                    WriteValue(output, pair.Value);
                }
            }
            else if (value is PlistInteger)
            {
                output.Write((byte)PlistDocument.ValueType.Integer);
                output.Write(value.AsInt);
            }
            else if (value is PlistNull)
            {
                output.Write((byte)PlistDocument.ValueType.Null);
            }
            else if (value is PlistReal)
            {
                output.Write((byte)PlistDocument.ValueType.Real);
                output.Write(value.AsFloat);
            }
            else if (value is PlistString)
            {
                int index = _stringPool[value.AsString];
                output.Write((byte)PlistDocument.ValueType.String);
                output.Write(index);
            }
        }
Ejemplo n.º 53
0
 public void Write(ContentWriter writer)
 {
     writer.WriteObject(this.texture);
     writer.WriteObject(this.animations);
 }
Ejemplo n.º 54
0
        /// <summary>
        /// Compiles an object into binary format.
        /// </summary>
        /// <param name="output">The content writer serializing the value.</param>
        /// <param name="theme">The resultant object.</param>
        protected override void Write(ContentWriter output, ThemeContent theme)
        {
            // Write cursors.
            output.Write(theme.Cursors.Count);
            foreach (var cursor in theme.Cursors)
            {
                output.Write(cursor.Name);
                output.Write(cursor.IsDefault);
                output.Write(cursor.FileName);
            }

            // Write fonts.
            output.Write(theme.Fonts.Count);
            foreach (var font in theme.Fonts)
            {
                output.Write(font.Name);
                output.Write(font.IsDefault);
                output.WriteExternalReference(font.Font);
            }

            // Write textures.
            output.Write(theme.Textures.Count);
            foreach (var texture in theme.Textures)
            {
                output.Write(texture.Name);
                output.Write(texture.IsDefault);
                output.WriteExternalReference(texture.Texture);
            }

            // Write styles.
            output.Write(theme.Styles.Count);
            foreach (var style in theme.Styles)
            {
                output.Write(style.Name);
                output.Write(style.Inherits ?? string.Empty);

                // Write attributes.
                output.Write(style.Attributes.Count);
                foreach (var attribute in style.Attributes)
                {
                    output.Write(attribute.Name);
                    output.Write(attribute.Value);
                }

                // Write states.
                output.Write(style.States.Count);
                foreach (var state in style.States)
                {
                    output.Write(state.Name);
                    output.Write(state.IsInherited);

                    // Write images.
                    output.Write(state.Images.Count);
                    foreach (var image in state.Images)
                    {
                        output.Write(image.Name ?? string.Empty);
                        output.Write(image.Texture ?? string.Empty);
                        output.WriteRawObject(image.SourceRectangle);
                        output.WriteRawObject(image.Margin);
                        output.Write((int)image.HorizontalAlignment);
                        output.Write((int)image.VerticalAlignment);
                        output.Write((int)image.TileMode);
                        output.WriteRawObject(image.Border);
                        output.Write(image.IsOverlay);
                        output.Write(image.Color);
                    }

                    bool hasBackground = state.Background.HasValue;
                    output.Write(hasBackground);
                    if (hasBackground)
                    {
                        output.Write(state.Background.Value);
                    }

                    bool hasForeground = state.Foreground.HasValue;
                    output.Write(hasForeground);
                    if (hasForeground)
                    {
                        output.Write(state.Foreground.Value);
                    }

                    bool hasOpacity = state.Opacity.HasValue;
                    output.Write(hasOpacity);
                    if (hasOpacity)
                    {
                        output.Write(state.Opacity.Value);
                    }
                }
            }
        }
Ejemplo n.º 55
0
 protected override void Write(ContentWriter output, TWrite value)
 {
     value.Write(output);
 }
Ejemplo n.º 56
0
 protected override void Render(ContentWriter cw, Vector2D offset)
 {
     cw.Ellipse(offset, Size);
 }
Ejemplo n.º 57
0
 protected override void Write(ContentWriter output, Keyframe value)
 {
     output.WriteObject(value.Bone);
     output.WriteObject(value.Time);
     output.WriteObject(value.Transform);
 }
Ejemplo n.º 58
0
    /// <summary>
    /// Converts the sequence to a PDF conent stream.
    /// </summary>
    public byte[] ToContent()
    {
      Stream stream = new MemoryStream();
      ContentWriter writer = new ContentWriter(stream);
      WriteObject(writer);
      writer.Close(false);

      stream.Position = 0;
      int count = (int)stream.Length;
      byte[] bytes = new byte[count];
      stream.Read(bytes, 0, count);
      stream.Close();
      return bytes;
    }
        protected override void Write(ContentWriter writer, TiledMapProcessorResult value)
        {
            var map = value.Map;

            writer.Write(HexToColor(map.BackgroundColor));
            writer.Write(ConvertRenderOrder(map.RenderOrder).ToString());
            writer.Write(map.Width);
            writer.Write(map.Height);
            writer.Write(map.TileWidth);
            writer.Write(map.TileHeight);
            writer.Write(Convert.ToInt32(map.Orientation));
            WriteCustomProperties(writer, map.Properties);

            writer.Write(map.Tilesets.Count);

            foreach (var tileset in map.Tilesets)
            {
                // ReSharper disable once AssignNullToNotNullAttribute
                writer.Write(Path.GetFileNameWithoutExtension(tileset.Image.Source));
                writer.Write(tileset.FirstGid);
                writer.Write(tileset.TileWidth);
                writer.Write(tileset.TileHeight);
                writer.Write(tileset.Spacing);
                writer.Write(tileset.Margin);
                WriteCustomProperties(writer, tileset.Properties);
            }

            writer.Write(map.Layers.Count);

            foreach (var layer in map.Layers)
            {
                writer.Write(layer.Name);
                writer.Write(layer.Visible);
                writer.Write(layer.Opacity);

                var tileLayer = layer as TmxTileLayer;

                if (tileLayer != null)
                {
                    writer.Write("TileLayer");
                    writer.Write(tileLayer.Data.Tiles.Count);

                    foreach (var tile in tileLayer.Data.Tiles)
                    {
                        writer.Write(tile.Gid);
                    }

                    writer.Write(tileLayer.Width);
                    writer.Write(tileLayer.Height);
                }

                var imageLayer = layer as TmxImageLayer;

                if (imageLayer != null)
                {
                    writer.Write("ImageLayer");
                    // ReSharper disable once AssignNullToNotNullAttribute
                    writer.Write(Path.GetFileNameWithoutExtension(imageLayer.Image.Source));
                    writer.Write(new Vector2(imageLayer.X, imageLayer.Y));
                }

                WriteCustomProperties(writer, layer.Properties);
            }
        }
Ejemplo n.º 60
0
 internal override void WriteObject(ContentWriter writer)
 {
   for (int idx = 0; idx < this.items.Count; idx++)
     (this.items[idx] as CObject).WriteObject(writer);
 }