public void SaveChanges(BinaryWriter writer) { writer.Write(UnusedBytes); var spriteSheetsCount = (byte)Math.Min(SpriteSheets.Count, byte.MaxValue); for (int i = 0; i < spriteSheetsCount; i++) { var item = SpriteSheets[i]; writer.Write(StringEncoding.GetBytes(item)); } writer.Write((byte)0); //Write the "EndTexFlag" byte var animationsCount = (byte)Math.Min(Animations.Count, byte.MaxValue); writer.Write(animationsCount); for (int i = 0; i < animationsCount; i++) { Animations[i].SaveChanges(writer); } var collisionBoxesCount = (byte)Math.Min(Hitboxes.Count, byte.MaxValue); writer.Write(collisionBoxesCount); for (int i = 0; i < collisionBoxesCount; i++) { Hitboxes[i].SaveChanges(writer); } }
public void SaveChanges(BinaryWriter writer) { writer.Write(UnusedBytes); var spriteSheetsCount = (byte)Math.Min(SpriteSheets.Count, 4); int s = 0; for (; s < spriteSheetsCount; s++) { var item = SpriteSheets[s]; writer.Write(StringEncoding.GetBytes(item)); } for (; s < 4; s++) //write null sheets if applicable { writer.Write(StringEncoding.GetBytes("")); } var animationsCount = (byte)Math.Min(Animations.Count, byte.MaxValue); writer.Write(animationsCount); for (int i = 0; i < animationsCount; i++) { Animations[i].SaveChanges(writer); } var collisionBoxesCount = (byte)Math.Min(Hitboxes.Count, byte.MaxValue); writer.Write(collisionBoxesCount); for (int i = 0; i < collisionBoxesCount; i++) { Hitboxes[i].SaveChanges(writer); } }