下抓通知添加

This commit is contained in:
kxdd 2024-08-13 15:33:44 +08:00
parent d703046f63
commit 49b0c6cc00
9 changed files with 72 additions and 16 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -12,14 +12,32 @@ const (
)
const (
ClawDollSceneWaitTimeout = time.Second * 2 //等待倒计时
ClawDollSceneStartTimeout = time.Second * 6 //开始倒计时
ClawDollSceneBilledTimeout = time.Second * 2 //结算
ClawDollSceneWaitTimeout = time.Second * 6 //等待倒计时
ClawDollSceneStartTimeout = time.Second * 15 //开始倒计时
ClawDollSceneBilledTimeout = time.Second * 2 //结算
)
// 玩家操作
const (
ClawDollPlayerOpScore = iota + 1 // 上分
ClawDollPlayerOpGo // 下抓
ClawDollPlayerOpMove // 移动方向
ClawDollPlayerOpPayCoin = iota + 1 // 上分 投币
ClawDollPlayerOpGo // 下抓
ClawDollPlayerOpMove // 玩家操控动作 // 1-前 2-后 3-左 4-右
)
const (
ButtonFront = iota + 1 /*前*/
ButtonBack /*后*/
ButtonLeft /*左*/
ButtonRight /*右*/
)
const (
MoveStop = 0 /*移动停止*/
MoveStar = 1 /*移动开始*/
)
const (
ClawWeak = iota + 1 //弱力抓
ClawStrong //强力抓
ClawGain //必出抓
)

View File

@ -31,7 +31,7 @@ func (this *PlayerEx) CanOp(sceneEx *SceneEx) bool {
return true
}
func (this *PlayerEx) CanPayCoinByPos() bool {
func (this *PlayerEx) CanPayCoin() bool {
return false
}

View File

@ -92,7 +92,7 @@ func (e *SceneEx) playerOpPack(snId int32, opcode int, opRetCode clawdoll.OpResu
SnId: proto.Int32(snId),
OpCode: proto.Int32(int32(opcode)),
Params: params,
OpRetCode: clawdoll.OpResultCode_OPRC_Success,
OpRetCode: opRetCode,
}
proto.SetDefaults(pack)

View File

@ -3,6 +3,7 @@ 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"
@ -444,6 +445,11 @@ func (this *StateStart) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, pa
return true
}
switch opcode {
case rule.ClawDollPlayerOpPayCoin:
}
return false
}
@ -503,6 +509,36 @@ func (this *PlayGame) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, para
return true
}
sceneEx, ok := s.ExtraData.(*SceneEx)
if !ok {
return false
}
playerEx, ok := p.ExtraData.(*PlayerEx)
if !ok {
return false
}
switch opcode {
case rule.ClawDollPlayerOpPayCoin:
// 投币检测
if !playerEx.CanPayCoin() {
return false
}
sceneEx.OnPlayerSCOp(p, opcode, clawdoll.OpResultCode_OPRC_Success, params)
case rule.ClawDollPlayerOpGo:
pack := &machine.SMDollMachineGrab{
Snid: proto.Int32(playerEx.SnId),
Id: proto.Int32(int32(sceneEx.machineId)),
TypeId: proto.Int32(int32(1)),
}
sceneEx.SendToMachine(int(machine.DollMachinePacketID_PACKET_SMDollMachineGrab), pack)
case rule.ClawDollPlayerOpMove:
}
return false
}

View File

@ -394,8 +394,8 @@ type CSCLAWDOLLOp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
OpCode int32 `protobuf:"varint,1,opt,name=OpCode,proto3" json:"OpCode,omitempty"`
Params []int64 `protobuf:"varint,2,rep,packed,name=Params,proto3" json:"Params,omitempty"`
OpCode int32 `protobuf:"varint,1,opt,name=OpCode,proto3" json:"OpCode,omitempty"` //操作码 1:上分 投币 2:下抓 3:玩家操控动作
Params []int64 `protobuf:"varint,2,rep,packed,name=Params,proto3" json:"Params,omitempty"` //操作参数 1:无
}
func (x *CSCLAWDOLLOp) Reset() {
@ -522,8 +522,8 @@ type SCCLAWDOLLRoundGameBilled struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
RoundId int32 `protobuf:"varint,1,opt,name=RoundId,proto3" json:"RoundId,omitempty"` //局ID
ClowResult int32 `protobuf:"varint,2,opt,name=ClowResult,proto3" json:"ClowResult,omitempty"` //抓取结果
RoundId int32 `protobuf:"varint,1,opt,name=RoundId,proto3" json:"RoundId,omitempty"` //局ID
ClowResult int32 `protobuf:"varint,2,opt,name=ClowResult,proto3" json:"ClowResult,omitempty"` //抓取结果 0: 没有抓住, 1抓住娃娃
Award int64 `protobuf:"varint,3,opt,name=Award,proto3" json:"Award,omitempty"` //获奖金额
Balance int64 `protobuf:"varint,4,opt,name=Balance,proto3" json:"Balance,omitempty"` //玩家余额
}

View File

@ -56,8 +56,10 @@ message SCCLAWDOLLRoomInfo {
//
message CSCLAWDOLLOp {
int32 OpCode = 1;
repeated int64 Params = 2;
int32 OpCode = 1; // 1: 2: 3:
repeated int64 Params = 2; // 1:
// 2:
// 3Params[0] 1- 2- 3- 4-
}
//
@ -70,8 +72,8 @@ message SCCLAWDOLLOp {
//
message SCCLAWDOLLRoundGameBilled {
int32 RoundId = 1; //ID
int32 ClowResult = 2; //
int32 RoundId = 1; //ID
int32 ClowResult = 2; // 0: 1
int64 Award = 3; //
int64 Balance = 4; //
}