You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.3 KiB

<!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 | Formwork</title>
<link rel="shortcut icon" href="TemplateData/favicon.ico">
<link rel="stylesheet" href="TemplateData/style.css">
<script src="TemplateData/UnityProgress.js"></script>
<script src="Build/UnityLoader.js"></script>
<script>
var gameInstance = UnityLoader.instantiate("gameContainer", "Build/DisaComputer.json", {onProgress: UnityProgress});
//注册web端消息监听
window.addEventListener('message',receiveMessage,false);
function receiveMessage(event){
console.log("receive web message ",event.data);
gameInstance.SendMessage("WebConnecter","RecData",event.data);
}
//发送消息给web端
function SendToWeb(param){
console.log("receive unity message ",param);
window.parent.postMessage(param,'*');
}
</script>
</head>
<body>
<div class="webgl-content">
<div id="gameContainer" style="width: 1040px; height: 585px"></div>
<div class="footer">
<div class="webgl-logo"></div>
<div class="fullscreen" onclick="gameInstance.SetFullscreen(1)"></div>
<div class="title">计算机虚拟组装课程</div>
</div>
</div>
</body>
</html>