Browse Source

【工业元宇宙】接入宇宙模型

任一存 2 years ago
parent
commit
38c805e2cf
3 changed files with 28 additions and 4 deletions
  1. 12 2
      src/App.vue
  2. 1 1
      src/views/General.vue
  3. 15 1
      src/views/Metaverse.vue

+ 12 - 2
src/App.vue

@@ -176,8 +176,18 @@ export default {
         })
         })
       }
       }
       window.onClickEnterprise = function (id) {
       window.onClickEnterprise = function (id) {
-        if (window.onCorpOnMapClicked) {
-          window.onCorpOnMapClicked(id)
+        if (window.handleClickEnterprise) {
+          window.handleClickEnterprise(id)
+        }
+      }
+      window.onClickPlanet = function (id) {
+        if (window.handleClickPlanet) {
+          window.handleClickPlanet(id)
+        }
+      }
+      window.onMovedPlanet = function (id) {
+        if (window.handleMovedPlanet) {
+          window.handleMovedPlanet(id)
         }
         }
       }
       }
       document.body.appendChild(script)
       document.body.appendChild(script)

+ 1 - 1
src/views/General.vue

@@ -171,7 +171,7 @@ export default {
         clickedElement.scrollIntoView()
         clickedElement.scrollIntoView()
       }
       }
     }
     }
-    window.onCorpOnMapClicked = onClickCorpItem
+    window.handleClickEnterprise = onClickCorpItem
 
 
     const isShowLoadingMask = ref(true)
     const isShowLoadingMask = ref(true)
     onMounted(() => {
     onMounted(() => {

+ 15 - 1
src/views/Metaverse.vue

@@ -11,7 +11,7 @@
     <article v-if="isShowDesc">
     <article v-if="isShowDesc">
       <button
       <button
         class="close"
         class="close"
-        @click="isShowDesc = false"
+        @click="onClickCloseDesc"
       />
       />
       <h2>{{ desc.name }}</h2>
       <h2>{{ desc.name }}</h2>
       <img
       <img
@@ -58,12 +58,23 @@ export default {
 
 
     const isShowDesc = ref(false)
     const isShowDesc = ref(false)
     const desc = reactive({})
     const desc = reactive({})
+    function onClickCloseDesc() {
+      isShowDesc.value = false
+      gUnityInst.SendMessage('MainPanel', 'ResetCamera')
+    }
 
 
     function onClickStar(idx) {
     function onClickStar(idx) {
       desc.name = rawData.value[idx].name
       desc.name = rawData.value[idx].name
       desc.detail = rawData.value[idx].description
       desc.detail = rawData.value[idx].description
       isShowDesc.value = true
       isShowDesc.value = true
     }
     }
+    window.handleClickPlanet = function(id) {
+      console.log('click planet', id)
+      onClickStar(id)
+    }
+    window.handleMovedPlanet = function(id) {
+      console.log('moved planet', id)
+    }
 
 
     const isShowLoadingMask = ref(true)
     const isShowLoadingMask = ref(true)
     onMounted(() => {
     onMounted(() => {
@@ -74,8 +85,11 @@ export default {
 
 
     return {
     return {
       rawData,
       rawData,
+
       isShowDesc,
       isShowDesc,
       desc,
       desc,
+      onClickCloseDesc,
+
       onClickStar,
       onClickStar,
 
 
       isShowLoadingMask,
       isShowLoadingMask,