Ejemplo n.º 1
0
 private void updateFrames(bool hasData, ref SpriteMetaTileFrame[][] frameData, int frame_length)
 {
     if (!hasData)
     {
         frameData = null;
     }
     else
     {
         SpriteMetaTileFrame[][] newData;
         newData = new SpriteMetaTileFrame[frame_length][];
         for (int i = 0; (i < newData.Length); i++)
         {
             newData[i] = new SpriteMetaTileFrame[TilesPerFrame];
         }
         if (frameData != null)
         {
             int i;
             for (i = 0; (i < newData.Length) && (i < frameData.Length); i++)
             {
                 int j;
                 for (j = 0; (j < newData[i].Length) && (j < frameData[i].Length); j++)
                 {
                     newData[i][j] = frameData[i][j];
                 }
                 for (; (j < newData[i].Length); j++)  // j is set by the previous for loop.
                 {
                     newData[i][j] = new SpriteMetaTileFrame();
                 }
             }
             for (; (i < newData.Length); i++) // i is set by the previous for loop.
             {
                 for (int j = 0; (j < newData[i].Length); j++)
                 {
                     newData[i][j] = new SpriteMetaTileFrame();
                 }
             }
         }
         else
         {
             for (int i = 0; i < newData.Length; i++)
             {
                 for (int j = 0; j < newData[i].Length; j++)
                 {
                     newData[i][j] = new SpriteMetaTileFrame();
                 }
             }
         }
         frameData = newData;
     }
 }
Ejemplo n.º 2
0
        // ================================================================================
        // Import/Export data
        // ================================================================================

        public void Unserialize(Core.BinaryFileReader reader, int version)
        {
            Name   = reader.ReadString();
            m_Data = reader.ReadByte();
            m_Tile = reader.ReadByte();
            if (HasStandardSprites)
            {
                m_StandardFrames = new SpriteMetaTileFrame[8][];
                for (int i = 0; i < 8; i++)
                {
                    m_StandardFrames[i] = new SpriteMetaTileFrame[TilesPerFrame];
                    for (int j = 0; j < m_StandardFrames[i].Length; j++)
                    {
                        m_StandardFrames[i][j] = new SpriteMetaTileFrame(reader, version);
                    }
                }
            }
            if (HasExtendedSprites)
            {
                m_ExtendedFrames = new SpriteMetaTileFrame[4][];
                for (int i = 0; i < 4; i++)
                {
                    m_ExtendedFrames[i] = new SpriteMetaTileFrame[TilesPerFrame];
                    for (int j = 0; j < m_ExtendedFrames[i].Length; j++)
                    {
                        m_ExtendedFrames[i][j] = new SpriteMetaTileFrame(reader, version);
                    }
                }
            }
            if (ExtraFrames != ExtraFramesEnum.Extra0)
            {
                m_ExtraFrames = new SpriteMetaTileFrame[ExtraFramesInt][];
                for (int i = 0; i < ExtraFramesInt; i++)
                {
                    m_ExtraFrames[i] = new SpriteMetaTileFrame[TilesPerFrame];
                    for (int j = 0; j < m_ExtraFrames[i].Length; j++)
                    {
                        m_ExtraFrames[i][j] = new SpriteMetaTileFrame(reader, version);
                    }
                }
            }
        }