本文整理汇总了Golang中github.com/LilyPad/GoLilyPad/packet.WriteString函数的典型用法代码示例。如果您正苦于以下问题:Golang WriteString函数的具体用法?Golang WriteString怎么用?Golang WriteString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WriteString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Encode
func (this *packetClientScoreboardObjectiveCodec) Encode(writer io.Writer, util []byte, encode packet.Packet) (err error) {
packetClientScoreboardObjective := encode.(*PacketClientScoreboardObjective)
err = packet.WriteString(writer, util, packetClientScoreboardObjective.Name)
if err != nil {
return
}
err = packet.WriteInt8(writer, util, packetClientScoreboardObjective.Action)
if err != nil {
return
}
switch packetClientScoreboardObjective.Action {
case PACKET_CLIENT_SCOREBOARD_OBJECTIVE_ACTION_ADD:
fallthrough
case PACKET_CLIENT_SCOREBOARD_OBJECTIVE_ACTION_UPDATE:
err = packet.WriteString(writer, util, packetClientScoreboardObjective.Value)
if err != nil {
return
}
err = packet.WriteString(writer, util, packetClientScoreboardObjective.Type)
case PACKET_CLIENT_SCOREBOARD_OBJECTIVE_ACTION_REMOVE:
// no payload
default:
err = errors.New(fmt.Sprintf("Encode, PacketClientScoreboardObjective action is not valid: %d", packetClientScoreboardObjective.Action))
}
return
}
示例2: Encode
func (this *PacketRedirectEventCodec) Encode(writer io.Writer, util []byte, encode packet.Packet) (err error) {
packetRedirectEvent := encode.(*PacketRedirectEvent)
err = packet.WriteString(writer, util, packetRedirectEvent.Server)
if err != nil {
return
}
err = packet.WriteString(writer, util, packetRedirectEvent.Player)
return
}
示例3: Encode
func (this *requestAuthenticateCodec) Encode(writer io.Writer, request Request) (err error) {
requestAuthenticate := request.(*RequestAuthenticate)
err = packet.WriteString(writer, requestAuthenticate.Username)
if err != nil {
return
}
err = packet.WriteString(writer, requestAuthenticate.Password)
return
}
示例4: Encode
func (this *packetClientLoginSuccessCodec) Encode(writer io.Writer, encode packet.Packet) (err error) {
packetClientLoginSuccess := encode.(*PacketClientLoginSuccess)
err = packet.WriteString(writer, packetClientLoginSuccess.UUID)
if err != nil {
return
}
err = packet.WriteString(writer, packetClientLoginSuccess.Name)
return
}
示例5: Encode
func (this *requestRedirectCodec) Encode(writer io.Writer, util []byte, request Request) (err error) {
requestRedirect := request.(*RequestRedirect)
err = packet.WriteString(writer, util, requestRedirect.Server)
if err != nil {
return
}
err = packet.WriteString(writer, util, requestRedirect.Player)
return
}
示例6: Encode
func (this *packetClientScoreboardObjectiveCodec17) Encode(writer io.Writer, encode packet.Packet) (err error) {
packetClientScoreboardObjective := encode.(*PacketClientScoreboardObjective)
err = packet.WriteString(writer, packetClientScoreboardObjective.Name)
if err != nil {
return
}
err = packet.WriteString(writer, packetClientScoreboardObjective.Value)
if err != nil {
return
}
err = packet.WriteInt8(writer, packetClientScoreboardObjective.Action)
return
}
示例7: Encode
func (this *packetClientJoinGameCodec17) Encode(writer io.Writer, encode packet.Packet) (err error) {
packetClientJoinGame := encode.(*PacketClientJoinGame)
err = packet.WriteInt32(writer, packetClientJoinGame.EntityId)
if err != nil {
return
}
err = packet.WriteInt8(writer, packetClientJoinGame.Gamemode)
if err != nil {
return
}
err = packet.WriteInt8(writer, packetClientJoinGame.Dimension)
if err != nil {
return
}
err = packet.WriteInt8(writer, packetClientJoinGame.Difficulty)
if err != nil {
return
}
err = packet.WriteInt8(writer, packetClientJoinGame.MaxPlayers)
if err != nil {
return
}
err = packet.WriteString(writer, packetClientJoinGame.LevelType)
return
}
示例8: Encode
func (this *packetServerClientSettingsCodec17) Encode(writer io.Writer, util []byte, encode packet.Packet) (err error) {
packetServerClientSettings := encode.(*PacketServerClientSettings)
err = packet.WriteString(writer, util, packetServerClientSettings.Locale)
if err != nil {
return
}
err = packet.WriteUint8(writer, util, packetServerClientSettings.ViewDistance)
if err != nil {
return
}
err = packet.WriteUint8(writer, util, packetServerClientSettings.ChatFlags)
if err != nil {
return
}
err = packet.WriteBool(writer, util, packetServerClientSettings.ChatColours)
if err != nil {
return
}
err = packet.WriteUint8(writer, util, packetServerClientSettings.difficulty17)
if err != nil {
return
}
err = packet.WriteBool(writer, util, packetServerClientSettings.ShowCape)
return
}
示例9: Encode
func (this *packetClientJoinGameCodec) Encode(writer io.Writer, util []byte, encode packet.Packet) (err error) {
packetClientJoinGame := encode.(*PacketClientJoinGame)
err = packet.WriteInt32(writer, util, packetClientJoinGame.EntityId)
if err != nil {
return
}
err = packet.WriteInt8(writer, util, packetClientJoinGame.Gamemode)
if err != nil {
return
}
err = packet.WriteInt8(writer, util, packetClientJoinGame.Dimension)
if err != nil {
return
}
err = packet.WriteInt8(writer, util, packetClientJoinGame.Difficulty)
if err != nil {
return
}
err = packet.WriteInt8(writer, util, packetClientJoinGame.MaxPlayers)
if err != nil {
return
}
err = packet.WriteString(writer, util, packetClientJoinGame.LevelType)
if err != nil {
return
}
err = packet.WriteBool(writer, util, packetClientJoinGame.ReducedDebugInfo)
return
}
示例10: Encode
func (this *packetMessageEventCodec) Encode(writer io.Writer, encode packet.Packet) (err error) {
packetMessageEvent := encode.(*PacketMessageEvent)
err = packet.WriteString(writer, packetMessageEvent.Sender)
if err != nil {
return
}
err = packet.WriteString(writer, packetMessageEvent.Channel)
if err != nil {
return
}
err = packet.WriteUint16(writer, uint16(len(packetMessageEvent.Payload)))
if err != nil {
return
}
_, err = writer.Write(packetMessageEvent.Payload)
return
}
示例11: Encode
func (this *resultGetDetailsCodec) Encode(writer io.Writer, result Result) (err error) {
resultGetDetails := result.(*ResultGetDetails)
err = packet.WriteString(writer, resultGetDetails.Ip)
if err != nil {
return
}
err = packet.WriteUint16(writer, resultGetDetails.Port)
if err != nil {
return
}
err = packet.WriteString(writer, resultGetDetails.Motd)
if err != nil {
return
}
err = packet.WriteString(writer, resultGetDetails.Version)
return
}
示例12: Encode
func (this *RequestAsServerCodec) Encode(writer io.Writer, util []byte, request Request) (err error) {
requestAsServer := request.(*RequestAsServer)
err = packet.WriteString(writer, util, requestAsServer.Address)
if err != nil {
return
}
err = packet.WriteUint16(writer, util, requestAsServer.Port)
return
}
示例13: Encode
func (this *packetServerPluginMessageCodec) Encode(writer io.Writer, encode packet.Packet) (err error) {
packetServerPluginMessage := encode.(*PacketServerPluginMessage)
err = packet.WriteString(writer, packetServerPluginMessage.Channel)
if err != nil {
return
}
_, err = writer.Write(packetServerPluginMessage.Data)
return
}
示例14: Encode
func (this *requestNotifyPlayerCodec) Encode(writer io.Writer, util []byte, request Request) (err error) {
requestNotifyPlayer := request.(*RequestNotifyPlayer)
err = packet.WriteBool(writer, util, requestNotifyPlayer.Add)
if err != nil {
return
}
err = packet.WriteString(writer, util, requestNotifyPlayer.Player)
return
}
示例15: Encode
func (this *requestAsProxyCodec) Encode(writer io.Writer, util []byte, request Request) (err error) {
requestAsProxy := request.(*RequestAsProxy)
err = packet.WriteString(writer, util, requestAsProxy.Address)
if err != nil {
return
}
err = packet.WriteUint16(writer, util, requestAsProxy.Port)
if err != nil {
return
}
err = packet.WriteString(writer, util, requestAsProxy.Motd)
if err != nil {
return
}
err = packet.WriteString(writer, util, requestAsProxy.Version)
if err != nil {
return
}
err = packet.WriteUint16(writer, util, requestAsProxy.MaxPlayers)
return
}