代码提交

This commit is contained in:
luoshiwen 2023-04-12 08:43:41 +08:00
parent 16d49f37bb
commit 0f149c4729
16 changed files with 181 additions and 188 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -1,172 +1,121 @@
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Unity WebGL Player | ElectricPowerStorage_Digital Twin</title>
<link rel="shortcut icon" href="TemplateData/favicon.ico">
<link rel="stylesheet" href="TemplateData/style.css">
<style>
html,
body {
width: 100%;
height: 100%;
overflow: hidden;
}
</style>
</head>
<body>
<div id="unity-container" style="width: 100%;height: 100%;" class="unity-desktop">
<canvas id="unity-canvas" style="width: 100%;height: 100%;"></canvas>
<div id="unity-loading-bar">
<div id="unity-logo"></div>
<div id="unity-progress-bar-empty">
<div id="unity-progress-bar-full"></div>
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Unity WebGL Player | ElectricPowerStorage_Digital Twin</title>
<link rel="shortcut icon" href="TemplateData/favicon.ico">
<link rel="stylesheet" href="TemplateData/style.css">
</head>
<body>
<div id="unity-container" class="unity-desktop">
<canvas id="unity-canvas" width=960 height=600></canvas>
<div id="unity-loading-bar">
<div id="unity-logo"></div>
<div id="unity-progress-bar-empty">
<div id="unity-progress-bar-full"></div>
</div>
</div>
<div id="unity-warning"> </div>
<div id="unity-footer">
<div id="unity-webgl-logo"></div>
<div id="unity-fullscreen-button"></div>
<div id="unity-build-title">ElectricPowerStorage_Digital Twin</div>
</div>
</div>
<div id="unity-warning"> </div>
<div id="unity-footer">
<div id="unity-webgl-logo"></div>
<div id="unity-fullscreen-button"></div>
<div id="unity-build-title">ElectricPowerStorage_Digital Twin</div>
</div>
</div>
<script>
var container = document.querySelector("#unity-container");
var canvas = document.querySelector("#unity-canvas");
var loadingBar = document.querySelector("#unity-loading-bar");
var progressBarFull = document.querySelector("#unity-progress-bar-full");
var fullscreenButton = document.querySelector("#unity-fullscreen-button");
var warningBanner = document.querySelector("#unity-warning");
<script>
var container = document.querySelector("#unity-container");
var canvas = document.querySelector("#unity-canvas");
var loadingBar = document.querySelector("#unity-loading-bar");
var progressBarFull = document.querySelector("#unity-progress-bar-full");
var fullscreenButton = document.querySelector("#unity-fullscreen-button");
var warningBanner = document.querySelector("#unity-warning");
// Shows a temporary message banner/ribbon for a few seconds, or
// a permanent error message on top of the canvas if type=='error'.
// If type=='warning', a yellow highlight color is used.
// Modify or remove this function to customize the visually presented
// way that non-critical warnings and error messages are presented to the
// user.
function unityShowBanner(msg, type) {
function updateBannerVisibility() {
warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
// Shows a temporary message banner/ribbon for a few seconds, or
// a permanent error message on top of the canvas if type=='error'.
// If type=='warning', a yellow highlight color is used.
// Modify or remove this function to customize the visually presented
// way that non-critical warnings and error messages are presented to the
// user.
function unityShowBanner(msg, type) {
function updateBannerVisibility() {
warningBanner.style.display = warningBanner.children.length ? 'block' : 'none';
}
var div = document.createElement('div');
div.innerHTML = msg;
warningBanner.appendChild(div);
if (type == 'error') div.style = 'background: red; padding: 10px;';
else {
if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
setTimeout(function() {
warningBanner.removeChild(div);
updateBannerVisibility();
}, 5000);
}
updateBannerVisibility();
}
var div = document.createElement('div');
div.innerHTML = msg;
warningBanner.appendChild(div);
if (type == 'error') div.style = 'background: red; padding: 10px;';
else {
if (type == 'warning') div.style = 'background: yellow; padding: 10px;';
setTimeout(function () {
warningBanner.removeChild(div);
updateBannerVisibility();
}, 5000);
var buildUrl = "Build";
var loaderUrl = buildUrl + "/WebglQidong.loader.js";
var config = {
dataUrl: buildUrl + "/WebglQidong.data.unityweb",
frameworkUrl: buildUrl + "/WebglQidong.framework.js.unityweb",
codeUrl: buildUrl + "/WebglQidong.wasm.unityweb",
streamingAssetsUrl: "StreamingAssets",
companyName: "DefaultCompany",
productName: "ElectricPowerStorage_Digital Twin",
productVersion: "0.1.0",
showBanner: unityShowBanner,
};
// By default Unity keeps WebGL canvas render target size matched with
// the DOM size of the canvas element (scaled by window.devicePixelRatio)
// Set this to false if you want to decouple this synchronization from
// happening inside the engine, and you would instead like to size up
// the canvas DOM size and WebGL render target sizes yourself.
// config.matchWebGLToCanvasSize = false;
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
// Mobile device style: fill the whole browser client area with the game canvas:
var meta = document.createElement('meta');
meta.name = 'viewport';
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
document.getElementsByTagName('head')[0].appendChild(meta);
container.className = "unity-mobile";
// To lower canvas resolution on mobile devices to gain some
// performance, uncomment the following line:
// config.devicePixelRatio = 1;
canvas.style.width = window.innerWidth + 'px';
canvas.style.height = window.innerHeight + 'px';
unityShowBanner('WebGL builds are not supported on mobile devices.');
} else {
// Desktop style: Render the game canvas in a window that can be maximized to fullscreen:
canvas.style.width = "960px";
canvas.style.height = "600px";
}
updateBannerVisibility();
}
var buildUrl = "Build";
var loaderUrl = buildUrl + "/EPS_Yzpq.loader.js";
var config = {
dataUrl: buildUrl + "/EPS_Yzpq.data.unityweb",
frameworkUrl: buildUrl + "/EPS_Yzpq.framework.js.unityweb",
codeUrl: buildUrl + "/EPS_Yzpq.wasm.unityweb",
streamingAssetsUrl: "StreamingAssets",
companyName: "DefaultCompany",
productName: "ElectricPowerStorage_Digital Twin",
productVersion: "0.1.0",
showBanner: unityShowBanner,
};
loadingBar.style.display = "block";
// By default Unity keeps WebGL canvas render target size matched with
// the DOM size of the canvas element (scaled by window.devicePixelRatio)
// Set this to false if you want to decouple this synchronization from
// happening inside the engine, and you would instead like to size up
// the canvas DOM size and WebGL render target sizes yourself.
// config.matchWebGLToCanvasSize = false;
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
// Mobile device style: fill the whole browser client area with the game canvas:
var meta = document.createElement('meta');
meta.name = 'viewport';
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
document.getElementsByTagName('head')[0].appendChild(meta);
container.className = "unity-mobile";
// To lower canvas resolution on mobile devices to gain some
// performance, uncomment the following line:
// config.devicePixelRatio = 1;
canvas.style.width = window.innerWidth + 'px';
canvas.style.height = window.innerHeight + 'px';
unityShowBanner('WebGL builds are not supported on mobile devices.');
} else {
// Desktop style: Render the game canvas in a window that can be maximized to fullscreen:
// canvas.style.width = "960px";
// canvas.style.height = "600px";
}
loadingBar.style.display = "block";
var script = document.createElement("script");
var unityInstanceA
script.src = loaderUrl;
script.onload = () => {
createUnityInstance(canvas, config, (progress) => {
progressBarFull.style.width = 100 * progress + "%";
}).then((unityInstance) => {
unityInstanceA = unityInstance
loadingBar.style.display = "none";
fullscreenButton.onclick = () => {
unityInstance.SetFullscreen(1);
};
}).catch((message) => {
alert(message);
});
};
document.body.appendChild(script);
// c仓位号查询
// function wareHouse(){
// }
//
// 定位货架位置
function shelvesList(val){
console.log(val,'unity');
// unityInstanceA.Unity_ShelvesList(val)
unityInstanceA.SendMessage("Manager","Unity_ShelvesList",val );
}
// 视角切换
function updateScene(val){
// console.log(val,'unity');
unityInstanceA.SendMessage("Manager","Unity_ViewportChange",val+'');
}
// 库房的定位
function selectHome(val){
// console.log(val,'库房的定位');
unityInstanceA.SendMessage("Manager","Unity_WarehouseList",val);
}
// 库外的按钮
function outHome(){
// console.log(5);
unityInstanceA.SendMessage("Manager","Unity_OutWarehouse",'');
}
// 转运
function transport(val){
// console.log('转运',val);
unityInstanceA.SendMessage("Manager","Unity_Transport",val+'');
}
// 显隐
function hide(val){
// console.log('显隐',val);
unityInstanceA.SendMessage("Manager","Unity_Transparence",val+'');
}
</script>
</body>
</html>
var script = document.createElement("script");
script.src = loaderUrl;
script.onload = () => {
createUnityInstance(canvas, config, (progress) => {
progressBarFull.style.width = 100 * progress + "%";
}).then((unityInstance) => {
loadingBar.style.display = "none";
fullscreenButton.onclick = () => {
unityInstance.SetFullscreen(1);
};
}).catch((message) => {
alert(message);
});
};
document.body.appendChild(script);
</script>
</body>
</html>

