Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 5.26 KB | None | 0 0
  1. #region ReadRooms
  2.  
  3.         private ResourceCollection<Room> ReadRooms(ResourceCollection<Object> objects)
  4.         {
  5.             ReadInt();
  6.  
  7.             ResourceCollection<Room> rooms = new ResourceCollection<Room>();
  8.  
  9.             int count = ReadInt();
  10.  
  11.             for (int i = 0; i < count; i++)
  12.             {
  13.                 if (!ReadBool())
  14.                 {
  15.                     rooms.LastId++;
  16.                     continue;
  17.                 }
  18.  
  19.                 Room room = new Room();
  20.  
  21.                 room.Id = i;
  22.                 room.Name = ReadString();
  23.  
  24.                 ReadInt();
  25.  
  26.                 room.Caption = ReadString();
  27.                 room.Width = ReadInt();
  28.                 room.Height = ReadInt();
  29.                 room.SnapY = ReadInt();
  30.                 room.SnapX = ReadInt();
  31.                 room.IsometricGrid = ReadBool();
  32.  
  33.                 room.Speed = ReadInt();
  34.                 room.Persistent = ReadBool();
  35.                 room.BackgroundColor = ReadInt();
  36.                 room.DrawBackgroundColor = ReadBool();
  37.                 room.CreationCode = ReadString();
  38.  
  39.                 room.Parallaxs = new Parallax[ReadInt()];
  40.  
  41.                 for (int j = 0; j < room.Parallaxs.Length; j++)
  42.                 {
  43.                     room.Parallaxs[j] = new Parallax();
  44.  
  45.                     room.Parallaxs[j].Visible = ReadBool();
  46.                     room.Parallaxs[j].Foreground = ReadBool();
  47.                     room.Parallaxs[j].BackgroundId = ReadInt();
  48.                     room.Parallaxs[j].X = ReadInt();
  49.                     room.Parallaxs[j].Y = ReadInt();
  50.                     room.Parallaxs[j].TileHorizontally = ReadBool();
  51.                     room.Parallaxs[j].TileVertically = ReadBool();
  52.                     room.Parallaxs[j].HorizontalSpeed = ReadInt();
  53.                     room.Parallaxs[j].VerticalSpeed = ReadInt();
  54.  
  55.                     room.Parallaxs[j].Stretch = ReadBool();
  56.                 }
  57.  
  58.                 room.EnableViews = ReadBool();
  59.  
  60.                 room.Views = new View[ReadInt()];
  61.  
  62.                 for (int j = 0; j < room.Views.Length; j++)
  63.                 {
  64.                     room.Views[j] = new View();
  65.  
  66.                     room.Views[j].Visible = ReadBool();
  67.                     room.Views[j].ViewX = ReadInt();
  68.                     room.Views[j].ViewY = ReadInt();
  69.                     room.Views[j].ViewWidth = ReadInt();
  70.                     room.Views[j].ViewHeight = ReadInt();
  71.                     room.Views[j].PortX = ReadInt();
  72.                     room.Views[j].PortY = ReadInt();
  73.                     room.Views[j].PortWidth = ReadInt();
  74.                     room.Views[j].PortHeight = ReadInt();
  75.  
  76.                     room.Views[j].HorizontalBorder = ReadInt();
  77.                     room.Views[j].VerticalBorder = ReadInt();
  78.                     room.Views[j].HorizontalSpeed = ReadInt();
  79.                     room.Views[j].VerticalSpeed = ReadInt();
  80.                     room.Views[j].FollowObject = ReadInt();
  81.                 }
  82.  
  83.  
  84.                 int instanceCount = ReadInt();
  85.                 for (int j = 0; j < instanceCount; j++)
  86.                 {
  87.                     Instance instance = new Instance();
  88.  
  89.                     instance.X = ReadInt();
  90.                     instance.Y = ReadInt();
  91.                     instance.ObjectId = ReadInt();
  92.                     instance.Id = ReadInt();
  93.  
  94.                     instance.CreationCode = ReadString();
  95.                     instance.Locked = ReadBool();
  96.  
  97.                     Object obj = objects.Find(delegate(Object o) { return o.Id == instance.ObjectId; });
  98.  
  99.                     if (obj != null)
  100.                     {
  101.                         instance.Name = obj.Name;
  102.                         instance.Depth = obj.Depth;
  103.                     }
  104.  
  105.                     room.Instances.Add(instance);
  106.                 }
  107.  
  108.                 int tileCount = ReadInt();
  109.                 for (int j = 0; j < tileCount; j++)
  110.                 {
  111.                     Tile tile = new Tile();
  112.  
  113.                     tile.X = ReadInt();
  114.                     tile.Y = ReadInt();
  115.                     tile.BackgroundId = ReadInt();
  116.                     tile.BackgroundX = ReadInt();
  117.                     tile.BackgroundY = ReadInt();
  118.                     tile.Width = ReadInt();
  119.                     tile.Height = ReadInt();
  120.                     tile.Depth = ReadInt();
  121.                     tile.Locked = ReadBool();
  122.  
  123.                     room.Tiles.Add(tile);
  124.                 }
  125.  
  126.                 room.RememberWindowSize = ReadBool();
  127.                 room.EditorWidth = ReadInt();
  128.                 room.EditorHeight = ReadInt();
  129.                 room.ShowGrid = ReadBool();
  130.                 room.ShowObjects = ReadBool();
  131.                 room.ShowTiles = ReadBool();
  132.                 room.ShowBackgrounds = ReadBool();
  133.                 room.ShowForegrounds = ReadBool();
  134.                 room.ShowViews = ReadBool();
  135.                 room.DeleteUnderlyingObjects = ReadBool();
  136.                 room.DeleteUnderlyingTiles = ReadBool();
  137.                 room.CurrentTab = (TabSetting)ReadInt();
  138.                 room.ScrollBarX = ReadInt();
  139.                 room.ScrollBarY = ReadInt();
  140.  
  141.                 rooms.Add(room);
  142.             }
  143.  
  144.             return rooms;
  145.         }
  146.  
  147.         #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement