コード例 #1
0
ファイル: PLayer.cs プロジェクト: templeblock/fyri2deditor
        //****************************************************************
        // Serialization - Layers conditionally serialize their cameras.
        // This means that only the camera references that were unconditionally
        // (using GetObjectData) serialized by someone else will be restored
        // when the layer is unserialized.
        //****************************************************************

        /// <summary>
        /// Read this this layer and all its children from the given SerializationInfo.
        /// </summary>
        /// <param name="info">The SerializationInfo to read from.</param>
        /// <param name="context">
        /// The StreamingContext of this serialization operation.
        /// </param>
        /// <remarks>
        /// This constructor is required for Deserialization.
        /// </remarks>
        protected PLayer(SerializationInfo info, StreamingContext context)
            : base(info, context)
        {
            cameras = new PCameraList();

            int count = info.GetInt32("cameraCount");

            for (int i = 0; i < count; i++)
            {
                PCamera camera = (PCamera)info.GetValue("camera" + i, typeof(PCamera));
                if (camera != null)
                {
                    cameras.Add(camera);
                }
            }
        }
コード例 #2
0
 /// <summary>
 /// Constructs a new PLayer.
 /// </summary>
 public PLayer()
 {
     cameras = new PCameraList();
 }