简化配置表读取

This commit is contained in:
flswld
2023-03-16 16:26:14 +08:00
parent 2a3ce25898
commit 5e5492943d
51 changed files with 418 additions and 2560 deletions

View File

@@ -143,7 +143,7 @@ func (m *MessageQueue) sendHandler() {
gateTcpMqInstMap := map[string]map[string]*GateTcpMqInst{
api.GATE: make(map[string]*GateTcpMqInst),
api.GS: make(map[string]*GateTcpMqInst),
api.FIGHT: make(map[string]*GateTcpMqInst),
api.ANTICHEAT: make(map[string]*GateTcpMqInst),
api.PATHFINDING: make(map[string]*GateTcpMqInst),
}
for {
@@ -293,8 +293,8 @@ func (m *MessageQueue) gateTcpMqHandshake(conn net.Conn) {
inst.serverType = api.GATE
case api.GS:
inst.serverType = api.GS
case api.FIGHT:
inst.serverType = api.FIGHT
case api.ANTICHEAT:
inst.serverType = api.ANTICHEAT
case api.PATHFINDING:
inst.serverType = api.PATHFINDING
default:

View File

@@ -4,7 +4,6 @@ import pb "google.golang.org/protobuf/proto"
const (
MsgTypeGame = iota // 来自客户端的游戏消息
MsgTypeFight // 战斗服务器消息
MsgTypeConnCtrl // GATE客户端连接信息消息
MsgTypeServer // 服务器之间转发的消息
)
@@ -16,7 +15,6 @@ type NetMsg struct {
AppId string `msgpack:"-"`
Topic string `msgpack:"-"`
GameMsg *GameMsg
FightMsg *FightMsg
ConnCtrlMsg *ConnCtrlMsg
ServerMsg *ServerMsg
OriginServerType string
@@ -50,22 +48,6 @@ type ConnCtrlMsg struct {
KickReason uint32
}
const (
AddFightRoutine = iota // 添加战斗实例
DelFightRoutine // 删除战斗实例
FightRoutineAddEntity // 战斗实例添加实体
FightRoutineDelEntity // 战斗实例删除实体
)
type FightMsg struct {
FightRoutineId uint32
EntityId uint32
FightPropMap map[uint32]float32
Uid uint32
AvatarGuid uint64
GateServerAppId string
}
const (
ServerAppidBindNotify = iota // 玩家连接绑定的各个服务器appid通知
ServerUserOnlineStateChangeNotify // 广播玩家上线和离线状态以及所在GS的appid
@@ -77,14 +59,14 @@ const (
)
type ServerMsg struct {
FightServerAppId string
UserId uint32
IsOnline bool
GameServerAppId string
JoinHostUserId uint32
UserMpInfo *UserMpInfo
ChatMsgInfo *ChatMsgInfo
AddFriendInfo *AddFriendInfo
AnticheatServerAppId string
UserId uint32
IsOnline bool
GameServerAppId string
JoinHostUserId uint32
UserMpInfo *UserMpInfo
ChatMsgInfo *ChatMsgInfo
AddFriendInfo *AddFriendInfo
}
type OriginInfo struct {

View File

@@ -35,9 +35,9 @@ func (m *MessageQueue) SendToGs(appId string, netMsg *NetMsg) {
m.netMsgInput <- netMsg
}
func (m *MessageQueue) SendToFight(appId string, netMsg *NetMsg) {
netMsg.Topic = m.getTopic(api.FIGHT, appId)
netMsg.ServerType = api.FIGHT
func (m *MessageQueue) SendToAnticheat(appId string, netMsg *NetMsg) {
netMsg.Topic = m.getTopic(api.ANTICHEAT, appId)
netMsg.ServerType = api.ANTICHEAT
netMsg.AppId = appId
originServerType, originServerAppId := m.getOriginServer()
netMsg.OriginServerType = originServerType