封装移动投币操作
This commit is contained in:
parent
ae4ab17075
commit
a4b4a0b2a0
|
|
@ -31,11 +31,24 @@ func (this *PlayerEx) CanOp(sceneEx *SceneEx) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// 能否投币
|
||||
func (this *PlayerEx) CanPayCoin() bool {
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// 能否移动
|
||||
func (this *PlayerEx) CanMove() bool {
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// 能否下抓
|
||||
func (this *PlayerEx) CanGrab() bool {
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// 游戏新一局 设置数据
|
||||
func (this *PlayerEx) ReStartGame() {
|
||||
this.ReDataStartGame()
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import (
|
|||
"mongo.games.com/game/gamesrv/base"
|
||||
"mongo.games.com/game/proto"
|
||||
"mongo.games.com/game/protocol/clawdoll"
|
||||
"mongo.games.com/game/protocol/machine"
|
||||
"mongo.games.com/goserver/core/logger"
|
||||
"mongo.games.com/goserver/core/netlib"
|
||||
"mongo.games.com/goserver/srvlib"
|
||||
|
|
@ -208,6 +209,30 @@ func (this *SceneEx) BackupPlayer(p *PlayerEx, isBilled bool) {
|
|||
}
|
||||
}
|
||||
|
||||
// OnPlayerSMGrabOp 下抓 //1-弱力抓 2 -强力抓 3-必出抓
|
||||
func (this *SceneEx) OnPlayerSMGrabOp(SnId, Id, GrabType int32) {
|
||||
|
||||
pack := &machine.SMDollMachineGrab{
|
||||
Snid: proto.Int32(SnId),
|
||||
Id: proto.Int32(Id),
|
||||
TypeId: proto.Int32(GrabType),
|
||||
}
|
||||
|
||||
this.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachineGrab), pack)
|
||||
}
|
||||
|
||||
// OnPlayerSCOp 发送玩家操作情况 1-前 2-后 3-左 4-右 5-投币
|
||||
func (this *SceneEx) OnPlayerSMPerateOp(SnId, Id, Perate int32) {
|
||||
|
||||
pack := &machine.SMDollMachineoPerate{
|
||||
Snid: proto.Int32(SnId),
|
||||
Id: proto.Int32(Id),
|
||||
Perate: proto.Int32(Perate),
|
||||
}
|
||||
|
||||
this.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachinePerate), pack)
|
||||
}
|
||||
|
||||
// 向娃娃机主机发送消息
|
||||
func (this *SceneEx) SendToMachine(pid int, msg interface{}) {
|
||||
if this.machineConn == nil {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package clawdoll
|
|||
import (
|
||||
"mongo.games.com/game/gamesrv/action"
|
||||
"mongo.games.com/game/protocol/clawdoll"
|
||||
"mongo.games.com/game/protocol/machine"
|
||||
"time"
|
||||
|
||||
"mongo.games.com/goserver/core"
|
||||
|
|
@ -461,13 +460,7 @@ func (this *StateStart) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, pa
|
|||
}
|
||||
|
||||
// 1-前 2-后 3-左 4-右 5-投币
|
||||
pack := &machine.SMDollMachineoPerate{
|
||||
Snid: proto.Int32(p.SnId),
|
||||
Id: proto.Int32(int32(sceneEx.machineId)),
|
||||
Perate: proto.Int32(int32(5)),
|
||||
}
|
||||
|
||||
sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachinePerate), pack)
|
||||
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), int32(5))
|
||||
}
|
||||
|
||||
return false
|
||||
|
|
@ -546,34 +539,22 @@ func (this *PlayGame) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, para
|
|||
}
|
||||
|
||||
// 1-前 2-后 3-左 4-右 5-投币
|
||||
pack := &machine.SMDollMachineoPerate{
|
||||
Snid: proto.Int32(p.SnId),
|
||||
Id: proto.Int32(int32(sceneEx.machineId)),
|
||||
Perate: proto.Int32(int32(5)),
|
||||
}
|
||||
|
||||
sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachinePerate), pack)
|
||||
|
||||
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), int32(5))
|
||||
//sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params)
|
||||
case rule.ClawDollPlayerOpGo:
|
||||
|
||||
pack := &machine.SMDollMachineGrab{
|
||||
Snid: proto.Int32(p.SnId),
|
||||
Id: proto.Int32(int32(sceneEx.machineId)),
|
||||
TypeId: proto.Int32(int32(2)),
|
||||
if !playerEx.CanGrab() {
|
||||
return false
|
||||
}
|
||||
|
||||
sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachineGrab), pack)
|
||||
//1-弱力抓 2 -强力抓
|
||||
sceneEx.OnPlayerSMGrabOp(p.SnId, int32(sceneEx.machineId), int32(2))
|
||||
case rule.ClawDollPlayerOpMove:
|
||||
if !playerEx.CanMove() {
|
||||
return false
|
||||
}
|
||||
|
||||
// 1-前 2-后 3-左 4-右 5-投币
|
||||
pack := &machine.SMDollMachineoPerate{
|
||||
Snid: proto.Int32(p.SnId),
|
||||
Id: proto.Int32(int32(sceneEx.machineId)),
|
||||
Perate: proto.Int32(int32(params[0])),
|
||||
}
|
||||
|
||||
sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachinePerate), pack)
|
||||
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), int32(params[0]))
|
||||
}
|
||||
|
||||
return false
|
||||
|
|
|
|||
Loading…
Reference in New Issue