let gameConfig = require("GameConfig"); let library = require("../Library"); cc.Class({ extends: cc.Component, properties: { gameStates: { default: null, type: cc.Node, serializable: true, }, gameMode: { default: null, type: cc.Node, serializable: true, }, playerController: { default: null, type: cc.Node, serializable: true, }, countDown: { default: null, type: cc.Node, serializable: true, }, kCal: { default: null, type: cc.Node, serializable: true, }, restTimeRing: { default: null, type: cc.Node, serializable: true, }, roundCurrentTime: { default: null, type: cc.Node, serializable: true, }, roundTxt: { default: null, type: cc.Node, serializable: true, }, nameTxt: { default: null, type: cc.Node, serializable: true, }, videoController: { default: null, type: cc.Node, serializable: true, }, videoplayer: { default: null, type: cc.Node, serializable: true, },progressBar: { default: null, type: cc.Node, serializable: true, }, comb: { default: null, type: cc.Node, serializable: true, }, countDownAudio: { default: null, type: cc.AudioClip, serializable: true, }, startGunAudio: { default: null, type: cc.AudioClip, serializable: true, }, actions: { default: null, type: cc.Node, serializable: true, }, hint: { default: null, type: cc.Node, serializable: true, }, loopTxt: { default: null, type: cc.Label, serializable: true, }, nextBtn: { default: null, type: cc.Node, serializable: true, }, }, onLoad () { this.gStatesScp = this.gameStates.getComponent('GameStates'); this.gameModeScp = this.gameMode.getComponent('GameMode'); this.playerControllerScp = this.playerController.getComponent('PlayerController'); this.restTimeRingScp = this.restTimeRing.getComponent('ProgressBar'); this.videoControllerScp = this.videoController.getComponent('SpriteVideoPlayer'); this.audioControllerScp = this.node.getComponent('AudioController'); this.combScp = this.comb.getComponent('Combo'); this.punchInteractScp = this.actions.getComponent('PunchInteract'); this.hintScp = this.hint.getComponent('Hint'); if(!this.gStatesScp.bLoop) { this.loopTxt.string = '循环'; } else { this.loopTxt.string = '顺序'; } }, resetRound() { this.round = gameConfig.round[this.gStatesScp.currentRound]; this.gStatesScp.curretState = this.gStatesScp.countDown; this.gStatesScp.bSecondOrTimes = 0; if(this.round.second != 0) { this.gStatesScp.bSecondOrTimes = 1; } if(this.gStatesScp.bSecondOrTimes) { this.roundCurrentTime.getComponent(cc.Label).string = this.round.second+' ″'; } else { this.roundCurrentTime.getComponent(cc.Label).string = this.round.times+' ″'; } this.roundTxt.getComponent(cc.Label).string = this.gStatesScp.currentRound+1; this.nameTxt.getComponent(cc.Label).string = this.round.name; this.restTimeRingScp.getComponent(cc.Sprite).fillRange = 1; this.gStatesScp.roundTime = 0; this.gStatesScp.currentSoundIndex = 0; this.progressBar.getComponent(cc.ProgressBar).progress = (this.gStatesScp.currentRound+1)/24; if(this.gStatesScp.currentRound+1==24) { this.progressBar.getComponent(cc.ProgressBar).progress = 1; } for(let i=0; i