娃娃机playing判定修改

This commit is contained in:
kxdd 2024-09-07 16:08:46 +08:00
parent de339225d2
commit f26cb4d2ff
2 changed files with 21 additions and 2 deletions

View File

@ -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
}

View File

@ -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)
}