From f26cb4d2ff295a07e1119f077999a322726609e0 Mon Sep 17 00:00:00 2001 From: kxdd Date: Sat, 7 Sep 2024 16:08:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A8=83=E5=A8=83=E6=9C=BAplaying=E5=88=A4?= =?UTF-8?q?=E5=AE=9A=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gamesrv/clawdoll/player_clawdoll.go | 17 ++++++++++++++++- gamesrv/clawdoll/scenepolicy_clawdoll.go | 6 +++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/gamesrv/clawdoll/player_clawdoll.go b/gamesrv/clawdoll/player_clawdoll.go index 4e7a01d..4d2611e 100644 --- a/gamesrv/clawdoll/player_clawdoll.go +++ b/gamesrv/clawdoll/player_clawdoll.go @@ -43,8 +43,9 @@ func (this *PlayerEx) CanPayCoin() bool { itemID := int32(rule.ClawDoorItemID) itemCount := this.GetItemCount(itemID) if itemCount < 1 { - return false + return true } + itemData := srvdata.GameItemMgr.Get(this.Platform, itemID) if itemData == nil { return false @@ -67,12 +68,26 @@ func (this *PlayerEx) CostPlayCoin(count int32) bool { // 能否移动 func (this *PlayerEx) CanMove() bool { + s := this.GetScene() + if sceneEx, ok := s.ExtraData.(*SceneEx); ok { + if !sceneEx.Gaming { + return false + } + } + return true } // 能否下抓 func (this *PlayerEx) CanGrab() bool { + s := this.GetScene() + if sceneEx, ok := s.ExtraData.(*SceneEx); ok { + if !sceneEx.Gaming { + return false + } + } + return true } diff --git a/gamesrv/clawdoll/scenepolicy_clawdoll.go b/gamesrv/clawdoll/scenepolicy_clawdoll.go index 8128e04..b6bb5d0 100644 --- a/gamesrv/clawdoll/scenepolicy_clawdoll.go +++ b/gamesrv/clawdoll/scenepolicy_clawdoll.go @@ -4,6 +4,7 @@ import ( "github.com/zegoim/zego_server_assistant/token/go/src/token04" "mongo.games.com/game/gamesrv/action" "mongo.games.com/game/protocol/clawdoll" + "strconv" "time" "mongo.games.com/goserver/core" @@ -288,7 +289,7 @@ func (this *PolicyClawdoll) SendGetVideoToken(s *base.Scene, p *base.Player, sce } //生成token - token, err := token04.GenerateToken04(uint32(machineinfo.AppId), string(p.SnId), machineinfo.ServerSecret, 3600, "") + token, err := token04.GenerateToken04(uint32(machineinfo.AppId), strconv.Itoa(int(p.SnId)), machineinfo.ServerSecret, 3600, "") if err != nil { logger.Logger.Error(err) return @@ -676,6 +677,8 @@ func (this *PlayGame) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, para //1-弱力抓 2 -强力抓 sceneEx.OnPlayerSMGrabOp(p.SnId, int32(sceneEx.machineId), grapType) + sceneEx.Gaming = false + case rule.ClawDollPlayerOpMove: if !sceneEx.CheckMoveOp(playerEx) { @@ -703,6 +706,7 @@ func (this *PlayGame) OnTick(s *base.Scene) { if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollScenePlayTimeout { if sceneEx.TimeOutPlayGrab() { + sceneEx.Gaming = false logger.Logger.Trace("PlayGame OnTick TimeOutPlayGrab SnId", sceneEx.playingSnid, " machineId:", sceneEx.machineId) }