2025-08-15 19:24:02 +08:00
|
|
|
package controller
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"blazing/common/data/entity"
|
|
|
|
|
"blazing/common/socket/errorcode"
|
2025-08-18 00:38:14 +08:00
|
|
|
"blazing/common/socket/handler"
|
2025-08-15 22:44:28 +08:00
|
|
|
"blazing/logic/service/maps"
|
|
|
|
|
"blazing/logic/service/space"
|
2025-08-18 00:38:14 +08:00
|
|
|
"time"
|
2025-08-15 19:24:02 +08:00
|
|
|
)
|
|
|
|
|
|
2025-08-15 22:44:28 +08:00
|
|
|
func (h *Controller) MapIn(data *maps.InInfo, c *entity.Player) (result *maps.OutInfo, err errorcode.ErrorCode) { //这个时候player应该是空的
|
|
|
|
|
|
2025-08-16 03:36:13 +00:00
|
|
|
c.MapId = data.MapId //登录地图
|
|
|
|
|
space.GetSpace(c.MapId).Set(c.UserID, c) //添加玩家
|
2025-08-18 00:38:14 +08:00
|
|
|
tt := maps.NewOutInfo()
|
|
|
|
|
tt.UserID = c.UserID
|
|
|
|
|
tt.Nick = c.Nick
|
|
|
|
|
tt.Pos = data.Point
|
|
|
|
|
data.Broadcast(c.MapId, *tt) //同步广播
|
|
|
|
|
go func() { //测试刷怪
|
2025-08-15 19:24:02 +08:00
|
|
|
|
2025-08-18 00:38:14 +08:00
|
|
|
for {
|
|
|
|
|
tt := handler.NewTomeeHeader()
|
|
|
|
|
tt.CMD = 2004
|
|
|
|
|
tt.Result = 0
|
|
|
|
|
tt.UserID = c.UserID
|
|
|
|
|
t1 := maps.OgreInfo{}
|
|
|
|
|
for i := 0; i < 9; i++ {
|
|
|
|
|
t1.Data[i] = 1
|
|
|
|
|
}
|
2025-08-17 21:55:15 +08:00
|
|
|
|
2025-08-18 00:38:14 +08:00
|
|
|
c.SendPack(tt.Pack(&t1))
|
|
|
|
|
<-time.After(10000 * time.Millisecond)
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}()
|
2025-08-17 21:55:15 +08:00
|
|
|
return nil, -1
|
2025-08-15 19:24:02 +08:00
|
|
|
}
|