2025-06-08 00:52:17 +08:00
|
|
|
package room
|
|
|
|
|
2025-06-08 22:29:01 +08:00
|
|
|
//
|
|
|
|
//import (
|
|
|
|
// "encoding/json"
|
|
|
|
// "game/common/proto/pb"
|
|
|
|
// "github.com/fox/fox/ipb"
|
|
|
|
// "time"
|
|
|
|
//)
|
|
|
|
//
|
|
|
|
//func (rm *ColorRoom) Ready() {
|
|
|
|
// rm.Table.ResetGameRoundId()
|
|
|
|
// rm.ResetData(true)
|
|
|
|
// rm.Table.EndGame()
|
|
|
|
//
|
|
|
|
// if isFunding := rm.jackpotMgr.Load(rm.RoomCfg.ColorPinoyLiveConfig.InitJackpot); isFunding {
|
|
|
|
// rm.kafkaJackpotFunding(rm.RoomCfg.ColorPinoyLiveConfig.InitJackpot)
|
|
|
|
// rm.jackpotFunding = rm.RoomCfg.ColorPinoyLiveConfig.InitJackpot
|
|
|
|
// log.Debugf(rm.Log("发生垫资:%v", rm.jackpotFunding))
|
|
|
|
// } else {
|
|
|
|
// rm.jackpotFunding = 0
|
|
|
|
// log.Debugf(rm.Log("没有垫资"))
|
|
|
|
// }
|
|
|
|
// rm.jackpotUser = nil
|
|
|
|
// rm.costJackpot = 0
|
|
|
|
// log.Debugf(rm.Log("游戏开始costJackpot重置为0"))
|
|
|
|
// rm.SetGameStatus(pb.ColorPinoyLiveGameStatus_ColorPinoyLiveStartReady)
|
|
|
|
// rm.TimerJob, _ = rm.Table.AddTimer(time.Duration(rm.RoomCfg.TimeConf.Readymove), func() {
|
|
|
|
// rm.Start()
|
|
|
|
// })
|
|
|
|
//
|
|
|
|
// // 初始化默认骰子
|
|
|
|
// // rm.initDefaultDiceGameRoundReady()
|
|
|
|
// // 开始动画消息
|
|
|
|
// msg := new(pb.ColorPinoyLiveStatusMessage)
|
|
|
|
// msg.Status = int32(rm.GetGameStatus())
|
|
|
|
// msg.StatusTime = int32(rm.RoomCfg.TimeConf.Startmove)
|
|
|
|
// msg.Jackpot = rm.jackpotMgr.GetJackpot()
|
|
|
|
// rm.Table.Broadcast(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeGameReady), msg)
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//func (rm *ColorRoom) Start() {
|
|
|
|
// rm.GameRoundStart()
|
|
|
|
// rm.InitBigOddsBetAreas()
|
|
|
|
// // 推送房间筹码选择规则
|
|
|
|
// rm.SendRuleInfo()
|
|
|
|
// rm.checkUserBet()
|
|
|
|
// // 选择列表中前6个用户上座
|
|
|
|
// rm.SelectUserListBalanceTopSitDownChair()
|
|
|
|
// rm.startAt = time.Now().Unix()
|
|
|
|
// rm.Table.StartGame()
|
|
|
|
// // 开始动画消息
|
|
|
|
// msg := new(pb.ColorPinoyLiveStatusMessage)
|
|
|
|
// msg.Status = int32(rm.GetGameStatus())
|
|
|
|
// msg.StatusTime = int32(rm.RoomCfg.TimeConf.Startmove)
|
|
|
|
// // rm.jackpotMgr.Load(rm.Cfg.InitJackpot)
|
|
|
|
// msg.Jackpot = rm.jackpotMgr.GetJackpot()
|
|
|
|
// rm.Table.Broadcast(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeGameStart), msg)
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//func (rm *ColorRoom) StartBet() {
|
|
|
|
// rm.SetGameStatus(pb.ColorPinoyLiveGameStatus_ColorPinoyLiveBetStatus)
|
|
|
|
// rm.TimerJob, _ = rm.Table.AddTimer(time.Duration(rm.RoomCfg.TimeConf.Startbet), func() {
|
|
|
|
// rm.EndBet()
|
|
|
|
// })
|
|
|
|
//
|
|
|
|
// // 发送开始下注消息
|
|
|
|
// msg := new(pb.ColorPinoyLiveStatusMessage)
|
|
|
|
// msg.Status = int32(rm.GetGameStatus())
|
|
|
|
// msg.StatusTime = int32(rm.RoomCfg.TimeConf.Startbet)
|
|
|
|
// msg.Jackpot = rm.jackpotMgr.GetJackpot()
|
|
|
|
// rm.Table.Broadcast(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeGameStartBet), msg)
|
|
|
|
// // log.Debug("pb. 开始下注.....StartBet()")
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//func (rm *ColorRoom) EndBet() {
|
|
|
|
// rm.SetGameStatus(pb.ColorPinoyLiveGameStatus_ColorPinoyLiveEndBetMovie)
|
|
|
|
// // 停止下注就扣钱
|
|
|
|
// rm.StartTransInoutBet()
|
|
|
|
//
|
|
|
|
// // 发送停止下注消息
|
|
|
|
// msg := new(pb.ColorPinoyLiveStatusMessage)
|
|
|
|
// msg.Status = int32(rm.GetGameStatus())
|
|
|
|
// msg.StatusTime = int32(rm.RoomCfg.TimeConf.Endmove)
|
|
|
|
// msg.Jackpot = rm.jackpotMgr.GetJackpot()
|
|
|
|
// rm.Table.Broadcast(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeGameEndBet), msg)
|
|
|
|
//
|
|
|
|
// // log.Debug("pb. 停止下注.....EndBet()")
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//// 开3个 dice
|
|
|
|
//func (rm *ColorRoom) openThreeDice() {
|
|
|
|
// // log.Debug("aabb openThreeDice")
|
|
|
|
// rm.SetGameStatus(pb.ColorPinoyLiveGameStatus_ColorPinoyLiveOpenThreeDice)
|
|
|
|
// rm.Table.AddTimer(time.Duration(rm.RoomCfg.TimeConf.OpenThreeDice), func() {
|
|
|
|
// // log.Debug("aabb settle")
|
|
|
|
// rm.CompareDiceResult()
|
|
|
|
// rm.Settle()
|
|
|
|
// })
|
|
|
|
// // 发送开三个骰子消息
|
|
|
|
// rm._aniThreeDiceRouteIndex = int32(rand.RandIntM(0, 48))
|
|
|
|
// msg := new(pb.ColorPinoyLiveGameOpenThreeDice)
|
|
|
|
// msg.Status = int32(rm.GetGameStatus())
|
|
|
|
// msg.AniRouteIndex = rm._aniThreeDiceRouteIndex // 掉落路径
|
|
|
|
//
|
|
|
|
// for _, dice := range rm.NormalDices {
|
|
|
|
// msg.Color = append(msg.Color, pb.ColorPinoyLiveDiceColorType(model.GetColor(dice)))
|
|
|
|
// }
|
|
|
|
// rm.Table.Broadcast(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeGameOpenThreeDice), msg)
|
|
|
|
//}
|
|
|
|
//
|
|
|
|
//// 结算
|
|
|
|
//func (rm *ColorRoom) Settle() {
|
|
|
|
// // log.Debug("aabb 结算")
|
|
|
|
// rm.SetGameStatus(pb.ColorPinoyLiveGameStatus_ColorPinoyLiveSettleStatus)
|
|
|
|
// rm.endAt = time.Now().Unix()
|
|
|
|
// rm.SetUserSettleMsg()
|
|
|
|
//}
|