实现跨服加入世界&玩家跨服在线迁移功能(部分完成)

This commit is contained in:
flswld
2022-12-25 20:09:19 +08:00
parent 9feeb4eafa
commit c7ba154ab4
15 changed files with 437 additions and 136 deletions

View File

@@ -6,6 +6,7 @@ const (
MsgTypeGame = iota
MsgTypeFight
MsgTypeConnCtrl
MsgTypeServer
)
type NetMsg struct {
@@ -15,6 +16,7 @@ type NetMsg struct {
GameMsg *GameMsg `msgpack:"GameMsg"`
FightMsg *FightMsg `msgpack:"FightMsg"`
ConnCtrlMsg *ConnCtrlMsg `msgpack:"ConnCtrlMsg"`
ServerMsg *ServerMsg `msgpack:"ServerMsg"`
OriginServerType string `msgpack:"OriginServerType"`
OriginServerAppId string `msgpack:"OriginServerAppId"`
}
@@ -35,17 +37,15 @@ type GameMsg struct {
const (
ClientRttNotify = iota
ClientTimeNotify
FightServerSelectNotify
KickPlayerNotify
)
type ConnCtrlMsg struct {
UserId uint32 `msgpack:"UserId"`
ClientRtt uint32 `msgpack:"ClientRtt"`
ClientTime uint32 `msgpack:"ClientTime"`
FightServerAppId string `msgpack:"FightServerAppId"`
KickUserId uint32 `msgpack:"KickUserId"`
KickReason uint32 `msgpack:"KickReason"`
UserId uint32 `msgpack:"UserId"`
ClientRtt uint32 `msgpack:"ClientRtt"`
ClientTime uint32 `msgpack:"ClientTime"`
KickUserId uint32 `msgpack:"KickUserId"`
KickReason uint32 `msgpack:"KickReason"`
}
const (
@@ -63,3 +63,37 @@ type FightMsg struct {
AvatarGuid uint64 `msgpack:"AvatarGuid"`
GateServerAppId string `msgpack:"GateServerAppId"`
}
const (
ServerAppidBindNotify = iota
ServerUserOnlineStateChangeNotify
ServerGetUserBaseInfoReq
ServerGetUserBaseInfoRsp
ServerUserGsChangeNotify
)
type ServerMsg struct {
FightServerAppId string `msgpack:"FightServerAppId"`
UserId uint32 `msgpack:"UserId"`
IsOnline bool `msgpack:"IsOnline"`
UserBaseInfo *UserBaseInfo `msgpack:"UserBaseInfo"`
GameServerAppId string `msgpack:"GameServerAppId"`
JoinHostUserId uint32 `msgpack:"JoinHostUserId"`
}
type OriginInfo struct {
CmdName string `msgpack:"CmdName"`
UserId uint32 `msgpack:"UserId"`
}
type UserBaseInfo struct {
OriginInfo *OriginInfo `msgpack:"OriginInfo"`
UserId uint32 `msgpack:"UserId"`
Nickname string `msgpack:"Nickname"`
PlayerLevel uint32 `msgpack:"PlayerLevel"`
MpSettingType uint8 `msgpack:"MpSettingType"`
NameCardId uint32 `msgpack:"NameCardId"`
Signature string `msgpack:"Signature"`
HeadImageId uint32 `msgpack:"HeadImageId"`
WorldPlayerNum uint32 `msgpack:"WorldPlayerNum"`
}