Advertisement
Guest User

Untitled

a guest
Feb 9th, 2012
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.68 KB | None | 0 0
  1.         public class MapContentReader : ContentTypeReader<Lib.Map>
  2.         {
  3.             protected override Map Read(
  4.                     ContentReader input,
  5.                     Map existingInstance)
  6.             {
  7.  
  8.                 Map map = existingInstance;
  9.  
  10.                 if (map == null)
  11.                 {
  12.                     map = new Map();
  13.                 }
  14.  
  15.                 map.filename = input.ReadString();
  16.                 map.numberOfLayers = input.ReadInt32();
  17.                 map.mapWidth = input.ReadInt32();
  18.                 map.mapHeight = input.ReadInt32();
  19.                 map.Map_Data = input.ReadString();
  20.                 map.Number_Of_Anim_Tiles = input.ReadInt32();
  21.  
  22.                 map.Animated_Tiles = input.ReadObject<List<AnimatedTiles>>();              
  23.                
  24.                 return map;
  25.             }
  26.         }
  27.  
  28. //AnimatedTiles Class
  29.     public class AnimatedTiles
  30.     {
  31.         #region Fields
  32.         private int positionX;
  33.         private int positionY;
  34.         private string ID;
  35.         #endregion
  36.  
  37.         #region Public Methods
  38.         public int PositionX
  39.         {
  40.             get { return positionX; }
  41.             set { positionX = value; }
  42.         }
  43.  
  44.         public int PositionY
  45.         {
  46.             get { return positionY; }
  47.             set { positionY = value; }
  48.         }
  49.  
  50.         public string Type
  51.         {
  52.             get { return ID; }
  53.             set { ID = value; }
  54.         }
  55.         #endregion
  56.  
  57.         public AnimatedTiles() { }
  58.  
  59.         public AnimatedTiles(int X, int Y, string tileID)
  60.         {
  61.             positionX = X;
  62.             positionY = Y;
  63.             ID = tileID;
  64.         }
  65.     }
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement