Compare commits
2 Commits
b8765251cc
...
149d896cc8
Author | SHA1 | Date |
---|---|---|
|
149d896cc8 | |
|
8c743fb804 |
|
@ -12,14 +12,32 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
ClawDollSceneWaitTimeout = time.Second * 2 //等待倒计时
|
ClawDollSceneWaitTimeout = time.Second * 6 //等待倒计时
|
||||||
ClawDollSceneStartTimeout = time.Second * 6 //开始倒计时
|
ClawDollSceneStartTimeout = time.Second * 15 //开始倒计时
|
||||||
ClawDollSceneBilledTimeout = time.Second * 2 //结算
|
ClawDollSceneBilledTimeout = time.Second * 2 //结算
|
||||||
)
|
)
|
||||||
|
|
||||||
// 玩家操作
|
// 玩家操作
|
||||||
const (
|
const (
|
||||||
ClawDollPlayerOpScore = iota + 1 // 上分
|
ClawDollPlayerOpPayCoin = iota + 1 // 上分 投币
|
||||||
ClawDollPlayerOpGo // 下抓
|
ClawDollPlayerOpGo // 下抓
|
||||||
ClawDollPlayerOpMove // 移动方向
|
ClawDollPlayerOpMove // 玩家操控动作 // 1-前 2-后 3-左 4-右
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
ButtonFront = iota + 1 /*前*/
|
||||||
|
ButtonBack /*后*/
|
||||||
|
ButtonLeft /*左*/
|
||||||
|
ButtonRight /*右*/
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
MoveStop = 0 /*移动停止*/
|
||||||
|
MoveStar = 1 /*移动开始*/
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
ClawWeak = iota + 1 //弱力抓
|
||||||
|
ClawStrong //强力抓
|
||||||
|
ClawGain //必出抓
|
||||||
)
|
)
|
||||||
|
|
|
@ -31,9 +31,9 @@ func (this *PlayerEx) CanOp(sceneEx *SceneEx) bool {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *PlayerEx) CanPayCoinByPos() bool {
|
func (this *PlayerEx) CanPayCoin() bool {
|
||||||
|
|
||||||
return false
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// 游戏新一局 设置数据
|
// 游戏新一局 设置数据
|
||||||
|
|
|
@ -91,7 +91,7 @@ func (e *SceneEx) playerOpPack(snId int32, opcode int, opRetCode clawdoll.OpResu
|
||||||
SnId: proto.Int32(snId),
|
SnId: proto.Int32(snId),
|
||||||
OpCode: proto.Int32(int32(opcode)),
|
OpCode: proto.Int32(int32(opcode)),
|
||||||
Params: params,
|
Params: params,
|
||||||
OpRetCode: clawdoll.OpResultCode_OPRC_Success,
|
OpRetCode: opRetCode,
|
||||||
}
|
}
|
||||||
|
|
||||||
proto.SetDefaults(pack)
|
proto.SetDefaults(pack)
|
||||||
|
|
|
@ -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/dollmachine"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"mongo.games.com/goserver/core"
|
"mongo.games.com/goserver/core"
|
||||||
|
@ -429,6 +430,10 @@ func (this *StateStart) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, pa
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch opcode {
|
||||||
|
case rule.ClawDollPlayerOpPayCoin:
|
||||||
|
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -488,6 +493,34 @@ func (this *PlayGame) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, para
|
||||||
return true
|
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 := &dollmachine.SMDollMachineMove{
|
||||||
|
Snid: proto.Int32(playerEx.SnId),
|
||||||
|
Id: proto.Int32(int32(opcode)),
|
||||||
|
Direction: proto.Int32(int32(params[0])),
|
||||||
|
}
|
||||||
|
|
||||||
|
sceneEx.SendToMachine(int(dollmachine.DollMachinePacketID_PACKET_SMDollMachineMove), pack)
|
||||||
|
case rule.ClawDollPlayerOpMove:
|
||||||
|
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -523,7 +523,7 @@ type SCCLAWDOLLRoundGameBilled struct {
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
RoundId int32 `protobuf:"varint,1,opt,name=RoundId,proto3" json:"RoundId,omitempty"` //牌局ID
|
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"` //抓取结果
|
ClowResult int32 `protobuf:"varint,2,opt,name=ClowResult,proto3" json:"ClowResult,omitempty"` //抓取结果 1-中奖 其他未中奖
|
||||||
Award int64 `protobuf:"varint,3,opt,name=Award,proto3" json:"Award,omitempty"` //获奖金额
|
Award int64 `protobuf:"varint,3,opt,name=Award,proto3" json:"Award,omitempty"` //获奖金额
|
||||||
Balance int64 `protobuf:"varint,4,opt,name=Balance,proto3" json:"Balance,omitempty"` //玩家余额
|
Balance int64 `protobuf:"varint,4,opt,name=Balance,proto3" json:"Balance,omitempty"` //玩家余额
|
||||||
}
|
}
|
||||||
|
@ -594,7 +594,7 @@ type SCCLAWDOLLRoomState struct {
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
State int32 `protobuf:"varint,1,opt,name=State,proto3" json:"State,omitempty"` //房间当前状态
|
State int32 `protobuf:"varint,1,opt,name=State,proto3" json:"State,omitempty"` //房间当前状态 //1-空闲 2-无法使用
|
||||||
Params []float32 `protobuf:"fixed32,2,rep,packed,name=Params,proto3" json:"Params,omitempty"`
|
Params []float32 `protobuf:"fixed32,2,rep,packed,name=Params,proto3" json:"Params,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,14 +71,14 @@ message SCCLAWDOLLOp {
|
||||||
//发送给客户端的数据 单局结算
|
//发送给客户端的数据 单局结算
|
||||||
message SCCLAWDOLLRoundGameBilled {
|
message SCCLAWDOLLRoundGameBilled {
|
||||||
int32 RoundId = 1; //牌局ID
|
int32 RoundId = 1; //牌局ID
|
||||||
int32 ClowResult = 2; //抓取结果
|
int32 ClowResult = 2; //抓取结果 1-中奖 其他未中奖
|
||||||
int64 Award = 3; //获奖金额
|
int64 Award = 3; //获奖金额
|
||||||
int64 Balance = 4; //玩家余额
|
int64 Balance = 4; //玩家余额
|
||||||
}
|
}
|
||||||
|
|
||||||
//房间状态
|
//房间状态
|
||||||
message SCCLAWDOLLRoomState {
|
message SCCLAWDOLLRoomState {
|
||||||
int32 State = 1; //房间当前状态
|
int32 State = 1; //房间当前状态 //1-空闲 2-无法使用
|
||||||
repeated float Params = 2;
|
repeated float Params = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue