refactor(logic): 重构登录和地图相关逻辑

- 更新 Player 结构体,添加 Nick 字段
- 修改 ErrorCode 类型从 uint32 改为 int32
- 优化 SocketHandler 处理逻辑
- 重构 Controller 中的 Login 和地图相关方法
- 更新地图服务中的 MapIn 和 MapOut 方法
- 调整空间服务中的 Hot 和 Walk 方法
This commit is contained in:
2025-08-17 21:55:15 +08:00
parent 3bddd29daa
commit 9a6587a2da
15 changed files with 136 additions and 57 deletions

View File

@@ -25,9 +25,10 @@ func GetMapHot() []MapHotInfo {
}
var result = make([]MapHotInfo, 0)
for k, v := range tt {
result = append(result, MapHotInfo{
MapID: uint32(k),
Count: uint32(GetSpace(uint32(v)).Len()),
Count: uint32(v),
})
}

View File

@@ -20,9 +20,14 @@ type InInfo struct {
func (t *InInfo) Broadcast(mapid uint32, o OutInfo) {
GetSpace(mapid).Range(func(playerID uint32, player *entity.Player) bool {
//tt := planetmap
//g.Dump(GetSpace(mapid).Len())
player.SendPack(t.Head.Pack(o))
GetSpace(mapid).Range(func(playerID uint32, player *entity.Player) bool {
t.Head.Result = 0
tt := t.Head.Pack(&o)
err := player.SendPack(tt)
player.Cheak(err)
return true
})
}