Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Jan 11th, 2012  |  syntax: C#  |  size: 1.31 KB  |  views: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.         public class AnimationContentReader : ContentTypeReader<Lib.Animation>
  2.         {
  3.             protected override Animation Read(
  4.                     ContentReader input,
  5.                     Animation existingInstance)
  6.             {
  7.  
  8.                 Animation anim = existingInstance;
  9.  
  10.                 if (anim == null)
  11.                 {
  12.                     anim = new Animation();
  13.                 }
  14.  
  15.                 anim.filename = input.ReadString();
  16.                 anim.Current_Frame = input.ReadInt32();
  17.                 anim.Number_Of_Frames = input.ReadInt32();
  18.                 anim.Max_Time_Per_Frame = input.ReadSingle();
  19.                 anim.Animate_Once = input.ReadBoolean();
  20.  
  21.                 anim.Rect = new List<Rectangle>();
  22.                 anim.Rect = (List<Rectangle>)input.ReadObject<List<Rectangle>>();
  23.                 anim.Vector2 = new List<Vector2>();
  24.                 anim.Vector2 = (List<Vector2>)input.ReadObject<List<Vector2>>();
  25.                 anim.Number_Of_Collision_Rects = new List<int>();
  26.                 anim.Number_Of_Collision_Rects = (List<int>)input.ReadObject<List<int>>();
  27.                 anim.CollisionRects = new List<Rect>();
  28.                 anim.CollisionRects = (List<Rect>)input.ReadObject<List<Rect>>();
  29.  
  30.                 return anim;
  31.             }
  32.         }
clone this paste RAW Paste Data