public void SerializeScene(MemoryStream ms) { BinaryWriter binaryWriter = new BinaryWriter(ms); binaryWriter.Write(faceToUpperLayer); binaryWriter.Write(useFilm); binaryWriter.Write(useBlur); binaryWriter.Write(useHorizontalBlur); binaryWriter.Write(filmPower); binaryWriter.Write(filmType); binaryWriter.Write(filmStyle); MGHelper.WriteColor(binaryWriter, filmColor); if (activeScene == 0) { scene1.BackgroundLayer.Serialize(binaryWriter); } else { scene2.BackgroundLayer.Serialize(binaryWriter); } if (faceLayer.IsInUse) { binaryWriter.Write(value: true); faceLayer.Serialize(binaryWriter); } else { binaryWriter.Write(value: false); } for (int i = 0; i < 64; i++) { if (layers[i] == null) { binaryWriter.Write(value: false); } else if (layers[i].FadingOut || !layers[i].IsInUse) { binaryWriter.Write(value: false); } else { binaryWriter.Write(value: true); layers[i].Serialize(binaryWriter); } } }