林旭祥 3 tygodni temu
rodzic
commit
a1958dc9bb

+ 2 - 2
src/views/game/components/basketball.vue

@@ -87,8 +87,8 @@ const getInit = (e: any) => {
   //console.log("result", result)
   bodyposeData.value = result;
   if (boxes.value.length == 0) {
-    speckText("识别成功");
-    proxy?.$modal.msgWarning(`识别成功`);
+    // speckText("识别成功");
+    // proxy?.$modal.msgWarning(`识别成功`);
     let arr = e.data.result.boxes;
     boxes.value = [{ x: arr[0], y: arr[3] }, { x: arr[0], y: arr[1] }, { x: arr[2], y: arr[1] }, { x: arr[2], y: arr[3] }]
     proportion.value = (clientObj.value.height / (arr[3] - arr[1])).toFixed(2);

+ 3 - 3
src/views/game/components/football.vue

@@ -1231,7 +1231,7 @@ watch(
         return false;
       }
       const gameScene = game.value.scene.getScene('GameScene');
-      if (!gameScene) {
+      if (!gameScene || !gameScene.cursors) {
         return false;
       }
       if (newData > oldData) {
@@ -1259,8 +1259,8 @@ const getInit = (e: any) => {
   //console.log("result", result)
   bodyposeData.value = result;
   if (boxes.value.length == 0) {
-    speckText("识别成功");
-    proxy?.$modal.msgWarning(`识别成功`);
+    // speckText("识别成功");
+    // proxy?.$modal.msgWarning(`识别成功`);
     let arr = e.data.result.boxes;
     boxes.value = [{ x: arr[0], y: arr[3] }, { x: arr[0], y: arr[1] }, { x: arr[2], y: arr[1] }, { x: arr[2], y: arr[3] }]
     proportion.value = (clientObj.value.height / (arr[3] - arr[1])).toFixed(2);

+ 2 - 2
src/views/game/components/fruit.vue

@@ -38,8 +38,8 @@ const getInit = (e: any) => {
   // console.log("result", result)
   bodyposeData.value = result;
   if (boxes.value.length == 0) {
-    speckText("识别成功");
-    proxy?.$modal.msgWarning(`识别成功`);
+    // speckText("识别成功");
+    // proxy?.$modal.msgWarning(`识别成功`);
     let arr = e.data.result.boxes;
     boxes.value = [{ x: arr[0], y: arr[3] }, { x: arr[0], y: arr[1] }, { x: arr[2], y: arr[1] }, { x: arr[2], y: arr[3] }]
     proportion.value = (clientObj.value.height / (arr[3] - arr[1])).toFixed(2);

+ 2 - 2
src/views/game/components/humanBody.vue

@@ -31,8 +31,8 @@ const getInit = (e: any) => {
   console.log("result", result)
   bodyposeData.value = result;
   if (boxes.value.length == 0) {
-    speckText("识别成功");
-    proxy?.$modal.msgWarning(`识别成功`);
+    // speckText("识别成功");
+    // proxy?.$modal.msgWarning(`识别成功`);
     let arr = e.data.result.boxes;
     boxes.value = [{ x: arr[0], y: arr[3] }, { x: arr[0], y: arr[1] }, { x: arr[2], y: arr[1] }, { x: arr[2], y: arr[3] }]
     proportion.value = (clientObj.value.height / (arr[3] - arr[1])).toFixed(2);

+ 33 - 21
src/views/game/index.vue

@@ -24,12 +24,17 @@
       <div class="gameWindow" v-if="currentGame">
         <!---人体姿态识别-->
         <div class="columns" v-if="currentGame == 'bodyposecontroller'">
-          <div class="item left">
+          <template v-if="projectList.length == 2">
+            <div class="item left">
+              <HumanBody ref="humanBodyLeftRef" type="left"></HumanBody>
+            </div>
+            <div class="item right">
+              <HumanBody ref="humanBodyRightRef" type="right"></HumanBody>
+            </div>
+          </template>
+          <template>
             <HumanBody ref="humanBodyLeftRef" type="left"></HumanBody>
-          </div>
-          <div class="item right">
-            <HumanBody ref="humanBodyRightRef" type="right"></HumanBody>
-          </div>
+          </template>
         </div>
         <!---篮球投篮-->
         <div class="columns" v-if="currentGame == 'game_basketball'">
@@ -159,11 +164,17 @@ const getInit = async () => {
       let myList = obj.area_test_id.split(",");
       let area = e.ctrl_name.replace('bodyposecontroller_', '');
       if (currentGame.value == 'bodyposecontroller') {
-        if (area == myList[0]) {
-          humanBodyLeftRef.value.getInit(e);
-        }
-        if (area == myList[1]) {
-          humanBodyRightRef.value.getInit(e);
+        if (projectList.value.length == 2) {
+          if (area == myList[0]) {
+            humanBodyLeftRef.value.getInit(e);
+          }
+          if (area == myList[1]) {
+            humanBodyRightRef.value.getInit(e);
+          }
+        } else {
+          if (area == myList[0]) {
+            humanBodyLeftRef.value.getInit(e);
+          }
         }
       }
       if (currentGame.value == 'game_basketball') {
@@ -179,9 +190,7 @@ const getInit = async () => {
           footballLeftRef.value.getInit(e);
         }
         if (area == myList[1]) {
-          if (area == myList[0]) {
-            footballRightRef.value.getInit(e);
-          }
+          footballRightRef.value.getInit(e);
         }
       }
       if (currentGame.value == 'game_fruit') {
@@ -226,14 +235,17 @@ const getExit = () => {
  * 退出游戏
  */
 const getExitGame = () => {
-  let obj = projectList.value.find((item: any) => {
-    return item.exam_name == currentGame.value
-  })
-  let myList = obj.area_test_id.split(",");
-  myList.forEach((item: any) => {
-    terminateBodypose(item);
-  })
-  currentGame.value = "";
+  proxy?.$modal.confirm("确定退出吗?").then(() => {
+    let obj = projectList.value.find((item: any) => {
+      return item.exam_name == currentGame.value
+    })
+    let myList = obj.area_test_id.split(",");
+    myList.forEach((item: any) => {
+      terminateBodypose(item);
+    })
+    currentGame.value = "";
+  }).finally(() => {
+  });
 };
 
 onBeforeMount(async () => {