slambb 3 роки тому
батько
коміт
ce688119eb

+ 1 - 4
common/config.js

@@ -11,7 +11,7 @@ const active = "dev";
 //测试地址,阿里云服务器
 // const host = "https://www.9527fun.cn/api_dev"
 //本地测试地址
-const host = "http://192.168.1.10:9090/api_dev"
+const host = "http://192.168.1.12:9090/api_dev"
 // const host = "http://192.168.0.112:9090/api_dev"
 // const host = "http://47.104.216.192:9090/api_dev"
 // const host = "http://121.4.103.151:9090/api_prd"
@@ -20,15 +20,12 @@ const host = "http://192.168.1.10:9090/api_dev"
 const URL = {
 	//验证token,获取服务器返回的信息
 	VERIFICATION: `${host}/program/Verification_Info`,
-	
 	/**
 	 * @deprecated since version 2.4.15
 	 */
 	SMSLOGIN: `${host}/program/SMS_login`,
 	//根据不同类型账号注册登录
 	SMSLOGINFROMTYPE: `${host}/program/SMS_login_from_type`,
-	
-	
 	/**
 	 * @deprecated since version 2.4.10
 	 */

+ 1 - 1
components/modal/action-hit/action-hit.vue

@@ -1260,7 +1260,7 @@
 			 * 识别跳部分数据处理
 			 */
 			onBLEHitUpdate(gameData) {
-				console.log("gameData:", gameData);
+				// console.log("gameData:", gameData);
 				if (!this.bJumpPlay || this.isGameOver || this.spawnAnimation != null) return;
 
 				// if (curAngleCeil < 30) {

+ 14 - 8
components/modal/action-jump/action-jump.vue

@@ -163,7 +163,7 @@
 	} from 'vuex';
 
 	export default {
-		computed: mapState(['systemInfo','bOldDeviceType']),
+		computed: mapState(['systemInfo', 'bOldDeviceType']),
 		components: {
 
 		},
@@ -444,6 +444,7 @@
 						//发送给game,在game里面处理判断
 						this.listenStateDataOfJump(e);
 					} else if (e.type == 'stop') {
+						console.log("stop");
 						this.onClearData();
 						this.actionJumpObj.resetAll();
 
@@ -470,7 +471,7 @@
 							console.log(e.data);
 						} else if (e.logType == 'error') {
 							console.error(e.data);
-						} else if(e.logType == 'warn'){
+						} else if (e.logType == 'warn') {
 							console.warn(e.data);
 						}
 					}
@@ -956,8 +957,9 @@
 				this.xA = 0;
 				this.yA = 0;
 				this.zA = 0;
-
-				this.actionJumpObj.resetAll();
+				console.log("onClear");
+				if (this.actionJumpObj)
+					this.actionJumpObj.resetAll();
 			},
 
 			/**
@@ -1098,6 +1100,7 @@
 				}
 			},
 			onGameOver(type) {
+				console.log("onGameOver")
 				this.isGameOver = true;
 				//处理参数
 				this.onClear();
@@ -1135,6 +1138,7 @@
 			},
 			//pk模式下结束游戏关卡
 			onPKModeGameOver(type) {
+				console.log("onPKModeGameOver");
 				this.isGameOver = true;
 				//处理参数
 				this.onClear();
@@ -1186,6 +1190,7 @@
 			},
 
 			onActionJumpPlay() {
+				console.log("onActionJumpPlay");
 				this.onClear();
 				this.onClearData();
 				this.startJumpGame();
@@ -1199,11 +1204,12 @@
 				this.faultCount = 0;
 				this.eliminationCount = 0;
 			},
-			
+
 			/**
 			 * 停止并清空数据
 			 */
-			onStopAndClearAction(){
+			onStopAndClearAction() {
+				console.log("onStopAndClearAction");
 				this.onClear();
 				this.onClearData();
 				this.bJumpPlay = false;
@@ -1213,7 +1219,7 @@
 				this.roundingCount = 0;
 				this.faultCount = 0;
 				this.eliminationCount = 0;
-				
+
 				this.jumpCalorie = 0;
 			},
 
@@ -1469,7 +1475,7 @@
 						oGyroZ: gz
 					},
 					//输入当前轴,旧设备使用Y轴,即为true
