Exemple #1
0
        public void DeSerializeScene(MemoryStream ms)
        {
            BinaryReader binaryReader = new BinaryReader(ms);

            HideFilmEffector(0f, isBlocking: false);
            DrawScene("black", 0f);
            gameSystem.ExecuteActions();
            faceToUpperLayer  = binaryReader.ReadBoolean();
            useFilm           = binaryReader.ReadBoolean();
            useBlur           = binaryReader.ReadBoolean();
            useHorizontalBlur = binaryReader.ReadBoolean();
            filmPower         = binaryReader.ReadInt32();
            filmType          = binaryReader.ReadInt32();
            filmStyle         = binaryReader.ReadInt32();
            filmColor         = MGHelper.ReadColor(binaryReader);
            MGHelper.ReadVector3(binaryReader);
            MGHelper.ReadVector3(binaryReader);
            string backgroundfilename = binaryReader.ReadString();

            binaryReader.ReadSingle();
            binaryReader.ReadInt32();
            binaryReader.ReadInt32();
            DrawScene(backgroundfilename, 0.3f);
            if (binaryReader.ReadBoolean())
            {
                MGHelper.ReadVector3(binaryReader);
                MGHelper.ReadVector3(binaryReader);
                string texture = binaryReader.ReadString();
                binaryReader.ReadSingle();
                binaryReader.ReadInt32();
                binaryReader.ReadInt32();
                DrawFace(texture, 0f, isblocking: false);
            }
            for (int i = 0; i < 64; i++)
            {
                if (layers[i] != null && layers[i].IsInUse)
                {
                    layers[i].HideLayer();
                }
                if (binaryReader.ReadBoolean())
                {
                    Vector3 vector      = MGHelper.ReadVector3(binaryReader);
                    Vector3 scale       = MGHelper.ReadVector3(binaryReader);
                    string  textureName = binaryReader.ReadString();
                    float   alpha       = binaryReader.ReadSingle();
                    int     num         = binaryReader.ReadInt32();
                    int     type        = binaryReader.ReadInt32();
                    if (i != 50)
                    {
                        bool  isBustshot = num != 0;
                        Layer layer      = GetLayer(i);
                        UpdateLayerMask(layer, i);
                        layer.DrawLayer(textureName, (int)vector.x, (int)vector.y, 0, null, alpha, isBustshot, type, 0f, isBlocking: false);
                        layer.SetPriority(i);
                        layer.RestoreScaleAndPosition(scale, vector);
                    }
                }
            }
            if (useFilm)
            {
                CreateFilmEffector(filmType, filmColor, filmPower, filmStyle, 0f, isBlocking: false);
            }
            if (useHorizontalBlur)
            {
                CreateHorizontalGradation(filmPower, 0f, isBlocking: false);
            }
            SetFaceToUpperLayer(faceToUpperLayer);
            gameSystem.ExecuteActions();
        }