mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/MI-38.git
synced 2026-01-24 02:45:39 +03:00
101 lines
3.3 KiB
HTML
101 lines
3.3 KiB
HTML
<!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 | Mi-38</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={{{ WIDTH }}} height={{{ HEIGHT }}}></canvas>
|
|
<div id="unity-loading-bar" align="center">
|
|
<div id="unity-logo"></div>
|
|
<div id="unity-progress-bar-empty" align="left">
|
|
<div id="unity-progress-bar-full"></div>
|
|
</div>
|
|
</div>
|
|
<div id="unity-mobile-warning">
|
|
WebGL builds are not supported on mobile devices.
|
|
</div>
|
|
</div>
|
|
<script>
|
|
var scenarioToLoad = "FreeMode";
|
|
function scFinished(scName, scTitle) { window.parent.scFinished(scName, scTitle); }
|
|
</script>
|
|
<script>
|
|
var buildUrl = "Build";
|
|
var loaderUrl = buildUrl + "/{{{ LOADER_FILENAME }}}";
|
|
var config = {
|
|
dataUrl: buildUrl + "/{{{ DATA_FILENAME }}}",
|
|
frameworkUrl: buildUrl + "/{{{ FRAMEWORK_FILENAME }}}",
|
|
codeUrl: buildUrl + "/{{{ CODE_FILENAME }}}",
|
|
#if MEMORY_FILENAME
|
|
memoryUrl: buildUrl + "/{{{ MEMORY_FILENAME }}}",
|
|
#endif
|
|
#if SYMBOLS_FILENAME
|
|
symbolsUrl: buildUrl + "/{{{ SYMBOLS_FILENAME }}}",
|
|
#endif
|
|
streamingAssetsUrl: "StreamingAssets",
|
|
companyName: "https://dinamika-avia.ru/",
|
|
productName: "Mi-38",
|
|
productVersion: "1.0",
|
|
};
|
|
|
|
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 mobileWarning = document.querySelector("#unity-mobile-warning");
|
|
|
|
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
|
|
container.className = "unity-mobile";
|
|
config.devicePixelRatio = 1;
|
|
mobileWarning.style.display = "block";
|
|
setTimeout(() => {
|
|
mobileWarning.style.display = "none";
|
|
}, 5000);
|
|
} else {
|
|
canvas.style.width = "936px"; //{{{ WIDTH }}}
|
|
canvas.style.height = "526px"; //{{{ HEIGHT }}}
|
|
}
|
|
#if BACKGROUND_FILENAME
|
|
canvas.style.background = "url('" + buildUrl + "/{{{ BACKGROUND_FILENAME.replace(/'/g, '%27') }}}') center / cover";
|
|
#endif
|
|
loadingBar.style.display = "block";
|
|
|
|
var myUnityInstance = null;
|
|
var timerId = setInterval(function trySendMsg() {
|
|
if(myUnityInstance != null)
|
|
if(myUnityInstance.progress = 1)
|
|
{
|
|
myUnityInstance.SendMessage('Player', 'LoadScenario', scenarioToLoad);
|
|
clearInterval(timerId); timerID = null;
|
|
}
|
|
}, 500);
|
|
|
|
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";
|
|
myUnityInstance = unityInstance;
|
|
window.parent.quitCurUnity = () => {
|
|
myUnityInstance.Quit().then(function () {
|
|
unityInstance = null; myUnityInstance = null;
|
|
container.remove();
|
|
window.parent.afterUnityQuit();
|
|
});
|
|
}
|
|
}).catch((message) => {
|
|
alert(message);
|
|
});
|
|
};
|
|
document.body.appendChild(script);
|
|
</script>
|
|
</body>
|
|
</html>
|