娃娃机playing判定修改
This commit is contained in:
parent
de339225d2
commit
f26cb4d2ff
|
|
@ -43,8 +43,9 @@ func (this *PlayerEx) CanPayCoin() bool {
|
||||||
itemID := int32(rule.ClawDoorItemID)
|
itemID := int32(rule.ClawDoorItemID)
|
||||||
itemCount := this.GetItemCount(itemID)
|
itemCount := this.GetItemCount(itemID)
|
||||||
if itemCount < 1 {
|
if itemCount < 1 {
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
itemData := srvdata.GameItemMgr.Get(this.Platform, itemID)
|
itemData := srvdata.GameItemMgr.Get(this.Platform, itemID)
|
||||||
if itemData == nil {
|
if itemData == nil {
|
||||||
return false
|
return false
|
||||||
|
|
@ -67,12 +68,26 @@ func (this *PlayerEx) CostPlayCoin(count int32) bool {
|
||||||
// 能否移动
|
// 能否移动
|
||||||
func (this *PlayerEx) CanMove() bool {
|
func (this *PlayerEx) CanMove() bool {
|
||||||
|
|
||||||
|
s := this.GetScene()
|
||||||
|
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
|
||||||
|
if !sceneEx.Gaming {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 能否下抓
|
// 能否下抓
|
||||||
func (this *PlayerEx) CanGrab() bool {
|
func (this *PlayerEx) CanGrab() bool {
|
||||||
|
|
||||||
|
s := this.GetScene()
|
||||||
|
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
|
||||||
|
if !sceneEx.Gaming {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"github.com/zegoim/zego_server_assistant/token/go/src/token04"
|
"github.com/zegoim/zego_server_assistant/token/go/src/token04"
|
||||||
"mongo.games.com/game/gamesrv/action"
|
"mongo.games.com/game/gamesrv/action"
|
||||||
"mongo.games.com/game/protocol/clawdoll"
|
"mongo.games.com/game/protocol/clawdoll"
|
||||||
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"mongo.games.com/goserver/core"
|
"mongo.games.com/goserver/core"
|
||||||
|
|
@ -288,7 +289,7 @@ func (this *PolicyClawdoll) SendGetVideoToken(s *base.Scene, p *base.Player, sce
|
||||||
}
|
}
|
||||||
|
|
||||||
//生成token
|
//生成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 {
|
if err != nil {
|
||||||
logger.Logger.Error(err)
|
logger.Logger.Error(err)
|
||||||
return
|
return
|
||||||
|
|
@ -676,6 +677,8 @@ func (this *PlayGame) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, para
|
||||||
//1-弱力抓 2 -强力抓
|
//1-弱力抓 2 -强力抓
|
||||||
sceneEx.OnPlayerSMGrabOp(p.SnId, int32(sceneEx.machineId), grapType)
|
sceneEx.OnPlayerSMGrabOp(p.SnId, int32(sceneEx.machineId), grapType)
|
||||||
|
|
||||||
|
sceneEx.Gaming = false
|
||||||
|
|
||||||
case rule.ClawDollPlayerOpMove:
|
case rule.ClawDollPlayerOpMove:
|
||||||
|
|
||||||
if !sceneEx.CheckMoveOp(playerEx) {
|
if !sceneEx.CheckMoveOp(playerEx) {
|
||||||
|
|
@ -703,6 +706,7 @@ func (this *PlayGame) OnTick(s *base.Scene) {
|
||||||
if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollScenePlayTimeout {
|
if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollScenePlayTimeout {
|
||||||
|
|
||||||
if sceneEx.TimeOutPlayGrab() {
|
if sceneEx.TimeOutPlayGrab() {
|
||||||
|
sceneEx.Gaming = false
|
||||||
logger.Logger.Trace("PlayGame OnTick TimeOutPlayGrab SnId", sceneEx.playingSnid, " machineId:", sceneEx.machineId)
|
logger.Logger.Trace("PlayGame OnTick TimeOutPlayGrab SnId", sceneEx.playingSnid, " machineId:", sceneEx.machineId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue