Compare commits
3 Commits
9963ef130a
...
979645567e
Author | SHA1 | Date |
---|---|---|
|
979645567e | |
|
b74f284654 | |
|
8f59f4d03a |
|
@ -71,3 +71,7 @@ const (
|
|||
Zego_ForbidRTCStream = iota + 1
|
||||
Zego_ResumeRTCStream = iota + 1
|
||||
)
|
||||
|
||||
const (
|
||||
ClawDoorItemID = 40003
|
||||
)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue