상속: O2DMainItem
예제 #1
0
        void readColorPrimitive(ContentReader reader, O2DColorPrimitive colorPrim)
        {
            var count = reader.ReadInt32();

            // special care needs to be taken here. if we have 4 verts everything will be fine. If we have any other number we need to
            // reverse the array
            colorPrim.polygon = new Vector2[count];

            for (var i = 0; i < count; i++)
            {
                colorPrim.polygon[i] = reader.ReadVector2();
            }

            if (count != 4)
            {
                Array.Reverse(colorPrim.polygon);
            }
        }
예제 #2
0
        void readColorPrimitive(ContentReader reader, O2DColorPrimitive colorPrim)
        {
            var count = reader.ReadInt32();

            // special care needs to be taken here. if we have 4 verts everything will be fine. If we have any other number we need to close
            // the poly by duplicating the last vert then we need to reverse the array
            colorPrim.polygon = new Vector2[count == 4 ? count : count + 1];

            for (var i = 0; i < count; i++)
            {
                colorPrim.polygon[i] = reader.ReadVector2();
            }

            if (count != 4)
            {
                colorPrim.polygon[count] = colorPrim.polygon[0];
                Array.Reverse(colorPrim.polygon);
            }
        }
예제 #3
0
        O2DComposite readComposite(ContentReader reader)
        {
            var composite = new O2DComposite();

            var imageCount = reader.ReadInt32();

            for (var i = 0; i < imageCount; i++)
            {
                var image = new O2DImage();
                readMainItem(reader, image);
                image.imageName = reader.ReadString();

                composite.images.Add(image);
            }


            var colorPrimitiveCount = reader.ReadInt32();

            for (var i = 0; i < colorPrimitiveCount; i++)
            {
                var colorPrim = new O2DColorPrimitive();
                readMainItem(reader, colorPrim);
                readColorPrimitive(reader, colorPrim);

                composite.colorPrimitives.Add(colorPrim);
            }


            var compositeItemCount = reader.ReadInt32();

            for (var i = 0; i < compositeItemCount; i++)
            {
                var compositeItem = new O2DCompositeItem();
                readMainItem(reader, compositeItem);
                compositeItem.composite = readComposite(reader);

                composite.compositeItems.Add(compositeItem);
            }

            return(composite);
        }