Exemple #1
0
        public int Serialize(Stream stream)
        {
            int  size       = stream.PacketWriteUShort((ushort)Type);
            byte fieldCount = (byte)HasFields.Count();

            size += stream.PacketWriteByte(fieldCount);

            switch ((TypeEnum)Type)
            {
            case TypeEnum.Transform:

                size += Transform.Serialize(HasFields, stream);
                break;

            case TypeEnum.Movement:

                size += Movement.Serialize(HasFields, stream);
                break;

            case TypeEnum.Player:

                size += Player.Serialize(HasFields, stream);
                break;

            default:
                return(-1);
            }

            return(size);
        }
Exemple #2
0
        public int Serialize(Stream stream)
        {
            byte fieldCount = (byte)HasFields.Count();
            int  size       = stream.PacketWriteByte(fieldCount);

            size += Input.Serialize(HasFields, stream);

            return(size);
        }