let gameConfig = require("GameConfig"); let library = require("../Library"); let webView = require("../WebView"); cc.Class({ extends: cc.Component, properties: { gameStates: { default: null, type: cc.Node, serializable: true, }, gameMode: { default: null, type: cc.Node, serializable: true, }, rest: { default: null, type: cc.Node, serializable: true, }, demostration: { default: null, type: cc.Node, serializable: true, }, main: { default: null, type: cc.Node, serializable: true, }, }, onLoad() { let self = this; this.gStatesScp = this.gameStates.getComponent('GameStates'); this.gameModeScp = this.gameMode.getComponent('GameMode'); this.restScp = this.rest.getComponent('Rest'); // this.demostrationScp = this.demostration.getComponent('Demostration'); this.mainScp = this.main.getComponent('Main'); this.bCd = true; if(cc.sys.isMobile) { webView.init(this.node,function () { let aMode = self.matchIndex(); if(aMode == -1) { self.gStatesScp.bSinglePlayMode = false; } else { self.gStatesScp.currentRound = aMode; } webView.onBindHitBoxingPost(); webView.onAddQuitModalListener();//添加退出事件 self.node.on('onBoxingPostHit',self.onBoxingPostHit,self); self.node.on('onQuit',self.onQuit,self); self.node.on('onQuitModal',self.onQuitModal,self); self.playRest(); }); } }, start() { if(!cc.sys.isMobile) this.playRest(); }, matchIndex() { let arr = gameConfig.videoNameArr; for(let i=0;i