- 更新 Player 结构体,添加 Nick 字段 - 修改 ErrorCode 类型从 uint32 改为 int32 - 优化 SocketHandler 处理逻辑 - 重构 Controller 中的 Login 和地图相关方法 - 更新地图服务中的 MapIn 和 MapOut 方法 - 调整空间服务中的 Hot 和 Walk 方法
37 lines
685 B
Go
37 lines
685 B
Go
package space
|
|
|
|
import xml "blazing/common/data/xml/map"
|
|
|
|
// MapHotInfo 表示地图热度信息
|
|
type MapHotInfo struct {
|
|
MapID uint32 `json:"mapId"` // 地图ID
|
|
Count uint32 `json:"count"` // 地图里的人数
|
|
}
|
|
|
|
func GetMapHot() []MapHotInfo {
|
|
|
|
tt := make(map[uint32]uint32)
|
|
|
|
for _, v := range xml.MapConfig.Maps {
|
|
|
|
t1, ok := tt[uint32(v.Super)]
|
|
if ok {
|
|
tt[uint32(v.Super)] = uint32(int(t1) + GetSpace(uint32(v.ID)).Len())
|
|
|
|
} else {
|
|
tt[uint32(v.Super)] = uint32(GetSpace(uint32(v.ID)).Len())
|
|
}
|
|
|
|
}
|
|
var result = make([]MapHotInfo, 0)
|
|
for k, v := range tt {
|
|
|
|
result = append(result, MapHotInfo{
|
|
MapID: uint32(k),
|
|
Count: uint32(v),
|
|
})
|
|
|
|
}
|
|
return result
|
|
}
|