diff --git a/gamerule/clawdoll/constants.go b/gamerule/clawdoll/constants.go index e855368..8c0386f 100644 --- a/gamerule/clawdoll/constants.go +++ b/gamerule/clawdoll/constants.go @@ -71,3 +71,7 @@ const ( Zego_ForbidRTCStream = iota + 1 Zego_ResumeRTCStream = iota + 1 ) + +const ( + ClawDoorItemID = 40003 +) diff --git a/gamesrv/clawdoll/action_clawdoll.go b/gamesrv/clawdoll/action_clawdoll.go index bd83ddc..9affeb7 100644 --- a/gamesrv/clawdoll/action_clawdoll.go +++ b/gamesrv/clawdoll/action_clawdoll.go @@ -2,6 +2,7 @@ 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" @@ -52,10 +53,20 @@ func (h *CSPlayerOpHandler) Process(s *netlib.Session, packetid int, data interf func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data interface{}) error { logger.Logger.Tracef("收到返回上分结果!!!!!!!!!!") if msg, ok := data.(*machine.MSDollMachineoPerateResult); ok { - p := base.PlayerMgrSington.GetPlayerBySnId(msg.GetSnid()) if p == nil { - logger.Logger.Warn("CSGetTokenHandler p == nil") + logger.Logger.Warn("MSDollMachineoCoinResultHandler p == nil") + return nil + } + + s := p.GetScene() + if s == nil { + logger.Logger.Warn("MSDollMachineoCoinResultHandler p.scene == nil") + return nil + } + + sceneEx, ok := s.ExtraData.(*SceneEx) + if !ok { return nil } @@ -68,10 +79,17 @@ func MSDollMachineoCoinResultHandler(session *netlib.Session, packetId int, data } case 2: if msg.Result == 1 { - + // 获得娃娃卡 + logger.Logger.Tracef("下抓成功!!!!!!!!!!!!snid = ", msg.Snid) } else { logger.Logger.Tracef("下抓失败!!!!!!!!!!!!snid = ", msg.Snid) } + + s.ChangeSceneState(rule.ClawDollSceneStateBilled) + sceneEx.SetPlayingState(int32(rule.ClawDollSceneStateBilled)) + + ClawdollBroadcastRoomState(s) + ClawdollSendPlayerInfo(s) } } return nil diff --git a/gamesrv/clawdoll/player_clawdoll.go b/gamesrv/clawdoll/player_clawdoll.go index 2fb434e..3dd7af7 100644 --- a/gamesrv/clawdoll/player_clawdoll.go +++ b/gamesrv/clawdoll/player_clawdoll.go @@ -1,7 +1,9 @@ package clawdoll import ( + rule "mongo.games.com/game/gamerule/clawdoll" "mongo.games.com/game/gamesrv/base" + "mongo.games.com/game/srvdata" "mongo.games.com/goserver/core/logger" ) @@ -37,11 +39,18 @@ func (this *PlayerEx) CanOp(sceneEx *SceneEx) bool { // 能否投币 func (this *PlayerEx) CanPayCoin() bool { + + itemID := int32(rule.ClawDoorItemID) + itemData := srvdata.GameItemMgr.Get(this.Platform, itemID) + if itemData == nil { + return false + } + return true } // 投币消耗 -func (this *PlayerEx) CostPlayCoin() bool { +func (this *PlayerEx) CostPlayCoin(count int32) bool { return true } @@ -106,3 +115,16 @@ func (this *PlayerEx) GetClawState() int32 { func (this *PlayerEx) SetClawState(state int32) { this.clawDollState = state } + +func (this *PlayerEx) GetItemCount(itemID int32) int64 { + itemData := srvdata.GameItemMgr.Get(this.Platform, itemID) + if itemData != nil { + v, ok := this.Items[itemID] + if ok { + return v + } else { + return 0 + } + } + return 0 +} diff --git a/gamesrv/clawdoll/scenepolicy_clawdoll.go b/gamesrv/clawdoll/scenepolicy_clawdoll.go index 9bfb767..b9ad90d 100644 --- a/gamesrv/clawdoll/scenepolicy_clawdoll.go +++ b/gamesrv/clawdoll/scenepolicy_clawdoll.go @@ -700,7 +700,7 @@ func (this *PlayGame) OnTick(s *base.Scene) { if time.Now().Sub(sceneEx.StateStartTime) > rule.ClawDollScenePlayTimeout { if sceneEx.TimeOutPlayGrab() { - //logger.Logger.Trace("PlayGame OnTick TimeOutPlayGrab SnId", sceneEx.playingSnid, " machineId:", sceneEx.machineId) + logger.Logger.Trace("PlayGame OnTick TimeOutPlayGrab SnId", sceneEx.playingSnid, " machineId:", sceneEx.machineId) } s.ChangeSceneState(rule.ClawDollSceneStateBilled) diff --git a/public b/public index 06da9b3..00b9fce 160000 --- a/public +++ b/public @@ -1 +1 @@ -Subproject commit 06da9b31abec96f3936877d7d73069e9852781ff +Subproject commit 00b9fce886af5b6a926aa804d3cad33be9ea0793