예제 #1
0
func (p *playerClient) EchoMessage(msg string) {
	p.player.Enqueue(func(_ *Player) {
		buf := new(bytes.Buffer)
		proto.WriteChatMessage(buf, msg)
		p.TransmitPacket(buf.Bytes())
	})
}
예제 #2
0
func (game *Game) BroadcastMessage(msg string) {
	buf := new(bytes.Buffer)
	proto.WriteChatMessage(buf, msg)

	game.enqueue(func(_ *Game) {
		game.multicastPacket(buf.Bytes(), nil)
	})
}
예제 #3
0
func (player *Player) sendChatMessage(message string, sendToSelf bool) {
	buf := new(bytes.Buffer)
	proto.WriteChatMessage(buf, message)

	packet := buf.Bytes()

	if sendToSelf {
		player.TransmitPacket(packet)
	}

	player.chunkSubs.curShard.ReqMulticastPlayers(
		player.chunkSubs.curChunkLoc,
		player.EntityId,
		packet,
	)
}
예제 #4
0
func (game *Game) BroadcastMessage(msg string) {
	buf := new(bytes.Buffer)
	proto.WriteChatMessage(buf, msg)
	game.BroadcastPacket(buf.Bytes())
}