Skip to content

Commit

Permalink
demo
Browse files Browse the repository at this point in the history
  • Loading branch information
Mutilar committed Sep 20, 2024
1 parent 0e05393 commit b01d07b
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 0 deletions.
Binary file added Build/09202024-webgl.data.unityweb
Binary file not shown.
Binary file added Build/09202024-webgl.framework.js.unityweb
Binary file not shown.
2 changes: 2 additions & 0 deletions Build/09202024-webgl.loader.js

Large diffs are not rendered by default.

Binary file added Build/09202024-webgl.wasm.unityweb
Binary file not shown.
81 changes: 81 additions & 0 deletions demo.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<!DOCTYPE html>
<html lang="en-us">
<head>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-B0SKSRDZQK"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());

gtag('config', 'G-B0SKSRDZQK');
</script>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>BitNaughts</title>
<link rel="shortcut icon" type="image/x-icon" href="assets/bnico.ico">
<link rel="stylesheet" href="TemplateData/style.css">
</head>
<body style="background-color: rgba(0, 0, 0)">
<div id="unity-container" class="unity-desktop">
<canvas id="unity-canvas"></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-footer">
<!-- <div id="unity-webgl-logo"></div> -->
<div id="unity-fullscreen-button"></div>
<div id="unity-build-title"><a href="https://github.com/bitnaughts" style="color:white; font-family: 'Abstract Slab'; font-weight: normal; font-style: normal;font-size: 30px">github.com/bitnaughts</a></div></div>
</div>
</div>
<script>
var buildUrl = "Build";
var loaderUrl = buildUrl + "/09202024-webgl.loader.js";
var config = {
dataUrl: buildUrl + "/09202024-webgl.data.unityweb",
frameworkUrl: buildUrl + "/09202024-webgl.framework.js.unityweb",
codeUrl: buildUrl + "/09202024-webgl.wasm.unityweb",
streamingAssetsUrl: "StreamingAssets",
companyName: "BitNaughts",
productName: "BitNaughts",
productVersion: "1",
};

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");

if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
container.className = "unity-mobile";
config.devicePixelRatio = 2;
} else {
container.className = "unity-mobile";
// canvas.style.width = "1910px";
// canvas.style.height = "880px";
}
loadingBar.style.display = "block";

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>

0 comments on commit b01d07b

Please sign in to comment.