ソースを参照

12.3改初始化

liuqiao 9 ヶ月 前
コミット
bd33502875

+ 1 - 1
dist/static/TemplateData/style.css

@@ -1,5 +1,5 @@
 body { padding: 0; margin: 0 }
-#unity-container { position: fixed; width: 100%; height: 100%; }
+#unity-container { width: 100%; height: 100%; }
 #unity-canvas { width: 100%; height: 100%; background: #231F20 }
 #unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
 #unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }

+ 1 - 1
public/static/TemplateData/style.css

@@ -1,5 +1,5 @@
 body { padding: 0; margin: 0 }
-#unity-container { position: fixed; width: 100%; height: 100%; }
+#unity-container {  width: 100%; height: 100%; }
 #unity-canvas { width: 100%; height: 100%; background: #231F20 }
 #unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
 #unity-logo { width: 154px; height: 130px; background: url('unity-logo-dark.png') no-repeat center }

+ 4 - 2
src/view/index/htmldialog.vue

@@ -76,7 +76,7 @@
       </template>
       <div>
         <!-- <iframe :src="ifr" width="100%" height="630px" frameborder="0"></iframe> -->
-        <homeindex :water="water" :fire="fire" :neiw="neiw" :classradio="props.classradio"/>
+        <homeindex :water="water" :fire="fire" :neiw="neiw" :classradio="props.classradio" />
       </div>
     </el-dialog>
 </template>
@@ -174,12 +174,14 @@ onMounted(() => {
 watch(
   () => [props.isshow],
   (newVal, oldVal) => {
-    console.log(11111)
+    console.log(props.isshow);
     if (newVal[0] == true) {
       htmldialogshow.value = true;
+      console.log(1111)
 
     } else {
       htmldialogshow.value = false;
+      console.log(2222)
     }
   },
   { deep: true }

+ 26 - 0
src/views/home/index.vue

@@ -35,6 +35,9 @@ const props = defineProps({
     type: String,
     // required: true,
   },
+  htmldialogshow:{
+    type:Boolean
+  }
 });
 onMounted(() => {  
       window.addEventListener("load", function () {
@@ -107,13 +110,20 @@ onMounted(() => {
       script.onload = () => {
         createUnityInstance(canvas, config, (progress) => {
           progressBarFull.style.width = 100 * progress + "%";
+          console.log(     progressBarFull.style.width);
         }).then((unityInstance) => {
           loadingBar.style.display = "none";
+        
+           setTimeout(function(){
+            changefunc();
+          },100)
+       
         }).catch((message) => {
           alert(message);
         });
       };
       document.body.appendChild(script);
+    
 });
 
 /**
@@ -175,7 +185,22 @@ function changeCamera(lv){
   console.log(lv)
   window.postMessage('changeCamera:'+lv);
 }
+//初始化
+function changefunc(){
+  console.log('11111111'+'88888888')
 
+  if(props.classradio=='Water'){
+      changeCamera(props.neiw)
+      changeWater(props.water)
+      console.log(props.neiw,props.water);
+    }else if(props.classradio=='Fire'){
+      changeCamera(props.neiw)
+      changeFire(props.fire)
+    }else if(props.classradio=='Gass'){
+      changeCamera(props.neiw)
+      changeGass(props.fire)
+    }
+}
 watch(
   () => [props.neiw,props.water,props.fire],
   (newVal, oldVal) => {
@@ -187,6 +212,7 @@ watch(
     }else if(props.classradio=='Fire'){
       changeCamera(newVal[0])
       changeFire(newVal[2])
+      console.log(11121+"火灾")
     }else if(props.classradio=='Gass'){
       changeCamera(newVal[0])
       console.log("这是我的温度"+newVal[2])