|
|
@ -149,7 +149,6 @@ func (p *Player) Talk(content string) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//广播玩家位置移动
|
|
|
|
func (p *Player) UpdatePos(x float32, y float32, z float32, v float32) { |
|
|
|
//更新玩家的位置信息
|
|
|
@ -214,20 +213,19 @@ func (p *Player) LostConnection() { |
|
|
|
WorldMgrObj.RemovePlayerByPid(p.Pid) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
发送消息给客户端, |
|
|
|
主要是将pb的protobuf数据序列化之后发送 |
|
|
|
*/ |
|
|
|
func (p *Player) SendMsg(msgId uint32, data proto.Message) { |
|
|
|
fmt.Printf("before Marshal data = %+v\n", data) |
|
|
|
//fmt.Printf("before Marshal data = %+v\n", data)
|
|
|
|
//将proto Message结构体序列化
|
|
|
|
msg, err := proto.Marshal(data) |
|
|
|
if err != nil { |
|
|
|
fmt.Println("marshal msg err: ", err) |
|
|
|
return |
|
|
|
} |
|
|
|
fmt.Printf("after Marshal data = %+v\n", msg) |
|
|
|
//fmt.Printf("after Marshal data = %+v\n", msg)
|
|
|
|
|
|
|
|
if p.Conn == nil { |
|
|
|
fmt.Println("connection in player is nil") |
|
|
|