示例#1
0
    private void _LoadDummyEBG(BGSCENE_DEF sceneUS, String path, String newName, FieldMapLocalizeAreaTitleInfo info, String localizeSymbol)
    {
        this.name = newName;
        TextAsset textAsset = AssetManager.Load <TextAsset>(String.Concat(path, newName, "_", localizeSymbol, ".bgs"), false);

        if (textAsset == null)
        {
            return;
        }
        this.ebgBin = textAsset.bytes;
        using (BinaryReader binaryReader = new BinaryReader(new MemoryStream(this.ebgBin)))
        {
            this.ExtractHeaderData(binaryReader);
            this.ExtractOverlayData(binaryReader);
            Int32 atlasWidth       = info.atlasWidth;
            Int32 startOvrIdx      = info.startOvrIdx;
            Int32 endOvrIdx        = info.endOvrIdx;
            Int32 spriteStartIndex = info.GetSpriteStartIndex(localizeSymbol);
            Int32 num  = atlasWidth / 36;
            Int32 num2 = spriteStartIndex;
            for (Int32 i = startOvrIdx; i <= endOvrIdx; i++)
            {
                BGOVERLAY_DEF bGOVERLAY_DEF = this.overlayList[i];
                binaryReader.BaseStream.Seek(bGOVERLAY_DEF.prmOffset, SeekOrigin.Begin);
                for (Int32 j = 0; j < (Int32)bGOVERLAY_DEF.spriteCount; j++)
                {
                    BGSPRITE_LOC_DEF bGSPRITE_LOC_DEF = new BGSPRITE_LOC_DEF();
                    bGSPRITE_LOC_DEF.ReadData_BGSPRITE_DEF(binaryReader);
                    bGOVERLAY_DEF.spriteList.Add(bGSPRITE_LOC_DEF);
                }
                binaryReader.BaseStream.Seek(bGOVERLAY_DEF.locOffset, SeekOrigin.Begin);
                for (Int32 k = 0; k < (Int32)bGOVERLAY_DEF.spriteCount; k++)
                {
                    BGSPRITE_LOC_DEF bGSPRITE_LOC_DEF2 = bGOVERLAY_DEF.spriteList[k];
                    bGSPRITE_LOC_DEF2.ReadData_BGSPRITELOC_DEF(binaryReader);
                    if (this.useUpscaleFM)
                    {
                        bGSPRITE_LOC_DEF2.atlasX = (UInt16)(2 + num2 % num * 36);
                        bGSPRITE_LOC_DEF2.atlasY = (UInt16)(2 + num2 / num * 36);
                        bGSPRITE_LOC_DEF2.w      = 32;
                        bGSPRITE_LOC_DEF2.h      = 32;
                        num2++;
                    }
                }
            }
            for (Int32 l = startOvrIdx; l <= endOvrIdx; l++)
            {
                sceneUS.overlayList[l] = this.overlayList[l];
            }
        }
    }
示例#2
0
    private void ExtractSpriteData(BinaryReader reader)
    {
        this.spriteCount = 0;
        for (Int32 i = 0; i < (Int32)this.overlayCount; i++)
        {
            BGOVERLAY_DEF bGOVERLAY_DEF = this.overlayList[i];
            this.spriteCount += bGOVERLAY_DEF.spriteCount;
        }
        if (this.useUpscaleFM)
        {
            this.ATLAS_H = (UInt32)this.atlas.height;
            this.ATLAS_W = (UInt32)this.atlas.width;
        }
        Int32 num  = this.atlas.width / 36;
        Int32 num2 = 0;

        for (Int32 j = 0; j < (Int32)this.overlayCount; j++)
        {
            BGOVERLAY_DEF bGOVERLAY_DEF2 = this.overlayList[j];
            reader.BaseStream.Seek(bGOVERLAY_DEF2.prmOffset, SeekOrigin.Begin);
            for (Int32 k = 0; k < (Int32)bGOVERLAY_DEF2.spriteCount; k++)
            {
                BGSPRITE_LOC_DEF bGSPRITE_LOC_DEF = new BGSPRITE_LOC_DEF();
                bGSPRITE_LOC_DEF.ReadData_BGSPRITE_DEF(reader);
                bGOVERLAY_DEF2.spriteList.Add(bGSPRITE_LOC_DEF);
            }
            reader.BaseStream.Seek(bGOVERLAY_DEF2.locOffset, SeekOrigin.Begin);
            for (Int32 l = 0; l < (Int32)bGOVERLAY_DEF2.spriteCount; l++)
            {
                BGSPRITE_LOC_DEF bGSPRITE_LOC_DEF2 = bGOVERLAY_DEF2.spriteList[l];
                bGSPRITE_LOC_DEF2.ReadData_BGSPRITELOC_DEF(reader);
                if (this.useUpscaleFM)
                {
                    bGSPRITE_LOC_DEF2.atlasX = (UInt16)(2 + num2 % num * 36);
                    bGSPRITE_LOC_DEF2.atlasY = (UInt16)(2 + num2 / num * 36);
                    bGSPRITE_LOC_DEF2.w      = 32;
                    bGSPRITE_LOC_DEF2.h      = 32;
                    num2++;
                }
            }
        }
    }