本文整理匯總了Golang中packet.NewWriteBuff函數的典型用法代碼示例。如果您正苦於以下問題:Golang NewWriteBuff函數的具體用法?Golang NewWriteBuff怎麽用?Golang NewWriteBuff使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了NewWriteBuff函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: Encode
func (this *AckRoleLoginOk) Encode() []byte {
pack := packet.NewWriteBuff(64)
pack.WriteString(this.uname)
return pack.Encode(P_ACK_ROLE_LOGIN_OK)
}
示例2: Encode
func (this *AckSceneEnter) Encode() []byte {
pack := packet.NewWriteBuff(64)
pack.WriteBytes(this.player.Encode())
return pack.Encode(P_ACK_SCENE_ENTER)
}
示例3: Encode
func (this *MsgTestPhp) Encode() []byte {
pack := packet.NewWriteBuff(64)
pack.WriteUint16(this.u16)
return pack.ReadBytes()
}
示例4: Encode
func (this *AckSceneExit) Encode() []byte {
pack := packet.NewWriteBuff(64)
pack.WriteUint32(this.uid)
return pack.Encode(P_ACK_SCENE_EXIT)
}
示例5: Encode
func (this *ReqChatGm) Encode() []byte {
pack := packet.NewWriteBuff(64)
pack.WriteString(this.content)
return pack.Encode(P_REQ_CHAT_GM)
}
示例6: Encode
func (this *AckRoleRandNameOk) Encode() []byte {
pack := packet.NewWriteBuff(64)
pack.WriteString(this.uname)
return pack.Encode(P_ACK_ROLE_RAND_NAME_OK)
}
示例7: Encode
func (this *ReqSceneEnterFly) Encode() []byte {
pack := packet.NewWriteBuff(64)
pack.WriteUint32(this.mapId)
return pack.Encode(P_REQ_SCENE_ENTER_FLY)
}
示例8: Encode
func (this *MsgScenePlayer) Encode() []byte {
pack := packet.NewWriteBuff(64)
pack.WriteUint32(this.uid)
pack.WriteBytes(this.sceneRotPos.Encode())
return pack.ReadBytes()
}
示例9: Encode
func (this *MsgFriendBaseAdd) Encode() []byte {
pack := packet.NewWriteBuff(64)
pack.WriteUint32(this.uid)
pack.WriteString(this.uname)
return pack.ReadBytes()
}
示例10: Encode
func (this *ReqChatSend) Encode() []byte {
pack := packet.NewWriteBuff(64)
pack.WriteUint8(this.channel)
pack.WriteUint32(this.destUid)
pack.WriteString(this.content)
return pack.Encode(P_REQ_CHAT_SEND)
}
示例11: Encode
func (this *MsgSceneVector3) Encode() []byte {
pack := packet.NewWriteBuff(64)
pack.WriteInt16(this.x)
pack.WriteInt16(this.y)
pack.WriteInt16(this.z)
return pack.ReadBytes()
}
示例12: Encode
func (this *ReqSceneMove) Encode() []byte {
pack := packet.NewWriteBuff(64)
pack.WriteBytes(this.sceneRotPos.Encode())
pack.WriteBytes(this.forward.Encode())
pack.WriteString(this.aniName)
pack.WriteInt16(this.xAxis)
return pack.Encode(P_REQ_SCENE_MOVE)
}
示例13: Encode
func (this *AckChatSendOk) Encode() []byte {
pack := packet.NewWriteBuff(64)
pack.WriteUint8(this.channel)
pack.WriteUint32(this.uid)
pack.WriteString(this.uname)
pack.WriteString(this.content)
return pack.Encode(P_ACK_CHAT_SEND_OK)
}
示例14: Encode
func (this *AckScenePlayers) Encode() []byte {
pack := packet.NewWriteBuff(64)
playersCount := uint16(len(this.players))
pack.WriteUint16(playersCount)
for i := uint16(0); i < playersCount; i++ {
pack.WriteBytes(this.players[i].Encode())
}
return pack.Encode(P_ACK_SCENE_PLAYERS)
}
示例15: Encode
func (this *MsgSceneRotPos) Encode() []byte {
pack := packet.NewWriteBuff(64)
pack.WriteInt16(this.rotX)
pack.WriteInt16(this.rotY)
pack.WriteInt16(this.rotZ)
pack.WriteInt16(this.posX)
pack.WriteInt16(this.posY)
pack.WriteInt16(this.posZ)
return pack.ReadBytes()
}