2025-07-16 15:37:39 +08:00
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
<html lang="en-us">
|
|
|
|
|
|
|
|
|
|
<head>
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
|
|
|
<title>调蓄池数据</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">
|
|
|
|
|
<div id="unity-loading-bar">
|
|
|
|
|
<div id="unity-progress-bar-empty">
|
|
|
|
|
<div id="unity-progress-bar-full"></div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="unity-loadtext">数据加载中...(0%)</div>
|
|
|
|
|
</div>
|
|
|
|
|
<canvas id="unity-canvas" width=960 height=600></canvas>
|
|
|
|
|
<div id="unity-warning"> </div>
|
|
|
|
|
<div id="unity-footer">
|
|
|
|
|
<div id="unity-webgl-logo"></div>
|
|
|
|
|
<div id="unity-fullscreen-button"></div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-07-23 01:36:18 +08:00
|
|
|
|
<script src="hls.min.js"></script>
|
2025-07-16 15:37:39 +08:00
|
|
|
|
<script>
|
|
|
|
|
var container = document.querySelector("#unity-container");
|
|
|
|
|
var canvas = document.querySelector("#unity-canvas");
|
|
|
|
|
var loadingBar = document.querySelector("#unity-loading-bar");
|
|
|
|
|
//var loadingLogo = document.querySelector("#unity-loading-img");
|
|
|
|
|
var loadingText = document.querySelector("#unity-loadtext");
|
|
|
|
|
var progressBarFull = document.querySelector("#unity-progress-bar-full");
|
|
|
|
|
var fullscreenButton = document.querySelector("#unity-fullscreen-button");
|
|
|
|
|
var warningBanner = document.querySelector("#unity-warning");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
通过调用此方法发送消息给Unity内部,参数依次为:模型ID、模型名称、模型介绍、谁用(0:正常 1:理化生)
|
|
|
|
|
举例:HtmlToUnity("1","霸王龙","简介","0");
|
|
|
|
|
*/
|
|
|
|
|
function HtmlToUnity(id, name, describe, type) {
|
|
|
|
|
var parameters = (id === undefined ? "" : id) + "|" +
|
|
|
|
|
(name === undefined ? "" : name) + "|" +
|
|
|
|
|
(describe === undefined ? "" : describe) + "|" +
|
|
|
|
|
(type === undefined ? "" : type);
|
|
|
|
|
unityInstnac.SendMessage("Common", "SetModelInfo", parameters);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function JumpToURL(str) {
|
|
|
|
|
window.open(str, '_self');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function SendFinish(str) {
|
|
|
|
|
progressBarFull.style.width = 100 * str + "%";
|
|
|
|
|
loadingText.textContent = "数据加载中...(" + parseInt(100 * str) + "%)";
|
|
|
|
|
//loadingLogo.style.marginLeft = 20 + (str * 50) + "%";
|
|
|
|
|
if (str == 1) {
|
|
|
|
|
loadingBar.style.display = "none";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var unityInstnac;
|
|
|
|
|
|
|
|
|
|
var buildUrl = "Build";
|
|
|
|
|
var loaderUrl = buildUrl + "/TXC.loader.js";
|
|
|
|
|
var config = {
|
|
|
|
|
dataUrl: buildUrl + "/TXC.data",
|
|
|
|
|
frameworkUrl: buildUrl + "/TXC.framework.js",
|
|
|
|
|
codeUrl: buildUrl + "/TXC.wasm",
|
|
|
|
|
streamingAssetsUrl: "StreamingAssets",
|
|
|
|
|
companyName: "DefaultCompany",
|
|
|
|
|
productName: "DXC",
|
|
|
|
|
productVersion: "0.1.0",
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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";
|
|
|
|
|
canvas.className = "unity-mobile";
|
|
|
|
|
|
|
|
|
|
// To lower canvas resolution on mobile devices to gain some
|
|
|
|
|
// performance, uncomment the following line:
|
|
|
|
|
config.devicePixelRatio = 1;
|
|
|
|
|
|
|
|
|
|
// 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 = "100%";
|
|
|
|
|
canvas.style.height = "100%";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
loadingBar.style.display = "flex";
|
|
|
|
|
//loadingLogo.src = ""
|
|
|
|
|
var script = document.createElement("script");
|
|
|
|
|
script.src = loaderUrl;
|
|
|
|
|
script.onload = () => {
|
|
|
|
|
createUnityInstance(canvas, config, (progress) => {
|
|
|
|
|
progressBarFull.style.width = 100 * (progress) + "%";
|
|
|
|
|
loadingText.textContent = "数据加载中...(" + parseInt(100 * (progress)) + "%)";
|
|
|
|
|
//loadingLogo.style.marginLeft = 20 + ((progress) * 50) + "%";
|
|
|
|
|
}).then((unityInstance) => {
|
|
|
|
|
unityInstnac = unityInstance;
|
|
|
|
|
setTimeout(function () {
|
|
|
|
|
var url = window.location.href;
|
|
|
|
|
var result = url.split("?");
|
|
|
|
|
var parameters = "";
|
|
|
|
|
if (result.length > 1) {
|
|
|
|
|
parameters = result[1];
|
|
|
|
|
}
|
|
|
|
|
loadingBar.style.display = "none";
|
|
|
|
|
//unityInstance.SendMessage("Common", "SetRoomData", parameters);
|
|
|
|
|
}, 500);
|
|
|
|
|
}).catch((message) => {
|
|
|
|
|
alert(message);
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
document.body.appendChild(script);
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
|
|
|
|
|
</html>
|