-					bYAxis: this.bOldDeviceType?true:false,
+					bYAxis: this.bOldDeviceType ? true : false,
 				};
 				this.actionJumpObj.updateJump(_temp);
 				this.BLEAccIndex++;

+ 2 - 2
manifest.json

@@ -2,8 +2,8 @@
     "name" : "哔蹦",
     "appid" : "__UNI__2635DF5",
     "description" : "",
-    "versionName" : "2.5.34",
-    "versionCode" : 22080502,
+    "versionName" : "2.5.35",
+    "versionCode" : 22080802,
     "transformPx" : false,
     /* 5+App特有相关 */
     "app-plus" : {

+ 4 - 4
pages/game-page/game-play-sub/subGame/subGame.nvue

@@ -3,7 +3,7 @@
 		<!-- :src="url" src = 'http://192.168.0.112:7456/build/index.html' :src="LocationGameUrl" -->
 		<!-- @receivedtitle="onReceivedTitle"   @pagefinish="onPageFinish" http://192.168.31.223:7456/-->
 		<view class="web-view">
-			<web-view class="web-view-child" :src="url" ref="webview" @pagestart="onPageStart"
+			<web-view class="web-view-child" src='http://192.168.1.12:7456/' ref="webview" @pagestart="onPageStart"
 				@onPostMessage="handlePostMessage" @error="onError"></web-view>
 		</view>
 
@@ -313,7 +313,7 @@
 			 * 初始化发送数据给游戏
 			 */
 			sendGameInit() {
-
+				console.log("this.avatarUrl:",this.avatarUrl);
 				this.urlToBase64(this.avatarUrl, (toBase64Url) => {
 					let device = null;
 					/**
@@ -1057,10 +1057,10 @@
 						hitPower: 10 //计算的力
 					}
 					if (e.type == 'stateDataOfJump') {
-						console.log("game stateDataOfJump");
+						// console.log("game stateDataOfJump");
 						this.sendMessage("onBoxingPostHit", temp);
 					} else if (e.type == 'stop') {
-						console.log("game stop");
+						// console.log("game stop");
 						this.onClearData();
 						// this.sendMessage("onBoxingPostHit", temp);
 					}

+ 2 - 2
pages/personal-page/personal/personal.vue

@@ -2867,10 +2867,10 @@
 					if (0 === this.currentModeIndex) {
 						this.$refs.actionHitRef.onStopAndClearAction(true);
 						//用于刷新 drawBg
-						this.$refs.actionHitRef.onDrawBg(true);
+						// this.$refs.actionHitRef.onDrawBg(true);
 					} else if (1 === this.currentModeIndex) {
 						this.$refs.actionJumpRef.onStopAndClearAction(true);
-						this.$refs.actionJumpRef.onDrawBg(true);
+						// this.$refs.actionJumpRef.onDrawBg(true);
 					}
 				})
 

BIN
static/modal/boxing-post/left-hook-h@2x.png


BIN
static/modal/boxing-post/left-hook-m@2x.png


BIN
static/modal/boxing-post/right-hook-h@2x.png


BIN
static/modal/boxing-post/right-hook-m@2x.png


+ 2 - 2
util/util-js/action/jump-0.2.js

@@ -112,7 +112,7 @@ ActionJump.prototype.updateJump = function() {
 		bYAxis
 	} = data;
 	//oGyroX 在用的过程中方向相反,所以添加负号
-	let _tempAxisData = bYAxis ? oGyroY : -oGyroX;
+	let _tempAxisData = bYAxis ? oGyroY : -oGyroY;//-oGyroX; 直接解析数据时候,调整
 	this.detectorNewStep(data.resultant, lAccX, lAccY, lAccZ, oAccX, oAccY, oAccZ, data.runIndex, _tempAxisData);
 };
 
@@ -219,7 +219,7 @@ ActionJump.prototype.detectorNewStep = function(resultant, linearX, linearY, lin
 						_frameMaxValue += this.frame[i].maxValue;
 						_frameGyroValue += this.frame[i].gyroValue;
 					}
-					console.log("frame:" + _frameMaxValue + " == " + _frameGyroValue);
+					// console.log("frame:" + _frameMaxValue + " == " + _frameGyroValue);
 
 					//后面通用使用这个类型传输数据
 					this.event.trigger('resultant', {

+ 48 - 38
util/util-js/o0ProjectRelease0.1.js

@@ -15,7 +15,7 @@ module.exports = {
 			this.frameOffset = 0;
 
 			this.frameHitCapacity = 11;
-			this.frameHit = [];//打击后的n帧
+			this.frameHit = []; //打击后的n帧
 
 			for (var i = 0; i < this.frameCapacity; ++i) {
 				var o = new Object();
@@ -49,9 +49,9 @@ module.exports = {
 					var newDirectionDistance = newDirection.length;
 					if (directionDistance < newDirectionDistance) {
 						directionDistance = newDirectionDistance;
-						direction = newDirection.multiply(this.frameHit[this.frameHit.length - 1].time - this.frameHit[0].time);
-					}
-					else {
+						direction = newDirection.multiply(this.frameHit[this.frameHit.length - 1].time -
+							this.frameHit[0].time);
+					} else {
 						//cout << "false" << endl;
 					}
 				}
@@ -79,18 +79,22 @@ module.exports = {
 			if (this.stableCount < this.stableCountMax) {
 				this.stableCount += 1;
 			}
-			this.stableAcc = this.stableAcc.multiply((this.stableCount - 1.0) / this.stableCount).plus(rawAcc.multiply(1 / this.stableCount));
-			this.stableGyr = this.stableGyr.multiply((this.stableCount - 1.0) / this.stableCount).plus(rawGyr.multiply(1 / this.stableCount));
+			this.stableAcc = this.stableAcc.multiply((this.stableCount - 1.0) / this.stableCount).plus(
+				rawAcc.multiply(1 / this.stableCount));
+			this.stableGyr = this.stableGyr.multiply((this.stableCount - 1.0) / this.stableCount).plus(
+				rawGyr.multiply(1 / this.stableCount));
 			//////////////////////////////////////////////////////////////////////////////////
 			newFrame.accFixed = newFrame.acc.length * 100;
 
 			if (newFrame.accFixed < lastFrame.accFixed * 0.85) {
 				newFrame.accFixed = lastFrame.accFixed * 0.85;
 			}
-			lastFrame.accFixed = Math.max(lastFrame.accFixed, Math.min(newFrame.accFixed, last2Frame.accFixed), Math.min(newFrame.accFixed, last3Frame.accFixed));
+			lastFrame.accFixed = Math.max(lastFrame.accFixed, Math.min(newFrame.accFixed, last2Frame
+				.accFixed), Math.min(newFrame.accFixed, last3Frame.accFixed));
 			///////////////////////////////////////////////////////////////////////
 			//newFrame.pos = lastFrame.pos.plus(lastFrame.acc.plus(newFrame.acc).multiply(timeGap/60)).multiply(Math.max(1-timeGap/200,0));
-			newFrame.pos = lastFrame.pos.plus(newFrame.acc.multiply(timeGap / 30)).multiply(Math.max(1 - timeGap / 1000, 0));
+			newFrame.pos = lastFrame.pos.plus(newFrame.acc.multiply(timeGap / 30)).multiply(Math.max(1 -
+				timeGap / 1000, 0));
 			////////////////////////////////////////////
 			newFrame.accSlope = Math.max(newFrame.accFixed - lastFrame.accFixed, 0);
 
@@ -101,8 +105,10 @@ module.exports = {
 			var t4 = newFrame.timeGap + t3;
 
 			newFrame.predict = new o0.Vector2(
-				new o0.QuadraticEquation(0, this.frame[lastI - 2].pos.x, t2, this.frame[lastI - 1].pos.x, t3, this.frame[lastI].pos.x).y(t4),
-				new o0.QuadraticEquation(0, this.frame[lastI - 2].pos.y, t2, this.frame[lastI - 1].pos.y, t3, this.frame[lastI].pos.y).y(t4));/** */
+				new o0.QuadraticEquation(0, this.frame[lastI - 2].pos.x, t2, this.frame[lastI - 1].pos
+					.x, t3, this.frame[lastI].pos.x).y(t4),
+				new o0.QuadraticEquation(0, this.frame[lastI - 2].pos.y, t2, this.frame[lastI - 1].pos
+					.y, t3, this.frame[lastI].pos.y).y(t4)); /** */
 
 			newFrame.shake = o0.distance2(newFrame.predict, newFrame.pos) * 100;
 
@@ -114,25 +120,29 @@ module.exports = {
 			newFrame.shakeFixed = lastFrame.shakeFixed * 0.85;
 			if (newFrame.shake > newFrame.shakeFixed) {
 				newFrame.shakeFixed = newFrame.shake;
-			}/* */
-			lastFrame.shakeFixed = Math.max(lastFrame.shakeFixed, Math.min(newFrame.shakeFixed, last2Frame.shakeFixed), Math.min(newFrame.shakeFixed, last3Frame.shakeFixed));
+			} /* */
+			lastFrame.shakeFixed = Math.max(lastFrame.shakeFixed, Math.min(newFrame.shakeFixed, last2Frame
+				.shakeFixed), Math.min(newFrame.shakeFixed, last3Frame.shakeFixed));
 			////////////////////////////////////////////////////////////////
 			newFrame.shakeSlope = Math.max(newFrame.shakeFixed - lastFrame.shakeFixed, 0);
 			///////////////////////////////////////////////////////////////
 
 			var direction = undefined;
 
-			if (lastFrame.hit == 0
-				&& last2Frame.hit == 0
-				&& last3Frame.hit == 0
-				&& last4Frame.hit == 0
-				&& last5Frame.hit == 0
-				&& (newFrame.accSlope >= 15 || lastFrame.accSlope >= 20)
-				&& (newFrame.shakeSlope >= 20 || lastFrame.shakeSlope >= 40)) {
+			//15 20 20 40 , 13 17 17 35
+			let slopeArr = [15, 20, 20, 40];
+			if (lastFrame.hit == 0 &&
+				last2Frame.hit == 0 &&
+				last3Frame.hit == 0 &&
+				last4Frame.hit == 0 &&
+				last5Frame.hit == 0 &&
+				(newFrame.accSlope >= slopeArr[0] || lastFrame.accSlope >= slopeArr[1]) &&
+				(newFrame.shakeSlope >= slopeArr[2] || lastFrame.shakeSlope >= slopeArr[3])) {
 				newFrame.hit = 1;
-				if (this.frameHit.length < this.frameHitCapacity && this.frameHit.length != 0) {//判断到第二次hit,但还未输出第一次hit的方向,强制输出方向
+				if (this.frameHit.length < this.frameHitCapacity && this.frameHit.length !=
+					0) { //判断到第二次hit,但还未输出第一次hit的方向,强制输出方向
 					direction = this.GetDirection();
-				}/**/
+				} /**/
 				this.frameHit = [];
 
 				/*
@@ -160,7 +170,7 @@ module.exports = {
 				//o.gyr = this.frameHit[this.frameHit.length-1].gyr.plus(newFrame.gyr);
 				o.gyr = newFrame.gyr;
 				this.frameHit.push(o);
-				if (this.frameHit.length == this.frameHitCapacity) {//累计达到设定的延迟帧数,输出方向
+				if (this.frameHit.length == this.frameHitCapacity) { //累计达到设定的延迟帧数,输出方向
 					direction = this.GetDirection();
 				}
 			}
@@ -171,39 +181,39 @@ module.exports = {
 		}
 
 		getTempValue(curDirection) {
-            let result = Math.atan2(curDirection.y,curDirection.x) * 180 / (Math.PI);
-            result = Math.round(result);
-			let curAngle = result > 0 ? result:(360 + result);
-			
+			let result = Math.atan2(curDirection.y, curDirection.x) * 180 / (Math.PI);
+			result = Math.round(result);
+			let curAngle = result > 0 ? result : (360 + result);
+
 			let directionPunch = "all",
 				name = "击中",
 				ename = "hit";
-
-			if (curAngle < 110 && curAngle >= 70) {
+			let positiveMidSlope = [72.5,107.5];//min max
+			let negativeMidSlope = [252.5,287.5];//min max
+			if (curAngle < positiveMidSlope[1] && curAngle >= positiveMidSlope[0]) {
 				directionPunch = "straightPunch";
 				name = "正向的直拳";
 				ename = "front-straight";
-			} else if (curAngle < 70 && curAngle >= 0) {
+			} else if (curAngle < positiveMidSlope[0] && curAngle >= 0) {
 				directionPunch = "rightPunch";
 				name = "正向的右拳";
 				ename = "front-right";
-			} else if (curAngle >= 110 && curAngle <= 180) {
+			} else if (curAngle <= 180 && curAngle >= positiveMidSlope[1]) {
 				directionPunch = "leftPunch";
 				name = "正向的左拳";
 				ename = "front-left";
 			}
 			//相反方向击打
 			//正方向
-			else if (curAngle > 180 && curAngle <= 250) {
-				directionPunch = "rightPunch";
-				name = "负向的右拳";
-				ename = "back-right";
-			}
-			else if (curAngle > 250 && curAngle <= 290) {
+			else if (curAngle <= negativeMidSlope[1] && curAngle > negativeMidSlope[0]) {
 				directionPunch = "straightPunch";
 				name = "负向的直拳";
 				ename = "back-straight";
-			} else if (curAngle > 290 && curAngle <= 360) {
+			} else if (curAngle <= negativeMidSlope[0] && curAngle > 180) {
+				directionPunch = "rightPunch";
+				name = "负向的右拳";
+				ename = "back-right";
+			} else if (curAngle <= 360 && curAngle > negativeMidSlope[1]) {
 				directionPunch = "leftPunch";
 				name = "负向的左拳";
 				ename = "back-left";
@@ -229,4 +239,4 @@ module.exports = {
 
 		}
 	}
-};
+};

+ 19 - 7
util/util-js/store.js

@@ -2107,7 +2107,8 @@ const store = new Vuex.Store({
 			} = data.gyro;
 			// ax / 10, az / 10, gz, -gx, data.ms ----- old
 			// ay / 10, -az / 10, gy, gz, data.ms
-			let [hit, dir] = state.sandbagAlgorithm.Update(-ay, az, -gz, -gy, data.ms);
+			// let [hit, dir] = state.sandbagAlgorithm.Update(-ay, az, -gz, -gy, data.ms);
+			let [hit, dir] = state.sandbagAlgorithm.Update(ax, az, gz, -gx, data.ms);
 			if (dir != undefined) {
 				let temp = state.sandbagAlgorithm.getTempValue(dir);
 				if (callback) {
@@ -2719,16 +2720,27 @@ const store = new Vuex.Store({
 					let min = BLE.hex2int(resValue.substr(32, 2));
 					//秒
 					let s = BLE.hex2int(resValue.substr(34, 2));
+
+
+
+					// ax / 10, az / 10, gz, -gx, data.ms ----- old
+					// let [hit, dir] = state.sandbagAlgorithm.Update(-ay, az, -gz, -gy, data.ms);
+
 					box["handle"] = BLE.hexToString(handle);
 					box["acc"] = {
-						ax,
-						ay,
-						az
+						ax: -ay,
+						ay: -ax,
+						az: az
 					};
+					// box["acc"] = {
+					// 	-ay,
+					// 	-ax, //ay,
+					// 	az
+					// };
 					box["gyro"] = {
-						gx,
-						gy,
-						gz
+						gx: gy,
+						gy: gx,
+						gz: -gz
 					};
 
 					box["min"] = min;