public override void Deserialize(System.IO.Stream stream) { base.Deserialize(stream); StreamReader sr = new StreamReader(stream); m_TextureFile = sr.ReadLine(); if (m_TextureFile == "null") { m_TextureFile = null; } else { CCLog.Log("CCSprite - deserialized with texture file " + m_TextureFile); InitWithFile(m_TextureFile); } Dirty = CCSerialization.DeSerializeBool(sr); IsTextureRectRotated = CCSerialization.DeSerializeBool(sr); AtlasIndex = CCSerialization.DeSerializeInt(sr); TextureRect = CCSerialization.DeSerializeRect(sr); OffsetPosition = CCSerialization.DeSerializePoint(sr); }
/// <summary> /// Tells the screen to deserialize its state from the given stream. /// </summary> public virtual void Deserialize(Stream stream) { StreamReader sr = new StreamReader(stream); m_bVisible = CCSerialization.DeSerializeBool(sr); m_fRotationX = CCSerialization.DeSerializeFloat(sr); m_fRotationY = CCSerialization.DeSerializeFloat(sr); m_fScaleX = CCSerialization.DeSerializeFloat(sr); m_fScaleY = CCSerialization.DeSerializeFloat(sr); m_fSkewX = CCSerialization.DeSerializeFloat(sr); m_fSkewY = CCSerialization.DeSerializeFloat(sr); m_fVertexZ = CCSerialization.DeSerializeFloat(sr); m_bIgnoreAnchorPointForPosition = CCSerialization.DeSerializeBool(sr); m_bInverseDirty = CCSerialization.DeSerializeBool(sr); m_bRunning = CCSerialization.DeSerializeBool(sr); m_bTransformDirty = CCSerialization.DeSerializeBool(sr); m_bReorderChildDirty = CCSerialization.DeSerializeBool(sr); m_uOrderOfArrival = (uint)CCSerialization.DeSerializeInt(sr); m_nTag = CCSerialization.DeSerializeInt(sr); m_nZOrder = CCSerialization.DeSerializeInt(sr); AnchorPoint = CCSerialization.DeSerializePoint(sr); ContentSize = CCSerialization.DeSerializeSize(sr); Position = CCSerialization.DeSerializePoint(sr); // m_UserData is handled by the specialized class. // TODO: Serializze the action manager // TODO :Serialize the grid // TODO: Serialize the camera string s; int count = CCSerialization.DeSerializeInt(sr); for (int i = 0; i < count; i++) { s = sr.ReadLine(); Type screenType = Type.GetType(s); CCNode scene = Activator.CreateInstance(screenType) as CCNode; AddChild(scene); scene.Deserialize(stream); } }