Compare commits

..

No commits in common. "b18696718913f551466937a74a839ace34898035" and "e044a590d469f94b3e5171a6054c4057b26b234a" have entirely different histories.

9 changed files with 12 additions and 80 deletions

View File

@ -35,7 +35,6 @@ const (
ThirteenWaterPlayerOpReset = 4 // 重新选牌
ThirteenWaterPlayerJoin = 5 // 加入游戏
ThirteenWaterPlayerOpSelect = 6 // 预选牌
ThirteenWaterPlayerOpAuto = 7 // 自动摆牌 1自动 2手动
)
const (
ThirteenWaterSceneWaitTimeout = time.Second * 2 //等待倒计时

View File

@ -1,8 +1,6 @@
package thirteen
import (
"time"
"mongo.games.com/goserver/core/logger"
"mongo.games.com/game/gamerule/thirteen"
@ -28,9 +26,6 @@ type PlayerEx struct {
totalScore int64
defGroup *thirteen.Group
playerPool int // 个人水池分
AutoState int // 是否自动模式
AutoMill time.Duration // 自动时长
HandMill time.Duration // 手动时长
}
func (this *PlayerEx) Clear() {
@ -47,9 +42,6 @@ func (this *PlayerEx) Clear() {
this.gainCoin = 0
this.taxCoin = 0
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.tableScore = [6]int64{}
this.winThreePos = make(map[int]int64)

View File

@ -86,7 +86,6 @@ type SceneEx struct {
ctrlType int // 1控赢 2控输 0不控
cardsArr [][13]int
cardsGroup []map[int]*rule.Group
timestamp time.Time
}
func NewThirteenWaterSceneData(s *base.Scene) *SceneEx {

View File

@ -4,7 +4,6 @@ import (
"strconv"
"time"
"go.mongodb.org/mongo-driver/bson/primitive"
"mongo.games.com/goserver/core"
"mongo.games.com/goserver/core/logger"
@ -12,7 +11,6 @@ import (
rule "mongo.games.com/game/gamerule/thirteen"
"mongo.games.com/game/gamesrv/base"
"mongo.games.com/game/model"
"mongo.games.com/game/mq"
"mongo.games.com/game/proto"
"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())
this.BaseState.OnEnter(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.UnmarkFlag(base.PlayerState_Auto)
playerEx.deterMine = true
playerEx.AutoState = 0
//如果所有玩家都确认牌之后 可以直接开始下一阶段
a := true
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
returnFunc(thirteen.OpResultCode_OPRC_Sucess, true)
case rule.ThirteenWaterPlayerOpAuto:
if len(params) == 0 {
return true
}
playerEx.AutoState = int(params[0])
default:
return false
}
@ -973,15 +958,6 @@ func (this *StateOp) OnLeave(s *base.Scene) {
for _, player := range sceneEx.players {
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) {
player.cardsO = player.preCardsO
@ -1161,23 +1137,7 @@ func (this *StateOp) OnLeave(s *base.Scene) {
func (this *StateOp) OnTick(s *base.Scene) {
this.BaseState.OnTick(s)
if sceneEx, ok := s.ExtraData.(*SceneEx); ok {
now := time.Now()
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() {
if time.Now().Sub(sceneEx.StateStartTime) > sceneEx.GetBaiPai() {
s.ChangeSceneState(rule.ThirteenWaterSceneStateShowCards)
}
}

View File

@ -1,9 +0,0 @@
package model
type ThirteenAutoLog struct {
Id string
LogId string
SnId int32
AutoTime int64 // 自动时长,毫秒
HandTime int64 // 手动时长,毫秒
}

View File

@ -55,18 +55,18 @@ type RabbitMQData struct {
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 {
return Send(msg.MQName, msg.Data, options...)
return Send(msg.MQName, msg.Data)
}
if len(name) > 0 {
return Send(name, data, options...)
if len(name) > 0 && name[0] != "" {
return Send(name[0], data)
}
key := c.getName(data)
if key == "" {
key = "_null_"
}
return Send(key, data, options...)
return Send(key, data)
}
type RegisterHandlerParam struct {
@ -132,14 +132,7 @@ func RegisterMessage(param *RegisterMessageParam) {
// Write 发送消息
// 默认队列名称规则队列前缀_消息结构体名称
func Write(data interface{}, name ...string) error {
if len(name) > 0 && name[0] != "" {
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...)
return MessageMgrSingle.Send(data, name...)
}
// RegisterHandler 注册消息处理函数

View File

@ -21,11 +21,9 @@ const (
BackOnlineGame = "back_onlinegame"
)
// go后端
// mgrsrv
const (
BackThirteenAutoLog = "b_thirteenautolog"
)
const ()
// worldsrv 消息

View File

@ -386,7 +386,7 @@ type CSThirteenPlayerOp struct {
sizeCache protoimpl.SizeCache
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发过来减少数据传输
// 第二种:按头墩中墩尾墩顺序把牌发过来

View File

@ -73,7 +73,7 @@ message SCThirteenPlayerCards {
//
//PACKET_CSThirteenPlayerOp
message CSThirteenPlayerOp {
int32 OpCode = 1; // 1: 2 3test 4 5 6 7(12)
int32 OpCode = 1; // 1: 2 3test 4 5 6
// ,
// Poker.IndexType发过来