本文整理匯總了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
}