OlympusGameSence.js 83 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653
  1. var GameBase = require("GameBase");
  2. var ProtocolGameServer = require("ProtocolGameServer");
  3. var GameProtocol = require("OlympusGameProtocol");
  4. var AnalyzeXieYi = require("AnalyzeOlympusXieYi");
  5. var MakeXieYi = require("MakeOlympusXieYi");
  6. var Global = require("Global");
  7. var topTipMsg = require("topTipMsg");
  8. var UIHelper = require("UIHelper");
  9. var BaseDefine = require("BaseDefine");
  10. var GameConstant = require("GameConstant");
  11. var ProtocolLoginServer = require("ProtocolLoginServer");
  12. var EventMgr = require("EventMgr");
  13. var LanguageKey = require("LanguageKey");
  14. import { CServerItem } from 'CServerItem'
  15. import GameManagerBase from 'GameManagerBase'
  16. import ScenceManager from 'HNScenceManager'
  17. // const GAME_FREE = 0; //无
  18. // const GAME_PLAYING = 1; //游戏中
  19. // const GAME_END = 2; //游戏结束
  20. // const GAME_PLAYSCOREING = 3; //表现分数增加中
  21. // const GAME_GAMEEND = 4; //游戏真正结束
  22. const ShowNextJackpotTime = 10;
  23. cc.Class({
  24. extends: GameBase,
  25. editor: {
  26. menu: 'Game/Olympus/GameSence'
  27. },
  28. properties: {
  29. rollNode: cc.Node,
  30. playerScore: cc.Label,
  31. resultNode: cc.Node,
  32. betNode: cc.Node,
  33. //功能按钮
  34. startBtn: cc.Node,
  35. addBtn: cc.Node,
  36. delBtn: cc.Node,
  37. quickBtn: cc.Node,
  38. homeBtn: cc.Node,
  39. exitBtn: cc.Node,
  40. playbackNode: cc.Node, //回放按钮
  41. freeLeftNode: cc.Node,
  42. ruleNode: cc.Node,
  43. winScoreLabel: cc.Label,
  44. winSpineData: [sp.SkeletonData],
  45. audioArr: [cc.AudioClip],
  46. jackpotAni: sp.Skeleton,
  47. jackpotNode: cc.Node,
  48. jackpotNumClone: cc.Node,
  49. jackpotNums: [cc.Node],
  50. // noticeNode: cc.Node,
  51. // noticeLabel: cc.Node,
  52. rightJackpotNode: cc.Node,
  53. rightJackpotPlayer1: cc.Node,
  54. rightJackpotPlayer2: cc.Node,
  55. rightJackpotPanel: cc.Node,
  56. rightJackPotClone: cc.Node,
  57. rightJackPotShowNode: cc.Node,
  58. rightJackPotContent: cc.Node,
  59. },
  60. update(dt) {
  61. if(this.delayNextTime <= 0) {
  62. this.jumpNextJackpot();
  63. }else{
  64. this.delayNextTime -= dt;
  65. }
  66. if(this.delayShowJackpotSweepTime <= 0) {
  67. this.jackpotAni.clearTracks();
  68. this.jackpotAni.setAnimation(0, 'a1', false);
  69. this.delayShowJackpotSweepTime = 10;
  70. }else{
  71. this.delayShowJackpotSweepTime -= dt;
  72. }
  73. },
  74. // showNextMar() {
  75. // var kStr = this.marqueueArr.shift();
  76. // this.noticeNode.active = true;
  77. // this.noticeLabel.x = 300;
  78. // this.noticeLabel.getComponent(cc.Label).string = kStr;
  79. // this.delayMarqueueTime = 15;
  80. // },
  81. onLoad () {
  82. this.rollPanel = this.rollNode.getComponent("OlympusRollPanel");
  83. this.gameConfig = {};
  84. this.bets = [];
  85. this.addNormalButtonListener();
  86. this.LG_PATH_SC = "OLYMPUS/";
  87. this.jackpotScore = -1;
  88. this.jackpotNumPositionY = [
  89. {y1:-208, y2:298},//0
  90. {y1:-163, y2:354},//1
  91. {y1:-118, y2:409},//2
  92. {y1:-73, y2:464},//3
  93. {y1:-28, y2:519},//4
  94. {y1:-434, y2:16},//5
  95. {y1:-388, y2:62},//6
  96. {y1:-344, y2:107},//7
  97. {y1:-298, y2:152},//8
  98. {y1:-253, y2:197},//9
  99. ];
  100. let des = [0,0,0];
  101. let k = des.length-1;
  102. for(let i = 8; i >= 0; --i,--k) {
  103. let ln = this.jackpotNums[i];
  104. if(ln) {
  105. if(k >= 0) {
  106. ln.active = true;
  107. // this.roll2Num(ln, des[k], 1-i*0.05);
  108. let info = this.jackpotNumPositionY[des[k]];
  109. ln.y = info.y1;
  110. }else{
  111. ln.active = false;
  112. }
  113. }
  114. }
  115. this.jackpotRecord = [];
  116. this.rightJackpotNode.active = false;
  117. this.delayShowJackpotSweepTime = 2;
  118. // this.delayMarqueueTime = 0;
  119. // this.noticeNode.active = false;
  120. // this.test();
  121. this.homeBtn.active = !cc.vv.config.ReviewApk;
  122. this.exitBtn.active = cc.vv.config.ReviewApk;
  123. },
  124. start () {
  125. this.node.parent = cc.director.getScene().getChildByName("Canvas");
  126. this.node.setPosition(0,0);
  127. let player = this.getSelfPlayer();
  128. if(player)
  129. this._lastScore = player.getUserScore();
  130. this._lastScore = cc.vv.globalUserInfo.getUserScore();
  131. this.upPlayerScore(this._lastScore);
  132. this.allWinScore = 0;
  133. cc.vv.audioMgr.playBGM("bgm");
  134. this._gameEnd = true;
  135. this.nowShowIdx = 0;
  136. this.delayNextTime = ShowNextJackpotTime;
  137. this.jackpotRecord = [];
  138. this.gameConfig = {};
  139. this.roomData = cc.vv.serverListData.getCurRoomData();
  140. this.getJackpotRecord();
  141. this.addMsgListener();
  142. this.makeDataToGameConfig();
  143. this._showControl = true;
  144. this.bTriggerJackpot = false;
  145. this.onRefreshJackpot();
  146. this.setPlayback();
  147. },
  148. addMsgListener(){
  149. cc.vv.netSocket.registerEvent(ProtocolLoginServer.CMD_C2S_Game_RollOLYMPUS,this.onRollEndInfo,this);
  150. EventMgr.getInstance().registerEvent('rewardInfo', this.onRefreshJackpot, this);
  151. EventMgr.getInstance().registerEvent('offLineStatus', this.onOffLine, this);
  152. },
  153. removeMsgListener(){
  154. cc.vv.netSocket.removeEvent(ProtocolLoginServer.CMD_C2S_Game_RollOLYMPUS,this.onRollEndInfo,this);
  155. EventMgr.getInstance().removeEvent('rewardInfo', this.onRefreshJackpot, this);
  156. EventMgr.getInstance().removeEvent('offLineStatus', this.onOffLine, this);
  157. },
  158. onOffLine(data){
  159. if(data.status == 1){ //1重连成功
  160. let delayTimes = 0;
  161. delayTimes = this._gameEnd ? 0 : 3;
  162. this.scheduleOnce(()=>{
  163. this._lastScore = cc.vv.globalUserInfo.getUserScore();
  164. this.upPlayerScore(this._lastScore);
  165. this.rollPanel.forceStop();
  166. this.node.stopAllActions();
  167. this.resetGameView();
  168. this.resetAllBtn();
  169. this.changeGameState(0);
  170. this._gameEnd = true;
  171. this._bAutoGame = false;
  172. }, delayTimes);
  173. }
  174. },
  175. setPlayback(){
  176. this.bTestPlayback = cc.vv.testPlayback; //是否是回放
  177. this.homeBtn.active = !this.bTestPlayback;
  178. this.playbackNode.active = this.bTestPlayback;
  179. },
  180. test() {
  181. ScenceManager.Instance().setGameComponent(this);
  182. this.gameConfig.nJetton = [50,100,500,5000]
  183. this.bets = [50,100,500,5000]
  184. this._currentScore = cc.vv.globalUserInfo.getUserScore();
  185. this._lastScore = cc.vv.globalUserInfo.getUserScore();
  186. this.curBetIndex = 0;
  187. this.leftFreeCount = 0;
  188. cc.vv.needFree = false;
  189. },
  190. //重写
  191. addNormalButtonListener() {
  192. UIHelper.addButtonListener(this.startBtn, this.node, "OlympusGameSence", "onClickStart");
  193. UIHelper.addButtonListener(this.quickBtn, this.node, "OlympusGameSence", "onClickQuick");
  194. UIHelper.addButtonListener(this.homeBtn, this.node, "OlympusGameSence", "onClickMenu");
  195. UIHelper.addButtonListener(this.addBtn, this.node, "OlympusGameSence", "onClickAdd");
  196. UIHelper.addButtonListener(this.delBtn, this.node, "OlympusGameSence", "onClickDel");
  197. },
  198. testResult() {
  199. /**
  200. * m_chair_id:
  201. * m_chip_size:
  202. * m_result_data:[
  203. * m_desk_data:[][]
  204. * m_item_id:[]
  205. * m_item_count:[]
  206. * m_item_times:[]
  207. * m_total_score:
  208. * bFree:
  209. * ]
  210. * m_all_score:
  211. * m_free_count:
  212. */
  213. let data = {};
  214. data.m_chair_id = 0;
  215. data.m_chip_size = this.bets[this.curBetIndex];
  216. data.m_all_score = 0;
  217. data.m_free_count = 0;
  218. data.m_result_data = [];
  219. let idx = 0;
  220. let hasNext = false;
  221. do{
  222. hasNext = false;
  223. let freeCount = 0;
  224. let res = {};
  225. let itemCount = [0,0,0,0,0,0,0,0,0,0];
  226. res.m_desk_data = [[-1,-1,-1,-1,-1],[-1,-1,-1,-1,-1],[-1,-1,-1,-1,-1],[-1,-1,-1,-1,-1],[-1,-1,-1,-1,-1],[-1,-1,-1,-1,-1]];
  227. if(idx > 0) {
  228. let rrs = data.m_result_data[idx-1];
  229. let temp = [[-1,-1,-1,-1,-1],[-1,-1,-1,-1,-1],[-1,-1,-1,-1,-1],[-1,-1,-1,-1,-1],[-1,-1,-1,-1,-1],[-1,-1,-1,-1,-1]];//rrs.m_desk_data.slice(0);
  230. // for(let i = 0; i < GameProtocol.MAX_COL_NUM; ++i) {
  231. // for(let j = GameProtocol.MAX_ROW_NUM-1; j >= 0; --j) {
  232. // temp[i][j] = rrs.m_desk_data[i][j];
  233. // }
  234. // }
  235. for(let k = 0; k < rrs.m_item_count.length; ++k) {
  236. let ddi = rrs.m_item_id[k];
  237. for(let i = 0; i < GameProtocol.MAX_COL_NUM; ++i) {
  238. for(let j = 0; j < GameProtocol.MAX_ROW_NUM; ++j) {
  239. if(rrs.m_desk_data[i][j] != ddi) {
  240. temp[i][j] = rrs.m_desk_data[i][j];
  241. }
  242. }
  243. }
  244. }
  245. for(let i = 0; i < GameProtocol.MAX_COL_NUM; ++i) {
  246. let k = GameProtocol.MAX_ROW_NUM-1;
  247. for(let j = GameProtocol.MAX_ROW_NUM-1; j >= 0; --j) {
  248. if(temp[i][j] != -1) {
  249. res.m_desk_data[i][k--] = temp[i][j];
  250. itemCount[temp[i][j]]++;
  251. }
  252. }
  253. }
  254. }
  255. for(let i = 0; i < GameProtocol.MAX_COL_NUM; ++i) {
  256. for(let j = 0; j < GameProtocol.MAX_ROW_NUM; ++j) {
  257. if(res.m_desk_data[i][j] != -1) {continue;}
  258. let ddt = this.getRandomValue(j);
  259. if(ddt == GameProtocol.FREE_ICON) {
  260. freeCount++;
  261. }
  262. itemCount[ddt]++;
  263. res.m_desk_data[i][j] = ddt;
  264. }
  265. }
  266. res.m_item_id = [];
  267. res.m_item_count = [];
  268. res.m_item_times = [];
  269. res.m_total_score = 0;
  270. for(let i = 0; i < itemCount.length; ++i) {
  271. if(itemCount[i] >= 8) {
  272. hasNext = true;
  273. res.m_item_id.push(i);
  274. res.m_item_count.push(itemCount[i]);
  275. res.m_item_times.push(i);
  276. res.m_total_score += 10;
  277. }
  278. }
  279. if(freeCount >= 4) {
  280. res.bFree = true;
  281. data.m_free_count += 15;
  282. }
  283. data.m_result_data[idx++] = res;
  284. }while(hasNext);
  285. // data.m_lottery_size = Global.unify(win*data.m_chip_size/50)*5;
  286. // data.lCurScore = this._currentScore + data.m_lottery_size;
  287. // this._lastScore = data.lCurScore;
  288. // cc.vv.globalUserInfo.setUserScore(this._lastScore*100);
  289. // Global.print(data);
  290. data = {
  291. "m_chair_id": 0,
  292. "m_chip_size": 100,
  293. "m_result_data": [
  294. {
  295. "m_desk_data": [
  296. 8,
  297. 8,
  298. 0,
  299. 4,
  300. 4,
  301. 0,
  302. 0,
  303. 0,
  304. 2,
  305. 2,
  306. 2,
  307. 0,
  308. 11,
  309. 0,
  310. 3,
  311. 6,
  312. 5,
  313. 4,
  314. 3,
  315. 9,
  316. 5,
  317. 6,
  318. 0,
  319. 9,
  320. 2,
  321. 0,
  322. 11,
  323. 9,
  324. 0,
  325. 0
  326. ],
  327. "m_item_id": [
  328. 0,
  329. 0,
  330. 0,
  331. 0,
  332. 0
  333. ],
  334. "m_item_count": [
  335. 10,
  336. 0,
  337. 0,
  338. 0,
  339. 0
  340. ],
  341. "m_item_times": [
  342. 25,
  343. 0,
  344. 0,
  345. 0,
  346. 0
  347. ],
  348. "m_win_score": 25
  349. },
  350. {
  351. "m_desk_data": [
  352. 8,
  353. 8,
  354. 1,
  355. 4,
  356. 4,
  357. 11,
  358. 2,
  359. 9,
  360. 2,
  361. 2,
  362. 2,
  363. 1,
  364. 11,
  365. 9,
  366. 3,
  367. 6,
  368. 5,
  369. 4,
  370. 3,
  371. 9,
  372. 5,
  373. 6,
  374. 9,
  375. 9,
  376. 2,
  377. 11,
  378. 11,
  379. 9,
  380. 9,
  381. 11
  382. ],
  383. "m_item_id": [
  384. 9,
  385. 0,
  386. 0,
  387. 0,
  388. 0
  389. ],
  390. "m_item_count": [
  391. 7,
  392. 0,
  393. 0,
  394. 0,
  395. 0
  396. ],
  397. "m_item_times": [
  398. 1000,
  399. 0,
  400. 0,
  401. 0,
  402. 0
  403. ],
  404. "m_win_score": 1000
  405. },
  406. {
  407. "m_desk_data": [
  408. 8,
  409. 8,
  410. 1,
  411. 4,
  412. 4,
  413. 11,
  414. 2,
  415. 11,
  416. 2,
  417. 2,
  418. 2,
  419. 1,
  420. 11,
  421. 6,
  422. 3,
  423. 6,
  424. 5,
  425. 4,
  426. 3,
  427. 11,
  428. 5,
  429. 6,
  430. 11,
  431. 11,
  432. 2,
  433. 11,
  434. 11,
  435. 3,
  436. 0,
  437. 11
  438. ],
  439. "m_item_id": [
  440. 11,
  441. 0,
  442. 0,
  443. 0,
  444. 0
  445. ],
  446. "m_item_count": [
  447. 9,
  448. 0,
  449. 0,
  450. 0,
  451. 0
  452. ],
  453. "m_item_times": [
  454. 1,
  455. 0,
  456. 0,
  457. 0,
  458. 0
  459. ],
  460. "m_deposit_lotttery":991,
  461. "m_win_score": 0
  462. },
  463. {
  464. "m_desk_data": [
  465. 0,
  466. 0,
  467. 0,
  468. 0,
  469. 0,
  470. 0,
  471. 0,
  472. 0,
  473. 0,
  474. 0,
  475. 0,
  476. 0,
  477. 0,
  478. 0,
  479. 0,
  480. 0,
  481. 0,
  482. 0,
  483. 0,
  484. 0,
  485. 0,
  486. 0,
  487. 0,
  488. 0,
  489. 0,
  490. 0,
  491. 0,
  492. 0,
  493. 0,
  494. 0
  495. ],
  496. "m_item_id": [
  497. 0,
  498. 0,
  499. 0,
  500. 0,
  501. 0
  502. ],
  503. "m_item_count": [
  504. 0,
  505. 0,
  506. 0,
  507. 0,
  508. 0
  509. ],
  510. "m_item_times": [
  511. 0,
  512. 0,
  513. 0,
  514. 0,
  515. 0
  516. ],
  517. "m_win_score": 0
  518. },
  519. {
  520. "m_desk_data": [
  521. 0,
  522. 0,
  523. 0,
  524. 0,
  525. 0,
  526. 0,
  527. 0,
  528. 0,
  529. 0,
  530. 0,
  531. 0,
  532. 0,
  533. 0,
  534. 0,
  535. 0,
  536. 0,
  537. 0,
  538. 0,
  539. 0,
  540. 0,
  541. 0,
  542. 0,
  543. 0,
  544. 0,
  545. 0,
  546. 0,
  547. 0,
  548. 0,
  549. 0,
  550. 0
  551. ],
  552. "m_item_id": [
  553. 0,
  554. 0,
  555. 0,
  556. 0,
  557. 0
  558. ],
  559. "m_item_count": [
  560. 0,
  561. 0,
  562. 0,
  563. 0,
  564. 0
  565. ],
  566. "m_item_times": [
  567. 0,
  568. 0,
  569. 0,
  570. 0,
  571. 0
  572. ],
  573. "m_win_score": 0
  574. },
  575. {
  576. "m_desk_data": [
  577. 0,
  578. 0,
  579. 0,
  580. 0,
  581. 0,
  582. 0,
  583. 0,
  584. 0,
  585. 0,
  586. 0,
  587. 0,
  588. 0,
  589. 0,
  590. 0,
  591. 0,
  592. 0,
  593. 0,
  594. 0,
  595. 0,
  596. 0,
  597. 0,
  598. 0,
  599. 0,
  600. 0,
  601. 0,
  602. 0,
  603. 0,
  604. 0,
  605. 0,
  606. 0
  607. ],
  608. "m_item_id": [
  609. 0,
  610. 0,
  611. 0,
  612. 0,
  613. 0
  614. ],
  615. "m_item_count": [
  616. 0,
  617. 0,
  618. 0,
  619. 0,
  620. 0
  621. ],
  622. "m_item_times": [
  623. 0,
  624. 0,
  625. 0,
  626. 0,
  627. 0
  628. ],
  629. "m_win_score": 0
  630. },
  631. {
  632. "m_desk_data": [
  633. 0,
  634. 0,
  635. 0,
  636. 0,
  637. 0,
  638. 0,
  639. 0,
  640. 0,
  641. 0,
  642. 0,
  643. 0,
  644. 0,
  645. 0,
  646. 0,
  647. 0,
  648. 0,
  649. 0,
  650. 0,
  651. 0,
  652. 0,
  653. 0,
  654. 0,
  655. 0,
  656. 0,
  657. 0,
  658. 0,
  659. 0,
  660. 0,
  661. 0,
  662. 0
  663. ],
  664. "m_item_id": [
  665. 0,
  666. 0,
  667. 0,
  668. 0,
  669. 0
  670. ],
  671. "m_item_count": [
  672. 0,
  673. 0,
  674. 0,
  675. 0,
  676. 0
  677. ],
  678. "m_item_times": [
  679. 0,
  680. 0,
  681. 0,
  682. 0,
  683. 0
  684. ],
  685. "m_win_score": 0
  686. },
  687. {
  688. "m_desk_data": [
  689. 0,
  690. 0,
  691. 0,
  692. 0,
  693. 0,
  694. 0,
  695. 0,
  696. 0,
  697. 0,
  698. 0,
  699. 0,
  700. 0,
  701. 0,
  702. 0,
  703. 0,
  704. 0,
  705. 0,
  706. 0,
  707. 0,
  708. 0,
  709. 0,
  710. 0,
  711. 0,
  712. 0,
  713. 0,
  714. 0,
  715. 0,
  716. 0,
  717. 0,
  718. 0
  719. ],
  720. "m_item_id": [
  721. 0,
  722. 0,
  723. 0,
  724. 0,
  725. 0
  726. ],
  727. "m_item_count": [
  728. 0,
  729. 0,
  730. 0,
  731. 0,
  732. 0
  733. ],
  734. "m_item_times": [
  735. 0,
  736. 0,
  737. 0,
  738. 0,
  739. 0
  740. ],
  741. "m_win_score": 0
  742. },
  743. {
  744. "m_desk_data": [
  745. 0,
  746. 0,
  747. 0,
  748. 0,
  749. 0,
  750. 0,
  751. 0,
  752. 0,
  753. 0,
  754. 0,
  755. 0,
  756. 0,
  757. 0,
  758. 0,
  759. 0,
  760. 0,
  761. 0,
  762. 0,
  763. 0,
  764. 0,
  765. 0,
  766. 0,
  767. 0,
  768. 0,
  769. 0,
  770. 0,
  771. 0,
  772. 0,
  773. 0,
  774. 0
  775. ],
  776. "m_item_id": [
  777. 0,
  778. 0,
  779. 0,
  780. 0,
  781. 0
  782. ],
  783. "m_item_count": [
  784. 0,
  785. 0,
  786. 0,
  787. 0,
  788. 0
  789. ],
  790. "m_item_times": [
  791. 0,
  792. 0,
  793. 0,
  794. 0,
  795. 0
  796. ],
  797. "m_win_score": 0
  798. },
  799. {
  800. "m_desk_data": [
  801. 0,
  802. 0,
  803. 0,
  804. 0,
  805. 0,
  806. 0,
  807. 0,
  808. 0,
  809. 0,
  810. 0,
  811. 0,
  812. 0,
  813. 0,
  814. 0,
  815. 0,
  816. 0,
  817. 0,
  818. 0,
  819. 0,
  820. 0,
  821. 0,
  822. 0,
  823. 0,
  824. 0,
  825. 0,
  826. 0,
  827. 0,
  828. 0,
  829. 0,
  830. 0
  831. ],
  832. "m_item_id": [
  833. 0,
  834. 0,
  835. 0,
  836. 0,
  837. 0
  838. ],
  839. "m_item_count": [
  840. 0,
  841. 0,
  842. 0,
  843. 0,
  844. 0
  845. ],
  846. "m_item_times": [
  847. 0,
  848. 0,
  849. 0,
  850. 0,
  851. 0
  852. ],
  853. "m_win_score": 0
  854. }
  855. ],
  856. "m_lottery_size": 1025,
  857. "m_deposit_lotttery": 991,
  858. "m_free_count": 0,
  859. "m_add_multi": [
  860. 0,
  861. 0,
  862. 0,
  863. 0,
  864. 0,
  865. 0,
  866. 0,
  867. 0,
  868. 0,
  869. 0,
  870. 0,
  871. 0,
  872. 0,
  873. 0,
  874. 0,
  875. 0,
  876. 0,
  877. 0,
  878. 0,
  879. 0,
  880. 0,
  881. 0,
  882. 0,
  883. 0,
  884. 0,
  885. 0,
  886. 0,
  887. 0,
  888. 0,
  889. 0
  890. ],
  891. "lCurScore": 2918
  892. }
  893. data = {
  894. "m_chair_id": 0,
  895. "m_chip_size": 60,
  896. "m_result_data": [
  897. {
  898. "m_desk_data": [
  899. 2,
  900. 3,
  901. 1,
  902. 7,
  903. 2,
  904. 1,
  905. 8,
  906. 5,
  907. 0,
  908. 2,
  909. 1,
  910. 2,
  911. 0,
  912. 7,
  913. 2,
  914. 4,
  915. 3,
  916. 1,
  917. 0,
  918. 0,
  919. 2,
  920. 1,
  921. 0,
  922. 2,
  923. 3,
  924. 1,
  925. 1,
  926. 5,
  927. 0,
  928. 1
  929. ],
  930. "m_item_id": [
  931. 1,
  932. 0,
  933. 0,
  934. 0,
  935. 0
  936. ],
  937. "m_item_count": [
  938. 8,
  939. 0,
  940. 0,
  941. 0,
  942. 0
  943. ],
  944. "m_item_times": [
  945. 40,
  946. 0,
  947. 0,
  948. 0,
  949. 0
  950. ],
  951. "m_deposit_lotttery": 0,
  952. "m_win_score": 24
  953. },
  954. {
  955. "m_desk_data": [
  956. 2,
  957. 3,
  958. 9,
  959. 7,
  960. 2,
  961. 3,
  962. 8,
  963. 5,
  964. 0,
  965. 2,
  966. 0,
  967. 2,
  968. 0,
  969. 7,
  970. 2,
  971. 4,
  972. 3,
  973. 9,
  974. 0,
  975. 0,
  976. 2,
  977. 2,
  978. 0,
  979. 2,
  980. 3,
  981. 11,
  982. 3,
  983. 5,
  984. 0,
  985. 0
  986. ],
  987. "m_item_id": [
  988. 0,
  989. 2,
  990. 0,
  991. 0,
  992. 0
  993. ],
  994. "m_item_count": [
  995. 8,
  996. 8,
  997. 0,
  998. 0,
  999. 0
  1000. ],
  1001. "m_item_times": [
  1002. 25,
  1003. 50,
  1004. 0,
  1005. 0,
  1006. 0
  1007. ],
  1008. "m_deposit_lotttery": 0,
  1009. "m_win_score": 45
  1010. },
  1011. {
  1012. "m_desk_data": [
  1013. 0,
  1014. 3,
  1015. 9,
  1016. 7,
  1017. 3,
  1018. 3,
  1019. 8,
  1020. 5,
  1021. 2,
  1022. 4,
  1023. 3,
  1024. 0,
  1025. 4,
  1026. 7,
  1027. 0,
  1028. 4,
  1029. 3,
  1030. 9,
  1031. 1,
  1032. 0,
  1033. 6,
  1034. 2,
  1035. 7,
  1036. 5,
  1037. 3,
  1038. 11,
  1039. 3,
  1040. 5,
  1041. 0,
  1042. 4
  1043. ],
  1044. "m_item_id": [
  1045. 0,
  1046. 0,
  1047. 0,
  1048. 0,
  1049. 0
  1050. ],
  1051. "m_item_count": [
  1052. 0,
  1053. 0,
  1054. 0,
  1055. 0,
  1056. 0
  1057. ],
  1058. "m_item_times": [
  1059. 0,
  1060. 0,
  1061. 0,
  1062. 0,
  1063. 0
  1064. ],
  1065. "m_deposit_lotttery": 0,
  1066. "m_win_score": 0
  1067. },
  1068. {
  1069. "m_desk_data": [
  1070. 0,
  1071. 0,
  1072. 0,
  1073. 0,
  1074. 0,
  1075. 0,
  1076. 0,
  1077. 0,
  1078. 0,
  1079. 0,
  1080. 0,
  1081. 0,
  1082. 0,
  1083. 0,
  1084. 0,
  1085. 0,
  1086. 0,
  1087. 0,
  1088. 0,
  1089. 0,
  1090. 0,
  1091. 0,
  1092. 0,
  1093. 0,
  1094. 0,
  1095. 0,
  1096. 0,
  1097. 0,
  1098. 0,
  1099. 0
  1100. ],
  1101. "m_item_id": [
  1102. 0,
  1103. 0,
  1104. 0,
  1105. 0,
  1106. 0
  1107. ],
  1108. "m_item_count": [
  1109. 0,
  1110. 0,
  1111. 0,
  1112. 0,
  1113. 0
  1114. ],
  1115. "m_item_times": [
  1116. 0,
  1117. 0,
  1118. 0,
  1119. 0,
  1120. 0
  1121. ],
  1122. "m_deposit_lotttery": 0,
  1123. "m_win_score": 0
  1124. },
  1125. {
  1126. "m_desk_data": [
  1127. 0,
  1128. 0,
  1129. 0,
  1130. 0,
  1131. 0,
  1132. 0,
  1133. 0,
  1134. 0,
  1135. 0,
  1136. 0,
  1137. 0,
  1138. 0,
  1139. 0,
  1140. 0,
  1141. 0,
  1142. 0,
  1143. 0,
  1144. 0,
  1145. 0,
  1146. 0,
  1147. 0,
  1148. 0,
  1149. 0,
  1150. 0,
  1151. 0,
  1152. 0,
  1153. 0,
  1154. 0,
  1155. 0,
  1156. 0
  1157. ],
  1158. "m_item_id": [
  1159. 0,
  1160. 0,
  1161. 0,
  1162. 0,
  1163. 0
  1164. ],
  1165. "m_item_count": [
  1166. 0,
  1167. 0,
  1168. 0,
  1169. 0,
  1170. 0
  1171. ],
  1172. "m_item_times": [
  1173. 0,
  1174. 0,
  1175. 0,
  1176. 0,
  1177. 0
  1178. ],
  1179. "m_deposit_lotttery": 0,
  1180. "m_win_score": 0
  1181. },
  1182. {
  1183. "m_desk_data": [
  1184. 0,
  1185. 0,
  1186. 0,
  1187. 0,
  1188. 0,
  1189. 0,
  1190. 0,
  1191. 0,
  1192. 0,
  1193. 0,
  1194. 0,
  1195. 0,
  1196. 0,
  1197. 0,
  1198. 0,
  1199. 0,
  1200. 0,
  1201. 0,
  1202. 0,
  1203. 0,
  1204. 0,
  1205. 0,
  1206. 0,
  1207. 0,
  1208. 0,
  1209. 0,
  1210. 0,
  1211. 0,
  1212. 0,
  1213. 0
  1214. ],
  1215. "m_item_id": [
  1216. 0,
  1217. 0,
  1218. 0,
  1219. 0,
  1220. 0
  1221. ],
  1222. "m_item_count": [
  1223. 0,
  1224. 0,
  1225. 0,
  1226. 0,
  1227. 0
  1228. ],
  1229. "m_item_times": [
  1230. 0,
  1231. 0,
  1232. 0,
  1233. 0,
  1234. 0
  1235. ],
  1236. "m_deposit_lotttery": 0,
  1237. "m_win_score": 0
  1238. },
  1239. {
  1240. "m_desk_data": [
  1241. 0,
  1242. 0,
  1243. 0,
  1244. 0,
  1245. 0,
  1246. 0,
  1247. 0,
  1248. 0,
  1249. 0,
  1250. 0,
  1251. 0,
  1252. 0,
  1253. 0,
  1254. 0,
  1255. 0,
  1256. 0,
  1257. 0,
  1258. 0,
  1259. 0,
  1260. 0,
  1261. 0,
  1262. 0,
  1263. 0,
  1264. 0,
  1265. 0,
  1266. 0,
  1267. 0,
  1268. 0,
  1269. 0,
  1270. 0
  1271. ],
  1272. "m_item_id": [
  1273. 0,
  1274. 0,
  1275. 0,
  1276. 0,
  1277. 0
  1278. ],
  1279. "m_item_count": [
  1280. 0,
  1281. 0,
  1282. 0,
  1283. 0,
  1284. 0
  1285. ],
  1286. "m_item_times": [
  1287. 0,
  1288. 0,
  1289. 0,
  1290. 0,
  1291. 0
  1292. ],
  1293. "m_deposit_lotttery": 0,
  1294. "m_win_score": 0
  1295. },
  1296. {
  1297. "m_desk_data": [
  1298. 0,
  1299. 0,
  1300. 0,
  1301. 0,
  1302. 0,
  1303. 0,
  1304. 0,
  1305. 0,
  1306. 0,
  1307. 0,
  1308. 0,
  1309. 0,
  1310. 0,
  1311. 0,
  1312. 0,
  1313. 0,
  1314. 0,
  1315. 0,
  1316. 0,
  1317. 0,
  1318. 0,
  1319. 0,
  1320. 0,
  1321. 0,
  1322. 0,
  1323. 0,
  1324. 0,
  1325. 0,
  1326. 0,
  1327. 0
  1328. ],
  1329. "m_item_id": [
  1330. 0,
  1331. 0,
  1332. 0,
  1333. 0,
  1334. 0
  1335. ],
  1336. "m_item_count": [
  1337. 0,
  1338. 0,
  1339. 0,
  1340. 0,
  1341. 0
  1342. ],
  1343. "m_item_times": [
  1344. 0,
  1345. 0,
  1346. 0,
  1347. 0,
  1348. 0
  1349. ],
  1350. "m_deposit_lotttery": 0,
  1351. "m_win_score": 0
  1352. },
  1353. {
  1354. "m_desk_data": [
  1355. 0,
  1356. 0,
  1357. 0,
  1358. 0,
  1359. 0,
  1360. 0,
  1361. 0,
  1362. 0,
  1363. 0,
  1364. 0,
  1365. 0,
  1366. 0,
  1367. 0,
  1368. 0,
  1369. 0,
  1370. 0,
  1371. 0,
  1372. 0,
  1373. 0,
  1374. 0,
  1375. 0,
  1376. 0,
  1377. 0,
  1378. 0,
  1379. 0,
  1380. 0,
  1381. 0,
  1382. 0,
  1383. 0,
  1384. 0
  1385. ],
  1386. "m_item_id": [
  1387. 0,
  1388. 0,
  1389. 0,
  1390. 0,
  1391. 0
  1392. ],
  1393. "m_item_count": [
  1394. 0,
  1395. 0,
  1396. 0,
  1397. 0,
  1398. 0
  1399. ],
  1400. "m_item_times": [
  1401. 0,
  1402. 0,
  1403. 0,
  1404. 0,
  1405. 0
  1406. ],
  1407. "m_deposit_lotttery": 0,
  1408. "m_win_score": 0
  1409. },
  1410. {
  1411. "m_desk_data": [
  1412. 0,
  1413. 0,
  1414. 0,
  1415. 0,
  1416. 0,
  1417. 0,
  1418. 0,
  1419. 0,
  1420. 0,
  1421. 0,
  1422. 0,
  1423. 0,
  1424. 0,
  1425. 0,
  1426. 0,
  1427. 0,
  1428. 0,
  1429. 0,
  1430. 0,
  1431. 0,
  1432. 0,
  1433. 0,
  1434. 0,
  1435. 0,
  1436. 0,
  1437. 0,
  1438. 0,
  1439. 0,
  1440. 0,
  1441. 0
  1442. ],
  1443. "m_item_id": [
  1444. 0,
  1445. 0,
  1446. 0,
  1447. 0,
  1448. 0
  1449. ],
  1450. "m_item_count": [
  1451. 0,
  1452. 0,
  1453. 0,
  1454. 0,
  1455. 0
  1456. ],
  1457. "m_item_times": [
  1458. 0,
  1459. 0,
  1460. 0,
  1461. 0,
  1462. 0
  1463. ],
  1464. "m_deposit_lotttery": 0,
  1465. "m_win_score": 0
  1466. }
  1467. ],
  1468. "m_lottery_size": 69,
  1469. "m_deposit_lotttery": 0,
  1470. "m_free_count": 0,
  1471. "m_add_multi": [
  1472. 0,
  1473. 0,
  1474. 0,
  1475. 0,
  1476. 0,
  1477. 0,
  1478. 0,
  1479. 0,
  1480. 0,
  1481. 0,
  1482. 0,
  1483. 0,
  1484. 0,
  1485. 0,
  1486. 0,
  1487. 0,
  1488. 0,
  1489. 0,
  1490. 0,
  1491. 0,
  1492. 0,
  1493. 0,
  1494. 0,
  1495. 0,
  1496. 0,
  1497. 0,
  1498. 0,
  1499. 0,
  1500. 0,
  1501. 0
  1502. ],
  1503. "lCurScore": 15031736
  1504. }
  1505. setTimeout(()=>{
  1506. this.onRollEndInfo(data);
  1507. }, 300);
  1508. },
  1509. getRandomValue(i) {
  1510. // if(i > 0) {
  1511. // return this.rollPanel.getRandomValue();
  1512. // }
  1513. let ddd = Math.floor(Math.random()*100);
  1514. return ddd % 10;
  1515. },
  1516. onClickCloseControlInfo() {
  1517. this._showControl = false;
  1518. this.node.getChildByName("ControlInfo").active = false;
  1519. },
  1520. // 控制数据
  1521. onSubSendControlInfo(data) {
  1522. // return;
  1523. if(BaseDefine.LOCALTEST && this._showControl) {
  1524. Global.print(data);
  1525. this.node.getChildByName("ControlInfo").active = true;
  1526. this._controlInfo = data;
  1527. this.showControlInfo();
  1528. }
  1529. },
  1530. showControlInfo() {
  1531. const infoNode = cc.find("ControlInfo/info", this.node);
  1532. if(!infoNode.active) return;
  1533. let data = this._controlInfo;
  1534. let txt = `<b>`
  1535. + `<color=#ffffff>房间杀率:${parseFloat(data.RoomSha/100.0).toFixed(2)}%</c> `
  1536. + `<color=#ffffff>触发系统赢:${parseFloat(data.RoomWin/100.0).toFixed(2)}%</c> `
  1537. + `<color=#ffffff>触发系统输:${parseFloat(data.RoomLost/100.0).toFixed(2)}%</c>\n`
  1538. + (
  1539. (!!data.IsDanKong) ? (
  1540. `<color=#ffffff>单控有</c> `
  1541. + `<color=#ffffff>单控玩家${(data.DanType==1)? "输" : ((data.DanType==2)? "赢": "无")}</c> `
  1542. + `<color=#ffffff>随到${data.RoomSuiRate}%</c> `
  1543. + `<color=#ffffff>玩家: ${data.szNickName}</c> `
  1544. + `<color=#ffffff>门槛: ${data.DanMinBet}</c>`
  1545. ): (
  1546. (!!data.QunState) ? (
  1547. `<color=#ffffff>群控${(data.RoomResult==1)? "系统赢" : ((data.RoomResult==2)? "系统输": "无控制")}</c>`
  1548. + `<color=#ffffff>随到概率${parseFloat(data.RoomSuiRate/100.0).toFixed(2)}%</c>\t`
  1549. ): (
  1550. `<color=#ffffff>单控无, 群控无</c>`
  1551. )
  1552. )
  1553. )
  1554. + `<color=#ffffff> 控制值${data.cbControlValue}</c>`
  1555. infoNode.getChildByName("label").getComponent(cc.RichText).string = txt;
  1556. },
  1557. // onSocketHorseMessage(data) {
  1558. // if(cc.vv.config.ReviewApk) {return;}
  1559. // Global.print(data)
  1560. // var str = data.szMessage;
  1561. // var list = str.split('##');
  1562. // if(this.getGameKind() == list[0]) {
  1563. // var rewardTxt = ['', 'jackpot'];
  1564. // var gameinfo = GameConstant.getGameUiInfoByKindId(list[0]);
  1565. // var sstr = `Jogador ${list[2]} no jogo ${gameinfo.en_name}, ganhou o prêmio ${rewardTxt[list[1]]}, ganha $${(list[3]/100).toFixed(2)}`;
  1566. // this.marqueueArr.push(sstr);
  1567. // if(this.delayMarqueueTime <= 0) {
  1568. // this.showNextMar();
  1569. // }
  1570. // }
  1571. // },
  1572. onRefreshJackpot(data){
  1573. if(!this.roomData) return;
  1574. let jackpotID = this.roomData.JackpotID;
  1575. let aimId = jackpotID[0][0];
  1576. let num = cc.vv.serverListData.getRewardInfoDataById(aimId).Num;
  1577. this.gameConfig.lJackPot = num;
  1578. this.updateJackpot(this.gameConfig);
  1579. let history = cc.vv.serverListData.getRewardInfoDataById(this.roomData.ServerID).History;
  1580. this.jackpotRecord = history;
  1581. if(this.jackpotRecord.length == 0) return; //没有记录就不展示
  1582. if(!this.bTriggerJackpot){ //第一次赋值
  1583. this.bTriggerJackpot = true;
  1584. this.rightJackpotNode.active = true;
  1585. let info = this.jackpotRecord[this.nowShowIdx];
  1586. this.setItemInfos(this.rightJackpotPlayer1, info);
  1587. this.rightJackpotPlayer1.y = 0;
  1588. this.rightJackpotPlayer2.y = -60;
  1589. this.delayNextTime = ShowNextJackpotTime;
  1590. }
  1591. },
  1592. //构造数据
  1593. makeDataToGameConfig(){
  1594. if(!this.roomData) return;
  1595. this.gameConfig.nJetton = this.roomData.Bet;
  1596. // this.gameConfig.lJackPot = 1020;
  1597. this.curBetIndex = 0;
  1598. this.bets = this.gameConfig.nJetton;
  1599. this.refrushBet();
  1600. // this.updateJackpot(this.gameConfig);
  1601. this.rollPanel.forceStop();
  1602. },
  1603. onEventSceneMessage(gameStatus,lookonUser,data) {
  1604. Global.print("GameSence onEventSceneMessage 场景消息 ");
  1605. var arr = new DataView(data.slice(0, 8));
  1606. var dataView = new DataView(data.slice(8));
  1607. var msgHead = { m: arr.getUint16(4, true), s: arr.getUint16(6, true), d: null };
  1608. arr = null;
  1609. this.gameConfig = AnalyzeXieYi.analyze_GameConfig(dataView);
  1610. Global.print(this.gameConfig);
  1611. this.bets = this.gameConfig.nJetton;
  1612. this.curBetIndex = 0;
  1613. this.refrushBet();
  1614. this.updateJackpot(this.gameConfig);
  1615. this.rollPanel.forceStop();
  1616. },
  1617. onEventGameMessage(data) {
  1618. var arr = new DataView(data.slice(0, 8));
  1619. var dataView = new DataView(data.slice(8));
  1620. var msgHead = { m: arr.getUint16(4, true), s: arr.getUint16(6, true), d: null };
  1621. arr = null;
  1622. // Global.print(msgHead)
  1623. var msg = AnalyzeXieYi.analyzeData(msgHead.m, msgHead.s, dataView);
  1624. switch (msgHead.s) {
  1625. case GameProtocol.SUB_S_REBACK_LOTTERY: { // 操作记录
  1626. Global.print("SGLB::结果");
  1627. this.onRollEndInfo(msg);
  1628. }
  1629. break;
  1630. case GameProtocol.SUB_S_JACKPOT_RESET: { // 操作记录
  1631. Global.print("JACKPOT");
  1632. this.updateJackpot(msg);
  1633. }
  1634. break;
  1635. case GameProtocol.SUB_S_SEND_CONTROL_INFO: {
  1636. Global.print("SUB_S_SEND_CONTROL_INFO");
  1637. this.onSubSendControlInfo(msg);
  1638. }
  1639. break;
  1640. default: {
  1641. Global.print("SGLBGameSence onEventGameMessage error ");
  1642. }
  1643. break;
  1644. }
  1645. },
  1646. getNeedShowValue(val) {
  1647. let str = ''+val;
  1648. if(val < 100) {
  1649. if(val < 10) {
  1650. str = '00'+val;
  1651. }else{
  1652. str = '0'+val;
  1653. }
  1654. }
  1655. return str;
  1656. },
  1657. updateJackpot(data) {
  1658. Global.print("JACKPOT:"+JSON.stringify(data));
  1659. //初始 或者 被人爆了jackpot
  1660. if((this.jackpotScore == -1) || (this.jackpotScore > data.lJackPot)) {
  1661. let des = this.getNeedShowValue(data.lJackPot).split('');
  1662. let k = des.length-1;
  1663. for(let i = 8; i >= 0; --i,--k) {
  1664. let ln = this.jackpotNums[i];
  1665. if(ln) {
  1666. if(k >= 0) {
  1667. ln.active = true;
  1668. // this.roll2Num(ln, des[k], 1-i*0.05);
  1669. let info = this.jackpotNumPositionY[des[k]];
  1670. ln.y = info.y1;
  1671. }else{
  1672. ln.active = false;
  1673. }
  1674. }
  1675. }
  1676. }else{ //播放动画
  1677. let des = this.getNeedShowValue(data.lJackPot).split('');
  1678. let k = des.length-1;
  1679. for(let i = 8; i >= 0; --i,--k) {
  1680. let ln = this.jackpotNums[i];
  1681. if(ln) {
  1682. if(k >= 0) {
  1683. ln.active = true;
  1684. this.roll2Num(ln, des[k], 1-i*0.1);
  1685. }else{
  1686. ln.active = false;
  1687. }
  1688. }
  1689. }
  1690. }
  1691. this.jackpotScore = data.lJackPot;
  1692. },
  1693. roll2Num(node, num, times) {
  1694. let y = node.y;
  1695. let dYs = this.jackpotNumPositionY[num];
  1696. let dy = dYs.y1;
  1697. if(y > dy) {
  1698. dy = dYs.y2;
  1699. }
  1700. node.stopAllActions();
  1701. cc.tween(node)
  1702. .to(times, {y: dy})
  1703. .call(()=>{
  1704. node.y = dYs.y1;
  1705. })
  1706. .start()
  1707. },
  1708. showDebugRewardInfo() {
  1709. let count = this.gameEndData.m_line_count;
  1710. let lineid = this.gameEndData.m_line_id;
  1711. let str = "中奖信息:" + count + "条线[";
  1712. for(let i = 0; i < count; ++i) {
  1713. str += (lineid[i]+1) + ',';
  1714. }
  1715. str += ']';
  1716. str += this.gameEndData.m_kongming == 1 ? "\n中免费次数" : "";
  1717. const infoNode = cc.find("ControlInfo/info", this.node);
  1718. infoNode.getChildByName("reward").getComponent(cc.RichText).string = str;
  1719. },
  1720. onEventGameRecord(data) {
  1721. let dd = AnalyzeXieYi.analyze_Record(data);
  1722. this._gameRecords.push(dd);
  1723. this.addOneRecord(dd);
  1724. // if(this._gameRecords.length >= 60) {
  1725. // this.showRecordsPanel();
  1726. // }
  1727. },
  1728. onEventJackpotRecord(data) {
  1729. let dd = AnalyzeXieYi.analyze_JackpotRecord(data);
  1730. this.jackpotRecord.push(dd);
  1731. Global.print(dd);
  1732. if(this.jackpotRecord.length == 1) {
  1733. this.showWithNowIdx();
  1734. }
  1735. },
  1736. onSocketHorseMessage(data) {
  1737. this._super(data);
  1738. this.rightJackpotPanel.active = false;
  1739. this.jackpotRecord.splice(0);
  1740. this.nowShowIdx = 0;
  1741. this.getJackpotRecord();
  1742. },
  1743. updateMarqueue(dt) {
  1744. if(this.delayMarqueueTime > 0) {
  1745. this.delayMarqueueTime -= dt;
  1746. let noticeNode = this.node.getChildByName("notice1");
  1747. let noticeLabel = noticeNode.getChildByName("Mask").getChildByName("label_notice");
  1748. noticeLabel.x -= dt*100;
  1749. if(noticeLabel.x + noticeLabel.width < -300) {
  1750. noticeNode.active = false;
  1751. }
  1752. }else{
  1753. if(this.marqueueArr.length <= 0) {
  1754. this.node.getChildByName("notice1").active = false;
  1755. return;
  1756. }
  1757. this.showNextMar();
  1758. }
  1759. },
  1760. showWithNowIdx() {
  1761. if(this.jackpotRecord.length <= 0) {
  1762. return;
  1763. }
  1764. if(this.nowShowIdx >= this.jackpotRecord.length) {
  1765. this.nowShowIdx = 0;
  1766. }
  1767. this.rightJackpotNode.active = true;
  1768. let info = this.jackpotRecord[this.nowShowIdx];
  1769. this.setItemInfos(this.rightJackpotPlayer1, info);
  1770. this.rightJackpotPlayer1.y = 0;
  1771. this.rightJackpotPlayer2.y = -60;
  1772. this.delayNextTime = ShowNextJackpotTime;
  1773. },
  1774. jumpNextJackpot() {
  1775. //小于两条 不滚动
  1776. if(this.jackpotRecord.length < 2) {
  1777. return;
  1778. }
  1779. this.nowShowIdx++;
  1780. if(this.nowShowIdx >= this.jackpotRecord.length) {
  1781. this.nowShowIdx = 0;
  1782. }
  1783. let info = this.jackpotRecord[this.nowShowIdx];
  1784. let node1 = null;
  1785. let node2 = null;
  1786. if(this.rightJackpotPlayer1.y > this.rightJackpotPlayer2.y) {
  1787. node1 = this.rightJackpotPlayer1;
  1788. node2 = this.rightJackpotPlayer2;
  1789. }else{
  1790. node1 = this.rightJackpotPlayer2;
  1791. node2 = this.rightJackpotPlayer1;
  1792. }
  1793. this.setItemInfos(node2, info);
  1794. node1.stopAllActions();
  1795. node2.stopAllActions();
  1796. cc.tween(node1)
  1797. .to(1, {y: 60})
  1798. .call(()=>{
  1799. node1.y = -60;
  1800. })
  1801. .start()
  1802. cc.tween(node2)
  1803. .to(1, {y: 0})
  1804. .start()
  1805. this.delayNextTime = ShowNextJackpotTime;
  1806. },
  1807. setItemInfos(node, info) {
  1808. if(!node || !info) {
  1809. return;
  1810. }
  1811. node.active = true;
  1812. /*
  1813. node.getChildByName("head").getChildByName("spr").getComponent(cc.Sprite).spriteFrame = cc.vv.globalUserInfo.getHeadSpriteFrameByFaceID(info.cbFaceID);
  1814. node.getChildByName("name").getComponent(cc.Label).string = info.szNickName;
  1815. node.getChildByName("score").getComponent(cc.Label).string = 'R$'+Global.formatString2Score(info.lLotteryMoney);
  1816. */
  1817. node.getChildByName("head").getChildByName("spr").getComponent(cc.Sprite).spriteFrame = cc.vv.globalUserInfo.getHeadSpriteFrameByFaceID(info.FaceID);
  1818. node.getChildByName("name").getComponent(cc.Label).string = info.NickName;
  1819. node.getChildByName("score").getComponent(cc.Label).string = 'R$:'+Global.formatString2Score(info.Value);
  1820. },
  1821. onClickShowJackpotUser() {
  1822. this.rightJackpotPanel.active = true;
  1823. this.rightJackpotPanel.getChildByName("mark").active = true;
  1824. for(let i = 0; i < 10; ++i) {
  1825. let item = null;
  1826. if(i >= this.rightJackPotContent.childrenCount) {
  1827. item = cc.instantiate(this.rightJackPotClone);
  1828. item.parent = this.rightJackPotContent;
  1829. }else{
  1830. item = this.rightJackPotContent.children[i];
  1831. }
  1832. if(item) {
  1833. let info = this.jackpotRecord[i];
  1834. if(info) {
  1835. this.setItemInfos(item, info);
  1836. }else{
  1837. item.active = false;
  1838. }
  1839. }
  1840. }
  1841. this.rightJackPotShowNode.stopAllActions();
  1842. this.rightJackPotShowNode.scaleY = 0;
  1843. cc.tween(this.rightJackPotShowNode)
  1844. .to(0.07, {scaleY:1})
  1845. .start()
  1846. },
  1847. onClickHideJackpotUser() {
  1848. this.rightJackpotPanel.getChildByName("mark").active = false;
  1849. this.rightJackPotShowNode.stopAllActions();
  1850. this.rightJackPotShowNode.scaleY = 1;
  1851. cc.tween(this.rightJackPotShowNode)
  1852. .to(0.07, {scaleY:0})
  1853. .call(()=>{
  1854. this.rightJackpotPanel.active = false;
  1855. })
  1856. .start()
  1857. },
  1858. backHome: function() {
  1859. if (CServerItem.get()) {
  1860. CServerItem.get().PerformStandUpAction(1);
  1861. } else {
  1862. this.exitGame();
  1863. }
  1864. this._backHome = true;
  1865. ScenceManager.Instance().gameBackScence();
  1866. GameManagerBase.Instance().setInGameServerID(-1);
  1867. },
  1868. exitGameWhenPlaying() {
  1869. if(!this._gameEnd || this._nFreeCount > 0) {
  1870. topTipMsg.showTopTipMsg(LanguageKey.t("pubWords.not_exit_game"));
  1871. return;
  1872. }
  1873. if(cc.vv.config.ReviewApk) {
  1874. cc.game.end();
  1875. return;
  1876. }
  1877. /*
  1878. this.goldGameLeave();
  1879. */
  1880. this._backHome = true;
  1881. cc.sys.localStorage.setItem("InGameServerID", -1);
  1882. this.removeMsgListener();
  1883. ScenceManager.Instance().gameBackScence();
  1884. // this.backHome();
  1885. // this.exitGame();
  1886. },
  1887. onRollEndInfo(data) {
  1888. console.log('雷神:', data);
  1889. //数据改造
  1890. for(let i=0; i < data.m_result_data.length; i++){
  1891. //m_desk_data服务器从1开始,客户端需要从0开始
  1892. for(let j=0; j < data.m_result_data[i].m_desk_data.length; j++){
  1893. if(data.m_result_data[i].m_desk_data[j] >= 1){
  1894. data.m_result_data[i].m_desk_data[j] -= 1;
  1895. }
  1896. }
  1897. //m_item_id服务器从1开始,客户端需要从0开始
  1898. for(let k=0; k < data.m_result_data[i].m_item_id.length; k++){
  1899. if(data.m_result_data[i].m_item_id[k] >= 1){
  1900. data.m_result_data[i].m_item_id[k] -= 1;
  1901. }
  1902. }
  1903. }
  1904. this.gameEndData = data;
  1905. // if(this._nFreeCount > 0) {
  1906. // this.upFreeCount();
  1907. // }else{
  1908. // this._nFreeTotal = 0;
  1909. // this.allWinScore = 0;
  1910. // }
  1911. // this._nFreeCount = data.cbFreeTime;
  1912. // this._nFreeTotal += data.cbFreeAdd;
  1913. // this._bFreeState = data.m_kongming;
  1914. this.rollPanel.setRollDatas(data);
  1915. this.rollPanel.openPrizes(false, this._bQuickGame);
  1916. //更新玩家金币
  1917. cc.vv.globalUserInfo.setUserScore(data.lCurScore);
  1918. this._lastScore = data.lCurScore;
  1919. this.showDebugRewardInfo();
  1920. },
  1921. makeXieYi(m,s,data) {
  1922. if(m == ProtocolGameServer.MDM_GF_FRAME) {
  1923. return //new DataView(arrayBuffer)
  1924. }
  1925. return MakeXieYi.makeRoll(data);
  1926. },
  1927. onSendRoll() {
  1928. /*
  1929. // this.testResult();
  1930. // return;
  1931. let t = {};
  1932. t.nJetton = this.gameConfig.nJetton[this.curBetIndex];
  1933. // Global.print(t);
  1934. this.SendGameSocketData(GameProtocol.SUB_C_LOTTERY, t);
  1935. */
  1936. setTimeout(()=>{
  1937. let _data = {'CMD':ProtocolLoginServer.CMD_C2S_Game_RollOLYMPUS,
  1938. 'Value':this.gameConfig.nJetton[this.curBetIndex],
  1939. 'RoomID':this.roomData.ServerID
  1940. };
  1941. cc.vv.netSocket.send(JSON.stringify(_data));
  1942. }, 500);
  1943. },
  1944. upLeftCount() {
  1945. this.freeLeftNode.active = this._bSpecialGame;
  1946. if(this._bSpecialGame) {
  1947. this.freeLeftNode.getChildByName("left").getComponent(cc.Label).string = this._nFreeCount + '/' + this._nFreeTotal;
  1948. }
  1949. },
  1950. upFreeCount() {
  1951. let funcNode = this.node.getChildByName("FuncBtnNode");
  1952. let left = funcNode.getChildByName("btn_left");
  1953. left.active = this._nFreeCount > 0;
  1954. left.getChildByName("left").getComponent(cc.Label).string = (this._nFreeCount-1) + '/' + this._nFreeTotal;
  1955. // this.upBtnInteractable(funcNode.getChildByName("btn_auto"), false);
  1956. },
  1957. judgeCannotRollGame() {
  1958. if(!cc.vv.netSocket.bNowOpend())
  1959. return false;
  1960. //下注配置为空
  1961. if(!this.bets || !this.gameConfig || !this.gameConfig.nJetton || this.curBetIndex == null) {
  1962. return false;
  1963. }
  1964. if(this._nFreeCount > 0) {
  1965. return true;
  1966. }
  1967. //检测钱是否够用
  1968. if(this._lastScore < Global.unify(this.bets[this.curBetIndex])) {
  1969. this.showLowLackMoney();
  1970. return false;
  1971. }
  1972. this._currentScore = this._lastScore - Global.unify(this.bets[this.curBetIndex]);
  1973. this.upPlayerScore(this._currentScore);
  1974. return true;
  1975. },
  1976. onStartRoll() {
  1977. // if(!this._gameEnd) return;
  1978. this.node.stopAllActions();
  1979. this.resetGameView();
  1980. if(this.playingEffectID != -1) {
  1981. cc.vv.audioMgr.stopSFX(this.playingEffectID);
  1982. }
  1983. //是否可以开始游戏
  1984. if(!this.judgeCannotRollGame()) {
  1985. return;
  1986. }
  1987. this._gameEnd = false;
  1988. this.changeGameState(1);
  1989. // if(!cc.vv.audioMgr.resumeBackMusic()) {
  1990. // cc.vv.audioMgr.playBGM("bgm");
  1991. // }
  1992. // this.upLeftCount();
  1993. this.onSendRoll();
  1994. this.showCenterNormal();
  1995. this.onGameStart();
  1996. this.rollPanel.startRollActions();
  1997. this.playEffect('shuax');
  1998. },
  1999. resetGameView() {
  2000. this.hideResultPanel();
  2001. this.node.getChildByName("freeWin").active = false;
  2002. },
  2003. resetAllBtn() {
  2004. if(this._bAutoGame || this._bSpecialGame) return;
  2005. this.upBtnInteractable(this.startBtn, true);
  2006. this.upBetAddOrDelState();
  2007. },
  2008. onGameStart() {
  2009. this.upBtnInteractable(this.startBtn, false);
  2010. this.upBtnInteractable(this.addBtn, false);
  2011. this.upBtnInteractable(this.delBtn, false);
  2012. },
  2013. showGameEnd() {
  2014. this._gameEnd = true;
  2015. this.changeGameState(2);
  2016. Global.print('showGameEnd')
  2017. // this.freeLeftNode.active = this._nFreeCount > 0;
  2018. //获得免费次数
  2019. if(this._bFreeState == 1) {
  2020. // cc.vv.audioMgr.pauseBackMusic();
  2021. this.showGetFreeTimes(this.gameEndData.cbFreeAdd);
  2022. }else if(this.winAniIdx < 0 || this._bSpecialGame){
  2023. Global.print('delayStartNextRoll')
  2024. this.delayStartNextRoll(0.1);
  2025. }
  2026. },
  2027. onClickSkip() {
  2028. this.playButtonEffect();
  2029. let scoreNode = this.resultNode.getChildByName("mask").getChildByName("scoreNode");
  2030. this.skipScoreAdd(scoreNode.getChildByName("score").getComponent(cc.Label),scoreNode.getChildByName("score2").getComponent(cc.Label))
  2031. },
  2032. showResultPanel() {
  2033. let ssNodeY = [-44,-103,-103,-150,-150];
  2034. this.changeGameState(3);
  2035. this.resultNode.active = true;
  2036. let node = this.resultNode.getChildByName("mask");
  2037. let goldNode = node.getChildByName("goldani");
  2038. let ssNode = node.getChildByName("scoreNode");
  2039. let sNode = ssNode.getChildByName("score");
  2040. let sNode2 = ssNode.getChildByName("score2");
  2041. let sLabel = sNode.getComponent(cc.Label);
  2042. let sLabel2 = sNode2.getComponent(cc.Label);
  2043. let aniNode1 = node.getChildByName("wani");
  2044. aniNode1.active = true;
  2045. goldNode.active = true;
  2046. ssNode.active = false;
  2047. let anii = aniNode1.getComponent(sp.Skeleton);
  2048. anii.skeletonData = this.winSpineData[this.winAniIdx];
  2049. if(this.winAniIdx >= 0) {
  2050. //金币动画
  2051. let gAni = goldNode.getComponent(sp.Skeleton);
  2052. // gAni.clearTracks();
  2053. // gAni.setAnimation(0, 'a'+(this.winAniIdx>3?3:this.winAniIdx), true);
  2054. gAni.setAnimation(0, 'a'+(this.winAniIdx+1>5?5:this.winAniIdx+1), true);
  2055. if(this.winAniIdx > 2) {
  2056. this.playJackpotAni();
  2057. }
  2058. }else{
  2059. goldNode.active = false;
  2060. }
  2061. // this.playJackpotAni();
  2062. this.isPlayingScoreAddAni = true;
  2063. //win动画
  2064. anii.clearTracks();
  2065. anii.setAnimation(0, "a1", false);
  2066. anii.addAnimation(0, "a2", true);
  2067. this.resultNode.stopAllActions();
  2068. cc.tween(this.resultNode)
  2069. .delay(0.3)
  2070. .call(()=>{
  2071. if(this.winAniIdx>=0 && this.winAniIdx<ssNodeY.length)
  2072. ssNode.y = ssNodeY[this.winAniIdx];
  2073. ssNode.active = true;
  2074. sLabel.string = '0';
  2075. sLabel2.string = '.00';
  2076. this.playScoreAddAni(sLabel, sLabel2);
  2077. })
  2078. .start()
  2079. },
  2080. playScoreAddAni(sLabel, sLabel2) {
  2081. let start = 0;
  2082. let bet = this.gameConfig.nJetton[this.curBetIndex];
  2083. let endScore = Global.formatString2Score(this.needPlayinfScore);
  2084. let add = parseFloat(bet/100);
  2085. this.upScoreLabel1 = ()=>{
  2086. start += add;
  2087. if(start >= endScore) {
  2088. this.skipScoreAdd(sLabel, sLabel2);
  2089. }else{
  2090. sLabel.string = Math.floor(start);
  2091. sLabel2.string = ((parseFloat(start - Math.floor(start)).toFixed(2)).toString()).slice(1);
  2092. }
  2093. }
  2094. if(this.upScoreLabel1) {
  2095. this.unschedule(this.upScoreLabel1);
  2096. }
  2097. this.schedule(this.upScoreLabel1, 0.01);
  2098. },
  2099. skipScoreAdd(sLabel, sLabel2) {
  2100. this.isPlayingScoreAddAni = false;
  2101. if(this.upScoreLabel1) {
  2102. this.unschedule(this.upScoreLabel1);
  2103. }
  2104. let score = Global.formatString2Score(this.needPlayinfScore);
  2105. sLabel.string = Math.floor(score);
  2106. sLabel2.string = ((parseFloat(score - Math.floor(score)).toFixed(2)).toString()).slice(1);
  2107. this.delayStartNextRoll(0.6);
  2108. },
  2109. hideResultPanel() {
  2110. this.resultNode.active = false;
  2111. },
  2112. changeGameState(state) {
  2113. this._gameState = state;
  2114. },
  2115. upBetAddOrDelState() {
  2116. this.upBtnInteractable(this.delBtn, this.curBetIndex>0);
  2117. this.upBtnInteractable(this.addBtn, this.curBetIndex<this.bets.length-1);
  2118. },
  2119. upBtnInteractable(btn, state) {
  2120. btn.getComponent(cc.Button).interactable = state;
  2121. },
  2122. onClickResultMask() {
  2123. if(this.isPlayingScoreAddAni) {
  2124. this.onClickSkip();
  2125. }else{
  2126. this.hideResultPanel();
  2127. }
  2128. },
  2129. addGameWinScore(score) {
  2130. this.allWinScore += score;
  2131. this.playinfScore = this.allWinScore;
  2132. this.winScoreLabel.string = (this.allWinScore/100).toFixed(2);
  2133. },
  2134. playAddScoreMulti(scoreNode, multi, idx) {
  2135. let node = cc.instantiate(scoreNode);
  2136. scoreNode.active = false;
  2137. node.active = true;
  2138. let startPos = cc.v2(scoreNode.parent.parent.parent.x, scoreNode.parent.parent.y);
  2139. node.position = startPos;
  2140. node.parent = this.node;
  2141. cc.tween(node)
  2142. .delay(1.2*idx+0.3)
  2143. .call(()=>{
  2144. this.playEffect('qiufly')
  2145. })
  2146. .to(0.7, {y: startPos.y+10, scale: 1.5})
  2147. .to(0.5, {position: cc.v2(0, -328)})
  2148. .call(()=>{
  2149. node.active = false;
  2150. if(idx == 0) {
  2151. this.playEndScoreAdd(multi-1);
  2152. }else{
  2153. this.playEndScoreAdd(multi);
  2154. }
  2155. node.destroy();
  2156. })
  2157. .start()
  2158. },
  2159. playEndScoreAdd(multi) {
  2160. let startScore = this.playinfScore;
  2161. let endScore = this.playinfScore + this.allWinScore * multi;
  2162. let add = Math.floor((endScore - startScore) / 20);
  2163. if(add <= 0) {
  2164. add = 1;
  2165. }
  2166. if(this.upScoreLabel) {
  2167. this.unschedule(this.upScoreLabel);
  2168. }
  2169. this.upScoreLabel = ()=>{
  2170. startScore += add;
  2171. if(startScore >= endScore) {
  2172. // this.skipScoreAdd(sLabel, sLabel2);
  2173. this.unschedule(this.upScoreLabel);
  2174. this.playinfScore = endScore;
  2175. this.winScoreLabel.string = (endScore/100).toFixed(2);
  2176. }else{
  2177. this.winScoreLabel.string = (startScore/100).toFixed(2);
  2178. }
  2179. }
  2180. this.schedule(this.upScoreLabel, 0.01);
  2181. },
  2182. showGameWinScore() {
  2183. this.winAniIdx = -1;
  2184. this.needPlayinfScore = this.gameEndData.m_lottery_size;
  2185. let score = this.gameEndData.m_lottery_size;
  2186. // if(this.gameEndData.m_deposit_lotttery > 0) { //彩金池
  2187. // this.winAniIdx = 4;
  2188. // this.needPlayinfScore = this.gameEndData.m_deposit_lotttery;
  2189. // this.winScoreLabel.string = Global.formatString2Score(this.needPlayinfScore + this.gameEndData.m_lottery_size);
  2190. // this.playEffectByID(4);
  2191. // this.showResultPanel();
  2192. // return;
  2193. // }
  2194. let timers = score / this.gameConfig.nJetton[this.curBetIndex];
  2195. this._currentScore = this._lastScore;
  2196. this.upPlayerScore(this._currentScore);
  2197. if(score <= 0){
  2198. this.showGameEnd();
  2199. return;
  2200. }
  2201. this.playSoundByTimes(timers);
  2202. this.winScoreLabel.string = (this.needPlayinfScore/100).toFixed(2)//Global.formatString2Score(this.needPlayinfScore);
  2203. if(this.winAniIdx >= 0) {
  2204. this.showResultPanel();
  2205. }
  2206. this.showGameEnd();
  2207. },
  2208. delayStartNextRoll(delayTime) {
  2209. //delayTime = 0; //策划想快一点,取消延迟
  2210. // if(!this._bSpecialGame) {
  2211. // this._nFreeTotal = 0;
  2212. // this.freeLeftNode.active = false;
  2213. // }
  2214. this.changeGameState(0);
  2215. // this.resetAllBtn();
  2216. this.node.stopAllActions();
  2217. cc.tween(this.node)
  2218. .delay(delayTime)
  2219. .call(()=>{
  2220. if(this._bAutoGame){ //自动游戏时
  2221. this.onStartRoll();
  2222. }else{
  2223. this.upBtnInteractable(this.startBtn, true);
  2224. this.resetAllBtn();
  2225. }
  2226. })
  2227. .start()
  2228. },
  2229. playJackpotAni() {
  2230. this.delayShowJackpotSweepTime += 5;
  2231. this.jackpotAni.clearTracks();
  2232. this.jackpotAni.setAnimation(0, 'a2', false);
  2233. // this.jackpotAni.addAnimation(0, 'a1', true);
  2234. },
  2235. showGetFreeTimes(times) {
  2236. this.playEffect("freeget");
  2237. let freeNode = this.node.getChildByName("freeNode");
  2238. let aniNode = freeNode.getChildByName("mask");
  2239. freeNode.active = true;
  2240. this._bSpecialGame = true;
  2241. let ani = aniNode.getChildByName("ani").getComponent(sp.Skeleton);
  2242. ani.clearTracks();
  2243. ani.setAnimation(0, "a1", false);
  2244. let sstr = aniNode.getChildByName("s");
  2245. sstr.getComponent(cc.Label).string = times;
  2246. sstr.stopAllActions();
  2247. // sstr.angle = 0;
  2248. sstr.active = false;
  2249. aniNode.stopAllActions();
  2250. cc.tween(aniNode)
  2251. .delay(0.4)
  2252. .call(()=>{
  2253. sstr.active = true;
  2254. })
  2255. .delay(2)
  2256. .call(()=>{
  2257. freeNode.active = false;
  2258. this.delayStartNextRoll(0.2);
  2259. })
  2260. .start()
  2261. },
  2262. showJackpotWin(score) {
  2263. this.needPlayinfScore = score;
  2264. this.playEffectByID(4);
  2265. this.playJackpotAni();
  2266. let winNode = this.node.getChildByName("freeWin");
  2267. winNode.active = true;
  2268. let node = winNode.getChildByName("mask");
  2269. let scoreNode = node.getChildByName("Node").getChildByName("score1");
  2270. let scoreNode1 = node.getChildByName("Node").getChildByName("score2");
  2271. scoreNode.stopAllActions();
  2272. scoreNode1.stopAllActions();
  2273. scoreNode.active = true;
  2274. scoreNode1.active = true;
  2275. let scoreLabel = scoreNode.getComponent(cc.Label);
  2276. let scoreLabel1 = scoreNode1.getComponent(cc.Label);
  2277. scoreLabel.string = '0';
  2278. scoreLabel1.string = '.00';
  2279. let ani = node.getComponent(sp.Skeleton);
  2280. ani.clearTracks();
  2281. ani.setAnimation(0, "a1", false);
  2282. this.isPlayingScoreAddAni = true;
  2283. ani.setCompleteListener(()=>{
  2284. ani.setCompleteListener(null)
  2285. ani.setAnimation(0, "a2", true);
  2286. scoreNode.active = true;
  2287. scoreNode1.active = true;
  2288. this.playFreeWinAddAni(scoreNode.getComponent(cc.Label),scoreNode1.getComponent(cc.Label));
  2289. })
  2290. },
  2291. hideJackpotWin() {
  2292. // this.playButtonEffect();
  2293. let winNode = this.node.getChildByName("freeWin");
  2294. winNode.stopAllActions();
  2295. winNode.active = false;
  2296. this.rollPanel.resumeShowPrizes();
  2297. },
  2298. onClickJackpotMask() {
  2299. if(this.isPlayingScoreAddAni) {
  2300. this.onClickSkipFreeWin();
  2301. }else{
  2302. this.hideJackpotWin();
  2303. }
  2304. },
  2305. onClickSkipFreeWin() {
  2306. // this.playButtonEffect();
  2307. if(this.isPlayingScoreAddAni) {
  2308. let winNode = this.node.getChildByName("freeWin").getChildByName("mask").getChildByName("Node");
  2309. this.skipFreeWinAdd(winNode.getChildByName("score1").getComponent(cc.Label),winNode.getChildByName("score2").getComponent(cc.Label));
  2310. }else{
  2311. this.hideJackpotWin();
  2312. }
  2313. // let winNode = this.node.getChildByName("freeWin").getChildByName("mask").getChildByName("Node");
  2314. // this.skipFreeWinAdd(winNode.getChildByName("score1").getComponent(cc.Label),winNode.getChildByName("score2").getComponent(cc.Label));
  2315. },
  2316. onClickFreeWinStart() {
  2317. },
  2318. playFreeWinAddAni(sLabel, sLabel1) {
  2319. sLabel.string = '0';
  2320. sLabel1.string = '.00';
  2321. let start = 0;
  2322. let bet = this.gameConfig.nJetton[this.curBetIndex];
  2323. let endScore = Global.formatString2Score(this.needPlayinfScore);
  2324. let add = parseFloat(bet/100);
  2325. if(add <= 0) {
  2326. add = 1;
  2327. }
  2328. if(this.upFreeWinLabel) {
  2329. this.unschedule(this.upFreeWinLabel);
  2330. }
  2331. this.upFreeWinLabel = ()=>{
  2332. start += add;
  2333. if(start >= endScore) {
  2334. this.skipFreeWinAdd(sLabel, sLabel1);
  2335. }else{
  2336. // sLabel.string = parseFloat(start).toFixed(2);
  2337. sLabel.string = Math.floor(start);
  2338. sLabel1.string = ((parseFloat(start - Math.floor(start)).toFixed(2)).toString()).slice(1);
  2339. }
  2340. }
  2341. if(this.upFreeWinLabel) {
  2342. this.unschedule(this.upFreeWinLabel);
  2343. }
  2344. this.schedule(this.upFreeWinLabel, 0.01);
  2345. },
  2346. skipFreeWinAdd(sLabel, sLabel1) {
  2347. if(this.upFreeWinLabel) {
  2348. this.unschedule(this.upFreeWinLabel);
  2349. }
  2350. this.isPlayingScoreAddAni = false;
  2351. let score = Global.formatString2Score(this.needPlayinfScore);
  2352. sLabel.string = Math.floor(score);
  2353. sLabel1.string = ((parseFloat(score - Math.floor(score)).toFixed(2)).toString()).slice(1);
  2354. if(this._bAutoGame) {
  2355. cc.tween(this.node.getChildByName("freeWin"))
  2356. .delay(1.5)
  2357. .call(()=>{
  2358. this.hideJackpotWin();
  2359. })
  2360. .start()
  2361. }
  2362. },
  2363. changeFreeWinBtn(bSkip) {
  2364. let winNode = this.node.getChildByName("freeWin").getChildByName("mask");
  2365. winNode.getChildByName("btn_start").active = !bSkip;
  2366. winNode.getChildByName("btn_skip").active = bSkip;
  2367. },
  2368. changeBtnState(bEnd) {
  2369. this.startBtn.active = !bEnd;
  2370. },
  2371. refrushBet() {
  2372. this.upBetAddOrDelState();
  2373. let bet = this.bets[this.curBetIndex];
  2374. this.betNode.getChildByName("allbet").getComponent(cc.Label).string = Global.formatString2Score(bet);
  2375. },
  2376. onClickStart() {
  2377. this.playButtonEffect();
  2378. this.onStartRoll();
  2379. },
  2380. onClickQuick(event) {
  2381. this.playButtonEffect();
  2382. this._bAutoGame = !event.target.getComponent(cc.Toggle).isChecked;
  2383. this._nAutoCount = -1;
  2384. },
  2385. onClickMenu() {
  2386. this.playButtonEffect();
  2387. UIHelper.loadRes('GamePrefabs/Public/GameMenu', cc.Prefab, (prefab)=>{
  2388. if (!this._ruleNode) {
  2389. this._ruleNode = cc.instantiate(prefab);
  2390. this._ruleNode.parent = this.node.getChildByName("MenuNode");
  2391. }
  2392. this._ruleNode.getComponent("GameMenu").show();
  2393. this._ruleNode.getComponent("GameMenu").onBtnBangZhu = ()=>{
  2394. this.showRule();
  2395. }
  2396. })
  2397. },
  2398. onHideRule() {
  2399. this.ruleNode.active = false;
  2400. },
  2401. showRule() {
  2402. Global.print("展示规则");
  2403. if(this._ruleNode) {
  2404. this._ruleNode.active = false;
  2405. }
  2406. this.ruleNode.active = true;
  2407. },
  2408. onClickAdd() {
  2409. this.curBetIndex++;
  2410. this.playButtonEffect();
  2411. this.refrushBet();
  2412. },
  2413. onClickDel() {
  2414. this.curBetIndex--;
  2415. this.playButtonEffect();
  2416. this.refrushBet();
  2417. },
  2418. // getGameKind() {
  2419. // return GameConstant.KIND_ID_FRUIT9X;
  2420. // },
  2421. onClickPlayback(){
  2422. console.log('点击回放');
  2423. this.node.stopAllActions();
  2424. this.resetGameView();
  2425. if(this.playingEffectID != -1) {
  2426. cc.vv.audioMgr.stopSFX(this.playingEffectID);
  2427. }
  2428. //是否可以开始游戏
  2429. if(!this.judgeCannotRollGame()) {
  2430. return;
  2431. }
  2432. this._gameEnd = false;
  2433. this.changeGameState(1);
  2434. this.showCenterNormal();
  2435. this.onGameStart();
  2436. this.rollPanel.startRollActions();
  2437. this.playEffect('shuax');
  2438. // let str = `{"CMD":103017,"Value":{"lCurScore":770,"m_add_multi":[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],
  2439. // "m_chair_id":10989,"m_chip_size":100,"m_deposit_lotttery":0,"m_free_count":0,"m_lottery_size":75,"m_result_data":[{"m_deposit_lotttery":0,
  2440. // "m_desk_data":[1,2,2,1,3,2,2,4,5,1,3,10,11,1,4,5,2,3,8,8,9,2,1,6,1,1,7,5,1,2],"m_item_count":[8,0,0,0,0],"m_item_id":[1,0,0,0,0],
  2441. // "m_item_times":[25,0,0,0,0],"m_win_score":25},{"m_deposit_lotttery":0,"m_desk_data":[1,2,2,3,3,2,2,4,5,4,3,10,11,1,4,5,2,3,8,8,9,2,4,6,4,10,7,5,4,2],
  2442. // "m_item_count":[0,0,0,0,0],"m_item_id":[0,0,0,0,0],"m_item_times":[0,0,0,0,0],"m_win_score":0},{"m_deposit_lotttery":0,
  2443. // "m_desk_data":[0,0,0,0,0,0,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_item_count":[0,0,0,0,0],"m_item_id":[0,0,0,0,0],
  2444. // "m_item_times":[0,0,0,0,0],"m_win_score":0},{"m_deposit_lotttery":0,"m_desk_data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  2445. // "m_item_count":[0,0,0,0,0],"m_item_id":[0,0,0,0,0],"m_item_times":[0,0,0,0,0],"m_win_score":0},{"m_deposit_lotttery":0,
  2446. // "m_desk_data":[0,0,0,0,0,0,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_item_count":[0,0,0,0,0],"m_item_id":[0,0,0,0,0],
  2447. // "m_item_times":[0,0,0,0,0],"m_win_score":0},{"m_deposit_lotttery":0,"m_desk_data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  2448. // "m_item_count":[0,0,0,0,0],"m_item_id":[0,0,0,0,0],"m_item_times":[0,0,0,0,0],"m_win_score":0},{"m_deposit_lotttery":0,
  2449. // "m_desk_data":[0,0,0,0,0,0,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_item_count":[0,0,0,0,0],"m_item_id":[0,0,0,0,0],
  2450. // "m_item_times":[0,0,0,0,0],"m_win_score":0},{"m_deposit_lotttery":0,"m_desk_data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  2451. // "m_item_count":[0,0,0,0,0],"m_item_id":[0,0,0,0,0],"m_item_times":[0,0,0,0,0],"m_win_score":0},{"m_deposit_lotttery":0,
  2452. // "m_desk_data":[0,0,0,0,0,0,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_item_count":[0,0,0,0,0],"m_item_id":[0,0,0,0,0],
  2453. // "m_item_times":[0,0,0,0,0],"m_win_score":0},{"m_deposit_lotttery":0,"m_desk_data":[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],
  2454. // "m_item_count":[0,0,0,0,0],"m_item_id":[0,0,0,0,0],"m_item_times":[0,0,0,0,0],"m_win_score":0}]}}`;
  2455. let str = cc.vv.playbackData;
  2456. let tData = JSON.parse(str);
  2457. setTimeout(()=>{
  2458. this.onRollEndInfo(tData.Value);
  2459. }, 400);
  2460. },
  2461. onClickSet() {
  2462. this.playButtonEffect();
  2463. this.setPanel.active = true;
  2464. this.changeAudioBtnState();
  2465. },
  2466. onClickExit() {
  2467. if(!this._gameEnd || this._nFreeCount > 0) {
  2468. topTipMsg.showTopTipMsg(LanguageKey.t("pubWords.not_exit_game"));
  2469. return;
  2470. }
  2471. cc.game.end();
  2472. },
  2473. showCenterNormal() {
  2474. if(this._bSpecialGame) return;
  2475. this.allWinScore = 0;
  2476. this.node.getChildByName("RoomInfoNode").getChildByName("img_1").getChildByName("winNode").active = true;
  2477. this.node.getChildByName("RoomInfoNode").getChildByName("img_1").getChildByName("winNode").getChildByName("score").getComponent(cc.Label).string = "0.00"
  2478. },
  2479. onClickRule() {
  2480. this.playButtonEffect();
  2481. UIHelper.loadRes('resourcesPrefab/ruleNode', cc.Prefab, (prefab)=>{
  2482. if (!this._ruleNode) {
  2483. this._ruleNode = cc.instantiate(prefab);
  2484. this._ruleNode.parent = this.node;
  2485. }
  2486. this._ruleNode.getComponent("FruitRule").show();
  2487. })
  2488. },
  2489. upPlayerScore(score) {
  2490. cc.vv.globalUserInfo.setUserScore(score);
  2491. this.playerScore.string = Global.formatString2Score(score);
  2492. },
  2493. onUserEnter(clientUserItem) {
  2494. this._currentScore = clientUserItem.GetUserScore();
  2495. this._lastScore = this._currentScore;
  2496. this.upPlayerScore(this._lastScore);
  2497. },
  2498. upPlayerInfo(clientUserItem) {
  2499. this._lastScore = clientUserItem.GetUserScore();
  2500. },
  2501. playSoundByTimes(_times) {
  2502. if(_times <= 0) return;
  2503. Global.print("winTimes:"+_times)
  2504. let id = 1;
  2505. if(_times > 120){
  2506. id = 15;
  2507. this.winAniIdx = 3;
  2508. }else if(_times > 100){
  2509. id = 14;
  2510. this.winAniIdx = 3;
  2511. }else if(_times > 80){
  2512. id = 13;
  2513. this.winAniIdx = 3;
  2514. }else if(_times > 64){
  2515. id = 12;
  2516. this.winAniIdx = 3;
  2517. }else if(_times > 48){
  2518. id = 11;
  2519. this.winAniIdx = 3;
  2520. }else if(_times > 32){
  2521. id = 10;
  2522. this.winAniIdx = 3;
  2523. }else if(_times > 20){
  2524. id = 9;
  2525. this.winAniIdx = 3;
  2526. }else if(_times > 12){
  2527. id = 8;
  2528. this.winAniIdx = 3;
  2529. }else if(_times > 8){
  2530. id = 5;
  2531. this.winAniIdx = 2;
  2532. }else if(_times > 4){
  2533. id = 4;
  2534. this.winAniIdx = 1;
  2535. }else if(_times > 2){
  2536. id = 3;
  2537. this.winAniIdx = 0;
  2538. }else if(_times > 1){
  2539. id = 2;
  2540. this.winAniIdx = -1;
  2541. }
  2542. // this.playEffect("Level"+this.winAniIdx);
  2543. this.playEffectByID(this.winAniIdx);
  2544. },
  2545. playEffectByID(id) {
  2546. let audioC = this.audioArr[id];
  2547. if(audioC) {
  2548. this.playingEffectID = cc.vv.audioMgr.playEffectByAudioClip(audioC);
  2549. }
  2550. },
  2551. playButtonEffect(){
  2552. this.playEffect("button");
  2553. },
  2554. //播放音效
  2555. playEffect(effName, needStop = false) {
  2556. if(needStop)
  2557. cc.vv.audioMgr.stopAllEffects();
  2558. cc.vv.audioMgr.playSFX(effName);
  2559. },
  2560. });