mirror of
https://github.com/FlourishingWorld/hk4e.git
synced 2026-03-01 00:35:36 +08:00
调整场景相关协议组的顺序
This commit is contained in:
@@ -122,6 +122,12 @@ func (t *TickManager) onTick10Second(now int64) {
|
|||||||
sceneTimeNotify.SceneId = player.SceneId
|
sceneTimeNotify.SceneId = player.SceneId
|
||||||
sceneTimeNotify.SceneTime = uint64(scene.GetSceneTime())
|
sceneTimeNotify.SceneTime = uint64(scene.GetSceneTime())
|
||||||
GAME_MANAGER.SendMsg(cmd.SceneTimeNotify, player.PlayerID, player.ClientSeq, sceneTimeNotify)
|
GAME_MANAGER.SendMsg(cmd.SceneTimeNotify, player.PlayerID, player.ClientSeq, sceneTimeNotify)
|
||||||
|
// PacketPlayerTimeNotify
|
||||||
|
playerTimeNotify := new(proto.PlayerTimeNotify)
|
||||||
|
playerTimeNotify.IsPaused = player.Pause
|
||||||
|
playerTimeNotify.PlayerTime = uint64(player.TotalOnlineTime)
|
||||||
|
playerTimeNotify.ServerTime = uint64(time.Now().UnixMilli())
|
||||||
|
GAME_MANAGER.SendMsg(cmd.PlayerTimeNotify, player.PlayerID, player.ClientSeq, playerTimeNotify)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !world.IsBigWorld() && (world.multiplayer || !world.owner.Pause) {
|
if !world.IsBigWorld() && (world.multiplayer || !world.owner.Pause) {
|
||||||
|
|||||||
@@ -21,7 +21,8 @@ func (g *GameManager) UnionCmdNotify(player *model.Player, payloadMsg pb.Message
|
|||||||
|
|
||||||
// 只给附近aoi区域的玩家广播消息
|
// 只给附近aoi区域的玩家广播消息
|
||||||
surrPlayerList := make([]*model.Player, 0)
|
surrPlayerList := make([]*model.Player, 0)
|
||||||
entityIdList := world.aoiManager.GetEntityIdListByPos(float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
|
//entityIdList := world.aoiManager.GetEntityIdListByPos(float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
|
||||||
|
entityIdList := world.GetSceneById(player.SceneId).GetEntityIdList()
|
||||||
for _, entityId := range entityIdList {
|
for _, entityId := range entityIdList {
|
||||||
entity := scene.GetEntity(entityId)
|
entity := scene.GetEntity(entityId)
|
||||||
if entity == nil {
|
if entity == nil {
|
||||||
@@ -101,7 +102,8 @@ func (g *GameManager) MassiveEntityElementOpBatchNotify(player *model.Player, pa
|
|||||||
|
|
||||||
// 只给附近aoi区域的玩家广播消息
|
// 只给附近aoi区域的玩家广播消息
|
||||||
surrPlayerList := make([]*model.Player, 0)
|
surrPlayerList := make([]*model.Player, 0)
|
||||||
entityIdList := world.aoiManager.GetEntityIdListByPos(float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
|
//entityIdList := world.aoiManager.GetEntityIdListByPos(float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
|
||||||
|
entityIdList := world.GetSceneById(player.SceneId).GetEntityIdList()
|
||||||
for _, entityId := range entityIdList {
|
for _, entityId := range entityIdList {
|
||||||
entity := scene.GetEntity(entityId)
|
entity := scene.GetEntity(entityId)
|
||||||
if entity == nil {
|
if entity == nil {
|
||||||
@@ -160,7 +162,7 @@ func (g *GameManager) CombatInvocationsNotify(player *model.Player, payloadMsg p
|
|||||||
// aoi
|
// aoi
|
||||||
oldGid := world.aoiManager.GetGidByPos(float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
|
oldGid := world.aoiManager.GetGidByPos(float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
|
||||||
newGid := world.aoiManager.GetGidByPos(motionInfo.Pos.X, motionInfo.Pos.Y, motionInfo.Pos.Z)
|
newGid := world.aoiManager.GetGidByPos(motionInfo.Pos.X, motionInfo.Pos.Y, motionInfo.Pos.Z)
|
||||||
if oldGid != newGid {
|
if false && oldGid != newGid {
|
||||||
// 跨越了格子
|
// 跨越了格子
|
||||||
oldGridList := world.aoiManager.GetSurrGridListByGid(oldGid)
|
oldGridList := world.aoiManager.GetSurrGridListByGid(oldGid)
|
||||||
oldEntityIdMap := make(map[uint32]bool)
|
oldEntityIdMap := make(map[uint32]bool)
|
||||||
@@ -211,7 +213,7 @@ func (g *GameManager) CombatInvocationsNotify(player *model.Player, payloadMsg p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 发送已消失格子里的实体消失通知
|
// 发送已消失格子里的实体消失通知
|
||||||
g.RemoveSceneEntityNotifyToPlayer(player, delEntityIdList)
|
g.RemoveSceneEntityNotifyToPlayer(player, proto.VisionType_VISION_TYPE_REMOVE, delEntityIdList)
|
||||||
// 发送新出现格子里的实体出现通知
|
// 发送新出现格子里的实体出现通知
|
||||||
g.AddSceneEntityNotify(player, proto.VisionType_VISION_TYPE_BORN, addEntityIdList, false)
|
g.AddSceneEntityNotify(player, proto.VisionType_VISION_TYPE_BORN, addEntityIdList, false)
|
||||||
// 更新玩家的位置信息
|
// 更新玩家的位置信息
|
||||||
@@ -224,7 +226,7 @@ func (g *GameManager) CombatInvocationsNotify(player *model.Player, payloadMsg p
|
|||||||
// 其他玩家
|
// 其他玩家
|
||||||
for _, uid := range delUidList {
|
for _, uid := range delUidList {
|
||||||
otherPlayer := g.userManager.GetOnlineUser(uid)
|
otherPlayer := g.userManager.GetOnlineUser(uid)
|
||||||
g.RemoveSceneEntityNotifyToPlayer(otherPlayer, []uint32{playerActiveAvatarEntityId})
|
g.RemoveSceneEntityNotifyToPlayer(otherPlayer, proto.VisionType_VISION_TYPE_REMOVE, []uint32{playerActiveAvatarEntityId})
|
||||||
}
|
}
|
||||||
for _, uid := range addUidList {
|
for _, uid := range addUidList {
|
||||||
otherPlayer := g.userManager.GetOnlineUser(uid)
|
otherPlayer := g.userManager.GetOnlineUser(uid)
|
||||||
@@ -357,7 +359,8 @@ func (g *GameManager) ClientAbilityInitFinishNotify(player *model.Player, payloa
|
|||||||
|
|
||||||
// 只给附近aoi区域的玩家广播消息
|
// 只给附近aoi区域的玩家广播消息
|
||||||
surrPlayerList := make([]*model.Player, 0)
|
surrPlayerList := make([]*model.Player, 0)
|
||||||
entityIdList := world.aoiManager.GetEntityIdListByPos(float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
|
//entityIdList := world.aoiManager.GetEntityIdListByPos(float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
|
||||||
|
entityIdList := world.GetSceneById(player.SceneId).GetEntityIdList()
|
||||||
for _, entityId := range entityIdList {
|
for _, entityId := range entityIdList {
|
||||||
entity := scene.GetEntity(entityId)
|
entity := scene.GetEntity(entityId)
|
||||||
if entity == nil {
|
if entity == nil {
|
||||||
@@ -423,7 +426,8 @@ func (g *GameManager) ClientAbilityChangeNotify(player *model.Player, payloadMsg
|
|||||||
|
|
||||||
// 只给附近aoi区域的玩家广播消息
|
// 只给附近aoi区域的玩家广播消息
|
||||||
surrPlayerList := make([]*model.Player, 0)
|
surrPlayerList := make([]*model.Player, 0)
|
||||||
entityIdList := world.aoiManager.GetEntityIdListByPos(float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
|
//entityIdList := world.aoiManager.GetEntityIdListByPos(float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
|
||||||
|
entityIdList := world.GetSceneById(player.SceneId).GetEntityIdList()
|
||||||
for _, entityId := range entityIdList {
|
for _, entityId := range entityIdList {
|
||||||
entity := scene.GetEntity(entityId)
|
entity := scene.GetEntity(entityId)
|
||||||
if entity == nil {
|
if entity == nil {
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ func (g *GameManager) TeleportPlayer(player *model.Player, sceneId uint32, pos *
|
|||||||
oldScene := world.GetSceneById(oldSceneId)
|
oldScene := world.GetSceneById(oldSceneId)
|
||||||
activeAvatarId := player.TeamConfig.GetActiveAvatarId()
|
activeAvatarId := player.TeamConfig.GetActiveAvatarId()
|
||||||
playerTeamEntity := oldScene.GetPlayerTeamEntity(player.PlayerID)
|
playerTeamEntity := oldScene.GetPlayerTeamEntity(player.PlayerID)
|
||||||
g.RemoveSceneEntityNotifyBroadcast(oldScene, []uint32{playerTeamEntity.avatarEntityMap[activeAvatarId]})
|
g.RemoveSceneEntityNotifyBroadcast(oldScene, proto.VisionType_VISION_TYPE_REMOVE, []uint32{playerTeamEntity.avatarEntityMap[activeAvatarId]})
|
||||||
if jumpScene {
|
if jumpScene {
|
||||||
// PacketDelTeamEntityNotify
|
// PacketDelTeamEntityNotify
|
||||||
delTeamEntityNotify := g.PacketDelTeamEntityNotify(oldScene, player)
|
delTeamEntityNotify := g.PacketDelTeamEntityNotify(oldScene, player)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package game
|
package game
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"hk4e/pkg/object"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"hk4e/gs/constant"
|
"hk4e/gs/constant"
|
||||||
@@ -40,13 +41,13 @@ func (g *GameManager) PlayerApplyEnterMpResultReq(player *model.Player, payloadM
|
|||||||
applyUid := req.ApplyUid
|
applyUid := req.ApplyUid
|
||||||
isAgreed := req.IsAgreed
|
isAgreed := req.IsAgreed
|
||||||
|
|
||||||
g.UserDealEnterWorld(player, applyUid, isAgreed)
|
|
||||||
|
|
||||||
// PacketPlayerApplyEnterMpResultRsp
|
// PacketPlayerApplyEnterMpResultRsp
|
||||||
playerApplyEnterMpResultRsp := new(proto.PlayerApplyEnterMpResultRsp)
|
playerApplyEnterMpResultRsp := new(proto.PlayerApplyEnterMpResultRsp)
|
||||||
playerApplyEnterMpResultRsp.ApplyUid = applyUid
|
playerApplyEnterMpResultRsp.ApplyUid = applyUid
|
||||||
playerApplyEnterMpResultRsp.IsAgreed = isAgreed
|
playerApplyEnterMpResultRsp.IsAgreed = isAgreed
|
||||||
g.SendMsg(cmd.PlayerApplyEnterMpResultRsp, player.PlayerID, player.ClientSeq, playerApplyEnterMpResultRsp)
|
g.SendMsg(cmd.PlayerApplyEnterMpResultRsp, player.PlayerID, player.ClientSeq, playerApplyEnterMpResultRsp)
|
||||||
|
|
||||||
|
g.UserDealEnterWorld(player, applyUid, isAgreed)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameManager) PlayerGetForceQuitBanInfoReq(player *model.Player, payloadMsg pb.Message) {
|
func (g *GameManager) PlayerGetForceQuitBanInfoReq(player *model.Player, payloadMsg pb.Message) {
|
||||||
@@ -130,6 +131,50 @@ func (g *GameManager) SceneKickPlayerReq(player *model.Player, payloadMsg pb.Mes
|
|||||||
g.SendMsg(cmd.SceneKickPlayerRsp, player.PlayerID, player.ClientSeq, sceneKickPlayerRsp)
|
g.SendMsg(cmd.SceneKickPlayerRsp, player.PlayerID, player.ClientSeq, sceneKickPlayerRsp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *GameManager) JoinPlayerSceneReq(player *model.Player, payloadMsg pb.Message) {
|
||||||
|
logger.LOG.Debug("user join player scene, uid: %v", player.PlayerID)
|
||||||
|
req := payloadMsg.(*proto.JoinPlayerSceneReq)
|
||||||
|
|
||||||
|
hostPlayer := g.userManager.GetOnlineUser(req.TargetUid)
|
||||||
|
hostWorld := g.worldManager.GetWorldByID(hostPlayer.WorldId)
|
||||||
|
|
||||||
|
_, exist := hostWorld.waitEnterPlayerMap[player.PlayerID]
|
||||||
|
if !exist {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
joinPlayerSceneRsp := new(proto.JoinPlayerSceneRsp)
|
||||||
|
joinPlayerSceneRsp.Retcode = int32(proto.Retcode_RETCODE_RET_JOIN_OTHER_WAIT)
|
||||||
|
g.SendMsg(cmd.JoinPlayerSceneRsp, player.PlayerID, player.ClientSeq, joinPlayerSceneRsp)
|
||||||
|
|
||||||
|
world := g.worldManager.GetWorldByID(player.WorldId)
|
||||||
|
g.UserWorldRemovePlayer(world, player)
|
||||||
|
|
||||||
|
g.SendMsg(cmd.LeaveWorldNotify, player.PlayerID, 0, new(proto.LeaveWorldNotify))
|
||||||
|
|
||||||
|
//g.LoginNotify(player.PlayerID, player, 0)
|
||||||
|
|
||||||
|
if hostPlayer.SceneLoadState == model.SceneEnterDone {
|
||||||
|
delete(hostWorld.waitEnterPlayerMap, player.PlayerID)
|
||||||
|
player.Pos = &model.Vector{
|
||||||
|
X: hostPlayer.Pos.X,
|
||||||
|
Y: hostPlayer.Pos.Y,
|
||||||
|
Z: hostPlayer.Pos.Z,
|
||||||
|
}
|
||||||
|
player.Rot = &model.Vector{
|
||||||
|
X: hostPlayer.Rot.X,
|
||||||
|
Y: hostPlayer.Rot.Y,
|
||||||
|
Z: hostPlayer.Rot.Z,
|
||||||
|
}
|
||||||
|
player.SceneId = hostPlayer.SceneId
|
||||||
|
|
||||||
|
g.UserWorldAddPlayer(hostWorld, player)
|
||||||
|
|
||||||
|
player.SceneLoadState = model.SceneNone
|
||||||
|
g.SendMsg(cmd.PlayerEnterSceneNotify, player.PlayerID, 0, g.PacketPlayerEnterSceneNotifyLogin(player, proto.EnterType_ENTER_TYPE_OTHER))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (g *GameManager) UserApplyEnterWorld(player *model.Player, targetUid uint32) bool {
|
func (g *GameManager) UserApplyEnterWorld(player *model.Player, targetUid uint32) bool {
|
||||||
targetPlayer := g.userManager.GetOnlineUser(targetUid)
|
targetPlayer := g.userManager.GetOnlineUser(targetUid)
|
||||||
if targetPlayer == nil {
|
if targetPlayer == nil {
|
||||||
@@ -189,56 +234,49 @@ func (g *GameManager) UserDealEnterWorld(hostPlayer *model.Player, otherUid uint
|
|||||||
if !agree {
|
if !agree {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
world := g.worldManager.GetWorldByID(hostPlayer.WorldId)
|
||||||
hostWorld := g.worldManager.GetWorldByID(hostPlayer.WorldId)
|
world.waitEnterPlayerMap[otherPlayer.PlayerID] = time.Now().UnixMilli()
|
||||||
if hostWorld.multiplayer == false {
|
if world.multiplayer {
|
||||||
g.UserWorldRemovePlayer(hostWorld, hostPlayer)
|
return
|
||||||
|
|
||||||
hostWorld = g.worldManager.CreateWorld(hostPlayer, true)
|
|
||||||
g.UserWorldAddPlayer(hostWorld, hostPlayer)
|
|
||||||
hostPlayer.SceneLoadState = model.SceneNone
|
|
||||||
|
|
||||||
// PacketPlayerEnterSceneNotify
|
|
||||||
hostPlayerEnterSceneNotify := g.PacketPlayerEnterSceneNotifyMp(
|
|
||||||
hostPlayer,
|
|
||||||
hostPlayer,
|
|
||||||
proto.EnterType_ENTER_TYPE_GOTO,
|
|
||||||
uint32(constant.EnterReasonConst.HostFromSingleToMp),
|
|
||||||
hostPlayer.SceneId,
|
|
||||||
hostPlayer.Pos,
|
|
||||||
)
|
|
||||||
g.SendMsg(cmd.PlayerEnterSceneNotify, hostPlayer.PlayerID, hostPlayer.ClientSeq, hostPlayerEnterSceneNotify)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
otherWorld := g.worldManager.GetWorldByID(otherPlayer.WorldId)
|
world.ChangeToMP()
|
||||||
g.UserWorldRemovePlayer(otherWorld, otherPlayer)
|
|
||||||
|
|
||||||
otherPlayer.Pos = &model.Vector{
|
// PacketWorldDataNotify
|
||||||
X: hostPlayer.Pos.X,
|
worldDataNotify := new(proto.WorldDataNotify)
|
||||||
Y: hostPlayer.Pos.Y + 1,
|
worldDataNotify.WorldPropMap = make(map[uint32]*proto.PropValue)
|
||||||
Z: hostPlayer.Pos.Z,
|
// 是否多人游戏
|
||||||
|
worldDataNotify.WorldPropMap[2] = &proto.PropValue{
|
||||||
|
Type: 2,
|
||||||
|
Val: object.ConvBoolToInt64(world.multiplayer),
|
||||||
|
Value: &proto.PropValue_Ival{Ival: object.ConvBoolToInt64(world.multiplayer)},
|
||||||
}
|
}
|
||||||
otherPlayer.Rot = &model.Vector{
|
g.SendMsg(cmd.WorldDataNotify, hostPlayer.PlayerID, hostPlayer.ClientSeq, worldDataNotify)
|
||||||
X: hostPlayer.Rot.X,
|
|
||||||
Y: hostPlayer.Rot.Y,
|
|
||||||
Z: hostPlayer.Rot.Z,
|
|
||||||
}
|
|
||||||
otherPlayer.SceneId = hostPlayer.SceneId
|
|
||||||
|
|
||||||
g.UserWorldAddPlayer(hostWorld, otherPlayer)
|
hostPlayer.SceneLoadState = model.SceneNone
|
||||||
}
|
|
||||||
|
|
||||||
func (g *GameManager) JoinPlayerSceneReq(player *model.Player, payloadMsg pb.Message) {
|
// PacketPlayerEnterSceneNotify
|
||||||
joinPlayerSceneRsp := new(proto.JoinPlayerSceneRsp)
|
hostPlayerEnterSceneNotify := g.PacketPlayerEnterSceneNotifyMp(
|
||||||
joinPlayerSceneRsp.Retcode = int32(proto.Retcode_RETCODE_RET_JOIN_OTHER_WAIT)
|
hostPlayer,
|
||||||
g.SendMsg(cmd.JoinPlayerSceneRsp, player.PlayerID, player.ClientSeq, joinPlayerSceneRsp)
|
hostPlayer,
|
||||||
|
proto.EnterType_ENTER_TYPE_GOTO,
|
||||||
|
uint32(constant.EnterReasonConst.HostFromSingleToMp),
|
||||||
|
hostPlayer.SceneId,
|
||||||
|
hostPlayer.Pos,
|
||||||
|
)
|
||||||
|
g.SendMsg(cmd.PlayerEnterSceneNotify, hostPlayer.PlayerID, hostPlayer.ClientSeq, hostPlayerEnterSceneNotify)
|
||||||
|
|
||||||
g.SendMsg(cmd.LeaveWorldNotify, player.PlayerID, 0, new(proto.LeaveWorldNotify))
|
// PacketGuestBeginEnterSceneNotify
|
||||||
|
guestBeginEnterSceneNotify := new(proto.GuestBeginEnterSceneNotify)
|
||||||
|
guestBeginEnterSceneNotify.SceneId = hostPlayer.SceneId
|
||||||
|
guestBeginEnterSceneNotify.Uid = otherPlayer.PlayerID
|
||||||
|
g.SendMsg(cmd.GuestBeginEnterSceneNotify, hostPlayer.PlayerID, hostPlayer.ClientSeq, guestBeginEnterSceneNotify)
|
||||||
|
|
||||||
g.LoginNotify(player.PlayerID, player, 0)
|
// 仅仅把当前的场上角色的实体消失掉
|
||||||
|
scene := world.GetSceneById(hostPlayer.SceneId)
|
||||||
player.SceneLoadState = model.SceneNone
|
playerTeamEntity := scene.GetPlayerTeamEntity(hostPlayer.PlayerID)
|
||||||
g.SendMsg(cmd.PlayerEnterSceneNotify, player.PlayerID, 0, g.PacketPlayerEnterSceneNotifyLogin(player, proto.EnterType_ENTER_TYPE_OTHER))
|
activeAvatarId := hostPlayer.TeamConfig.GetActiveAvatarId()
|
||||||
|
g.RemoveSceneEntityNotifyToPlayer(hostPlayer, proto.VisionType_VISION_TYPE_MISS, []uint32{playerTeamEntity.avatarEntityMap[activeAvatarId]})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameManager) UserLeaveWorld(player *model.Player) bool {
|
func (g *GameManager) UserLeaveWorld(player *model.Player) bool {
|
||||||
@@ -282,8 +320,14 @@ func (g *GameManager) UserWorldRemovePlayer(world *World, player *model.Player)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PacketDelTeamEntityNotify
|
|
||||||
scene := world.GetSceneById(player.SceneId)
|
scene := world.GetSceneById(player.SceneId)
|
||||||
|
|
||||||
|
// 仅仅把当前的场上角色的实体消失掉
|
||||||
|
playerTeamEntity := scene.GetPlayerTeamEntity(player.PlayerID)
|
||||||
|
activeAvatarId := player.TeamConfig.GetActiveAvatarId()
|
||||||
|
g.RemoveSceneEntityNotifyToPlayer(player, proto.VisionType_VISION_TYPE_MISS, []uint32{playerTeamEntity.avatarEntityMap[activeAvatarId]})
|
||||||
|
|
||||||
|
// PacketDelTeamEntityNotify
|
||||||
delTeamEntityNotify := g.PacketDelTeamEntityNotify(scene, player)
|
delTeamEntityNotify := g.PacketDelTeamEntityNotify(scene, player)
|
||||||
g.SendMsg(cmd.DelTeamEntityNotify, player.PlayerID, player.ClientSeq, delTeamEntityNotify)
|
g.SendMsg(cmd.DelTeamEntityNotify, player.PlayerID, player.ClientSeq, delTeamEntityNotify)
|
||||||
|
|
||||||
@@ -295,7 +339,7 @@ func (g *GameManager) UserWorldRemovePlayer(world *World, player *model.Player)
|
|||||||
|
|
||||||
activeAvatarId := player.TeamConfig.GetActiveAvatarId()
|
activeAvatarId := player.TeamConfig.GetActiveAvatarId()
|
||||||
playerTeamEntity := scene.GetPlayerTeamEntity(player.PlayerID)
|
playerTeamEntity := scene.GetPlayerTeamEntity(player.PlayerID)
|
||||||
g.RemoveSceneEntityNotifyBroadcast(scene, []uint32{playerTeamEntity.avatarEntityMap[activeAvatarId]})
|
g.RemoveSceneEntityNotifyBroadcast(scene, proto.VisionType_VISION_TYPE_REMOVE, []uint32{playerTeamEntity.avatarEntityMap[activeAvatarId]})
|
||||||
}
|
}
|
||||||
|
|
||||||
world.RemovePlayer(player)
|
world.RemovePlayer(player)
|
||||||
@@ -313,13 +357,17 @@ func (g *GameManager) UserWorldRemovePlayer(world *World, player *model.Player)
|
|||||||
|
|
||||||
func (g *GameManager) UpdateWorldPlayerInfo(hostWorld *World, excludePlayer *model.Player) {
|
func (g *GameManager) UpdateWorldPlayerInfo(hostWorld *World, excludePlayer *model.Player) {
|
||||||
for _, worldPlayer := range hostWorld.playerMap {
|
for _, worldPlayer := range hostWorld.playerMap {
|
||||||
if worldPlayer.PlayerID == excludePlayer.PlayerID || worldPlayer.SceneLoadState == model.SceneNone {
|
if worldPlayer.PlayerID == excludePlayer.PlayerID {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
scene := hostWorld.GetSceneById(worldPlayer.SceneId)
|
||||||
|
|
||||||
// PacketSceneTeamUpdateNotify
|
// PacketPlayerPreEnterMpNotify
|
||||||
sceneTeamUpdateNotify := g.PacketSceneTeamUpdateNotify(hostWorld)
|
playerPreEnterMpNotify := new(proto.PlayerPreEnterMpNotify)
|
||||||
g.SendMsg(cmd.SceneTeamUpdateNotify, worldPlayer.PlayerID, worldPlayer.ClientSeq, sceneTeamUpdateNotify)
|
playerPreEnterMpNotify.State = proto.PlayerPreEnterMpNotify_STATE_START
|
||||||
|
playerPreEnterMpNotify.Uid = excludePlayer.PlayerID
|
||||||
|
playerPreEnterMpNotify.Nickname = excludePlayer.NickName
|
||||||
|
g.SendMsg(cmd.PlayerPreEnterMpNotify, worldPlayer.PlayerID, worldPlayer.ClientSeq, playerPreEnterMpNotify)
|
||||||
|
|
||||||
// PacketWorldPlayerInfoNotify
|
// PacketWorldPlayerInfoNotify
|
||||||
worldPlayerInfoNotify := new(proto.WorldPlayerInfoNotify)
|
worldPlayerInfoNotify := new(proto.WorldPlayerInfoNotify)
|
||||||
@@ -338,6 +386,12 @@ func (g *GameManager) UpdateWorldPlayerInfo(hostWorld *World, excludePlayer *mod
|
|||||||
}
|
}
|
||||||
g.SendMsg(cmd.WorldPlayerInfoNotify, worldPlayer.PlayerID, worldPlayer.ClientSeq, worldPlayerInfoNotify)
|
g.SendMsg(cmd.WorldPlayerInfoNotify, worldPlayer.PlayerID, worldPlayer.ClientSeq, worldPlayerInfoNotify)
|
||||||
|
|
||||||
|
// PacketSceneTimeNotify
|
||||||
|
sceneTimeNotify := new(proto.SceneTimeNotify)
|
||||||
|
sceneTimeNotify.SceneId = worldPlayer.SceneId
|
||||||
|
sceneTimeNotify.SceneTime = uint64(scene.GetSceneTime())
|
||||||
|
g.SendMsg(cmd.SceneTimeNotify, worldPlayer.PlayerID, worldPlayer.ClientSeq, sceneTimeNotify)
|
||||||
|
|
||||||
// PacketScenePlayerInfoNotify
|
// PacketScenePlayerInfoNotify
|
||||||
scenePlayerInfoNotify := new(proto.ScenePlayerInfoNotify)
|
scenePlayerInfoNotify := new(proto.ScenePlayerInfoNotify)
|
||||||
for _, subWorldPlayer := range hostWorld.playerMap {
|
for _, subWorldPlayer := range hostWorld.playerMap {
|
||||||
@@ -360,6 +414,10 @@ func (g *GameManager) UpdateWorldPlayerInfo(hostWorld *World, excludePlayer *mod
|
|||||||
}
|
}
|
||||||
g.SendMsg(cmd.ScenePlayerInfoNotify, worldPlayer.PlayerID, worldPlayer.ClientSeq, scenePlayerInfoNotify)
|
g.SendMsg(cmd.ScenePlayerInfoNotify, worldPlayer.PlayerID, worldPlayer.ClientSeq, scenePlayerInfoNotify)
|
||||||
|
|
||||||
|
// PacketSceneTeamUpdateNotify
|
||||||
|
sceneTeamUpdateNotify := g.PacketSceneTeamUpdateNotify(hostWorld)
|
||||||
|
g.SendMsg(cmd.SceneTeamUpdateNotify, worldPlayer.PlayerID, worldPlayer.ClientSeq, sceneTeamUpdateNotify)
|
||||||
|
|
||||||
// PacketSyncTeamEntityNotify
|
// PacketSyncTeamEntityNotify
|
||||||
syncTeamEntityNotify := new(proto.SyncTeamEntityNotify)
|
syncTeamEntityNotify := new(proto.SyncTeamEntityNotify)
|
||||||
syncTeamEntityNotify.SceneId = worldPlayer.SceneId
|
syncTeamEntityNotify.SceneId = worldPlayer.SceneId
|
||||||
|
|||||||
@@ -19,10 +19,11 @@ import (
|
|||||||
func (g *GameManager) EnterSceneReadyReq(player *model.Player, payloadMsg pb.Message) {
|
func (g *GameManager) EnterSceneReadyReq(player *model.Player, payloadMsg pb.Message) {
|
||||||
logger.LOG.Debug("user enter scene ready, uid: %v", player.PlayerID)
|
logger.LOG.Debug("user enter scene ready, uid: %v", player.PlayerID)
|
||||||
|
|
||||||
|
world := g.worldManager.GetWorldByID(player.WorldId)
|
||||||
|
|
||||||
// PacketEnterScenePeerNotify
|
// PacketEnterScenePeerNotify
|
||||||
enterScenePeerNotify := new(proto.EnterScenePeerNotify)
|
enterScenePeerNotify := new(proto.EnterScenePeerNotify)
|
||||||
enterScenePeerNotify.DestSceneId = player.SceneId
|
enterScenePeerNotify.DestSceneId = player.SceneId
|
||||||
world := g.worldManager.GetWorldByID(player.WorldId)
|
|
||||||
enterScenePeerNotify.PeerId = player.PeerId
|
enterScenePeerNotify.PeerId = player.PeerId
|
||||||
enterScenePeerNotify.HostPeerId = world.owner.PeerId
|
enterScenePeerNotify.HostPeerId = world.owner.PeerId
|
||||||
enterScenePeerNotify.EnterSceneToken = player.EnterSceneToken
|
enterScenePeerNotify.EnterSceneToken = player.EnterSceneToken
|
||||||
@@ -37,120 +38,123 @@ func (g *GameManager) EnterSceneReadyReq(player *model.Player, payloadMsg pb.Mes
|
|||||||
func (g *GameManager) SceneInitFinishReq(player *model.Player, payloadMsg pb.Message) {
|
func (g *GameManager) SceneInitFinishReq(player *model.Player, payloadMsg pb.Message) {
|
||||||
logger.LOG.Debug("user scene init finish, uid: %v", player.PlayerID)
|
logger.LOG.Debug("user scene init finish, uid: %v", player.PlayerID)
|
||||||
|
|
||||||
|
world := g.worldManager.GetWorldByID(player.WorldId)
|
||||||
|
scene := world.GetSceneById(player.SceneId)
|
||||||
|
|
||||||
// PacketServerTimeNotify
|
// PacketServerTimeNotify
|
||||||
serverTimeNotify := new(proto.ServerTimeNotify)
|
serverTimeNotify := new(proto.ServerTimeNotify)
|
||||||
serverTimeNotify.ServerTime = uint64(time.Now().UnixMilli())
|
serverTimeNotify.ServerTime = uint64(time.Now().UnixMilli())
|
||||||
g.SendMsg(cmd.ServerTimeNotify, player.PlayerID, player.ClientSeq, serverTimeNotify)
|
g.SendMsg(cmd.ServerTimeNotify, player.PlayerID, player.ClientSeq, serverTimeNotify)
|
||||||
|
|
||||||
// PacketWorldPlayerInfoNotify
|
if world.IsPlayerFirstEnter(player) {
|
||||||
worldPlayerInfoNotify := new(proto.WorldPlayerInfoNotify)
|
// PacketWorldPlayerInfoNotify
|
||||||
world := g.worldManager.GetWorldByID(player.WorldId)
|
worldPlayerInfoNotify := new(proto.WorldPlayerInfoNotify)
|
||||||
scene := world.GetSceneById(player.SceneId)
|
for _, worldPlayer := range world.playerMap {
|
||||||
for _, worldPlayer := range world.playerMap {
|
onlinePlayerInfo := new(proto.OnlinePlayerInfo)
|
||||||
onlinePlayerInfo := new(proto.OnlinePlayerInfo)
|
onlinePlayerInfo.Uid = worldPlayer.PlayerID
|
||||||
onlinePlayerInfo.Uid = worldPlayer.PlayerID
|
onlinePlayerInfo.Nickname = worldPlayer.NickName
|
||||||
onlinePlayerInfo.Nickname = worldPlayer.NickName
|
onlinePlayerInfo.PlayerLevel = worldPlayer.PropertiesMap[constant.PlayerPropertyConst.PROP_PLAYER_LEVEL]
|
||||||
onlinePlayerInfo.PlayerLevel = worldPlayer.PropertiesMap[constant.PlayerPropertyConst.PROP_PLAYER_LEVEL]
|
onlinePlayerInfo.MpSettingType = proto.MpSettingType(worldPlayer.PropertiesMap[constant.PlayerPropertyConst.PROP_PLAYER_MP_SETTING_TYPE])
|
||||||
onlinePlayerInfo.MpSettingType = proto.MpSettingType(worldPlayer.PropertiesMap[constant.PlayerPropertyConst.PROP_PLAYER_MP_SETTING_TYPE])
|
onlinePlayerInfo.NameCardId = worldPlayer.NameCard
|
||||||
onlinePlayerInfo.NameCardId = worldPlayer.NameCard
|
onlinePlayerInfo.Signature = worldPlayer.Signature
|
||||||
onlinePlayerInfo.Signature = worldPlayer.Signature
|
onlinePlayerInfo.ProfilePicture = &proto.ProfilePicture{AvatarId: worldPlayer.HeadImage}
|
||||||
onlinePlayerInfo.ProfilePicture = &proto.ProfilePicture{AvatarId: worldPlayer.HeadImage}
|
onlinePlayerInfo.CurPlayerNumInWorld = uint32(len(world.playerMap))
|
||||||
onlinePlayerInfo.CurPlayerNumInWorld = uint32(len(world.playerMap))
|
worldPlayerInfoNotify.PlayerInfoList = append(worldPlayerInfoNotify.PlayerInfoList, onlinePlayerInfo)
|
||||||
worldPlayerInfoNotify.PlayerInfoList = append(worldPlayerInfoNotify.PlayerInfoList, onlinePlayerInfo)
|
worldPlayerInfoNotify.PlayerUidList = append(worldPlayerInfoNotify.PlayerUidList, worldPlayer.PlayerID)
|
||||||
worldPlayerInfoNotify.PlayerUidList = append(worldPlayerInfoNotify.PlayerUidList, worldPlayer.PlayerID)
|
|
||||||
}
|
|
||||||
g.SendMsg(cmd.WorldPlayerInfoNotify, player.PlayerID, player.ClientSeq, worldPlayerInfoNotify)
|
|
||||||
|
|
||||||
// PacketWorldDataNotify
|
|
||||||
worldDataNotify := new(proto.WorldDataNotify)
|
|
||||||
worldDataNotify.WorldPropMap = make(map[uint32]*proto.PropValue)
|
|
||||||
// 世界等级
|
|
||||||
worldDataNotify.WorldPropMap[1] = &proto.PropValue{
|
|
||||||
Type: 1,
|
|
||||||
Val: int64(world.worldLevel),
|
|
||||||
Value: &proto.PropValue_Ival{Ival: int64(world.worldLevel)},
|
|
||||||
}
|
|
||||||
// 是否多人游戏
|
|
||||||
worldDataNotify.WorldPropMap[2] = &proto.PropValue{
|
|
||||||
Type: 2,
|
|
||||||
Val: object.ConvBoolToInt64(world.multiplayer),
|
|
||||||
Value: &proto.PropValue_Ival{Ival: object.ConvBoolToInt64(world.multiplayer)},
|
|
||||||
}
|
|
||||||
g.SendMsg(cmd.WorldDataNotify, player.PlayerID, player.ClientSeq, worldDataNotify)
|
|
||||||
|
|
||||||
// PacketPlayerWorldSceneInfoListNotify
|
|
||||||
playerWorldSceneInfoListNotify := new(proto.PlayerWorldSceneInfoListNotify)
|
|
||||||
playerWorldSceneInfoListNotify.InfoList = []*proto.PlayerWorldSceneInfo{
|
|
||||||
{SceneId: 1, IsLocked: true, SceneTagIdList: []uint32{}},
|
|
||||||
{SceneId: 3, IsLocked: false, SceneTagIdList: []uint32{102, 111, 112, 116, 118, 126, 135, 140, 142, 149, 1091, 1094, 1095, 1099, 1101, 1103, 1105, 1110, 1120, 1122, 1125, 1127, 1129, 1131, 1133, 1135, 1137, 1138, 1140, 1143, 1146, 1165, 1168}},
|
|
||||||
{SceneId: 4, IsLocked: true, SceneTagIdList: []uint32{}},
|
|
||||||
{SceneId: 5, IsLocked: false, SceneTagIdList: []uint32{121, 1031}},
|
|
||||||
{SceneId: 6, IsLocked: false, SceneTagIdList: []uint32{144, 146, 1062, 1063}},
|
|
||||||
{SceneId: 7, IsLocked: true, SceneTagIdList: []uint32{136, 137, 138, 148, 1034}},
|
|
||||||
{SceneId: 9, IsLocked: true, SceneTagIdList: []uint32{1012, 1016, 1021, 1022, 1060, 1077}},
|
|
||||||
}
|
|
||||||
g.SendMsg(cmd.PlayerWorldSceneInfoListNotify, player.PlayerID, player.ClientSeq, playerWorldSceneInfoListNotify)
|
|
||||||
|
|
||||||
// SceneForceUnlockNotify
|
|
||||||
g.SendMsg(cmd.SceneForceUnlockNotify, player.PlayerID, player.ClientSeq, new(proto.SceneForceUnlockNotify))
|
|
||||||
|
|
||||||
// PacketHostPlayerNotify
|
|
||||||
hostPlayerNotify := new(proto.HostPlayerNotify)
|
|
||||||
hostPlayerNotify.HostUid = world.owner.PlayerID
|
|
||||||
hostPlayerNotify.HostPeerId = world.owner.PeerId
|
|
||||||
g.SendMsg(cmd.HostPlayerNotify, player.PlayerID, player.ClientSeq, hostPlayerNotify)
|
|
||||||
|
|
||||||
// PacketSceneTimeNotify
|
|
||||||
sceneTimeNotify := new(proto.SceneTimeNotify)
|
|
||||||
sceneTimeNotify.SceneId = player.SceneId
|
|
||||||
sceneTimeNotify.SceneTime = uint64(scene.GetSceneTime())
|
|
||||||
g.SendMsg(cmd.SceneTimeNotify, player.PlayerID, player.ClientSeq, sceneTimeNotify)
|
|
||||||
|
|
||||||
// PacketPlayerGameTimeNotify
|
|
||||||
playerGameTimeNotify := new(proto.PlayerGameTimeNotify)
|
|
||||||
playerGameTimeNotify.GameTime = scene.gameTime
|
|
||||||
playerGameTimeNotify.Uid = player.PlayerID
|
|
||||||
g.SendMsg(cmd.PlayerGameTimeNotify, player.PlayerID, player.ClientSeq, playerGameTimeNotify)
|
|
||||||
|
|
||||||
// PacketPlayerEnterSceneInfoNotify
|
|
||||||
empty := new(proto.AbilitySyncStateInfo)
|
|
||||||
playerEnterSceneInfoNotify := new(proto.PlayerEnterSceneInfoNotify)
|
|
||||||
activeAvatarId := player.TeamConfig.GetActiveAvatarId()
|
|
||||||
playerTeamEntity := scene.GetPlayerTeamEntity(player.PlayerID)
|
|
||||||
playerEnterSceneInfoNotify.CurAvatarEntityId = playerTeamEntity.avatarEntityMap[activeAvatarId]
|
|
||||||
playerEnterSceneInfoNotify.EnterSceneToken = player.EnterSceneToken
|
|
||||||
playerEnterSceneInfoNotify.TeamEnterInfo = &proto.TeamEnterSceneInfo{
|
|
||||||
TeamEntityId: playerTeamEntity.teamEntityId,
|
|
||||||
TeamAbilityInfo: empty,
|
|
||||||
AbilityControlBlock: new(proto.AbilityControlBlock),
|
|
||||||
}
|
|
||||||
playerEnterSceneInfoNotify.MpLevelEntityInfo = &proto.MPLevelEntityInfo{
|
|
||||||
EntityId: g.worldManager.GetWorldByID(player.WorldId).mpLevelEntityId,
|
|
||||||
AuthorityPeerId: g.worldManager.GetWorldByID(player.WorldId).owner.PeerId,
|
|
||||||
AbilityInfo: empty,
|
|
||||||
}
|
|
||||||
activeTeam := player.TeamConfig.GetActiveTeam()
|
|
||||||
for _, avatarId := range activeTeam.AvatarIdList {
|
|
||||||
if avatarId == 0 {
|
|
||||||
break
|
|
||||||
}
|
}
|
||||||
avatar := player.AvatarMap[avatarId]
|
g.SendMsg(cmd.WorldPlayerInfoNotify, player.PlayerID, player.ClientSeq, worldPlayerInfoNotify)
|
||||||
avatarEnterSceneInfo := new(proto.AvatarEnterSceneInfo)
|
|
||||||
avatarEnterSceneInfo.AvatarGuid = avatar.Guid
|
|
||||||
avatarEnterSceneInfo.AvatarEntityId = playerTeamEntity.avatarEntityMap[avatarId]
|
|
||||||
avatarEnterSceneInfo.WeaponGuid = avatar.EquipWeapon.Guid
|
|
||||||
avatarEnterSceneInfo.WeaponEntityId = playerTeamEntity.weaponEntityMap[avatar.EquipWeapon.WeaponId]
|
|
||||||
avatarEnterSceneInfo.AvatarAbilityInfo = empty
|
|
||||||
avatarEnterSceneInfo.WeaponAbilityInfo = empty
|
|
||||||
playerEnterSceneInfoNotify.AvatarEnterInfo = append(playerEnterSceneInfoNotify.AvatarEnterInfo, avatarEnterSceneInfo)
|
|
||||||
}
|
|
||||||
g.SendMsg(cmd.PlayerEnterSceneInfoNotify, player.PlayerID, player.ClientSeq, playerEnterSceneInfoNotify)
|
|
||||||
|
|
||||||
// PacketSceneAreaWeatherNotify
|
// PacketWorldDataNotify
|
||||||
sceneAreaWeatherNotify := new(proto.SceneAreaWeatherNotify)
|
worldDataNotify := new(proto.WorldDataNotify)
|
||||||
sceneAreaWeatherNotify.WeatherAreaId = 0
|
worldDataNotify.WorldPropMap = make(map[uint32]*proto.PropValue)
|
||||||
sceneAreaWeatherNotify.ClimateType = uint32(constant.ClimateTypeConst.CLIMATE_SUNNY)
|
// 世界等级
|
||||||
g.SendMsg(cmd.SceneAreaWeatherNotify, player.PlayerID, player.ClientSeq, sceneAreaWeatherNotify)
|
worldDataNotify.WorldPropMap[1] = &proto.PropValue{
|
||||||
|
Type: 1,
|
||||||
|
Val: int64(world.worldLevel),
|
||||||
|
Value: &proto.PropValue_Ival{Ival: int64(world.worldLevel)},
|
||||||
|
}
|
||||||
|
// 是否多人游戏
|
||||||
|
worldDataNotify.WorldPropMap[2] = &proto.PropValue{
|
||||||
|
Type: 2,
|
||||||
|
Val: object.ConvBoolToInt64(world.multiplayer),
|
||||||
|
Value: &proto.PropValue_Ival{Ival: object.ConvBoolToInt64(world.multiplayer)},
|
||||||
|
}
|
||||||
|
g.SendMsg(cmd.WorldDataNotify, player.PlayerID, player.ClientSeq, worldDataNotify)
|
||||||
|
|
||||||
|
// PacketPlayerWorldSceneInfoListNotify
|
||||||
|
playerWorldSceneInfoListNotify := new(proto.PlayerWorldSceneInfoListNotify)
|
||||||
|
playerWorldSceneInfoListNotify.InfoList = []*proto.PlayerWorldSceneInfo{
|
||||||
|
{SceneId: 1, IsLocked: true, SceneTagIdList: []uint32{}},
|
||||||
|
{SceneId: 3, IsLocked: false, SceneTagIdList: []uint32{102, 111, 112, 116, 118, 126, 135, 140, 142, 149, 1091, 1094, 1095, 1099, 1101, 1103, 1105, 1110, 1120, 1122, 1125, 1127, 1129, 1131, 1133, 1135, 1137, 1138, 1140, 1143, 1146, 1165, 1168}},
|
||||||
|
{SceneId: 4, IsLocked: true, SceneTagIdList: []uint32{}},
|
||||||
|
{SceneId: 5, IsLocked: false, SceneTagIdList: []uint32{121, 1031}},
|
||||||
|
{SceneId: 6, IsLocked: false, SceneTagIdList: []uint32{144, 146, 1062, 1063}},
|
||||||
|
{SceneId: 7, IsLocked: true, SceneTagIdList: []uint32{136, 137, 138, 148, 1034}},
|
||||||
|
{SceneId: 9, IsLocked: true, SceneTagIdList: []uint32{1012, 1016, 1021, 1022, 1060, 1077}},
|
||||||
|
}
|
||||||
|
g.SendMsg(cmd.PlayerWorldSceneInfoListNotify, player.PlayerID, player.ClientSeq, playerWorldSceneInfoListNotify)
|
||||||
|
|
||||||
|
// SceneForceUnlockNotify
|
||||||
|
g.SendMsg(cmd.SceneForceUnlockNotify, player.PlayerID, player.ClientSeq, new(proto.SceneForceUnlockNotify))
|
||||||
|
|
||||||
|
// PacketHostPlayerNotify
|
||||||
|
hostPlayerNotify := new(proto.HostPlayerNotify)
|
||||||
|
hostPlayerNotify.HostUid = world.owner.PlayerID
|
||||||
|
hostPlayerNotify.HostPeerId = world.owner.PeerId
|
||||||
|
g.SendMsg(cmd.HostPlayerNotify, player.PlayerID, player.ClientSeq, hostPlayerNotify)
|
||||||
|
|
||||||
|
// PacketSceneTimeNotify
|
||||||
|
sceneTimeNotify := new(proto.SceneTimeNotify)
|
||||||
|
sceneTimeNotify.SceneId = player.SceneId
|
||||||
|
sceneTimeNotify.SceneTime = uint64(scene.GetSceneTime())
|
||||||
|
g.SendMsg(cmd.SceneTimeNotify, player.PlayerID, player.ClientSeq, sceneTimeNotify)
|
||||||
|
|
||||||
|
// PacketPlayerGameTimeNotify
|
||||||
|
playerGameTimeNotify := new(proto.PlayerGameTimeNotify)
|
||||||
|
playerGameTimeNotify.GameTime = scene.gameTime
|
||||||
|
playerGameTimeNotify.Uid = player.PlayerID
|
||||||
|
g.SendMsg(cmd.PlayerGameTimeNotify, player.PlayerID, player.ClientSeq, playerGameTimeNotify)
|
||||||
|
|
||||||
|
// PacketPlayerEnterSceneInfoNotify
|
||||||
|
empty := new(proto.AbilitySyncStateInfo)
|
||||||
|
playerEnterSceneInfoNotify := new(proto.PlayerEnterSceneInfoNotify)
|
||||||
|
activeAvatarId := player.TeamConfig.GetActiveAvatarId()
|
||||||
|
playerTeamEntity := scene.GetPlayerTeamEntity(player.PlayerID)
|
||||||
|
playerEnterSceneInfoNotify.CurAvatarEntityId = playerTeamEntity.avatarEntityMap[activeAvatarId]
|
||||||
|
playerEnterSceneInfoNotify.EnterSceneToken = player.EnterSceneToken
|
||||||
|
playerEnterSceneInfoNotify.TeamEnterInfo = &proto.TeamEnterSceneInfo{
|
||||||
|
TeamEntityId: playerTeamEntity.teamEntityId,
|
||||||
|
TeamAbilityInfo: empty,
|
||||||
|
AbilityControlBlock: new(proto.AbilityControlBlock),
|
||||||
|
}
|
||||||
|
playerEnterSceneInfoNotify.MpLevelEntityInfo = &proto.MPLevelEntityInfo{
|
||||||
|
EntityId: g.worldManager.GetWorldByID(player.WorldId).mpLevelEntityId,
|
||||||
|
AuthorityPeerId: 1,
|
||||||
|
AbilityInfo: empty,
|
||||||
|
}
|
||||||
|
activeTeam := player.TeamConfig.GetActiveTeam()
|
||||||
|
for _, avatarId := range activeTeam.AvatarIdList {
|
||||||
|
if avatarId == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
avatar := player.AvatarMap[avatarId]
|
||||||
|
avatarEnterSceneInfo := new(proto.AvatarEnterSceneInfo)
|
||||||
|
avatarEnterSceneInfo.AvatarGuid = avatar.Guid
|
||||||
|
avatarEnterSceneInfo.AvatarEntityId = playerTeamEntity.avatarEntityMap[avatarId]
|
||||||
|
avatarEnterSceneInfo.WeaponGuid = avatar.EquipWeapon.Guid
|
||||||
|
avatarEnterSceneInfo.WeaponEntityId = playerTeamEntity.weaponEntityMap[avatar.EquipWeapon.WeaponId]
|
||||||
|
avatarEnterSceneInfo.AvatarAbilityInfo = empty
|
||||||
|
avatarEnterSceneInfo.WeaponAbilityInfo = empty
|
||||||
|
playerEnterSceneInfoNotify.AvatarEnterInfo = append(playerEnterSceneInfoNotify.AvatarEnterInfo, avatarEnterSceneInfo)
|
||||||
|
}
|
||||||
|
g.SendMsg(cmd.PlayerEnterSceneInfoNotify, player.PlayerID, player.ClientSeq, playerEnterSceneInfoNotify)
|
||||||
|
|
||||||
|
// PacketSceneAreaWeatherNotify
|
||||||
|
sceneAreaWeatherNotify := new(proto.SceneAreaWeatherNotify)
|
||||||
|
sceneAreaWeatherNotify.WeatherAreaId = 0
|
||||||
|
sceneAreaWeatherNotify.ClimateType = uint32(constant.ClimateTypeConst.CLIMATE_SUNNY)
|
||||||
|
g.SendMsg(cmd.SceneAreaWeatherNotify, player.PlayerID, player.ClientSeq, sceneAreaWeatherNotify)
|
||||||
|
}
|
||||||
|
|
||||||
// PacketScenePlayerInfoNotify
|
// PacketScenePlayerInfoNotify
|
||||||
scenePlayerInfoNotify := new(proto.ScenePlayerInfoNotify)
|
scenePlayerInfoNotify := new(proto.ScenePlayerInfoNotify)
|
||||||
@@ -215,29 +219,67 @@ func (g *GameManager) SceneInitFinishReq(player *model.Player, payloadMsg pb.Mes
|
|||||||
func (g *GameManager) EnterSceneDoneReq(player *model.Player, payloadMsg pb.Message) {
|
func (g *GameManager) EnterSceneDoneReq(player *model.Player, payloadMsg pb.Message) {
|
||||||
logger.LOG.Debug("user enter scene done, uid: %v", player.PlayerID)
|
logger.LOG.Debug("user enter scene done, uid: %v", player.PlayerID)
|
||||||
|
|
||||||
|
world := g.worldManager.GetWorldByID(player.WorldId)
|
||||||
|
scene := world.GetSceneById(player.SceneId)
|
||||||
|
|
||||||
|
if world.multiplayer && world.IsPlayerFirstEnter(player) {
|
||||||
|
guestPostEnterSceneNotify := new(proto.GuestPostEnterSceneNotify)
|
||||||
|
guestPostEnterSceneNotify.SceneId = player.SceneId
|
||||||
|
guestPostEnterSceneNotify.Uid = player.PlayerID
|
||||||
|
g.SendMsg(cmd.GuestPostEnterSceneNotify, world.owner.PlayerID, world.owner.ClientSeq, guestPostEnterSceneNotify)
|
||||||
|
}
|
||||||
|
|
||||||
|
var visionType = proto.VisionType_VISION_TYPE_TRANSPORT
|
||||||
|
|
||||||
|
playerTeamEntity := scene.GetPlayerTeamEntity(player.PlayerID)
|
||||||
|
activeAvatarId := player.TeamConfig.GetActiveAvatarId()
|
||||||
|
if world.IsPlayerFirstEnter(player) {
|
||||||
|
visionType = proto.VisionType_VISION_TYPE_BORN
|
||||||
|
}
|
||||||
|
g.AddSceneEntityNotify(player, visionType, []uint32{playerTeamEntity.avatarEntityMap[activeAvatarId]}, true)
|
||||||
|
|
||||||
|
// 通过aoi获取场景中在自己周围格子里的全部实体id
|
||||||
|
//entityIdList := world.aoiManager.GetEntityIdListByPos(float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
|
||||||
|
entityIdList := world.GetSceneById(player.SceneId).GetEntityIdList()
|
||||||
|
if world.IsPlayerFirstEnter(player) {
|
||||||
|
visionType = proto.VisionType_VISION_TYPE_MEET
|
||||||
|
}
|
||||||
|
g.AddSceneEntityNotify(player, visionType, entityIdList, false)
|
||||||
|
|
||||||
|
// PacketSceneAreaWeatherNotify
|
||||||
|
sceneAreaWeatherNotify := new(proto.SceneAreaWeatherNotify)
|
||||||
|
sceneAreaWeatherNotify.WeatherAreaId = 0
|
||||||
|
sceneAreaWeatherNotify.ClimateType = uint32(constant.ClimateTypeConst.CLIMATE_SUNNY)
|
||||||
|
g.SendMsg(cmd.SceneAreaWeatherNotify, player.PlayerID, player.ClientSeq, sceneAreaWeatherNotify)
|
||||||
|
|
||||||
// PacketEnterSceneDoneRsp
|
// PacketEnterSceneDoneRsp
|
||||||
enterSceneDoneRsp := new(proto.EnterSceneDoneRsp)
|
enterSceneDoneRsp := new(proto.EnterSceneDoneRsp)
|
||||||
enterSceneDoneRsp.EnterSceneToken = player.EnterSceneToken
|
enterSceneDoneRsp.EnterSceneToken = player.EnterSceneToken
|
||||||
g.SendMsg(cmd.EnterSceneDoneRsp, player.PlayerID, player.ClientSeq, enterSceneDoneRsp)
|
g.SendMsg(cmd.EnterSceneDoneRsp, player.PlayerID, player.ClientSeq, enterSceneDoneRsp)
|
||||||
|
|
||||||
// PacketPlayerTimeNotify
|
|
||||||
playerTimeNotify := new(proto.PlayerTimeNotify)
|
|
||||||
playerTimeNotify.IsPaused = player.Pause
|
|
||||||
playerTimeNotify.PlayerTime = uint64(player.TotalOnlineTime)
|
|
||||||
playerTimeNotify.ServerTime = uint64(time.Now().UnixMilli())
|
|
||||||
g.SendMsg(cmd.PlayerTimeNotify, player.PlayerID, player.ClientSeq, playerTimeNotify)
|
|
||||||
|
|
||||||
player.SceneLoadState = model.SceneEnterDone
|
player.SceneLoadState = model.SceneEnterDone
|
||||||
world := g.worldManager.GetWorldByID(player.WorldId)
|
world.PlayerEnter(player)
|
||||||
scene := world.GetSceneById(player.SceneId)
|
|
||||||
|
|
||||||
playerTeamEntity := scene.GetPlayerTeamEntity(player.PlayerID)
|
for otherPlayerId := range world.waitEnterPlayerMap {
|
||||||
activeAvatarId := player.TeamConfig.GetActiveAvatarId()
|
delete(world.waitEnterPlayerMap, otherPlayerId)
|
||||||
g.AddSceneEntityNotify(player, proto.VisionType_VISION_TYPE_BORN, []uint32{playerTeamEntity.avatarEntityMap[activeAvatarId]}, true)
|
otherPlayer := g.userManager.GetOnlineUser(otherPlayerId)
|
||||||
|
otherPlayer.Pos = &model.Vector{
|
||||||
|
X: player.Pos.X,
|
||||||
|
Y: player.Pos.Y,
|
||||||
|
Z: player.Pos.Z,
|
||||||
|
}
|
||||||
|
otherPlayer.Rot = &model.Vector{
|
||||||
|
X: player.Rot.X,
|
||||||
|
Y: player.Rot.Y,
|
||||||
|
Z: player.Rot.Z,
|
||||||
|
}
|
||||||
|
otherPlayer.SceneId = player.SceneId
|
||||||
|
|
||||||
// 通过aoi获取场景中在自己周围格子里的全部实体id
|
g.UserWorldAddPlayer(world, otherPlayer)
|
||||||
entityIdList := world.aoiManager.GetEntityIdListByPos(float32(player.Pos.X), float32(player.Pos.Y), float32(player.Pos.Z))
|
|
||||||
g.AddSceneEntityNotify(player, proto.VisionType_VISION_TYPE_MEET, entityIdList, false)
|
otherPlayer.SceneLoadState = model.SceneNone
|
||||||
|
g.SendMsg(cmd.PlayerEnterSceneNotify, otherPlayer.PlayerID, 0, g.PacketPlayerEnterSceneNotifyLogin(otherPlayer, proto.EnterType_ENTER_TYPE_OTHER))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameManager) PostEnterSceneReq(player *model.Player, payloadMsg pb.Message) {
|
func (g *GameManager) PostEnterSceneReq(player *model.Player, payloadMsg pb.Message) {
|
||||||
@@ -368,21 +410,21 @@ func (g *GameManager) AddSceneEntityNotifyBroadcast(scene *Scene, visionType pro
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameManager) RemoveSceneEntityNotifyToPlayer(player *model.Player, entityIdList []uint32) {
|
func (g *GameManager) RemoveSceneEntityNotifyToPlayer(player *model.Player, visionType proto.VisionType, entityIdList []uint32) {
|
||||||
// PacketSceneEntityDisappearNotify
|
// PacketSceneEntityDisappearNotify
|
||||||
sceneEntityDisappearNotify := new(proto.SceneEntityDisappearNotify)
|
sceneEntityDisappearNotify := new(proto.SceneEntityDisappearNotify)
|
||||||
sceneEntityDisappearNotify.EntityList = entityIdList
|
sceneEntityDisappearNotify.EntityList = entityIdList
|
||||||
sceneEntityDisappearNotify.DisappearType = proto.VisionType_VISION_TYPE_REMOVE
|
sceneEntityDisappearNotify.DisappearType = visionType
|
||||||
g.SendMsg(cmd.SceneEntityDisappearNotify, player.PlayerID, player.ClientSeq, sceneEntityDisappearNotify)
|
g.SendMsg(cmd.SceneEntityDisappearNotify, player.PlayerID, player.ClientSeq, sceneEntityDisappearNotify)
|
||||||
logger.LOG.Debug("SceneEntityDisappearNotify, uid: %v, type: %v, len: %v",
|
logger.LOG.Debug("SceneEntityDisappearNotify, uid: %v, type: %v, len: %v",
|
||||||
player.PlayerID, sceneEntityDisappearNotify.DisappearType, len(sceneEntityDisappearNotify.EntityList))
|
player.PlayerID, sceneEntityDisappearNotify.DisappearType, len(sceneEntityDisappearNotify.EntityList))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameManager) RemoveSceneEntityNotifyBroadcast(scene *Scene, entityIdList []uint32) {
|
func (g *GameManager) RemoveSceneEntityNotifyBroadcast(scene *Scene, visionType proto.VisionType, entityIdList []uint32) {
|
||||||
// PacketSceneEntityDisappearNotify
|
// PacketSceneEntityDisappearNotify
|
||||||
sceneEntityDisappearNotify := new(proto.SceneEntityDisappearNotify)
|
sceneEntityDisappearNotify := new(proto.SceneEntityDisappearNotify)
|
||||||
sceneEntityDisappearNotify.EntityList = entityIdList
|
sceneEntityDisappearNotify.EntityList = entityIdList
|
||||||
sceneEntityDisappearNotify.DisappearType = proto.VisionType_VISION_TYPE_REMOVE
|
sceneEntityDisappearNotify.DisappearType = visionType
|
||||||
for _, scenePlayer := range scene.playerMap {
|
for _, scenePlayer := range scene.playerMap {
|
||||||
g.SendMsg(cmd.SceneEntityDisappearNotify, scenePlayer.PlayerID, scenePlayer.ClientSeq, sceneEntityDisappearNotify)
|
g.SendMsg(cmd.SceneEntityDisappearNotify, scenePlayer.PlayerID, scenePlayer.ClientSeq, sceneEntityDisappearNotify)
|
||||||
logger.LOG.Debug("SceneEntityDisappearNotify, uid: %v, type: %v, len: %v",
|
logger.LOG.Debug("SceneEntityDisappearNotify, uid: %v, type: %v, len: %v",
|
||||||
@@ -410,9 +452,9 @@ func (g *GameManager) AddSceneEntityNotify(player *model.Player, visionType prot
|
|||||||
logger.LOG.Error("get scene player is nil, world id: %v, scene id: %v", world.id, scene.id)
|
logger.LOG.Error("get scene player is nil, world id: %v, scene id: %v", world.id, scene.id)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if scenePlayer.SceneLoadState != model.SceneEnterDone {
|
//if scenePlayer.SceneLoadState != model.SceneEnterDone {
|
||||||
continue
|
// continue
|
||||||
}
|
//}
|
||||||
if entity.avatarEntity.avatarId != scenePlayer.TeamConfig.GetActiveAvatarId() {
|
if entity.avatarEntity.avatarId != scenePlayer.TeamConfig.GetActiveAvatarId() {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@@ -626,8 +668,7 @@ func (g *GameManager) PacketSceneEntityInfoGadget(scene *Scene, entityId uint32)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *GameManager) PacketSceneAvatarInfo(scene *Scene, player *model.Player, avatarId uint32) *proto.SceneAvatarInfo {
|
func (g *GameManager) PacketSceneAvatarInfo(scene *Scene, player *model.Player, avatarId uint32) *proto.SceneAvatarInfo {
|
||||||
activeAvatarId := player.TeamConfig.GetActiveAvatarId()
|
avatar := player.AvatarMap[avatarId]
|
||||||
activeAvatar := player.AvatarMap[activeAvatarId]
|
|
||||||
playerTeamEntity := scene.GetPlayerTeamEntity(player.PlayerID)
|
playerTeamEntity := scene.GetPlayerTeamEntity(player.PlayerID)
|
||||||
equipIdList := make([]uint32, 0)
|
equipIdList := make([]uint32, 0)
|
||||||
weapon := player.AvatarMap[avatarId].EquipWeapon
|
weapon := player.AvatarMap[avatarId].EquipWeapon
|
||||||
@@ -643,7 +684,7 @@ func (g *GameManager) PacketSceneAvatarInfo(scene *Scene, player *model.Player,
|
|||||||
EquipIdList: equipIdList,
|
EquipIdList: equipIdList,
|
||||||
SkillDepotId: player.AvatarMap[avatarId].SkillDepotId,
|
SkillDepotId: player.AvatarMap[avatarId].SkillDepotId,
|
||||||
Weapon: &proto.SceneWeaponInfo{
|
Weapon: &proto.SceneWeaponInfo{
|
||||||
EntityId: playerTeamEntity.weaponEntityMap[activeAvatar.EquipWeapon.WeaponId],
|
EntityId: playerTeamEntity.weaponEntityMap[avatar.EquipWeapon.WeaponId],
|
||||||
GadgetId: uint32(gdc.CONF.ItemDataMap[int32(weapon.ItemId)].GadgetId),
|
GadgetId: uint32(gdc.CONF.ItemDataMap[int32(weapon.ItemId)].GadgetId),
|
||||||
ItemId: weapon.ItemId,
|
ItemId: weapon.ItemId,
|
||||||
Guid: weapon.Guid,
|
Guid: weapon.Guid,
|
||||||
|
|||||||
@@ -222,7 +222,10 @@ func (g *GameManager) UpdateStamina(player *model.Player, staminaCost int32) {
|
|||||||
// SetStamina 设置玩家的耐力
|
// SetStamina 设置玩家的耐力
|
||||||
func (g *GameManager) SetStamina(player *model.Player, stamina uint32) {
|
func (g *GameManager) SetStamina(player *model.Player, stamina uint32) {
|
||||||
prop := constant.PlayerPropertyConst.PROP_CUR_PERSIST_STAMINA
|
prop := constant.PlayerPropertyConst.PROP_CUR_PERSIST_STAMINA
|
||||||
|
// 当前无变动不要频繁发包
|
||||||
|
if player.PropertiesMap[constant.PlayerPropertyConst.PROP_MAX_STAMINA] == player.PropertiesMap[constant.PlayerPropertyConst.PROP_CUR_PERSIST_STAMINA] {
|
||||||
|
return
|
||||||
|
}
|
||||||
// 设置玩家的耐力prop
|
// 设置玩家的耐力prop
|
||||||
player.PropertiesMap[prop] = stamina
|
player.PropertiesMap[prop] = stamina
|
||||||
|
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ func (w *WorldManager) CreateWorld(owner *model.Player, multiplayer bool) *World
|
|||||||
-2000, 2000, 1,
|
-2000, 2000, 1,
|
||||||
-5500, 6500, 120,
|
-5500, 6500, 120,
|
||||||
),
|
),
|
||||||
|
playerFirstEnterMap: make(map[uint32]int64),
|
||||||
|
waitEnterPlayerMap: make(map[uint32]int64),
|
||||||
}
|
}
|
||||||
if world.IsBigWorld() {
|
if world.IsBigWorld() {
|
||||||
world.aoiManager = aoi.NewAoiManager(
|
world.aoiManager = aoi.NewAoiManager(
|
||||||
@@ -94,16 +96,18 @@ func (w *WorldManager) InitBigWorld(owner *model.Player) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type World struct {
|
type World struct {
|
||||||
id uint32
|
id uint32
|
||||||
owner *model.Player
|
owner *model.Player
|
||||||
playerMap map[uint32]*model.Player
|
playerMap map[uint32]*model.Player
|
||||||
sceneMap map[uint32]*Scene
|
sceneMap map[uint32]*Scene
|
||||||
entityIdCounter uint32
|
entityIdCounter uint32
|
||||||
worldLevel uint8
|
worldLevel uint8
|
||||||
multiplayer bool
|
multiplayer bool
|
||||||
mpLevelEntityId uint32
|
mpLevelEntityId uint32
|
||||||
chatMsgList []*proto.ChatInfo
|
chatMsgList []*proto.ChatInfo
|
||||||
aoiManager *aoi.AoiManager // 当前世界地图的aoi管理器
|
aoiManager *aoi.AoiManager // 当前世界地图的aoi管理器
|
||||||
|
playerFirstEnterMap map[uint32]int64
|
||||||
|
waitEnterPlayerMap map[uint32]int64
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *World) GetNextWorldEntityId(entityType uint16) uint32 {
|
func (w *World) GetNextWorldEntityId(entityType uint16) uint32 {
|
||||||
@@ -123,6 +127,7 @@ func (w *World) RemovePlayer(player *model.Player) {
|
|||||||
scene := w.sceneMap[player.SceneId]
|
scene := w.sceneMap[player.SceneId]
|
||||||
scene.RemovePlayer(player)
|
scene.RemovePlayer(player)
|
||||||
delete(w.playerMap, player.PlayerID)
|
delete(w.playerMap, player.PlayerID)
|
||||||
|
delete(w.playerFirstEnterMap, player.PlayerID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *World) CreateScene(sceneId uint32) *Scene {
|
func (w *World) CreateScene(sceneId uint32) *Scene {
|
||||||
@@ -161,6 +166,23 @@ func (w *World) IsBigWorld() bool {
|
|||||||
return w.owner.PlayerID == 1
|
return w.owner.PlayerID == 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (w *World) ChangeToMP() {
|
||||||
|
w.multiplayer = true
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *World) IsPlayerFirstEnter(player *model.Player) bool {
|
||||||
|
_, exist := w.playerFirstEnterMap[player.PlayerID]
|
||||||
|
if !exist {
|
||||||
|
return true
|
||||||
|
} else {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (w *World) PlayerEnter(player *model.Player) {
|
||||||
|
w.playerFirstEnterMap[player.PlayerID] = time.Now().UnixMilli()
|
||||||
|
}
|
||||||
|
|
||||||
type Scene struct {
|
type Scene struct {
|
||||||
id uint32
|
id uint32
|
||||||
world *World
|
world *World
|
||||||
@@ -378,6 +400,14 @@ func (s *Scene) GetEntity(entityId uint32) *Entity {
|
|||||||
return s.entityMap[entityId]
|
return s.entityMap[entityId]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (s *Scene) GetEntityIdList() []uint32 {
|
||||||
|
entityIdList := make([]uint32, 0)
|
||||||
|
for k := range s.entityMap {
|
||||||
|
entityIdList = append(entityIdList, k)
|
||||||
|
}
|
||||||
|
return entityIdList
|
||||||
|
}
|
||||||
|
|
||||||
// 伤害处理和转发
|
// 伤害处理和转发
|
||||||
|
|
||||||
func (s *Scene) AddAttack(attack *Attack) {
|
func (s *Scene) AddAttack(attack *Attack) {
|
||||||
|
|||||||
@@ -53,22 +53,22 @@ type Player struct {
|
|||||||
ChatMsgMap map[uint32][]*ChatMsg `bson:"chatMsgMap"` // 聊天信息
|
ChatMsgMap map[uint32][]*ChatMsg `bson:"chatMsgMap"` // 聊天信息
|
||||||
IsGM uint8 `bson:"isGM"` // 管理员权限等级
|
IsGM uint8 `bson:"isGM"` // 管理员权限等级
|
||||||
// 在线数据
|
// 在线数据
|
||||||
EnterSceneToken uint32 `bson:"-"` // 玩家的世界进入令牌
|
EnterSceneToken uint32 `bson:"-"` // 玩家的世界进入令牌
|
||||||
DbState int `bson:"-"` // 数据库存档状态
|
DbState int `bson:"-"` // 数据库存档状态
|
||||||
WorldId uint32 `bson:"-"` // 所在的世界id
|
WorldId uint32 `bson:"-"` // 所在的世界id
|
||||||
PeerId uint32 `bson:"-"` // 多人世界的玩家编号
|
PeerId uint32 `bson:"-"` // 多人世界的玩家编号
|
||||||
GameObjectGuidCounter uint64 `bson:"-"` // 游戏对象guid计数器
|
GameObjectGuidCounter uint64 `bson:"-"` // 游戏对象guid计数器
|
||||||
ClientTime uint32 `bson:"-"` // 玩家客户端的本地时钟
|
ClientTime uint32 `bson:"-"` // 玩家客户端的本地时钟
|
||||||
ClientRTT uint32 `bson:"-"` // 玩家客户端往返时延
|
ClientRTT uint32 `bson:"-"` // 玩家客户端往返时延
|
||||||
GameObjectGuidMap map[uint64]GameObject `bson:"-"` // 游戏对象guid映射表
|
GameObjectGuidMap map[uint64]GameObject `bson:"-"` // 游戏对象guid映射表
|
||||||
Online bool `bson:"-"` // 在线状态
|
Online bool `bson:"-"` // 在线状态
|
||||||
Pause bool `bson:"-"` // 暂停状态
|
Pause bool `bson:"-"` // 暂停状态
|
||||||
SceneLoadState int `bson:"-"` // 场景加载状态
|
SceneLoadState int `bson:"-"` // 场景加载状态
|
||||||
CoopApplyMap map[uint32]int64 `bson:"-"` // 敲门申请的玩家uid及时间
|
CoopApplyMap map[uint32]int64 `bson:"-"` // 敲门申请的玩家uid及时间
|
||||||
StaminaInfo *StaminaInfo `bson:"-"` // 耐力临时数据
|
StaminaInfo *StaminaInfo `bson:"-"` // 耐力临时数据
|
||||||
ClientSeq uint32 `bson:"-"` // 客户端发包请求的序号
|
ClientSeq uint32 `bson:"-"` // 客户端发包请求的序号
|
||||||
CombatInvokeHandler *InvokeHandler[proto.CombatInvokeEntry]
|
CombatInvokeHandler *InvokeHandler[proto.CombatInvokeEntry] `bson:"-"`
|
||||||
AbilityInvokeHandler *InvokeHandler[proto.AbilityInvokeEntry]
|
AbilityInvokeHandler *InvokeHandler[proto.AbilityInvokeEntry] `bson:"-"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *Player) GetNextGameObjectGuid() uint64 {
|
func (p *Player) GetNextGameObjectGuid() uint64 {
|
||||||
|
|||||||
@@ -140,6 +140,9 @@ func (c *CmdProtoMap) registerAllMessage() {
|
|||||||
c.registerMessage(PlayerQuitFromMpNotify, &proto.PlayerQuitFromMpNotify{}) // 退出多人游戏通知
|
c.registerMessage(PlayerQuitFromMpNotify, &proto.PlayerQuitFromMpNotify{}) // 退出多人游戏通知
|
||||||
c.registerMessage(JoinPlayerSceneReq, &proto.JoinPlayerSceneReq{}) // 进入他人世界请求
|
c.registerMessage(JoinPlayerSceneReq, &proto.JoinPlayerSceneReq{}) // 进入他人世界请求
|
||||||
c.registerMessage(JoinPlayerSceneRsp, &proto.JoinPlayerSceneRsp{}) // 进入他人世界响应
|
c.registerMessage(JoinPlayerSceneRsp, &proto.JoinPlayerSceneRsp{}) // 进入他人世界响应
|
||||||
|
c.registerMessage(GuestBeginEnterSceneNotify, &proto.GuestBeginEnterSceneNotify{}) // 他人开始进入世界通知
|
||||||
|
c.registerMessage(GuestPostEnterSceneNotify, &proto.GuestPostEnterSceneNotify{}) // 他人进入世界完成通知
|
||||||
|
c.registerMessage(PlayerPreEnterMpNotify, &proto.PlayerPreEnterMpNotify{}) // 他人正在进入世界通知
|
||||||
|
|
||||||
// 社交
|
// 社交
|
||||||
c.registerMessage(SetPlayerBirthdayReq, &proto.SetPlayerBirthdayReq{}) // 设置生日请求
|
c.registerMessage(SetPlayerBirthdayReq, &proto.SetPlayerBirthdayReq{}) // 设置生日请求
|
||||||
|
|||||||
Reference in New Issue
Block a user