123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166 |
- var GameProtocol = require("FruitGameProtocol")
- var Global = require("Global")
- cc.Class({
- extends: cc.Component,
- properties: {
- },
- statics: {
- analyzeData(m, s, dataview) {
- switch (s) {
- case GameProtocol.SUB_S_REBACK_LOTTERY: {//游戏开始
- return this.analyze_GameResult(dataview);
- }
- break;
- case GameProtocol.SUB_S_JACKPOT_RESET: { //下注
- return this.analyze_Jackpot(dataview);
- }
- break;
- case GameProtocol.SUB_S_SEND_CONTROL_INFO: {
- return this.analyze_ControlInfo(dataview);
- }
- break;
- default:
- break;
- }
- return null;
- },
- analyze_GameConfig(dataview) {//游戏状态
- var dataList = {};
- dataview.pos = 0;
- // dataList.lCurScore = Global.unify(Global.GetUint64(dataview));
- // dataList.lEnterScore = Global.unify(Global.GetUint64(dataview));
- // dataList.nMinJetton = Global.GetInt32(dataview);
- // dataList.nMaxJetton = Global.GetInt32(dataview);
- dataList.nJetton = [];
- for(let i = 0;i< GameProtocol.LUCKMAN_LIST_LENGTH;i++){
- dataList.nJetton[i] = Global.GetInt32(dataview);//筹码配置
- }
- // dataList.szLuckymanList = [];
- // for(let i = 0;i< GameProtocol.LUCKMAN_LIST_LENGTH;i++){
- // dataList.szLuckymanList[i] = Global.Read2Char(dataview, 32);
- // }
- return dataList;
- },
- analyze_GameResult(dataview) {
- // Global.print(dataview);
- var dataList = {};
- dataview.pos = 0;
- dataList.m_chair_id = Global.GetInt8(dataview);
- dataList.m_chip_size = Global.GetInt32(dataview);
- dataList.m_desk_data = [];
- for(let i = 0;i< GameProtocol.MAX_ROW_NUM;i++){
- dataList.m_desk_data[i] = [];
- for(let j = 0; j < GameProtocol.MAX_COL_NUM; ++j) {
- dataList.m_desk_data[i][j] = Global.GetInt8(dataview);
- }
- }
- dataList.m_is_berserk = Global.GetInt8(dataview);
- dataList.m_berserk_data1 = [];
- for(let i = 0;i< GameProtocol.MAX_ROW_NUM;i++){
- dataList.m_berserk_data1[i] = [];
- for(let j = 0; j < GameProtocol.MAX_COL_NUM; ++j) {
- dataList.m_berserk_data1[i][j] = Global.GetInt8(dataview);
- }
- }
- dataList.m_berserk_data2 = [];
- for(let i = 0;i< GameProtocol.MAX_ROW_NUM;i++){
- dataList.m_berserk_data2[i] = [];
- for(let j = 0; j < GameProtocol.MAX_COL_NUM; ++j) {
- dataList.m_berserk_data2[i][j] = Global.GetInt8(dataview);
- }
- }
- dataList.m_line_count = Global.GetInt8(dataview);
- dataList.m_line_id = [];
- for(let i = 0;i< GameProtocol.MAX_LINE_COUNT;i++){
- dataList.m_line_id[i] = Global.GetInt8(dataview);
- }
- dataList.m_line_size = [];
- for(let i = 0;i< GameProtocol.MAX_LINE_COUNT;i++){
- dataList.m_line_size[i] = Global.GetInt8(dataview);
- }
- dataList.m_line_icon = [];
- for(let i = 0;i< GameProtocol.MAX_LINE_COUNT;i++){
- dataList.m_line_icon[i] = Global.GetInt8(dataview);
- }
- dataList.m_line_times = [];
- for(let i = 0;i< GameProtocol.MAX_LINE_COUNT;i++){
- dataList.m_line_times[i] = Global.GetInt8(dataview);
- }
- dataList.m_kongming = Global.GetInt8(dataview);
- dataList.m_ruyi = Global.GetInt8(dataview);
- dataList.m_lottery_size = Global.unify(Global.GetUint64(dataview));
- dataList.m_deposit_lotttery = Global.unify(Global.GetUint64(dataview));
- dataList.lCurScore = Global.unify(Global.GetUint64(dataview));
- dataList.cbFreeTime = Global.GetInt8(dataview);
- dataList.cbFreeAdd = Global.GetInt8(dataview);
-
- return dataList;
- },
- analyze_Jackpot(dataview) {
- var dataList = {};
- dataview.pos = 0;
- dataList.lJackPot = Global.unify(Global.GetUint64(dataview));
- return dataList;
- },
- analyze_ControlInfo(dataview) {
- let data = {};
- dataview.pos = 0;
- data.RoomSha = Global.GetInt16(dataview); // WORD 房间杀率
- data.RoomWin = Global.GetInt16(dataview); // WORD 系统赢
- data.RoomLost = Global.GetInt16(dataview); // WORD 系统输
- data.RoomSuiRate = Global.GetInt16(dataview); // WORD 当前随到
- data.RoomResult = Global.GetInt8(dataview); // BYTE 控制结果 0无控制 1系统赢 2系统输
- data.QunState = Global.GetInt8(dataview); // BYTE 是否需要判断控制 0不需要1需要
- data.QunStock = Global.unify(Global.Read2ll(dataview)); // SCORE 群控库存
- data.IsDanKong = Global.GetInt8(dataview); // BYTE 单控是否生效 1是
- data.DanRate = Global.GetInt16(dataview); // WORD 单控概率
- data.DanStocks = Global.unify(Global.GetInt32(dataview)); // int 单控库存
- data.DanSuiRate = Global.GetInt16(dataview); // WORD 单控随机值
- data.DanType = Global.GetInt8(dataview); // BYTE 控制结果0无控制 1控制系统赢 2控制系统输
- data.DanMinBet = Global.unify(Global.GetInt32(dataview)); // int 单控门槛
- return data;
- },
- analyze_Record(dataview) {
- var dataList = {};
- dataview.pos = 0;
- dataList.nBet = Global.GetInt32(dataview);
- dataList.nWinLost = Global.GetInt32(dataview);
- dataList.nTime = Global.GetInt32(dataview);
- return dataList;
- },
- },
- start () {
- },
- });
|