Пример #1
0
func decodeEquipUnLoadResponse(buffer *packet.Packet) interface{} {
	data := &EquipUnLoadResponse{}
	data.PlayerID = buffer.ReadString()
	data.EquipId = buffer.ReadString()
	data.Level = buffer.ReadUint32()
	return data
}
Пример #2
0
func decodeEquipUnLoadParams(buffer *packet.Packet) interface{} {
	data := &EquipUnLoadParams{}
	data.PlayerID = buffer.ReadString()
	data.EquipId = buffer.ReadString()
	data.HeroId = buffer.ReadString()
	return data
}
Пример #3
0
func decodeLoginResponse(buffer *packet.Packet) interface{} {
	data := &LoginResponse{}
	data.Uuid = buffer.ReadString()
	data.Level = buffer.ReadUint32()
	data.Exp = buffer.ReadFloat32()

	for i := 0; i < int(buffer.ReadUint16()); i++ {
		data.Equips = append(data.Equips, decodeEquipLoadResponse(buffer).(*EquipLoadResponse))
	}

	for i := 0; i < int(buffer.ReadUint16()); i++ {
		data.Friends = append(data.Friends, buffer.ReadString())
	}

	for i := 0; i < int(buffer.ReadUint16()); i++ {
		data.Ages = append(data.Ages, buffer.ReadInt32())
	}
	return data
}
Пример #4
0
func encodeLoginResponse(buffer *packet.Packet, value interface{}) {
	v := value.(*LoginResponse)
	buffer.WriteString(v.Uuid)
	buffer.WriteUint32(v.Level)
	buffer.WriteFloat32(v.Exp)

	buffer.WriteUint16(uint16(len(v.Equips)))
	for i := 0; i < len(v.Equips); i++ {
		encodeEquipLoadResponse(buffer, v.Equips[i])
	}

	buffer.WriteUint16(uint16(len(v.Friends)))
	for i := 0; i < len(v.Friends); i++ {
		buffer.WriteString(v.Friends[i])
	}

	buffer.WriteUint16(uint16(len(v.Ages)))
	for i := 0; i < len(v.Ages); i++ {
		buffer.WriteInt32(v.Ages[i])
	}
}
Пример #5
0
func encodeEquipUnLoadResponse(buffer *packet.Packet, value interface{}) {
	v := value.(*EquipUnLoadResponse)
	buffer.WriteString(v.PlayerID)
	buffer.WriteString(v.EquipId)
	buffer.WriteUint32(v.Level)
}
Пример #6
0
func encodeEquipUnLoadParams(buffer *packet.Packet, value interface{}) {
	v := value.(*EquipUnLoadParams)
	buffer.WriteString(v.PlayerID)
	buffer.WriteString(v.EquipId)
	buffer.WriteString(v.HeroId)
}