重写消息
This commit is contained in:
parent
0cd61a60c2
commit
758af0443f
@ -24,26 +24,12 @@ type ColorRoomConfig struct {
|
|||||||
JpYRate int `json:"jp_y_rate"` // jp池追加比例
|
JpYRate int `json:"jp_y_rate"` // jp池追加比例
|
||||||
JpXYRate int `json:"jp_xy_rate"` // 系统池为正时jackpot追加比例
|
JpXYRate int `json:"jp_xy_rate"` // 系统池为正时jackpot追加比例
|
||||||
|
|
||||||
AreaBetLimit int64 `json:"area_bet_limit"` // 下注区域自己的下注限制
|
AreaBetLimit int64 `json:"area_bet_limit"` // 下注区域自己的下注限制
|
||||||
|
NoBetCountMax int `json:"no_bet_count_max"` // 未操作回合踢出房间
|
||||||
NoBetCountMax int `json:"no_bet_count_max"` // 未操作回合踢出房间
|
BetList [][]int64 `json:"bet_list"` // 筹码
|
||||||
BetList [][]int64 `json:"bet_list"` // 筹码
|
BetLevel []int64 `json:"bet_level"` // 筹码等级
|
||||||
BetLevel []int64 `json:"bet_level"` // 筹码等级
|
BetMap map[int64][]int32
|
||||||
OneCreateMin int32 `json:"one_create_min"` // 一次创建机器最少数
|
TotalBetLimit int64 `json:"total_bet_limit"`
|
||||||
OneCreateMax int32 `json:"one_create_max"` // 一次创建机器人最大数
|
|
||||||
UserAddRobotNum int32 `json:"user_add_robot_num"` // 真人+机器人最小数
|
|
||||||
UserAddRobotNumMax int32 `json:"user_add_robot_num_max"` // 真人+机器人最大数
|
|
||||||
OneDeleteNum int32 `json:"one_delete_num"` // 一次删除机器人数量
|
|
||||||
BalanceMin int64 `json:"balance_min"` // 机器人生成最小金币
|
|
||||||
BalanceMax int64 `json:"balance_max"` // 机器人生成最大金币
|
|
||||||
BalanceMinDelete int64 `json:"balance_min_delete"` // 机器人低于多少金币删除
|
|
||||||
RobotCreateTime int32 `json:"robot_create_time"` // 多少时间创建机器人
|
|
||||||
RobotDeleteTime int32 `json:"robot_delete_time"` // 多少时间删除机器人
|
|
||||||
RobotBetNumMin int32 `json:"robot_bet_num_min"` // 机器人每轮下注最少次数
|
|
||||||
RobotBetNumMax int32 `json:"robot_bet_num_max"` // 机器人每轮下注最大次数
|
|
||||||
OpenRobot bool `json:"open_robot"` // 机器人开关
|
|
||||||
BetMap map[int64][]int32
|
|
||||||
TotalBetLimit int64 `json:"total_bet_limit"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ColorGameTiming struct {
|
type ColorGameTiming struct {
|
||||||
|
@ -2,579 +2,270 @@ syntax = "proto3";
|
|||||||
package pb;
|
package pb;
|
||||||
option go_package = "common/proto/pb";
|
option go_package = "common/proto/pb";
|
||||||
|
|
||||||
|
import "code.proto";
|
||||||
|
|
||||||
|
// 奖励档位
|
||||||
|
enum ColorPrizeArea
|
||||||
|
{
|
||||||
|
CPA_Single_0 = 0; // 单色投注区域开出单色
|
||||||
|
CPA_Single_1 = 1; // 单色投注区域开出双色
|
||||||
|
CPA_Single_2 = 2; // 单色投注区域开出三色
|
||||||
|
CPA_Double = 3; // 双色投注区域
|
||||||
|
CPA_Three = 4; // 三色投注区域
|
||||||
|
}
|
||||||
|
|
||||||
|
// 投注区域赔率范围配置信息
|
||||||
|
message ColorPrizeAreaRange
|
||||||
|
{
|
||||||
|
ColorPrizeArea pos = 1; // 下注区域为单色区0-2时,该值表明是单色还是双色,三色不同的赔率
|
||||||
|
int64 minMul = 2;
|
||||||
|
int64 maxMul = 3;
|
||||||
|
}
|
||||||
|
|
||||||
// color玩法配置信息
|
// color玩法配置信息
|
||||||
message ColorRoomInfo
|
message ColorRoomConfig
|
||||||
{
|
{
|
||||||
|
repeated int64 betList = 3; // 下注档位
|
||||||
|
repeated ColorPrizeAreaRange mulRangeConfig = 5; // 赔率显示
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//骰子颜色类型
|
//骰子颜色类型
|
||||||
enum ColorPinoyLiveDiceColorType {
|
enum ColorType
|
||||||
ColorPinoyLiveType_Void = 0;
|
{
|
||||||
ColorPinoyLiveType_YELLOW = 1; //黄色
|
CT_Yellow = 0; // 黄色
|
||||||
ColorPinoyLiveType_WHITE = 2; //白色
|
CT_White = 1; // 白色
|
||||||
ColorPinoyLiveType_PINK = 3; //粉色
|
CT_Pink = 2; // 粉色
|
||||||
ColorPinoyLiveType_BLUE = 4; //蓝色
|
CT_Blue = 3; // 蓝色
|
||||||
ColorPinoyLiveType_RED = 5; //红色
|
CT_Red = 4; // 红色
|
||||||
ColorPinoyLiveType_GREEN = 6; //绿色
|
CT_Green = 5; // 绿色
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 带jackpot版本的押注类型
|
// 押注区域
|
||||||
enum ColorPinoyLiveBetTypeJP {
|
enum ColorBetArea
|
||||||
CLJ_Yellow = 0; // 黄色
|
{
|
||||||
CLJ_White = 1; // 白色
|
CBA_Yellow = 0; // 黄色
|
||||||
CLJ_Pink = 2; // 粉色
|
CBA_White = 1; // 白色
|
||||||
CLJ_Blue = 3; // 蓝色
|
CBA_Pink = 2; // 粉色
|
||||||
CLJ_Red = 4; // 红色
|
CBA_Blue = 3; // 蓝色
|
||||||
CLJ_Green = 5; // 绿色
|
CBA_Red = 4; // 红色
|
||||||
|
CBA_Green = 5; // 绿色
|
||||||
|
|
||||||
CLJ_Double_Yellow = 6; // 双黄色
|
CBA_Yellow2 = 6; // 双黄色
|
||||||
CLJ_Double_White = 7; // 双白色
|
CBA_White2 = 7; // 双白色
|
||||||
CLJ_Double_Pink = 8; // 双粉色
|
CBA_Pink2 = 8; // 双粉色
|
||||||
CLJ_Double_Blue = 9; // 双蓝色
|
CBA_Blue2 = 9; // 双蓝色
|
||||||
CLJ_Double_Red = 10; // 双红色
|
CBA_Red2 = 10; // 双红色
|
||||||
CLJ_Double_Green = 11; // 双绿色
|
CBA_Green2 = 11; // 双绿色
|
||||||
|
|
||||||
CLJ_Three_Yellow = 12; // 双黄色
|
CBA_Yellow3 = 12; // 三黄色
|
||||||
CLJ_Three_White = 13; // 双白色
|
CBA_White3 = 13; // 三白色
|
||||||
CLJ_Three_Pink = 14; // 双粉色
|
CBA_Pink3 = 14; // 三粉色
|
||||||
CLJ_Three_Blue = 15; // 双蓝色
|
CBA_Blue3 = 15; // 三蓝色
|
||||||
CLJ_Three_Red = 16; // 双红色
|
CBA_Red3 = 16; // 三红色
|
||||||
CLJ_Three_Green = 17; // 双绿色
|
CBA_Green3 = 17; // 三绿色
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//游戏阶段
|
//游戏阶段
|
||||||
enum ColorPinoyLiveGameStatus{
|
enum ColorGameStatus
|
||||||
ColorPinoyLiveStartUnReady = 0;
|
{
|
||||||
ColorPinoyLiveStartReady = 1; //开始321
|
CGS_WaitStart = 0; // 等待准备
|
||||||
ColorPinoyLiveStartMovie = 2; //开始动画
|
CGS_Start = 1; // 开始
|
||||||
ColorPinoyLiveBetStatus = 3; //下注阶段
|
CGS_Betting = 2; // 下注
|
||||||
ColorPinoyLiveEndBetMovie = 4; //结束下注动画
|
CGS_BetEnd = 3; // 下注结束
|
||||||
// ColorPinoyLiveOpenLuckyDice = 5; //开lucky dice
|
CGS_OpenThreeDice = 4; // 开三色
|
||||||
ColorPinoyLiveOpenThreeDice = 6; //开3个 dice
|
CGS_Settle = 5; // 结算
|
||||||
ColorPinoyLiveSettleStatus = 7; //结算阶段
|
|
||||||
ColorPinoyLiveRankStatus = 8; //排行阶段
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ColorPinoyLiveLeaveReason {
|
// 等待状态下房间显示信息
|
||||||
ColorPinoyLiveLeaveReason_void = 0;
|
message ColorRoomWaitStart
|
||||||
ColorPinoyLiveLeaveReason_PLAYER_QUIT_ROOM=2; // 玩家离开游戏
|
{
|
||||||
ColorPinoyLiveLeaveReason_Maintaince=20; //维护公告
|
NotifyColorTrend Trends = 1; // 路途显示
|
||||||
ColorPinoyLiveLeaveReason_Server_Update=21; //服务器更新
|
}
|
||||||
ColorPinoyLiveLeaveReason_Ban=22; //封禁
|
|
||||||
|
// 开始房间显示信息
|
||||||
|
message ColorRoomStart
|
||||||
|
{
|
||||||
|
NotifyColorTrend Trends = 1; // 路途显示
|
||||||
|
}
|
||||||
|
|
||||||
|
// 下注显示信息
|
||||||
|
message ColorRoomBetting
|
||||||
|
{
|
||||||
|
NotifyColorBetAreaInfo betAreaInfo = 1; // 每个投注区域的下注人数,下注金额显示
|
||||||
|
}
|
||||||
|
|
||||||
|
// 结束下注显示信息
|
||||||
|
message ColorRoomEndBet
|
||||||
|
{
|
||||||
|
NotifyColorEndBetting areaMul = 1; // 结束下注后,更新每个投注区域的赔率
|
||||||
|
NotifyColorBetAreaInfo betAreaInfo = 2; // 每个投注区域的下注人数,下注金额显示
|
||||||
|
NotifyColorBigUser bigUser = 3; // 大客数据
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开骰子显示信息
|
||||||
|
message ColorRoomOpenThreeDice
|
||||||
|
{
|
||||||
|
NotifyColorOpenThreeDice dices = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 结算信息
|
||||||
|
message ColorRoomSettle
|
||||||
|
{
|
||||||
|
NotifyColorSettle settle = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 进房间发送房间当前所有信息及状态
|
||||||
|
message NotifyColorRoomInfo
|
||||||
|
{
|
||||||
|
ColorGameStatus status = 1;
|
||||||
|
int64 endTime = 2; // 该状态结束时间
|
||||||
|
ColorRoomConfig config = 101; // 房间配置
|
||||||
|
ColorUser user = 100;
|
||||||
|
ColorRoomWaitStart waitStart = 3; // 等待状态房间数据
|
||||||
|
ColorRoomStart start = 4;
|
||||||
|
ColorRoomBetting betting = 5;
|
||||||
|
ColorRoomEndBet endBet = 6;
|
||||||
|
ColorRoomOpenThreeDice openThreeDice = 7;
|
||||||
|
ColorRoomSettle settle = 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
message ColorPinoyLiveStatusMessage{
|
message NotifyColorGameStart
|
||||||
int32 Status = 1; //状态
|
{
|
||||||
int32 StatusTime = 2; //状态的总时间
|
int64 endTime = 1; // 倒计时3秒后游戏开始,endTime = statusTime+3秒
|
||||||
int32 StatusRemainTime = 3; // 状态还剩多久结束时间
|
}
|
||||||
int64 jackpot = 4;
|
|
||||||
|
message NotifyColorBetting
|
||||||
|
{
|
||||||
|
int64 endTime = 1; // 结束时间
|
||||||
|
}
|
||||||
|
|
||||||
|
message ReqColorBetting
|
||||||
|
{
|
||||||
|
ColorBetArea area = 1;
|
||||||
|
int64 bet = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
message RspColorBetting
|
||||||
|
{
|
||||||
|
ErrCode code = 1;
|
||||||
|
ColorBetArea area = 2;
|
||||||
|
int64 bet = 3;
|
||||||
|
int64 gold = 4; // 玩家一共有多少金币
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新投注区域信息
|
||||||
|
message NotifyColorBetAreaInfo
|
||||||
|
{
|
||||||
|
message BetAreaInfo
|
||||||
|
{
|
||||||
|
ColorBetArea area = 1; // 投注区域
|
||||||
|
int64 totalGold = 2; // 所有玩家总投注金额
|
||||||
|
int32 playerNum = 3; // 投注该区域人数
|
||||||
|
int64 myBet = 4; // 我的投注金额
|
||||||
|
}
|
||||||
|
repeated BetAreaInfo areaInfos = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 奖励类型
|
||||||
|
enum ColorPrizeType
|
||||||
|
{
|
||||||
|
CPT_Normal = 0; // 普通奖励
|
||||||
|
CPT_Big = 1; // 爆奖
|
||||||
|
CPT_Jackpot = 2; // jackpot奖
|
||||||
|
}
|
||||||
|
|
||||||
|
// 投注区域实际赔率,奖励类型
|
||||||
|
message ColorBetAreaMul
|
||||||
|
{
|
||||||
|
ColorBetArea area = 1; // 区域位置
|
||||||
|
ColorPrizeArea prizeArea = 2; // 奖励档位
|
||||||
|
ColorPrizeType prizeType = 3; // 奖励类型
|
||||||
|
int64 mul = 4; // 赔率
|
||||||
|
}
|
||||||
|
|
||||||
|
// 结束投注
|
||||||
|
message NotifyColorEndBetting
|
||||||
|
{
|
||||||
|
int64 endTime = 1; // 结束时间
|
||||||
|
repeated ColorBetAreaMul areaMul = 2; // 更新区域实际赔率
|
||||||
|
int64 jackpot = 3; // 下注结束,更新jackpot值
|
||||||
|
}
|
||||||
|
|
||||||
|
message NotifyColorOpenThreeDice
|
||||||
|
{
|
||||||
|
repeated ColorType color = 1; // 骰子开出颜色 3个
|
||||||
|
int32 aniRouteIndex = 3; // 动画路径
|
||||||
|
repeated ColorBetAreaMul winBetArea = 5; // 中奖区域高亮
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
message ColorPinoyLiveGameOpenThreeDice{
|
// 玩家结算信息
|
||||||
int32 Status = 1; //游戏状态
|
message NotifyColorSettle
|
||||||
repeated ColorPinoyLiveDiceColorType color = 2; //骰子颜色 3个
|
{
|
||||||
int32 aniRouteIndex = 3; // 动画路径
|
message UserBetAreaMul
|
||||||
|
{
|
||||||
|
ColorBetAreaMul areaMul = 1;
|
||||||
|
int64 bet = 2; // 玩家在该区域投注金额
|
||||||
|
int64 win = 3; // 该区域赢钱
|
||||||
|
}
|
||||||
|
repeated UserBetAreaMul userAreaWin = 1; // 每个投注区域的下注及输赢
|
||||||
|
|
||||||
|
repeated ColorType threeDice = 2; // 骰子开出颜色
|
||||||
|
int64 totalWin = 3; // 总输赢
|
||||||
|
int64 totalBet = 4; // 总投注
|
||||||
|
int64 tax = 5; // 税
|
||||||
}
|
}
|
||||||
|
|
||||||
message ColorPinoyLiveBetReq {
|
|
||||||
ColorPinoyLiveBetTypeJP BetType = 1;//下注区域
|
|
||||||
int32 BetLevel = 2;//筹码级别
|
|
||||||
int32 BetIndex = 3;//下注的下标
|
|
||||||
int64 BetAmount = 4;//下注cash
|
|
||||||
}
|
|
||||||
|
|
||||||
// 服务器收到的押注信息
|
|
||||||
message ColorPinoyLiveBetReqs {
|
|
||||||
repeated ColorPinoyLiveBetReq info = 1; // 下注区域数组
|
|
||||||
}
|
|
||||||
|
|
||||||
message ColorPinoyLiveBetResp {
|
|
||||||
int32 code = 1;
|
|
||||||
string msg = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
//游戏中几个玩家的数据
|
//游戏中几个玩家的数据
|
||||||
message ColorPinoyLiveSeatUser {
|
message ColorUser {
|
||||||
string Nick = 1; // 用户昵称
|
string Nick = 1; // 用户昵称
|
||||||
string Head = 2; // 头像
|
string Head = 2; // 头像
|
||||||
int64 Score = 3; // 分数
|
int64 Score = 3; // 分数
|
||||||
int32 SeatId = 4; //在场景中的座位id
|
int32 SeatId = 4; //在场景中的座位id
|
||||||
int64 UserID = 5; //用户ID
|
int64 UserID = 5; //用户ID
|
||||||
}
|
}
|
||||||
// 发送在线人数
|
|
||||||
message ColorPinoyLiveS2COnlinePlayerNum{
|
|
||||||
int64 Num = 1; //
|
|
||||||
}
|
|
||||||
|
|
||||||
// 结束下注,更新大客投注信息
|
// 结束下注,更新大客投注信息
|
||||||
message ColorPinoyLivePlayerBigWinner
|
message NotifyColorBigUser
|
||||||
{
|
{
|
||||||
repeated ColorPinoyLiveBigWinner bigBet = 34; // 大客投注
|
repeated ColorBigUser bigUser = 34; // 大客投注
|
||||||
int64 jackpot = 1; // 下注结束,更新jackpot值
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message ColorPinoyLiveSceneBetInfo{
|
|
||||||
int64 UserBetTotal = 1;//玩家总下注
|
|
||||||
repeated int64 TotalBets = 2;//总各区域下注
|
|
||||||
repeated int64 UserBets = 3;//用户各区域下注
|
|
||||||
ColorPinoyLiveUserInfo UserInfo = 4;//用户信息
|
|
||||||
}
|
|
||||||
|
|
||||||
message ColorPinoyLiveBetArr{
|
// 路途展示
|
||||||
repeated int64 betArr = 3; //下注数组
|
message NotifyColorTrend
|
||||||
}
|
|
||||||
|
|
||||||
// 房间下注规则
|
|
||||||
message ColorPinoyLiveRoomBetRuleMsg{
|
|
||||||
int32 userBetLimit = 1;
|
|
||||||
int64 betMinLimit = 2;//最低携带金币限制
|
|
||||||
repeated ColorPinoyLiveBetArr betLevels = 3;//下注级别
|
|
||||||
repeated int64 level = 4;//等级
|
|
||||||
repeated BetAreaMulRangeConfig mulRangeConfig = 5; // 赔率显示
|
|
||||||
}
|
|
||||||
|
|
||||||
message ColorPinoyLiveTrendGroup{
|
|
||||||
ColorPinoyLiveDiceColorType luckyDice = 1; // 幸运骰子
|
|
||||||
repeated ColorPinoyLiveDiceColorType threeDice = 2; // 3个普通骰子
|
|
||||||
}
|
|
||||||
|
|
||||||
message ColorPinoyLiveTrend{
|
|
||||||
repeated ColorPinoyLiveTrendGroup listTrendGroup = 1;
|
|
||||||
repeated int32 luckStarRate = 2; // 数组索引号为颜色从0-5(ColorPinoyLiveDiceColorType-1)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 腾讯云实时音视频房间参数
|
|
||||||
message TRTCRoomArgs {
|
|
||||||
int32 appId = 1;
|
|
||||||
string strRoomId = 2;
|
|
||||||
string userId = 3;
|
|
||||||
string userSig = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 赢钱最多的6个玩家
|
|
||||||
message ColorPinoyLiveBigWinner
|
|
||||||
{
|
{
|
||||||
string nickName = 5;//名字
|
message ColorRate
|
||||||
|
{
|
||||||
|
ColorType color = 1;
|
||||||
|
int32 rate = 2;
|
||||||
|
}
|
||||||
|
repeated ColorRate colorRate = 1; // 最近30局各颜色中奖概率
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 赢钱或下注最多的6个玩家
|
||||||
|
message ColorBigUser
|
||||||
|
{
|
||||||
|
string nickName = 5; //名字
|
||||||
string avatar = 2;
|
string avatar = 2;
|
||||||
int64 winChips = 1; // 赢取金币
|
int64 winChips = 1; // 赢取金币
|
||||||
repeated int64 areaId = 3; // 赢钱区域(前6个)
|
repeated int64 areaId = 3; // 赢钱区域(前6个)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 投注区域赔率范围配置信息
|
message NotifyColorKickOutUser
|
||||||
message BetAreaMulRangeConfig {
|
|
||||||
ColorPinoyLiveBigBetAreaPos pos = 1; // 下注区域为单色区0-2时,该值表明是单色还是双色,三色不同的赔率
|
|
||||||
int64 minMul = 2;
|
|
||||||
int64 maxMul = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 发送场景数据
|
|
||||||
message SceneMessage{
|
|
||||||
int32 roomID = 1;
|
|
||||||
ColorPinoyLiveStatusMessage gameStatus = 2; // 游戏状态
|
|
||||||
int32 statusTime = 3; // 游戏状态剩余时间(下注倒计时会有 其余时间为 零)
|
|
||||||
int32 onlineNum = 4; // 在线人数
|
|
||||||
ColorPinoyLiveTrend trendList = 5; // 走势图
|
|
||||||
ColorPinoyLiveDiceColorType luckyDice = 6; // 幸运骰子
|
|
||||||
repeated ColorPinoyLiveDiceColorType threeDice = 7; // 3个普通骰子
|
|
||||||
repeated ColorPinoyLiveGameBetAreaInfo betAreaInfo = 8; // 下注信息
|
|
||||||
ColorPinoyLiveRoomBetRuleMsg betRule = 9; // 下注规则
|
|
||||||
// repeated SeatUser userData = 10; // 在坐玩家
|
|
||||||
int32 aniLuckyDiceRouteIndex = 10; // 幸运骰子 掉落路径
|
|
||||||
int32 aniThreeDiceRouteIndex = 11; // 3个骰子 掉落路径
|
|
||||||
int32 onlineNums = 12; // 在线人数
|
|
||||||
repeated ColorPinoyLiveBetReqs lastTimeBet = 13; // 上局下注
|
|
||||||
repeated ColorPinoyLivePlayerData rankList = 14; // 玩家数据
|
|
||||||
int32 bonus = 15; // 幸运骰子加成
|
|
||||||
string artcUrl = 16; // 阿里云拉流地址
|
|
||||||
TRTCRoomArgs trtcRoomArgs = 17; // 腾讯云房间参数
|
|
||||||
int64 balance = 18; // 用户余额
|
|
||||||
repeated ColorPinoyLiveBigWinner bigWinner = 19; // 大客数据
|
|
||||||
repeated string dealerName = 20; // 主播名字
|
|
||||||
int64 jackpot = 21; // jackpot值
|
|
||||||
repeated BetAreaMulRangeConfig mulRangeConfig = 22; // 赔率显示
|
|
||||||
}
|
|
||||||
|
|
||||||
message ColorPinoyLiveUserSitDown{
|
|
||||||
int32 ChairNo = 1;//座位号
|
|
||||||
}
|
|
||||||
|
|
||||||
message ColorPinoyLiveUserSitDownFail{
|
|
||||||
string FailReaSon = 1;//坐下失败
|
|
||||||
}
|
|
||||||
|
|
||||||
message ColorPinoyLiveBetAreaOdd{
|
|
||||||
ColorPinoyLiveBetTypeJP betArea = 1; // 投注区域
|
|
||||||
int64 odd = 4; // 实际中奖赔率
|
|
||||||
int64 viewOdd = 9; // 投注面板显示的赔率,比如单黄区域爆奖显示x10赔率,开出黄白红,则实际中奖赔率是基础赔率而不是爆奖赔率
|
|
||||||
bool isBigOdd = 5; // true:爆奖
|
|
||||||
ColorPinoyLiveBigBetAreaPos bigSingleColorOddPos = 6; // 下注区域为单色区0-2时,该值表明是单色还是双色,三色不同的赔率
|
|
||||||
bool isWin = 7; // 该区域是否中奖
|
|
||||||
bool isJackpot = 8; // true:jackpot位置
|
|
||||||
}
|
|
||||||
|
|
||||||
//扑克消息
|
|
||||||
message ColorPinoyLivePokerMsg{
|
|
||||||
repeated ColorPinoyLiveBetAreaOdd winBetArea = 5; // 中奖区域
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
message ColorPinoyLiveUserInfo{
|
|
||||||
string NikeName = 1;//昵称
|
|
||||||
int64 UserGlod = 2;//玩家金币
|
|
||||||
int64 BetGold = 3;//近20局赢取的金币
|
|
||||||
int32 WinCount = 4;//赢的次数
|
|
||||||
string Head = 5; // 头像
|
|
||||||
int64 UserID = 6;//用户id
|
|
||||||
}
|
|
||||||
|
|
||||||
//用户列表
|
|
||||||
message ColorPinoyLiveUserList{
|
|
||||||
repeated ColorPinoyLiveUserInfo UserList = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//个人 结算消息
|
|
||||||
message ColorPinoyLiveUserSettleMsg{
|
|
||||||
int64 TotalWinBaseBet = 1; //赢区的投注总和
|
|
||||||
int64 UserScore = 2; //用户当前的分数
|
|
||||||
int64 TotalWin = 3; //扣税以后总赢钱
|
|
||||||
repeated int64 UserBets = 4; //用户各区域下注
|
|
||||||
repeated int64 TotalBets = 5; //总各区域下注
|
|
||||||
repeated int64 UserWins = 6; //用户各区域赢钱
|
|
||||||
repeated int64 UserRealWins = 7;//用户各区域赢钱扣税后
|
|
||||||
int64 Tax = 9; //税
|
|
||||||
repeated int64 oddsWins = 10; // // 老版 用户各区域的赢区的结算倍率 todo
|
|
||||||
repeated int64 userBetsCount = 11; // 用户各区域下注次数
|
|
||||||
repeated ColorPinoyLiveBetAreaOdd winAreaOdd = 12; // 中奖区域及中奖赔率
|
|
||||||
int64 jackpotWin = 13; // jackpot奖励
|
|
||||||
repeated string jackpotUserName = 14; // 中jackpot 玩家名单
|
|
||||||
}
|
|
||||||
|
|
||||||
message ColorPinoyLiveGameBetAreaUserInfo{
|
|
||||||
int64 userID = 1;
|
|
||||||
int64 betChips = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 爆奖区域位置
|
|
||||||
enum ColorPinoyLiveBigBetAreaPos {
|
|
||||||
BBA_Single_0 = 0; // 单色投注区域开出单色
|
|
||||||
BBA_Single_1 = 1; // 单色投注区域开出双色
|
|
||||||
BBA_Single_2 = 2; // 单色投注区域开出三色
|
|
||||||
BBA_Double = 3; // 双色投注区域
|
|
||||||
BBA_Three = 4; // 三色投注区域
|
|
||||||
}
|
|
||||||
|
|
||||||
message ColorPinoyLiveGameBetAreaInfo{
|
|
||||||
ColorPinoyLiveBetTypeJP betType = 1;// 下注区域
|
|
||||||
repeated ColorPinoyLiveGameBetAreaUserInfo betChipsInfo = 2;//该下注区的玩家下注情况
|
|
||||||
int32 isWin = 3; //这个区域是否中奖
|
|
||||||
repeated int64 odd = 4; // 赔率 单色投注区域有三个赔率 其它投注区域只有一个赔率
|
|
||||||
bool isBigOdd = 5; // true:爆奖
|
|
||||||
ColorPinoyLiveBigBetAreaPos bigSingleColorOddPos = 6; // 下注区域为单色区0-2时,该值表明是单色还是双色,三色不同的赔率
|
|
||||||
bool isJackpot = 7; // 该区域是否jackpot
|
|
||||||
}
|
|
||||||
|
|
||||||
message ColorPinoyLiveSceneUserInfo{
|
|
||||||
int64 UserID = 1;
|
|
||||||
int32 SceneSeatID = 2;
|
|
||||||
int64 UserScore = 3; //当前分数
|
|
||||||
int64 TotalWin = 4; //扣税以后总赢钱
|
|
||||||
int64 jackpotWin = 5; // jackpot赢钱
|
|
||||||
int64 normalWin = 6; // 非jackpot赢钱
|
|
||||||
}
|
|
||||||
|
|
||||||
//场景上的玩家结算信息
|
|
||||||
message ColorPinoyLiveSceneSettleMsg{
|
|
||||||
repeated ColorPinoyLiveGameBetAreaInfo betAreaInfo = 1; // 下注区域信息
|
|
||||||
// repeated SceneUserInfo UserList = 2; // 有座玩家下注信息
|
|
||||||
int64 noChairTotalWin = 2;
|
|
||||||
int64 sysDealerAreaInfo = 3; // 系统庄是否有赢
|
|
||||||
ColorPinoyLiveSceneUserInfo selfWinInfo = 4; // 自己的输赢
|
|
||||||
ColorPinoyLiveDiceColorType luckyDice = 5; // 幸运骰子
|
|
||||||
repeated ColorPinoyLiveDiceColorType threeDice = 6; // 3个普通骰子
|
|
||||||
ColorPinoyLiveTrendGroup trendGroup = 7;
|
|
||||||
repeated ColorPinoyLiveBetReqs lastTimeBet = 8; // 上局下注
|
|
||||||
ColorPinoyLiveTrend trendGroupEx = 9;
|
|
||||||
repeated ColorPinoyLiveBigWinner bigWinner = 10; // 大客数据
|
|
||||||
int64 jackpot = 11; // jackpot池
|
|
||||||
repeated string jackpotUserName = 12; // 中jackpot 玩家名单
|
|
||||||
}
|
|
||||||
|
|
||||||
//message ExitFail{
|
|
||||||
// string FailReason = 1;//失败的原因
|
|
||||||
//}
|
|
||||||
|
|
||||||
message ColorPinoyLiveKickOutUserMsg{
|
|
||||||
string KickOutReason = 1;//踢出玩家发送原因
|
|
||||||
int32 reason = 2; //1没操作 2服务器维护
|
|
||||||
}
|
|
||||||
|
|
||||||
//次消息一秒一次
|
|
||||||
message ColorPinoyLiveUpdateRoomInfoMsg{
|
|
||||||
int64 OnlineNum = 1; //在线人数
|
|
||||||
}
|
|
||||||
|
|
||||||
//测试
|
|
||||||
message ColorPinoyLivetempCardMsg{
|
|
||||||
bytes LongPoker = 1;
|
|
||||||
bytes HuPoker = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 押注成功时发送的消息
|
|
||||||
message ColorPinoyLiveBetSuccessMessage {
|
|
||||||
int32 SeatId = 1;//座位号,场景中的座位号
|
|
||||||
int32 BetLevel = 2;//下注的下标
|
|
||||||
int32 BetIndex = 3;//下注的下标
|
|
||||||
ColorPinoyLiveBetTypeJP BetType = 4;//下注区域
|
|
||||||
int64 UserBet = 5; //该玩家本次下注
|
|
||||||
int64 UserBets = 6; //该玩家各区域总下注
|
|
||||||
int64 TotalBets = 7;//所有玩家总各区域下注
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// 押注成功返回
|
|
||||||
message ColorPinoyLiveS2CRepetBet {
|
|
||||||
|
|
||||||
repeated ColorPinoyLiveBetSuccessMessage betInfo = 1;
|
|
||||||
int64 UserScore = 2; //用户当前的分数
|
|
||||||
int64 uid = 3;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
message ColorPinoyLiveS2CNoChairRepetBet {
|
|
||||||
repeated ColorPinoyLiveBetSuccessMessage betInfo = 1;
|
|
||||||
repeated int64 UserBets = 2;//用户各区域下注
|
|
||||||
repeated int64 TotalBets = 3;//总各区域下注
|
|
||||||
int64 UserScore = 4; //用户当前的分数
|
|
||||||
int64 uid = 5;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 押注翻倍
|
|
||||||
message ColorPinoyLiveC2SBetDouble {
|
|
||||||
|
|
||||||
}
|
|
||||||
//撤回类型
|
|
||||||
enum ColorPinoyLiveUndoType{
|
|
||||||
ColorPinoyLiveUndoVoid = 0;
|
|
||||||
ColorPinoyLiveUndoOne = 1;//撤回一次
|
|
||||||
ColorPinoyLiveUndoAll = 2; //撤回所有
|
|
||||||
}
|
|
||||||
// 撤回
|
|
||||||
message ColorPinoyLiveC2SUndoBet {
|
|
||||||
ColorPinoyLiveUndoType undoType = 1;
|
|
||||||
}
|
|
||||||
//撤回返回
|
|
||||||
message S2CUndoBet {
|
|
||||||
ColorPinoyLiveUndoType undoType = 1;
|
|
||||||
repeated ColorPinoyLiveBetSuccessMessage betInfo = 2;
|
|
||||||
int64 UserScore = 3; //用户当前的分数
|
|
||||||
int64 uid = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 广播爆奖
|
|
||||||
message ColorPinoyLiveNtfBigOddBetArea
|
|
||||||
{
|
{
|
||||||
repeated ColorPinoyLiveGameBetAreaInfo betAreas = 1; // 下注结束后,每个区域更新是否爆奖
|
ErrCode code = 1; // 踢出原因
|
||||||
}
|
}
|
||||||
|
|
||||||
message ColorPinoyLiveMainteNtf {
|
// 系统维护或流局
|
||||||
ColorPinoyLiveUserInfo userInfo = 1;
|
message NotifyColorMaintain
|
||||||
string maintMsg = 2;//维护消息
|
|
||||||
int64 returnGold = 3;//返回金币
|
|
||||||
}
|
|
||||||
|
|
||||||
message ColorPinoyLiveS2CBetEndFailResult{ // 停止下注和平台扣钱 失败返回
|
|
||||||
int32 code = 1;
|
|
||||||
repeated ColorPinoyLiveS2CRepetBet players = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
message ColorPinoyLiveApplyPropsReq{
|
|
||||||
int64 userId = 1;//使用者 uid
|
|
||||||
int64 acceptUserId = 2;//接受者uid
|
|
||||||
string propsId = 3;//道具id
|
|
||||||
}
|
|
||||||
|
|
||||||
message ColorPinoyLivePlayerPropsResp{
|
|
||||||
int64 applyUserId = 1;//发送者
|
|
||||||
int64 acceptUserId = 2;//接受者
|
|
||||||
string propsId = 3;//道具id
|
|
||||||
int64 chips = 4;//发送者使用道具后金币
|
|
||||||
}
|
|
||||||
|
|
||||||
message ColorPinoyLiveLeaveResp{
|
|
||||||
int32 code = 1; // 0能离开 其他不能离开
|
|
||||||
string msg = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 广播主播名字
|
|
||||||
message ColorPinoyLiveDealerName
|
|
||||||
{
|
{
|
||||||
repeated string dealerName = 1; // 主播名字
|
string msg = 2; // 维护消息
|
||||||
}
|
int64 gold = 3; // 玩家金币重置为该值
|
||||||
|
|
||||||
|
|
||||||
//================================================================================================================================
|
|
||||||
|
|
||||||
message ColorPinoyLivePlayerData {
|
|
||||||
int64 uid = 1;
|
|
||||||
repeated int64 totalBets = 2; // 各区域投注
|
|
||||||
int64 totalBet = 3; // 总投注
|
|
||||||
int64 score = 4; // 总分
|
|
||||||
int64 profit = 5; // 实际总盈利(需按照以小博大&破产逻辑计算并抽水)
|
|
||||||
int64 tax = 6; // 抽水
|
|
||||||
int64 balance = 7; // 余额
|
|
||||||
int64 wait_time = 8; // 等待开局时间
|
|
||||||
int64 pre_balance = 9; // 开局余额
|
|
||||||
repeated int64 userWins = 10; // 用户各区域赢钱
|
|
||||||
repeated int64 userRealWins = 11; // 用户各区域真实赢钱
|
|
||||||
int64 start_time = 12;
|
|
||||||
string nickname = 13; // 用户冗余数据,生产方不需要填入,由API查询写入
|
|
||||||
string avatar = 14; // 用户冗余数据,生产方不需要填入,由API查询写入
|
|
||||||
int64 trans_bet = 15; // 流水投注
|
|
||||||
int64 trans_win = 16; // 流水获利
|
|
||||||
int32 dev_mode = 17; // 用户属性
|
|
||||||
repeated int64 odds = 18; // // 老版 投注区域倍率 todo
|
|
||||||
repeated int64 userBetsCount = 19; // 用户各区域下注次数
|
|
||||||
int32 isDiscard = 20; // 是否废弃 0正常 1废弃
|
|
||||||
repeated ColorPinoyLiveBetAreaOdd areaOdds = 21; // 投注区域倍率
|
|
||||||
}
|
|
||||||
message ColorPinoyLiveDetail {
|
|
||||||
repeated int64 winDoubleColorMul = 1; // // 老版 胜利双色奖励倍率 todo
|
|
||||||
repeated int64 winSingleColorMul = 2; // // 老版 胜利单色奖励倍率 todo
|
|
||||||
int64 bonus = 3; // 幸运骰子加成
|
|
||||||
repeated ColorPinoyLiveDiceColorType threeDice = 4; // 3个普通骰子
|
|
||||||
ColorPinoyLiveDiceColorType luckyDice = 5; // // 老版 幸运骰子 todo
|
|
||||||
repeated ColorPinoyLiveDiceColorType startDice = 6; // 初始位置摆放的骰子
|
|
||||||
repeated string resultImg = 7; // 结果图片
|
|
||||||
repeated string dealerName = 8; // 主播名字
|
|
||||||
repeated ColorPinoyLiveBetAreaOdd betAreaMul = 9; // 新版各区域的赔率
|
|
||||||
int64 jackpotFunding = 10; // 本局jackpot系统垫资多少,没有垫资为0
|
|
||||||
int64 jackpotX = 11; // 赎回比例(反应系统盈亏)
|
|
||||||
int64 jackpotY = 12; // 追加进jackpot池子比例
|
|
||||||
}
|
|
||||||
// 对局详情 (游戏生产)
|
|
||||||
message ColorPinoyLiveEnd {
|
|
||||||
string game_no = 1; // 编号
|
|
||||||
int64 start_time = 2; // 开始时间
|
|
||||||
int64 end_time = 3; // 结束时间
|
|
||||||
int32 level = 4; // 场次
|
|
||||||
int64 base_bet = 5; // 底注
|
|
||||||
repeated ColorPinoyLivePlayerData player_data = 6; // 玩家数据
|
|
||||||
int64 tax_rate = 7; // 抽水比例
|
|
||||||
int64 totalBet = 8; //投注总量
|
|
||||||
repeated int64 totalBets = 9; //各区域投注总量
|
|
||||||
int64 realSystemWin = 10; //系统输赢
|
|
||||||
repeated int64 realSystemWins = 11; //各区域系统输赢
|
|
||||||
int64 tax = 12; //抽水流水
|
|
||||||
repeated ColorPinoyLiveBetTypeJP wins = 13; // 中奖区域
|
|
||||||
string op_token = 14; // 平台
|
|
||||||
ColorPinoyLiveDetail detail = 15; // 数据详情
|
|
||||||
int32 isDiscard = 16; // 是否废弃 0正常 1废弃
|
|
||||||
}
|
|
||||||
|
|
||||||
//================================================================================================================================
|
|
||||||
//游戏转态 ColorPinoyLiveGameStatus 客户端 0未开始 1准备 2开始 3下注 4结束下注 5开幸运骰子 6开三个骰子 7结算 8排行
|
|
||||||
// 对后台 2,3 合并为一个阶段 3 下注阶段, 0忽略 最终 1准备 3 下注 4结束下注 5 开幸运骰子 6 开三个骰子 7 结算 8 排行
|
|
||||||
|
|
||||||
enum ColorPinoyLiveProcessCmd{
|
|
||||||
ColorPinoyLiveVoid = 0;
|
|
||||||
ColorPinoyLiveMSGGameGetStatus = 300;//获取游戏状态 ColorPinoyLiveGetStatus
|
|
||||||
ColorPinoyLiveMSGReady = 301;//准备 空
|
|
||||||
ColorPinoyLiveMSGBetting = 302;//开始下注 空
|
|
||||||
ColorPinoyLiveMSGLucky = 303;//幸运星 ColorPinoyLiveLucky
|
|
||||||
ColorPinoyLiveMSGResult = 304;//游戏结果 ColorPinoyLiveResult
|
|
||||||
ColorPinoyLiveMSGSettle = 305;//结算 空
|
|
||||||
ColorPinoyLiveMSGRank = 306;//排行榜 空
|
|
||||||
ColorPinoyLiveMSGMMainteSet = 307;//维护状态 设置 ColorPinoyLiveMainte -> ColorPinoyLiveCommResp
|
|
||||||
ColorPinoyLiveMSGMDiscard = 308;//废弃 ColorPinoyLiveMainte -> ColorPinoyLiveCommResp
|
|
||||||
ColorPinoyLiveMSGMRankList = 309;//排行榜列表 空 ->ColorPinoyLiveRankList
|
|
||||||
ColorPinoyLiveMSGMEndBet = 310;//结束下注 空
|
|
||||||
ColorPinoyLiveMSGMStartDice = 311;//初始位置摆放的骰子
|
|
||||||
ColorPinoyLiveMSGMResultImg = 312;//结果图片
|
|
||||||
ColorPinoyLiveMSGMSyncNotify = 400;//状态同步通知
|
|
||||||
ColorPinoyLiveMSGMChat = 401; //聊天数据推送
|
|
||||||
ColorPinoyLiveMSGLiveConfig = 402; //直播配置推送
|
|
||||||
ColorPinoyLiveMSGSetDealer = 403; // 设置主播名
|
|
||||||
}
|
|
||||||
|
|
||||||
enum ColorPinoyLiveCmd{
|
|
||||||
ColorPinoyLiveCmdMSGMRandomNext = 0; // 只用于控制点击NEXT按钮推进流程
|
|
||||||
}
|
|
||||||
|
|
||||||
enum ColorPinoyLiveProcessError{
|
|
||||||
ColorPinoyLiveProcessErrorVoid =0;
|
|
||||||
ColorPinoyLiveProcessErrorGameSatus = 1;//游戏状态错误
|
|
||||||
ColorPinoyLiveProcessErrorMainteStatus = 2;//维护状态错误
|
|
||||||
ColorPinoyLiveProcessErrorDice = 3;//骰子错误
|
|
||||||
}
|
|
||||||
|
|
||||||
//通用返回
|
|
||||||
message ColorPinoyLiveCommResp{
|
|
||||||
int32 code = 1;
|
|
||||||
string msg = 2;
|
|
||||||
int32 gameId = 3;
|
|
||||||
int32 gameStatus = 4; // 当前游戏状态
|
|
||||||
int64 countdown = 5; // 进入下一个阶段的毫秒时间戳
|
|
||||||
int64 countdown2 = 6; // 进入下一个阶段的毫秒时间戳
|
|
||||||
int32 maintainStatus = 7; // 维护状态 0 正常 1 维护
|
|
||||||
string maintainMsg = 8; //维护消息
|
|
||||||
ColorPinoyLiveDiceColorType luckyStar = 9; // 幸运星
|
|
||||||
repeated ColorPinoyLiveDiceColorType drawResult = 10; // 开奖结果
|
|
||||||
repeated int64 times = 11;
|
|
||||||
ColorPinoyLiveRankList rankList = 12; // 排行榜列表
|
|
||||||
repeated ColorPinoyLiveDiceColorType startDice = 13; // 初始位置摆放的骰子
|
|
||||||
repeated string resultImg = 14; // 结果图片
|
|
||||||
bool randomNext = 15; // randomNext
|
|
||||||
string gameNo = 16; // 对局编号
|
|
||||||
repeated string dealerName = 19; // 当前主播名字
|
|
||||||
repeated ColorPinoyLiveGameBetAreaInfo betAreaMul = 20; // 新版各区域的赔率
|
|
||||||
int64 jackpot = 30; // jackpot金额
|
|
||||||
}
|
|
||||||
//GameGetStatus
|
|
||||||
message ColorPinoyLiveGetStatus{
|
|
||||||
int32 gameId = 1;
|
|
||||||
}
|
|
||||||
//幸运星
|
|
||||||
message ColorPinoyLiveLucky{
|
|
||||||
ColorPinoyLiveDiceColorType Color = 1;
|
|
||||||
}
|
|
||||||
//游戏结果
|
|
||||||
message ColorPinoyLiveResult{
|
|
||||||
repeated ColorPinoyLiveDiceColorType Color = 1;
|
|
||||||
}
|
|
||||||
//初始位置摆放的骰子
|
|
||||||
message ColorPinoyLiveStartDice{
|
|
||||||
repeated ColorPinoyLiveDiceColorType startDice = 1; // 初始位置摆放的骰子
|
|
||||||
}
|
|
||||||
//结果图片
|
|
||||||
message ColorPinoyLiveResultImg{
|
|
||||||
repeated string resultImg = 1; // 结果图片
|
|
||||||
int32 stage = 2; // 控制台使用 1: random 2: lottery
|
|
||||||
}
|
|
||||||
// 维护状态设置
|
|
||||||
message ColorPinoyLiveMaintain{
|
|
||||||
int32 targetStatus = 1;// 维护状态 0 正常 1 维护
|
|
||||||
string msg = 2;//维护消息
|
|
||||||
}
|
|
||||||
|
|
||||||
//排行榜列表
|
|
||||||
message ColorPinoyLiveRankList{
|
|
||||||
repeated ColorPinoyLivePlayerData player_data = 1; // 玩家数据
|
|
||||||
string game_no = 2; // 编号
|
|
||||||
int64 start_time = 3; // 开始时间
|
|
||||||
int64 end_time = 4; // 结束时间
|
|
||||||
}
|
|
||||||
|
|
||||||
// 设置主播名字
|
|
||||||
message ColorPinoyLiveSetDealer{
|
|
||||||
repeated string dealerName = 1; // 主播名字
|
|
||||||
}
|
}
|
||||||
|
@ -1,518 +1,441 @@
|
|||||||
package room
|
package room
|
||||||
|
|
||||||
import (
|
//import (
|
||||||
"encoding/json"
|
// "encoding/json"
|
||||||
"game/common/proto/pb"
|
// "game/common/proto/pb"
|
||||||
"github.com/fox/fox/log"
|
// "github.com/fox/fox/log"
|
||||||
)
|
//)
|
||||||
|
|
||||||
// const (
|
|
||||||
// LiveProcessInit = iota
|
|
||||||
// LiveProcessStart
|
|
||||||
// LiveProcessWait
|
|
||||||
// LiveProcessWaitDone
|
|
||||||
// LiveProcessFuncStart
|
|
||||||
// LiveProcessFuncDone
|
|
||||||
// )
|
|
||||||
//
|
//
|
||||||
// var LiveProcessStatusName = map[int]string{
|
|
||||||
// LiveProcessInit: "LiveProcessInit",
|
|
||||||
// LiveProcessStart: "LiveProcessStart",
|
|
||||||
// LiveProcessWait: "LiveProcessWait",
|
|
||||||
// LiveProcessWaitDone: "LiveProcessWaitDone",
|
|
||||||
// LiveProcessFuncStart: "LiveProcessFuncStart",
|
|
||||||
// LiveProcessFuncDone: "LiveProcessFuncDone",
|
|
||||||
// }
|
|
||||||
|
|
||||||
type LiveMgr struct {
|
|
||||||
// LiveWg *sync.WaitGroup
|
|
||||||
// Count int // 当前数量
|
|
||||||
// Mu *sync.Mutex
|
|
||||||
MaintenanceStatus int32 // 维护状态 0 正常 1 维护
|
|
||||||
// ProcessStatus int // 进程状态
|
|
||||||
Restting bool // 重置状态
|
|
||||||
MainteMsg string
|
|
||||||
DiscardMsg string
|
|
||||||
DiscardStatus int
|
|
||||||
DiscardRestting bool // 重置状态
|
|
||||||
RankList *pb.ColorPinoyLiveRankList
|
|
||||||
HasMainte bool
|
|
||||||
}
|
|
||||||
|
|
||||||
func NewLiveMgr() *LiveMgr {
|
|
||||||
return &LiveMgr{
|
|
||||||
// LiveWg: new(sync.WaitGroup),
|
|
||||||
// Mu: new(sync.Mutex),
|
|
||||||
RankList: new(pb.ColorPinoyLiveRankList),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (lm *LiveMgr) Reset() {
|
|
||||||
lm.Restting = false
|
|
||||||
lm.DiscardRestting = false
|
|
||||||
lm.DiscardStatus = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
// func (lm *LiveMgr) IsAdd() bool {
|
|
||||||
// lm.Mu.Lock()
|
|
||||||
// defer lm.Mu.Unlock()
|
|
||||||
// return lm.Count > 0
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// func (lm *LiveMgr) Add() {
|
//type LiveMgr struct {
|
||||||
// log.Debug("LiveMgr add")
|
// // LiveWg *sync.WaitGroup
|
||||||
// lm.Mu.Lock()
|
// // Count int // 当前数量
|
||||||
// defer lm.Mu.Unlock()
|
// // Mu *sync.Mutex
|
||||||
// lm.LiveWg.Add(1)
|
// MaintenanceStatus int32 // 维护状态 0 正常 1 维护
|
||||||
// lm.Count++
|
// // ProcessStatus int // 进程状态
|
||||||
// }
|
// Restting bool // 重置状态
|
||||||
|
// MainteMsg string
|
||||||
|
// DiscardMsg string
|
||||||
|
// DiscardStatus int
|
||||||
|
// DiscardRestting bool // 重置状态
|
||||||
|
// RankList *pb.ColorPinoyLiveRankList
|
||||||
|
// HasMainte bool
|
||||||
|
//}
|
||||||
//
|
//
|
||||||
// func (lm *LiveMgr) Done() {
|
//func NewLiveMgr() *LiveMgr {
|
||||||
// log.Debug("LiveMgr Done")
|
// return &LiveMgr{
|
||||||
// lm.Mu.Lock()
|
// // LiveWg: new(sync.WaitGroup),
|
||||||
// defer lm.Mu.Unlock()
|
// // Mu: new(sync.Mutex),
|
||||||
// if lm.Count == 0 {
|
// RankList: new(pb.ColorPinoyLiveRankList),
|
||||||
// return
|
// }
|
||||||
// }
|
//}
|
||||||
// lm.LiveWg.Done()
|
|
||||||
// lm.Count--
|
|
||||||
// }
|
|
||||||
//
|
//
|
||||||
// func (lm *LiveMgr) Wait() {
|
//func (lm *LiveMgr) Reset() {
|
||||||
// log.Debug("LiveMgr Wait")
|
// lm.Restting = false
|
||||||
// lm.LiveWg.Wait()
|
// lm.DiscardRestting = false
|
||||||
// }
|
// lm.DiscardStatus = 0
|
||||||
|
//}
|
||||||
func (lm *LiveMgr) NeedMaintenance() bool {
|
//
|
||||||
return !lm.HasMainte && (lm.MaintenanceStatus == 1 || lm.DiscardStatus == 1)
|
//
|
||||||
}
|
//func (lm *LiveMgr) NeedMaintenance() bool {
|
||||||
|
// return !lm.HasMainte && (lm.MaintenanceStatus == 1 || lm.DiscardStatus == 1)
|
||||||
func (rm *ColorRoom) LiveDelayUpdate() error {
|
//}
|
||||||
event := &events.ServCmdKafka{
|
//
|
||||||
ServCmd: common.ServCmd_sc_live_delay_update,
|
//func (rm *ColorRoom) LiveDelayUpdate() error {
|
||||||
}
|
// event := &events.ServCmdKafka{
|
||||||
data := &common.ServLiveDelayUpdate{
|
// ServCmd: common.ServCmd_sc_live_delay_update,
|
||||||
GameId: gconfig.GConfig.GRoomConfig.GameId,
|
// }
|
||||||
MainteStatus: rm.LiveMgr.MaintenanceStatus,
|
// data := &common.ServLiveDelayUpdate{
|
||||||
MainteMsg: rm.LiveMgr.MainteMsg,
|
// GameId: gconfig.GConfig.GRoomConfig.GameId,
|
||||||
}
|
// MainteStatus: rm.LiveMgr.MaintenanceStatus,
|
||||||
event.Data, _ = proto.Marshal(data)
|
// MainteMsg: rm.LiveMgr.MainteMsg,
|
||||||
err := gconfig.Produce(context.Background(), define.TopicSysServerCmd, event)
|
// }
|
||||||
if err != nil {
|
// event.Data, _ = proto.Marshal(data)
|
||||||
log.Error(rm.Log("fail to Produce Event(%+v), err: %v", event, err))
|
// err := gconfig.Produce(context.Background(), define.TopicSysServerCmd, event)
|
||||||
return err
|
// if err != nil {
|
||||||
}
|
// log.Error(rm.Log("fail to Produce Event(%+v), err: %v", event, err))
|
||||||
return nil
|
// return err
|
||||||
}
|
// }
|
||||||
|
// return nil
|
||||||
func (rm *ColorRoom) NotifyLiveDelayUpdate() {
|
//}
|
||||||
if !gconfig.DelayUpdateServer {
|
//
|
||||||
return
|
//func (rm *ColorRoom) NotifyLiveDelayUpdate() {
|
||||||
}
|
// if !gconfig.DelayUpdateServer {
|
||||||
if rm.LiveDelayUpdate() != nil {
|
// return
|
||||||
return
|
// }
|
||||||
}
|
// if rm.LiveDelayUpdate() != nil {
|
||||||
gconfig.DelayUpdateServer = false
|
// return
|
||||||
}
|
// }
|
||||||
|
// gconfig.DelayUpdateServer = false
|
||||||
func (rm *ColorRoom) ServerMaintenanceKickPlayer() {
|
//}
|
||||||
rm.Traverse(func(u *model.User) bool {
|
//
|
||||||
kMsg := new(pb.ColorPinoyLiveKickOutUserMsg)
|
//func (rm *ColorRoom) ServerMaintenanceKickPlayer() {
|
||||||
kMsg.Reason = int32(pb.ColorPinoyLiveLeaveReason_ColorPinoyLiveLeaveReason_Server_Update)
|
// rm.Traverse(func(u *model.User) bool {
|
||||||
u.SendMsg(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeKickOutUser), kMsg)
|
// kMsg := new(pb.ColorPinoyLiveKickOutUserMsg)
|
||||||
rm.KickOutUser(u)
|
// kMsg.Reason = int32(pb.ColorPinoyLiveLeaveReason_ColorPinoyLiveLeaveReason_Server_Update)
|
||||||
return true
|
// u.SendMsg(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeKickOutUser), kMsg)
|
||||||
})
|
// rm.KickOutUser(u)
|
||||||
}
|
// return true
|
||||||
|
// })
|
||||||
func (rm *ColorRoom) SyncServerMaintenance(st int32, ss string) {
|
//}
|
||||||
_ = st
|
//
|
||||||
_ = ss
|
//func (rm *ColorRoom) SyncServerMaintenance(st int32, ss string) {
|
||||||
rm.LoadDealerNames()
|
// _ = st
|
||||||
// 可能即将变为 normal
|
// _ = ss
|
||||||
if gconfig.GConfig.GServConfig.Status != define.GameStatusNoraml {
|
// rm.LoadDealerNames()
|
||||||
rm.LiveMgr.MaintenanceStatus = 0
|
// // 可能即将变为 normal
|
||||||
rm.LiveMgr.MainteMsg = ""
|
// if gconfig.GConfig.GServConfig.Status != define.GameStatusNoraml {
|
||||||
return
|
// rm.LiveMgr.MaintenanceStatus = 0
|
||||||
}
|
// rm.LiveMgr.MainteMsg = ""
|
||||||
ssv := redisf.RSC.LiveMainteGet(gconfig.GConfig.GDataConfig.VersionMode, gconfig.GConfig.GRoomConfig.GameId)
|
// return
|
||||||
resp := new(pb.ColorPinoyLiveCommResp)
|
// }
|
||||||
_ = json.Unmarshal([]byte(ssv), resp)
|
// ssv := redisf.RSC.LiveMainteGet(gconfig.GConfig.GDataConfig.VersionMode, gconfig.GConfig.GRoomConfig.GameId)
|
||||||
rm.LiveMgr.MaintenanceStatus = resp.MaintainStatus
|
// resp := new(pb.ColorPinoyLiveCommResp)
|
||||||
rm.LiveMgr.MainteMsg = resp.MaintainMsg
|
// _ = json.Unmarshal([]byte(ssv), resp)
|
||||||
|
// rm.LiveMgr.MaintenanceStatus = resp.MaintainStatus
|
||||||
}
|
// rm.LiveMgr.MainteMsg = resp.MaintainMsg
|
||||||
|
//
|
||||||
func (rm *ColorRoom) OnLiveGameMessage(subCmd int32, buffer []byte) ([]byte, error) {
|
//}
|
||||||
// log.Debug("收到后台消息:", subCmd)
|
//
|
||||||
var result proto.Message
|
//func (rm *ColorRoom) OnLiveGameMessage(subCmd int32, buffer []byte) ([]byte, error) {
|
||||||
_, err := rm.Table.RunAndWait(func() any {
|
// // log.Debug("收到后台消息:", subCmd)
|
||||||
switch subCmd {
|
// var result proto.Message
|
||||||
case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGGameGetStatus):
|
// _, err := rm.Table.RunAndWait(func() any {
|
||||||
result = rm.LiveGetGameStatus(buffer)
|
// switch subCmd {
|
||||||
case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGReady):
|
// case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGGameGetStatus):
|
||||||
result = rm.LiveGameReady(buffer) // 点击finish
|
// result = rm.LiveGetGameStatus(buffer)
|
||||||
case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGBetting):
|
// case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGReady):
|
||||||
result = rm.LiveGameBetting(buffer) // 点击start
|
// result = rm.LiveGameReady(buffer) // 点击finish
|
||||||
case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGMStartDice):
|
// case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGBetting):
|
||||||
result = rm.LiveGameStartDice(buffer)
|
// result = rm.LiveGameBetting(buffer) // 点击start
|
||||||
case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGMResultImg):
|
// case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGMStartDice):
|
||||||
result = rm.LiveGameResultImg(buffer)
|
// result = rm.LiveGameStartDice(buffer)
|
||||||
// case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGLucky):
|
// case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGMResultImg):
|
||||||
// result = rm.LiveGameLucky(buffer)
|
// result = rm.LiveGameResultImg(buffer)
|
||||||
case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGResult):
|
// // case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGLucky):
|
||||||
result = rm.LiveGameResult(buffer)
|
// // result = rm.LiveGameLucky(buffer)
|
||||||
case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGMMainteSet):
|
// case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGResult):
|
||||||
result = rm.LiveGameMainte(buffer)
|
// result = rm.LiveGameResult(buffer)
|
||||||
case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGMDiscard):
|
// case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGMMainteSet):
|
||||||
result = rm.LiveGameDiscard(buffer)
|
// result = rm.LiveGameMainte(buffer)
|
||||||
case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGMRankList):
|
// case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGMDiscard):
|
||||||
result = rm.LiveGameRankList(buffer)
|
// result = rm.LiveGameDiscard(buffer)
|
||||||
case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGSetDealer):
|
// case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGMRankList):
|
||||||
result = rm.LiveGameSetDealerName(buffer)
|
// result = rm.LiveGameRankList(buffer)
|
||||||
default:
|
// case int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGSetDealer):
|
||||||
log.Error(rm.Log("no protocol"))
|
// result = rm.LiveGameSetDealerName(buffer)
|
||||||
return nil
|
// default:
|
||||||
}
|
// log.Error(rm.Log("no protocol"))
|
||||||
return result
|
// return nil
|
||||||
})
|
// }
|
||||||
if err == nil && result != nil {
|
// return result
|
||||||
b, _ := proto.Marshal(result)
|
// })
|
||||||
canLog := true
|
// if err == nil && result != nil {
|
||||||
if subCmd == int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGGameGetStatus) {
|
// b, _ := proto.Marshal(result)
|
||||||
if rd := rand.RandInt(0, 100); rd < 90 {
|
// canLog := true
|
||||||
canLog = false
|
// if subCmd == int32(pb.ColorPinoyLiveProcessCmd_ColorPinoyLiveMSGGameGetStatus) {
|
||||||
}
|
// if rd := rand.RandInt(0, 100); rd < 90 {
|
||||||
}
|
// canLog = false
|
||||||
if canLog {
|
// }
|
||||||
j, _ := json.Marshal(result)
|
// }
|
||||||
log.Debug(rm.Log("返回后台消息 subCmd:%d, msg:%s", subCmd, string(j)))
|
// if canLog {
|
||||||
}
|
// j, _ := json.Marshal(result)
|
||||||
return b, nil
|
// log.Debug(rm.Log("返回后台消息 subCmd:%d, msg:%s", subCmd, string(j)))
|
||||||
}
|
// }
|
||||||
return nil, err
|
// return b, nil
|
||||||
}
|
// }
|
||||||
|
// return nil, err
|
||||||
func (rm *ColorRoom) getStatus() (int32, int64) {
|
//}
|
||||||
switch rm.Status {
|
//
|
||||||
case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveStartUnReady:
|
//func (rm *ColorRoom) getStatus() (int32, int64) {
|
||||||
return int32(rm.Status), rm.StatusTime + int64(rm.RoomCfg.TimeConf.Readymove)
|
// switch rm.Status {
|
||||||
case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveStartReady:
|
// case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveStartUnReady:
|
||||||
return int32(rm.Status), rm.StatusTime + int64(rm.RoomCfg.TimeConf.Startmove)
|
// return int32(rm.Status), rm.StatusTime + int64(rm.RoomCfg.TimeConf.Readymove)
|
||||||
case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveStartMovie:
|
// case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveStartReady:
|
||||||
return int32(pb.ColorPinoyLiveGameStatus_ColorPinoyLiveBetStatus), rm.StatusTime + int64(rm.RoomCfg.TimeConf.Startbet)
|
// return int32(rm.Status), rm.StatusTime + int64(rm.RoomCfg.TimeConf.Startmove)
|
||||||
case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveBetStatus:
|
// case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveStartMovie:
|
||||||
return int32(rm.Status), rm.StatusTime + int64(rm.RoomCfg.TimeConf.Startbet)
|
// return int32(pb.ColorPinoyLiveGameStatus_ColorPinoyLiveBetStatus), rm.StatusTime + int64(rm.RoomCfg.TimeConf.Startbet)
|
||||||
case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveEndBetMovie:
|
// case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveBetStatus:
|
||||||
return int32(rm.Status), rm.StatusTime + int64(rm.RoomCfg.TimeConf.Endmove)
|
// return int32(rm.Status), rm.StatusTime + int64(rm.RoomCfg.TimeConf.Startbet)
|
||||||
case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveOpenThreeDice:
|
// case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveEndBetMovie:
|
||||||
return int32(rm.Status), rm.StatusTime + int64(rm.RoomCfg.TimeConf.OpenThreeDice)
|
// return int32(rm.Status), rm.StatusTime + int64(rm.RoomCfg.TimeConf.Endmove)
|
||||||
case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveSettleStatus:
|
// case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveOpenThreeDice:
|
||||||
return int32(rm.Status), rm.StatusTime + int64(rm.RoomCfg.TimeConf.Endpay)
|
// return int32(rm.Status), rm.StatusTime + int64(rm.RoomCfg.TimeConf.OpenThreeDice)
|
||||||
case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveRankStatus:
|
// case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveSettleStatus:
|
||||||
return int32(rm.Status), rm.StatusTime + int64(rm.RoomCfg.TimeConf.Rank)
|
// return int32(rm.Status), rm.StatusTime + int64(rm.RoomCfg.TimeConf.Endpay)
|
||||||
default:
|
// case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveRankStatus:
|
||||||
return int32(rm.Status), rm.StatusTime
|
// return int32(rm.Status), rm.StatusTime + int64(rm.RoomCfg.TimeConf.Rank)
|
||||||
}
|
// default:
|
||||||
}
|
// return int32(rm.Status), rm.StatusTime
|
||||||
|
// }
|
||||||
func (rm *ColorRoom) LiveStatus() *pb.ColorPinoyLiveCommResp {
|
//}
|
||||||
resp := &pb.ColorPinoyLiveCommResp{
|
//
|
||||||
GameId: gconfig.GConfig.GRoomConfig.GameId,
|
//func (rm *ColorRoom) LiveStatus() *pb.ColorPinoyLiveCommResp {
|
||||||
MaintainStatus: rm.LiveMgr.MaintenanceStatus,
|
// resp := &pb.ColorPinoyLiveCommResp{
|
||||||
MaintainMsg: rm.LiveMgr.MainteMsg,
|
// GameId: gconfig.GConfig.GRoomConfig.GameId,
|
||||||
Times: rm.RoomCfg.TimeConf.Get(),
|
// MaintainStatus: rm.LiveMgr.MaintenanceStatus,
|
||||||
GameNo: rm.Table.GetGameRoundId(),
|
// MaintainMsg: rm.LiveMgr.MainteMsg,
|
||||||
DealerName: rm.dealerName,
|
// Times: rm.RoomCfg.TimeConf.Get(),
|
||||||
Jackpot: rm.jackpotMgr.GetJackpotCopy(),
|
// GameNo: rm.Table.GetGameRoundId(),
|
||||||
}
|
// DealerName: rm.dealerName,
|
||||||
resp.GameStatus, resp.Countdown = rm.getStatus()
|
// Jackpot: rm.jackpotMgr.GetJackpotCopy(),
|
||||||
resp.BetAreaMul = rm.betEndBetAreasOdds
|
// }
|
||||||
for _, dice := range rm.StartDices {
|
// resp.GameStatus, resp.Countdown = rm.getStatus()
|
||||||
resp.StartDice = append(resp.StartDice, pb.ColorPinoyLiveDiceColorType(model.GetColor(dice)))
|
// resp.BetAreaMul = rm.betEndBetAreasOdds
|
||||||
}
|
// for _, dice := range rm.StartDices {
|
||||||
resp.ResultImg = rm.ResultImgs
|
// resp.StartDice = append(resp.StartDice, pb.ColorPinoyLiveDiceColorType(model.GetColor(dice)))
|
||||||
switch rm.Status {
|
// }
|
||||||
case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveOpenThreeDice:
|
// resp.ResultImg = rm.ResultImgs
|
||||||
resp.LuckyStar = pb.ColorPinoyLiveDiceColorType(model.GetColor(rm.LuckyDice))
|
// switch rm.Status {
|
||||||
for _, dice := range rm.NormalDices {
|
// case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveOpenThreeDice:
|
||||||
resp.DrawResult = append(resp.DrawResult, pb.ColorPinoyLiveDiceColorType(model.GetColor(dice)))
|
// resp.LuckyStar = pb.ColorPinoyLiveDiceColorType(model.GetColor(rm.LuckyDice))
|
||||||
}
|
// for _, dice := range rm.NormalDices {
|
||||||
case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveSettleStatus, pb.ColorPinoyLiveGameStatus_ColorPinoyLiveRankStatus:
|
// resp.DrawResult = append(resp.DrawResult, pb.ColorPinoyLiveDiceColorType(model.GetColor(dice)))
|
||||||
resp.LuckyStar = pb.ColorPinoyLiveDiceColorType(model.GetColor(rm.LuckyDice))
|
// }
|
||||||
for _, dice := range rm.NormalDices {
|
// case pb.ColorPinoyLiveGameStatus_ColorPinoyLiveSettleStatus, pb.ColorPinoyLiveGameStatus_ColorPinoyLiveRankStatus:
|
||||||
resp.DrawResult = append(resp.DrawResult, pb.ColorPinoyLiveDiceColorType(model.GetColor(dice)))
|
// resp.LuckyStar = pb.ColorPinoyLiveDiceColorType(model.GetColor(rm.LuckyDice))
|
||||||
}
|
// for _, dice := range rm.NormalDices {
|
||||||
resp.RankList = rm.LiveMgr.RankList
|
// resp.DrawResult = append(resp.DrawResult, pb.ColorPinoyLiveDiceColorType(model.GetColor(dice)))
|
||||||
default:
|
// }
|
||||||
}
|
// resp.RankList = rm.LiveMgr.RankList
|
||||||
// 结束下注后,后台可看到更新爆奖后的投注面板
|
// default:
|
||||||
if rm.Status > pb.ColorPinoyLiveGameStatus_ColorPinoyLiveBetStatus {
|
// }
|
||||||
resp.BetAreaMul = rm.betEndBetAreasOdds
|
// // 结束下注后,后台可看到更新爆奖后的投注面板
|
||||||
}
|
// if rm.Status > pb.ColorPinoyLiveGameStatus_ColorPinoyLiveBetStatus {
|
||||||
return resp
|
// resp.BetAreaMul = rm.betEndBetAreasOdds
|
||||||
}
|
// }
|
||||||
|
// return resp
|
||||||
func (rm *ColorRoom) LiveGetGameStatus(buffer []byte) proto.Message {
|
//}
|
||||||
_ = buffer
|
//
|
||||||
return rm.LiveStatus()
|
//func (rm *ColorRoom) LiveGetGameStatus(buffer []byte) proto.Message {
|
||||||
}
|
// _ = buffer
|
||||||
|
// return rm.LiveStatus()
|
||||||
func (rm *ColorRoom) LiveGameReady(buffer []byte) proto.Message {
|
//}
|
||||||
_ = buffer
|
//
|
||||||
log.Debug(rm.Log("LiveGameReady"))
|
//func (rm *ColorRoom) LiveGameReady(buffer []byte) proto.Message {
|
||||||
// rm.MutexStatus.Lock()
|
// _ = buffer
|
||||||
// defer rm.MutexStatus.Unlock()
|
// log.Debug(rm.Log("LiveGameReady"))
|
||||||
resp := rm.LiveStatus()
|
// // rm.MutexStatus.Lock()
|
||||||
if rm.LiveMgr.MaintenanceStatus == 1 {
|
// // defer rm.MutexStatus.Unlock()
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
// resp := rm.LiveStatus()
|
||||||
return resp
|
// if rm.LiveMgr.MaintenanceStatus == 1 {
|
||||||
}
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
||||||
if rm.Status != pb.ColorPinoyLiveGameStatus_ColorPinoyLiveRankStatus {
|
// return resp
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorGameSatus)
|
// }
|
||||||
return resp
|
// if rm.Status != pb.ColorPinoyLiveGameStatus_ColorPinoyLiveRankStatus {
|
||||||
}
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorGameSatus)
|
||||||
rm.Ready()
|
// return resp
|
||||||
resp.GameStatus, resp.Countdown = rm.getStatus()
|
// }
|
||||||
return resp
|
// rm.Ready()
|
||||||
}
|
// resp.GameStatus, resp.Countdown = rm.getStatus()
|
||||||
|
// return resp
|
||||||
func (rm *ColorRoom) LiveGameBetting(buffer []byte) proto.Message {
|
//}
|
||||||
_ = buffer
|
//
|
||||||
log.Debug(rm.Log("LiveGameBetting"))
|
//func (rm *ColorRoom) LiveGameBetting(buffer []byte) proto.Message {
|
||||||
// rm.MutexStatus.Lock()
|
// _ = buffer
|
||||||
// defer rm.MutexStatus.Unlock()
|
// log.Debug(rm.Log("LiveGameBetting"))
|
||||||
resp := rm.LiveStatus()
|
// // rm.MutexStatus.Lock()
|
||||||
if rm.LiveMgr.MaintenanceStatus == 1 {
|
// // defer rm.MutexStatus.Unlock()
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
// resp := rm.LiveStatus()
|
||||||
return resp
|
// if rm.LiveMgr.MaintenanceStatus == 1 {
|
||||||
}
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
||||||
if rm.Status != pb.ColorPinoyLiveGameStatus_ColorPinoyLiveStartReady {
|
// return resp
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorGameSatus)
|
// }
|
||||||
return resp
|
// if rm.Status != pb.ColorPinoyLiveGameStatus_ColorPinoyLiveStartReady {
|
||||||
}
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorGameSatus)
|
||||||
|
// return resp
|
||||||
rm.StartBet()
|
// }
|
||||||
return resp
|
//
|
||||||
}
|
// rm.StartBet()
|
||||||
|
// return resp
|
||||||
func (rm *ColorRoom) LiveGameStartDice(buffer []byte) proto.Message {
|
//}
|
||||||
log.Debug(rm.Log("LiveGameStartDice"))
|
//
|
||||||
resp := rm.LiveStatus()
|
//func (rm *ColorRoom) LiveGameStartDice(buffer []byte) proto.Message {
|
||||||
if rm.LiveMgr.MaintenanceStatus == 1 {
|
// log.Debug(rm.Log("LiveGameStartDice"))
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
// resp := rm.LiveStatus()
|
||||||
return resp
|
// if rm.LiveMgr.MaintenanceStatus == 1 {
|
||||||
}
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
||||||
if rm.Status != pb.ColorPinoyLiveGameStatus_ColorPinoyLiveEndBetMovie {
|
// return resp
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorGameSatus)
|
// }
|
||||||
return resp
|
// if rm.Status != pb.ColorPinoyLiveGameStatus_ColorPinoyLiveEndBetMovie {
|
||||||
}
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorGameSatus)
|
||||||
req := new(pb.ColorPinoyLiveStartDice)
|
// return resp
|
||||||
_ = proto.Unmarshal(buffer, req)
|
// }
|
||||||
if len(req.GetStartDice()) != 3 {
|
// req := new(pb.ColorPinoyLiveStartDice)
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorDice)
|
// _ = proto.Unmarshal(buffer, req)
|
||||||
return resp
|
// if len(req.GetStartDice()) != 3 {
|
||||||
}
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorDice)
|
||||||
for i := 0; i < len(req.GetStartDice()); i++ {
|
// return resp
|
||||||
rm.StartDices[i] = byte(req.GetStartDice()[i])
|
// }
|
||||||
}
|
// for i := 0; i < len(req.GetStartDice()); i++ {
|
||||||
log.Debug(rm.Log("req:", req.GetStartDice(), ",StartDice:", rm.StartDices))
|
// rm.StartDices[i] = byte(req.GetStartDice()[i])
|
||||||
resp.StartDice = make([]pb.ColorPinoyLiveDiceColorType, 0)
|
// }
|
||||||
for _, dice := range rm.StartDices {
|
// log.Debug(rm.Log("req:", req.GetStartDice(), ",StartDice:", rm.StartDices))
|
||||||
resp.StartDice = append(resp.StartDice, pb.ColorPinoyLiveDiceColorType(model.GetColor(dice)))
|
// resp.StartDice = make([]pb.ColorPinoyLiveDiceColorType, 0)
|
||||||
}
|
// for _, dice := range rm.StartDices {
|
||||||
resp.ResultImg = rm.ResultImgs
|
// resp.StartDice = append(resp.StartDice, pb.ColorPinoyLiveDiceColorType(model.GetColor(dice)))
|
||||||
return resp
|
// }
|
||||||
}
|
// resp.ResultImg = rm.ResultImgs
|
||||||
|
// return resp
|
||||||
func (rm *ColorRoom) LiveGameResultImg(buffer []byte) proto.Message {
|
//}
|
||||||
resp := rm.LiveStatus()
|
//
|
||||||
if rm.LiveMgr.MaintenanceStatus == 1 {
|
//func (rm *ColorRoom) LiveGameResultImg(buffer []byte) proto.Message {
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
// resp := rm.LiveStatus()
|
||||||
return resp
|
// if rm.LiveMgr.MaintenanceStatus == 1 {
|
||||||
}
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
||||||
req := new(pb.ColorPinoyLiveResultImg)
|
// return resp
|
||||||
_ = proto.Unmarshal(buffer, req)
|
// }
|
||||||
rm.ResultImgs = append(rm.ResultImgs, req.GetResultImg()...)
|
// req := new(pb.ColorPinoyLiveResultImg)
|
||||||
log.Debug(rm.Log("req:", req.GetResultImg(), ",ResultImg:", rm.ResultImgs))
|
// _ = proto.Unmarshal(buffer, req)
|
||||||
resp.StartDice = make([]pb.ColorPinoyLiveDiceColorType, 0)
|
// rm.ResultImgs = append(rm.ResultImgs, req.GetResultImg()...)
|
||||||
for _, dice := range rm.StartDices {
|
// log.Debug(rm.Log("req:", req.GetResultImg(), ",ResultImg:", rm.ResultImgs))
|
||||||
resp.StartDice = append(resp.StartDice, pb.ColorPinoyLiveDiceColorType(model.GetColor(dice)))
|
// resp.StartDice = make([]pb.ColorPinoyLiveDiceColorType, 0)
|
||||||
}
|
// for _, dice := range rm.StartDices {
|
||||||
resp.ResultImg = rm.ResultImgs
|
// resp.StartDice = append(resp.StartDice, pb.ColorPinoyLiveDiceColorType(model.GetColor(dice)))
|
||||||
return resp
|
// }
|
||||||
}
|
// resp.ResultImg = rm.ResultImgs
|
||||||
|
// return resp
|
||||||
func (rm *ColorRoom) LiveGameResult(buffer []byte) proto.Message {
|
//}
|
||||||
// rm.MutexStatus.Lock()
|
//
|
||||||
// defer rm.MutexStatus.Unlock()
|
//func (rm *ColorRoom) LiveGameResult(buffer []byte) proto.Message {
|
||||||
log.Debug(rm.Log("LiveGameResult"))
|
// // rm.MutexStatus.Lock()
|
||||||
resp := rm.LiveStatus()
|
// // defer rm.MutexStatus.Unlock()
|
||||||
if rm.LiveMgr.MaintenanceStatus == 1 {
|
// log.Debug(rm.Log("LiveGameResult"))
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
// resp := rm.LiveStatus()
|
||||||
return resp
|
// if rm.LiveMgr.MaintenanceStatus == 1 {
|
||||||
}
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
||||||
log.Debug(rm.Log("LiveGameResult status:%v ", rm.Status))
|
// return resp
|
||||||
if rm.Status != pb.ColorPinoyLiveGameStatus_ColorPinoyLiveEndBetMovie {
|
// }
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorGameSatus)
|
// log.Debug(rm.Log("LiveGameResult status:%v ", rm.Status))
|
||||||
return resp
|
// if rm.Status != pb.ColorPinoyLiveGameStatus_ColorPinoyLiveEndBetMovie {
|
||||||
}
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorGameSatus)
|
||||||
req := new(pb.ColorPinoyLiveResult)
|
// return resp
|
||||||
_ = proto.Unmarshal(buffer, req)
|
// }
|
||||||
if len(req.GetColor()) != 3 {
|
// req := new(pb.ColorPinoyLiveResult)
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorDice)
|
// _ = proto.Unmarshal(buffer, req)
|
||||||
return resp
|
// if len(req.GetColor()) != 3 {
|
||||||
} else {
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorDice)
|
||||||
for i := 0; i < len(req.GetColor()); i++ {
|
// return resp
|
||||||
if !model.IsLogic(int32(req.GetColor()[i])) {
|
// } else {
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorDice)
|
// for i := 0; i < len(req.GetColor()); i++ {
|
||||||
return resp
|
// if !model.IsLogic(int32(req.GetColor()[i])) {
|
||||||
}
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorDice)
|
||||||
rm.NormalDices[i] = byte(req.GetColor()[i])
|
// return resp
|
||||||
}
|
// }
|
||||||
}
|
// rm.NormalDices[i] = byte(req.GetColor()[i])
|
||||||
log.Debug(rm.Log("LiveGameResult req:%v NormalDices:%v", req.GetColor(), rm.NormalDices))
|
// }
|
||||||
|
// }
|
||||||
rm.Table.Run(rm.openThreeDice)
|
// log.Debug(rm.Log("LiveGameResult req:%v NormalDices:%v", req.GetColor(), rm.NormalDices))
|
||||||
return resp
|
//
|
||||||
}
|
// rm.Table.Run(rm.openThreeDice)
|
||||||
|
// return resp
|
||||||
func (rm *ColorRoom) LiveGameMainte(buffer []byte) proto.Message {
|
//}
|
||||||
req := new(pb.ColorPinoyLiveMaintain)
|
//
|
||||||
_ = proto.Unmarshal(buffer, req)
|
//func (rm *ColorRoom) LiveGameMainte(buffer []byte) proto.Message {
|
||||||
b, _ := json.Marshal(req)
|
// req := new(pb.ColorPinoyLiveMaintain)
|
||||||
log.Debug(rm.Log("LiveGameMainte:%v", string(b)))
|
// _ = proto.Unmarshal(buffer, req)
|
||||||
resp := rm.LiveStatus()
|
// b, _ := json.Marshal(req)
|
||||||
if rm.LiveMgr.Restting {
|
// log.Debug(rm.Log("LiveGameMainte:%v", string(b)))
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
// resp := rm.LiveStatus()
|
||||||
resp.Msg = "Restting"
|
// if rm.LiveMgr.Restting {
|
||||||
return resp
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
||||||
}
|
// resp.Msg = "Restting"
|
||||||
if req.TargetStatus == rm.LiveMgr.MaintenanceStatus {
|
// return resp
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
// }
|
||||||
return resp
|
// if req.TargetStatus == rm.LiveMgr.MaintenanceStatus {
|
||||||
}
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
||||||
if rm.GetGameStatus() == pb.ColorPinoyLiveGameStatus_ColorPinoyLiveSettleStatus {
|
// return resp
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorGameSatus)
|
// }
|
||||||
resp.Msg = "SettleStatus"
|
// if rm.GetGameStatus() == pb.ColorPinoyLiveGameStatus_ColorPinoyLiveSettleStatus {
|
||||||
return resp
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorGameSatus)
|
||||||
}
|
// resp.Msg = "SettleStatus"
|
||||||
defer func() {
|
// return resp
|
||||||
_ = pushGate.NotifyConfigUpdated(msg.ConfigUpdateType_ConfigUpdateTypeLiveConfig)
|
// }
|
||||||
rm.SetLiveGameStatus()
|
// defer func() {
|
||||||
}()
|
// _ = pushGate.NotifyConfigUpdated(msg.ConfigUpdateType_ConfigUpdateTypeLiveConfig)
|
||||||
if req.TargetStatus == 0 {
|
// rm.SetLiveGameStatus()
|
||||||
rm.LiveMgr.MaintenanceStatus = 0
|
// }()
|
||||||
rm.LiveMgr.MainteMsg = ""
|
// if req.TargetStatus == 0 {
|
||||||
rm.LiveMgr.HasMainte = false
|
// rm.LiveMgr.MaintenanceStatus = 0
|
||||||
} else {
|
// rm.LiveMgr.MainteMsg = ""
|
||||||
rm.LiveMgr.MaintenanceStatus = req.TargetStatus
|
// rm.LiveMgr.HasMainte = false
|
||||||
rm.LiveMgr.MainteMsg = req.GetMsg()
|
// } else {
|
||||||
rm.LiveMainteCnt()
|
// rm.LiveMgr.MaintenanceStatus = req.TargetStatus
|
||||||
}
|
// rm.LiveMgr.MainteMsg = req.GetMsg()
|
||||||
resp.MaintainStatus = rm.LiveMgr.MaintenanceStatus
|
// rm.LiveMainteCnt()
|
||||||
resp.MaintainMsg = rm.LiveMgr.MainteMsg
|
// }
|
||||||
resp.GameStatus, resp.Countdown = rm.getStatus()
|
// resp.MaintainStatus = rm.LiveMgr.MaintenanceStatus
|
||||||
br, _ := json.Marshal(resp)
|
// resp.MaintainMsg = rm.LiveMgr.MainteMsg
|
||||||
redisf.RSC.LiveMainteSet(gconfig.GConfig.GDataConfig.VersionMode, gconfig.GConfig.GRoomConfig.GameId, string(br))
|
// resp.GameStatus, resp.Countdown = rm.getStatus()
|
||||||
redisf.RSC.LiveMainteLobbySet(gconfig.GConfig.GDataConfig.VersionMode, gconfig.GConfig.GRoomConfig.GameId, rm.LiveMgr.MaintenanceStatus, rm.LiveMgr.MainteMsg)
|
// br, _ := json.Marshal(resp)
|
||||||
return resp
|
// redisf.RSC.LiveMainteSet(gconfig.GConfig.GDataConfig.VersionMode, gconfig.GConfig.GRoomConfig.GameId, string(br))
|
||||||
}
|
// redisf.RSC.LiveMainteLobbySet(gconfig.GConfig.GDataConfig.VersionMode, gconfig.GConfig.GRoomConfig.GameId, rm.LiveMgr.MaintenanceStatus, rm.LiveMgr.MainteMsg)
|
||||||
|
// return resp
|
||||||
func (rm *ColorRoom) LiveMainteCnt() {
|
//}
|
||||||
rm.LiveMainte()
|
//
|
||||||
}
|
//func (rm *ColorRoom) LiveMainteCnt() {
|
||||||
|
// rm.LiveMainte()
|
||||||
func (rm *ColorRoom) LiveMainte() {
|
//}
|
||||||
if rm.LiveMgr.MaintenanceStatus == 1 {
|
//
|
||||||
rm.LiveMgr.HasMainte = true
|
//func (rm *ColorRoom) LiveMainte() {
|
||||||
rm.LiveMgr.Restting = true
|
// if rm.LiveMgr.MaintenanceStatus == 1 {
|
||||||
}
|
// rm.LiveMgr.HasMainte = true
|
||||||
if rm.LiveMgr.DiscardStatus == 1 {
|
// rm.LiveMgr.Restting = true
|
||||||
rm.LiveMgr.DiscardRestting = true
|
// }
|
||||||
}
|
// if rm.LiveMgr.DiscardStatus == 1 {
|
||||||
rm.GameDiscard()
|
// rm.LiveMgr.DiscardRestting = true
|
||||||
// rm.LiveMgr.SetProcessStatus(LiveProcessInit)
|
// }
|
||||||
if rm.LiveMgr.MaintenanceStatus == 1 {
|
// rm.GameDiscard()
|
||||||
rm.LiveMgr.Restting = false
|
// // rm.LiveMgr.SetProcessStatus(LiveProcessInit)
|
||||||
}
|
// if rm.LiveMgr.MaintenanceStatus == 1 {
|
||||||
if rm.LiveMgr.DiscardStatus == 1 {
|
// rm.LiveMgr.Restting = false
|
||||||
rm.LiveMgr.DiscardRestting = false
|
// }
|
||||||
rm.LiveMgr.DiscardStatus = 0
|
// if rm.LiveMgr.DiscardStatus == 1 {
|
||||||
}
|
// rm.LiveMgr.DiscardRestting = false
|
||||||
}
|
// rm.LiveMgr.DiscardStatus = 0
|
||||||
|
// }
|
||||||
func (rm *ColorRoom) LiveGameDiscard(_ []byte) proto.Message {
|
//}
|
||||||
log.Debug(rm.Log("LiveGameDiscard"))
|
//
|
||||||
resp := rm.LiveStatus()
|
//func (rm *ColorRoom) LiveGameDiscard(_ []byte) proto.Message {
|
||||||
if rm.LiveMgr.MaintenanceStatus == 1 {
|
// log.Debug(rm.Log("LiveGameDiscard"))
|
||||||
log.Error(rm.Log("rm.LiveMgr.MaintenanceStatus"))
|
// resp := rm.LiveStatus()
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
// if rm.LiveMgr.MaintenanceStatus == 1 {
|
||||||
return resp
|
// log.Error(rm.Log("rm.LiveMgr.MaintenanceStatus"))
|
||||||
}
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
||||||
if rm.LiveMgr.DiscardRestting {
|
// return resp
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
// }
|
||||||
resp.Msg = "DiscardRestting"
|
// if rm.LiveMgr.DiscardRestting {
|
||||||
return resp
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
||||||
}
|
// resp.Msg = "DiscardRestting"
|
||||||
// if rm.GetGameStatus() == pb.ColorPinoyLiveGameStatus_ColorPinoyLiveSettleStatus {
|
// return resp
|
||||||
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorGameSatus)
|
// }
|
||||||
// resp.Msg = "SettleStatus"
|
// // if rm.GetGameStatus() == pb.ColorPinoyLiveGameStatus_ColorPinoyLiveSettleStatus {
|
||||||
// return resp
|
// // resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorGameSatus)
|
||||||
// }
|
// // resp.Msg = "SettleStatus"
|
||||||
rm.LiveMgr.DiscardStatus = 1
|
// // return resp
|
||||||
rm.LiveMgr.DiscardMsg = ""
|
// // }
|
||||||
rm.LiveMainteCnt()
|
// rm.LiveMgr.DiscardStatus = 1
|
||||||
resp.GameStatus, resp.Countdown = rm.getStatus()
|
// rm.LiveMgr.DiscardMsg = ""
|
||||||
return resp
|
// rm.LiveMainteCnt()
|
||||||
}
|
// resp.GameStatus, resp.Countdown = rm.getStatus()
|
||||||
func (rm *ColorRoom) LiveGameRankList(buffer []byte) proto.Message {
|
// return resp
|
||||||
_ = buffer
|
//}
|
||||||
return rm.LiveMgr.RankList
|
//func (rm *ColorRoom) LiveGameRankList(buffer []byte) proto.Message {
|
||||||
}
|
// _ = buffer
|
||||||
|
// return rm.LiveMgr.RankList
|
||||||
func (rm *ColorRoom) LiveGameSetDealerName(buffer []byte) proto.Message {
|
//}
|
||||||
resp := rm.LiveStatus()
|
//
|
||||||
if rm.LiveMgr.MaintenanceStatus == 1 {
|
//func (rm *ColorRoom) LiveGameSetDealerName(buffer []byte) proto.Message {
|
||||||
resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
// resp := rm.LiveStatus()
|
||||||
return resp
|
// if rm.LiveMgr.MaintenanceStatus == 1 {
|
||||||
}
|
// resp.Code = int32(pb.ColorPinoyLiveProcessError_ColorPinoyLiveProcessErrorMainteStatus)
|
||||||
req := new(pb.ColorPinoyLiveSetDealer)
|
// return resp
|
||||||
_ = proto.Unmarshal(buffer, req)
|
// }
|
||||||
rm.UpdateDealerName(req.DealerName)
|
// req := new(pb.ColorPinoyLiveSetDealer)
|
||||||
log.Debug(rm.Log("set dealer:", req.DealerName))
|
// _ = proto.Unmarshal(buffer, req)
|
||||||
resp.DealerName = rm.dealerName
|
// rm.UpdateDealerName(req.DealerName)
|
||||||
return resp
|
// log.Debug(rm.Log("set dealer:", req.DealerName))
|
||||||
}
|
// resp.DealerName = rm.dealerName
|
||||||
|
// return resp
|
||||||
// 长度0 维护, 长度1 设置状态 , 长度2 设置排行榜
|
//}
|
||||||
func (rm *ColorRoom) SetLiveGameStatus(pushRank ...int) {
|
|
||||||
lScene := &lws.CPLScene{
|
|
||||||
Status: int32(rm.Status),
|
|
||||||
RankList: nil,
|
|
||||||
MaintainStatus: rm.LiveMgr.MaintenanceStatus,
|
|
||||||
}
|
|
||||||
if rm.LiveMgr.RankList != nil &&
|
|
||||||
(rm.Status == pb.ColorPinoyLiveGameStatus_ColorPinoyLiveSettleStatus || rm.Status == pb.ColorPinoyLiveGameStatus_ColorPinoyLiveRankStatus) {
|
|
||||||
lScene.RankList = &lws.CPLRankList{
|
|
||||||
PlayerData: nil,
|
|
||||||
GameNo: rm.LiveMgr.RankList.GameNo,
|
|
||||||
}
|
|
||||||
for _, dd := range rm.LiveMgr.RankList.PlayerData {
|
|
||||||
lScene.RankList.PlayerData = append(lScene.RankList.PlayerData, &lws.CPLPlayerData{
|
|
||||||
Uid: dd.Uid,
|
|
||||||
Profit: dd.Profit,
|
|
||||||
Nickname: dd.Nickname,
|
|
||||||
Avatar: dd.Avatar,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if len(pushRank) == 0 {
|
|
||||||
live.PushScene(lScene)
|
|
||||||
} else if len(pushRank) == 1 {
|
|
||||||
live.PushStatus(&lws.CPLStatus{Status: lScene.Status})
|
|
||||||
} else if len(pushRank) == 2 {
|
|
||||||
live.PushColorRank(lScene.RankList)
|
|
||||||
}
|
|
||||||
go redisf.RSC.SetLiveGameStatus(lScene, gconfig.GConfig.GRoomConfig.GameId, gconfig.GConfig.GDataConfig.VersionMode)
|
|
||||||
}
|
|
||||||
|
@ -3,7 +3,6 @@ package room
|
|||||||
import (
|
import (
|
||||||
"game/common/proto/pb"
|
"game/common/proto/pb"
|
||||||
"github.com/fox/fox/ipb"
|
"github.com/fox/fox/ipb"
|
||||||
"github.com/fox/fox/log"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func (rm *ColorRoom) checkEnterRoom(user *ColorPlayer, iMsg *ipb.InternalMsg, req *pb.C2SMatchRoom) {
|
func (rm *ColorRoom) checkEnterRoom(user *ColorPlayer, iMsg *ipb.InternalMsg, req *pb.C2SMatchRoom) {
|
||||||
@ -16,210 +15,212 @@ func (rm *ColorRoom) OnEnterRoom(user *ColorPlayer, iMsg *ipb.InternalMsg, req *
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rm *ColorRoom) ApplyLeave(buffer []byte, user inter.UserInetr) {
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
_ = buffer
|
//
|
||||||
resp := new(pb.ColorPinoyLiveLeaveResp)
|
//func (rm *ColorRoom) ApplyLeave(buffer []byte, user inter.UserInetr) {
|
||||||
u := rm.GetPlayer(user.GetId())
|
// _ = buffer
|
||||||
if u == nil {
|
// resp := new(pb.ColorPinoyLiveLeaveResp)
|
||||||
rm.Table.KickOut(user)
|
// u := rm.GetPlayer(user.GetId())
|
||||||
return
|
// if u == nil {
|
||||||
}
|
// rm.Table.KickOut(user)
|
||||||
// 有下注时不让玩家离开
|
// return
|
||||||
if u.TotalBet != 0 {
|
// }
|
||||||
resp.Code = 1
|
// // 有下注时不让玩家离开
|
||||||
_ = user.SendMsg(int32(pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyLeave), resp)
|
// if u.TotalBet != 0 {
|
||||||
return
|
// resp.Code = 1
|
||||||
}
|
// _ = user.SendMsg(int32(pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyLeave), resp)
|
||||||
rm.KickOutUser(u)
|
// return
|
||||||
_ = user.SendMsg(int32(pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyLeave), resp)
|
// }
|
||||||
return
|
// rm.KickOutUser(u)
|
||||||
}
|
// _ = user.SendMsg(int32(pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyLeave), resp)
|
||||||
|
// return
|
||||||
func (rm *ColorRoom) checkNoBet() bool {
|
//}
|
||||||
return rm.GetGameStatus() != pb.ColorPinoyLiveGameStatus_ColorPinoyLiveBetStatus ||
|
//
|
||||||
rm.LiveMgr.MaintenanceStatus == 1 ||
|
//func (rm *ColorRoom) checkNoBet() bool {
|
||||||
rm.LiveMgr.DiscardRestting
|
// return rm.GetGameStatus() != pb.ColorPinoyLiveGameStatus_ColorPinoyLiveBetStatus ||
|
||||||
}
|
// rm.LiveMgr.MaintenanceStatus == 1 ||
|
||||||
|
// rm.LiveMgr.DiscardRestting
|
||||||
func (rm *ColorRoom) Bet(buffer []byte, user inter.UserInetr) {
|
//}
|
||||||
u := rm.getUser(user)
|
//
|
||||||
u.MutexBet.Lock()
|
//func (rm *ColorRoom) Bet(buffer []byte, user inter.UserInetr) {
|
||||||
defer u.MutexBet.Unlock()
|
// u := rm.getUser(user)
|
||||||
if rm.checkNoBet() {
|
// u.MutexBet.Lock()
|
||||||
log.Error(rm.Log("game bet status err:%v", rm.GetGameStatus()))
|
// defer u.MutexBet.Unlock()
|
||||||
model.SendBetFailMessageInetr(model.StatusError, user)
|
// if rm.checkNoBet() {
|
||||||
return
|
// log.Error(rm.Log("game bet status err:%v", rm.GetGameStatus()))
|
||||||
}
|
// model.SendBetFailMessageInetr(model.StatusError, user)
|
||||||
// 用户下注
|
// return
|
||||||
BetPb := &pb.ColorPinoyLiveBetReqs{}
|
// }
|
||||||
err := proto.Unmarshal(buffer, BetPb)
|
// // 用户下注
|
||||||
if err != nil {
|
// BetPb := &pb.ColorPinoyLiveBetReqs{}
|
||||||
log.Error(rm.Log("proto.Unmarshal err:%v", err))
|
// err := proto.Unmarshal(buffer, BetPb)
|
||||||
model.SendBetFailMessageInetr(model.DataErr, user)
|
// if err != nil {
|
||||||
return
|
// log.Error(rm.Log("proto.Unmarshal err:%v", err))
|
||||||
}
|
// model.SendBetFailMessageInetr(model.DataErr, user)
|
||||||
log.Debug(rm.Log("Bet pb = ", BetPb))
|
// return
|
||||||
var bets []*pb.ColorPinoyLiveBetReq
|
// }
|
||||||
|
// log.Debug(rm.Log("Bet pb = ", BetPb))
|
||||||
for _, bet := range BetPb.Info {
|
// var bets []*pb.ColorPinoyLiveBetReq
|
||||||
req := &pb.ColorPinoyLiveBetReq{
|
//
|
||||||
BetType: bet.BetType,
|
// for _, bet := range BetPb.Info {
|
||||||
BetLevel: bet.BetLevel,
|
// req := &pb.ColorPinoyLiveBetReq{
|
||||||
BetIndex: bet.BetIndex,
|
// BetType: bet.BetType,
|
||||||
BetAmount: bet.BetAmount,
|
// BetLevel: bet.BetLevel,
|
||||||
}
|
// BetIndex: bet.BetIndex,
|
||||||
bets = append(bets, req)
|
// BetAmount: bet.BetAmount,
|
||||||
}
|
// }
|
||||||
|
// bets = append(bets, req)
|
||||||
// log.Debug("Bet bets =", bets)
|
// }
|
||||||
rm.CheckAndBet(u, bets)
|
//
|
||||||
}
|
// // log.Debug("Bet bets =", bets)
|
||||||
|
// rm.CheckAndBet(u, bets)
|
||||||
func (rm *ColorRoom) UserSitDown(buffer []byte, user inter.UserInetr) {
|
//}
|
||||||
us := &pb.ColorPinoyLiveUserSitDown{}
|
//
|
||||||
_ = proto.Unmarshal(buffer, us)
|
//func (rm *ColorRoom) UserSitDown(buffer []byte, user inter.UserInetr) {
|
||||||
// u, ok := rm.AllUserList[user.GetId()]
|
// us := &pb.ColorPinoyLiveUserSitDown{}
|
||||||
u := rm.GetPlayer(user.GetId())
|
// _ = proto.Unmarshal(buffer, us)
|
||||||
if u != nil {
|
// // u, ok := rm.AllUserList[user.GetId()]
|
||||||
if rm.SceneInfo.SitScene(u, int(us.ChairNo)) {
|
// u := rm.GetPlayer(user.GetId())
|
||||||
u.SceneChairId = int(us.ChairNo)
|
// if u != nil {
|
||||||
rm.Traverse(func(v *model.User) bool {
|
// if rm.SceneInfo.SitScene(u, int(us.ChairNo)) {
|
||||||
// rm.SendSceneMsg(v)
|
// u.SceneChairId = int(us.ChairNo)
|
||||||
return true
|
// rm.Traverse(func(v *model.User) bool {
|
||||||
})
|
// // rm.SendSceneMsg(v)
|
||||||
}
|
// return true
|
||||||
}
|
// })
|
||||||
}
|
// }
|
||||||
|
// }
|
||||||
func (rm *ColorRoom) SendUserListInfo(user inter.UserInetr) {
|
//}
|
||||||
msg := new(pb.ColorPinoyLiveUserList)
|
//
|
||||||
for _, u := range rm.OnlineUserList {
|
//func (rm *ColorRoom) SendUserListInfo(user inter.UserInetr) {
|
||||||
userinfo := new(pb.ColorPinoyLiveUserInfo)
|
// msg := new(pb.ColorPinoyLiveUserList)
|
||||||
userinfo.NikeName = u.UserInetr.GetNike()
|
// for _, u := range rm.OnlineUserList {
|
||||||
userinfo.UserGlod = u.Balance
|
// userinfo := new(pb.ColorPinoyLiveUserInfo)
|
||||||
userinfo.Head = u.UserInetr.GetHead()
|
// userinfo.NikeName = u.UserInetr.GetNike()
|
||||||
userinfo.UserID = u.UserID
|
// userinfo.UserGlod = u.Balance
|
||||||
msg.UserList = append(msg.UserList, userinfo)
|
// userinfo.Head = u.UserInetr.GetHead()
|
||||||
}
|
// userinfo.UserID = u.UserID
|
||||||
// log.Debug("SendUserListInfo", msg)
|
// msg.UserList = append(msg.UserList, userinfo)
|
||||||
_ = user.SendMsg(int32(pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyGetUserListInfo), msg)
|
// }
|
||||||
}
|
// // log.Debug("SendUserListInfo", msg)
|
||||||
|
// _ = user.SendMsg(int32(pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyGetUserListInfo), msg)
|
||||||
func (rm *ColorRoom) SendTrend(u inter.UserInetr) {
|
//}
|
||||||
// log.Debug("发送走势图")
|
//
|
||||||
msg := new(pb.ColorPinoyLiveTrend)
|
//func (rm *ColorRoom) SendTrend(u inter.UserInetr) {
|
||||||
msg.ListTrendGroup = rm.GameTrend.ListTrendGroup
|
// // log.Debug("发送走势图")
|
||||||
msg.LuckStarRate = rm.GetGameTrend()
|
// msg := new(pb.ColorPinoyLiveTrend)
|
||||||
_ = u.SendMsg(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeGameTrendInfo), msg)
|
// msg.ListTrendGroup = rm.GameTrend.ListTrendGroup
|
||||||
}
|
// msg.LuckStarRate = rm.GetGameTrend()
|
||||||
|
// _ = u.SendMsg(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeGameTrendInfo), msg)
|
||||||
func (rm *ColorRoom) OnUserStanUp(user *model.User) {
|
//}
|
||||||
rm.SceneInfo.UserStandUp(user.UserInetr)
|
//
|
||||||
user.Mn.Lock()
|
//func (rm *ColorRoom) OnUserStanUp(user *model.User) {
|
||||||
user.SceneChairId = 0
|
// rm.SceneInfo.UserStandUp(user.UserInetr)
|
||||||
user.Mn.Unlock()
|
// user.Mn.Lock()
|
||||||
if rm.GetGameStatus() < pb.ColorPinoyLiveGameStatus_ColorPinoyLiveOpenThreeDice {
|
// user.SceneChairId = 0
|
||||||
rm.SelectUserListBalanceTopSitDownChair()
|
// user.Mn.Unlock()
|
||||||
} else {
|
// if rm.GetGameStatus() < pb.ColorPinoyLiveGameStatus_ColorPinoyLiveOpenThreeDice {
|
||||||
// rm.Traverse(func(v *model.User) bool {
|
// rm.SelectUserListBalanceTopSitDownChair()
|
||||||
// rm.SendSceneMsg(v)
|
// } else {
|
||||||
// return true
|
// // rm.Traverse(func(v *model.User) bool {
|
||||||
// })
|
// // rm.SendSceneMsg(v)
|
||||||
}
|
// // return true
|
||||||
}
|
// // })
|
||||||
|
// }
|
||||||
func (rm *ColorRoom) AgainBet(user inter.UserInetr) {
|
//}
|
||||||
u := rm.getUser(user)
|
//
|
||||||
u.MutexBet.Lock()
|
//func (rm *ColorRoom) AgainBet(user inter.UserInetr) {
|
||||||
defer u.MutexBet.Unlock()
|
// u := rm.getUser(user)
|
||||||
if rm.checkNoBet() {
|
// u.MutexBet.Lock()
|
||||||
log.Error(rm.Log("game bet status err ", rm.GetGameStatus()))
|
// defer u.MutexBet.Unlock()
|
||||||
model.SendBetFailMessageInetr(model.StatusError, user)
|
// if rm.checkNoBet() {
|
||||||
return
|
// log.Error(rm.Log("game bet status err ", rm.GetGameStatus()))
|
||||||
}
|
// model.SendBetFailMessageInetr(model.StatusError, user)
|
||||||
// u := rm.getUser(user)
|
// return
|
||||||
var bets []*pb.ColorPinoyLiveBetReq
|
// }
|
||||||
if u.TempLastTimeBet != nil {
|
// // u := rm.getUser(user)
|
||||||
for _, bet := range u.TempLastTimeBet {
|
// var bets []*pb.ColorPinoyLiveBetReq
|
||||||
bets = append(bets, bet...)
|
// if u.TempLastTimeBet != nil {
|
||||||
}
|
// for _, bet := range u.TempLastTimeBet {
|
||||||
}
|
// bets = append(bets, bet...)
|
||||||
rm.CheckAndBet(u, bets)
|
// }
|
||||||
}
|
// }
|
||||||
|
// rm.CheckAndBet(u, bets)
|
||||||
func (rm *ColorRoom) BetDouble(user inter.UserInetr) {
|
//}
|
||||||
u := rm.getUser(user)
|
//
|
||||||
u.MutexBet.Lock()
|
//func (rm *ColorRoom) BetDouble(user inter.UserInetr) {
|
||||||
defer u.MutexBet.Unlock()
|
// u := rm.getUser(user)
|
||||||
if rm.checkNoBet() {
|
// u.MutexBet.Lock()
|
||||||
log.Error(rm.Log("game bet status err ", rm.GetGameStatus()))
|
// defer u.MutexBet.Unlock()
|
||||||
model.SendBetFailMessageInetr(model.StatusError, user)
|
// if rm.checkNoBet() {
|
||||||
return
|
// log.Error(rm.Log("game bet status err ", rm.GetGameStatus()))
|
||||||
}
|
// model.SendBetFailMessageInetr(model.StatusError, user)
|
||||||
// u := rm.getUser(user)
|
// return
|
||||||
var bets []*pb.ColorPinoyLiveBetReq
|
// }
|
||||||
if u.LastTimeBet != nil {
|
// // u := rm.getUser(user)
|
||||||
for _, bet := range u.LastTimeBet {
|
// var bets []*pb.ColorPinoyLiveBetReq
|
||||||
bets = append(bets, bet...)
|
// if u.LastTimeBet != nil {
|
||||||
}
|
// for _, bet := range u.LastTimeBet {
|
||||||
// log.Debug("BetDouble 上次下注:", u.LastTimeBet, "bets:", bets)
|
// bets = append(bets, bet...)
|
||||||
}
|
// }
|
||||||
if len(bets) > 1000 {
|
// // log.Debug("BetDouble 上次下注:", u.LastTimeBet, "bets:", bets)
|
||||||
log.Error(rm.Log("game bet status err ", rm.GetGameStatus()))
|
// }
|
||||||
model.SendBetFailMessageInetr(12, user)
|
// if len(bets) > 1000 {
|
||||||
return
|
// log.Error(rm.Log("game bet status err ", rm.GetGameStatus()))
|
||||||
}
|
// model.SendBetFailMessageInetr(12, user)
|
||||||
|
// return
|
||||||
rm.CheckAndBet(u, bets)
|
// }
|
||||||
}
|
//
|
||||||
|
// rm.CheckAndBet(u, bets)
|
||||||
func (rm *ColorRoom) OnUndoBet(buffer []byte, user inter.UserInetr) {
|
//}
|
||||||
u := rm.getUser(user)
|
//
|
||||||
u.MutexBet.Lock()
|
//func (rm *ColorRoom) OnUndoBet(buffer []byte, user inter.UserInetr) {
|
||||||
defer u.MutexBet.Unlock()
|
// u := rm.getUser(user)
|
||||||
if rm.checkNoBet() {
|
// u.MutexBet.Lock()
|
||||||
log.Error(rm.Log("game bet status err:%v", rm.GetGameStatus()))
|
// defer u.MutexBet.Unlock()
|
||||||
model.SendBetFailMessageInetr(model.StatusError, user)
|
// if rm.checkNoBet() {
|
||||||
return
|
// log.Error(rm.Log("game bet status err:%v", rm.GetGameStatus()))
|
||||||
}
|
// model.SendBetFailMessageInetr(model.StatusError, user)
|
||||||
reqInfo := &pb.ColorPinoyLiveC2SUndoBet{}
|
// return
|
||||||
err := proto.Unmarshal(buffer, reqInfo)
|
// }
|
||||||
if err != nil {
|
// reqInfo := &pb.ColorPinoyLiveC2SUndoBet{}
|
||||||
log.Error(rm.Log("proto.Unmarshal err:%v", err))
|
// err := proto.Unmarshal(buffer, reqInfo)
|
||||||
model.SendBetFailMessageInetr(model.DataErr, user)
|
// if err != nil {
|
||||||
return
|
// log.Error(rm.Log("proto.Unmarshal err:%v", err))
|
||||||
}
|
// model.SendBetFailMessageInetr(model.DataErr, user)
|
||||||
rm.UndoBet(u, reqInfo.UndoType)
|
// return
|
||||||
}
|
// }
|
||||||
|
// rm.UndoBet(u, reqInfo.UndoType)
|
||||||
// ApplyUseProps todo
|
//}
|
||||||
func (rm *ColorRoom) ApplyUseProps(buffer []byte, userInter inter.UserInetr) {
|
//
|
||||||
applyInfo := new(pb.ColorPinoyLiveApplyPropsReq)
|
//// ApplyUseProps todo
|
||||||
err := proto.Unmarshal(buffer, applyInfo)
|
//func (rm *ColorRoom) ApplyUseProps(buffer []byte, userInter inter.UserInetr) {
|
||||||
user := rm.getUser(userInter)
|
// applyInfo := new(pb.ColorPinoyLiveApplyPropsReq)
|
||||||
if err != nil {
|
// err := proto.Unmarshal(buffer, applyInfo)
|
||||||
log.Error(rm.Log("proto.Unmarshal err:%v", err))
|
// user := rm.getUser(userInter)
|
||||||
model.SendBetFailMessage(model.DataErr, user)
|
// if err != nil {
|
||||||
return
|
// log.Error(rm.Log("proto.Unmarshal err:%v", err))
|
||||||
}
|
// model.SendBetFailMessage(model.DataErr, user)
|
||||||
AcceptUser := rm.GetPlayer(applyInfo.AcceptUserId)
|
// return
|
||||||
if AcceptUser == nil {
|
// }
|
||||||
log.Error(rm.Log("AcceptUser is null"))
|
// AcceptUser := rm.GetPlayer(applyInfo.AcceptUserId)
|
||||||
model.SendBetFailMessage(model.UserNull, user)
|
// if AcceptUser == nil {
|
||||||
return
|
// log.Error(rm.Log("AcceptUser is null"))
|
||||||
}
|
// model.SendBetFailMessage(model.UserNull, user)
|
||||||
_, err = user.GetPropsReal(rm.RoomCfg.Prop, rm.Table, rm.RoomCfg)
|
// return
|
||||||
if err != nil {
|
// }
|
||||||
log.Error(rm.Log("GetPropsReal err", err))
|
// _, err = user.GetPropsReal(rm.RoomCfg.Prop, rm.Table, rm.RoomCfg)
|
||||||
model.SendBetFailMessage(model.ScoreLess, user)
|
// if err != nil {
|
||||||
return
|
// log.Error(rm.Log("GetPropsReal err", err))
|
||||||
}
|
// model.SendBetFailMessage(model.ScoreLess, user)
|
||||||
leftCoins := user.Balance
|
// return
|
||||||
propsResp := &pb.ColorPinoyLivePlayerPropsResp{
|
// }
|
||||||
ApplyUserId: user.UserID,
|
// leftCoins := user.Balance
|
||||||
AcceptUserId: AcceptUser.UserID,
|
// propsResp := &pb.ColorPinoyLivePlayerPropsResp{
|
||||||
PropsId: applyInfo.PropsId,
|
// ApplyUserId: user.UserID,
|
||||||
Chips: leftCoins,
|
// AcceptUserId: AcceptUser.UserID,
|
||||||
}
|
// PropsId: applyInfo.PropsId,
|
||||||
rm.Table.Broadcast(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticePlayerUseProps), propsResp)
|
// Chips: leftCoins,
|
||||||
}
|
// }
|
||||||
|
// rm.Table.Broadcast(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticePlayerUseProps), propsResp)
|
||||||
|
//}
|
||||||
|
@ -1,68 +1,53 @@
|
|||||||
package room
|
package room
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"game/common/baseroom"
|
"game/common/baseroom"
|
||||||
"game/common/proto/pb"
|
"game/common/proto/pb"
|
||||||
"github.com/fox/fox/log"
|
"github.com/fox/fox/log"
|
||||||
"github.com/fox/fox/processor"
|
"github.com/fox/fox/processor"
|
||||||
"github.com/fox/fox/service"
|
"github.com/fox/fox/service"
|
||||||
"sync"
|
)
|
||||||
"time"
|
|
||||||
|
const (
|
||||||
|
BET_TYPE_NUM = 18
|
||||||
)
|
)
|
||||||
|
|
||||||
type ColorRoom struct {
|
type ColorRoom struct {
|
||||||
*baseroom.BaseRoom[ColorSeat]
|
*baseroom.BaseRoom[ColorSeat]
|
||||||
|
|
||||||
//---------------------------------
|
//---------------------------------
|
||||||
Status pb.ColorPinoyLiveGameStatus // 房间状态1 表示
|
//Status pb.ColorPinoyLiveGameStatus // 房间状态1 表示
|
||||||
StatusTime int64 // 切换状态时的时间戳
|
//StatusTime int64 // 切换状态时的时间戳
|
||||||
|
//
|
||||||
|
//NormalDices []byte // 普通骰子 3个
|
||||||
|
//StartDices []byte // 初始位置摆放的骰子 3个
|
||||||
|
//
|
||||||
|
//// DefaultLuckyDice byte // 幸运骰子 1个 每局开始 放在拉杆上的骰子
|
||||||
|
//// DefaultNormalDices []byte // 普通骰子 3个 每局开始 放在拉杆上的骰子
|
||||||
|
//
|
||||||
|
//TotalBets [BET_TYPE_NUM]int64 // 各区域的下注统计
|
||||||
|
//TotalBet int64 // 下注统计
|
||||||
|
////SceneInfo model.SceneInfo // 下注的玩家列表
|
||||||
|
//
|
||||||
|
//GameTrend *pb.ColorPinoyLiveTrend // 走势图
|
||||||
|
////OnlineUserList []*model.User // 所有的玩家列表 用于排序
|
||||||
|
//PokerMsg *pb.ColorPinoyLivePokerMsg // 扑克消息
|
||||||
|
//RoomCfg game.ColorRoomConfig // 房间配置
|
||||||
|
//GameTiming game.ColorGameTiming // 时间配置
|
||||||
|
//startAt int64
|
||||||
|
//endAt int64
|
||||||
|
//
|
||||||
|
//ServerStatus int32
|
||||||
|
//wd *sync.WaitGroup
|
||||||
|
//TrendRedisKey string
|
||||||
|
//_aniLuckyDiceRouteIndex int32 // 幸运骰子动画路径
|
||||||
|
//_aniThreeDiceRouteIndex int32 // 3个骰子动画路径
|
||||||
|
//BigWinner []*pb.ColorPinoyLiveBigWinner
|
||||||
|
//LiveMgr *LiveMgr
|
||||||
|
//dealerName []string // 主播名字
|
||||||
|
//betEndBetAreasOdds []*pb.ColorPinoyLiveGameBetAreaInfo // 下注结束后,每个区域更新是否爆奖
|
||||||
|
//afterBetAreaOdds []*pb.ColorPinoyLiveBetAreaOdd // 开奖后,更新每个区域的赔率(主要是单色投注区开奖后,三个赔率变为1个赔率)
|
||||||
|
|
||||||
LuckyDice byte // 幸运骰子 1个
|
|
||||||
NormalDices []byte // 普通骰子 3个
|
|
||||||
StartDices []byte // 初始位置摆放的骰子 3个
|
|
||||||
ResultImgs []string // 结果图片
|
|
||||||
|
|
||||||
// DefaultLuckyDice byte // 幸运骰子 1个 每局开始 放在拉杆上的骰子
|
|
||||||
// DefaultNormalDices []byte // 普通骰子 3个 每局开始 放在拉杆上的骰子
|
|
||||||
|
|
||||||
TotalBets [config.BET_TYPE_NUM]int64 // 各区域的下注统计
|
|
||||||
TotalBet int64 // 下注统计
|
|
||||||
SceneInfo model.SceneInfo // 下注的玩家列表
|
|
||||||
GamePoker *model.GameDice // 管理一副牌
|
|
||||||
TimerJob *clock.Job // job
|
|
||||||
RobotCreateJob *clock.Job // job
|
|
||||||
RobotDeleteJob *clock.Job // job
|
|
||||||
// LuckyBetType int32 // 幸运区域
|
|
||||||
// LuckyMul int32 // 幸运倍率
|
|
||||||
// RobotTimerJob *clock.Job // 机器人job
|
|
||||||
// LastMasterBetType int32 // 最近一次神算子下注的类型
|
|
||||||
GameTrend *pb.ColorPinoyLiveTrend // 走势图
|
|
||||||
OnlineUserList []*model.User // 所有的玩家列表 用于排序
|
|
||||||
PokerMsg *pb.ColorPinoyLivePokerMsg // 扑克消息
|
|
||||||
RoomCfg *config.RoomConfig // 房间配置
|
|
||||||
Cfg *config.ColorPinoyLiveConfig // 房间配置
|
|
||||||
startAt int64
|
|
||||||
endAt int64
|
|
||||||
MutexData *sync.RWMutex
|
|
||||||
MutexStatus *sync.RWMutex
|
|
||||||
MutexUserList *sync.RWMutex
|
|
||||||
ServerStatus int32
|
|
||||||
wd *sync.WaitGroup
|
|
||||||
TrendRedisKey string
|
|
||||||
_aniLuckyDiceRouteIndex int32 // 幸运骰子动画路径
|
|
||||||
_aniThreeDiceRouteIndex int32 // 3个骰子动画路径
|
|
||||||
BigWinner []*pb.ColorPinoyLiveBigWinner
|
|
||||||
LiveMgr *LiveMgr
|
|
||||||
dealerName []string // 主播名字
|
|
||||||
betEndBetAreasOdds []*pb.ColorPinoyLiveGameBetAreaInfo // 下注结束后,每个区域更新是否爆奖
|
|
||||||
afterBetAreaOdds []*pb.ColorPinoyLiveBetAreaOdd // 开奖后,更新每个区域的赔率(主要是单色投注区开奖后,三个赔率变为1个赔率)
|
|
||||||
jackpotMgr *jackpot.JackPotMgr
|
|
||||||
jackpotFunding int64 // 本局垫资
|
|
||||||
jackpotX int64 // 赎回比例
|
|
||||||
jackpotY int64 // 追加进
|
|
||||||
costJackpot int64 // 本局发下去的jackpot奖励,回滚用
|
|
||||||
jackpotUser map[int64]int64 // 本局中jackpot的玩家,用于kafka发送消息
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func newColorRoom(id, roomType int, srv service.IService) (baseroom.IRoom, pb.ErrCode) {
|
func newColorRoom(id, roomType int, srv service.IService) (baseroom.IRoom, pb.ErrCode) {
|
||||||
@ -100,406 +85,327 @@ func (rm *ColorRoom) AddGold(user *ColorPlayer, add int64) (int64, bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------------------------------
|
||||||
|
//
|
||||||
const (
|
//const (
|
||||||
BigWinnerCount = 6
|
// BigWinnerCount = 6
|
||||||
GameName = "ColorPinoyLive"
|
// GameName = "ColorPinoyLive"
|
||||||
)
|
//)
|
||||||
|
//
|
||||||
func (rm *ColorRoom) SetGameStatus(status pb.ColorPinoyLiveGameStatus) {
|
//func (rm *ColorRoom) SetGameStatus(status pb.ColorPinoyLiveGameStatus) {
|
||||||
rm.Status = status
|
// rm.Status = status
|
||||||
rm.StatusTime = time.Now().UnixMilli()
|
// rm.StatusTime = time.Now().UnixMilli()
|
||||||
log.Debug("设置房间状态:", status)
|
// log.DebugF(rm.Log("设置房间状态:%v", status))
|
||||||
rm.SetLiveGameStatus([]int{1}...)
|
//}
|
||||||
}
|
//func (rm *ColorRoom) GetGameStatus() pb.ColorPinoyLiveGameStatus {
|
||||||
func (rm *ColorRoom) GetGameStatus() pb.ColorPinoyLiveGameStatus {
|
// return rm.Status
|
||||||
return rm.Status
|
//}
|
||||||
}
|
//
|
||||||
func (rm *ColorRoom) UserOffline(user inter.UserInetr) {
|
//// 客户端显示赔率范围
|
||||||
_ = user
|
//func (rm *ColorRoom) MulRangeConfig() []*pb.BetAreaMulRangeConfig {
|
||||||
}
|
// var mulRangeCfg []*pb.BetAreaMulRangeConfig
|
||||||
|
// for pos, mul := range rm.RoomCfg.WinSingleColorMul {
|
||||||
// 客户端显示赔率范围
|
// if len(mul) > 0 {
|
||||||
func (rm *ColorRoom) MulRangeConfig() []*pb.BetAreaMulRangeConfig {
|
// mulRangeCfg = append(mulRangeCfg, &pb.BetAreaMulRangeConfig{
|
||||||
var mulRangeCfg []*pb.BetAreaMulRangeConfig
|
// Pos: pb.ColorPinoyLiveBigBetAreaPos(pos),
|
||||||
for pos, mul := range rm.Cfg.WinSingleColorMul {
|
// MinMul: mul[0].Mul,
|
||||||
if len(mul) > 0 {
|
// MaxMul: mul[len(mul)-1].Mul,
|
||||||
mulRangeCfg = append(mulRangeCfg, &pb.BetAreaMulRangeConfig{
|
// })
|
||||||
Pos: pb.ColorPinoyLiveBigBetAreaPos(pos),
|
// }
|
||||||
MinMul: mul[0].Mul,
|
// }
|
||||||
MaxMul: mul[len(mul)-1].Mul,
|
// if len(rm.RoomCfg.WinDoubleColorMul) > 0 {
|
||||||
})
|
// mul := rm.RoomCfg.WinDoubleColorMul
|
||||||
}
|
// mulRangeCfg = append(mulRangeCfg, &pb.BetAreaMulRangeConfig{
|
||||||
}
|
// Pos: pb.ColorPinoyLiveBigBetAreaPos_BBA_Double,
|
||||||
if len(rm.Cfg.WinDoubleColorMul) > 0 {
|
// MinMul: mul[0].Mul,
|
||||||
mul := rm.Cfg.WinDoubleColorMul
|
// MaxMul: mul[0].Mul,
|
||||||
mulRangeCfg = append(mulRangeCfg, &pb.BetAreaMulRangeConfig{
|
// })
|
||||||
Pos: pb.ColorPinoyLiveBigBetAreaPos_BBA_Double,
|
// }
|
||||||
MinMul: mul[0].Mul,
|
// if len(rm.RoomCfg.WinThreeColorMul) > 0 {
|
||||||
MaxMul: mul[0].Mul,
|
// mul := rm.RoomCfg.WinThreeColorMul
|
||||||
})
|
// mulRangeCfg = append(mulRangeCfg, &pb.BetAreaMulRangeConfig{
|
||||||
}
|
// Pos: pb.ColorPinoyLiveBigBetAreaPos_BBA_Three,
|
||||||
if len(rm.Cfg.WinThreeColorMul) > 0 {
|
// MinMul: mul[0].Mul,
|
||||||
mul := rm.Cfg.WinThreeColorMul
|
// MaxMul: mul[0].Mul,
|
||||||
mulRangeCfg = append(mulRangeCfg, &pb.BetAreaMulRangeConfig{
|
// })
|
||||||
Pos: pb.ColorPinoyLiveBigBetAreaPos_BBA_Three,
|
// }
|
||||||
MinMul: mul[0].Mul,
|
// if len(mulRangeCfg) != len(pb.ColorPinoyLiveBigBetAreaPos_name) {
|
||||||
MaxMul: mul[0].Mul,
|
// log.Error(rm.Log(("配置错误")))
|
||||||
})
|
// return nil
|
||||||
}
|
// }
|
||||||
if len(mulRangeCfg) != len(pb.ColorPinoyLiveBigBetAreaPos_name) {
|
// for pos, v := range mulRangeCfg {
|
||||||
log.Error(rm.Log(("配置错误")))
|
// log.Debug(rm.Log("pos:%v 赔率区间:%v-%v", pos, v.MinMul, v.MaxMul))
|
||||||
return nil
|
// }
|
||||||
}
|
// return mulRangeCfg
|
||||||
for pos, v := range mulRangeCfg {
|
//}
|
||||||
log.Debug(rm.Log("pos:%v 赔率区间:%v-%v", pos, v.MinMul, v.MaxMul))
|
//
|
||||||
}
|
//func (rm *ColorRoom) InitBigOddsBetAreas() {
|
||||||
return mulRangeCfg
|
// if len(rm.betEndBetAreasOdds) == 0 {
|
||||||
}
|
// rm.betEndBetAreasOdds = make([]*pb.ColorPinoyLiveGameBetAreaInfo, 0, len(pb.ColorPinoyLiveBetTypeJP_name))
|
||||||
|
// }
|
||||||
func (rm *ColorRoom) InitBigOddsBetAreas() {
|
// rm.betEndBetAreasOdds = rm.betEndBetAreasOdds[0:0]
|
||||||
if len(rm.betEndBetAreasOdds) == 0 {
|
// for betType := 0; betType < BET_TYPE_NUM; betType++ {
|
||||||
rm.betEndBetAreasOdds = make([]*pb.ColorPinoyLiveGameBetAreaInfo, 0, len(pb.ColorPinoyLiveBetTypeJP_name))
|
// rm.betEndBetAreasOdds = append(rm.betEndBetAreasOdds, &pb.ColorPinoyLiveGameBetAreaInfo{
|
||||||
}
|
// BetType: pb.ColorPinoyLiveBetTypeJP(betType),
|
||||||
rm.betEndBetAreasOdds = rm.betEndBetAreasOdds[0:0]
|
// BetChipsInfo: nil,
|
||||||
for betType := 0; betType < config.BET_TYPE_NUM; betType++ {
|
// IsWin: 0,
|
||||||
rm.betEndBetAreasOdds = append(rm.betEndBetAreasOdds, &pb.ColorPinoyLiveGameBetAreaInfo{
|
// Odd: nil,
|
||||||
BetType: pb.ColorPinoyLiveBetTypeJP(betType),
|
// IsBigOdd: false,
|
||||||
BetChipsInfo: nil,
|
// BigSingleColorOddPos: 0,
|
||||||
IsWin: 0,
|
// })
|
||||||
Odd: nil,
|
// }
|
||||||
IsBigOdd: false,
|
// for pos, betArea := range rm.betEndBetAreasOdds {
|
||||||
BigSingleColorOddPos: 0,
|
// betArea.IsBigOdd = false
|
||||||
})
|
// index := pos / int(pb.ColorPinoyLiveDiceColorType_ColorPinoyLiveType_GREEN)
|
||||||
}
|
// if index == 0 {
|
||||||
for pos, betArea := range rm.betEndBetAreasOdds {
|
// betArea.BigSingleColorOddPos = pb.ColorPinoyLiveBigBetAreaPos_BBA_Single_0
|
||||||
betArea.IsBigOdd = false
|
// var mulRangeW []*MulRangeW
|
||||||
index := pos / int(pb.ColorPinoyLiveDiceColorType_ColorPinoyLiveType_GREEN)
|
// begin := 0
|
||||||
if index == 0 {
|
// for _, mul := range rm.RoomCfg.WinSingleColorMul[0] {
|
||||||
betArea.BigSingleColorOddPos = pb.ColorPinoyLiveBigBetAreaPos_BBA_Single_0
|
// mulRangeW = append(mulRangeW, &MulRangeW{MulRate: mul, ColorPos: pb.ColorPinoyLiveBigBetAreaPos(pos), MinW: begin, MaxW: begin + mul.Rate})
|
||||||
var mulRangeW []*MulRangeW
|
// begin += mul.Rate
|
||||||
begin := 0
|
// }
|
||||||
for _, mul := range rm.Cfg.WinSingleColorMul[0] {
|
// rdv := xrand.RandRange[int](mulRangeW[0].MinW, mulRangeW[len(mulRangeW)-1].MaxW)
|
||||||
mulRangeW = append(mulRangeW, &MulRangeW{MulRate: mul, ColorPos: pb.ColorPinoyLiveBigBetAreaPos(pos), MinW: begin, MaxW: begin + mul.Rate})
|
// singleMul := rm.Cfg.WinSingleColorMul[0][0].Mul
|
||||||
begin += mul.Rate
|
// for _, mul := range mulRangeW {
|
||||||
}
|
// if rdv < mul.MinW || rdv >= mul.MaxW {
|
||||||
rdv := rand.RandInt(mulRangeW[0].MinW, mulRangeW[len(mulRangeW)-1].MaxW)
|
// continue
|
||||||
singleMul := rm.Cfg.WinSingleColorMul[0][0].Mul
|
// }
|
||||||
for _, mul := range mulRangeW {
|
// singleMul = mul.Mul
|
||||||
if rdv < mul.MinW || rdv >= mul.MaxW {
|
// break
|
||||||
continue
|
// }
|
||||||
}
|
// log.Debug(rm.Log("单色区域基础权重区间:[%v,%v],随机数:%v 基础赔率:%v", mulRangeW[0].MinW, mulRangeW[len(mulRangeW)-1].MaxW, rdv, singleMul))
|
||||||
singleMul = mul.Mul
|
// betArea.Odd = append(betArea.Odd, singleMul)
|
||||||
break
|
// betArea.Odd = append(betArea.Odd, rm.Cfg.WinSingleColorMul[1][0].Mul)
|
||||||
}
|
// betArea.Odd = append(betArea.Odd, rm.Cfg.WinSingleColorMul[2][0].Mul)
|
||||||
log.Debug(rm.Log("单色区域基础权重区间:[%v,%v],随机数:%v 基础赔率:%v", mulRangeW[0].MinW, mulRangeW[len(mulRangeW)-1].MaxW, rdv, singleMul))
|
// } else if index == 1 {
|
||||||
betArea.Odd = append(betArea.Odd, singleMul)
|
// betArea.BigSingleColorOddPos = pb.ColorPinoyLiveBigBetAreaPos_BBA_Double
|
||||||
betArea.Odd = append(betArea.Odd, rm.Cfg.WinSingleColorMul[1][0].Mul)
|
// betArea.Odd = append(betArea.Odd, rm.Cfg.WinDoubleColorMul[0].Mul)
|
||||||
betArea.Odd = append(betArea.Odd, rm.Cfg.WinSingleColorMul[2][0].Mul)
|
// } else {
|
||||||
} else if index == 1 {
|
// betArea.BigSingleColorOddPos = pb.ColorPinoyLiveBigBetAreaPos_BBA_Three
|
||||||
betArea.BigSingleColorOddPos = pb.ColorPinoyLiveBigBetAreaPos_BBA_Double
|
// betArea.Odd = append(betArea.Odd, rm.Cfg.WinThreeColorMul[0].Mul)
|
||||||
betArea.Odd = append(betArea.Odd, rm.Cfg.WinDoubleColorMul[0].Mul)
|
// }
|
||||||
} else {
|
// }
|
||||||
betArea.BigSingleColorOddPos = pb.ColorPinoyLiveBigBetAreaPos_BBA_Three
|
// for _, betArea := range rm.betEndBetAreasOdds {
|
||||||
betArea.Odd = append(betArea.Odd, rm.Cfg.WinThreeColorMul[0].Mul)
|
// log.Debug(rm.Log("初始化投注区域:%v 倍率:%v 是否爆奖:%v 是否jackpot:%v", betArea.BetType, betArea.Odd, betArea.IsBigOdd, betArea.IsJackpot))
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
for _, betArea := range rm.betEndBetAreasOdds {
|
//
|
||||||
log.Debug(rm.Log("初始化投注区域:%v 倍率:%v 是否爆奖:%v 是否jackpot:%v", betArea.BetType, betArea.Odd, betArea.IsBigOdd, betArea.IsJackpot))
|
//func (rm *ColorRoom) Log(format string, args ...any) string {
|
||||||
}
|
// s := fmt.Sprintf(format, args...)
|
||||||
}
|
// head := fmt.Sprintf("gameno:%v ", rm.Table.GetGameRoundId())
|
||||||
|
// return head + s
|
||||||
func (rm *ColorRoom) Log(format string, args ...any) string {
|
//}
|
||||||
s := fmt.Sprintf(format, args...)
|
//
|
||||||
head := fmt.Sprintf("gameno:%v ", rm.Table.GetGameRoundId())
|
//func (rm *ColorRoom) LogEx(user *model.User, format string, args ...any) string {
|
||||||
return head + s
|
// s := fmt.Sprintf(format, args...)
|
||||||
}
|
// head := fmt.Sprintf("gameno:%v user:%v", rm.Table.GetGameRoundId(), user.UserID)
|
||||||
|
// return head + s
|
||||||
func (rm *ColorRoom) LogEx(user *model.User, format string, args ...any) string {
|
//}
|
||||||
s := fmt.Sprintf(format, args...)
|
//
|
||||||
head := fmt.Sprintf("gameno:%v user:%v", rm.Table.GetGameRoundId(), user.UserID)
|
//
|
||||||
return head + s
|
//func (rm *ColorRoom) ResetConfigPrivate() bool {
|
||||||
}
|
// rm.RoomCfg = config.ResetConfigPrivate()
|
||||||
|
// rm.Cfg = &rm.RoomCfg.ColorPinoyLiveConfig
|
||||||
func (rm *ColorRoom) InitTableFrameSink(table inter.TableInter) inter.LiveRoomInter {
|
// return true
|
||||||
room := new(ColorPinoyLiveGame)
|
//}
|
||||||
room.Table = table
|
//func (rm *ColorRoom) GetPlayer(userid int64) *model.User {
|
||||||
room.OnlineUserList = make([]*model.User, 0)
|
// user, ok := rm.AllUserList.Load(userid)
|
||||||
room.SceneInfo.Init()
|
// if !ok {
|
||||||
room.PokerMsg = new(pb.ColorPinoyLivePokerMsg)
|
// return nil
|
||||||
// room.PokerMsg.LongPoker = make([]int32, 1)
|
// }
|
||||||
// room.PokerMsg.HuPoker = make([]int32, 1)
|
// player, ok := user.(*model.User)
|
||||||
room.MutexData = new(sync.RWMutex)
|
// if !ok {
|
||||||
room.MutexStatus = new(sync.RWMutex)
|
// return nil
|
||||||
room.MutexUserList = new(sync.RWMutex)
|
// }
|
||||||
room.GamePoker = new(model.GameDice)
|
// return player
|
||||||
room.wd = new(sync.WaitGroup)
|
//}
|
||||||
room.GamePoker.InitPoker()
|
//func (rm *ColorRoom) AddPlayer(player *model.User) {
|
||||||
room.NormalDices = make([]byte, 3)
|
// rm.AllUserList.Store(player.UserInetr.GetId(), player)
|
||||||
// room.DefaultNormalDices = make([]byte, 3)
|
// rm.MutexUserList.Lock()
|
||||||
room.GameTrend = new(pb.ColorPinoyLiveTrend)
|
// rm.OnlineUserList = append(rm.OnlineUserList, player)
|
||||||
room.GameTrend.ListTrendGroup = []*pb.ColorPinoyLiveTrendGroup{}
|
// rm.MutexUserList.Unlock()
|
||||||
room.GameRoundStart()
|
//}
|
||||||
room.InitWinTrend()
|
//
|
||||||
room.LiveMgr = NewLiveMgr()
|
//type TraverseFunc func(v *model.User) bool
|
||||||
room.InitBigOddsBetAreas()
|
//
|
||||||
room.jackpotMgr = jackpot.NewJackPotMgr()
|
//func (rm *ColorRoom) Traverse(f TraverseFunc) {
|
||||||
// room.jackpotMgr.Load(room.RoomCfg.ColorPinoyLiveConfig.InitJackpot)
|
// function := func(key, value interface{}) bool {
|
||||||
|
// if value != nil {
|
||||||
table.BindGame(room)
|
// us, ok := value.(*model.User)
|
||||||
return room
|
// if !ok {
|
||||||
}
|
// log.Warn("user is not *UserInetr")
|
||||||
func (rm *ColorRoom) ResetConfigPrivate() bool {
|
// } else {
|
||||||
rm.RoomCfg = config.ResetConfigPrivate()
|
// return f(us)
|
||||||
rm.Cfg = &rm.RoomCfg.ColorPinoyLiveConfig
|
// }
|
||||||
return true
|
// }
|
||||||
}
|
// return true
|
||||||
func (rm *ColorRoom) GetPlayer(userid int64) *model.User {
|
// }
|
||||||
user, ok := rm.AllUserList.Load(userid)
|
// rm.AllUserList.Range(function)
|
||||||
if !ok {
|
//}
|
||||||
return nil
|
//
|
||||||
}
|
//
|
||||||
player, ok := user.(*model.User)
|
//func (rm *ColorRoom) DeletePlayer(uid int64) {
|
||||||
if !ok {
|
// p := rm.GetPlayer(uid)
|
||||||
return nil
|
// if p != nil {
|
||||||
}
|
// rm.AllUserList.Delete(uid)
|
||||||
return player
|
// rm.DeleteExitUserFromOnlineUserListSlice(p)
|
||||||
}
|
// }
|
||||||
func (rm *ColorRoom) AddPlayer(player *model.User) {
|
//}
|
||||||
rm.AllUserList.Store(player.UserInetr.GetId(), player)
|
//
|
||||||
rm.MutexUserList.Lock()
|
//
|
||||||
rm.OnlineUserList = append(rm.OnlineUserList, player)
|
//
|
||||||
rm.MutexUserList.Unlock()
|
//
|
||||||
}
|
//
|
||||||
|
//func (rm *ColorRoom) UserExit(user inter.UserInetr) bool {
|
||||||
type TraverseFunc func(v *model.User) bool
|
// u := rm.getUser(user)
|
||||||
|
// // 有下注时不让玩家离开
|
||||||
func (rm *ColorRoom) Traverse(f TraverseFunc) {
|
// if u.TotalBet != 0 {
|
||||||
function := func(key, value interface{}) bool {
|
// return false
|
||||||
if value != nil {
|
// }
|
||||||
us, ok := value.(*model.User)
|
// rm.KickOutUser(u)
|
||||||
if !ok {
|
// return true
|
||||||
log.Warn("user is not *UserInetr")
|
//}
|
||||||
} else {
|
//func (rm *ColorRoom) LeaveGame(user inter.UserInetr) bool {
|
||||||
return f(us)
|
// u := rm.getUser(user)
|
||||||
}
|
// if u.TotalBet != 0 {
|
||||||
}
|
// // msg := new(pb.KickOutUserMsg)
|
||||||
return true
|
// // msg.KickOutReason = "游戏中不能退出!"
|
||||||
}
|
// // u.SendMsg(int32(pb.SendToClientMessageType_NoticeExitRet), msg)
|
||||||
rm.AllUserList.Range(function)
|
// return false
|
||||||
}
|
// }
|
||||||
func (rm *ColorRoom) TraverseRobotNum(num int, f TraverseFunc) {
|
//
|
||||||
curNum := 0
|
// rm.KickOutUser(u)
|
||||||
function := func(key, value interface{}) bool {
|
// return true
|
||||||
if value != nil {
|
//}
|
||||||
us, ok := value.(*model.User)
|
//
|
||||||
if !ok {
|
//// 游戏消息
|
||||||
log.Warn("user is not *UserInetr")
|
//func (rm *ColorRoom) OnGameMessage(subCmd int32, buffer []byte, user inter.UserInetr) {
|
||||||
} else if us.IsRobot {
|
// // log.Debug("收到客户端消息:", subCmd)
|
||||||
curNum++
|
// switch pb.ColorPinoyLiveReceiveFromClientMessageType(subCmd) {
|
||||||
f(us)
|
// case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyRefresh:
|
||||||
}
|
// rm.GameSync(user)
|
||||||
}
|
// case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyBetChips:
|
||||||
if num > 0 && curNum == num {
|
// monitor.GoSafe(rm.Bet, buffer, user)
|
||||||
return false
|
// case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyGetUserListInfo:
|
||||||
}
|
// monitor.GoSafe(rm.SendUserListInfo, user)
|
||||||
return true
|
// case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyGetTrend:
|
||||||
}
|
// monitor.GoSafe(rm.SendTrend, user)
|
||||||
rm.AllUserList.Range(function)
|
// case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyBetAgain:
|
||||||
}
|
// // go rm.AgainBet(user)
|
||||||
|
// monitor.GoSafe(rm.AgainBet, user)
|
||||||
func (rm *ColorRoom) DeletePlayer(uid int64) {
|
// case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyBetDouble:
|
||||||
p := rm.GetPlayer(uid)
|
// monitor.GoSafe(rm.BetDouble, user)
|
||||||
if p != nil {
|
// case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyUndoBet:
|
||||||
rm.AllUserList.Delete(uid)
|
// monitor.GoSafe(rm.OnUndoBet, buffer, user)
|
||||||
rm.DeleteExitUserFromOnlineUserListSlice(p)
|
// case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyUseProps:
|
||||||
}
|
// monitor.GoSafe(rm.ApplyUseProps, buffer, user)
|
||||||
}
|
// case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyLeave:
|
||||||
func (rm *ColorRoom) getUserLen() int64 {
|
// monitor.GoSafe(rm.ApplyLeave, buffer, user)
|
||||||
len1 := int64(0)
|
// }
|
||||||
rm.Traverse(func(v *model.User) bool {
|
//}
|
||||||
len1++
|
//
|
||||||
return true
|
//func (rm *ColorRoom) initDefaultDiceGameRoundReady() {
|
||||||
})
|
// // rm.DefaultLuckyDice = rm.GamePoker.ShuffleDices(1)[0]
|
||||||
return len1
|
// //
|
||||||
}
|
// // rm.DefaultNormalDices[0] = rm.GamePoker.ShuffleDices(1)[0]
|
||||||
func (rm *ColorRoom) getUserAndRobotLen() (userNum, robotNum int64) {
|
// // rm.DefaultNormalDices[1] = rm.GamePoker.ShuffleDices(1)[0]
|
||||||
rm.Traverse(func(v *model.User) bool {
|
// // rm.DefaultNormalDices[2] = rm.GamePoker.ShuffleDices(1)[0]
|
||||||
if v.IsRobot {
|
//}
|
||||||
robotNum++
|
//
|
||||||
} else {
|
//// 开lucky dice
|
||||||
userNum++
|
//func (rm *ColorRoom) OpenLuckyDice() {
|
||||||
}
|
//
|
||||||
return true
|
// dealDice := rm.GetPairDice(1, 0, 1)
|
||||||
})
|
//
|
||||||
return
|
// if dealDice == nil || len(dealDice) < 1 {
|
||||||
}
|
// rm.LuckyDice = rm.GamePoker.ShuffleDices(1)[0]
|
||||||
|
// } else {
|
||||||
func (rm *ColorRoom) UserReady(user inter.UserInetr) bool {
|
// deck := model.GetInitialDeck()
|
||||||
_ = user
|
// rm.LuckyDice = deck[dealDice[0]-1]
|
||||||
return true
|
// }
|
||||||
}
|
//}
|
||||||
|
//
|
||||||
// 用户坐下
|
//// 开3个普通 dice
|
||||||
func (rm *ColorRoom) OnActionUserSitDown(user inter.UserInetr, chairId int, config string) int {
|
//func (rm *ColorRoom) OpenThreeDice() {
|
||||||
_ = chairId
|
//
|
||||||
_ = config
|
// dealDice := rm.GetPairDice(3, 1, 4)
|
||||||
u := rm.getUser(user)
|
// if dealDice == nil || len(dealDice) < 3 {
|
||||||
// log.Debug("玩家坐下...OnActionUserSitDown:", u, chairId, config)
|
// rm.NormalDices[0] = rm.GamePoker.ShuffleDices(1)[0]
|
||||||
go rm.SceneUserSitDown(u)
|
// rm.NormalDices[1] = rm.GamePoker.ShuffleDices(1)[0]
|
||||||
return 1 // business.OnActionUserSitDownHandler()
|
// rm.NormalDices[2] = rm.GamePoker.ShuffleDices(1)[0]
|
||||||
}
|
// } else {
|
||||||
|
// deck := model.GetInitialDeck()
|
||||||
func (rm *ColorRoom) UserExit(user inter.UserInetr) bool {
|
// rm.NormalDices[0] = deck[dealDice[0]-1]
|
||||||
u := rm.getUser(user)
|
// rm.NormalDices[1] = deck[dealDice[1]-1]
|
||||||
// 有下注时不让玩家离开
|
// rm.NormalDices[2] = deck[dealDice[2]-1]
|
||||||
if u.TotalBet != 0 {
|
// }
|
||||||
return false
|
//}
|
||||||
}
|
//
|
||||||
rm.KickOutUser(u)
|
//func (rm *ColorRoom) getUser(user inter.UserInetr) *model.User {
|
||||||
return true
|
// // u, ok := rm.AllUserList[user.GetId()]
|
||||||
}
|
// u := rm.GetPlayer(user.GetId())
|
||||||
func (rm *ColorRoom) LeaveGame(user inter.UserInetr) bool {
|
// if u == nil {
|
||||||
u := rm.getUser(user)
|
// u = new(model.User)
|
||||||
if u.TotalBet != 0 {
|
// u.UserID = user.GetId()
|
||||||
// msg := new(pb.KickOutUserMsg)
|
// u.UserInetr = user
|
||||||
// msg.KickOutReason = "游戏中不能退出!"
|
// u.Balance = user.GetScore()
|
||||||
// u.SendMsg(int32(pb.SendToClientMessageType_NoticeExitRet), msg)
|
// u.Carry = user.GetCarry()
|
||||||
return false
|
// u.Time = time.Now().UnixNano() / 1e6
|
||||||
}
|
// u.UserInetr = user
|
||||||
|
// rm.AddPlayer(u)
|
||||||
rm.KickOutUser(u)
|
// u.ResetUserData()
|
||||||
return true
|
// }
|
||||||
}
|
//
|
||||||
|
// return u
|
||||||
// 游戏消息
|
//}
|
||||||
func (rm *ColorRoom) OnGameMessage(subCmd int32, buffer []byte, user inter.UserInetr) {
|
//
|
||||||
// log.Debug("收到客户端消息:", subCmd)
|
//func (rm *ColorRoom) getRobotUser(user inter.UserInetr) *model.User {
|
||||||
switch pb.ColorPinoyLiveReceiveFromClientMessageType(subCmd) {
|
// // u, ok := rm.AllUserList[user.GetId()]
|
||||||
case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyRefresh:
|
// u := rm.GetPlayer(user.GetId())
|
||||||
rm.GameSync(user)
|
// if u == nil {
|
||||||
case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyBetChips:
|
// u = new(model.User)
|
||||||
monitor.GoSafe(rm.Bet, buffer, user)
|
// u.UserID = user.GetId()
|
||||||
case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyGetUserListInfo:
|
// u.UserInetr = user
|
||||||
monitor.GoSafe(rm.SendUserListInfo, user)
|
// u.Balance = user.GetScore()
|
||||||
case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyGetTrend:
|
// u.Carry = user.GetCarry()
|
||||||
monitor.GoSafe(rm.SendTrend, user)
|
// u.Time = time.Now().UnixNano() / 1e6
|
||||||
case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyBetAgain:
|
// u.UserInetr = user
|
||||||
// go rm.AgainBet(user)
|
// u.IsRobot = true
|
||||||
monitor.GoSafe(rm.AgainBet, user)
|
// rm.AddPlayer(u)
|
||||||
case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyBetDouble:
|
// u.ResetUserData()
|
||||||
monitor.GoSafe(rm.BetDouble, user)
|
// }
|
||||||
case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyUndoBet:
|
//
|
||||||
monitor.GoSafe(rm.OnUndoBet, buffer, user)
|
// return u
|
||||||
case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyUseProps:
|
//}
|
||||||
monitor.GoSafe(rm.ApplyUseProps, buffer, user)
|
//
|
||||||
case pb.ColorPinoyLiveReceiveFromClientMessageType_ColorPinoyLiveApplyLeave:
|
//// 游戏开始入口.....
|
||||||
monitor.GoSafe(rm.ApplyLeave, buffer, user)
|
//func (rm *ColorRoom) GameStart() bool {
|
||||||
}
|
// if rm.GetGameStatus() == 0 {
|
||||||
}
|
// rm.Ready()
|
||||||
|
// rm.SyncServerMaintenance(0, "")
|
||||||
func (rm *ColorRoom) initDefaultDiceGameRoundReady() {
|
// _ = rm.LiveDelayUpdate()
|
||||||
// rm.DefaultLuckyDice = rm.GamePoker.ShuffleDices(1)[0]
|
// // 防止卡房间
|
||||||
//
|
// rm.Table.AddTimerRepeat(60, 0, func() {
|
||||||
// rm.DefaultNormalDices[0] = rm.GamePoker.ShuffleDices(1)[0]
|
// if rm.LiveMgr.MaintenanceStatus == 1 {
|
||||||
// rm.DefaultNormalDices[1] = rm.GamePoker.ShuffleDices(1)[0]
|
// rm.Table.EndGame()
|
||||||
// rm.DefaultNormalDices[2] = rm.GamePoker.ShuffleDices(1)[0]
|
// }
|
||||||
}
|
// })
|
||||||
|
// } else if rm.TimerJob != nil {
|
||||||
// 开lucky dice
|
// }
|
||||||
func (rm *ColorRoom) OpenLuckyDice() {
|
//
|
||||||
|
// return true
|
||||||
dealDice := rm.GetPairDice(1, 0, 1)
|
//}
|
||||||
|
//
|
||||||
if dealDice == nil || len(dealDice) < 1 {
|
//func (rm *ColorRoom) GameRoundStart() {
|
||||||
rm.LuckyDice = rm.GamePoker.ShuffleDices(1)[0]
|
// rm.RoomCfg = config.ResetConfig()
|
||||||
} else {
|
// rm.Cfg = &rm.RoomCfg.ColorPinoyLiveConfig
|
||||||
deck := model.GetInitialDeck()
|
// rm.ServerStatus = gconfig.GConfig.GServConfig.Status
|
||||||
rm.LuckyDice = deck[dealDice[0]-1]
|
//}
|
||||||
}
|
//
|
||||||
}
|
//func (rm *ColorRoom) ResetTable() {
|
||||||
|
// rm.SetGameStatus(0)
|
||||||
// 开3个普通 dice
|
//}
|
||||||
func (rm *ColorRoom) OpenThreeDice() {
|
//
|
||||||
|
//// 关闭桌子
|
||||||
dealDice := rm.GetPairDice(3, 1, 4)
|
//func (rm *ColorRoom) CloseTable() {
|
||||||
if dealDice == nil || len(dealDice) < 3 {
|
//}
|
||||||
rm.NormalDices[0] = rm.GamePoker.ShuffleDices(1)[0]
|
|
||||||
rm.NormalDices[1] = rm.GamePoker.ShuffleDices(1)[0]
|
|
||||||
rm.NormalDices[2] = rm.GamePoker.ShuffleDices(1)[0]
|
|
||||||
} else {
|
|
||||||
deck := model.GetInitialDeck()
|
|
||||||
rm.NormalDices[0] = deck[dealDice[0]-1]
|
|
||||||
rm.NormalDices[1] = deck[dealDice[1]-1]
|
|
||||||
rm.NormalDices[2] = deck[dealDice[2]-1]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func (rm *ColorRoom) getUser(user inter.UserInetr) *model.User {
|
|
||||||
// u, ok := rm.AllUserList[user.GetId()]
|
|
||||||
u := rm.GetPlayer(user.GetId())
|
|
||||||
if u == nil {
|
|
||||||
u = new(model.User)
|
|
||||||
u.UserID = user.GetId()
|
|
||||||
u.UserInetr = user
|
|
||||||
u.Balance = user.GetScore()
|
|
||||||
u.Carry = user.GetCarry()
|
|
||||||
u.Time = time.Now().UnixNano() / 1e6
|
|
||||||
u.UserInetr = user
|
|
||||||
rm.AddPlayer(u)
|
|
||||||
u.ResetUserData()
|
|
||||||
}
|
|
||||||
|
|
||||||
return u
|
|
||||||
}
|
|
||||||
|
|
||||||
func (rm *ColorRoom) getRobotUser(user inter.UserInetr) *model.User {
|
|
||||||
// u, ok := rm.AllUserList[user.GetId()]
|
|
||||||
u := rm.GetPlayer(user.GetId())
|
|
||||||
if u == nil {
|
|
||||||
u = new(model.User)
|
|
||||||
u.UserID = user.GetId()
|
|
||||||
u.UserInetr = user
|
|
||||||
u.Balance = user.GetScore()
|
|
||||||
u.Carry = user.GetCarry()
|
|
||||||
u.Time = time.Now().UnixNano() / 1e6
|
|
||||||
u.UserInetr = user
|
|
||||||
u.IsRobot = true
|
|
||||||
rm.AddPlayer(u)
|
|
||||||
u.ResetUserData()
|
|
||||||
}
|
|
||||||
|
|
||||||
return u
|
|
||||||
}
|
|
||||||
|
|
||||||
// 游戏开始入口.....
|
|
||||||
func (rm *ColorRoom) GameStart() bool {
|
|
||||||
if rm.GetGameStatus() == 0 {
|
|
||||||
rm.Ready()
|
|
||||||
rm.SyncServerMaintenance(0, "")
|
|
||||||
_ = rm.LiveDelayUpdate()
|
|
||||||
// 防止卡房间
|
|
||||||
rm.Table.AddTimerRepeat(60, 0, func() {
|
|
||||||
if rm.LiveMgr.MaintenanceStatus == 1 {
|
|
||||||
rm.Table.EndGame()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
} else if rm.TimerJob != nil {
|
|
||||||
}
|
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
func (rm *ColorRoom) GameRoundStart() {
|
|
||||||
rm.RoomCfg = config.ResetConfig()
|
|
||||||
rm.Cfg = &rm.RoomCfg.ColorPinoyLiveConfig
|
|
||||||
rm.ServerStatus = gconfig.GConfig.GServConfig.Status
|
|
||||||
}
|
|
||||||
|
|
||||||
func (rm *ColorRoom) ResetTable() {
|
|
||||||
rm.SetGameStatus(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
// 关闭桌子
|
|
||||||
func (rm *ColorRoom) CloseTable() {
|
|
||||||
}
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,117 +1,118 @@
|
|||||||
package room
|
package room
|
||||||
|
|
||||||
import (
|
//
|
||||||
"encoding/json"
|
//import (
|
||||||
"game/common/proto/pb"
|
// "encoding/json"
|
||||||
"github.com/fox/fox/ipb"
|
// "game/common/proto/pb"
|
||||||
"time"
|
// "github.com/fox/fox/ipb"
|
||||||
)
|
// "time"
|
||||||
|
//)
|
||||||
func (rm *ColorRoom) Ready() {
|
//
|
||||||
rm.Table.ResetGameRoundId()
|
//func (rm *ColorRoom) Ready() {
|
||||||
rm.ResetData(true)
|
// rm.Table.ResetGameRoundId()
|
||||||
rm.Table.EndGame()
|
// rm.ResetData(true)
|
||||||
|
// rm.Table.EndGame()
|
||||||
if isFunding := rm.jackpotMgr.Load(rm.RoomCfg.ColorPinoyLiveConfig.InitJackpot); isFunding {
|
//
|
||||||
rm.kafkaJackpotFunding(rm.RoomCfg.ColorPinoyLiveConfig.InitJackpot)
|
// if isFunding := rm.jackpotMgr.Load(rm.RoomCfg.ColorPinoyLiveConfig.InitJackpot); isFunding {
|
||||||
rm.jackpotFunding = rm.RoomCfg.ColorPinoyLiveConfig.InitJackpot
|
// rm.kafkaJackpotFunding(rm.RoomCfg.ColorPinoyLiveConfig.InitJackpot)
|
||||||
log.Debugf(rm.Log("发生垫资:%v", rm.jackpotFunding))
|
// rm.jackpotFunding = rm.RoomCfg.ColorPinoyLiveConfig.InitJackpot
|
||||||
} else {
|
// log.Debugf(rm.Log("发生垫资:%v", rm.jackpotFunding))
|
||||||
rm.jackpotFunding = 0
|
// } else {
|
||||||
log.Debugf(rm.Log("没有垫资"))
|
// rm.jackpotFunding = 0
|
||||||
}
|
// log.Debugf(rm.Log("没有垫资"))
|
||||||
rm.jackpotUser = nil
|
// }
|
||||||
rm.costJackpot = 0
|
// rm.jackpotUser = nil
|
||||||
log.Debugf(rm.Log("游戏开始costJackpot重置为0"))
|
// rm.costJackpot = 0
|
||||||
rm.SetGameStatus(pb.ColorPinoyLiveGameStatus_ColorPinoyLiveStartReady)
|
// log.Debugf(rm.Log("游戏开始costJackpot重置为0"))
|
||||||
rm.TimerJob, _ = rm.Table.AddTimer(time.Duration(rm.RoomCfg.TimeConf.Readymove), func() {
|
// rm.SetGameStatus(pb.ColorPinoyLiveGameStatus_ColorPinoyLiveStartReady)
|
||||||
rm.Start()
|
// rm.TimerJob, _ = rm.Table.AddTimer(time.Duration(rm.RoomCfg.TimeConf.Readymove), func() {
|
||||||
})
|
// rm.Start()
|
||||||
|
// })
|
||||||
// 初始化默认骰子
|
//
|
||||||
// rm.initDefaultDiceGameRoundReady()
|
// // 初始化默认骰子
|
||||||
// 开始动画消息
|
// // rm.initDefaultDiceGameRoundReady()
|
||||||
msg := new(pb.ColorPinoyLiveStatusMessage)
|
// // 开始动画消息
|
||||||
msg.Status = int32(rm.GetGameStatus())
|
// msg := new(pb.ColorPinoyLiveStatusMessage)
|
||||||
msg.StatusTime = int32(rm.RoomCfg.TimeConf.Startmove)
|
// msg.Status = int32(rm.GetGameStatus())
|
||||||
msg.Jackpot = rm.jackpotMgr.GetJackpot()
|
// msg.StatusTime = int32(rm.RoomCfg.TimeConf.Startmove)
|
||||||
rm.Table.Broadcast(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeGameReady), msg)
|
// msg.Jackpot = rm.jackpotMgr.GetJackpot()
|
||||||
}
|
// rm.Table.Broadcast(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeGameReady), msg)
|
||||||
|
//}
|
||||||
func (rm *ColorRoom) Start() {
|
//
|
||||||
rm.GameRoundStart()
|
//func (rm *ColorRoom) Start() {
|
||||||
rm.InitBigOddsBetAreas()
|
// rm.GameRoundStart()
|
||||||
// 推送房间筹码选择规则
|
// rm.InitBigOddsBetAreas()
|
||||||
rm.SendRuleInfo()
|
// // 推送房间筹码选择规则
|
||||||
rm.checkUserBet()
|
// rm.SendRuleInfo()
|
||||||
// 选择列表中前6个用户上座
|
// rm.checkUserBet()
|
||||||
rm.SelectUserListBalanceTopSitDownChair()
|
// // 选择列表中前6个用户上座
|
||||||
rm.startAt = time.Now().Unix()
|
// rm.SelectUserListBalanceTopSitDownChair()
|
||||||
rm.Table.StartGame()
|
// rm.startAt = time.Now().Unix()
|
||||||
// 开始动画消息
|
// rm.Table.StartGame()
|
||||||
msg := new(pb.ColorPinoyLiveStatusMessage)
|
// // 开始动画消息
|
||||||
msg.Status = int32(rm.GetGameStatus())
|
// msg := new(pb.ColorPinoyLiveStatusMessage)
|
||||||
msg.StatusTime = int32(rm.RoomCfg.TimeConf.Startmove)
|
// msg.Status = int32(rm.GetGameStatus())
|
||||||
// rm.jackpotMgr.Load(rm.Cfg.InitJackpot)
|
// msg.StatusTime = int32(rm.RoomCfg.TimeConf.Startmove)
|
||||||
msg.Jackpot = rm.jackpotMgr.GetJackpot()
|
// // rm.jackpotMgr.Load(rm.Cfg.InitJackpot)
|
||||||
rm.Table.Broadcast(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeGameStart), msg)
|
// msg.Jackpot = rm.jackpotMgr.GetJackpot()
|
||||||
}
|
// rm.Table.Broadcast(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeGameStart), msg)
|
||||||
|
//}
|
||||||
func (rm *ColorRoom) StartBet() {
|
//
|
||||||
rm.SetGameStatus(pb.ColorPinoyLiveGameStatus_ColorPinoyLiveBetStatus)
|
//func (rm *ColorRoom) StartBet() {
|
||||||
rm.TimerJob, _ = rm.Table.AddTimer(time.Duration(rm.RoomCfg.TimeConf.Startbet), func() {
|
// rm.SetGameStatus(pb.ColorPinoyLiveGameStatus_ColorPinoyLiveBetStatus)
|
||||||
rm.EndBet()
|
// rm.TimerJob, _ = rm.Table.AddTimer(time.Duration(rm.RoomCfg.TimeConf.Startbet), func() {
|
||||||
})
|
// rm.EndBet()
|
||||||
|
// })
|
||||||
// 发送开始下注消息
|
//
|
||||||
msg := new(pb.ColorPinoyLiveStatusMessage)
|
// // 发送开始下注消息
|
||||||
msg.Status = int32(rm.GetGameStatus())
|
// msg := new(pb.ColorPinoyLiveStatusMessage)
|
||||||
msg.StatusTime = int32(rm.RoomCfg.TimeConf.Startbet)
|
// msg.Status = int32(rm.GetGameStatus())
|
||||||
msg.Jackpot = rm.jackpotMgr.GetJackpot()
|
// msg.StatusTime = int32(rm.RoomCfg.TimeConf.Startbet)
|
||||||
rm.Table.Broadcast(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeGameStartBet), msg)
|
// msg.Jackpot = rm.jackpotMgr.GetJackpot()
|
||||||
// log.Debug("pb. 开始下注.....StartBet()")
|
// rm.Table.Broadcast(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeGameStartBet), msg)
|
||||||
}
|
// // log.Debug("pb. 开始下注.....StartBet()")
|
||||||
|
//}
|
||||||
func (rm *ColorRoom) EndBet() {
|
//
|
||||||
rm.SetGameStatus(pb.ColorPinoyLiveGameStatus_ColorPinoyLiveEndBetMovie)
|
//func (rm *ColorRoom) EndBet() {
|
||||||
// 停止下注就扣钱
|
// rm.SetGameStatus(pb.ColorPinoyLiveGameStatus_ColorPinoyLiveEndBetMovie)
|
||||||
rm.StartTransInoutBet()
|
// // 停止下注就扣钱
|
||||||
|
// rm.StartTransInoutBet()
|
||||||
// 发送停止下注消息
|
//
|
||||||
msg := new(pb.ColorPinoyLiveStatusMessage)
|
// // 发送停止下注消息
|
||||||
msg.Status = int32(rm.GetGameStatus())
|
// msg := new(pb.ColorPinoyLiveStatusMessage)
|
||||||
msg.StatusTime = int32(rm.RoomCfg.TimeConf.Endmove)
|
// msg.Status = int32(rm.GetGameStatus())
|
||||||
msg.Jackpot = rm.jackpotMgr.GetJackpot()
|
// msg.StatusTime = int32(rm.RoomCfg.TimeConf.Endmove)
|
||||||
rm.Table.Broadcast(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeGameEndBet), msg)
|
// msg.Jackpot = rm.jackpotMgr.GetJackpot()
|
||||||
|
// rm.Table.Broadcast(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeGameEndBet), msg)
|
||||||
// log.Debug("pb. 停止下注.....EndBet()")
|
//
|
||||||
}
|
// // log.Debug("pb. 停止下注.....EndBet()")
|
||||||
|
//}
|
||||||
// 开3个 dice
|
//
|
||||||
func (rm *ColorRoom) openThreeDice() {
|
//// 开3个 dice
|
||||||
// log.Debug("aabb openThreeDice")
|
//func (rm *ColorRoom) openThreeDice() {
|
||||||
rm.SetGameStatus(pb.ColorPinoyLiveGameStatus_ColorPinoyLiveOpenThreeDice)
|
// // log.Debug("aabb openThreeDice")
|
||||||
rm.Table.AddTimer(time.Duration(rm.RoomCfg.TimeConf.OpenThreeDice), func() {
|
// rm.SetGameStatus(pb.ColorPinoyLiveGameStatus_ColorPinoyLiveOpenThreeDice)
|
||||||
// log.Debug("aabb settle")
|
// rm.Table.AddTimer(time.Duration(rm.RoomCfg.TimeConf.OpenThreeDice), func() {
|
||||||
rm.CompareDiceResult()
|
// // log.Debug("aabb settle")
|
||||||
rm.Settle()
|
// rm.CompareDiceResult()
|
||||||
})
|
// rm.Settle()
|
||||||
// 发送开三个骰子消息
|
// })
|
||||||
rm._aniThreeDiceRouteIndex = int32(rand.RandIntM(0, 48))
|
// // 发送开三个骰子消息
|
||||||
msg := new(pb.ColorPinoyLiveGameOpenThreeDice)
|
// rm._aniThreeDiceRouteIndex = int32(rand.RandIntM(0, 48))
|
||||||
msg.Status = int32(rm.GetGameStatus())
|
// msg := new(pb.ColorPinoyLiveGameOpenThreeDice)
|
||||||
msg.AniRouteIndex = rm._aniThreeDiceRouteIndex // 掉落路径
|
// msg.Status = int32(rm.GetGameStatus())
|
||||||
|
// msg.AniRouteIndex = rm._aniThreeDiceRouteIndex // 掉落路径
|
||||||
for _, dice := range rm.NormalDices {
|
//
|
||||||
msg.Color = append(msg.Color, pb.ColorPinoyLiveDiceColorType(model.GetColor(dice)))
|
// for _, dice := range rm.NormalDices {
|
||||||
}
|
// msg.Color = append(msg.Color, pb.ColorPinoyLiveDiceColorType(model.GetColor(dice)))
|
||||||
rm.Table.Broadcast(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeGameOpenThreeDice), msg)
|
// }
|
||||||
}
|
// rm.Table.Broadcast(int32(pb.ColorPinoyLiveSendToClientMessageType_ColorPinoyLiveNoticeGameOpenThreeDice), msg)
|
||||||
|
//}
|
||||||
// 结算
|
//
|
||||||
func (rm *ColorRoom) Settle() {
|
//// 结算
|
||||||
// log.Debug("aabb 结算")
|
//func (rm *ColorRoom) Settle() {
|
||||||
rm.SetGameStatus(pb.ColorPinoyLiveGameStatus_ColorPinoyLiveSettleStatus)
|
// // log.Debug("aabb 结算")
|
||||||
rm.endAt = time.Now().Unix()
|
// rm.SetGameStatus(pb.ColorPinoyLiveGameStatus_ColorPinoyLiveSettleStatus)
|
||||||
rm.SetUserSettleMsg()
|
// rm.endAt = time.Now().Unix()
|
||||||
}
|
// rm.SetUserSettleMsg()
|
||||||
|
//}
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user