Compare commits

...

2 Commits

Author SHA1 Message Date
kxdd ae4ab17075 Merge branch 'ma' of https://git.pogorockgames.com/mango-games/server/game into ma 2024-08-14 15:54:38 +08:00
kxdd 2c8ce6a467 添加上分投币 2024-08-14 15:53:27 +08:00
2 changed files with 32 additions and 3 deletions

View File

@ -33,7 +33,7 @@ func (this *PlayerEx) CanOp(sceneEx *SceneEx) bool {
func (this *PlayerEx) CanPayCoin() bool { func (this *PlayerEx) CanPayCoin() bool {
return false return true
} }
// 游戏新一局 设置数据 // 游戏新一局 设置数据

View File

@ -445,9 +445,29 @@ func (this *StateStart) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, pa
return true return true
} }
sceneEx, ok := s.ExtraData.(*SceneEx)
if !ok {
return false
}
playerEx, ok := p.ExtraData.(*PlayerEx)
if !ok {
return false
}
switch opcode { switch opcode {
case rule.ClawDollPlayerOpPayCoin: case rule.ClawDollPlayerOpPayCoin:
if !playerEx.CanPayCoin() {
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(5)),
}
sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachinePerate), pack)
} }
return false return false
@ -524,14 +544,23 @@ func (this *PlayGame) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, para
if !playerEx.CanPayCoin() { if !playerEx.CanPayCoin() {
return false return false
} }
sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params)
// 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.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params)
case rule.ClawDollPlayerOpGo: case rule.ClawDollPlayerOpGo:
pack := &machine.SMDollMachineGrab{ pack := &machine.SMDollMachineGrab{
Snid: proto.Int32(p.SnId), Snid: proto.Int32(p.SnId),
Id: proto.Int32(int32(sceneEx.machineId)), Id: proto.Int32(int32(sceneEx.machineId)),
TypeId: proto.Int32(int32(1)), TypeId: proto.Int32(int32(2)),
} }
sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachineGrab), pack) sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachineGrab), pack)