From 2c8ce6a46715ae38391044167b5fbf3cc1b609d8 Mon Sep 17 00:00:00 2001 From: kxdd <88655@163.com> Date: Wed, 14 Aug 2024 15:53:27 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=8A=E5=88=86=E6=8A=95?= =?UTF-8?q?=E5=B8=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gamesrv/clawdoll/player_clawdoll.go | 2 +- gamesrv/clawdoll/scenepolicy_clawdoll.go | 33 ++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/gamesrv/clawdoll/player_clawdoll.go b/gamesrv/clawdoll/player_clawdoll.go index bba7f72..f69670f 100644 --- a/gamesrv/clawdoll/player_clawdoll.go +++ b/gamesrv/clawdoll/player_clawdoll.go @@ -33,7 +33,7 @@ func (this *PlayerEx) CanOp(sceneEx *SceneEx) bool { func (this *PlayerEx) CanPayCoin() bool { - return false + return true } // 游戏新一局 设置数据 diff --git a/gamesrv/clawdoll/scenepolicy_clawdoll.go b/gamesrv/clawdoll/scenepolicy_clawdoll.go index 89cf7c2..146a682 100644 --- a/gamesrv/clawdoll/scenepolicy_clawdoll.go +++ b/gamesrv/clawdoll/scenepolicy_clawdoll.go @@ -445,9 +445,29 @@ func (this *StateStart) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, pa return true } + sceneEx, ok := s.ExtraData.(*SceneEx) + if !ok { + return false + } + playerEx, ok := p.ExtraData.(*PlayerEx) + if !ok { + return false + } + switch opcode { case rule.ClawDollPlayerOpPayCoin: + if !playerEx.CanPayCoin() { + return false + } + // 1-前 2-后 3-左 4-右 5-投币 + pack := &machine.SMDollMachineoPerate{ + Snid: proto.Int32(p.SnId), + Id: proto.Int32(int32(sceneEx.machineId)), + Perate: proto.Int32(int32(5)), + } + + sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachinePerate), pack) } return false @@ -524,14 +544,23 @@ func (this *PlayGame) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, para if !playerEx.CanPayCoin() { return false } - sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params) + // 1-前 2-后 3-左 4-右 5-投币 + pack := &machine.SMDollMachineoPerate{ + Snid: proto.Int32(p.SnId), + Id: proto.Int32(int32(sceneEx.machineId)), + Perate: proto.Int32(int32(5)), + } + + sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachinePerate), pack) + + //sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params) case rule.ClawDollPlayerOpGo: pack := &machine.SMDollMachineGrab{ Snid: proto.Int32(p.SnId), Id: proto.Int32(int32(sceneEx.machineId)), - TypeId: proto.Int32(int32(1)), + TypeId: proto.Int32(int32(2)), } sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachineGrab), pack)