AnalyzeFruitXieYi.js 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. var GameProtocol = require("FruitGameProtocol")
  2. var Global = require("Global")
  3. cc.Class({
  4. extends: cc.Component,
  5. properties: {
  6. },
  7. statics: {
  8. analyzeData(m, s, dataview) {
  9. switch (s) {
  10. case GameProtocol.SUB_S_REBACK_LOTTERY: {//游戏开始
  11. return this.analyze_GameResult(dataview);
  12. }
  13. break;
  14. case GameProtocol.SUB_S_JACKPOT_RESET: { //下注
  15. return this.analyze_Jackpot(dataview);
  16. }
  17. break;
  18. case GameProtocol.SUB_S_SEND_CONTROL_INFO: {
  19. return this.analyze_ControlInfo(dataview);
  20. }
  21. break;
  22. default:
  23. break;
  24. }
  25. return null;
  26. },
  27. analyze_GameConfig(dataview) {//游戏状态
  28. var dataList = {};
  29. dataview.pos = 0;
  30. // dataList.lCurScore = Global.unify(Global.GetUint64(dataview));
  31. // dataList.lEnterScore = Global.unify(Global.GetUint64(dataview));
  32. // dataList.nMinJetton = Global.GetInt32(dataview);
  33. // dataList.nMaxJetton = Global.GetInt32(dataview);
  34. dataList.nJetton = [];
  35. for(let i = 0;i< GameProtocol.LUCKMAN_LIST_LENGTH;i++){
  36. dataList.nJetton[i] = Global.GetInt32(dataview);//筹码配置
  37. }
  38. // dataList.szLuckymanList = [];
  39. // for(let i = 0;i< GameProtocol.LUCKMAN_LIST_LENGTH;i++){
  40. // dataList.szLuckymanList[i] = Global.Read2Char(dataview, 32);
  41. // }
  42. return dataList;
  43. },
  44. analyze_GameResult(dataview) {
  45. // Global.print(dataview);
  46. var dataList = {};
  47. dataview.pos = 0;
  48. dataList.m_chair_id = Global.GetInt8(dataview);
  49. dataList.m_chip_size = Global.GetInt32(dataview);
  50. dataList.m_desk_data = [];
  51. for(let i = 0;i< GameProtocol.MAX_ROW_NUM;i++){
  52. dataList.m_desk_data[i] = [];
  53. for(let j = 0; j < GameProtocol.MAX_COL_NUM; ++j) {
  54. dataList.m_desk_data[i][j] = Global.GetInt8(dataview);
  55. }
  56. }
  57. dataList.m_is_berserk = Global.GetInt8(dataview);
  58. dataList.m_berserk_data1 = [];
  59. for(let i = 0;i< GameProtocol.MAX_ROW_NUM;i++){
  60. dataList.m_berserk_data1[i] = [];
  61. for(let j = 0; j < GameProtocol.MAX_COL_NUM; ++j) {
  62. dataList.m_berserk_data1[i][j] = Global.GetInt8(dataview);
  63. }
  64. }
  65. dataList.m_berserk_data2 = [];
  66. for(let i = 0;i< GameProtocol.MAX_ROW_NUM;i++){
  67. dataList.m_berserk_data2[i] = [];
  68. for(let j = 0; j < GameProtocol.MAX_COL_NUM; ++j) {
  69. dataList.m_berserk_data2[i][j] = Global.GetInt8(dataview);
  70. }
  71. }
  72. dataList.m_line_count = Global.GetInt8(dataview);
  73. dataList.m_line_id = [];
  74. for(let i = 0;i< GameProtocol.MAX_LINE_COUNT;i++){
  75. dataList.m_line_id[i] = Global.GetInt8(dataview);
  76. }
  77. dataList.m_line_size = [];
  78. for(let i = 0;i< GameProtocol.MAX_LINE_COUNT;i++){
  79. dataList.m_line_size[i] = Global.GetInt8(dataview);
  80. }
  81. dataList.m_line_icon = [];
  82. for(let i = 0;i< GameProtocol.MAX_LINE_COUNT;i++){
  83. dataList.m_line_icon[i] = Global.GetInt8(dataview);
  84. }
  85. dataList.m_line_times = [];
  86. for(let i = 0;i< GameProtocol.MAX_LINE_COUNT;i++){
  87. dataList.m_line_times[i] = Global.GetInt8(dataview);
  88. }
  89. dataList.m_kongming = Global.GetInt8(dataview);
  90. dataList.m_ruyi = Global.GetInt8(dataview);
  91. dataList.m_lottery_size = Global.unify(Global.GetUint64(dataview));
  92. dataList.m_deposit_lotttery = Global.unify(Global.GetUint64(dataview));
  93. dataList.lCurScore = Global.unify(Global.GetUint64(dataview));
  94. dataList.cbFreeTime = Global.GetInt8(dataview);
  95. dataList.cbFreeAdd = Global.GetInt8(dataview);
  96. return dataList;
  97. },
  98. analyze_Jackpot(dataview) {
  99. var dataList = {};
  100. dataview.pos = 0;
  101. dataList.lJackPot = Global.unify(Global.GetUint64(dataview));
  102. return dataList;
  103. },
  104. analyze_ControlInfo(dataview) {
  105. let data = {};
  106. dataview.pos = 0;
  107. data.RoomSha = Global.GetInt16(dataview); // WORD 房间杀率
  108. data.RoomWin = Global.GetInt16(dataview); // WORD 系统赢
  109. data.RoomLost = Global.GetInt16(dataview); // WORD 系统输
  110. data.RoomSuiRate = Global.GetInt16(dataview); // WORD 当前随到
  111. data.RoomResult = Global.GetInt8(dataview); // BYTE 控制结果 0无控制 1系统赢 2系统输
  112. data.QunState = Global.GetInt8(dataview); // BYTE 是否需要判断控制 0不需要1需要
  113. data.QunStock = Global.unify(Global.Read2ll(dataview)); // SCORE 群控库存
  114. data.IsDanKong = Global.GetInt8(dataview); // BYTE 单控是否生效 1是
  115. data.DanRate = Global.GetInt16(dataview); // WORD 单控概率
  116. data.DanStocks = Global.unify(Global.GetInt32(dataview)); // int 单控库存
  117. data.DanSuiRate = Global.GetInt16(dataview); // WORD 单控随机值
  118. data.DanType = Global.GetInt8(dataview); // BYTE 控制结果0无控制 1控制系统赢 2控制系统输
  119. data.DanMinBet = Global.unify(Global.GetInt32(dataview)); // int 单控门槛
  120. return data;
  121. },
  122. analyze_Record(dataview) {
  123. var dataList = {};
  124. dataview.pos = 0;
  125. dataList.nBet = Global.GetInt32(dataview);
  126. dataList.nWinLost = Global.GetInt32(dataview);
  127. dataList.nTime = Global.GetInt32(dataview);
  128. return dataList;
  129. },
  130. },
  131. start () {
  132. },
  133. });