示例#1
0
        public T Read <T>() where T : IPacketable <T>, new()
        {
            ReadData <T> data = PacketableHandler.Read(new T(), this);

            currentReadPosition = data.bytesRead;

            return(data.data);
        }
示例#2
0
        public void Write <T>(IPacketable <T>[] _data) where T : IPacketable <T>, new()
        {
            Write(_data.Length);

            for (int i = 0; i < _data.Length; i++)
            {
                buffer = PacketableHandler.Write(_data[i], this).buffer;
            }
        }
示例#3
0
        public T[] ReadArray <T>() where T : IPacketable <T>, new()
        {
            int size = ReadInt();

            T[] arr = new T[size];

            for (int i = 0; i < size; i++)
            {
                ReadData <T> data = PacketableHandler.Read(new T(), this);
                currentReadPosition = data.bytesRead;

                arr[i] = data.data;
            }

            return(arr);
        }
示例#4
0
 public void Write <T>(IPacketable <T> _data) where T : IPacketable <T>, new()
 {
     buffer = PacketableHandler.Write(_data, this).buffer;
 }