娃娃机连接

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
import (
"mongo.games.com/game/protocol/clawdoll"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/game/common"
rule "mongo.games.com/game/gamerule/clawdoll"
"mongo.games.com/game/gamesrv/base"
"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 {
@ -41,9 +42,11 @@ type SceneEx struct {
PlayerBackup map[int32]*PlayerData // 本局离场玩家数据备份
seats []*PlayerEx // 本局游戏中的玩家状态数据
RoundId int // 局数,第几局
robotNum int // 参与游戏的机器人数量
logid string
RoundId int // 局数,第几局
robotNum int // 参与游戏的机器人数量
logid string
machineId int //娃娃机ID
machineConn *netlib.Session //娃娃机链接
}
// 游戏是否能开始
@ -203,3 +206,15 @@ func (this *SceneEx) BackupPlayer(p *PlayerEx, isBilled bool) {
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 !")
}
}