You've already forked FateViewer
Add project files.
This commit is contained in:
101
Assets/WebGLTemplates/Better2020/index.html
Normal file
101
Assets/WebGLTemplates/Better2020/index.html
Normal file
@@ -0,0 +1,101 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<title>{{{ PRODUCT_NAME }}}</title>
|
||||
<link rel="shortcut icon" href="TemplateData/favicon.ico">
|
||||
<link rel="stylesheet" href="TemplateData/style.css">
|
||||
</head>
|
||||
<body class="{{{ SPLASH_SCREEN_STYLE.toLowerCase() }}}">
|
||||
<div id="unity-container" class="unity-desktop">
|
||||
<canvas id="unity-canvas"></canvas>
|
||||
</div>
|
||||
<div id="loading-cover" style="display:none;">
|
||||
<div id="unity-loading-bar">
|
||||
<div id="unity-logo"><img src="logo.png"></div>
|
||||
<div id="unity-progress-bar-empty" style="display: none;">
|
||||
<div id="unity-progress-bar-full"></div>
|
||||
</div>
|
||||
<div class="spinner"></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="unity-fullscreen-button" style="display: none;"></div>
|
||||
<script>
|
||||
const hideFullScreenButton = "{{{ HIDE_FULL_SCREEN_BUTTON }}}";
|
||||
const buildUrl = "Build";
|
||||
const loaderUrl = buildUrl + "/{{{ LOADER_FILENAME }}}";
|
||||
const 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: "{{{ COMPANY_NAME }}}",
|
||||
productName: "{{{ PRODUCT_NAME }}}",
|
||||
productVersion: "{{{ PRODUCT_VERSION }}}",
|
||||
};
|
||||
|
||||
const container = document.querySelector("#unity-container");
|
||||
const canvas = document.querySelector("#unity-canvas");
|
||||
const loadingCover = document.querySelector("#loading-cover");
|
||||
const progressBarEmpty = document.querySelector("#unity-progress-bar-empty");
|
||||
const progressBarFull = document.querySelector("#unity-progress-bar-full");
|
||||
const fullscreenButton = document.querySelector("#unity-fullscreen-button");
|
||||
const spinner = document.querySelector('.spinner');
|
||||
|
||||
const canFullscreen = (function() {
|
||||
for (const key of [
|
||||
'exitFullscreen',
|
||||
'webkitExitFullscreen',
|
||||
'webkitCancelFullScreen',
|
||||
'mozCancelFullScreen',
|
||||
'msExitFullscreen',
|
||||
]) {
|
||||
if (key in document) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}());
|
||||
|
||||
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
|
||||
container.className = "unity-mobile";
|
||||
config.devicePixelRatio = 1;
|
||||
}
|
||||
#if BACKGROUND_FILENAME
|
||||
canvas.style.background = "url('" + buildUrl + "/{{{ BACKGROUND_FILENAME.replace(/'/g, '%27') }}}') center / cover";
|
||||
#endif
|
||||
loadingCover.style.display = "";
|
||||
|
||||
const script = document.createElement("script");
|
||||
script.src = loaderUrl;
|
||||
script.onload = () => {
|
||||
createUnityInstance(canvas, config, (progress) => {
|
||||
spinner.style.display = "none";
|
||||
progressBarEmpty.style.display = "";
|
||||
progressBarFull.style.width = `${100 * progress}%`;
|
||||
}).then((unityInstance) => {
|
||||
loadingCover.style.display = "none";
|
||||
if (canFullscreen) {
|
||||
if (!hideFullScreenButton) {
|
||||
fullscreenButton.style.display = "";
|
||||
}
|
||||
fullscreenButton.onclick = () => {
|
||||
unityInstance.SetFullscreen(1);
|
||||
};
|
||||
}
|
||||
}).catch((message) => {
|
||||
alert(message);
|
||||
});
|
||||
};
|
||||
document.body.appendChild(script);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user