Compare commits
3 Commits
8ff978db72
...
f23cfda629
Author | SHA1 | Date |
---|---|---|
|
f23cfda629 | |
|
4dc78ff468 | |
|
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{}) {
|
||||
this.machineConn = srvlib.ServerSessionMgrSington.GetSession(1, 10, 1001)
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -93,6 +93,7 @@ func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data inte
|
|||
Snid: msg.Snid,
|
||||
Id: msg.GetId(),
|
||||
Result: int32(buf[4]),
|
||||
TypeId: 1,
|
||||
})
|
||||
}
|
||||
return nil
|
||||
|
@ -112,10 +113,11 @@ func SMDollMachineGrabHandler(session *netlib.Session, packetId int, data interf
|
|||
}
|
||||
|
||||
send := func(net.Conn) {
|
||||
session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineGrab), &machine.MSDollMachineGrab{
|
||||
session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{
|
||||
Snid: msg.Snid,
|
||||
Id: msg.GetId(),
|
||||
Result: 1,
|
||||
TypeId: 2,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue