Esempio n. 1
0
func NewCodec(connectClient Connect) packet.PacketCodec {
	packetCodecs := make([]packet.PacketCodec, len(connect.PacketCodecs))
	copy(packetCodecs, connect.PacketCodecs)
	packetCodecs[connect.PACKET_RESULT] = connect.NewPacketResultCodec(connectClient)
	return packet.NewPacketCodecVarIntLength(packet.NewPacketCodecRegistry(packetCodecs))
}
func NewCodecRegistry(connectClient Connect) (codec *packet.PacketCodecRegistry) {
	registryCodec := connect.PacketCodec.Copy()
	registryCodec.DecodeCodecs[connect.PACKET_RESULT] = connect.NewPacketResultCodec(connectClient)
	codec = registryCodec
	return
}