window.boxingManager = { // confs: [ // { // top: { // time: 0.2, // timeScale: 3 // }, // mid: { // time: 2.6, // timeScale: 1 // }, // lower: { // time: 0.1, // timeScale: 3 // }, // }, // { // top: { // time: 0.2, // timeScale: 3 // }, // mid: { // time: 2.2, // timeScale: 1 // }, // lower: { // time: 0.1, // timeScale: 3 // } // }, // { // top: { // time: 0.2, // timeScale: 3 // }, // mid: { // time: 2, // timeScale: 1 // }, // lower: { // time: 0.1, // timeScale: 3 // } // }, // // ], scheduleTimes : [3,1.5,1.25], num: 0, //奖励分数 rewardScore : 10, setConf: function (num) { this.num = num; return this.confs[this.num]; }, getConf: function () { return this.confs[this.num]; }, setScheduleTimes: function (num) { this.num = num; return this.scheduleTimes[this.num]; }, getScheduleTimes: function () { // Log.info("到底是什么",this.num,this.scheduleTimes) return this.scheduleTimes[this.num]; }, } cc.Class({ extends: cc.Component, properties: { }, onLoad() { }, endLoop: function () { }, startLoop: function () { this.count = boxingManager.getScheduleTimes(); this.callback = function () { if (this.count != boxingManager.getScheduleTimes()) { // 在第六次执行回调时取消这个计时器 this.count = boxingManager.getScheduleTimes(); this.unschedule(this.callback); this.startLoop(); return; } // let time = new Date().getTime(); // // console.log("相差时间 ",time-this.currld); // this.currld = time; this.doSomething(); // this.startLoop(); // this.count++; } this.schedule(this.callback, boxingManager.getScheduleTimes()); }, doSomething: function () { if (this.StartLoopListener) { this.StartLoopListener() } }, start() { }, setStartLoopListener(StartLoopListener){ this.StartLoopListener = StartLoopListener; }, update(dt) { }, });