本文整理汇总了Golang中nonamelib/network.IPacket.ReadUint16方法的典型用法代码示例。如果您正苦于以下问题:Golang IPacket.ReadUint16方法的具体用法?Golang IPacket.ReadUint16怎么用?Golang IPacket.ReadUint16使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nonamelib/network.IPacket
的用法示例。
在下文中一共展示了IPacket.ReadUint16方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: ReadPacket
func (m *CreatureTurnMessage) ReadPacket(_packet pnet.IPacket) error {
direction, err := _packet.ReadUint16()
if err != nil {
return err
}
m.Direction = int(direction)
return nil
}
示例2: ReadPacket
// ReadPacket reads all data from a packet and puts it in the object
func (m *LoginMessage) ReadPacket(_packet pnet.IPacket) error {
var err error
if m.Username, err = _packet.ReadString(); err != nil {
return err
}
if m.Password, err = _packet.ReadString(); err != nil {
return err
}
clientVersion, err := _packet.ReadUint16()
if err != nil {
return err
}
m.ClientVersion = int(clientVersion)
return nil
}
示例3: ReadPacket
// ReadPacket reads all data from a packet and puts it in the object
func (m *WalkMessage) ReadPacket(_packet pnet.IPacket) (err error) {
direction, err := _packet.ReadUint16()
if err != nil {
return
}
m.Direction = int(direction)
sendMap, err := _packet.ReadUint16()
if err != nil {
return err
}
if sendMap == 1 {
m.SendMap = true
}
return nil
}
示例4: ReadPacket
func (m *ChatMessage) ReadPacket(_packet pnet.IPacket) (err error) {
speaktype, err := _packet.ReadUint8()
if err != nil {
return
}
m.SpeakType = int(speaktype)
channelId, err := _packet.ReadUint16()
if err != nil {
return
}
m.ChannelId = int(channelId)
if m.Receiver, err = _packet.ReadString(); err != nil {
return
}
if m.Text, err = _packet.ReadString(); err != nil {
return
}
return nil
}