Compare commits

..

No commits in common. "f23cfda6295d1dcb57af57675fe1f26b294a8e79" and "8ff978db72ccf8f1b61ec16e7d3e89452f8b3b27" have entirely different histories.

4 changed files with 30 additions and 51 deletions

View File

@ -31,24 +31,11 @@ func (this *PlayerEx) CanOp(sceneEx *SceneEx) bool {
return true return true
} }
// 能否投币
func (this *PlayerEx) CanPayCoin() bool { func (this *PlayerEx) CanPayCoin() bool {
return true return true
} }
// 能否移动
func (this *PlayerEx) CanMove() bool {
return true
}
// 能否下抓
func (this *PlayerEx) CanGrab() bool {
return true
}
// 游戏新一局 设置数据 // 游戏新一局 设置数据
func (this *PlayerEx) ReStartGame() { func (this *PlayerEx) ReStartGame() {
this.ReDataStartGame() this.ReDataStartGame()

View File

@ -6,7 +6,6 @@ import (
"mongo.games.com/game/gamesrv/base" "mongo.games.com/game/gamesrv/base"
"mongo.games.com/game/proto" "mongo.games.com/game/proto"
"mongo.games.com/game/protocol/clawdoll" "mongo.games.com/game/protocol/clawdoll"
"mongo.games.com/game/protocol/machine"
"mongo.games.com/goserver/core/logger" "mongo.games.com/goserver/core/logger"
"mongo.games.com/goserver/core/netlib" "mongo.games.com/goserver/core/netlib"
"mongo.games.com/goserver/srvlib" "mongo.games.com/goserver/srvlib"
@ -209,30 +208,6 @@ 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{}) { func (this *SceneEx) SendToMachine(pid int, msg interface{}) {
this.machineConn = srvlib.ServerSessionMgrSington.GetSession(1, 10, 1001) this.machineConn = srvlib.ServerSessionMgrSington.GetSession(1, 10, 1001)

View File

@ -3,6 +3,7 @@ package clawdoll
import ( import (
"mongo.games.com/game/gamesrv/action" "mongo.games.com/game/gamesrv/action"
"mongo.games.com/game/protocol/clawdoll" "mongo.games.com/game/protocol/clawdoll"
"mongo.games.com/game/protocol/machine"
"time" "time"
"mongo.games.com/goserver/core" "mongo.games.com/goserver/core"
@ -460,7 +461,13 @@ func (this *StateStart) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, pa
} }
// 1-前 2-后 3-左 4-右 5-投币 // 1-前 2-后 3-左 4-右 5-投币
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), int32(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)
} }
return false return false
@ -539,22 +546,34 @@ func (this *PlayGame) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, para
} }
// 1-前 2-后 3-左 4-右 5-投币 // 1-前 2-后 3-左 4-右 5-投币
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), int32(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.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params) //sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params)
case rule.ClawDollPlayerOpGo: case rule.ClawDollPlayerOpGo:
if !playerEx.CanGrab() {
return false pack := &machine.SMDollMachineGrab{
Snid: proto.Int32(p.SnId),
Id: proto.Int32(int32(sceneEx.machineId)),
TypeId: proto.Int32(int32(2)),
} }
//1-弱力抓 2 -强力抓 sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachineGrab), pack)
sceneEx.OnPlayerSMGrabOp(p.SnId, int32(sceneEx.machineId), int32(2))
case rule.ClawDollPlayerOpMove: case rule.ClawDollPlayerOpMove:
if !playerEx.CanMove() {
return false
}
// 1-前 2-后 3-左 4-右 5-投币 // 1-前 2-后 3-左 4-右 5-投币
sceneEx.OnPlayerSMPerateOp(p.SnId, int32(sceneEx.machineId), int32(params[0])) 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)
} }
return false return false

View File

@ -93,7 +93,6 @@ func SMDollMachinePerateHandler(session *netlib.Session, packetId int, data inte
Snid: msg.Snid, Snid: msg.Snid,
Id: msg.GetId(), Id: msg.GetId(),
Result: int32(buf[4]), Result: int32(buf[4]),
TypeId: 1,
}) })
} }
return nil return nil
@ -113,11 +112,10 @@ func SMDollMachineGrabHandler(session *netlib.Session, packetId int, data interf
} }
send := func(net.Conn) { send := func(net.Conn) {
session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineoPerateResult), &machine.MSDollMachineoPerateResult{ session.Send(int(machine.DollMachinePacketID_PACKET_MSDollMachineGrab), &machine.MSDollMachineGrab{
Snid: msg.Snid, Snid: msg.Snid,
Id: msg.GetId(), Id: msg.GetId(),
Result: 1, Result: 1,
TypeId: 2,
}) })
} }