Пример #1
0
 public virtual bool Load(MemoryStream _buf_)
 {
     try {
         if (false == Vector2Int_Serializer.Load(ref destination, _buf_))
         {
             return(false);
         }
     } catch (System.Exception) {
         return(false);
     }
     return(true);
 }
Пример #2
0
 public virtual bool Load(MemoryStream _buf_)
 {
     try {
         if (sizeof(ulong) > _buf_.Length - _buf_.Position)
         {
             return(false);
         }
         unit_seq        = BitConverter.ToUInt64(_buf_.GetBuffer(), (int)_buf_.Position);
         _buf_.Position += sizeof(ulong);
         if (false == Vector2Int_Serializer.Load(ref position, _buf_))
         {
             return(false);
         }
     } catch (System.Exception) {
         return(false);
     }
     return(true);
 }
Пример #3
0
 public virtual bool Load(MemoryStream _buf_)
 {
     try {
         if (false == ErrorCode_Serializer.Load(ref error_code, _buf_))
         {
             return(false);
         }
         if (sizeof(int) > _buf_.Length - _buf_.Position)
         {
             return(false);
         }
         width           = BitConverter.ToInt32(_buf_.GetBuffer(), (int)_buf_.Position);
         _buf_.Position += sizeof(int);
         if (sizeof(int) > _buf_.Length - _buf_.Position)
         {
             return(false);
         }
         height          = BitConverter.ToInt32(_buf_.GetBuffer(), (int)_buf_.Position);
         _buf_.Position += sizeof(int);
         if (sizeof(int) > _buf_.Length - _buf_.Position)
         {
             return(false);
         }
         int tiles_length = BitConverter.ToInt32(_buf_.GetBuffer(), (int)_buf_.Position);
         _buf_.Position += sizeof(int);
         for (int tiles_itr = 0; tiles_itr < tiles_length; tiles_itr++)
         {
             DungeonTileType tiles_val = new DungeonTileType();
             if (false == DungeonTileType_Serializer.Load(ref tiles_val, _buf_))
             {
                 return(false);
             }
             tiles.Add(tiles_val);
         }
         if (sizeof(ulong) > _buf_.Length - _buf_.Position)
         {
             return(false);
         }
         unit_seq        = BitConverter.ToUInt64(_buf_.GetBuffer(), (int)_buf_.Position);
         _buf_.Position += sizeof(ulong);
         if (false == Vector2Int_Serializer.Load(ref position, _buf_))
         {
             return(false);
         }
         if (sizeof(int) > _buf_.Length - _buf_.Position)
         {
             return(false);
         }
         int comrades_length = BitConverter.ToInt32(_buf_.GetBuffer(), (int)_buf_.Position);
         _buf_.Position += sizeof(int);
         for (int comrades_itr = 0; comrades_itr < comrades_length; comrades_itr++)
         {
             Player comrades_val = new Player();
             if (false == Player_Serializer.Load(ref comrades_val, _buf_))
             {
                 return(false);
             }
             comrades.Add(comrades_val);
         }
         if (sizeof(int) > _buf_.Length - _buf_.Position)
         {
             return(false);
         }
         int enemies_length = BitConverter.ToInt32(_buf_.GetBuffer(), (int)_buf_.Position);
         _buf_.Position += sizeof(int);
         for (int enemies_itr = 0; enemies_itr < enemies_length; enemies_itr++)
         {
             Monster enemies_val = new Monster();
             if (false == Monster_Serializer.Load(ref enemies_val, _buf_))
             {
                 return(false);
             }
             enemies.Add(enemies_val);
         }
     } catch (System.Exception) {
         return(false);
     }
     return(true);
 }