View File

@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>扬中数字孪生仓库</title>
<title>启东南苑路数字孪生仓库</title>
</head>
<body>
<noscript>

View File

@ -2,6 +2,9 @@
<div id="app">
<!-- unity3D -->
<iframe id="iframe" ref="dome" width="100%" height="100%" src="EPS_Yzpq/index.html" frameborder="0"></iframe>
<div class="load">
<div class="loadding"></div>
</div>
<!-- 头部 -->
<header class="nav">
<div class="wether">
@ -18,16 +21,17 @@
<ul>
<li v-for="(s, i) in liImgs" class="nav-li" :key="i" @click="handleBtn(i)">
<el-dropdown trigger="click" placement="bottom" v-if="i == 0" :hide-on-click="true">
<el-dropdown trigger="click" placement="bottom" v-if="i == 0" :hide-on-click="false">
<span class="downPull"><img :src="i == index ? s.selectImg : s.img" alt="" /></span>
<el-dropdown-menu slot="dropdown">
<ul class="menuContent">
<li v-for="(num, index) in 15" :key="index" @click="shelfHanlder($event)">
LD1_B01-{{ num < 10 ? "0" + num : num }} </li>
<li v-for="(num, index) in 15" :key="index" @click="shelfHanlder($event)">LD1_B01-{{ num < 10 ? "0" + num
: num }}</li>
</ul>
<ul class="menuContent">
<li v-for="(num, index) in 9" :key="index + 1" @click="shelfHanlder($event)">
LD1_C01-{{ num < 10 ? "0" + num : num }} </li>
<li v-for="(num, index) in 9" :key="index + 1" @click="shelfHanlder($event)">LD1_C01-{{ num < 10 ? "0" +
num : num }}</li>
<!-- <li @click="shelfHanlder($event)">LD1_B01-01</li> -->
<li @click="shelfHanlder($event)">LD1_C02-01</li>
<li @click="shelfHanlder($event)">LD1_C03-01</li>
</ul>
@ -69,6 +73,7 @@ export default {
data() {
return {
heatList: [20, 40, 200, 100],
fullscreenLoading: true,
liImgs: [
{ img: require("@/assets/images/1.png"), selectImg: require('@/assets/images/select_1.png') },
{ img: require("@/assets/images/2.png"), selectImg: require('@/assets/images/select_2.png') },
@ -107,9 +112,9 @@ export default {
},
created() {
this.$nextTick(() => {
getVisualStorageList({ wareHouseCode: "HA1" }).then((res) => {
console.log(res, "shuju");
});
// getVisualStorageList({ wareHouseCode: "HA1" }).then((res) => {
// console.log(res, "shuju");
// });
});
// window.parent.shelvesList = this.shelfHanlder
@ -129,26 +134,26 @@ export default {
},
handleBtn(i) {
this.navLiState = !this.navLiState
if (this.index == i&&this.navLiState) {
if (this.index == i && this.navLiState) {
this.index = null
if (i == 1) {
this.state = !this.state;
// console.log(this.state);
this.$refs.dome.contentWindow.updateScene(this.state);
} else if (i == 3) {
this.$refs.dome.contentWindow.outHome();
} else if (i == 4) {
this.transport = !this.transport;
this.$refs.dome.contentWindow.transport(this.transport);
} else if (i == 5) {
this.hide = !this.hide;
this.$refs.dome.contentWindow.hide(this.hide);
}
return
this.state = !this.state;
// console.log(this.state);
this.$refs.dome.contentWindow.updateScene(this.state);
} else if (i == 3) {
this.$refs.dome.contentWindow.outHome();
} else if (i == 4) {
this.transport = !this.transport;
this.$refs.dome.contentWindow.transport(this.transport);
} else if (i == 5) {
this.hide = !this.hide;
this.$refs.dome.contentWindow.hide(this.hide);
}
return
}
this.index = i
//
this.state =false
this.state = false
this.transport = false
this.hide = false
this.$refs.dome.contentWindow.updateScene(false);
@ -239,6 +244,44 @@ html {
width: 100%;
height: 100%;
}
.load {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
// z-index: 0;
display: none;
background-color: rgba(0, 0, 0, 1);
.loadding {
background-image: url('@/assets/images/loadding.png');
background-size: 100% 100%;
width: 100px;
height: 100px;
left: calc((100% - 100px) / 2);
position: absolute;
top: calc((100% - 100px) / 2);
animation: move 2s linear infinite forwards;
}
@keyframes move {
0% {
transform: rotate(0deg);
}
50% {
transform: rotate(180deg);
}
100% {
transform: rotate(360deg);
}
}
}
}
#app {

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -228,7 +228,7 @@ export default {
border-bottom-right-radius: 20px;
position: relative;
z-index: 10;
.title {
font-size: 16px;
margin-left: 7%;