Esempio n. 1
0
    public override void Deserialize(BinaryReader R)
    {
        base.Deserialize(R);
        int version = R.ReadInt32();

        if (version == 4 || version == 5)
        {
            mBackgroundColor.r = R.ReadSingle();
            mBackgroundColor.g = R.ReadSingle();
            mBackgroundColor.b = R.ReadSingle();

            for (int iX = 0; iX < 100; ++iX)
            {
                for (int iY = 0; iY < 100; ++iY)
                {
                    Color32 tileCol;
                    tileCol.r = R.ReadByte();
                    tileCol.g = R.ReadByte();
                    tileCol.b = R.ReadByte();
                    tileCol.a = 255;

                    mTileColors[iX, iY] = tileCol;

                    mWallX[iX, iY] = R.ReadInt32();
                    mWallZ[iX, iY] = R.ReadInt32();
                }
            }
        }

        if (version == 5)
        {
            mObjects.Clear();
            int metaCount = R.ReadInt32();
            for (int i = 0; i < metaCount; ++i)
            {
                CLevelMetaObject meta = new CLevelMetaObject();
                mObjects.Add(meta);

                meta.mID             = R.ReadInt32();
                meta.mType           = (CLevelMetaObject.EType)R.ReadInt32();
                meta.mSubtype        = R.ReadInt32();
                meta.mOwner          = R.ReadInt32();
                meta.mIdentifier     = R.ReadString();
                meta.mData           = R.ReadInt32();
                meta.mPositionA      = CUtility.ReadVec3(R);
                meta.mPositionB      = CUtility.ReadVec3(R);
                meta.mRotation       = R.ReadInt32();
                meta.mOrientation    = CUtility.ReadVec3(R);
                meta.mExtraIntData   = R.ReadInt32();
                meta.mExtraFloatData = R.ReadSingle();
                meta.mExtraBoolData  = R.ReadBoolean();
                meta.mColor          = CUtility.ReadColor(R);
            }
        }
    }