コード例 #1
0
ファイル: Sprite.cs プロジェクト: zhangxv12138/SB3Utility
        public void LoadFrom(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);

            m_Name          = reader.ReadNameA4();
            m_Rect          = new Rectf(stream);
            m_Offset        = reader.ReadVector2();
            m_Border        = reader.ReadVector4();
            m_PixelsToUnits = reader.ReadSingle();
            m_Extrude       = reader.ReadUInt32();
            m_RD            = new SpriteRenderData(file, stream);
        }
コード例 #2
0
ファイル: Sprite.cs プロジェクト: kkdevs/sb3u
        public SpriteRenderData Clone(AssetCabinet file)
        {
            SpriteRenderData clone = new SpriteRenderData(file);

            clone.texture = new PPtr <Texture2D>(texture.instance != null ? texture.instance.Clone(file) : null);
            if (this.file.VersionNumber >= AssetCabinet.VERSION_5_0_0)
            {
                clone.alphaTexture = new PPtr <Texture2D>(alphaTexture.instance != null ? alphaTexture.instance.Clone(file) : null);
            }

            if (this.file.VersionNumber < AssetCabinet.VERSION_5_6_2)
            {
                clone.vertices = new SpriteVertex[vertices.Length];
                for (int i = 0; i < vertices.Length; i++)
                {
                    clone.vertices[i] = vertices[i].Clone();
                }

                clone.indices = (ushort[])indices.Clone();
            }
            else
            {
                clone.m_SubMeshes = new List <SubMesh>(m_SubMeshes.Count);
                for (int i = 0; i < m_SubMeshes.Count; i++)
                {
                    using (Stream stream = new MemoryStream())
                    {
                        m_SubMeshes[i].WriteTo(stream);
                        stream.Position = 0;
                        clone.m_SubMeshes.Add(new SubMesh(stream));
                    }
                }

                clone.m_IndexBuffer = (byte[])m_IndexBuffer.Clone();

                using (Stream stream = new MemoryStream())
                {
                    m_VertexData.WriteTo(stream, true);
                    stream.Position    = 0;
                    clone.m_VertexData = new VertexData(stream, true);
                }
            }

            clone.textureRect       = textureRect.Clone();
            clone.textureRectOffset = textureRectOffset;
            if (this.file.VersionNumber >= AssetCabinet.VERSION_5_5_0)
            {
                clone.atlasRectOffset = atlasRectOffset;
            }
            clone.settingsRaw = settingsRaw;
            clone.uvTransform = uvTransform;
            return(clone);
        }
コード例 #3
0
ファイル: Sprite.cs プロジェクト: zhangxv12138/SB3Utility
        public SpriteRenderData Clone(AssetCabinet file)
        {
            SpriteRenderData clone = new SpriteRenderData(file);

            clone.texture = new PPtr <Texture2D>(texture.instance != null ? texture.instance.Clone(file) : null);

            clone.vertices = new SpriteVertex[vertices.Length];
            for (int i = 0; i < vertices.Length; i++)
            {
                clone.vertices[i] = vertices[i].Clone();
            }

            clone.indices           = (ushort[])indices.Clone();
            clone.textureRect       = textureRect.Clone();
            clone.textureRectOffset = textureRectOffset;
            clone.settingsRaw       = settingsRaw;
            clone.uvTransform       = uvTransform;
            return(clone);
        }
コード例 #4
0
ファイル: Sprite.cs プロジェクト: kkdevs/sb3u
        public void LoadFrom(Stream stream)
        {
            BinaryReader reader = new BinaryReader(stream);

            m_Name          = reader.ReadNameA4U8();
            m_Rect          = new Rectf(stream);
            m_Offset        = reader.ReadVector2();
            m_Border        = reader.ReadVector4();
            m_PixelsToUnits = reader.ReadSingle();
            if (file.VersionNumber >= AssetCabinet.VERSION_5_4_1)
            {
                m_Pivot = reader.ReadVector2();
            }
            m_Extrude = reader.ReadUInt32();
            if (file.VersionNumber >= AssetCabinet.VERSION_5_0_0)
            {
                m_IsPolygon      = reader.ReadBoolean();
                stream.Position += 3;
            }
            m_RD = new SpriteRenderData(file, stream);
        }
コード例 #5
0
ファイル: Sprite.cs プロジェクト: hejob/SB3Utility
        public SpriteRenderData Clone(AssetCabinet file)
        {
            SpriteRenderData clone = new SpriteRenderData(file);
            clone.texture = new PPtr<Texture2D>(texture.instance != null ? texture.instance.Clone(file) : null);

            clone.vertices = new SpriteVertex[vertices.Length];
            for (int i = 0; i < vertices.Length; i++)
            {
                clone.vertices[i] = vertices[i].Clone();
            }

            clone.indices = (ushort[])indices.Clone();
            clone.textureRect = textureRect.Clone();
            clone.textureRectOffset = textureRectOffset;
            clone.settingsRaw = settingsRaw;
            clone.uvTransform = uvTransform;
            return clone;
        }
コード例 #6
0
ファイル: Sprite.cs プロジェクト: hejob/SB3Utility
 public void LoadFrom(Stream stream)
 {
     BinaryReader reader = new BinaryReader(stream);
     m_Name = reader.ReadNameA4();
     m_Rect = new Rectf(stream);
     m_Offset = reader.ReadVector2();
     m_Border = reader.ReadVector4();
     m_PixelsToUnits = reader.ReadSingle();
     m_Extrude = reader.ReadUInt32();
     m_RD = new SpriteRenderData(file, stream);
 }