娃娃机连接

This commit is contained in:
by 2024-08-13 09:52:39 +08:00
parent af6114e69b
commit a8f6039fe9
1 changed files with 21 additions and 6 deletions

View File

@ -1,13 +1,14 @@
package clawdoll package clawdoll
import ( import (
"mongo.games.com/game/protocol/clawdoll"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/game/common" "mongo.games.com/game/common"
rule "mongo.games.com/game/gamerule/clawdoll" rule "mongo.games.com/game/gamerule/clawdoll"
"mongo.games.com/game/gamesrv/base" "mongo.games.com/game/gamesrv/base"
"mongo.games.com/game/proto" "mongo.games.com/game/proto"
"mongo.games.com/game/protocol/clawdoll"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib"
"mongo.games.com/goserver/srvlib"
) )
type PlayerData struct { type PlayerData struct {
@ -44,6 +45,8 @@ type SceneEx struct {
RoundId int // 局数,第几局 RoundId int // 局数,第几局
robotNum int // 参与游戏的机器人数量 robotNum int // 参与游戏的机器人数量
logid string logid string
machineId int //娃娃机ID
machineConn *netlib.Session //娃娃机链接
} }
// 游戏是否能开始 // 游戏是否能开始
@ -203,3 +206,15 @@ func (this *SceneEx) BackupPlayer(p *PlayerEx, isBilled bool) {
BeUnderAgentCode: p.BeUnderAgentCode, BeUnderAgentCode: p.BeUnderAgentCode,
} }
} }
// 向娃娃机主机发送消息
func (this *SceneEx) SendMachine(pid int, msg interface{}) {
if this.machineConn == nil {
this.machineConn = srvlib.ServerSessionMgrSington.GetSession(1, 10, 1001)
}
if this.machineConn != nil {
this.machineConn.Send(pid, msg)
} else {
logger.Logger.Error("MachineConn is nil !")
}
}