From 8514f22fc6e8c94005cdd8b31149c11599b4e79d Mon Sep 17 00:00:00 2001 From: kxdd Date: Wed, 4 Sep 2024 11:18:04 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A8=83=E5=A8=83=E6=9C=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gamesrv/clawdoll/action_clawdoll.go | 17 ----------------- gamesrv/clawdoll/scene_clawdoll.go | 8 ++++++-- gamesrv/clawdoll/scenepolicy_clawdoll.go | 11 +++++++++++ 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/gamesrv/clawdoll/action_clawdoll.go b/gamesrv/clawdoll/action_clawdoll.go index 75e5fd2..bd83ddc 100644 --- a/gamesrv/clawdoll/action_clawdoll.go +++ b/gamesrv/clawdoll/action_clawdoll.go @@ -2,7 +2,6 @@ package clawdoll import ( "mongo.games.com/game/common" - rule "mongo.games.com/game/gamerule/clawdoll" "mongo.games.com/game/gamesrv/base" "mongo.games.com/game/protocol/clawdoll" "mongo.games.com/game/protocol/machine" @@ -60,15 +59,6 @@ func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data return nil } - scene := p.GetScene() - if scene == nil { - return nil - } - sceneEx, ok := scene.ExtraData.(*SceneEx) - if !ok { - return nil - } - switch msg.TypeId { case 1: if msg.Result == 1 { @@ -82,13 +72,6 @@ func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data } else { logger.Logger.Tracef("下抓失败!!!!!!!!!!!!snid = ", msg.Snid) } - - scene.ChangeSceneState(rule.ClawDollSceneStateBilled) - - sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateBilled)) - - ClawdollBroadcastRoomState(scene) - ClawdollSendPlayerInfo(scene) } } return nil diff --git a/gamesrv/clawdoll/scene_clawdoll.go b/gamesrv/clawdoll/scene_clawdoll.go index f87890b..8c3070d 100644 --- a/gamesrv/clawdoll/scene_clawdoll.go +++ b/gamesrv/clawdoll/scene_clawdoll.go @@ -311,7 +311,7 @@ func (this *SceneEx) GetPlayGrabType(player *PlayerEx) int32 { return rule.ClawWeak } - if this.RoundId%100 == 0 && this.RoundId != 0 { + if this.RoundId/2 == 0 && this.RoundId != 0 { return rule.ClawStrong } @@ -371,7 +371,11 @@ func (this *SceneEx) SetPlayingState(state int32) { // 时间到 系统开始下抓 func (this *SceneEx) TimeOutPlayGrab() bool { - this.OnPlayerSMGrabOp(this.playingSnid, int32(this.machineId), rule.ClawWeak) + playerEx := this.players[this.playingSnid] + if playerEx != nil { + grapType := this.GetPlayGrabType(playerEx) + this.OnPlayerSMGrabOp(this.playingSnid, int32(this.machineId), grapType) + } return true } diff --git a/gamesrv/clawdoll/scenepolicy_clawdoll.go b/gamesrv/clawdoll/scenepolicy_clawdoll.go index 8d56913..f2c46e0 100644 --- a/gamesrv/clawdoll/scenepolicy_clawdoll.go +++ b/gamesrv/clawdoll/scenepolicy_clawdoll.go @@ -668,6 +668,12 @@ func (this *PlayGame) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, para //1-弱力抓 2 -强力抓 sceneEx.OnPlayerSMGrabOp(p.SnId, int32(sceneEx.machineId), grapType) + s.ChangeSceneState(rule.ClawDollSceneStateBilled) + sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateBilled)) + + ClawdollBroadcastRoomState(s) + ClawdollSendPlayerInfo(s) + case rule.ClawDollPlayerOpMove: if !sceneEx.CheckMoveOp(playerEx) { @@ -698,6 +704,11 @@ func (this *PlayGame) OnTick(s *base.Scene) { logger.Logger.Trace("PlayGame OnTick TimeOutPlayGrab SnId", sceneEx.playingSnid, " machineId:", sceneEx.machineId) } + s.ChangeSceneState(rule.ClawDollSceneStateBilled) + sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateBilled)) + + ClawdollBroadcastRoomState(s) + ClawdollSendPlayerInfo(s) return } }