From a8f6039fe9f8fecb6c9b013193ab7a41320e93db Mon Sep 17 00:00:00 2001 From: by <123456@qq.com> Date: Tue, 13 Aug 2024 09:52:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A8=83=E5=A8=83=E6=9C=BA=E8=BF=9E=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gamesrv/clawdoll/scene_clawdoll.go | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/gamesrv/clawdoll/scene_clawdoll.go b/gamesrv/clawdoll/scene_clawdoll.go index fd6a518..6f3d434 100644 --- a/gamesrv/clawdoll/scene_clawdoll.go +++ b/gamesrv/clawdoll/scene_clawdoll.go @@ -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 !") + } +}