- 更新 Player 结构体,添加 Nick 字段 - 修改 ErrorCode 类型从 uint32 改为 int32 - 优化 SocketHandler 处理逻辑 - 重构 Controller 中的 Login 和地图相关方法 - 更新地图服务中的 MapIn 和 MapOut 方法 - 调整空间服务中的 Hot 和 Walk 方法
27 lines
585 B
Go
27 lines
585 B
Go
package maps
|
|
|
|
import (
|
|
"blazing/common/data/entity"
|
|
"blazing/common/socket/handler"
|
|
"blazing/logic/service/space"
|
|
)
|
|
|
|
type LeaveMapOutboundInfo struct {
|
|
// 米米号
|
|
UserID uint32 `struc:"uint32" fieldDesc:"米米号" json:"user_id"`
|
|
}
|
|
|
|
type LeaveMapInboundInfo struct {
|
|
Head handler.TomeeHeader `cmd:"2002" struc:"[0]pad"` //切换地图
|
|
}
|
|
|
|
func (t *LeaveMapInboundInfo) Broadcast(mapid uint32, o LeaveMapOutboundInfo) {
|
|
|
|
space.GetSpace(mapid).Range(func(playerID uint32, player *entity.Player) bool {
|
|
t.Head.Result = 0
|
|
|
|
player.SendPack(t.Head.Pack(&o))
|
|
return true
|
|
})
|
|
}
|