123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464 |
- var BRTPGameProtocol = require("BRTPGameProtocol")
- var Global = require("Global")
- cc.Class({
- extends: cc.Component,
- properties: {
- },
- statics: {
- analyzeData(m, s, dataview) {
- switch (s) {
- case BRTPGameProtocol.SUB_S_GAME_FREE: {//空闲状态
- return this.analyze_GameFree(dataview);
- }
- break;
- case BRTPGameProtocol.SUB_S_GAME_START: {//游戏开始
- return this.analyze_GameStart(dataview);
- }
- break;
- case BRTPGameProtocol.SUB_S_PLACE_JETTON: { //下注
- return this.analyze_PlaceJetton(dataview);
- }
- break;
- case BRTPGameProtocol.SUB_S_PLACE_JETTON_FAIL: { //下注失败
- return this.analyze_PlaceBetFail(dataview);
- }
- break;
- case BRTPGameProtocol.SUB_S_GAME_END: { //游戏结束
- return this.analyze_GameEnd(dataview);
- }
- break;
- case BRTPGameProtocol.SUB_S_APPLY_BANKER: { //申请庄家
- return this.analyze_ApplyBanker(dataview);
- }
- break;
- case BRTPGameProtocol.SUB_S_APPLEY_BANKER_FAILURE: { //申请庄家失败
- return this.analyze_ApplyFailed(dataview);
- }
- break;
- case BRTPGameProtocol.SUB_S_CHANGE_BANKER: { //切换庄家
- return this.analyze_ChangeBanker(dataview);
- }
- break;
- case BRTPGameProtocol.SUB_S_CANCEL_BANKER: { //取消申请庄家
- return this.analyze_CancelBanker(dataview);
- }
- break;
- case BRTPGameProtocol.SUB_S_CANCEL_FAILURE:{//取消庄家失败
- return this.analyze_CancelFailed(dataview);
- }
- break;
- case BRTPGameProtocol.SUB_S_BANK_LIST:{//庄家列表
- return this.analyze_bankerList(dataview);
- }
- break;
- case BRTPGameProtocol.SUB_S_ONLINE_PLAYER:{//在线用户
- return this.analyze_UserList(dataview);
- }
- break;
- case BRTPGameProtocol.SUB_S_SEND_RECORD:{//游戏记录
- return this.analyze_record(dataview);
- }
- break;
- case BRTPGameProtocol.SUB_S_SEND_WINLOST:{//游戏输赢统计
- return this.analyze_winLost(dataview);
- }
- break;
- case BRTPGameProtocol.SUB_S_OTHER_JETTON:{//其它玩家下注
- return this.analyze_PlaceJetton(dataview);
- }
- break;
- case BRTPGameProtocol.SUB_S_SEAT_JETTON:{//占位玩家下注
- return this.analyze_PlaceJetton(dataview);
- }
- break;
- case BRTPGameProtocol.SUB_S_SEND_CONTROL_INFO:{
- return this.analyzeSendControlInfo(dataview);
- }
- case BRTPGameProtocol.SUB_S_GAME_RECORD_INFO:{
- return this.analyzeGameRecord(dataview);
- }
- default:
- break;
- }
- return null;
- },
-
- analyze_StatusFree:function(dataview) {//游戏状态free
- var dataList = {};
- dataview.pos = 0;
- dataList.cbHighTimes = Global.GetInt8(dataview);//是否是高倍场
- dataList.cbTimeLeave = Global.GetInt8(dataview);//剩余时间
- dataList.nChip = [];
- for(let i = 0;i< BRTPGameProtocol.MAX_CHIP_COUNT;i++){
- dataList.nChip[i] = Global.GetInt32(dataview);//筹码配置
- }
- dataList.wSeatUser = [];
- for(let i = 0;i< BRTPGameProtocol.MAX_SEAT_COUNT;i++){
- dataList.wSeatUser[i] = Global.GetInt16(dataview);//6个椅子玩家的椅子号
- }
- dataList.wBankerUser = Global.GetInt16(dataview);//当前庄家的GameID
- dataList.lBankerScore = Global.unify(Global.GetUint64(dataview));//庄家分数
- dataList.lAreaLimitScore = Global.unify(Global.GetUint64(dataview));//区域限制
- dataList.lApplyBankerCondition = Global.unify(Global.GetUint64(dataview));//申请条件
- dataList.lMinXianHong = Global.unify(Global.GetUint64(dataview));//
- dataList.lMaxXianHong = Global.unify(Global.GetUint64(dataview));//
-
- return dataList;
- },
- analyze_StatusPlay:function(dataview) {//游戏状态play
- var dataList = {};
- dataview.pos = 0;
- dataList.cbHighTimes = Global.GetInt8(dataview);//是否是高倍场
- dataList.cbTimeLeave = Global.GetInt8(dataview);//剩余时间
- dataList.nChip = [];
- for(let i = 0;i< BRTPGameProtocol.MAX_CHIP_COUNT;i++){
- dataList.nChip[i] = Global.GetInt32(dataview);//筹码配置
- }
- dataList.wSeatUser = [];
- for(let i = 0;i< BRTPGameProtocol.MAX_SEAT_COUNT;i++){
- dataList.wSeatUser[i] = Global.GetInt16(dataview);//6个椅子玩家的椅子号
- }
- dataList.wBankerUser = Global.GetInt16(dataview);//当前庄家的GameID
- dataList.lBankerScore = Global.unify(Global.GetUint64(dataview));//庄家分数
- dataList.lAreaLimitScore = Global.unify(Global.GetUint64(dataview));//区域限制
- dataList.lApplyBankerCondition = Global.unify(Global.GetUint64(dataview));//申请条件
- dataList.lMinXianHong = Global.unify(Global.GetUint64(dataview));//
- dataList.lMaxXianHong = Global.unify(Global.GetUint64(dataview));//
- dataList.lPlayerJettonScore = [];
- for(let i = 0;i< BRTPGameProtocol.AREA_MAX+1;i++){
- dataList.lPlayerJettonScore[i] = Global.unify(Global.GetUint64(dataview));//玩家下的注
- }
- dataList.lAllJettonScore = [];
- for(let i = 0;i< BRTPGameProtocol.AREA_MAX+1;i++){
- dataList.lAllJettonScore[i] = Global.unify(Global.GetUint64(dataview));//所有玩家下的注
- }
- dataList.cbTableCardArray = [];
- for(let i = 0;i< 5;i++){
- dataList.cbTableCardArray[i] = []
- for(let j = 0;j< 5;j++){
- dataList.cbTableCardArray[i][j] = Global.GetInt8(dataview);//桌面扑克
- }
- }
- dataList.cbCardType = [];
- for(let i = 0;i< BRTPGameProtocol.AREA_MAX+1;i++){
- dataList.cbCardType[i] = Global.GetInt8(dataview);//牌型
- }
- dataList.cbResult = [];
- for(let i = 0;i< BRTPGameProtocol.AREA_MAX;i++){
- dataList.cbResult[i] = Global.GetInt8(dataview);//结果
- }
- dataList.lBankerWinScore = Global.unify(Global.GetUint64(dataview));//庄家赢分
- dataList.lPlayerWinScore = Global.unify(Global.GetUint64(dataview));//玩家赢分
- dataList.lSeatUserWinScore = [];
- for(let i = 0;i< BRTPGameProtocol.MAX_SEAT_COUNT;i++){
- dataList.lSeatUserWinScore[i] = Global.unify(Global.GetUint64(dataview));//坐下的玩家输赢
- }
- dataList.lPlayerRestScore = Global.unify(Global.GetUint64(dataview));//玩家还剩多少钱
- dataList.lBankerRestScore = Global.unify(Global.GetUint64(dataview));//庄家还剩多少钱
- dataList.cbStatus = Global.GetInt8(dataview);//当前状态1=下注状态,2=结算状态
-
- return dataList;
- },
- analyze_GameFree:function(dataview){//空闲时间
- var dataList = {};
- dataview.pos = 0;
- dataList.cbTimeLeave = Global.GetInt32(dataview);//剩余时间
- return dataList;
- },
- analyze_GameStart:function(dataview) {//游戏开始
- var dataList = {};
- dataview.pos = 0;
- // 剩余时间
- dataList.cbTimeLeave = Global.GetInt8(dataview);
- // 6个椅子玩家的椅子号
- dataList.wSeatUser = new Array(BRTPGameProtocol.MAX_SEAT_COUNT);
- for(let i = 0;i<BRTPGameProtocol.MAX_SEAT_COUNT;i++){
- dataList.wSeatUser[i] = Global.GetInt16(dataview);
- }
- // 连庄次数
- dataList.BankTimes = Global.GetInt32(dataview);
- // 当前局下注上限
- dataList.lBankerScore = Global.unify(Global.GetUint64(dataview),2);
- // 桌面扑克
- dataList.cbTableCardArray = new Array(5);
- for(let i = 0; i < 5; i++) {
- let arr = new Array(5);
- for(let j = 0; j < 5; j++) {
- arr[j] = Global.GetInt8(dataview);
- }
- dataList.cbTableCardArray[i] = arr;
- }
- return dataList;
- },
- analyze_PlaceJetton:function(dataview) {//用户下注
- var dataList = {};
- dataview.pos = 0;
- dataList.wChairID = Global.GetInt16(dataview);//用户位置
- dataList.cbBetArea = Global.GetInt8(dataview);//筹码区域
- dataList.lBetScore = Global.unify(Global.GetUint64(dataview));//加注数目
- dataList.lPlayerRestScore = Global.unify(Global.GetUint64(dataview));//下注玩家剩余金币
- return dataList;
- },
- analyze_PlaceBetFail:function(dataview) {//下注失败
- var dataList = {};
- dataview.pos = 0;
- dataList.szBuffer = Global.Read2Char(dataview,64);//描述信息
- return dataList;
- },
- analyze_GameEnd:function(dataview) {//游戏结束
- var dataList = {};
- dataview.pos = 0;
- dataList.cbEarlyOpenFlag = Global.GetInt8(dataview);//提前开牌标识
- dataList.lPlayAreaScore = [];
- for(let i = 0;i< BRTPGameProtocol.AREA_MAX;i++){
- dataList.lPlayAreaScore[i] = Global.unify(Global.GetUint64(dataview));//玩家成绩
- }
- dataList.lPlayerWinScore = Global.unify(Global.GetUint64(dataview));//玩家赢的钱
- dataList.lPlayerRestScore = Global.unify(Global.GetUint64(dataview));//玩家还剩多少钱
- dataList.lBankerWinScore = Global.unify(Global.GetUint64(dataview));//庄家成绩
- dataList.lBankerRestScore = Global.unify(Global.GetUint64(dataview));//庄家还剩多少钱
- dataList.lSeatUserWinScore = [];
- for(let i = 0;i< BRTPGameProtocol.MAX_SEAT_COUNT;i++){
- dataList.lSeatUserWinScore[i] = Global.unify(Global.GetUint64(dataview));//坐下的玩家输赢
- }
- dataList.cbTableCardArray = [];
- for(let i = 0;i< 5;i++){
- dataList.cbTableCardArray[i] = [];
- for(let j = 0;j<5;j++){
- dataList.cbTableCardArray[i][j] = Global.GetUint8(dataview);//桌面扑克
- }
- }
- dataList.cbCardType = [];
- for(let i = 0;i< BRTPGameProtocol.AREA_MAX+1;i++){
- dataList.cbCardType[i] = Global.GetInt8(dataview);//牌型
- }
- dataList.cbResult = [];
- for(let i = 0;i< BRTPGameProtocol.AREA_MAX;i++){
- dataList.cbResult[i] = Global.GetInt8(dataview);//结果
- }
- dataList.cbTimeLeave = Global.GetInt32(dataview);//剩余时间
- dataList.lOtherPlayerWinScore = Global.unify(Global.GetUint64(dataview));//除了座位上玩家其他玩家的输赢总值
- dataList.lBankAreaWinScore = [];
- for(let i = 0;i< BRTPGameProtocol.AREA_MAX;i++){
- dataList.lBankAreaWinScore[i] = Global.unify(Global.GetUint64(dataview));//庄家各个区域的输赢
- }
- //坐下的玩家输赢
- dataList.lSeatUserArerScore = [];
- for(let i = 0; i < BRTPGameProtocol.MAX_SEAT_COUNT; i++){
- let arr = new Array();
- for(let i = 0; i < BRTPGameProtocol.AREA_MAX; i++){
- arr.push(Global.unify(Global.GetUint64(dataview)));
- }
- dataList.lSeatUserArerScore.push(arr);
- }
- // 倍率
- dataList.cbMulti = [];
- for(let i = 0;i< BRTPGameProtocol.AREA_MAX;i++){
- dataList.cbMulti[i] = Global.GetInt8(dataview);
- }
-
- return dataList;
- },
- analyze_ApplyBanker:function(dataview) {//申请庄家成功
- var dataList = {};
- dataview.pos = 0;
- dataList.wApplyUser = Global.GetInt8(dataview);//申请玩家
- return dataList;
- },
- analyze_ApplyFailed:function(dataview) {//申请庄家失败
- var dataList = {};
- dataview.pos = 0;
- dataList.szBuffer = Global.Read2Char(dataview,64);//描述信息
- return dataList;
- },
- analyze_CancelBanker:function(dataview) {//取消庄家成功
- var dataList = {};
- dataview.pos = 0;
- dataList.wCancelUser = Global.GetInt8(dataview);//取消玩家
- return dataList;
- },
- analyze_CancelFailed:function(dataview) {//取消庄家失败
- var dataList = {};
- dataview.pos = 0;
- dataList.szBuffer = Global.Read2Char(dataview,64);//描述信息
- return dataList;
- },
- analyze_ChangeBanker:function(dataview) {//切换庄家
- var dataList = {};
- dataview.pos = 0;
- dataList.wPreviousBanker = Global.GetInt16(dataview);//上一个当庄玩家
- dataList.wBankerUser = Global.GetInt16(dataview);//当庄玩家
- dataList.lBankerScore = Global.unify(Global.GetUint64(dataview));//庄家金币
- return dataList;
- },
- analyze_record:function(dataview){//前7局输赢
- var dataList = {};
- dataview.pos = 0;
- dataList.record = [];
- var cnt = dataview.byteLength/4;
- for(var i = 0;i<cnt;i++){
- var data = {};
- data.bWinTian = Global.GetInt8(dataview);
- data.bWinDi = Global.GetInt8(dataview);
- data.bWinXuan = Global.GetInt8(dataview);
- data.bWinHuang = Global.GetInt8(dataview);
- dataList.record.push(data);
- }
- return dataList;
- },
- analyze_winLost:function(dataview){//
- var dataList = {};
- dataview.pos = 0;
- dataList.record = [];
- var cnt = dataview.byteLength/40;
- for(var i = 0;i<cnt;i++){
- var data = {};
- data.lDrawCount = Global.GetUint64(dataview);
- data.lWinTian = Global.GetUint64(dataview);
- data.lWinDi = Global.GetUint64(dataview);
- data.lWinXuan = Global.GetUint64(dataview);
- data.lWinHuang = Global.GetUint64(dataview);
- dataList.record.push(data);
- }
- return dataList;
- },
- analyze_bankerList:function(dataview) {//玩家列表
- var dataList = {};
- dataview.pos = 0;
- dataList.BankLists = [];
- for(let i = 0;i<20;i++){
- dataList.BankLists[i] = Global.GetInt32(dataview);
- }
- return dataList;
- },
- analyze_UserList:function(dataview) {//玩家列表
- var dataList = {};
- dataview.pos = 0;
- dataList.wCount = Global.GetInt8(dataview);//数组数量
- dataList.bEnd = Global.GetInt8(dataview);//是否结束
- dataList.cbIndex = [];
- for(let i = 0;i< BRTPGameProtocol.USER_LIST_COUNT;i++){
- dataList.cbIndex[i] = Global.GetInt8(dataview);//排名
- }
- dataList.szUserNick = [];
- for(let i = 0;i< BRTPGameProtocol.USER_LIST_COUNT;i++){
- dataList.szUserNick[i] = Global.Read2Char(dataview,32);//昵称
- }
- dataList.lBetScore = [];
- for(let i = 0;i< BRTPGameProtocol.USER_LIST_COUNT;i++){
- dataList.lBetScore[i] = Global.unify(Global.GetUint64(dataview));//近20局下注金额
- }
- dataList.cbWinTimes = [];
- for(let i = 0;i< BRTPGameProtocol.USER_LIST_COUNT;i++){
- dataList.cbWinTimes[i] = Global.GetUint64(dataview);//近20局赢了多少局
- }
- dataList.lUserScore = [];
- for(let i = 0;i< BRTPGameProtocol.USER_LIST_COUNT;i++){
- dataList.lUserScore[i] = Global.unify(Global.GetUint64(dataview));//玩家金币
- }
- dataList.wFaceID = [];
- for(let i = 0;i< BRTPGameProtocol.USER_LIST_COUNT;i++){
- dataList.wFaceID[i] = Global.GetUint8(dataview);//玩家头像
- }
- dataList.wChairID = [];
- for(let i = 0;i< BRTPGameProtocol.USER_LIST_COUNT;i++){
- dataList.wChairID[i] = Global.GetUint16(dataview);//
- }
- return dataList;
- },
- analyze_UserListInfo:function(dataview) {//玩家列表单个数据
- var dataList = {};
- dataview.pos = 0;
- dataList.wWinNum = Global.GetUint16(dataview);//获胜次数
- dataList.lAllBet = Global.unify(Global.GetUint64(dataview));//下注分数
- dataList.lUserScore = Global.unify(Global.GetUint64(dataview));//用户积分
- dataList.szNickName = Global.gbk2Utf8(Global.Read2Char(dataview,32));//用户昵称
- dataList.wFaceID = Global.GetUint8(dataview);//玩家头像
- dataList.wChairID = Global.GetUint16(dataview);//
- return dataList;
- },
- analyzeSendControlInfo:function(dataview) {
- const areaNum = 4;
- let data = {};
- dataview.pos = 0;
- data.areaInfo = new Array(areaNum);
- for(let i = 0; i < areaNum; ++i) {
- let item = {};
- item.RoomSha = Global.GetInt16(dataview); // WORD 房间杀率
- item.RoomWin = Global.GetInt16(dataview); // WORD 系统赢
- item.RoomLost = Global.GetInt16(dataview); // WORD 系统输
- item.RoomSuiRate = Global.GetInt16(dataview); // WORD 当前随到
- item.RoomResult = Global.GetInt8(dataview); // BYTE 控制结果 0无控制 1系统赢 2系统输
- item.QunState = Global.GetInt8(dataview); // BYTE 是否需要判断控制 0不需要1需要
- item.QunStock = Global.unify(Global.Read2ll(dataview)); // SCORE 群控库存
- item.IsDanKong = Global.GetInt8(dataview); // BYTE 单控是否生效 1是
- item.DanRate = Global.GetInt16(dataview); // WORD 单控概率
- item.DanStocks = Global.unify(Global.GetInt32(dataview)); // int 单控库存
- item.DanSuiRate = Global.GetInt16(dataview); // WORD 单控随机值
- item.DanType = Global.GetInt8(dataview); // BYTE 控制结果0无控制 1控制系统赢 2控制系统输
- item.DanMinBet = Global.unify(Global.GetInt32(dataview)); // int 单控门槛
- item.szNickName = Global.gbk2Utf8(Global.Read2Char(dataview,32)); // TCHAR 单控玩家
-
- data.areaInfo[i] = item;
- }
- return data;
- },
- analyzeGameRecord: function(dataview) {
- dataview.pos = 0;
- let data = [];
- let count = Global.GetInt8(dataview);
- for(let i = 0; i < count; i++) {
- let item = {};
- item.nBet = Global.unify(Global.GetInt32(dataview));
- item.nWimLost = Global.unify(Global.GetInt32(dataview));
- item.nTime = new Date(Global.GetInt32(dataview) * 1000); // 服务器单位秒
- data.push(item);
- }
- return data;
- }
- },
- start () {
- },
- });
|