12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454 |
- var GameBase = require("LBGameBase");
- var ProtocolGameServer = require("ProtocolGameServer");
- var GameProtocol = require("RomanGameProtocol");
- var AnalyzeXieYi = require("AnalyzeRomanXieYi");
- var MakeXieYi = require("MakeRomanXieYi");
- var Global = require("Global");
- var topTipMsg = require("topTipMsg");
- var UIHelper = require("UIHelper");
- var BaseDefine = require("BaseDefine");
- var ProtocolLoginServer = require("ProtocolLoginServer");
- var EventMgr = require("EventMgr");
- const LanguageKey = require("LanguageKey");
- import { CServerItem } from 'CServerItem'
- import GameManagerBase from 'GameManagerBase'
- import ScenceManager from 'HNScenceManager'
- // const GAME_FREE = 0; //无
- // const GAME_PLAYING = 1; //游戏中
- // const GAME_END = 2; //游戏结束
- // const GAME_PLAYSCOREING = 3; //表现分数增加中
- // const GAME_GAMEEND = 4; //游戏真正结束
- const ShowNextJackpotTime = 10;
- cc.Class({
- extends: GameBase,
- editor: {
- menu: 'Game/Roman/GameSence'
- },
- properties: {
- // rollNode: cc.Node,
- // playerScore: cc.Label,
- // recordPanel: cc.Node,
- // recordContent: cc.Node,
- // recordClone: cc.Node,
- // backPanel: cc.Node,
- // setPanel: cc.Node,
- // resultNode: cc.Node,
- // guideNode: cc.Node,
- freeLeftNode: cc.Node,
- winSpineData: [sp.SkeletonData],
- jackpotLabel: cc.Label,
- lineNode: cc.Node,
- spBg: cc.Node,
- spRollBg: cc.Node,
- sunGameNode: cc.Node,
- sun2GameNode: cc.Node,
- sunNode: cc.Node,
- winScore: cc.Label,
- scoreAni: sp.Skeleton,
- sunBtnMask: cc.Node,
- playbackNode: cc.Node, //回放按钮
- audioArr: [cc.AudioClip],
- freeWinAudio: cc.AudioClip,
- // _gameEnd: true,
- // _bQuickGame: false,
- // _bAutoGame: false,
- // _bFreeGame: false,
- // _nAutoCount: 0,
- // _nFreeCount: 0,
- // _nFreeTotal: 0,
- // _bFreeState: 0,
- // _nFreeWin: 0,
- // _currentScore: 0,
- // _lastScore: 0,
- // _nowBet: 0,
- // _playingAudioID: -1,
- // _bFirstIn: true,
- jackpotNode: cc.Node,
- jackpotNums: [cc.Node],
- rightJackpotNode: cc.Node,
- rightJackpotPlayer1: cc.Node,
- rightJackpotPlayer2: cc.Node,
- rightJackpotPanel: cc.Node,
- // rightJackPotClone: cc.Node,
- rightJackPotShowNode: cc.Node,
- rightJackPotContent: cc.Node,
- },
- onLoad () {
- this._super();
- this.sunGamePanel = this.sunGameNode.getComponent("RomanSunGame");
- this.sun2GamePanel = this.sun2GameNode.getComponent('RomanSun2Game');
- this.LG_PATH_SC = "LB-Roman/";
- this.homeBtn.active = !cc.vv.config.ReviewApk;
- this.stopBackMusicTimes = 0;
- this.nowPlayBgm = "bgm";
- this.lineNode.active = true;
- this.spBg.active = false;
- this.spRollBg.active = false;
- // this.sunGameNode.active = false;
- this.sunNode.active = false;
- this.sunBtnMask.active = false;
- this.jackpotScore = -1;
- this.jackpotNumPositionY = [
- {y1:-166, y2:198},//0
- {y1:-130, y2:234},//1
- {y1:-94, y2:271},//2
- {y1:-58, y2:307},//3
- {y1:-21, y2:344},//4
- {y1:-350, y2:15.5},//5
- {y1:-313, y2:52},//6
- {y1:-277, y2:88.5},//7
- {y1:-240, y2:124},//8
- {y1:-204.5, y2:161},//9
- ];
- let des = [0,0,0];
- let k = des.length-1;
- for(let i = 8; i >= 0; --i,--k) {
- let ln = this.jackpotNums[i];
- if(ln) {
- if(k >= 0) {
- ln.active = true;
- // this.roll2Num(ln, des[k], 1-i*0.05);
- let info = this.jackpotNumPositionY[des[k]];
- ln.y = info.y1;
- }else{
- ln.active = false;
- }
- }
- }
- this.jackpotRecord = [];
- },
- start () {
- this._super();
- let player = this.getSelfPlayer();
- if(player)
- this._lastScore = player.getUserScore();
- this.upPlayerScore(this._lastScore);
- this.allWinScore = 0;
- // this.curBetIndex = 0;
- // this._playingAudioID = -1;
- // this.upBetAddOrDelState();
- // this.addNormalButtonListener();
- // this.initStartTouchEvent();
- this.nowShowIdx = 0;
- this.delayNextTime = ShowNextJackpotTime;
- this.jackpotRecord = [];
- this.gameConfig = {}
- this.roomData = cc.vv.serverListData.getCurRoomData(); //当前房间信息.
- this.getJackpotRecord();
- this.addMsgListener();
- this.makeDataToGameConfig();
- this.bTriggerJackpot = false;
- this.onRefreshJackpot();
- this.setPlayback();
- },
- addMsgListener(){
- cc.vv.netSocket.registerEvent(ProtocolLoginServer.CMD_C2S_Game_RollRoman,this.onRollEndInfo,this);
-
- EventMgr.getInstance().registerEvent('rewardInfo', this.onRefreshJackpot, this);
- EventMgr.getInstance().registerEvent('offLineStatus', this.onOffLine, this);
- },
- removeMsgListener(){
- cc.vv.netSocket.removeEvent(ProtocolLoginServer.CMD_C2S_Game_RollRoman,this.onRollEndInfo,this);
-
- EventMgr.getInstance().removeEvent('rewardInfo', this.onRefreshJackpot, this);
- EventMgr.getInstance().removeEvent('offLineStatus', this.onOffLine, this);
- },
- onOffLine(data){
- if(data.status == 1){ //1重连成功
- let delayTimes = 0;
- delayTimes = this._gameEnd ? 0 : 3;
- this.scheduleOnce(()=>{
- this._lastScore = cc.vv.globalUserInfo.getUserScore();
- this.upPlayerScore(this._lastScore);
- this.rollPanel.forceStop();
- this.node.stopAllActions();
- this.resetGameView();
- this.resetAllBtn();
- this.changeGameState(0);
- this.onCancelAutoRoll();
- this._gameEnd = true;
- this._bAutoGame = false;
- }, delayTimes);
- }
- },
- //重写
- addNormalButtonListener() {
- UIHelper.addButtonListener(this.stopBtn, this.node, "LBGameBase", "onClickStop");
- UIHelper.addButtonListener(this.skipBtn, this.node, "LBGameBase", "onClickSkip");
- UIHelper.addButtonListener(this.quickBtn, this.node, "LBGameBase", "onClickQuick");
- UIHelper.addButtonListener(this.addBtn, this.node, "LBGameBase", "onClickAdd");
- UIHelper.addButtonListener(this.delBtn, this.node, "LBGameBase", "onClickDel");
- UIHelper.addButtonListener(this.maxBtn, this.node, "LBGameBase", "onClickMax");
- UIHelper.addButtonListener(this.stopAutoBtn, this.node, "LBGameBase", "onClickStopAuto");
-
- UIHelper.addButtonListener(this.homeBtn, this.node, "LBGameBase", "onClickMenu");
- // UIHelper.addButtonListener(this.ruleBtn, this.node, "LBGameBase", "onClickRule");
- // UIHelper.addButtonListener(this.recordBtn, this.node, "LBGameBase", "onClickRecord");
- // UIHelper.addButtonListener(this.setBtn, this.node, "LBGameBase", "onClickSet");
- // UIHelper.addButtonListener(this.goldBtn, this.node, "LBGameBase", "onClickGoldBuy");
- for(let i = 1; i < 6; ++i) {
- let btn = this.autoSelectNode.getChildByName("auto"+i);
- if(btn) {
- UIHelper.addButtonListener(btn, this.node, "LBGameBase", "onClickAuto", i-1);
- }
- }
- },
- addSetBtnListener() {
- },
- getRandomValue(i) {
- if(i == 0) {
- return this.rollPanel.getRandomValue();
- }
- let ddd = Math.floor(Math.random()*100);
- if(ddd > 90) {
- return 11;
- }
- return ddd % 8;
- },
- setPlayback(){
- this.bTestPlayback = cc.vv.testPlayback; //是否是回放
- this.homeBtn.active = !this.bTestPlayback;
- this.playbackNode.active = this.bTestPlayback;
- },
- onClickConnect() {
- GameManagerBase.Instance().StartGameReconnect();
- },
- onClickTest() {
- // this.curBetIndex = -1;
- // this.refrushBet();
- return;
- // this.SendGameSocketData(GameProtocol.SUB_C_LOTTERY_TEST, {});
- this.testMode = true;
- this.testResult = [
- // {"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},
- // {"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},
- // {"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},
- // {"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},
- // // {"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},
- // {"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},
- // {"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},
- {"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},
- {"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},
- {"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}
- ,{"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}
- ,
- {"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}
- ,{"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}
- ]
- 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};
- this.testIdx = 0;
- },
- onEventSceneMessage(gameStatus,lookonUser,data) {
- Global.print("GameSence onEventSceneMessage 场景消息 ");
- var arr = new DataView(data.slice(0, 8));
- var dataView = new DataView(data.slice(8));
- var msgHead = { m: arr.getUint16(4, true), s: arr.getUint16(6, true), d: null };
- arr = null;
- this.gameConfig = AnalyzeXieYi.analyze_GameConfig(dataView);
- Global.print(this.gameConfig);
- this.updateJackpot(this.gameConfig);
- this.curBetIndex = 0;
- this.bets = this.gameConfig.nJetton;
- this.refrushBet();
- this.rollPanel.resetView();
- },
- onRefreshJackpot(data){
- if(!this.roomData) return;
- let jackpotID = this.roomData.JackpotID;
- let aimId = jackpotID[0][0];
- let num = cc.vv.serverListData.getRewardInfoDataById(aimId).Num;
- this.gameConfig.lJackPot = num;
- this.updateJackpot(this.gameConfig);
- let history = cc.vv.serverListData.getRewardInfoDataById(this.roomData.ServerID).History;
- this.jackpotRecord = history;
- if(this.jackpotRecord.length == 0) return; //没有记录就不展示
- if(!this.bTriggerJackpot){ //第一次赋值
- this.bTriggerJackpot = true;
- this.rightJackpotNode.active = true;
- let info = this.jackpotRecord[this.nowShowIdx];
- this.setItemInfos(this.rightJackpotPlayer1, info);
- this.rightJackpotPlayer1.y = 0;
- this.rightJackpotPlayer2.y = -60;
- this.delayNextTime = ShowNextJackpotTime;
- }
- },
- //构造数据
- makeDataToGameConfig(){
- if(!this.roomData) return;
- this.gameConfig.nJetton = this.roomData.Bet;
- // this.gameConfig.lJackPot = 1020;
- this.bets = this.gameConfig.nJetton;
- this.refrushBet();
- // this.updateJackpot(this.gameConfig);
- //this.rollPanel.forceStop();
- },
- onEventGameMessage(data) {
- var arr = new DataView(data.slice(0, 8));
- var dataView = new DataView(data.slice(8));
- var msgHead = { m: arr.getUint16(4, true), s: arr.getUint16(6, true), d: null };
- arr = null;
- // Global.print(msgHead)
- var msg = AnalyzeXieYi.analyzeData(msgHead.m, msgHead.s, dataView);
- switch (msgHead.s) {
- case GameProtocol.SUB_S_REBACK_LOTTERY: { // 操作记录
- Global.print("SGLB::结果");
- this.onRollEndInfo(msg);
- }
- break;
- case GameProtocol.SUB_S_JACKPOT_RESET: { // 操作记录
- Global.print("JACKPOT");
- this.updateJackpot(msg);
- }
- break;
- case GameProtocol.SUB_S_SEND_CONTROL_INFO: {
- Global.print("SUB_S_SEND_CONTROL_INFO");
- this.onSubSendControlInfo(msg);
- }
- break;
- case GameProtocol.SUB_S_SUNGAME_INFO: {
- Global.print("SUB_S_SUNGAME_INFO");
- Global.print(JSON.stringify(msg));
- this._sunGameInfo = msg;
- }
- break;
- default: {
- Global.print("SGLBGameSence onEventGameMessage error ");
- }
- break;
- }
- },
- getNeedShowValue(val) {
- let str = ''+val;
- if(val < 100) {
- if(val < 10) {
- str = '00'+val;
- }else{
- str = '0'+val;
- }
- }
- return str;
- },
- updateJackpot(data) {
- Global.print("JACKPOT:"+JSON.stringify(data));
- //初始 或者 被人爆了jackpot
- if((this.jackpotScore == -1) || (this.jackpotScore > data.lJackPot)) {
- let des = this.getNeedShowValue(data.lJackPot).split('');
- let k = des.length-1;
- for(let i = 8; i >= 0; --i,--k) {
- let ln = this.jackpotNums[i];
- if(ln) {
- if(k >= 0) {
- ln.active = true;
- // this.roll2Num(ln, des[k], 1-i*0.05);
- let info = this.jackpotNumPositionY[des[k]];
- ln.y = info.y1;
- }else{
- ln.active = false;
- }
- }
- }
- }else{ //播放动画
- let des = this.getNeedShowValue(data.lJackPot).split('');
- let k = des.length-1;
- for(let i = 8; i >= 0; --i,--k) {
- let ln = this.jackpotNums[i];
- if(ln) {
- if(k >= 0) {
- ln.active = true;
- this.roll2Num(ln, des[k], 1-i*0.1);
- }else{
- ln.active = false;
- }
- }
- }
- }
- this.jackpotScore = data.lJackPot;
- },
- roll2Num(node, num, times) {
- let y = node.y;
- let dYs = this.jackpotNumPositionY[num];
- let dy = dYs.y1;
- if(y > dy) {
- dy = dYs.y2;
- }
- node.stopAllActions();
- cc.tween(node)
- .to(times, {y: dy})
- .call(()=>{
- node.y = dYs.y1;
- })
- .start()
- },
- showDebugRewardInfo() {
- let count = this.gameEndData.m_line_count;
- let lineid = this.gameEndData.m_line_id;
- let str = "中奖信息:" + count + "条线[";
- for(let i = 0; i < count; ++i) {
- str += (lineid[i]+1) + ',';
- }
- str += ']';
- str += this.gameEndData.m_kongming == 1 ? "\n中免费次数" : "";
- str += '\n 总输赢:'+Global.formatString2Score(this.gameEndData.m_lottery_size);
- const infoNode = cc.find("ControlInfo/info", this.node);
- infoNode.getChildByName("reward").getComponent(cc.RichText).string = str;
- },
- onEventGameRecord(data) {
- let dd = AnalyzeXieYi.analyze_Record(data);
- this._gameRecords.push(dd);
- this.addOneRecord(dd);
- // if(this._gameRecords.length >= 60) {
- // this.showRecordsPanel();
- // }
- },
- onEventJackpotRecord(data) {
- let dd = AnalyzeXieYi.analyze_JackpotRecord(data);
- this.jackpotRecord.push(dd);
- Global.print(dd);
- if(this.jackpotRecord.length == 1) {
- this.showWithNowIdx();
- }
- },
- onSocketHorseMessage(data) {
- this._super(data);
- this.rightJackpotPanel.active = false;
- this.jackpotRecord.splice(0);
- this.nowShowIdx = 0;
- this.getJackpotRecord();
- },
- showWithNowIdx() {
- if(this.jackpotRecord.length <= 0) {
- return;
- }
- if(this.nowShowIdx >= this.jackpotRecord.length) {
- this.nowShowIdx = 0;
- }
- this.rightJackpotNode.active = true;
- let info = this.jackpotRecord[this.nowShowIdx];
- this.setItemInfos(this.rightJackpotPlayer1, info);
- this.rightJackpotPlayer1.y = 0;
- this.rightJackpotPlayer2.y = -60;
- this.delayNextTime = ShowNextJackpotTime;
- },
- jumpNextJackpot() {
- //小于两条 不滚动
- if(this.jackpotRecord.length < 2) {
- return;
- }
- this.nowShowIdx++;
- if(this.nowShowIdx >= this.jackpotRecord.length) {
- this.nowShowIdx = 0;
- }
- let info = this.jackpotRecord[this.nowShowIdx];
- let node1 = null;
- let node2 = null;
- if(this.rightJackpotPlayer1.y > this.rightJackpotPlayer2.y) {
- node1 = this.rightJackpotPlayer1;
- node2 = this.rightJackpotPlayer2;
- }else{
- node1 = this.rightJackpotPlayer2;
- node2 = this.rightJackpotPlayer1;
- }
- this.setItemInfos(node2, info);
- node1.stopAllActions();
- node2.stopAllActions();
- cc.tween(node1)
- .to(1, {y: 60})
- .call(()=>{
- node1.y = -60;
- })
- .start()
- cc.tween(node2)
- .to(1, {y: 0})
- .start()
- this.delayNextTime = ShowNextJackpotTime;
- },
- setItemInfos(node, info) {
- if(!node || !info) {
- return;
- }
- node.active = true;
- /*
- node.getChildByName("head").getChildByName("spr").getComponent(cc.Sprite).spriteFrame = cc.vv.globalUserInfo.getHeadSpriteFrameByFaceID(info.cbFaceID);
- node.getChildByName("name").getComponent(cc.Label).string = info.szNickName;
- node.getChildByName("score").getComponent(cc.Label).string = '$'+Global.formatString2Score(info.lLotteryMoney);
- */
- node.getChildByName("head").getChildByName("spr").getComponent(cc.Sprite).spriteFrame = cc.vv.globalUserInfo.getHeadSpriteFrameByFaceID(info.FaceID);
- node.getChildByName("name").getComponent(cc.Label).string = info.NickName;
- node.getChildByName("score").getComponent(cc.Label).string = 'R$:'+Global.formatString2Score(info.Value);
- },
- onClickShowJackpotUser() {
- this.rightJackpotPanel.active = true;
- this.rightJackpotPanel.getChildByName("mark").active = true;
-
- for(let i = 0; i < 10; ++i) {
- let item = null;
- if(i >= this.rightJackPotContent.childrenCount) {
- item = cc.instantiate(this.rightJackPotContent.children[0]);
- item.parent = this.rightJackPotContent;
- }else{
- item = this.rightJackPotContent.children[i];
- }
- if(item) {
- let info = this.jackpotRecord[i];
- if(info) {
- this.setItemInfos(item, info);
- }else{
- item.active = false;
- }
- }
- }
- this.rightJackPotShowNode.stopAllActions();
- this.rightJackPotShowNode.scaleY = 0;
- cc.tween(this.rightJackPotShowNode)
- .to(0.07, {scaleY:1})
- .start()
- },
- onClickHideJackpotUser() {
- this.rightJackpotPanel.getChildByName("mark").active = false;
- this.rightJackPotShowNode.stopAllActions();
- this.rightJackPotShowNode.scaleY = 1;
- cc.tween(this.rightJackPotShowNode)
- .to(0.07, {scaleY:0})
- .call(()=>{
- this.rightJackpotPanel.active = false;
- })
- .start()
- },
- backHome: function() {
- if (CServerItem.get()) {
- CServerItem.get().PerformStandUpAction(1);
- } else {
- this.exitGame();
- }
- this._backHome = true;
- ScenceManager.Instance().gameBackScence();
- GameManagerBase.Instance().setInGameServerID(-1);
- },
- onClickHome() {
- if(!this._gameEnd || this._nFreeCount > 0) {
- this.showBackTips();
- return;
- }
- this.backHome();
- this.exitGame();
- },
- exitGameWhenPlaying() {
- if(!this._gameEnd || this._nFreeCount > 0) {
- topTipMsg.showTopTipMsg(LanguageKey.t("pubWords.not_exit_game"));
- return;
- }
- if(cc.vv.config.ReviewApk) {
- cc.game.end();
- return;
- }
- /*
- // this.backHome();
- // this.exitGame();
- */
- this._backHome = true;
- cc.sys.localStorage.setItem("InGameServerID", -1);
- this.removeMsgListener();
- ScenceManager.Instance().gameBackScence();
- },
- onClickGoldBuy() {
- if(cc.vv.config.ReviewApk) return;
- this.onClickHome();
- // let FirstPay10State = cc.vv.GetHallScript().GetFirstPay10State();
- // let FirstPayState = cc.vv.GetHallScript().GetFirstPayState();
- // if(FirstPay10State){
- // cc.vv.GetHallScript().onClickFirstPay_10(null,true);
- // }else if(FirstPayState){
- // cc.vv.GetHallScript().onClickFirstPay(null,true);
- // }else{
- // cc.vv.GetHallScript().showBuyGold();
- // }
- // this.hideGuideNode();
- },
- showBackTips() {
- this.backPanel.active = true;
- },
- hideBackTips() {
- this.playEffect("button");
- this.backPanel.active = false;
- },
- getSingleLineBet() {
- return this.gameConfig.nJetton[this.curBetIndex]/this.MAX_LINE;
- },
- onStartSun2Game(){
- this.playEffect("sunpanelclose");
- this.sunNode.active = false;
- this.sun2GamePanel.rolls();
- },
- onStartSunGame() {
- if(!this._sunGameInfo) return;
- if(!this.isSunGame) return;
- this.sunNode.active = false;
- this.sunGamePanel.rolls();
- this.playEffect("sunpanelclose");
- // this.playEffect("sunstart");
- },
- sunGameEnd() {
- this._gameEnd = true;
- this.lineNode.active = true;
- this.spBg.active = true;
- this.spBg.opacity = 255;
- cc.tween(this.spBg)
- .delay(0.5)
- .to(0.5, {opacity: 0})
- .start()
- this.spRollBg.active = true;
- this.spRollBg.opacity = 255;
- cc.tween(this.spRollBg)
- .delay(0.5)
- .to(0.5, {opacity: 0})
- .start()
- cc.vv.audioMgr.pauseBackMusic();
- this.sunGameNode.active = false;
- this.sun2GameNode.active = false;
- this.rollNode.active = true;
- this.sunNode.active = false;
- this.sunBtnMask.active = false;
- let timers = Math.floor(this.gameEndData.m_lottery_size * this.MAX_LINE / this.gameConfig.nJetton[this.curBetIndex]);
- this._currentScore = this._lastScore;
- this.upPlayerScore(this._currentScore);
- this.playSoundByTimes(timers);
- if(this.winAniIdx == -1) //加个保护 防止子游戏恭喜获得没有界面
- this.winAniIdx = 0;
- this.showResultPanel();
- if(this._bSpecialGame) {
- this.changeFreeBtns(true);
- }
- this.winScore.string = Global.formatString2Score(this.allWinScore);
- },
- doCoinAni() {
- this.scoreAni.node.active = true;
- this.scoreAni.setAnimation(0, "a2", false);
- },
- addCoinGet(value) {
- this.playEffect("sungetcoin");
- Global.print("add:"+value);
- this._nSunWin += value;
- this.winScore.string = Global.formatString2Score(this._nSunWin);
- },
- showSun2Game(){
- if(this._bSpecialGame) {
- this.changeFreeBtns(false);
- }
- this.lineNode.active = false;
- this.sunBtnMask.active = true;
- this.spBg.active = true;
- this.spBg.opacity = 0;
- cc.tween(this.spBg)
- .delay(0.5)
- .to(0.5, {opacity: 255})
- .start();
- cc.vv.audioMgr.playBGM("sunbgm");
- this.playEffect("sunpanelopen");
- this.winScore.string = '0';
- this.rollNode.active = false;
- this.sunNode.active = true;
- this.sun2GameNode.active = true;
- this.sun2GamePanel.showSubgame(this.gameEndData.m_desk_data, this.gameEndData.m_desk_value, this.gameEndData.SG_result_data);
- this.scheduleOnce(()=>{
- this.onStartSun2Game();
- }, 1);
- },
- onSunGameInfo() {
- let data = this._sunGameInfo;
- Global.print(data);
- if(this._bSpecialGame) {
- this.changeFreeBtns(false);
- }
- this.lineNode.active = false;
- this.sunBtnMask.active = true;
- this.spBg.active = true;
- this.spBg.opacity = 0;
- cc.tween(this.spBg)
- .delay(0.5)
- .to(0.5, {opacity: 255})
- .start()
- this.spRollBg.active = true;
- this.spRollBg.opacity = 0;
- cc.tween(this.spRollBg)
- .delay(0.5)
- .to(0.5, {opacity: 255})
- .start()
- this.sunGamePanel.init(data, this.gameEndData.m_desk_data, this.gameConfig.nJetton[this.curBetIndex]/this.MAX_LINE);
- this.sunGameNode.active = true;
- cc.vv.audioMgr.playBGM("sunbgm");
- this.playEffect("sunpanelopen");
- this.winScore.string = '0';
- this.rollNode.active = false;
- this.sunNode.active = true;
- },
- onRollEndInfo(data) {
- Global.print(data);
- //数据改造
- //m_desk_data服务器从1开始,客户端需要从0开始
- for(let i=0; i < data.m_desk_data.length; i++){
- for(let j=0; j < data.m_desk_data[i].length; j++){
- if(data.m_desk_data[i][j] >= 1){
- data.m_desk_data[i][j] -= 1;
- }
- }
- }
- //m_line_icon服务器从1开始, 客户端需要从0开始
- for(let i=0; i < data.m_line_icon.length; i++){
- if(data.m_line_icon[i] >= 1){
- data.m_line_icon[i] -= 1;
- }
- }
- //m_line_id服务器从1开始, 客户端需要从0开始
- for(let i=0; i < data.m_line_id.length; i++){
- if(data.m_line_id[i] >=1){
- data.m_line_id[i] -= 1;
- }
- }
- //子游戏的m_desk_data服务器从1开始, 客户端需要从0开始
- for(let i=0; i < data.SG_result_data.length; i++){
- for(let j=0; j < data.SG_result_data[i].m_desk_data.length; j++){
- for(let k=0; k < data.SG_result_data[i].m_desk_data[j].length; k++){
- if(data.SG_result_data[i].m_desk_data[j][k] >= 1){
- data.SG_result_data[i].m_desk_data[j][k] -= 1;
- }
- }
- }
- }
-
- // this.onSocketHorseMessage({szMessage:"3010##1##gg##100"});
- // if(!this._bQuickGame)
- // this.changeBtnState(true);
- this.gameEndData = data;
- if(this._nFreeCount > 0) {
- this.upFreeCount();
- }else{
- this._nFreeTotal = 0;
- this.allWinScore = 0;
- }
- let endSp = data.cbFreeTime > 0;
- this._bFreeEnd = false;
- if(this._bSpecialGame || endSp) {
- this._bSpecialGame = endSp;
- this._nFreeWin += data.m_lottery_size+data.m_deposit_lotttery; //彩金和赢得
- this._bFreeEnd = data.cbFreeTime == 0;
- }
- this._nFreeCount = data.cbFreeTime;
- this._nFreeTotal += data.cbFreeAdd;
- this._bFreeState = data.m_kongming;
- this._winTimes = Math.floor(data.m_lottery_size*5000 / data.m_chip_size);
- data.m_is_berserk = this.gameEndData.SG_result_data.length > 0;
- this.isSunGame = data.m_is_berserk;
- if(data.m_is_berserk) { //触发小游戏
- this.rollPanel.setSpecialData(this._sunGameInfo);
- }
- this.rollPanel.setRollDatas(data);
- this.rollPanel.openPrizes(false, this._bQuickGame);
- //更新玩家金币
- cc.vv.globalUserInfo.setUserScore(data.lCurScore);
- this._lastScore = data.lCurScore;
- this.showDebugRewardInfo();
- },
- makeXieYi(m,s,data) {
- if(m == ProtocolGameServer.MDM_GF_FRAME) {
- return //new DataView(arrayBuffer)
- }
- return MakeXieYi.makeRoll(data);
- },
- onClickRecord() {
- this.recordContent.removeAllChildren();
- this._gameRecords.splice(0);
- this.recordPanel.active = true;
- this.getGameRecord();
- },
- onSendRoll() {
- /*
- // if(this.testMode && this.testIdx < this.testResult.length) {
- // setTimeout(()=>{
- // this.onRollEndInfo(this.testResult[this.testIdx++]);
- // }, 500);
- // return;
- // }
- let t = {};
- t.nJetton = this.gameConfig.nJetton[this.curBetIndex];
- // Global.print(t);
- this.SendGameSocketData(GameProtocol.SUB_C_LOTTERY, t);
- */
- let timer = this._bQuickGame ? 100 : 500;
- setTimeout(()=>{
- let _data = {'CMD':ProtocolLoginServer.CMD_C2S_Game_RollRoman,
- 'Value':this.gameConfig.nJetton[this.curBetIndex],
- 'RoomID':this.roomData.ServerID
- };
- cc.vv.netSocket.send(JSON.stringify(_data));
- }, timer);
- },
- upLeftCount() {
- this.freeLeftNode.active = this._bSpecialGame;
- if(this._bSpecialGame) {
- this.freeLeftNode.getChildByName("left").getComponent(cc.Label).string = this._nFreeCount + '/' + this._nFreeTotal;
- }else{
- this._super();
- }
- },
- upFreeCount() {
- let funcNode = this.node.getChildByName("FuncBtnNode");
- let left = funcNode.getChildByName("btn_left");
- left.active = this._nFreeCount > 0;
- left.getChildByName("left").getComponent(cc.Label).string = (this._nFreeCount-1) + '/' + this._nFreeTotal;
- // this.upBtnInteractable(funcNode.getChildByName("btn_auto"), false);
- },
- // judgeAuto() {
- // let funcNode = this.node.getChildByName("FuncBtnNode");
- // if(this._nAutoCount == 0) {
- // this._bAutoGame = false;
- // }else{
- // this._bAutoGame = true;
- // }
- // funcNode.getChildByName("btn_left").active = this._bAutoGame;
- // let left = funcNode.getChildByName("btn_left");
- // left.active = this._bAutoGame;
- // left.getChildByName("left").active = this._nAutoCount > 0;
- // left.getChildByName("left2").active = this._nAutoCount < 0;
- // left.getChildByName("left").getComponent(cc.Label).string = this._nAutoCount;
- // },
- onStartRoll() {
- if(this.bTestPlayback) return; //如果是回放, 下面的不执行.
- if(!this._gameEnd) return;
- this.node.stopAllActions();
- this.resetGameView();
- if(this.playingEffectID != -1) {
- cc.vv.audioMgr.stopSFX(this.playingEffectID);
- }
- // cc.vv.audioMgr.stopAllEffects();
- //是否可以开始游戏
- if(!this.judgeCannotRollGame()) {
- return;
- }
- this._gameEnd = false;
- this.changeGameState(1);
- if(cc.vv.audioMgr._musicFile != this.nowPlayBgm || this.stopBackMusicTimes < 0)
- cc.vv.audioMgr.playBGM(this.nowPlayBgm);
-
- this.upLeftCount();
- this.onSendRoll();
- this.showCenterNormal();
- this.onGameStart();
- this.rollPanel.startRollActions();
- // this._super();
-
- this.stopBackMusicTimes = 0;
- },
- // resetGameView() {
- // this._super();
- // this.hideFreeWin();
- // },
- showGameEnd() {
- // this._super();
- this._gameEnd = true;
- this.changeGameState(2);
- // setTimeout(()=>{
- // // Global.print("pauseBackMusic")
- // if(this._gameEnd && !this._backHome) {
- // // Global.print(this.node);
- // cc.vv.audioMgr.pauseBackMusic();
- // }
- // }, 3000);
- this.stopBackMusicTimes = 3;
- //获得免费次数
- if(this._bFreeState == 1) {
- cc.vv.audioMgr.pauseBackMusic();
- this.showGetFreeTimes(this.gameEndData.cbFreeAdd);
- }else if(this._bFreeEnd){
- //免费次数结束,自动游戏在其他地方判断
- this.freeLeftNode.active = false;
- this.changeGameState(0);
- this.resetAllBtn();
- if((this.winAniIdx < 0 || this._bSpecialGame) && this.gameEndData.m_ruyi <= 0){
- this.delayStartNextRoll(1);
- }
- }else if((this.winAniIdx < 0 || this._bSpecialGame) && this.gameEndData.m_ruyi <= 0){
- this.delayStartNextRoll(1);
- }
- },
- onClickSkip() {
- this.playButtonEffect();
- let scoreNode = this.resultNode.getChildByName("mask").getChildByName("scoreNode");
- this.skipScoreAdd(scoreNode.getChildByName("score").getComponent(cc.Label),scoreNode.getChildByName("score2").getComponent(cc.Label))
- },
- showResultPanel() {
- if(this.changeSkipBtnState <=0){
- console.error('没有钱, 不播放');
- return;
- }
- let ssNodeY = [-44,-103,-103,-150,-150];
- this.changeGameState(3);
- this.resultNode.active = true;
- let node = this.resultNode.getChildByName("mask");
- let goldNode = node.getChildByName("goldani");
- let ssNode = node.getChildByName("scoreNode");
- let sNode = ssNode.getChildByName("score");
- let sNode2 = ssNode.getChildByName("score2");
- let sLabel = sNode.getComponent(cc.Label);
- let sLabel2 = sNode2.getComponent(cc.Label);
- let aniNode1 = node.getChildByName("wani");
- aniNode1.active = true;
- goldNode.active = true;
- ssNode.active = false;
- let anii = aniNode1.getComponent(sp.Skeleton);
- anii.skeletonData = this.winSpineData[this.winAniIdx];
- if(this.winAniIdx >= 0) {
- //金币动画
- let gAni = goldNode.getComponent(sp.Skeleton);
- // gAni.clearTracks();
- // gAni.setAnimation(0, 'a'+(this.winAniIdx>3?3:this.winAniIdx), true);
- gAni.setAnimation(0, 'a'+(this.winAniIdx+1>5?5:this.winAniIdx+1), true);
- }else{
- goldNode.active = false;
- }
- this.isPlayingScoreAddAni = true;
- //win动画
- anii.clearTracks();
- anii.setAnimation(0, "a1", false);
- anii.addAnimation(0, "a2", true);
- this.resultNode.stopAllActions();
- cc.tween(this.resultNode)
- .delay(0.3)
- .call(()=>{
- if(this.winAniIdx>=0 && this.winAniIdx<ssNodeY.length)
- ssNode.y = ssNodeY[this.winAniIdx];
- ssNode.active = true;
- sLabel.string = '0';
- sLabel2.string = '.00';
- this.playScoreAddAni(sLabel, sLabel2);
- this.changeSkipBtnState(true);
- })
- .start()
- },
- skipScoreAdd(sLabel, sLabel2) {
- this._super(sLabel, sLabel2);
- this.isPlayingScoreAddAni = false;
- },
- hideResultPanel() {
- this.resultNode.active = false;
- },
- onClickResultMask() {
- if(this.isPlayingScoreAddAni) {
- this.onClickSkip();
- }else{
- this.hideResultPanel();
- }
- },
- onClickFreeWinMask() {
- this.changeFreeWinBtn(false);
- if(this.isPlayingScoreAddAni) {
- this.onClickSkipFreeWin();
- }else{
- this.hideFreeWin();
- }
- },
- showGameWinScore() {
- this.winAniIdx = -1;
- //所有赢钱
- this.allWinScore += this.gameEndData.m_deposit_lotttery+this.gameEndData.m_lottery_size;
- this.needPlayinfScore = this.gameEndData.m_lottery_size;
- if(this.gameEndData.m_ruyi > 0) { //彩金池
- this.winAniIdx = 4;
- this.needPlayinfScore = this.gameEndData.m_deposit_lotttery;
- let nnode = this.node.getChildByName("RoomInfoNode").getChildByName("img_1");
- nnode.getChildByName("normalNode").active = false;
- nnode.getChildByName("winNode").active = true;
- this.winScore.string = Global.formatString2Score(this.allWinScore);
- this.showResultPanel();
- this.upPlayerScore(this._lastScore);
- return;
- }
- let score = this.gameEndData.m_lottery_size;
- if(this.isSunGame) {
- this._nSunWin = 0;
- // this.winAniIdx = 4;
- let nnode = this.node.getChildByName("RoomInfoNode").getChildByName("img_1");
- if(!nnode.getChildByName("winNode").active) {
- nnode.getChildByName("normalNode").active = false;
- nnode.getChildByName("winNode").active = true;
- this.winScore.string = '0'//this._nFreeWin;
- }
-
- return;
- }
- //免费游戏中
- if(this._bSpecialGame) {
- if(this._bFreeState) {
- this.playEffect("freestart");
- }
- let nnode = this.node.getChildByName("RoomInfoNode").getChildByName("img_1");
- nnode.getChildByName("normalNode").active = false;
- nnode.getChildByName("winNode").active = true;
- this.winScore.string = Global.formatString2Score(this.allWinScore);
- return;
- }
- //免费游戏结束
- if(this.gameEndData.m_chip_size == 0) {
- this.nowPlayBgm = "bgm";
- cc.vv.audioMgr.playBGM("bgm");
- this.needPlayinfScore = this.allWinScore;
-
- this._currentScore = this._lastScore;
- this.upPlayerScore(this._currentScore);
-
- let nnode = this.node.getChildByName("RoomInfoNode").getChildByName("img_1");
- nnode.getChildByName("normalNode").active = false;
- nnode.getChildByName("winNode").active = true;
- this.winScore.string = Global.formatString2Score(this.allWinScore);
- let xxTimer = Math.floor(this.allWinScore * this.MAX_LINE / this.gameConfig.nJetton[this.curBetIndex]);
- this.playSoundByTimes(xxTimer);
- if(this.winAniIdx == -1 && this.allWinScore > 0) //保护
- this.winAniIdx = 0;
- this.showResultPanel();
- // this.showFreeWin();
- return;
- }
- let timers = Math.floor(score * this.MAX_LINE / this.gameConfig.nJetton[this.curBetIndex]);
- this._currentScore = this._lastScore;
- this.upPlayerScore(this._currentScore);
-
- if(score <= 0){
- return;
- }
- this.playSoundByTimes(timers);
- let nnode = this.node.getChildByName("RoomInfoNode").getChildByName("img_1");
- nnode.getChildByName("normalNode").active = false;
- nnode.getChildByName("winNode").active = true;
- this.winScore.string = Global.formatString2Score(this.allWinScore);
-
-
- if(this.winAniIdx >= 0) {
- this.showResultPanel();
- }
- },
- delayStartNextRoll(delayTime) {
- if(!this._bSpecialGame) {
- this._nFreeTotal = 0;
- this.freeLeftNode.active = false;
- }
- this.sunGameNode.active = false;
- this.rollNode.active = true;
- // this._super(delayTime);
- this.changeGameState(0);
- this.resetAllBtn();
- this.node.stopAllActions();
- if(this.gameEndData.m_line_count <= 0){
- delayTime = 0.1;
- }
- if(this._bFreeState){ //免费游戏开始
- delayTime = 1;
- }
- if(!this._bSpecialGame && this.gameEndData.m_chip_size == 0) { //免费游戏结束
- delayTime = 1.5;
- }
- this.scheduleOnce(()=>{
- if(this.gameEndData.SG_result_data.length > 0){ //触发子游戏
- this._bAutoGame = false; //停止自动游戏
- this.onCancelAutoRoll();
- }
- if(this._bAutoGame || this._bSpecialGame){ //自动游戏时
- this.onStartRoll();
- }
- }, delayTime);
- },
- showGetFreeTimes(times) {
- this.nowPlayBgm = "freebgm";
- let freeNode = this.node.getChildByName("freeNode");
- let aniNode = freeNode.getChildByName("mask");
- let ani = aniNode.getComponent(sp.Skeleton);
- ani.clearTracks();
- ani.setAnimation(0, "a1", false);
- freeNode.active = true;
- this._bSpecialGame = true;
- let sstr = aniNode.getChildByName("s");
- sstr.getComponent(cc.Label).string = times;
- sstr.stopAllActions();
- sstr.angle = 0;
- sstr.active = false;
- aniNode.stopAllActions();
- cc.tween(aniNode)
- .delay(0.4)
- .call(()=>{
- sstr.active = true;
- })
- .delay(0.2)
- .call(()=>{
- cc.tween(sstr)
- .to(1.4, {angle: -60})
- .start()
- })
- .delay(1.4)
- .call(()=>{
- freeNode.active = false;
- cc.vv.audioMgr.playBGM("freebgm");
- this.delayStartNextRoll(0.5);
- })
- .start()
- // cc.tween(freeNode.getChildByName("mark"))
- // .hide()
- // .delay(1+5)
- // .show()
- // .start()
- },
- showFreeWin() {
- if(this.gameEndData.m_kongming == 0) {
- this._nFreeWin = 0;
- }
- // this.playEffect("freeend");
- let funcNode = this.node.getChildByName("FuncBtnNode");
- funcNode.getChildByName("btn_left").active = false;
- this.upBtnInteractable(this.startBtn, true);
- this.playingEffectID = cc.vv.audioMgr.playEffectByAudioClip(this.freeWinAudio);
- let winNode = this.node.getChildByName("freeWin");
- winNode.active = true;
- let node = winNode.getChildByName("mask");
- let startBtn = node.getChildByName("btn_start");
- startBtn.active = false;
- let scoreNode = node.getChildByName("score1");
- scoreNode.stopAllActions();
- scoreNode.scale = 1;
- scoreNode.active = false;
- let ani = node.getComponent(sp.Skeleton);
- ani.clearTracks();
- ani.setAnimation(0, "b1", false);
- ani.setCompleteListener(()=>{
- ani.setCompleteListener(()=>{})
- ani.setAnimation(0, "b2", true);
- scoreNode.active = true;
- this.changeFreeWinBtn(true);
- this.isPlayingScoreAddAni = true;
- this.playFreeWinAddAni(scoreNode.getComponent(cc.Label));
- })
- },
- hideFreeWin() {
- this.nowPlayBgm = "bgm";
- this.playButtonEffect();
- let winNode = this.node.getChildByName("freeWin");
- winNode.getChildByName("mask").getChildByName("btn_start").active = false;
- winNode.stopAllActions();
- if(!winNode.active){
- this.onStartRoll();
- return;
- }
-
- let node = winNode.getChildByName("mask");
- let ani = node.getComponent(sp.Skeleton);
- ani.clearTracks();
- ani.setAnimation(0, "b3", false);
- ani.setCompleteListener(()=>{
- ani.setCompleteListener(()=>{})
- winNode.active = false;
- if(this._bAutoGame)
- this.onStartRoll();
- })
- },
- onClickSkipFreeWin() {
- this.playButtonEffect();
- let winNode = this.node.getChildByName("freeWin").getChildByName("mask");
- this.skipFreeWinAdd(winNode.getChildByName("score1").getComponent(cc.Label));
- },
- onClickFreeWinStart() {
- },
- playFreeWinAddAni(sLabel) {
- let start = 0;
- let bet = this.gameConfig.nJetton[this.curBetIndex];
- let endScore = Global.formatString2Score(this.needPlayinfScore);
- let add = parseFloat(bet/100/this.MAX_LINE);
- this.upFreeWinLabel = ()=>{
- start += add;
- if(start >= endScore) {
- this.skipFreeWinAdd(sLabel);
- }else{
- sLabel.string = parseFloat(start).toFixed(2);
- }
- }
- if(this.upFreeWinLabel) {
- this.unschedule(this.upFreeWinLabel);
- }
- this.schedule(this.upFreeWinLabel, 0.01);
- },
- skipFreeWinAdd(sLabel) {
- if(this.upFreeWinLabel) {
- this.unschedule(this.upFreeWinLabel);
- }
- let score = this.needPlayinfScore;
- sLabel.string = Global.formatString2Score(score);
- sLabel.node.stopAllActions();
- cc.tween(sLabel.node)
- .sequence(
- cc.tween().to(0.25, {scale: 0.9}),
- cc.tween().to(0.25, {scale: 1})
- )
- .repeatForever()
- .start()
-
- this.changeFreeWinBtn(false);
- this.isPlayingScoreAddAni = false;
- let node = this.node.getChildByName("freeWin");
- node.stopAllActions();
- cc.tween(node)
- .delay(0.5)
- .call(()=>{
- if(this._bAutoGame)
- this.hideFreeWin();
- })
- .start()
- },
- changeFreeWinBtn(bSkip) {
- let winNode = this.node.getChildByName("freeWin").getChildByName("mask");
- winNode.getChildByName("btn_start").active = !bSkip;
- winNode.getChildByName("btn_skip").active = bSkip;
- },
- changeFreeBtns(bShow) {
- this.upBtnInteractable(this.node.getChildByName("FuncBtnNode").getChildByName("btn_left"), bShow);
- },
-
- addOneRecord(info) {
- let item = cc.instantiate(this.recordClone);
- item.getChildByName("time").getComponent(cc.Label).string = Global.formatDate(new Date(info.nTime*1000));
- item.getChildByName("bet").getComponent(cc.Label).string = Global.formatString2Score(info.nBet);
- let win = info.nBet+info.nWinLost;
- let col = new cc.Color(232, 232, 232);
- if(win > 0) {
- col = new cc.Color(248, 201, 39);
- }
- item.getChildByName("win").color = col;
- item.getChildByName("win").getComponent(cc.Label).string = Global.formatString2Score(win);
- item.active = true;
- item.parent = this.recordContent;
- },
- showRecordsPanel() {
- this.recordContent.removeAllChildren();
- for(let i = 0; i < this._gameRecords.length; ++i) {
- let info = this._gameRecords[i];
- let item = cc.instantiate(this.recordClone);
- item.getChildByName("time").getComponent(cc.Label).string = Global.formatDate(new Date(info.nTime*1000));
- item.getChildByName("bet").getComponent(cc.Label).string = Global.formatString2Score(info.nBet);
- let win = info.nBet+info.nWinLost;
- let col = new cc.Color(232, 232, 232);
- if(win > 0) {
- col = new cc.Color(248, 201, 39);
- }
- item.getChildByName("win").color = col;
- item.getChildByName("win").getComponent(cc.Label).string = Global.formatString2Score(win);
- item.active = true;
- item.parent = this.recordContent;
- }
- this.recordPanel.active = true;
- },
- onClickPlayback(){
- console.log('点击回放');
- if(!this._gameEnd) return;
- this.node.stopAllActions();
- this.resetGameView();
- if(this.playingEffectID != -1) {
- cc.vv.audioMgr.stopSFX(this.playingEffectID);
- }
-
- if(!this.judgeCannotRollGame()) {
- return;
- }
- this._gameEnd = false;
- this.changeGameState(1);
- if(cc.vv.audioMgr._musicFile != this.nowPlayBgm || this.stopBackMusicTimes < 0)
- cc.vv.audioMgr.playBGM(this.nowPlayBgm);
-
- this.upLeftCount();
- // this.onSendRoll();
- this.showCenterNormal();
- this.onGameStart();
- this.rollPanel.startRollActions();
- this.stopBackMusicTimes = 0;
- // 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]],
- // "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,
- // "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,
- // "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],
- // "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_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_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":[]}}`;
- let str = cc.vv.playbackData;
- let tData = JSON.parse(str);
- setTimeout(()=>{
- this.onRollEndInfo(tData.Value);
- }, 400);
- },
- onClickSet() {
- this.playButtonEffect();
- this.setPanel.active = true;
- this.changeAudioBtnState();
- },
- showCenterNormal() {
- if(this._bSpecialGame) return;
- this.node.getChildByName("RoomInfoNode").getChildByName("img_1").getChildByName("normalNode").active = true;
- this.node.getChildByName("RoomInfoNode").getChildByName("img_1").getChildByName("winNode").active = false;
- },
- onClickRule() {
- this.playButtonEffect();
- UIHelper.loadRes('resourcesPrefab/ruleNode', cc.Prefab, (prefab)=>{
- if (!this._ruleNode) {
- this._ruleNode = cc.instantiate(prefab);
- this._ruleNode.parent = this.node;
- }
- this._ruleNode.getComponent("RomanRule").show();
- })
- },
- onClickMenu() {
- this.playButtonEffect();
- UIHelper.loadRes('GamePrefabs/Public/GameMenu', cc.Prefab, (prefab)=>{
- if (!this._ruleNode) {
- this._ruleNode = cc.instantiate(prefab);
- this._ruleNode.parent = this.node;
- }
- this._ruleNode.getComponent("GameMenu").show();
- })
- },
- playSoundByTimes(_times) {
- if(_times <= 0) return;
- let id = 1;
- if(_times > this.MAX_LINE*120){
- id = 15;
- this.winAniIdx = 3;
- }else if(_times > this.MAX_LINE*100){
- id = 14;
- this.winAniIdx = 3;
- }else if(_times > this.MAX_LINE*80){
- id = 13;
- this.winAniIdx = 3;
- }else if(_times > this.MAX_LINE*64){
- id = 12;
- this.winAniIdx = 3;
- }else if(_times > this.MAX_LINE*48){
- id = 11;
- this.winAniIdx = 3;
- }else if(_times > this.MAX_LINE*32){
- id = 10;
- this.winAniIdx = 3;
- }else if(_times > this.MAX_LINE*20){
- id = 9;
- this.winAniIdx = 3;
- }else if(_times > this.MAX_LINE*12){
- id = 8;
- this.winAniIdx = 3;
- }else if(_times > this.MAX_LINE*8){
- id = 5;
- this.winAniIdx = 2;
- }else if(_times > this.MAX_LINE*4){
- id = 4;
- this.winAniIdx = 1;
- }else if(_times > this.MAX_LINE*2){
- id = 3;
- this.winAniIdx = 0;
- }else if(_times > this.MAX_LINE){
- id = 2;
- this.winAniIdx = -1;
- }
- // this.playEffect("Level"+id);
- this.playEffectByID(id);
- },
- playEffectByID(id) {
- let audioC = this.audioArr[id];
- if(audioC) {
- this.playingEffectID = cc.vv.audioMgr.playEffectByAudioClip(audioC);
- }
- },
- playButtonEffect(){
- this.playEffect("button");
- },
- update (dt) {
- if(this.stopBackMusicTimes > 0) {
- this.stopBackMusicTimes -= dt;
- if(this.stopBackMusicTimes <= 0) {
- cc.vv.audioMgr.pauseBackMusic();
- }
- }
- },
- });
|