let library = require("../Library"); let webView = require("../WebView"); cc.Class({ extends: require("BasePlayerController"), properties: { }, start() { this._super(); if(cc.sys.isMobile) { this.avatar.spriteFrame = webView.rivalAvatarSpriteFrame; this.avatar.node.width = 80; this.avatar.node.height = 80; this.playerName.string = webView.rivalUserName; this.gender.string = webView.rivalGender; } this.gStatesScp.playerStatesArr.push(this.pStatesScp); }, hit() { this.pStatesScp.hit++; this.score.string = this.pStatesScp.hit.toString(); }, actorComeOut(nameIndex,appearDur) { // return; let timing = library.getRandom(0.5, appearDur, 1); let bBeat = library.randomInt(0,3); // console.log('bBeat=',bBeat); // console.log('appearDur=',appearDur); if(bBeat!=0) { timing = appearDur; } // console.log('nameIndex=',nameIndex); this.scheduleOnce(function () { switch (nameIndex) { case 0: this.top(); console.log('ai hit top mouse'); break; case 1: this.left(); console.log('ai hit left mouse'); break; case 2: this.right(); console.log('ai hit right mouse'); break; default: break; } },timing); } });