RomanGameSence.js 62 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454
  1. var GameBase = require("LBGameBase");
  2. var ProtocolGameServer = require("ProtocolGameServer");
  3. var GameProtocol = require("RomanGameProtocol");
  4. var AnalyzeXieYi = require("AnalyzeRomanXieYi");
  5. var MakeXieYi = require("MakeRomanXieYi");
  6. var Global = require("Global");
  7. var topTipMsg = require("topTipMsg");
  8. var UIHelper = require("UIHelper");
  9. var BaseDefine = require("BaseDefine");
  10. var ProtocolLoginServer = require("ProtocolLoginServer");
  11. var EventMgr = require("EventMgr");
  12. const LanguageKey = require("LanguageKey");
  13. import { CServerItem } from 'CServerItem'
  14. import GameManagerBase from 'GameManagerBase'
  15. import ScenceManager from 'HNScenceManager'
  16. // const GAME_FREE = 0; //无
  17. // const GAME_PLAYING = 1; //游戏中
  18. // const GAME_END = 2; //游戏结束
  19. // const GAME_PLAYSCOREING = 3; //表现分数增加中
  20. // const GAME_GAMEEND = 4; //游戏真正结束
  21. const ShowNextJackpotTime = 10;
  22. cc.Class({
  23. extends: GameBase,
  24. editor: {
  25. menu: 'Game/Roman/GameSence'
  26. },
  27. properties: {
  28. // rollNode: cc.Node,
  29. // playerScore: cc.Label,
  30. // recordPanel: cc.Node,
  31. // recordContent: cc.Node,
  32. // recordClone: cc.Node,
  33. // backPanel: cc.Node,
  34. // setPanel: cc.Node,
  35. // resultNode: cc.Node,
  36. // guideNode: cc.Node,
  37. freeLeftNode: cc.Node,
  38. winSpineData: [sp.SkeletonData],
  39. jackpotLabel: cc.Label,
  40. lineNode: cc.Node,
  41. spBg: cc.Node,
  42. spRollBg: cc.Node,
  43. sunGameNode: cc.Node,
  44. sun2GameNode: cc.Node,
  45. sunNode: cc.Node,
  46. winScore: cc.Label,
  47. scoreAni: sp.Skeleton,
  48. sunBtnMask: cc.Node,
  49. playbackNode: cc.Node, //回放按钮
  50. audioArr: [cc.AudioClip],
  51. freeWinAudio: cc.AudioClip,
  52. // _gameEnd: true,
  53. // _bQuickGame: false,
  54. // _bAutoGame: false,
  55. // _bFreeGame: false,
  56. // _nAutoCount: 0,
  57. // _nFreeCount: 0,
  58. // _nFreeTotal: 0,
  59. // _bFreeState: 0,
  60. // _nFreeWin: 0,
  61. // _currentScore: 0,
  62. // _lastScore: 0,
  63. // _nowBet: 0,
  64. // _playingAudioID: -1,
  65. // _bFirstIn: true,
  66. jackpotNode: cc.Node,
  67. jackpotNums: [cc.Node],
  68. rightJackpotNode: cc.Node,
  69. rightJackpotPlayer1: cc.Node,
  70. rightJackpotPlayer2: cc.Node,
  71. rightJackpotPanel: cc.Node,
  72. // rightJackPotClone: cc.Node,
  73. rightJackPotShowNode: cc.Node,
  74. rightJackPotContent: cc.Node,
  75. },
  76. onLoad () {
  77. this._super();
  78. this.sunGamePanel = this.sunGameNode.getComponent("RomanSunGame");
  79. this.sun2GamePanel = this.sun2GameNode.getComponent('RomanSun2Game');
  80. this.LG_PATH_SC = "LB-Roman/";
  81. this.homeBtn.active = !cc.vv.config.ReviewApk;
  82. this.stopBackMusicTimes = 0;
  83. this.nowPlayBgm = "bgm";
  84. this.lineNode.active = true;
  85. this.spBg.active = false;
  86. this.spRollBg.active = false;
  87. // this.sunGameNode.active = false;
  88. this.sunNode.active = false;
  89. this.sunBtnMask.active = false;
  90. this.jackpotScore = -1;
  91. this.jackpotNumPositionY = [
  92. {y1:-166, y2:198},//0
  93. {y1:-130, y2:234},//1
  94. {y1:-94, y2:271},//2
  95. {y1:-58, y2:307},//3
  96. {y1:-21, y2:344},//4
  97. {y1:-350, y2:15.5},//5
  98. {y1:-313, y2:52},//6
  99. {y1:-277, y2:88.5},//7
  100. {y1:-240, y2:124},//8
  101. {y1:-204.5, y2:161},//9
  102. ];
  103. let des = [0,0,0];
  104. let k = des.length-1;
  105. for(let i = 8; i >= 0; --i,--k) {
  106. let ln = this.jackpotNums[i];
  107. if(ln) {
  108. if(k >= 0) {
  109. ln.active = true;
  110. // this.roll2Num(ln, des[k], 1-i*0.05);
  111. let info = this.jackpotNumPositionY[des[k]];
  112. ln.y = info.y1;
  113. }else{
  114. ln.active = false;
  115. }
  116. }
  117. }
  118. this.jackpotRecord = [];
  119. },
  120. start () {
  121. this._super();
  122. let player = this.getSelfPlayer();
  123. if(player)
  124. this._lastScore = player.getUserScore();
  125. this.upPlayerScore(this._lastScore);
  126. this.allWinScore = 0;
  127. // this.curBetIndex = 0;
  128. // this._playingAudioID = -1;
  129. // this.upBetAddOrDelState();
  130. // this.addNormalButtonListener();
  131. // this.initStartTouchEvent();
  132. this.nowShowIdx = 0;
  133. this.delayNextTime = ShowNextJackpotTime;
  134. this.jackpotRecord = [];
  135. this.gameConfig = {}
  136. this.roomData = cc.vv.serverListData.getCurRoomData(); //当前房间信息.
  137. this.getJackpotRecord();
  138. this.addMsgListener();
  139. this.makeDataToGameConfig();
  140. this.bTriggerJackpot = false;
  141. this.onRefreshJackpot();
  142. this.setPlayback();
  143. },
  144. addMsgListener(){
  145. cc.vv.netSocket.registerEvent(ProtocolLoginServer.CMD_C2S_Game_RollRoman,this.onRollEndInfo,this);
  146. EventMgr.getInstance().registerEvent('rewardInfo', this.onRefreshJackpot, this);
  147. EventMgr.getInstance().registerEvent('offLineStatus', this.onOffLine, this);
  148. },
  149. removeMsgListener(){
  150. cc.vv.netSocket.removeEvent(ProtocolLoginServer.CMD_C2S_Game_RollRoman,this.onRollEndInfo,this);
  151. EventMgr.getInstance().removeEvent('rewardInfo', this.onRefreshJackpot, this);
  152. EventMgr.getInstance().removeEvent('offLineStatus', this.onOffLine, this);
  153. },
  154. onOffLine(data){
  155. if(data.status == 1){ //1重连成功
  156. let delayTimes = 0;
  157. delayTimes = this._gameEnd ? 0 : 3;
  158. this.scheduleOnce(()=>{
  159. this._lastScore = cc.vv.globalUserInfo.getUserScore();
  160. this.upPlayerScore(this._lastScore);
  161. this.rollPanel.forceStop();
  162. this.node.stopAllActions();
  163. this.resetGameView();
  164. this.resetAllBtn();
  165. this.changeGameState(0);
  166. this.onCancelAutoRoll();
  167. this._gameEnd = true;
  168. this._bAutoGame = false;
  169. }, delayTimes);
  170. }
  171. },
  172. //重写
  173. addNormalButtonListener() {
  174. UIHelper.addButtonListener(this.stopBtn, this.node, "LBGameBase", "onClickStop");
  175. UIHelper.addButtonListener(this.skipBtn, this.node, "LBGameBase", "onClickSkip");
  176. UIHelper.addButtonListener(this.quickBtn, this.node, "LBGameBase", "onClickQuick");
  177. UIHelper.addButtonListener(this.addBtn, this.node, "LBGameBase", "onClickAdd");
  178. UIHelper.addButtonListener(this.delBtn, this.node, "LBGameBase", "onClickDel");
  179. UIHelper.addButtonListener(this.maxBtn, this.node, "LBGameBase", "onClickMax");
  180. UIHelper.addButtonListener(this.stopAutoBtn, this.node, "LBGameBase", "onClickStopAuto");
  181. UIHelper.addButtonListener(this.homeBtn, this.node, "LBGameBase", "onClickMenu");
  182. // UIHelper.addButtonListener(this.ruleBtn, this.node, "LBGameBase", "onClickRule");
  183. // UIHelper.addButtonListener(this.recordBtn, this.node, "LBGameBase", "onClickRecord");
  184. // UIHelper.addButtonListener(this.setBtn, this.node, "LBGameBase", "onClickSet");
  185. // UIHelper.addButtonListener(this.goldBtn, this.node, "LBGameBase", "onClickGoldBuy");
  186. for(let i = 1; i < 6; ++i) {
  187. let btn = this.autoSelectNode.getChildByName("auto"+i);
  188. if(btn) {
  189. UIHelper.addButtonListener(btn, this.node, "LBGameBase", "onClickAuto", i-1);
  190. }
  191. }
  192. },
  193. addSetBtnListener() {
  194. },
  195. getRandomValue(i) {
  196. if(i == 0) {
  197. return this.rollPanel.getRandomValue();
  198. }
  199. let ddd = Math.floor(Math.random()*100);
  200. if(ddd > 90) {
  201. return 11;
  202. }
  203. return ddd % 8;
  204. },
  205. setPlayback(){
  206. this.bTestPlayback = cc.vv.testPlayback; //是否是回放
  207. this.homeBtn.active = !this.bTestPlayback;
  208. this.playbackNode.active = this.bTestPlayback;
  209. },
  210. onClickConnect() {
  211. GameManagerBase.Instance().StartGameReconnect();
  212. },
  213. onClickTest() {
  214. // this.curBetIndex = -1;
  215. // this.refrushBet();
  216. return;
  217. // this.SendGameSocketData(GameProtocol.SUB_C_LOTTERY_TEST, {});
  218. this.testMode = true;
  219. this.testResult = [
  220. // {"m_chair_id":0,"m_chip_size":50,"m_desk_data":[[3,10,13,11,12],[12,9,1,12,0],[1,11,1,11,2]],"m_is_berserk":0,"m_berserk_data1":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_berserk_data2":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_line_count":3,"m_line_id":[2,6,38,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_size":[4,4,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_icon":[1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_times":[10,10,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_kongming":1,"m_ruyi":0,"m_lottery_size":25,"m_deposit_lotttery":0,"lCurScore":15540618,"cbFreeTime":5,"cbFreeAdd":5},
  221. // {"m_chair_id":0,"m_chip_size":0,"m_desk_data":[[0,5,11,11,10],[5,8,3,5,0],[0,12,11,0,2]],"m_is_berserk":0,"m_berserk_data1":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_berserk_data2":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_line_count":4,"m_line_id":[8,15,33,43,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_size":[4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_icon":[5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_times":[30,30,30,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_kongming":0,"m_ruyi":0,"m_lottery_size":120,"m_deposit_lotttery":0,"lCurScore":15540726,"cbFreeTime":4,"cbFreeAdd":0},
  222. // {"m_chair_id":0,"m_chip_size":0,"m_desk_data":[[1,5,5,2,0],[1,8,11,6,8],[7,11,11,0,11]],"m_is_berserk":0,"m_berserk_data1":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_berserk_data2":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_line_count":9,"m_line_id":[2,6,12,16,17,26,27,38,44,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_size":[3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_icon":[7,7,1,1,1,1,1,7,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_times":[15,15,5,5,5,5,5,15,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_kongming":0,"m_ruyi":0,"m_lottery_size":75,"m_deposit_lotttery":0,"lCurScore":15540794,"cbFreeTime":3,"cbFreeAdd":0},
  223. // {"m_chair_id":0,"m_chip_size":0,"m_desk_data":[[1,11,0,2,9],[6,11,10,0,4],[5,12,11,2,0]],"m_is_berserk":0,"m_berserk_data1":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_berserk_data2":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_line_count":13,"m_line_id":[3,8,10,19,22,24,30,32,33,36,42,46,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_size":[3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_icon":[1,6,5,1,6,5,1,5,6,1,1,6,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_times":[5,15,15,5,15,15,5,15,15,5,5,15,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_kongming":0,"m_ruyi":0,"m_lottery_size":135,"m_deposit_lotttery":0,"lCurScore":15540812,"cbFreeTime":2,"cbFreeAdd":0},
  224. // // {"m_chair_id":0,"m_chip_size":0,"m_desk_data":[[10,10,10,10,10],[6,12,5,2,10],[1,11,7,12,1]],"m_is_berserk":1,"m_berserk_data1":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_berserk_data2":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_line_count":0,"m_line_id":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_icon":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_times":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_kongming":0,"m_ruyi":0,"m_lottery_size":2000,"m_deposit_lotttery":0,"lCurScore":15540812,"cbFreeTime":2,"cbFreeAdd":0},
  225. // {"m_chair_id":0,"m_chip_size":0,"m_desk_data":[[2,11,1,2,13],[13,13,13,11,4],[8,3,8,4,0]],"m_is_berserk":0,"m_berserk_data1":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_berserk_data2":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_line_count":1,"m_line_id":[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_size":[3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_icon":[13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_times":[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_kongming":0,"m_ruyi":1,"m_lottery_size":0,"m_deposit_lotttery":250,"lCurScore":15540812,"cbFreeTime":1,"cbFreeAdd":0},
  226. // {"m_chair_id":0,"m_chip_size":0,"m_desk_data":[[3,11,11,1,4],[12,11,1,10,1],[10,12,11,1,6]],"m_is_berserk":0,"m_berserk_data1":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_berserk_data2":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_line_count":9,"m_line_id":[0,3,9,19,30,31,36,42,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_size":[3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_icon":[3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_times":[10,10,10,10,10,10,10,10,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_kongming":0,"m_ruyi":0,"m_lottery_size":90,"m_deposit_lotttery":0,"lCurScore":15540893,"cbFreeTime":0,"cbFreeAdd":0},
  227. {"m_chair_id":0,"m_chip_size":50,"m_desk_data":[[12,0,6,3,1],[1,5,11,12,12],[5,2,0,0,3]],"m_is_berserk":0,"m_berserk_data1":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_berserk_data2":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_line_count":2,"m_line_id":[14,40,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_size":[3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_icon":[5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_times":[15,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_kongming":1,"m_ruyi":0,"m_lottery_size":30,"m_deposit_lotttery":0,"lCurScore":7885,"cbFreeTime":5,"cbFreeAdd":5},
  228. {"m_chair_id":0,"m_chip_size":0,"m_desk_data":[[3,11,9,11,2],[7,11,13,5,3],[13,8,7,2,4]],"m_is_berserk":0,"m_berserk_data1":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_berserk_data2":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_line_count":4,"m_line_id":[8,22,33,46,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_size":[4,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_icon":[7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_times":[30,15,15,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_kongming":0,"m_ruyi":0,"m_lottery_size":75,"m_deposit_lotttery":0,"lCurScore":7953,"cbFreeTime":4,"cbFreeAdd":0},
  229. {"m_chair_id":0,"m_chip_size":0,"m_desk_data":[[6,1,10,0,10],[3,13,11,1,2],[6,7,0,10,4]],"m_is_berserk":0,"m_berserk_data1":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_berserk_data2":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_line_count":0,"m_line_id":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_icon":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_times":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_kongming":0,"m_ruyi":0,"m_lottery_size":0,"m_deposit_lotttery":0,"lCurScore":7953,"cbFreeTime":3,"cbFreeAdd":0}
  230. ,{"m_chair_id":0,"m_chip_size":0,"m_desk_data":[[0,5,11,4,6],[0,11,1,2,4],[0,11,2,11,2]],"m_is_berserk":0,"m_berserk_data1":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_berserk_data2":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_line_count":13,"m_line_id":[4,7,9,20,21,23,29,31,34,35,41,45,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_size":[3,4,3,4,3,4,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_icon":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_times":[5,10,5,10,5,10,5,5,5,5,5,5,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_kongming":0,"m_ruyi":0,"m_lottery_size":80,"m_deposit_lotttery":0,"lCurScore":8025,"cbFreeTime":2,"cbFreeAdd":0}
  231. ,
  232. {"m_chair_id":0,"m_chip_size":0,"m_desk_data":[[6,11,13,0,10],[1,11,11,1,2],[3,0,7,2,4]],"m_is_berserk":0,"m_berserk_data1":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_berserk_data2":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_line_count":11,"m_line_id":[1,5,11,13,14,25,28,37,39,40,49,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_size":[4,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_icon":[1,6,1,6,3,3,3,6,6,3,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_times":[10,15,5,15,10,10,10,15,15,10,15,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_kongming":0,"m_ruyi":0,"m_lottery_size":130,"m_deposit_lotttery":0,"lCurScore":8142,"cbFreeTime":1,"cbFreeAdd":0}
  233. ,{"m_chair_id":0,"m_chip_size":0,"m_desk_data":[[0,8,13,9,10],[10,11,11,0,12],[1,0,2,10,4]],"m_is_berserk":0,"m_berserk_data1":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_berserk_data2":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_line_count":7,"m_line_id":[13,14,26,27,39,40,49,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_size":[4,3,3,3,3,3,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_icon":[0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_line_times":[10,5,5,5,5,5,10,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"m_kongming":0,"m_ruyi":0,"m_lottery_size":45,"m_deposit_lotttery":0,"lCurScore":8183,"cbFreeTime":0,"cbFreeAdd":0}
  234. ]
  235. this._sunGameInfo = {"cbSunData":[[[10,10,10,10,10],[10,6,11,11,10],[2,1,1,11,0]],[[10,10,10,10,10],[10,11,11,1,10],[7,2,0,11,1]],[[10,10,10,10,10],[10,13,0,0,10],[10,11,11,2,6]],[[10,10,10,10,10],[10,7,3,1,10],[10,7,11,2,9]],[[10,10,10,10,10],[10,11,10,9,10],[10,11,11,7,3]],[[10,10,10,10,10],[10,7,10,11,10],[10,11,11,6,8]],[[10,10,10,10,10],[10,1,10,12,10],[10,7,13,2,3]],[[10,10,10,10,10],[10,9,10,1,10],[10,10,8,10,9]],[[10,10,10,10,10],[10,4,10,0,10],[10,10,11,10,2]],[[10,10,10,10,10],[10,12,10,12,10],[10,10,11,10,10]],[[10,10,10,10,10],[10,11,10,11,10],[10,10,7,10,10]],[[10,10,10,10,10],[10,11,10,2,10],[10,10,11,10,10]],[[10,10,10,10,10],[10,11,10,1,10],[10,10,11,10,10]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]]],"wSunIconMulti":[[100,200,100,500,100],[50,0,100,0,200],[200,200,0,50,200]],"cbSunIconCount":12,"cbSunDataCount":13,"cbLeftCount":[3,3,2,3,2,3,2,1,3,2,3,2,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"nTotaltimes":2000};
  236. this.testIdx = 0;
  237. },
  238. onEventSceneMessage(gameStatus,lookonUser,data) {
  239. Global.print("GameSence onEventSceneMessage 场景消息 ");
  240. var arr = new DataView(data.slice(0, 8));
  241. var dataView = new DataView(data.slice(8));
  242. var msgHead = { m: arr.getUint16(4, true), s: arr.getUint16(6, true), d: null };
  243. arr = null;
  244. this.gameConfig = AnalyzeXieYi.analyze_GameConfig(dataView);
  245. Global.print(this.gameConfig);
  246. this.updateJackpot(this.gameConfig);
  247. this.curBetIndex = 0;
  248. this.bets = this.gameConfig.nJetton;
  249. this.refrushBet();
  250. this.rollPanel.resetView();
  251. },
  252. onRefreshJackpot(data){
  253. if(!this.roomData) return;
  254. let jackpotID = this.roomData.JackpotID;
  255. let aimId = jackpotID[0][0];
  256. let num = cc.vv.serverListData.getRewardInfoDataById(aimId).Num;
  257. this.gameConfig.lJackPot = num;
  258. this.updateJackpot(this.gameConfig);
  259. let history = cc.vv.serverListData.getRewardInfoDataById(this.roomData.ServerID).History;
  260. this.jackpotRecord = history;
  261. if(this.jackpotRecord.length == 0) return; //没有记录就不展示
  262. if(!this.bTriggerJackpot){ //第一次赋值
  263. this.bTriggerJackpot = true;
  264. this.rightJackpotNode.active = true;
  265. let info = this.jackpotRecord[this.nowShowIdx];
  266. this.setItemInfos(this.rightJackpotPlayer1, info);
  267. this.rightJackpotPlayer1.y = 0;
  268. this.rightJackpotPlayer2.y = -60;
  269. this.delayNextTime = ShowNextJackpotTime;
  270. }
  271. },
  272. //构造数据
  273. makeDataToGameConfig(){
  274. if(!this.roomData) return;
  275. this.gameConfig.nJetton = this.roomData.Bet;
  276. // this.gameConfig.lJackPot = 1020;
  277. this.bets = this.gameConfig.nJetton;
  278. this.refrushBet();
  279. // this.updateJackpot(this.gameConfig);
  280. //this.rollPanel.forceStop();
  281. },
  282. onEventGameMessage(data) {
  283. var arr = new DataView(data.slice(0, 8));
  284. var dataView = new DataView(data.slice(8));
  285. var msgHead = { m: arr.getUint16(4, true), s: arr.getUint16(6, true), d: null };
  286. arr = null;
  287. // Global.print(msgHead)
  288. var msg = AnalyzeXieYi.analyzeData(msgHead.m, msgHead.s, dataView);
  289. switch (msgHead.s) {
  290. case GameProtocol.SUB_S_REBACK_LOTTERY: { // 操作记录
  291. Global.print("SGLB::结果");
  292. this.onRollEndInfo(msg);
  293. }
  294. break;
  295. case GameProtocol.SUB_S_JACKPOT_RESET: { // 操作记录
  296. Global.print("JACKPOT");
  297. this.updateJackpot(msg);
  298. }
  299. break;
  300. case GameProtocol.SUB_S_SEND_CONTROL_INFO: {
  301. Global.print("SUB_S_SEND_CONTROL_INFO");
  302. this.onSubSendControlInfo(msg);
  303. }
  304. break;
  305. case GameProtocol.SUB_S_SUNGAME_INFO: {
  306. Global.print("SUB_S_SUNGAME_INFO");
  307. Global.print(JSON.stringify(msg));
  308. this._sunGameInfo = msg;
  309. }
  310. break;
  311. default: {
  312. Global.print("SGLBGameSence onEventGameMessage error ");
  313. }
  314. break;
  315. }
  316. },
  317. getNeedShowValue(val) {
  318. let str = ''+val;
  319. if(val < 100) {
  320. if(val < 10) {
  321. str = '00'+val;
  322. }else{
  323. str = '0'+val;
  324. }
  325. }
  326. return str;
  327. },
  328. updateJackpot(data) {
  329. Global.print("JACKPOT:"+JSON.stringify(data));
  330. //初始 或者 被人爆了jackpot
  331. if((this.jackpotScore == -1) || (this.jackpotScore > data.lJackPot)) {
  332. let des = this.getNeedShowValue(data.lJackPot).split('');
  333. let k = des.length-1;
  334. for(let i = 8; i >= 0; --i,--k) {
  335. let ln = this.jackpotNums[i];
  336. if(ln) {
  337. if(k >= 0) {
  338. ln.active = true;
  339. // this.roll2Num(ln, des[k], 1-i*0.05);
  340. let info = this.jackpotNumPositionY[des[k]];
  341. ln.y = info.y1;
  342. }else{
  343. ln.active = false;
  344. }
  345. }
  346. }
  347. }else{ //播放动画
  348. let des = this.getNeedShowValue(data.lJackPot).split('');
  349. let k = des.length-1;
  350. for(let i = 8; i >= 0; --i,--k) {
  351. let ln = this.jackpotNums[i];
  352. if(ln) {
  353. if(k >= 0) {
  354. ln.active = true;
  355. this.roll2Num(ln, des[k], 1-i*0.1);
  356. }else{
  357. ln.active = false;
  358. }
  359. }
  360. }
  361. }
  362. this.jackpotScore = data.lJackPot;
  363. },
  364. roll2Num(node, num, times) {
  365. let y = node.y;
  366. let dYs = this.jackpotNumPositionY[num];
  367. let dy = dYs.y1;
  368. if(y > dy) {
  369. dy = dYs.y2;
  370. }
  371. node.stopAllActions();
  372. cc.tween(node)
  373. .to(times, {y: dy})
  374. .call(()=>{
  375. node.y = dYs.y1;
  376. })
  377. .start()
  378. },
  379. showDebugRewardInfo() {
  380. let count = this.gameEndData.m_line_count;
  381. let lineid = this.gameEndData.m_line_id;
  382. let str = "中奖信息:" + count + "条线[";
  383. for(let i = 0; i < count; ++i) {
  384. str += (lineid[i]+1) + ',';
  385. }
  386. str += ']';
  387. str += this.gameEndData.m_kongming == 1 ? "\n中免费次数" : "";
  388. str += '\n 总输赢:'+Global.formatString2Score(this.gameEndData.m_lottery_size);
  389. const infoNode = cc.find("ControlInfo/info", this.node);
  390. infoNode.getChildByName("reward").getComponent(cc.RichText).string = str;
  391. },
  392. onEventGameRecord(data) {
  393. let dd = AnalyzeXieYi.analyze_Record(data);
  394. this._gameRecords.push(dd);
  395. this.addOneRecord(dd);
  396. // if(this._gameRecords.length >= 60) {
  397. // this.showRecordsPanel();
  398. // }
  399. },
  400. onEventJackpotRecord(data) {
  401. let dd = AnalyzeXieYi.analyze_JackpotRecord(data);
  402. this.jackpotRecord.push(dd);
  403. Global.print(dd);
  404. if(this.jackpotRecord.length == 1) {
  405. this.showWithNowIdx();
  406. }
  407. },
  408. onSocketHorseMessage(data) {
  409. this._super(data);
  410. this.rightJackpotPanel.active = false;
  411. this.jackpotRecord.splice(0);
  412. this.nowShowIdx = 0;
  413. this.getJackpotRecord();
  414. },
  415. showWithNowIdx() {
  416. if(this.jackpotRecord.length <= 0) {
  417. return;
  418. }
  419. if(this.nowShowIdx >= this.jackpotRecord.length) {
  420. this.nowShowIdx = 0;
  421. }
  422. this.rightJackpotNode.active = true;
  423. let info = this.jackpotRecord[this.nowShowIdx];
  424. this.setItemInfos(this.rightJackpotPlayer1, info);
  425. this.rightJackpotPlayer1.y = 0;
  426. this.rightJackpotPlayer2.y = -60;
  427. this.delayNextTime = ShowNextJackpotTime;
  428. },
  429. jumpNextJackpot() {
  430. //小于两条 不滚动
  431. if(this.jackpotRecord.length < 2) {
  432. return;
  433. }
  434. this.nowShowIdx++;
  435. if(this.nowShowIdx >= this.jackpotRecord.length) {
  436. this.nowShowIdx = 0;
  437. }
  438. let info = this.jackpotRecord[this.nowShowIdx];
  439. let node1 = null;
  440. let node2 = null;
  441. if(this.rightJackpotPlayer1.y > this.rightJackpotPlayer2.y) {
  442. node1 = this.rightJackpotPlayer1;
  443. node2 = this.rightJackpotPlayer2;
  444. }else{
  445. node1 = this.rightJackpotPlayer2;
  446. node2 = this.rightJackpotPlayer1;
  447. }
  448. this.setItemInfos(node2, info);
  449. node1.stopAllActions();
  450. node2.stopAllActions();
  451. cc.tween(node1)
  452. .to(1, {y: 60})
  453. .call(()=>{
  454. node1.y = -60;
  455. })
  456. .start()
  457. cc.tween(node2)
  458. .to(1, {y: 0})
  459. .start()
  460. this.delayNextTime = ShowNextJackpotTime;
  461. },
  462. setItemInfos(node, info) {
  463. if(!node || !info) {
  464. return;
  465. }
  466. node.active = true;
  467. /*
  468. node.getChildByName("head").getChildByName("spr").getComponent(cc.Sprite).spriteFrame = cc.vv.globalUserInfo.getHeadSpriteFrameByFaceID(info.cbFaceID);
  469. node.getChildByName("name").getComponent(cc.Label).string = info.szNickName;
  470. node.getChildByName("score").getComponent(cc.Label).string = '$'+Global.formatString2Score(info.lLotteryMoney);
  471. */
  472. node.getChildByName("head").getChildByName("spr").getComponent(cc.Sprite).spriteFrame = cc.vv.globalUserInfo.getHeadSpriteFrameByFaceID(info.FaceID);
  473. node.getChildByName("name").getComponent(cc.Label).string = info.NickName;
  474. node.getChildByName("score").getComponent(cc.Label).string = 'R$:'+Global.formatString2Score(info.Value);
  475. },
  476. onClickShowJackpotUser() {
  477. this.rightJackpotPanel.active = true;
  478. this.rightJackpotPanel.getChildByName("mark").active = true;
  479. for(let i = 0; i < 10; ++i) {
  480. let item = null;
  481. if(i >= this.rightJackPotContent.childrenCount) {
  482. item = cc.instantiate(this.rightJackPotContent.children[0]);
  483. item.parent = this.rightJackPotContent;
  484. }else{
  485. item = this.rightJackPotContent.children[i];
  486. }
  487. if(item) {
  488. let info = this.jackpotRecord[i];
  489. if(info) {
  490. this.setItemInfos(item, info);
  491. }else{
  492. item.active = false;
  493. }
  494. }
  495. }
  496. this.rightJackPotShowNode.stopAllActions();
  497. this.rightJackPotShowNode.scaleY = 0;
  498. cc.tween(this.rightJackPotShowNode)
  499. .to(0.07, {scaleY:1})
  500. .start()
  501. },
  502. onClickHideJackpotUser() {
  503. this.rightJackpotPanel.getChildByName("mark").active = false;
  504. this.rightJackPotShowNode.stopAllActions();
  505. this.rightJackPotShowNode.scaleY = 1;
  506. cc.tween(this.rightJackPotShowNode)
  507. .to(0.07, {scaleY:0})
  508. .call(()=>{
  509. this.rightJackpotPanel.active = false;
  510. })
  511. .start()
  512. },
  513. backHome: function() {
  514. if (CServerItem.get()) {
  515. CServerItem.get().PerformStandUpAction(1);
  516. } else {
  517. this.exitGame();
  518. }
  519. this._backHome = true;
  520. ScenceManager.Instance().gameBackScence();
  521. GameManagerBase.Instance().setInGameServerID(-1);
  522. },
  523. onClickHome() {
  524. if(!this._gameEnd || this._nFreeCount > 0) {
  525. this.showBackTips();
  526. return;
  527. }
  528. this.backHome();
  529. this.exitGame();
  530. },
  531. exitGameWhenPlaying() {
  532. if(!this._gameEnd || this._nFreeCount > 0) {
  533. topTipMsg.showTopTipMsg(LanguageKey.t("pubWords.not_exit_game"));
  534. return;
  535. }
  536. if(cc.vv.config.ReviewApk) {
  537. cc.game.end();
  538. return;
  539. }
  540. /*
  541. // this.backHome();
  542. // this.exitGame();
  543. */
  544. this._backHome = true;
  545. cc.sys.localStorage.setItem("InGameServerID", -1);
  546. this.removeMsgListener();
  547. ScenceManager.Instance().gameBackScence();
  548. },
  549. onClickGoldBuy() {
  550. if(cc.vv.config.ReviewApk) return;
  551. this.onClickHome();
  552. // let FirstPay10State = cc.vv.GetHallScript().GetFirstPay10State();
  553. // let FirstPayState = cc.vv.GetHallScript().GetFirstPayState();
  554. // if(FirstPay10State){
  555. // cc.vv.GetHallScript().onClickFirstPay_10(null,true);
  556. // }else if(FirstPayState){
  557. // cc.vv.GetHallScript().onClickFirstPay(null,true);
  558. // }else{
  559. // cc.vv.GetHallScript().showBuyGold();
  560. // }
  561. // this.hideGuideNode();
  562. },
  563. showBackTips() {
  564. this.backPanel.active = true;
  565. },
  566. hideBackTips() {
  567. this.playEffect("button");
  568. this.backPanel.active = false;
  569. },
  570. getSingleLineBet() {
  571. return this.gameConfig.nJetton[this.curBetIndex]/this.MAX_LINE;
  572. },
  573. onStartSun2Game(){
  574. this.playEffect("sunpanelclose");
  575. this.sunNode.active = false;
  576. this.sun2GamePanel.rolls();
  577. },
  578. onStartSunGame() {
  579. if(!this._sunGameInfo) return;
  580. if(!this.isSunGame) return;
  581. this.sunNode.active = false;
  582. this.sunGamePanel.rolls();
  583. this.playEffect("sunpanelclose");
  584. // this.playEffect("sunstart");
  585. },
  586. sunGameEnd() {
  587. this._gameEnd = true;
  588. this.lineNode.active = true;
  589. this.spBg.active = true;
  590. this.spBg.opacity = 255;
  591. cc.tween(this.spBg)
  592. .delay(0.5)
  593. .to(0.5, {opacity: 0})
  594. .start()
  595. this.spRollBg.active = true;
  596. this.spRollBg.opacity = 255;
  597. cc.tween(this.spRollBg)
  598. .delay(0.5)
  599. .to(0.5, {opacity: 0})
  600. .start()
  601. cc.vv.audioMgr.pauseBackMusic();
  602. this.sunGameNode.active = false;
  603. this.sun2GameNode.active = false;
  604. this.rollNode.active = true;
  605. this.sunNode.active = false;
  606. this.sunBtnMask.active = false;
  607. let timers = Math.floor(this.gameEndData.m_lottery_size * this.MAX_LINE / this.gameConfig.nJetton[this.curBetIndex]);
  608. this._currentScore = this._lastScore;
  609. this.upPlayerScore(this._currentScore);
  610. this.playSoundByTimes(timers);
  611. if(this.winAniIdx == -1) //加个保护 防止子游戏恭喜获得没有界面
  612. this.winAniIdx = 0;
  613. this.showResultPanel();
  614. if(this._bSpecialGame) {
  615. this.changeFreeBtns(true);
  616. }
  617. this.winScore.string = Global.formatString2Score(this.allWinScore);
  618. },
  619. doCoinAni() {
  620. this.scoreAni.node.active = true;
  621. this.scoreAni.setAnimation(0, "a2", false);
  622. },
  623. addCoinGet(value) {
  624. this.playEffect("sungetcoin");
  625. Global.print("add:"+value);
  626. this._nSunWin += value;
  627. this.winScore.string = Global.formatString2Score(this._nSunWin);
  628. },
  629. showSun2Game(){
  630. if(this._bSpecialGame) {
  631. this.changeFreeBtns(false);
  632. }
  633. this.lineNode.active = false;
  634. this.sunBtnMask.active = true;
  635. this.spBg.active = true;
  636. this.spBg.opacity = 0;
  637. cc.tween(this.spBg)
  638. .delay(0.5)
  639. .to(0.5, {opacity: 255})
  640. .start();
  641. cc.vv.audioMgr.playBGM("sunbgm");
  642. this.playEffect("sunpanelopen");
  643. this.winScore.string = '0';
  644. this.rollNode.active = false;
  645. this.sunNode.active = true;
  646. this.sun2GameNode.active = true;
  647. this.sun2GamePanel.showSubgame(this.gameEndData.m_desk_data, this.gameEndData.m_desk_value, this.gameEndData.SG_result_data);
  648. this.scheduleOnce(()=>{
  649. this.onStartSun2Game();
  650. }, 1);
  651. },
  652. onSunGameInfo() {
  653. let data = this._sunGameInfo;
  654. Global.print(data);
  655. if(this._bSpecialGame) {
  656. this.changeFreeBtns(false);
  657. }
  658. this.lineNode.active = false;
  659. this.sunBtnMask.active = true;
  660. this.spBg.active = true;
  661. this.spBg.opacity = 0;
  662. cc.tween(this.spBg)
  663. .delay(0.5)
  664. .to(0.5, {opacity: 255})
  665. .start()
  666. this.spRollBg.active = true;
  667. this.spRollBg.opacity = 0;
  668. cc.tween(this.spRollBg)
  669. .delay(0.5)
  670. .to(0.5, {opacity: 255})
  671. .start()
  672. this.sunGamePanel.init(data, this.gameEndData.m_desk_data, this.gameConfig.nJetton[this.curBetIndex]/this.MAX_LINE);
  673. this.sunGameNode.active = true;
  674. cc.vv.audioMgr.playBGM("sunbgm");
  675. this.playEffect("sunpanelopen");
  676. this.winScore.string = '0';
  677. this.rollNode.active = false;
  678. this.sunNode.active = true;
  679. },
  680. onRollEndInfo(data) {
  681. Global.print(data);
  682. //数据改造
  683. //m_desk_data服务器从1开始,客户端需要从0开始
  684. for(let i=0; i < data.m_desk_data.length; i++){
  685. for(let j=0; j < data.m_desk_data[i].length; j++){
  686. if(data.m_desk_data[i][j] >= 1){
  687. data.m_desk_data[i][j] -= 1;
  688. }
  689. }
  690. }
  691. //m_line_icon服务器从1开始, 客户端需要从0开始
  692. for(let i=0; i < data.m_line_icon.length; i++){
  693. if(data.m_line_icon[i] >= 1){
  694. data.m_line_icon[i] -= 1;
  695. }
  696. }
  697. //m_line_id服务器从1开始, 客户端需要从0开始
  698. for(let i=0; i < data.m_line_id.length; i++){
  699. if(data.m_line_id[i] >=1){
  700. data.m_line_id[i] -= 1;
  701. }
  702. }
  703. //子游戏的m_desk_data服务器从1开始, 客户端需要从0开始
  704. for(let i=0; i < data.SG_result_data.length; i++){
  705. for(let j=0; j < data.SG_result_data[i].m_desk_data.length; j++){
  706. for(let k=0; k < data.SG_result_data[i].m_desk_data[j].length; k++){
  707. if(data.SG_result_data[i].m_desk_data[j][k] >= 1){
  708. data.SG_result_data[i].m_desk_data[j][k] -= 1;
  709. }
  710. }
  711. }
  712. }
  713. // this.onSocketHorseMessage({szMessage:"3010##1##gg##100"});
  714. // if(!this._bQuickGame)
  715. // this.changeBtnState(true);
  716. this.gameEndData = data;
  717. if(this._nFreeCount > 0) {
  718. this.upFreeCount();
  719. }else{
  720. this._nFreeTotal = 0;
  721. this.allWinScore = 0;
  722. }
  723. let endSp = data.cbFreeTime > 0;
  724. this._bFreeEnd = false;
  725. if(this._bSpecialGame || endSp) {
  726. this._bSpecialGame = endSp;
  727. this._nFreeWin += data.m_lottery_size+data.m_deposit_lotttery; //彩金和赢得
  728. this._bFreeEnd = data.cbFreeTime == 0;
  729. }
  730. this._nFreeCount = data.cbFreeTime;
  731. this._nFreeTotal += data.cbFreeAdd;
  732. this._bFreeState = data.m_kongming;
  733. this._winTimes = Math.floor(data.m_lottery_size*5000 / data.m_chip_size);
  734. data.m_is_berserk = this.gameEndData.SG_result_data.length > 0;
  735. this.isSunGame = data.m_is_berserk;
  736. if(data.m_is_berserk) { //触发小游戏
  737. this.rollPanel.setSpecialData(this._sunGameInfo);
  738. }
  739. this.rollPanel.setRollDatas(data);
  740. this.rollPanel.openPrizes(false, this._bQuickGame);
  741. //更新玩家金币
  742. cc.vv.globalUserInfo.setUserScore(data.lCurScore);
  743. this._lastScore = data.lCurScore;
  744. this.showDebugRewardInfo();
  745. },
  746. makeXieYi(m,s,data) {
  747. if(m == ProtocolGameServer.MDM_GF_FRAME) {
  748. return //new DataView(arrayBuffer)
  749. }
  750. return MakeXieYi.makeRoll(data);
  751. },
  752. onClickRecord() {
  753. this.recordContent.removeAllChildren();
  754. this._gameRecords.splice(0);
  755. this.recordPanel.active = true;
  756. this.getGameRecord();
  757. },
  758. onSendRoll() {
  759. /*
  760. // if(this.testMode && this.testIdx < this.testResult.length) {
  761. // setTimeout(()=>{
  762. // this.onRollEndInfo(this.testResult[this.testIdx++]);
  763. // }, 500);
  764. // return;
  765. // }
  766. let t = {};
  767. t.nJetton = this.gameConfig.nJetton[this.curBetIndex];
  768. // Global.print(t);
  769. this.SendGameSocketData(GameProtocol.SUB_C_LOTTERY, t);
  770. */
  771. let timer = this._bQuickGame ? 100 : 500;
  772. setTimeout(()=>{
  773. let _data = {'CMD':ProtocolLoginServer.CMD_C2S_Game_RollRoman,
  774. 'Value':this.gameConfig.nJetton[this.curBetIndex],
  775. 'RoomID':this.roomData.ServerID
  776. };
  777. cc.vv.netSocket.send(JSON.stringify(_data));
  778. }, timer);
  779. },
  780. upLeftCount() {
  781. this.freeLeftNode.active = this._bSpecialGame;
  782. if(this._bSpecialGame) {
  783. this.freeLeftNode.getChildByName("left").getComponent(cc.Label).string = this._nFreeCount + '/' + this._nFreeTotal;
  784. }else{
  785. this._super();
  786. }
  787. },
  788. upFreeCount() {
  789. let funcNode = this.node.getChildByName("FuncBtnNode");
  790. let left = funcNode.getChildByName("btn_left");
  791. left.active = this._nFreeCount > 0;
  792. left.getChildByName("left").getComponent(cc.Label).string = (this._nFreeCount-1) + '/' + this._nFreeTotal;
  793. // this.upBtnInteractable(funcNode.getChildByName("btn_auto"), false);
  794. },
  795. // judgeAuto() {
  796. // let funcNode = this.node.getChildByName("FuncBtnNode");
  797. // if(this._nAutoCount == 0) {
  798. // this._bAutoGame = false;
  799. // }else{
  800. // this._bAutoGame = true;
  801. // }
  802. // funcNode.getChildByName("btn_left").active = this._bAutoGame;
  803. // let left = funcNode.getChildByName("btn_left");
  804. // left.active = this._bAutoGame;
  805. // left.getChildByName("left").active = this._nAutoCount > 0;
  806. // left.getChildByName("left2").active = this._nAutoCount < 0;
  807. // left.getChildByName("left").getComponent(cc.Label).string = this._nAutoCount;
  808. // },
  809. onStartRoll() {
  810. if(this.bTestPlayback) return; //如果是回放, 下面的不执行.
  811. if(!this._gameEnd) return;
  812. this.node.stopAllActions();
  813. this.resetGameView();
  814. if(this.playingEffectID != -1) {
  815. cc.vv.audioMgr.stopSFX(this.playingEffectID);
  816. }
  817. // cc.vv.audioMgr.stopAllEffects();
  818. //是否可以开始游戏
  819. if(!this.judgeCannotRollGame()) {
  820. return;
  821. }
  822. this._gameEnd = false;
  823. this.changeGameState(1);
  824. if(cc.vv.audioMgr._musicFile != this.nowPlayBgm || this.stopBackMusicTimes < 0)
  825. cc.vv.audioMgr.playBGM(this.nowPlayBgm);
  826. this.upLeftCount();
  827. this.onSendRoll();
  828. this.showCenterNormal();
  829. this.onGameStart();
  830. this.rollPanel.startRollActions();
  831. // this._super();
  832. this.stopBackMusicTimes = 0;
  833. },
  834. // resetGameView() {
  835. // this._super();
  836. // this.hideFreeWin();
  837. // },
  838. showGameEnd() {
  839. // this._super();
  840. this._gameEnd = true;
  841. this.changeGameState(2);
  842. // setTimeout(()=>{
  843. // // Global.print("pauseBackMusic")
  844. // if(this._gameEnd && !this._backHome) {
  845. // // Global.print(this.node);
  846. // cc.vv.audioMgr.pauseBackMusic();
  847. // }
  848. // }, 3000);
  849. this.stopBackMusicTimes = 3;
  850. //获得免费次数
  851. if(this._bFreeState == 1) {
  852. cc.vv.audioMgr.pauseBackMusic();
  853. this.showGetFreeTimes(this.gameEndData.cbFreeAdd);
  854. }else if(this._bFreeEnd){
  855. //免费次数结束,自动游戏在其他地方判断
  856. this.freeLeftNode.active = false;
  857. this.changeGameState(0);
  858. this.resetAllBtn();
  859. if((this.winAniIdx < 0 || this._bSpecialGame) && this.gameEndData.m_ruyi <= 0){
  860. this.delayStartNextRoll(1);
  861. }
  862. }else if((this.winAniIdx < 0 || this._bSpecialGame) && this.gameEndData.m_ruyi <= 0){
  863. this.delayStartNextRoll(1);
  864. }
  865. },
  866. onClickSkip() {
  867. this.playButtonEffect();
  868. let scoreNode = this.resultNode.getChildByName("mask").getChildByName("scoreNode");
  869. this.skipScoreAdd(scoreNode.getChildByName("score").getComponent(cc.Label),scoreNode.getChildByName("score2").getComponent(cc.Label))
  870. },
  871. showResultPanel() {
  872. if(this.changeSkipBtnState <=0){
  873. console.error('没有钱, 不播放');
  874. return;
  875. }
  876. let ssNodeY = [-44,-103,-103,-150,-150];
  877. this.changeGameState(3);
  878. this.resultNode.active = true;
  879. let node = this.resultNode.getChildByName("mask");
  880. let goldNode = node.getChildByName("goldani");
  881. let ssNode = node.getChildByName("scoreNode");
  882. let sNode = ssNode.getChildByName("score");
  883. let sNode2 = ssNode.getChildByName("score2");
  884. let sLabel = sNode.getComponent(cc.Label);
  885. let sLabel2 = sNode2.getComponent(cc.Label);
  886. let aniNode1 = node.getChildByName("wani");
  887. aniNode1.active = true;
  888. goldNode.active = true;
  889. ssNode.active = false;
  890. let anii = aniNode1.getComponent(sp.Skeleton);
  891. anii.skeletonData = this.winSpineData[this.winAniIdx];
  892. if(this.winAniIdx >= 0) {
  893. //金币动画
  894. let gAni = goldNode.getComponent(sp.Skeleton);
  895. // gAni.clearTracks();
  896. // gAni.setAnimation(0, 'a'+(this.winAniIdx>3?3:this.winAniIdx), true);
  897. gAni.setAnimation(0, 'a'+(this.winAniIdx+1>5?5:this.winAniIdx+1), true);
  898. }else{
  899. goldNode.active = false;
  900. }
  901. this.isPlayingScoreAddAni = true;
  902. //win动画
  903. anii.clearTracks();
  904. anii.setAnimation(0, "a1", false);
  905. anii.addAnimation(0, "a2", true);
  906. this.resultNode.stopAllActions();
  907. cc.tween(this.resultNode)
  908. .delay(0.3)
  909. .call(()=>{
  910. if(this.winAniIdx>=0 && this.winAniIdx<ssNodeY.length)
  911. ssNode.y = ssNodeY[this.winAniIdx];
  912. ssNode.active = true;
  913. sLabel.string = '0';
  914. sLabel2.string = '.00';
  915. this.playScoreAddAni(sLabel, sLabel2);
  916. this.changeSkipBtnState(true);
  917. })
  918. .start()
  919. },
  920. skipScoreAdd(sLabel, sLabel2) {
  921. this._super(sLabel, sLabel2);
  922. this.isPlayingScoreAddAni = false;
  923. },
  924. hideResultPanel() {
  925. this.resultNode.active = false;
  926. },
  927. onClickResultMask() {
  928. if(this.isPlayingScoreAddAni) {
  929. this.onClickSkip();
  930. }else{
  931. this.hideResultPanel();
  932. }
  933. },
  934. onClickFreeWinMask() {
  935. this.changeFreeWinBtn(false);
  936. if(this.isPlayingScoreAddAni) {
  937. this.onClickSkipFreeWin();
  938. }else{
  939. this.hideFreeWin();
  940. }
  941. },
  942. showGameWinScore() {
  943. this.winAniIdx = -1;
  944. //所有赢钱
  945. this.allWinScore += this.gameEndData.m_deposit_lotttery+this.gameEndData.m_lottery_size;
  946. this.needPlayinfScore = this.gameEndData.m_lottery_size;
  947. if(this.gameEndData.m_ruyi > 0) { //彩金池
  948. this.winAniIdx = 4;
  949. this.needPlayinfScore = this.gameEndData.m_deposit_lotttery;
  950. let nnode = this.node.getChildByName("RoomInfoNode").getChildByName("img_1");
  951. nnode.getChildByName("normalNode").active = false;
  952. nnode.getChildByName("winNode").active = true;
  953. this.winScore.string = Global.formatString2Score(this.allWinScore);
  954. this.showResultPanel();
  955. this.upPlayerScore(this._lastScore);
  956. return;
  957. }
  958. let score = this.gameEndData.m_lottery_size;
  959. if(this.isSunGame) {
  960. this._nSunWin = 0;
  961. // this.winAniIdx = 4;
  962. let nnode = this.node.getChildByName("RoomInfoNode").getChildByName("img_1");
  963. if(!nnode.getChildByName("winNode").active) {
  964. nnode.getChildByName("normalNode").active = false;
  965. nnode.getChildByName("winNode").active = true;
  966. this.winScore.string = '0'//this._nFreeWin;
  967. }
  968. return;
  969. }
  970. //免费游戏中
  971. if(this._bSpecialGame) {
  972. if(this._bFreeState) {
  973. this.playEffect("freestart");
  974. }
  975. let nnode = this.node.getChildByName("RoomInfoNode").getChildByName("img_1");
  976. nnode.getChildByName("normalNode").active = false;
  977. nnode.getChildByName("winNode").active = true;
  978. this.winScore.string = Global.formatString2Score(this.allWinScore);
  979. return;
  980. }
  981. //免费游戏结束
  982. if(this.gameEndData.m_chip_size == 0) {
  983. this.nowPlayBgm = "bgm";
  984. cc.vv.audioMgr.playBGM("bgm");
  985. this.needPlayinfScore = this.allWinScore;
  986. this._currentScore = this._lastScore;
  987. this.upPlayerScore(this._currentScore);
  988. let nnode = this.node.getChildByName("RoomInfoNode").getChildByName("img_1");
  989. nnode.getChildByName("normalNode").active = false;
  990. nnode.getChildByName("winNode").active = true;
  991. this.winScore.string = Global.formatString2Score(this.allWinScore);
  992. let xxTimer = Math.floor(this.allWinScore * this.MAX_LINE / this.gameConfig.nJetton[this.curBetIndex]);
  993. this.playSoundByTimes(xxTimer);
  994. if(this.winAniIdx == -1 && this.allWinScore > 0) //保护
  995. this.winAniIdx = 0;
  996. this.showResultPanel();
  997. // this.showFreeWin();
  998. return;
  999. }
  1000. let timers = Math.floor(score * this.MAX_LINE / this.gameConfig.nJetton[this.curBetIndex]);
  1001. this._currentScore = this._lastScore;
  1002. this.upPlayerScore(this._currentScore);
  1003. if(score <= 0){
  1004. return;
  1005. }
  1006. this.playSoundByTimes(timers);
  1007. let nnode = this.node.getChildByName("RoomInfoNode").getChildByName("img_1");
  1008. nnode.getChildByName("normalNode").active = false;
  1009. nnode.getChildByName("winNode").active = true;
  1010. this.winScore.string = Global.formatString2Score(this.allWinScore);
  1011. if(this.winAniIdx >= 0) {
  1012. this.showResultPanel();
  1013. }
  1014. },
  1015. delayStartNextRoll(delayTime) {
  1016. if(!this._bSpecialGame) {
  1017. this._nFreeTotal = 0;
  1018. this.freeLeftNode.active = false;
  1019. }
  1020. this.sunGameNode.active = false;
  1021. this.rollNode.active = true;
  1022. // this._super(delayTime);
  1023. this.changeGameState(0);
  1024. this.resetAllBtn();
  1025. this.node.stopAllActions();
  1026. if(this.gameEndData.m_line_count <= 0){
  1027. delayTime = 0.1;
  1028. }
  1029. if(this._bFreeState){ //免费游戏开始
  1030. delayTime = 1;
  1031. }
  1032. if(!this._bSpecialGame && this.gameEndData.m_chip_size == 0) { //免费游戏结束
  1033. delayTime = 1.5;
  1034. }
  1035. this.scheduleOnce(()=>{
  1036. if(this.gameEndData.SG_result_data.length > 0){ //触发子游戏
  1037. this._bAutoGame = false; //停止自动游戏
  1038. this.onCancelAutoRoll();
  1039. }
  1040. if(this._bAutoGame || this._bSpecialGame){ //自动游戏时
  1041. this.onStartRoll();
  1042. }
  1043. }, delayTime);
  1044. },
  1045. showGetFreeTimes(times) {
  1046. this.nowPlayBgm = "freebgm";
  1047. let freeNode = this.node.getChildByName("freeNode");
  1048. let aniNode = freeNode.getChildByName("mask");
  1049. let ani = aniNode.getComponent(sp.Skeleton);
  1050. ani.clearTracks();
  1051. ani.setAnimation(0, "a1", false);
  1052. freeNode.active = true;
  1053. this._bSpecialGame = true;
  1054. let sstr = aniNode.getChildByName("s");
  1055. sstr.getComponent(cc.Label).string = times;
  1056. sstr.stopAllActions();
  1057. sstr.angle = 0;
  1058. sstr.active = false;
  1059. aniNode.stopAllActions();
  1060. cc.tween(aniNode)
  1061. .delay(0.4)
  1062. .call(()=>{
  1063. sstr.active = true;
  1064. })
  1065. .delay(0.2)
  1066. .call(()=>{
  1067. cc.tween(sstr)
  1068. .to(1.4, {angle: -60})
  1069. .start()
  1070. })
  1071. .delay(1.4)
  1072. .call(()=>{
  1073. freeNode.active = false;
  1074. cc.vv.audioMgr.playBGM("freebgm");
  1075. this.delayStartNextRoll(0.5);
  1076. })
  1077. .start()
  1078. // cc.tween(freeNode.getChildByName("mark"))
  1079. // .hide()
  1080. // .delay(1+5)
  1081. // .show()
  1082. // .start()
  1083. },
  1084. showFreeWin() {
  1085. if(this.gameEndData.m_kongming == 0) {
  1086. this._nFreeWin = 0;
  1087. }
  1088. // this.playEffect("freeend");
  1089. let funcNode = this.node.getChildByName("FuncBtnNode");
  1090. funcNode.getChildByName("btn_left").active = false;
  1091. this.upBtnInteractable(this.startBtn, true);
  1092. this.playingEffectID = cc.vv.audioMgr.playEffectByAudioClip(this.freeWinAudio);
  1093. let winNode = this.node.getChildByName("freeWin");
  1094. winNode.active = true;
  1095. let node = winNode.getChildByName("mask");
  1096. let startBtn = node.getChildByName("btn_start");
  1097. startBtn.active = false;
  1098. let scoreNode = node.getChildByName("score1");
  1099. scoreNode.stopAllActions();
  1100. scoreNode.scale = 1;
  1101. scoreNode.active = false;
  1102. let ani = node.getComponent(sp.Skeleton);
  1103. ani.clearTracks();
  1104. ani.setAnimation(0, "b1", false);
  1105. ani.setCompleteListener(()=>{
  1106. ani.setCompleteListener(()=>{})
  1107. ani.setAnimation(0, "b2", true);
  1108. scoreNode.active = true;
  1109. this.changeFreeWinBtn(true);
  1110. this.isPlayingScoreAddAni = true;
  1111. this.playFreeWinAddAni(scoreNode.getComponent(cc.Label));
  1112. })
  1113. },
  1114. hideFreeWin() {
  1115. this.nowPlayBgm = "bgm";
  1116. this.playButtonEffect();
  1117. let winNode = this.node.getChildByName("freeWin");
  1118. winNode.getChildByName("mask").getChildByName("btn_start").active = false;
  1119. winNode.stopAllActions();
  1120. if(!winNode.active){
  1121. this.onStartRoll();
  1122. return;
  1123. }
  1124. let node = winNode.getChildByName("mask");
  1125. let ani = node.getComponent(sp.Skeleton);
  1126. ani.clearTracks();
  1127. ani.setAnimation(0, "b3", false);
  1128. ani.setCompleteListener(()=>{
  1129. ani.setCompleteListener(()=>{})
  1130. winNode.active = false;
  1131. if(this._bAutoGame)
  1132. this.onStartRoll();
  1133. })
  1134. },
  1135. onClickSkipFreeWin() {
  1136. this.playButtonEffect();
  1137. let winNode = this.node.getChildByName("freeWin").getChildByName("mask");
  1138. this.skipFreeWinAdd(winNode.getChildByName("score1").getComponent(cc.Label));
  1139. },
  1140. onClickFreeWinStart() {
  1141. },
  1142. playFreeWinAddAni(sLabel) {
  1143. let start = 0;
  1144. let bet = this.gameConfig.nJetton[this.curBetIndex];
  1145. let endScore = Global.formatString2Score(this.needPlayinfScore);
  1146. let add = parseFloat(bet/100/this.MAX_LINE);
  1147. this.upFreeWinLabel = ()=>{
  1148. start += add;
  1149. if(start >= endScore) {
  1150. this.skipFreeWinAdd(sLabel);
  1151. }else{
  1152. sLabel.string = parseFloat(start).toFixed(2);
  1153. }
  1154. }
  1155. if(this.upFreeWinLabel) {
  1156. this.unschedule(this.upFreeWinLabel);
  1157. }
  1158. this.schedule(this.upFreeWinLabel, 0.01);
  1159. },
  1160. skipFreeWinAdd(sLabel) {
  1161. if(this.upFreeWinLabel) {
  1162. this.unschedule(this.upFreeWinLabel);
  1163. }
  1164. let score = this.needPlayinfScore;
  1165. sLabel.string = Global.formatString2Score(score);
  1166. sLabel.node.stopAllActions();
  1167. cc.tween(sLabel.node)
  1168. .sequence(
  1169. cc.tween().to(0.25, {scale: 0.9}),
  1170. cc.tween().to(0.25, {scale: 1})
  1171. )
  1172. .repeatForever()
  1173. .start()
  1174. this.changeFreeWinBtn(false);
  1175. this.isPlayingScoreAddAni = false;
  1176. let node = this.node.getChildByName("freeWin");
  1177. node.stopAllActions();
  1178. cc.tween(node)
  1179. .delay(0.5)
  1180. .call(()=>{
  1181. if(this._bAutoGame)
  1182. this.hideFreeWin();
  1183. })
  1184. .start()
  1185. },
  1186. changeFreeWinBtn(bSkip) {
  1187. let winNode = this.node.getChildByName("freeWin").getChildByName("mask");
  1188. winNode.getChildByName("btn_start").active = !bSkip;
  1189. winNode.getChildByName("btn_skip").active = bSkip;
  1190. },
  1191. changeFreeBtns(bShow) {
  1192. this.upBtnInteractable(this.node.getChildByName("FuncBtnNode").getChildByName("btn_left"), bShow);
  1193. },
  1194. addOneRecord(info) {
  1195. let item = cc.instantiate(this.recordClone);
  1196. item.getChildByName("time").getComponent(cc.Label).string = Global.formatDate(new Date(info.nTime*1000));
  1197. item.getChildByName("bet").getComponent(cc.Label).string = Global.formatString2Score(info.nBet);
  1198. let win = info.nBet+info.nWinLost;
  1199. let col = new cc.Color(232, 232, 232);
  1200. if(win > 0) {
  1201. col = new cc.Color(248, 201, 39);
  1202. }
  1203. item.getChildByName("win").color = col;
  1204. item.getChildByName("win").getComponent(cc.Label).string = Global.formatString2Score(win);
  1205. item.active = true;
  1206. item.parent = this.recordContent;
  1207. },
  1208. showRecordsPanel() {
  1209. this.recordContent.removeAllChildren();
  1210. for(let i = 0; i < this._gameRecords.length; ++i) {
  1211. let info = this._gameRecords[i];
  1212. let item = cc.instantiate(this.recordClone);
  1213. item.getChildByName("time").getComponent(cc.Label).string = Global.formatDate(new Date(info.nTime*1000));
  1214. item.getChildByName("bet").getComponent(cc.Label).string = Global.formatString2Score(info.nBet);
  1215. let win = info.nBet+info.nWinLost;
  1216. let col = new cc.Color(232, 232, 232);
  1217. if(win > 0) {
  1218. col = new cc.Color(248, 201, 39);
  1219. }
  1220. item.getChildByName("win").color = col;
  1221. item.getChildByName("win").getComponent(cc.Label).string = Global.formatString2Score(win);
  1222. item.active = true;
  1223. item.parent = this.recordContent;
  1224. }
  1225. this.recordPanel.active = true;
  1226. },
  1227. onClickPlayback(){
  1228. console.log('点击回放');
  1229. if(!this._gameEnd) return;
  1230. this.node.stopAllActions();
  1231. this.resetGameView();
  1232. if(this.playingEffectID != -1) {
  1233. cc.vv.audioMgr.stopSFX(this.playingEffectID);
  1234. }
  1235. if(!this.judgeCannotRollGame()) {
  1236. return;
  1237. }
  1238. this._gameEnd = false;
  1239. this.changeGameState(1);
  1240. if(cc.vv.audioMgr._musicFile != this.nowPlayBgm || this.stopBackMusicTimes < 0)
  1241. cc.vv.audioMgr.playBGM(this.nowPlayBgm);
  1242. this.upLeftCount();
  1243. // this.onSendRoll();
  1244. this.showCenterNormal();
  1245. this.onGameStart();
  1246. this.rollPanel.startRollActions();
  1247. this.stopBackMusicTimes = 0;
  1248. // let str = `{"CMD":103010,"Value":{"cbFreeAdd":3,"cbFreeTime":3,"lCurScore":670,"m_berserk_data1":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],
  1249. // "m_berserk_data2":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_chair_id":10989,"m_chip_size":50,"m_deposit_lotttery":0,
  1250. // "m_desk_data":[[2,6,2,1,14],[4,11,11,3,1],[2,3,11,1,12]],"m_desk_value":[[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],"m_is_berserk":0,
  1251. // "m_kongming":1,"m_line_count":0,"m_line_icon":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1252. // "m_line_id":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1253. // "m_line_size":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1254. // "m_line_times":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  1255. // "m_lottery_size":0,"m_ruyi":0,"m_add_multi":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],"SG_result_data":[]}}`;
  1256. let str = cc.vv.playbackData;
  1257. let tData = JSON.parse(str);
  1258. setTimeout(()=>{
  1259. this.onRollEndInfo(tData.Value);
  1260. }, 400);
  1261. },
  1262. onClickSet() {
  1263. this.playButtonEffect();
  1264. this.setPanel.active = true;
  1265. this.changeAudioBtnState();
  1266. },
  1267. showCenterNormal() {
  1268. if(this._bSpecialGame) return;
  1269. this.node.getChildByName("RoomInfoNode").getChildByName("img_1").getChildByName("normalNode").active = true;
  1270. this.node.getChildByName("RoomInfoNode").getChildByName("img_1").getChildByName("winNode").active = false;
  1271. },
  1272. onClickRule() {
  1273. this.playButtonEffect();
  1274. UIHelper.loadRes('resourcesPrefab/ruleNode', cc.Prefab, (prefab)=>{
  1275. if (!this._ruleNode) {
  1276. this._ruleNode = cc.instantiate(prefab);
  1277. this._ruleNode.parent = this.node;
  1278. }
  1279. this._ruleNode.getComponent("RomanRule").show();
  1280. })
  1281. },
  1282. onClickMenu() {
  1283. this.playButtonEffect();
  1284. UIHelper.loadRes('GamePrefabs/Public/GameMenu', cc.Prefab, (prefab)=>{
  1285. if (!this._ruleNode) {
  1286. this._ruleNode = cc.instantiate(prefab);
  1287. this._ruleNode.parent = this.node;
  1288. }
  1289. this._ruleNode.getComponent("GameMenu").show();
  1290. })
  1291. },
  1292. playSoundByTimes(_times) {
  1293. if(_times <= 0) return;
  1294. let id = 1;
  1295. if(_times > this.MAX_LINE*120){
  1296. id = 15;
  1297. this.winAniIdx = 3;
  1298. }else if(_times > this.MAX_LINE*100){
  1299. id = 14;
  1300. this.winAniIdx = 3;
  1301. }else if(_times > this.MAX_LINE*80){
  1302. id = 13;
  1303. this.winAniIdx = 3;
  1304. }else if(_times > this.MAX_LINE*64){
  1305. id = 12;
  1306. this.winAniIdx = 3;
  1307. }else if(_times > this.MAX_LINE*48){
  1308. id = 11;
  1309. this.winAniIdx = 3;
  1310. }else if(_times > this.MAX_LINE*32){
  1311. id = 10;
  1312. this.winAniIdx = 3;
  1313. }else if(_times > this.MAX_LINE*20){
  1314. id = 9;
  1315. this.winAniIdx = 3;
  1316. }else if(_times > this.MAX_LINE*12){
  1317. id = 8;
  1318. this.winAniIdx = 3;
  1319. }else if(_times > this.MAX_LINE*8){
  1320. id = 5;
  1321. this.winAniIdx = 2;
  1322. }else if(_times > this.MAX_LINE*4){
  1323. id = 4;
  1324. this.winAniIdx = 1;
  1325. }else if(_times > this.MAX_LINE*2){
  1326. id = 3;
  1327. this.winAniIdx = 0;
  1328. }else if(_times > this.MAX_LINE){
  1329. id = 2;
  1330. this.winAniIdx = -1;
  1331. }
  1332. // this.playEffect("Level"+id);
  1333. this.playEffectByID(id);
  1334. },
  1335. playEffectByID(id) {
  1336. let audioC = this.audioArr[id];
  1337. if(audioC) {
  1338. this.playingEffectID = cc.vv.audioMgr.playEffectByAudioClip(audioC);
  1339. }
  1340. },
  1341. playButtonEffect(){
  1342. this.playEffect("button");
  1343. },
  1344. update (dt) {
  1345. if(this.stopBackMusicTimes > 0) {
  1346. this.stopBackMusicTimes -= dt;
  1347. if(this.stopBackMusicTimes <= 0) {
  1348. cc.vv.audioMgr.pauseBackMusic();
  1349. }
  1350. }
  1351. },
  1352. });