Compare commits
No commits in common. "b18696718913f551466937a74a839ace34898035" and "e044a590d469f94b3e5171a6054c4057b26b234a" have entirely different histories.
b186967189
...
e044a590d4
|
@ -35,7 +35,6 @@ const (
|
||||||
ThirteenWaterPlayerOpReset = 4 // 重新选牌
|
ThirteenWaterPlayerOpReset = 4 // 重新选牌
|
||||||
ThirteenWaterPlayerJoin = 5 // 加入游戏
|
ThirteenWaterPlayerJoin = 5 // 加入游戏
|
||||||
ThirteenWaterPlayerOpSelect = 6 // 预选牌
|
ThirteenWaterPlayerOpSelect = 6 // 预选牌
|
||||||
ThirteenWaterPlayerOpAuto = 7 // 自动摆牌 1自动 2手动
|
|
||||||
)
|
)
|
||||||
const (
|
const (
|
||||||
ThirteenWaterSceneWaitTimeout = time.Second * 2 //等待倒计时
|
ThirteenWaterSceneWaitTimeout = time.Second * 2 //等待倒计时
|
||||||
|
|
|
@ -1,8 +1,6 @@
|
||||||
package thirteen
|
package thirteen
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
|
||||||
|
|
||||||
"mongo.games.com/goserver/core/logger"
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
|
||||||
"mongo.games.com/game/gamerule/thirteen"
|
"mongo.games.com/game/gamerule/thirteen"
|
||||||
|
@ -27,10 +25,7 @@ type PlayerEx struct {
|
||||||
odds int32
|
odds int32
|
||||||
totalScore int64
|
totalScore int64
|
||||||
defGroup *thirteen.Group
|
defGroup *thirteen.Group
|
||||||
playerPool int // 个人水池分
|
playerPool int // 个人水池分
|
||||||
AutoState int // 是否自动模式
|
|
||||||
AutoMill time.Duration // 自动时长
|
|
||||||
HandMill time.Duration // 手动时长
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *PlayerEx) Clear() {
|
func (this *PlayerEx) Clear() {
|
||||||
|
@ -47,9 +42,6 @@ func (this *PlayerEx) Clear() {
|
||||||
this.gainCoin = 0
|
this.gainCoin = 0
|
||||||
this.taxCoin = 0
|
this.taxCoin = 0
|
||||||
this.deterMine = false
|
this.deterMine = false
|
||||||
this.AutoState = 0
|
|
||||||
this.AutoMill = time.Duration(0)
|
|
||||||
this.HandMill = time.Duration(0)
|
|
||||||
this.score = [7]int64{0, 0, 0, 0, 0, 0, 0}
|
this.score = [7]int64{0, 0, 0, 0, 0, 0, 0}
|
||||||
this.tableScore = [6]int64{}
|
this.tableScore = [6]int64{}
|
||||||
this.winThreePos = make(map[int]int64)
|
this.winThreePos = make(map[int]int64)
|
||||||
|
|
|
@ -86,7 +86,6 @@ type SceneEx struct {
|
||||||
ctrlType int // 1控赢 2控输 0不控
|
ctrlType int // 1控赢 2控输 0不控
|
||||||
cardsArr [][13]int
|
cardsArr [][13]int
|
||||||
cardsGroup []map[int]*rule.Group
|
cardsGroup []map[int]*rule.Group
|
||||||
timestamp time.Time
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewThirteenWaterSceneData(s *base.Scene) *SceneEx {
|
func NewThirteenWaterSceneData(s *base.Scene) *SceneEx {
|
||||||
|
|
|
@ -4,7 +4,6 @@ import (
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
||||||
"mongo.games.com/goserver/core"
|
"mongo.games.com/goserver/core"
|
||||||
"mongo.games.com/goserver/core/logger"
|
"mongo.games.com/goserver/core/logger"
|
||||||
|
|
||||||
|
@ -12,7 +11,6 @@ import (
|
||||||
rule "mongo.games.com/game/gamerule/thirteen"
|
rule "mongo.games.com/game/gamerule/thirteen"
|
||||||
"mongo.games.com/game/gamesrv/base"
|
"mongo.games.com/game/gamesrv/base"
|
||||||
"mongo.games.com/game/model"
|
"mongo.games.com/game/model"
|
||||||
"mongo.games.com/game/mq"
|
|
||||||
"mongo.games.com/game/proto"
|
"mongo.games.com/game/proto"
|
||||||
"mongo.games.com/game/protocol/thirteen"
|
"mongo.games.com/game/protocol/thirteen"
|
||||||
)
|
)
|
||||||
|
@ -810,11 +808,6 @@ func (this *StateOp) OnEnter(s *base.Scene) {
|
||||||
logger.Logger.Tracef("(this *StateOp) OnEnter, sceneid=%v", s.GetSceneId())
|
logger.Logger.Tracef("(this *StateOp) OnEnter, sceneid=%v", s.GetSceneId())
|
||||||
this.BaseState.OnEnter(s)
|
this.BaseState.OnEnter(s)
|
||||||
ThirteenWaterBroadcastRoomState(s)
|
ThirteenWaterBroadcastRoomState(s)
|
||||||
sceneEx, ok := s.ExtraData.(*SceneEx)
|
|
||||||
if !ok {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
sceneEx.timestamp = time.Now()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 玩家操作
|
// 玩家操作
|
||||||
|
@ -876,7 +869,6 @@ func (this *StateOp) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, param
|
||||||
playerEx.Trusteeship = 0
|
playerEx.Trusteeship = 0
|
||||||
playerEx.UnmarkFlag(base.PlayerState_Auto)
|
playerEx.UnmarkFlag(base.PlayerState_Auto)
|
||||||
playerEx.deterMine = true
|
playerEx.deterMine = true
|
||||||
playerEx.AutoState = 0
|
|
||||||
//如果所有玩家都确认牌之后 可以直接开始下一阶段
|
//如果所有玩家都确认牌之后 可以直接开始下一阶段
|
||||||
a := true
|
a := true
|
||||||
for _, v := range sceneEx.players {
|
for _, v := range sceneEx.players {
|
||||||
|
@ -950,13 +942,6 @@ func (this *StateOp) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, param
|
||||||
playerEx.deterMine = false
|
playerEx.deterMine = false
|
||||||
returnFunc(thirteen.OpResultCode_OPRC_Sucess, true)
|
returnFunc(thirteen.OpResultCode_OPRC_Sucess, true)
|
||||||
|
|
||||||
case rule.ThirteenWaterPlayerOpAuto:
|
|
||||||
if len(params) == 0 {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
playerEx.AutoState = int(params[0])
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
@ -973,15 +958,6 @@ func (this *StateOp) OnLeave(s *base.Scene) {
|
||||||
|
|
||||||
for _, player := range sceneEx.players {
|
for _, player := range sceneEx.players {
|
||||||
if player != nil && player.IsGameing() {
|
if player != nil && player.IsGameing() {
|
||||||
|
|
||||||
mq.Write(model.ThirteenAutoLog{
|
|
||||||
Id: primitive.NewObjectID().Hex(),
|
|
||||||
LogId: sceneEx.logid,
|
|
||||||
SnId: player.SnId,
|
|
||||||
AutoTime: player.AutoMill.Milliseconds(),
|
|
||||||
HandTime: player.HandMill.Milliseconds(),
|
|
||||||
}, mq.BackThirteenAutoLog)
|
|
||||||
|
|
||||||
// 使用预选牌
|
// 使用预选牌
|
||||||
if player.preCardsO != nil && player.preCardsO.PokerType != -1 && (player.cardsO == nil || player.cardsO.PokerType == -1) {
|
if player.preCardsO != nil && player.preCardsO.PokerType != -1 && (player.cardsO == nil || player.cardsO.PokerType == -1) {
|
||||||
player.cardsO = player.preCardsO
|
player.cardsO = player.preCardsO
|
||||||
|
@ -1161,23 +1137,7 @@ func (this *StateOp) OnLeave(s *base.Scene) {
|
||||||
func (this *StateOp) OnTick(s *base.Scene) {
|
func (this *StateOp) OnTick(s *base.Scene) {
|
||||||
this.BaseState.OnTick(s)
|
this.BaseState.OnTick(s)
|
||||||
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
|
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
|
||||||
now := time.Now()
|
if time.Now().Sub(sceneEx.StateStartTime) > sceneEx.GetBaiPai() {
|
||||||
addTime := now.Sub(sceneEx.timestamp)
|
|
||||||
for _, v := range sceneEx.seats {
|
|
||||||
if v != nil && v.IsGameing() {
|
|
||||||
switch v.AutoState {
|
|
||||||
case 2:
|
|
||||||
v.AutoMill += addTime
|
|
||||||
case 1:
|
|
||||||
v.HandMill += addTime
|
|
||||||
default:
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sceneEx.timestamp = now
|
|
||||||
|
|
||||||
if now.Sub(sceneEx.StateStartTime) > sceneEx.GetBaiPai() {
|
|
||||||
s.ChangeSceneState(rule.ThirteenWaterSceneStateShowCards)
|
s.ChangeSceneState(rule.ThirteenWaterSceneStateShowCards)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
package model
|
|
||||||
|
|
||||||
type ThirteenAutoLog struct {
|
|
||||||
Id string
|
|
||||||
LogId string
|
|
||||||
SnId int32
|
|
||||||
AutoTime int64 // 自动时长,毫秒
|
|
||||||
HandTime int64 // 手动时长,毫秒
|
|
||||||
}
|
|
19
mq/export.go
19
mq/export.go
|
@ -55,18 +55,18 @@ type RabbitMQData struct {
|
||||||
Data interface{}
|
Data interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *MessageMgr) Send(data interface{}, name string, options ...broker.PublishOption) error {
|
func (c *MessageMgr) Send(data interface{}, name ...string) error {
|
||||||
if msg, ok := data.(*RabbitMQData); ok {
|
if msg, ok := data.(*RabbitMQData); ok {
|
||||||
return Send(msg.MQName, msg.Data, options...)
|
return Send(msg.MQName, msg.Data)
|
||||||
}
|
}
|
||||||
if len(name) > 0 {
|
if len(name) > 0 && name[0] != "" {
|
||||||
return Send(name, data, options...)
|
return Send(name[0], data)
|
||||||
}
|
}
|
||||||
key := c.getName(data)
|
key := c.getName(data)
|
||||||
if key == "" {
|
if key == "" {
|
||||||
key = "_null_"
|
key = "_null_"
|
||||||
}
|
}
|
||||||
return Send(key, data, options...)
|
return Send(key, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
type RegisterHandlerParam struct {
|
type RegisterHandlerParam struct {
|
||||||
|
@ -132,14 +132,7 @@ func RegisterMessage(param *RegisterMessageParam) {
|
||||||
// Write 发送消息
|
// Write 发送消息
|
||||||
// 默认队列名称规则:队列前缀_消息结构体名称
|
// 默认队列名称规则:队列前缀_消息结构体名称
|
||||||
func Write(data interface{}, name ...string) error {
|
func Write(data interface{}, name ...string) error {
|
||||||
if len(name) > 0 && name[0] != "" {
|
return MessageMgrSingle.Send(data, name...)
|
||||||
return MessageMgrSingle.Send(data, name[0])
|
|
||||||
}
|
|
||||||
return MessageMgrSingle.Send(data, "")
|
|
||||||
}
|
|
||||||
|
|
||||||
func WriteWithOptions(data interface{}, name string, opts ...broker.PublishOption) error {
|
|
||||||
return MessageMgrSingle.Send(data, name, opts...)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// RegisterHandler 注册消息处理函数
|
// RegisterHandler 注册消息处理函数
|
||||||
|
|
|
@ -21,11 +21,9 @@ const (
|
||||||
BackOnlineGame = "back_onlinegame"
|
BackOnlineGame = "back_onlinegame"
|
||||||
)
|
)
|
||||||
|
|
||||||
// go后端
|
// mgrsrv
|
||||||
|
|
||||||
const (
|
const ()
|
||||||
BackThirteenAutoLog = "b_thirteenautolog"
|
|
||||||
)
|
|
||||||
|
|
||||||
// worldsrv 消息
|
// worldsrv 消息
|
||||||
|
|
||||||
|
|
|
@ -386,7 +386,7 @@ type CSThirteenPlayerOp struct {
|
||||||
sizeCache protoimpl.SizeCache
|
sizeCache protoimpl.SizeCache
|
||||||
unknownFields protoimpl.UnknownFields
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
OpCode int32 `protobuf:"varint,1,opt,name=OpCode,proto3" json:"OpCode,omitempty"` // 1:确定牌 2站起状态 3test 4重新选牌 5加入游戏 6预选 7自动手动切换(1自动,2手动)
|
OpCode int32 `protobuf:"varint,1,opt,name=OpCode,proto3" json:"OpCode,omitempty"` // 1:确定牌 2站起状态 3test 4重新选牌 5加入游戏 6预选
|
||||||
// 确定牌时,两种参数规则,都可以
|
// 确定牌时,两种参数规则,都可以
|
||||||
// 第一种:玩家从推荐牌型中选择一个,把Poker.IndexType发过来(减少数据传输)
|
// 第一种:玩家从推荐牌型中选择一个,把Poker.IndexType发过来(减少数据传输)
|
||||||
// 第二种:按头墩中墩尾墩顺序把牌发过来
|
// 第二种:按头墩中墩尾墩顺序把牌发过来
|
||||||
|
|
|
@ -73,7 +73,7 @@ message SCThirteenPlayerCards {
|
||||||
//玩家操作
|
//玩家操作
|
||||||
//PACKET_CSThirteenPlayerOp
|
//PACKET_CSThirteenPlayerOp
|
||||||
message CSThirteenPlayerOp {
|
message CSThirteenPlayerOp {
|
||||||
int32 OpCode = 1; // 1:确定牌 2站起状态 3test 4重新选牌 5加入游戏 6预选 7自动手动切换(1自动,2手动)
|
int32 OpCode = 1; // 1:确定牌 2站起状态 3test 4重新选牌 5加入游戏 6预选
|
||||||
|
|
||||||
// 确定牌时,两种参数规则,都可以
|
// 确定牌时,两种参数规则,都可以
|
||||||
// 第一种:玩家从推荐牌型中选择一个,把Poker.IndexType发过来(减少数据传输)
|
// 第一种:玩家从推荐牌型中选择一个,把Poker.IndexType发过来(减少数据传输)
|
||||||
|
|
Loading…
Reference in New Issue