|
@@ -27,7 +27,15 @@
|
|
|
<div class="gamePlayer">
|
|
|
<div class="item" v-for="item in areaStateList" :key="item.area">
|
|
|
<div class="player">
|
|
|
- <template v-if="currentGame == 'bodyposecontroller'">
|
|
|
+
|
|
|
+
|
|
|
+ <div><img src="@/assets/images/game/fruit1.png" class="fade-image"
|
|
|
+ :class="{ 'fade-image1': !item.state }"></img></div>
|
|
|
+ <div><img v-if="!item.state" src="@/assets/images/game/fruit2.png" class="fade-image"
|
|
|
+ :class="{ 'fade-image2': !item.state }"></img></div>
|
|
|
+
|
|
|
+
|
|
|
+ <!-- <template v-if="currentGame == 'bodyposecontroller'">
|
|
|
<div><img src="@/assets/images/game/fruit1.png" class="fade-image"
|
|
|
:class="{ 'fade-image1': !item.state }"></img></div>
|
|
|
<div><img v-if="!item.state" src="@/assets/images/game/fruit2.png" class="fade-image"
|
|
@@ -50,7 +58,7 @@
|
|
|
:class="{ 'fade-image1': !item.state }"></img></div>
|
|
|
<div><img v-if="!item.state" src="@/assets/images/game/football2.png" class="fade-image"
|
|
|
:class="{ 'fade-image2': !item.state }"></img></div>
|
|
|
- </template>
|
|
|
+ </template> -->
|
|
|
<div v-if="item.state" class="ok"><img src="@/assets/images/game/ok.png"></div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -127,73 +135,87 @@ const getInit = (e: any) => {
|
|
|
result.push(myArr.slice(i, i + 2));
|
|
|
}
|
|
|
//console.log("result", result)
|
|
|
- if (currentGame.value == 'bodyposecontroller') {
|
|
|
- let leftA = result[6][1];//右肩Y
|
|
|
- let rightA = result[5][1];//左肩Y
|
|
|
- let leftB = result[10][1];//右手Y
|
|
|
- let rightB = result[9][1];//左手Y
|
|
|
- let bizi = result[0][1];//鼻子Y
|
|
|
- if (leftB < leftA || rightB < rightA || leftB < bizi || rightB < bizi) {
|
|
|
- let myIndex = areaStateList.value.findIndex((item: any) => {
|
|
|
- return item.area == area;
|
|
|
- })
|
|
|
- let boxes = [{ x: arr[0], y: arr[3] }, { x: arr[0], y: arr[1] }, { x: arr[2], y: arr[1] }, { x: arr[2], y: arr[3] }];
|
|
|
- areaStateList.value[myIndex].state = true;
|
|
|
- areaStateList.value[myIndex].boxes = boxes;
|
|
|
- }
|
|
|
- }
|
|
|
- if (currentGame.value == 'game_basketball') {
|
|
|
- let leftA = result[6][1];//右肩Y
|
|
|
- let rightA = result[5][1];//左肩Y
|
|
|
- let leftB = result[10][1];//右手Y
|
|
|
- let rightB = result[9][1];//左手Y
|
|
|
- let bizi = result[0][1];//鼻子Y
|
|
|
- if (leftB < leftA || rightB < rightA || leftB < bizi || rightB < bizi) {
|
|
|
- let myIndex = areaStateList.value.findIndex((item: any) => {
|
|
|
- return item.area == area;
|
|
|
- })
|
|
|
- let boxes = [{ x: arr[0], y: arr[3] }, { x: arr[0], y: arr[1] }, { x: arr[2], y: arr[1] }, { x: arr[2], y: arr[3] }];
|
|
|
- areaStateList.value[myIndex].state = true;
|
|
|
- areaStateList.value[myIndex].boxes = boxes;
|
|
|
- }
|
|
|
- }
|
|
|
- if (currentGame.value == 'game_football') {
|
|
|
- let leftA = { x: result[12][0], y: result[12][1] };//大腿
|
|
|
- let leftB = { x: result[14][0], y: result[14][1] };//膝盖
|
|
|
- let leftC = { x: result[16][0], y: result[16][1] };//脚
|
|
|
-
|
|
|
- let rightA = { x: result[11][0], y: result[11][1] };//大腿
|
|
|
- let rightB = { x: result[13][0], y: result[13][1] };//膝盖
|
|
|
- let rightC = { x: result[15][0], y: result[15][1] };//脚
|
|
|
-
|
|
|
- let jiaodu1 = calculateAngleAtB(leftA, leftB, leftC)
|
|
|
- let jiaodu2 = calculateAngleAtB(rightA, rightB, rightC)
|
|
|
- // console.log("jiaodu1",jiaodu1)
|
|
|
- // console.log("jiaodu2",jiaodu2)
|
|
|
- if (jiaodu1 <= 80 && jiaodu2 >= 120 || jiaodu2 <= 80 && jiaodu2 >= 120) {
|
|
|
- let myIndex = areaStateList.value.findIndex((item: any) => {
|
|
|
- return item.area == area;
|
|
|
- })
|
|
|
- let boxes = [{ x: arr[0], y: arr[3] }, { x: arr[0], y: arr[1] }, { x: arr[2], y: arr[1] }, { x: arr[2], y: arr[3] }];
|
|
|
- areaStateList.value[myIndex].state = true;
|
|
|
- areaStateList.value[myIndex].boxes = boxes;
|
|
|
- }
|
|
|
- }
|
|
|
- if (currentGame.value == 'game_fruit') {
|
|
|
- let leftA = result[6][1];//右肩Y
|
|
|
- let rightA = result[5][1];//左肩Y
|
|
|
- let leftB = result[10][1];//右手Y
|
|
|
- let rightB = result[9][1];//左手Y
|
|
|
- let bizi = result[0][1];//鼻子Y
|
|
|
- if (leftB < leftA || rightB < rightA || leftB < bizi || rightB < bizi) {
|
|
|
- let myIndex = areaStateList.value.findIndex((item: any) => {
|
|
|
- return item.area == area;
|
|
|
- })
|
|
|
- let boxes = [{ x: arr[0], y: arr[3] }, { x: arr[0], y: arr[1] }, { x: arr[2], y: arr[1] }, { x: arr[2], y: arr[3] }];
|
|
|
- areaStateList.value[myIndex].state = true;
|
|
|
- areaStateList.value[myIndex].boxes = boxes;
|
|
|
- }
|
|
|
+ //全部用肘过肩
|
|
|
+ let leftA = result[6][1];//右肩Y
|
|
|
+ let rightA = result[5][1];//左肩Y
|
|
|
+ let leftB = result[8][1];//右肘Y
|
|
|
+ let rightB = result[7][1];//左肘Y
|
|
|
+ let bizi = result[0][1];//鼻子Y
|
|
|
+ if (leftB < leftA || rightB < rightA || leftB < bizi || rightB < bizi) {
|
|
|
+ let myIndex = areaStateList.value.findIndex((item: any) => {
|
|
|
+ return item.area == area;
|
|
|
+ })
|
|
|
+ let boxes = [{ x: arr[0], y: arr[3] }, { x: arr[0], y: arr[1] }, { x: arr[2], y: arr[1] }, { x: arr[2], y: arr[3] }];
|
|
|
+ areaStateList.value[myIndex].state = true;
|
|
|
+ areaStateList.value[myIndex].boxes = boxes;
|
|
|
}
|
|
|
+ // if (currentGame.value == 'bodyposecontroller') {
|
|
|
+ // let leftA = result[6][1];//右肩Y
|
|
|
+ // let rightA = result[5][1];//左肩Y
|
|
|
+ // let leftB = result[8][1];//右肘Y
|
|
|
+ // let rightB = result[7][1];//左肘Y
|
|
|
+ // let bizi = result[0][1];//鼻子Y
|
|
|
+ // if (leftB < leftA || rightB < rightA || leftB < bizi || rightB < bizi) {
|
|
|
+ // let myIndex = areaStateList.value.findIndex((item: any) => {
|
|
|
+ // return item.area == area;
|
|
|
+ // })
|
|
|
+ // let boxes = [{ x: arr[0], y: arr[3] }, { x: arr[0], y: arr[1] }, { x: arr[2], y: arr[1] }, { x: arr[2], y: arr[3] }];
|
|
|
+ // areaStateList.value[myIndex].state = true;
|
|
|
+ // areaStateList.value[myIndex].boxes = boxes;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if (currentGame.value == 'game_basketball') {
|
|
|
+ // let leftA = result[6][1];//右肩Y
|
|
|
+ // let rightA = result[5][1];//左肩Y
|
|
|
+ // let leftB = result[8][1];//右肘Y
|
|
|
+ // let rightB = result[7][1];//左肘Y
|
|
|
+ // let bizi = result[0][1];//鼻子Y
|
|
|
+ // if (leftB < leftA || rightB < rightA || leftB < bizi || rightB < bizi) {
|
|
|
+ // let myIndex = areaStateList.value.findIndex((item: any) => {
|
|
|
+ // return item.area == area;
|
|
|
+ // })
|
|
|
+ // let boxes = [{ x: arr[0], y: arr[3] }, { x: arr[0], y: arr[1] }, { x: arr[2], y: arr[1] }, { x: arr[2], y: arr[3] }];
|
|
|
+ // areaStateList.value[myIndex].state = true;
|
|
|
+ // areaStateList.value[myIndex].boxes = boxes;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if (currentGame.value == 'game_football') {
|
|
|
+ // let leftA = { x: result[12][0], y: result[12][1] };//大腿
|
|
|
+ // let leftB = { x: result[14][0], y: result[14][1] };//膝盖
|
|
|
+ // let leftC = { x: result[16][0], y: result[16][1] };//脚
|
|
|
+
|
|
|
+ // let rightA = { x: result[11][0], y: result[11][1] };//大腿
|
|
|
+ // let rightB = { x: result[13][0], y: result[13][1] };//膝盖
|
|
|
+ // let rightC = { x: result[15][0], y: result[15][1] };//脚
|
|
|
+
|
|
|
+ // let jiaodu1 = calculateAngleAtB(leftA, leftB, leftC)
|
|
|
+ // let jiaodu2 = calculateAngleAtB(rightA, rightB, rightC)
|
|
|
+ // // console.log("jiaodu1",jiaodu1)
|
|
|
+ // // console.log("jiaodu2",jiaodu2)
|
|
|
+ // if (jiaodu1 <= 80 && jiaodu2 >= 120 || jiaodu2 <= 80 && jiaodu2 >= 120) {
|
|
|
+ // let myIndex = areaStateList.value.findIndex((item: any) => {
|
|
|
+ // return item.area == area;
|
|
|
+ // })
|
|
|
+ // let boxes = [{ x: arr[0], y: arr[3] }, { x: arr[0], y: arr[1] }, { x: arr[2], y: arr[1] }, { x: arr[2], y: arr[3] }];
|
|
|
+ // areaStateList.value[myIndex].state = true;
|
|
|
+ // areaStateList.value[myIndex].boxes = boxes;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // if (currentGame.value == 'game_fruit') {
|
|
|
+ // let leftA = result[6][1];//右肩Y
|
|
|
+ // let rightA = result[5][1];//左肩Y
|
|
|
+ // let leftB = result[8][1];//右肘Y
|
|
|
+ // let rightB = result[7][1];//左肘Y
|
|
|
+ // let bizi = result[0][1];//鼻子Y
|
|
|
+ // if (leftB < leftA || rightB < rightA || leftB < bizi || rightB < bizi) {
|
|
|
+ // let myIndex = areaStateList.value.findIndex((item: any) => {
|
|
|
+ // return item.area == area;
|
|
|
+ // })
|
|
|
+ // let boxes = [{ x: arr[0], y: arr[3] }, { x: arr[0], y: arr[1] }, { x: arr[2], y: arr[1] }, { x: arr[2], y: arr[3] }];
|
|
|
+ // areaStateList.value[myIndex].state = true;
|
|
|
+ // areaStateList.value[myIndex].boxes = boxes;
|
|
|
+ // }
|
|
|
+ // }
|
|
|
};
|
|
|
|
|
|
/**
|
|
@@ -272,19 +294,19 @@ const getOpen = async (game: any, area: any) => {
|
|
|
}) || [];
|
|
|
areaStateList.value = list;
|
|
|
actionState.value = true;
|
|
|
- let txt = ""
|
|
|
- if (currentGame.value == 'bodyposecontroller') {
|
|
|
- txt = "举手开始游戏";
|
|
|
- }
|
|
|
- if (currentGame.value == 'game_fruit') {
|
|
|
- txt = "举手开始游戏";
|
|
|
- }
|
|
|
- if (currentGame.value == 'game_basketball') {
|
|
|
- txt = "请做投篮动作开始游戏";
|
|
|
- }
|
|
|
- if (currentGame.value == 'game_football') {
|
|
|
- txt = "请踢腿开始游戏";
|
|
|
- }
|
|
|
+ let txt = "举手开始游戏"
|
|
|
+ // if (currentGame.value == 'bodyposecontroller') {
|
|
|
+ // txt = "举手开始游戏";
|
|
|
+ // }
|
|
|
+ // if (currentGame.value == 'game_fruit') {
|
|
|
+ // txt = "举手开始游戏";
|
|
|
+ // }
|
|
|
+ // if (currentGame.value == 'game_basketball') {
|
|
|
+ // txt = "请做投篮动作开始游戏";
|
|
|
+ // }
|
|
|
+ // if (currentGame.value == 'game_football') {
|
|
|
+ // txt = "请踢腿开始游戏";
|
|
|
+ // }
|
|
|
actionText.value = txt;
|
|
|
speckText(actionText.value);
|
|
|
};
|