示例#1
0
文件: DCC.cs 项目: r2d2m/Diablerie
        static DCC Load(string filename, byte[] bytes, bool loadAllDirections = false)
        {
            DCC dcc = new DCC();

            dcc.bytes    = bytes;
            dcc.header   = new Header();
            dcc.textures = new List <Texture2D>();
            dcc.filename = filename;

            using (var stream = new MemoryStream(dcc.bytes))
                using (var reader = new BinaryReader(stream))
                {
                    ReadHeader(reader, dcc.header);
                }

            dcc.directionCount     = dcc.header.directionCount;
            dcc.framesPerDirection = dcc.header.framesPerDir;
            dcc.sprites            = new Sprite[dcc.header.directionCount][];

            if (loadAllDirections)
            {
                for (int d = 0; d < dcc.header.directionCount; ++d)
                {
                    dcc.DecodeDirection(d);
                }
            }

            return(dcc);
        }
示例#2
0
文件: DCC.cs 项目: r2d2m/Diablerie
 public static DCC Load(string filename, bool loadAllDirections = false, bool mpq = true)
 {
     UnityEngine.Profiling.Profiler.BeginSample("DCC.Load");
     try
     {
         var bytes = mpq ? Mpq.ReadAllBytes(filename) : File.ReadAllBytes(filename);
         DCC dcc   = Load(filename, bytes, loadAllDirections);
         return(dcc);
     }
     finally
     {
         UnityEngine.Profiling.Profiler.EndSample();
     }
 }