public override void Serialize(System.IO.Stream stream) { base.Serialize(stream); StreamWriter sw = new StreamWriter(stream); CCSerialization.SerializeData(IsTextureRectRotated, sw); CCSerialization.SerializeData(AtlasIndex, sw); CCSerialization.SerializeData(TextureRectInPixels, sw); sw.WriteLine(textureFile == null ? "null" : textureFile); }
public override void Deserialize(System.IO.Stream stream) { base.Deserialize(stream); StreamReader sr = new StreamReader(stream); textureFile = sr.ReadLine(); if (textureFile == "null") { textureFile = null; } else { CCLog.Log("CCSprite - deserialized with texture file " + textureFile); InitWithFile(textureFile); } IsTextureRectRotated = CCSerialization.DeSerializeBool(sr); AtlasIndex = CCSerialization.DeSerializeInt(sr); TextureRectInPixels = CCSerialization.DeSerializeRect(sr); }