let webView = require("../../WebView"); let library = require("../../Library"); let gameConfig = require("../GameConfig"); cc.Class({ extends: cc.Component, properties: { gameStates: { default: null, type: cc.Node, serializable: true, }, gameMode: { default: null, type: cc.Node, serializable: true, }, topHole: { default: null, type: cc.Node, serializable: true, }, leftHole: { default: null, type: cc.Node, serializable: true, }, rightHole: { default: null, type: cc.Node, serializable: true, }, avatar: { default: null, type: cc.Sprite, serializable: true, }, playerName: { default: null, type: cc.Label, serializable: true, }, score: { default: null, type: cc.Label, serializable: true, }, gender: { default: null, type: cc.Node, serializable: true, }, hp: { default: null, type: cc.Node, serializable: true, }, bAi:true, id:0, }, onLoad () { this.init(); if(cc.sys.isMobile) { webView.register(this.node); } }, init() { this.topHoleScp = this.topHole.getComponent('Actor'); this.leftHoleScp = this.leftHole.getComponent('Actor'); this.rightHoleScp = this.rightHole.getComponent('Actor'); this.gStatesScp = this.gameStates.getComponent('GameStates'); this.gameModeScp = this.gameMode.getComponent('GameMode'); this.pStatesScp = this.node.getComponent('BasePlayerStates'); this.hpScp = this.hp.getComponent('MaskedProgressBar'); this.bCd = false; }, start() { this.score.string = this.pStatesScp.hit.toString(); }, left() { if(this.gStatesScp.curretState == this.gStatesScp.finished) return; if(!this.leftHoleScp.bBeat) { this.wrong(); return; } this.leftHoleScp.punch(this.bAi); this.hit(); }, top() { if(this.gStatesScp.curretState == this.gStatesScp.finished) return; if(!this.topHoleScp.bBeat) { this.wrong(); return; } this.topHoleScp.punch(this.bAi); this.hit(); }, right() { if(this.gStatesScp.curretState == this.gStatesScp.finished) return; if(!this.rightHoleScp.bBeat) { this.wrong(); return; } this.rightHoleScp.punch(this.bAi); this.hit(); }, noDirectionPunch() { if(this.gStatesScp.curretState == this.gStatesScp.finished) return; let arr = this.gStatesScp.appearMouseArr; for(let i=0;i