// Learn cc.Class: // - https://docs.cocos.com/creator/manual/en/scripting/class.html // Learn Attribute: // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html cc.Class({ extends: cc.Component, properties: { left: { // ATTRIBUTES: default: null, // The default value will be used only when the component attaching // to a node for the first time type: cc.Label, // optional, default is typeof default serializable: true, // optional, default is true }, mid: { // ATTRIBUTES: default: null, // The default value will be used only when the component attaching // to a node for the first time type: cc.Label, // optional, default is typeof default serializable: true, // optional, default is true }, right: { // ATTRIBUTES: default: null, // The default value will be used only when the component attaching // to a node for the first time type: cc.Label, // optional, default is typeof default serializable: true, // optional, default is true }, front: { // ATTRIBUTES: default: null, // The default value will be used only when the component attaching // to a node for the first time type: cc.Label, // optional, default is typeof default serializable: true, // optional, default is true }, back: { // ATTRIBUTES: default: null, // The default value will be used only when the component attaching // to a node for the first time type: cc.Label, // optional, default is typeof default serializable: true, // optional, default is true }, limitLabel: { // ATTRIBUTES: default: null, // The default value will be used only when the component attaching // to a node for the first time type: cc.Label, // optional, default is typeof default serializable: true, // optional, default is true }, limitDirectionLabel: { // ATTRIBUTES: default: null, // The default value will be used only when the component attaching // to a node for the first time type: cc.Label, // optional, default is typeof default serializable: true, // optional, default is true }, x: { default: null, type: cc.Label, serializable: true, }, y: { default: null, type: cc.Label, serializable: true, }, z: { default: null, type: cc.Label, serializable: true, }, sqrt: { default: null, type: cc.Label, serializable: true, }, ox: { default: null, type: cc.Label, serializable: true, }, oy: { default: null, type: cc.Label, serializable: true, }, oz: { default: null, type: cc.Label, serializable: true, }, oriSqrt: { default: null, type: cc.Label, serializable: true, }, hitCountL: { default: null, type: cc.Label, serializable: true, }, hitCountZ: { default: null, type: cc.Label, serializable: true, }, //调用测试次数 phoneIndex: { default: null, type: cc.Label, serializable: true, }, BLEIndex: { default: null, type: cc.Label, serializable: true, }, avePhoneIndex: { default: null, type: cc.Label, serializable: true, }, aveBLEIndex: { default: null, type: cc.Label, serializable: true, }, writeValue: { default: '', visible: false, serializable: true, }, jumpCount: { default: null, type: cc.Label, serializable: true, }, runCount: { default: null, type: cc.Label, serializable: true, }, moveState: { default: null, type: cc.Label, serializable: true, }, handleState: { default: null, type: cc.Label, serializable: true, }, min: { default: null, type: cc.Label, serializable: true, }, s: { default: null, type: cc.Label, serializable: true, }, ms: { default: null, type: cc.Label, serializable: true, } }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, start() { this.leftCount = 0; this.rightCount = 0; this.midCount = 0; this.backCount = 0; this.onJumpCount(0); this.onRunCount(0); this.onResetState(); }, leftHook() { console.log("左勾拳"); this.leftCount++; this.left.string = "左勾拳:" + this.leftCount; }, jar() { console.log("直拳"); this.midCount++; this.mid.string = "直拳:" + this.midCount; }, rightHook() { console.log("右勾拳"); this.rightCount++; this.right.string = "右勾拳: " + this.rightCount; }, leftJump() { this.leftCount++; this.left.string = "左:" + this.leftCount; }, frontJump() { this.midCount++; this.mid.string = "前:" + this.midCount; }, rightJump() { this.rightCount++; this.right.string = "右: " + this.rightCount; }, backJump() { this.backCount++; this.back.string = "后: " + this.backCount; }, onSlide(e, customEventData) { // console.log(e.progress); window.webView.currentLimitValue = Math.floor(e.progress * 15); console.log("webview.currentLimitValue:", window.webView.currentLimitValue); this.limitLabel.string = window.webView.currentLimitValue; }, onSlideDirection(e, customEventData) { // console.log(e.progress); window.webView.currentLimitDireValue = Math.floor(e.progress * 1000) / 100; console.log("webview.currentLimitDireValue:", window.webView.currentLimitDireValue); this.limitDirectionLabel.string = window.webView.currentLimitDireValue; }, updateLMR(acc) { this.left.string = "x:" + acc.xAxis.toFixed(5); this.mid.string = "y:" + acc.yAxis.toFixed(5); this.right.string = "z:" + acc.zAxis.toFixed(5); }, updateAcc(acc) { this.x.string = "x:" + acc.xAxis.toFixed(5); this.y.string = "y:" + acc.yAxis.toFixed(5); this.z.string = "z:" + acc.zAxis.toFixed(5); }, updateStr(data) { this.sqrt.string = "d:" + data; }, updateSqrt(value) { this.sqrt.string = "sqrt:" + value.toFixed(5); }, updateOriSqrt(value) { this.oriSqrt.string = "oriS:" + value.toFixed(5); }, updateOri(ori) { this.ox.string = " ox:" + ori.beta; this.oy.string = " oy:" + ori.gamma; this.oz.string = " oz:" + ori.alpha; }, updateOriBeta(ori) { this.ox.string = "ox:" + ori.beta; }, updateOriGamma(ori) { this.oy.string = "oy:" + ori.gamma; }, updateOriAlpha(ori) { this.oz.string = "oz:" + ori.alpha; }, updateHitCountL(data) { this.hitCountL.string = "hitx:" + data; }, updateHitCountZ(data) { this.hitCountZ.string = "hitz:" + data.toFixed(2); }, updatePhoneIndex(data) { this.phoneIndex.string = "p:" + data; }, updateBLEIndex(data) { this.BLEIndex.string = "b:" + data; }, onAvePhoneIndex(data) { this.avePhoneIndex.string = "ap:" + data; }, onAveBLEIndex(data) { this.aveBLEIndex.string = "ab:" + data; }, onWriteValueChange(data) { console.log(data); this.writeValue = data; }, onJumpCount(data) { this.jumpCount.string = "jump:" + data; }, onRunCount(data) { if (this.runCount) this.runCount.string = "run:" + data; }, onMoveState(data) { this.moveState.string = "state:" + data; }, onResetState() { this.moveState.string = "state: 无"; }, onHandleState(data) { this.handleState.string = "手柄:" + data; }, updateTime(data) { this.min.string = "min:" + data.min.toFixed(1); this.s.string = "s:" + data.s.toFixed(1); this.ms.string = "ms:" + data.ms.toFixed(1); }, onLeftCount(data) { this.left.string = "jump:" + data; } });