示例#1
0
        public GfxFileReader(BinaryReader reader,
                             GilFileReader offsetTable, JilFileReader jobIndexList, DilFileReader directionIndexList, PaletteCollection paletteCollection)
        {
            this.offsetTable        = offsetTable;
            this.jobIndexList       = jobIndexList;
            this.directionIndexList = directionIndexList;
            this.paletteCollection  = paletteCollection;

            ReadResource(reader);

            reader.BaseStream.Seek(0, SeekOrigin.Begin);
            byte[] buffer = reader.ReadBytes((int)reader.BaseStream.Length);

            reader.BaseStream.Seek(HeaderSize, SeekOrigin.Begin);

            int count = offsetTable.GetImageCount();

            images = new GfxImage[count];

            for (int i = 0; i < count; i++)
            {
                int gfxOffset = offsetTable.GetImageOffset(i);

                int jobIndex = GetPaletteOffsetIndex(i);

                //Console.WriteLine($"JIL Offset: {jobIndex} == {reference}");


                images[i]          = ReadImage(reader, gfxOffset, paletteCollection.GetPalette(), paletteCollection.GetOffset(jobIndex), buffer);
                images[i].jobIndex = jobIndex;
            }

            //ChangeImageData(2, images[2].GetImageData());
        }