1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653 |
- var GameBase = require("GameBase");
- var ProtocolGameServer = require("ProtocolGameServer");
- var GameProtocol = require("OlympusGameProtocol");
- var AnalyzeXieYi = require("AnalyzeOlympusXieYi");
- var MakeXieYi = require("MakeOlympusXieYi");
- var Global = require("Global");
- var topTipMsg = require("topTipMsg");
- var UIHelper = require("UIHelper");
- var BaseDefine = require("BaseDefine");
- var GameConstant = require("GameConstant");
- var ProtocolLoginServer = require("ProtocolLoginServer");
- var EventMgr = require("EventMgr");
- var 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/Olympus/GameSence'
- },
- properties: {
- rollNode: cc.Node,
- playerScore: cc.Label,
- resultNode: cc.Node,
- betNode: cc.Node,
- //功能按钮
- startBtn: cc.Node,
- addBtn: cc.Node,
- delBtn: cc.Node,
- quickBtn: cc.Node,
- homeBtn: cc.Node,
- exitBtn: cc.Node,
- playbackNode: cc.Node, //回放按钮
- freeLeftNode: cc.Node,
- ruleNode: cc.Node,
- winScoreLabel: cc.Label,
- winSpineData: [sp.SkeletonData],
- audioArr: [cc.AudioClip],
- jackpotAni: sp.Skeleton,
- jackpotNode: cc.Node,
- jackpotNumClone: cc.Node,
- jackpotNums: [cc.Node],
- // noticeNode: cc.Node,
- // noticeLabel: cc.Node,
- rightJackpotNode: cc.Node,
- rightJackpotPlayer1: cc.Node,
- rightJackpotPlayer2: cc.Node,
- rightJackpotPanel: cc.Node,
- rightJackPotClone: cc.Node,
- rightJackPotShowNode: cc.Node,
- rightJackPotContent: cc.Node,
- },
- update(dt) {
- if(this.delayNextTime <= 0) {
- this.jumpNextJackpot();
- }else{
- this.delayNextTime -= dt;
- }
- if(this.delayShowJackpotSweepTime <= 0) {
- this.jackpotAni.clearTracks();
- this.jackpotAni.setAnimation(0, 'a1', false);
- this.delayShowJackpotSweepTime = 10;
- }else{
- this.delayShowJackpotSweepTime -= dt;
- }
- },
- // showNextMar() {
- // var kStr = this.marqueueArr.shift();
- // this.noticeNode.active = true;
- // this.noticeLabel.x = 300;
- // this.noticeLabel.getComponent(cc.Label).string = kStr;
- // this.delayMarqueueTime = 15;
- // },
- onLoad () {
- this.rollPanel = this.rollNode.getComponent("OlympusRollPanel");
- this.gameConfig = {};
- this.bets = [];
- this.addNormalButtonListener();
- this.LG_PATH_SC = "OLYMPUS/";
- this.jackpotScore = -1;
- this.jackpotNumPositionY = [
- {y1:-208, y2:298},//0
- {y1:-163, y2:354},//1
- {y1:-118, y2:409},//2
- {y1:-73, y2:464},//3
- {y1:-28, y2:519},//4
- {y1:-434, y2:16},//5
- {y1:-388, y2:62},//6
- {y1:-344, y2:107},//7
- {y1:-298, y2:152},//8
- {y1:-253, y2:197},//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 = [];
- this.rightJackpotNode.active = false;
- this.delayShowJackpotSweepTime = 2;
- // this.delayMarqueueTime = 0;
- // this.noticeNode.active = false;
- // this.test();
- this.homeBtn.active = !cc.vv.config.ReviewApk;
- this.exitBtn.active = cc.vv.config.ReviewApk;
- },
- start () {
- this.node.parent = cc.director.getScene().getChildByName("Canvas");
- this.node.setPosition(0,0);
- let player = this.getSelfPlayer();
- if(player)
- this._lastScore = player.getUserScore();
- this._lastScore = cc.vv.globalUserInfo.getUserScore();
- this.upPlayerScore(this._lastScore);
- this.allWinScore = 0;
- cc.vv.audioMgr.playBGM("bgm");
- this._gameEnd = true;
- this.nowShowIdx = 0;
- this.delayNextTime = ShowNextJackpotTime;
- this.jackpotRecord = [];
- this.gameConfig = {};
- this.roomData = cc.vv.serverListData.getCurRoomData();
- this.getJackpotRecord();
- this.addMsgListener();
- this.makeDataToGameConfig();
- this._showControl = true;
- this.bTriggerJackpot = false;
- this.onRefreshJackpot();
- this.setPlayback();
- },
- addMsgListener(){
- cc.vv.netSocket.registerEvent(ProtocolLoginServer.CMD_C2S_Game_RollOLYMPUS,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_RollOLYMPUS,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._gameEnd = true;
- this._bAutoGame = false;
- }, delayTimes);
- }
- },
- setPlayback(){
- this.bTestPlayback = cc.vv.testPlayback; //是否是回放
- this.homeBtn.active = !this.bTestPlayback;
- this.playbackNode.active = this.bTestPlayback;
- },
- test() {
- ScenceManager.Instance().setGameComponent(this);
- this.gameConfig.nJetton = [50,100,500,5000]
- this.bets = [50,100,500,5000]
- this._currentScore = cc.vv.globalUserInfo.getUserScore();
- this._lastScore = cc.vv.globalUserInfo.getUserScore();
- this.curBetIndex = 0;
- this.leftFreeCount = 0;
- cc.vv.needFree = false;
- },
- //重写
- addNormalButtonListener() {
- UIHelper.addButtonListener(this.startBtn, this.node, "OlympusGameSence", "onClickStart");
- UIHelper.addButtonListener(this.quickBtn, this.node, "OlympusGameSence", "onClickQuick");
- UIHelper.addButtonListener(this.homeBtn, this.node, "OlympusGameSence", "onClickMenu");
- UIHelper.addButtonListener(this.addBtn, this.node, "OlympusGameSence", "onClickAdd");
- UIHelper.addButtonListener(this.delBtn, this.node, "OlympusGameSence", "onClickDel");
- },
- testResult() {
- /**
- * m_chair_id:
- * m_chip_size:
- * m_result_data:[
- * m_desk_data:[][]
- * m_item_id:[]
- * m_item_count:[]
- * m_item_times:[]
- * m_total_score:
- * bFree:
- * ]
- * m_all_score:
- * m_free_count:
- */
- let data = {};
- data.m_chair_id = 0;
- data.m_chip_size = this.bets[this.curBetIndex];
- data.m_all_score = 0;
- data.m_free_count = 0;
-
- data.m_result_data = [];
- let idx = 0;
- let hasNext = false;
- do{
- hasNext = false;
- let freeCount = 0;
- let res = {};
- let itemCount = [0,0,0,0,0,0,0,0,0,0];
- 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]];
- if(idx > 0) {
- let rrs = data.m_result_data[idx-1];
- 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);
- // for(let i = 0; i < GameProtocol.MAX_COL_NUM; ++i) {
- // for(let j = GameProtocol.MAX_ROW_NUM-1; j >= 0; --j) {
- // temp[i][j] = rrs.m_desk_data[i][j];
- // }
- // }
- for(let k = 0; k < rrs.m_item_count.length; ++k) {
- let ddi = rrs.m_item_id[k];
- for(let i = 0; i < GameProtocol.MAX_COL_NUM; ++i) {
- for(let j = 0; j < GameProtocol.MAX_ROW_NUM; ++j) {
- if(rrs.m_desk_data[i][j] != ddi) {
- temp[i][j] = rrs.m_desk_data[i][j];
- }
- }
- }
- }
- for(let i = 0; i < GameProtocol.MAX_COL_NUM; ++i) {
- let k = GameProtocol.MAX_ROW_NUM-1;
- for(let j = GameProtocol.MAX_ROW_NUM-1; j >= 0; --j) {
- if(temp[i][j] != -1) {
- res.m_desk_data[i][k--] = temp[i][j];
- itemCount[temp[i][j]]++;
- }
- }
- }
- }
- for(let i = 0; i < GameProtocol.MAX_COL_NUM; ++i) {
- for(let j = 0; j < GameProtocol.MAX_ROW_NUM; ++j) {
- if(res.m_desk_data[i][j] != -1) {continue;}
- let ddt = this.getRandomValue(j);
- if(ddt == GameProtocol.FREE_ICON) {
- freeCount++;
- }
- itemCount[ddt]++;
- res.m_desk_data[i][j] = ddt;
- }
- }
- res.m_item_id = [];
- res.m_item_count = [];
- res.m_item_times = [];
- res.m_total_score = 0;
- for(let i = 0; i < itemCount.length; ++i) {
- if(itemCount[i] >= 8) {
- hasNext = true;
- res.m_item_id.push(i);
- res.m_item_count.push(itemCount[i]);
- res.m_item_times.push(i);
- res.m_total_score += 10;
- }
- }
- if(freeCount >= 4) {
- res.bFree = true;
- data.m_free_count += 15;
- }
- data.m_result_data[idx++] = res;
- }while(hasNext);
-
- // data.m_lottery_size = Global.unify(win*data.m_chip_size/50)*5;
- // data.lCurScore = this._currentScore + data.m_lottery_size;
- // this._lastScore = data.lCurScore;
- // cc.vv.globalUserInfo.setUserScore(this._lastScore*100);
- // Global.print(data);
- data = {
- "m_chair_id": 0,
- "m_chip_size": 100,
- "m_result_data": [
- {
- "m_desk_data": [
- 8,
- 8,
- 0,
- 4,
- 4,
- 0,
- 0,
- 0,
- 2,
- 2,
- 2,
- 0,
- 11,
- 0,
- 3,
- 6,
- 5,
- 4,
- 3,
- 9,
- 5,
- 6,
- 0,
- 9,
- 2,
- 0,
- 11,
- 9,
- 0,
- 0
- ],
- "m_item_id": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 10,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 25,
- 0,
- 0,
- 0,
- 0
- ],
- "m_win_score": 25
- },
- {
- "m_desk_data": [
- 8,
- 8,
- 1,
- 4,
- 4,
- 11,
- 2,
- 9,
- 2,
- 2,
- 2,
- 1,
- 11,
- 9,
- 3,
- 6,
- 5,
- 4,
- 3,
- 9,
- 5,
- 6,
- 9,
- 9,
- 2,
- 11,
- 11,
- 9,
- 9,
- 11
- ],
- "m_item_id": [
- 9,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 7,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 1000,
- 0,
- 0,
- 0,
- 0
- ],
- "m_win_score": 1000
- },
- {
- "m_desk_data": [
- 8,
- 8,
- 1,
- 4,
- 4,
- 11,
- 2,
- 11,
- 2,
- 2,
- 2,
- 1,
- 11,
- 6,
- 3,
- 6,
- 5,
- 4,
- 3,
- 11,
- 5,
- 6,
- 11,
- 11,
- 2,
- 11,
- 11,
- 3,
- 0,
- 11
- ],
- "m_item_id": [
- 11,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 9,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 1,
- 0,
- 0,
- 0,
- 0
- ],
- "m_deposit_lotttery":991,
- "m_win_score": 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
- ],
- "m_item_id": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_win_score": 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
- ],
- "m_item_id": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_win_score": 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
- ],
- "m_item_id": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_win_score": 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
- ],
- "m_item_id": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_win_score": 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
- ],
- "m_item_id": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_win_score": 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
- ],
- "m_item_id": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_win_score": 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
- ],
- "m_item_id": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_win_score": 0
- }
- ],
- "m_lottery_size": 1025,
- "m_deposit_lotttery": 991,
- "m_free_count": 0,
- "m_add_multi": [
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "lCurScore": 2918
- }
- data = {
- "m_chair_id": 0,
- "m_chip_size": 60,
- "m_result_data": [
- {
- "m_desk_data": [
- 2,
- 3,
- 1,
- 7,
- 2,
- 1,
- 8,
- 5,
- 0,
- 2,
- 1,
- 2,
- 0,
- 7,
- 2,
- 4,
- 3,
- 1,
- 0,
- 0,
- 2,
- 1,
- 0,
- 2,
- 3,
- 1,
- 1,
- 5,
- 0,
- 1
- ],
- "m_item_id": [
- 1,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 8,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 40,
- 0,
- 0,
- 0,
- 0
- ],
- "m_deposit_lotttery": 0,
- "m_win_score": 24
- },
- {
- "m_desk_data": [
- 2,
- 3,
- 9,
- 7,
- 2,
- 3,
- 8,
- 5,
- 0,
- 2,
- 0,
- 2,
- 0,
- 7,
- 2,
- 4,
- 3,
- 9,
- 0,
- 0,
- 2,
- 2,
- 0,
- 2,
- 3,
- 11,
- 3,
- 5,
- 0,
- 0
- ],
- "m_item_id": [
- 0,
- 2,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 8,
- 8,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 25,
- 50,
- 0,
- 0,
- 0
- ],
- "m_deposit_lotttery": 0,
- "m_win_score": 45
- },
- {
- "m_desk_data": [
- 0,
- 3,
- 9,
- 7,
- 3,
- 3,
- 8,
- 5,
- 2,
- 4,
- 3,
- 0,
- 4,
- 7,
- 0,
- 4,
- 3,
- 9,
- 1,
- 0,
- 6,
- 2,
- 7,
- 5,
- 3,
- 11,
- 3,
- 5,
- 0,
- 4
- ],
- "m_item_id": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_deposit_lotttery": 0,
- "m_win_score": 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
- ],
- "m_item_id": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_deposit_lotttery": 0,
- "m_win_score": 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
- ],
- "m_item_id": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_deposit_lotttery": 0,
- "m_win_score": 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
- ],
- "m_item_id": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_deposit_lotttery": 0,
- "m_win_score": 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
- ],
- "m_item_id": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_deposit_lotttery": 0,
- "m_win_score": 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
- ],
- "m_item_id": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_deposit_lotttery": 0,
- "m_win_score": 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
- ],
- "m_item_id": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_deposit_lotttery": 0,
- "m_win_score": 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
- ],
- "m_item_id": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_count": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_item_times": [
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "m_deposit_lotttery": 0,
- "m_win_score": 0
- }
- ],
- "m_lottery_size": 69,
- "m_deposit_lotttery": 0,
- "m_free_count": 0,
- "m_add_multi": [
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0
- ],
- "lCurScore": 15031736
- }
- setTimeout(()=>{
- this.onRollEndInfo(data);
- }, 300);
- },
- getRandomValue(i) {
- // if(i > 0) {
- // return this.rollPanel.getRandomValue();
- // }
- let ddd = Math.floor(Math.random()*100);
- return ddd % 10;
- },
- onClickCloseControlInfo() {
- this._showControl = false;
- this.node.getChildByName("ControlInfo").active = false;
- },
- // 控制数据
- onSubSendControlInfo(data) {
- // return;
- if(BaseDefine.LOCALTEST && this._showControl) {
- Global.print(data);
- this.node.getChildByName("ControlInfo").active = true;
- this._controlInfo = data;
- this.showControlInfo();
- }
- },
- showControlInfo() {
- const infoNode = cc.find("ControlInfo/info", this.node);
- if(!infoNode.active) return;
- let data = this._controlInfo;
- let txt = `<b>`
- + `<color=#ffffff>房间杀率:${parseFloat(data.RoomSha/100.0).toFixed(2)}%</c> `
- + `<color=#ffffff>触发系统赢:${parseFloat(data.RoomWin/100.0).toFixed(2)}%</c> `
- + `<color=#ffffff>触发系统输:${parseFloat(data.RoomLost/100.0).toFixed(2)}%</c>\n`
- + (
- (!!data.IsDanKong) ? (
- `<color=#ffffff>单控有</c> `
- + `<color=#ffffff>单控玩家${(data.DanType==1)? "输" : ((data.DanType==2)? "赢": "无")}</c> `
- + `<color=#ffffff>随到${data.RoomSuiRate}%</c> `
- + `<color=#ffffff>玩家: ${data.szNickName}</c> `
- + `<color=#ffffff>门槛: ${data.DanMinBet}</c>`
- ): (
- (!!data.QunState) ? (
- `<color=#ffffff>群控${(data.RoomResult==1)? "系统赢" : ((data.RoomResult==2)? "系统输": "无控制")}</c>`
- + `<color=#ffffff>随到概率${parseFloat(data.RoomSuiRate/100.0).toFixed(2)}%</c>\t`
- ): (
- `<color=#ffffff>单控无, 群控无</c>`
- )
- )
- )
- + `<color=#ffffff> 控制值${data.cbControlValue}</c>`
-
- infoNode.getChildByName("label").getComponent(cc.RichText).string = txt;
- },
- // onSocketHorseMessage(data) {
- // if(cc.vv.config.ReviewApk) {return;}
- // Global.print(data)
- // var str = data.szMessage;
- // var list = str.split('##');
- // if(this.getGameKind() == list[0]) {
- // var rewardTxt = ['', 'jackpot'];
- // var gameinfo = GameConstant.getGameUiInfoByKindId(list[0]);
- // var sstr = `Jogador ${list[2]} no jogo ${gameinfo.en_name}, ganhou o prêmio ${rewardTxt[list[1]]}, ganha $${(list[3]/100).toFixed(2)}`;
- // this.marqueueArr.push(sstr);
- // if(this.delayMarqueueTime <= 0) {
- // this.showNextMar();
- // }
- // }
- // },
- 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.curBetIndex = 0;
- this.bets = this.gameConfig.nJetton;
- this.refrushBet();
- // this.updateJackpot(this.gameConfig);
- this.rollPanel.forceStop();
- },
- 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.bets = this.gameConfig.nJetton;
- this.curBetIndex = 0;
- 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;
- 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中免费次数" : "";
- 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();
- },
- updateMarqueue(dt) {
- if(this.delayMarqueueTime > 0) {
- this.delayMarqueueTime -= dt;
- let noticeNode = this.node.getChildByName("notice1");
- let noticeLabel = noticeNode.getChildByName("Mask").getChildByName("label_notice");
- noticeLabel.x -= dt*100;
- if(noticeLabel.x + noticeLabel.width < -300) {
- noticeNode.active = false;
- }
- }else{
- if(this.marqueueArr.length <= 0) {
- this.node.getChildByName("notice1").active = false;
- return;
- }
- this.showNextMar();
- }
- },
- 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 = 'R$'+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.rightJackPotClone);
- 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);
- },
- 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.goldGameLeave();
- */
- this._backHome = true;
- cc.sys.localStorage.setItem("InGameServerID", -1);
- this.removeMsgListener();
- ScenceManager.Instance().gameBackScence();
- // this.backHome();
- // this.exitGame();
- },
- onRollEndInfo(data) {
- console.log('雷神:', data);
- //数据改造
- for(let i=0; i < data.m_result_data.length; i++){
- //m_desk_data服务器从1开始,客户端需要从0开始
- for(let j=0; j < data.m_result_data[i].m_desk_data.length; j++){
- if(data.m_result_data[i].m_desk_data[j] >= 1){
- data.m_result_data[i].m_desk_data[j] -= 1;
- }
- }
- //m_item_id服务器从1开始,客户端需要从0开始
- for(let k=0; k < data.m_result_data[i].m_item_id.length; k++){
- if(data.m_result_data[i].m_item_id[k] >= 1){
- data.m_result_data[i].m_item_id[k] -= 1;
- }
- }
- }
- this.gameEndData = data;
-
- // if(this._nFreeCount > 0) {
- // this.upFreeCount();
- // }else{
- // this._nFreeTotal = 0;
- // this.allWinScore = 0;
- // }
- // this._nFreeCount = data.cbFreeTime;
- // this._nFreeTotal += data.cbFreeAdd;
- // this._bFreeState = data.m_kongming;
- 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);
- },
- onSendRoll() {
- /*
- // this.testResult();
- // return;
- let t = {};
- t.nJetton = this.gameConfig.nJetton[this.curBetIndex];
- // Global.print(t);
- this.SendGameSocketData(GameProtocol.SUB_C_LOTTERY, t);
- */
- setTimeout(()=>{
- let _data = {'CMD':ProtocolLoginServer.CMD_C2S_Game_RollOLYMPUS,
- 'Value':this.gameConfig.nJetton[this.curBetIndex],
- 'RoomID':this.roomData.ServerID
- };
- cc.vv.netSocket.send(JSON.stringify(_data));
- }, 500);
- },
- upLeftCount() {
- this.freeLeftNode.active = this._bSpecialGame;
- if(this._bSpecialGame) {
- this.freeLeftNode.getChildByName("left").getComponent(cc.Label).string = this._nFreeCount + '/' + this._nFreeTotal;
- }
- },
- 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);
- },
- judgeCannotRollGame() {
- if(!cc.vv.netSocket.bNowOpend())
- return false;
- //下注配置为空
- if(!this.bets || !this.gameConfig || !this.gameConfig.nJetton || this.curBetIndex == null) {
- return false;
- }
- if(this._nFreeCount > 0) {
- return true;
- }
- //检测钱是否够用
- if(this._lastScore < Global.unify(this.bets[this.curBetIndex])) {
- this.showLowLackMoney();
- return false;
- }
- this._currentScore = this._lastScore - Global.unify(this.bets[this.curBetIndex]);
- this.upPlayerScore(this._currentScore);
- return true;
- },
- onStartRoll() {
- // 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.resumeBackMusic()) {
- // cc.vv.audioMgr.playBGM("bgm");
- // }
-
- // this.upLeftCount();
- this.onSendRoll();
- this.showCenterNormal();
- this.onGameStart();
- this.rollPanel.startRollActions();
- this.playEffect('shuax');
- },
- resetGameView() {
- this.hideResultPanel();
- this.node.getChildByName("freeWin").active = false;
- },
- resetAllBtn() {
- if(this._bAutoGame || this._bSpecialGame) return;
- this.upBtnInteractable(this.startBtn, true);
- this.upBetAddOrDelState();
- },
- onGameStart() {
- this.upBtnInteractable(this.startBtn, false);
- this.upBtnInteractable(this.addBtn, false);
- this.upBtnInteractable(this.delBtn, false);
- },
- showGameEnd() {
- this._gameEnd = true;
- this.changeGameState(2);
- Global.print('showGameEnd')
- // this.freeLeftNode.active = this._nFreeCount > 0;
- //获得免费次数
- if(this._bFreeState == 1) {
- // cc.vv.audioMgr.pauseBackMusic();
- this.showGetFreeTimes(this.gameEndData.cbFreeAdd);
- }else if(this.winAniIdx < 0 || this._bSpecialGame){
- Global.print('delayStartNextRoll')
- this.delayStartNextRoll(0.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() {
- 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);
- if(this.winAniIdx > 2) {
- this.playJackpotAni();
- }
- }else{
- goldNode.active = false;
- }
- // this.playJackpotAni();
- 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);
- })
- .start()
- },
- playScoreAddAni(sLabel, sLabel2) {
- let start = 0;
- let bet = this.gameConfig.nJetton[this.curBetIndex];
- let endScore = Global.formatString2Score(this.needPlayinfScore);
- let add = parseFloat(bet/100);
- this.upScoreLabel1 = ()=>{
- start += add;
- if(start >= endScore) {
- this.skipScoreAdd(sLabel, sLabel2);
- }else{
- sLabel.string = Math.floor(start);
- sLabel2.string = ((parseFloat(start - Math.floor(start)).toFixed(2)).toString()).slice(1);
- }
- }
- if(this.upScoreLabel1) {
- this.unschedule(this.upScoreLabel1);
- }
- this.schedule(this.upScoreLabel1, 0.01);
- },
- skipScoreAdd(sLabel, sLabel2) {
- this.isPlayingScoreAddAni = false;
- if(this.upScoreLabel1) {
- this.unschedule(this.upScoreLabel1);
- }
- let score = Global.formatString2Score(this.needPlayinfScore);
- sLabel.string = Math.floor(score);
- sLabel2.string = ((parseFloat(score - Math.floor(score)).toFixed(2)).toString()).slice(1);
-
- this.delayStartNextRoll(0.6);
- },
- hideResultPanel() {
- this.resultNode.active = false;
- },
- changeGameState(state) {
- this._gameState = state;
- },
- upBetAddOrDelState() {
- this.upBtnInteractable(this.delBtn, this.curBetIndex>0);
- this.upBtnInteractable(this.addBtn, this.curBetIndex<this.bets.length-1);
- },
- upBtnInteractable(btn, state) {
- btn.getComponent(cc.Button).interactable = state;
- },
- onClickResultMask() {
- if(this.isPlayingScoreAddAni) {
- this.onClickSkip();
- }else{
- this.hideResultPanel();
- }
- },
- addGameWinScore(score) {
- this.allWinScore += score;
- this.playinfScore = this.allWinScore;
- this.winScoreLabel.string = (this.allWinScore/100).toFixed(2);
- },
- playAddScoreMulti(scoreNode, multi, idx) {
- let node = cc.instantiate(scoreNode);
- scoreNode.active = false;
- node.active = true;
- let startPos = cc.v2(scoreNode.parent.parent.parent.x, scoreNode.parent.parent.y);
- node.position = startPos;
- node.parent = this.node;
- cc.tween(node)
- .delay(1.2*idx+0.3)
- .call(()=>{
- this.playEffect('qiufly')
- })
- .to(0.7, {y: startPos.y+10, scale: 1.5})
- .to(0.5, {position: cc.v2(0, -328)})
- .call(()=>{
- node.active = false;
- if(idx == 0) {
- this.playEndScoreAdd(multi-1);
- }else{
- this.playEndScoreAdd(multi);
- }
- node.destroy();
- })
- .start()
- },
- playEndScoreAdd(multi) {
- let startScore = this.playinfScore;
- let endScore = this.playinfScore + this.allWinScore * multi;
- let add = Math.floor((endScore - startScore) / 20);
- if(add <= 0) {
- add = 1;
- }
- if(this.upScoreLabel) {
- this.unschedule(this.upScoreLabel);
- }
- this.upScoreLabel = ()=>{
- startScore += add;
- if(startScore >= endScore) {
- // this.skipScoreAdd(sLabel, sLabel2);
- this.unschedule(this.upScoreLabel);
- this.playinfScore = endScore;
- this.winScoreLabel.string = (endScore/100).toFixed(2);
- }else{
- this.winScoreLabel.string = (startScore/100).toFixed(2);
- }
- }
- this.schedule(this.upScoreLabel, 0.01);
- },
- showGameWinScore() {
- this.winAniIdx = -1;
- this.needPlayinfScore = this.gameEndData.m_lottery_size;
- let score = this.gameEndData.m_lottery_size;
- // if(this.gameEndData.m_deposit_lotttery > 0) { //彩金池
- // this.winAniIdx = 4;
- // this.needPlayinfScore = this.gameEndData.m_deposit_lotttery;
- // this.winScoreLabel.string = Global.formatString2Score(this.needPlayinfScore + this.gameEndData.m_lottery_size);
- // this.playEffectByID(4);
- // this.showResultPanel();
- // return;
- // }
- let timers = score / this.gameConfig.nJetton[this.curBetIndex];
- this._currentScore = this._lastScore;
- this.upPlayerScore(this._currentScore);
-
- if(score <= 0){
- this.showGameEnd();
- return;
- }
- this.playSoundByTimes(timers);
- this.winScoreLabel.string = (this.needPlayinfScore/100).toFixed(2)//Global.formatString2Score(this.needPlayinfScore);
-
- if(this.winAniIdx >= 0) {
- this.showResultPanel();
- }
- this.showGameEnd();
- },
- delayStartNextRoll(delayTime) {
- //delayTime = 0; //策划想快一点,取消延迟
- // if(!this._bSpecialGame) {
- // this._nFreeTotal = 0;
- // this.freeLeftNode.active = false;
- // }
- this.changeGameState(0);
- // this.resetAllBtn();
- this.node.stopAllActions();
- cc.tween(this.node)
- .delay(delayTime)
- .call(()=>{
- if(this._bAutoGame){ //自动游戏时
- this.onStartRoll();
- }else{
- this.upBtnInteractable(this.startBtn, true);
- this.resetAllBtn();
- }
- })
- .start()
- },
- playJackpotAni() {
- this.delayShowJackpotSweepTime += 5;
- this.jackpotAni.clearTracks();
- this.jackpotAni.setAnimation(0, 'a2', false);
- // this.jackpotAni.addAnimation(0, 'a1', true);
- },
- showGetFreeTimes(times) {
- this.playEffect("freeget");
- let freeNode = this.node.getChildByName("freeNode");
- let aniNode = freeNode.getChildByName("mask");
- freeNode.active = true;
- this._bSpecialGame = true;
- let ani = aniNode.getChildByName("ani").getComponent(sp.Skeleton);
- ani.clearTracks();
- ani.setAnimation(0, "a1", false);
- 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(2)
- .call(()=>{
- freeNode.active = false;
- this.delayStartNextRoll(0.2);
- })
- .start()
- },
- showJackpotWin(score) {
- this.needPlayinfScore = score;
- this.playEffectByID(4);
- this.playJackpotAni();
- let winNode = this.node.getChildByName("freeWin");
- winNode.active = true;
- let node = winNode.getChildByName("mask");
- let scoreNode = node.getChildByName("Node").getChildByName("score1");
- let scoreNode1 = node.getChildByName("Node").getChildByName("score2");
- scoreNode.stopAllActions();
- scoreNode1.stopAllActions();
- scoreNode.active = true;
- scoreNode1.active = true;
- let scoreLabel = scoreNode.getComponent(cc.Label);
- let scoreLabel1 = scoreNode1.getComponent(cc.Label);
- scoreLabel.string = '0';
- scoreLabel1.string = '.00';
- let ani = node.getComponent(sp.Skeleton);
- ani.clearTracks();
- ani.setAnimation(0, "a1", false);
- this.isPlayingScoreAddAni = true;
- ani.setCompleteListener(()=>{
- ani.setCompleteListener(null)
- ani.setAnimation(0, "a2", true);
- scoreNode.active = true;
- scoreNode1.active = true;
- this.playFreeWinAddAni(scoreNode.getComponent(cc.Label),scoreNode1.getComponent(cc.Label));
- })
- },
- hideJackpotWin() {
- // this.playButtonEffect();
- let winNode = this.node.getChildByName("freeWin");
- winNode.stopAllActions();
- winNode.active = false;
- this.rollPanel.resumeShowPrizes();
- },
- onClickJackpotMask() {
- if(this.isPlayingScoreAddAni) {
- this.onClickSkipFreeWin();
- }else{
- this.hideJackpotWin();
- }
- },
- onClickSkipFreeWin() {
- // this.playButtonEffect();
- if(this.isPlayingScoreAddAni) {
- let winNode = this.node.getChildByName("freeWin").getChildByName("mask").getChildByName("Node");
- this.skipFreeWinAdd(winNode.getChildByName("score1").getComponent(cc.Label),winNode.getChildByName("score2").getComponent(cc.Label));
- }else{
- this.hideJackpotWin();
- }
- // let winNode = this.node.getChildByName("freeWin").getChildByName("mask").getChildByName("Node");
- // this.skipFreeWinAdd(winNode.getChildByName("score1").getComponent(cc.Label),winNode.getChildByName("score2").getComponent(cc.Label));
- },
- onClickFreeWinStart() {
- },
- playFreeWinAddAni(sLabel, sLabel1) {
- sLabel.string = '0';
- sLabel1.string = '.00';
- let start = 0;
- let bet = this.gameConfig.nJetton[this.curBetIndex];
- let endScore = Global.formatString2Score(this.needPlayinfScore);
- let add = parseFloat(bet/100);
- if(add <= 0) {
- add = 1;
- }
- if(this.upFreeWinLabel) {
- this.unschedule(this.upFreeWinLabel);
- }
- this.upFreeWinLabel = ()=>{
- start += add;
- if(start >= endScore) {
- this.skipFreeWinAdd(sLabel, sLabel1);
- }else{
- // sLabel.string = parseFloat(start).toFixed(2);
- sLabel.string = Math.floor(start);
- sLabel1.string = ((parseFloat(start - Math.floor(start)).toFixed(2)).toString()).slice(1);
- }
- }
- if(this.upFreeWinLabel) {
- this.unschedule(this.upFreeWinLabel);
- }
- this.schedule(this.upFreeWinLabel, 0.01);
- },
- skipFreeWinAdd(sLabel, sLabel1) {
- if(this.upFreeWinLabel) {
- this.unschedule(this.upFreeWinLabel);
- }
- this.isPlayingScoreAddAni = false;
- let score = Global.formatString2Score(this.needPlayinfScore);
- sLabel.string = Math.floor(score);
- sLabel1.string = ((parseFloat(score - Math.floor(score)).toFixed(2)).toString()).slice(1);
-
- if(this._bAutoGame) {
- cc.tween(this.node.getChildByName("freeWin"))
- .delay(1.5)
- .call(()=>{
- this.hideJackpotWin();
- })
- .start()
- }
- },
- changeFreeWinBtn(bSkip) {
- let winNode = this.node.getChildByName("freeWin").getChildByName("mask");
- winNode.getChildByName("btn_start").active = !bSkip;
- winNode.getChildByName("btn_skip").active = bSkip;
- },
- changeBtnState(bEnd) {
- this.startBtn.active = !bEnd;
- },
-
- refrushBet() {
- this.upBetAddOrDelState();
- let bet = this.bets[this.curBetIndex];
- this.betNode.getChildByName("allbet").getComponent(cc.Label).string = Global.formatString2Score(bet);
- },
-
- onClickStart() {
- this.playButtonEffect();
- this.onStartRoll();
- },
- onClickQuick(event) {
- this.playButtonEffect();
- this._bAutoGame = !event.target.getComponent(cc.Toggle).isChecked;
- this._nAutoCount = -1;
- },
- onClickMenu() {
- this.playButtonEffect();
- UIHelper.loadRes('GamePrefabs/Public/GameMenu', cc.Prefab, (prefab)=>{
- if (!this._ruleNode) {
- this._ruleNode = cc.instantiate(prefab);
- this._ruleNode.parent = this.node.getChildByName("MenuNode");
- }
- this._ruleNode.getComponent("GameMenu").show();
- this._ruleNode.getComponent("GameMenu").onBtnBangZhu = ()=>{
- this.showRule();
- }
- })
- },
- onHideRule() {
- this.ruleNode.active = false;
- },
- showRule() {
- Global.print("展示规则");
- if(this._ruleNode) {
- this._ruleNode.active = false;
- }
- this.ruleNode.active = true;
- },
- onClickAdd() {
- this.curBetIndex++;
- this.playButtonEffect();
- this.refrushBet();
- },
- onClickDel() {
- this.curBetIndex--;
- this.playButtonEffect();
- this.refrushBet();
- },
- // getGameKind() {
- // return GameConstant.KIND_ID_FRUIT9X;
- // },
- onClickPlayback(){
- console.log('点击回放');
- 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);
- this.showCenterNormal();
- this.onGameStart();
- this.rollPanel.startRollActions();
- this.playEffect('shuax');
- // 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],
- // "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,
- // "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],
- // "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],
- // "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,
- // "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],
- // "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],
- // "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,
- // "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],
- // "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],
- // "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,
- // "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],
- // "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],
- // "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,
- // "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],
- // "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],
- // "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}]}}`;
- 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();
- },
- onClickExit() {
- if(!this._gameEnd || this._nFreeCount > 0) {
- topTipMsg.showTopTipMsg(LanguageKey.t("pubWords.not_exit_game"));
- return;
- }
- cc.game.end();
- },
- showCenterNormal() {
- if(this._bSpecialGame) return;
- this.allWinScore = 0;
- this.node.getChildByName("RoomInfoNode").getChildByName("img_1").getChildByName("winNode").active = true;
- this.node.getChildByName("RoomInfoNode").getChildByName("img_1").getChildByName("winNode").getChildByName("score").getComponent(cc.Label).string = "0.00"
- },
- 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("FruitRule").show();
- })
- },
- upPlayerScore(score) {
- cc.vv.globalUserInfo.setUserScore(score);
- this.playerScore.string = Global.formatString2Score(score);
- },
- onUserEnter(clientUserItem) {
- this._currentScore = clientUserItem.GetUserScore();
- this._lastScore = this._currentScore;
- this.upPlayerScore(this._lastScore);
- },
- upPlayerInfo(clientUserItem) {
- this._lastScore = clientUserItem.GetUserScore();
- },
- playSoundByTimes(_times) {
- if(_times <= 0) return;
- Global.print("winTimes:"+_times)
- let id = 1;
- if(_times > 120){
- id = 15;
- this.winAniIdx = 3;
- }else if(_times > 100){
- id = 14;
- this.winAniIdx = 3;
- }else if(_times > 80){
- id = 13;
- this.winAniIdx = 3;
- }else if(_times > 64){
- id = 12;
- this.winAniIdx = 3;
- }else if(_times > 48){
- id = 11;
- this.winAniIdx = 3;
- }else if(_times > 32){
- id = 10;
- this.winAniIdx = 3;
- }else if(_times > 20){
- id = 9;
- this.winAniIdx = 3;
- }else if(_times > 12){
- id = 8;
- this.winAniIdx = 3;
- }else if(_times > 8){
- id = 5;
- this.winAniIdx = 2;
- }else if(_times > 4){
- id = 4;
- this.winAniIdx = 1;
- }else if(_times > 2){
- id = 3;
- this.winAniIdx = 0;
- }else if(_times > 1){
- id = 2;
- this.winAniIdx = -1;
- }
- // this.playEffect("Level"+this.winAniIdx);
- this.playEffectByID(this.winAniIdx);
- },
- playEffectByID(id) {
- let audioC = this.audioArr[id];
- if(audioC) {
- this.playingEffectID = cc.vv.audioMgr.playEffectByAudioClip(audioC);
- }
- },
- playButtonEffect(){
- this.playEffect("button");
- },
- //播放音效
- playEffect(effName, needStop = false) {
- if(needStop)
- cc.vv.audioMgr.stopAllEffects();
- cc.vv.audioMgr.playSFX(effName);
- },
- });
|