SamuelM0422 commited on
Commit
06a4229
·
verified ·
1 Parent(s): 208968c

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +92 -92
index.html CHANGED
@@ -1,92 +1,92 @@
1
- <!DOCTYPE html>
2
- <html lang="en-us">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
7
- <title>Solar Tracker RL</title>
8
- <link rel="shortcut icon" href="TemplateData/favicon.ico">
9
- <link rel="stylesheet" href="TemplateData/style.css">
10
- </head>
11
- <body class="dark">
12
- <div id="unity-container" class="unity-desktop">
13
- <canvas id="unity-canvas"></canvas>
14
- </div>
15
- <div id="loading-cover" style="display:none;">
16
- <div id="unity-loading-bar">
17
- <div id="unity-logo"><img src="logo.png"></div>
18
- <div id="unity-progress-bar-empty" style="display: none;">
19
- <div id="unity-progress-bar-full"></div>
20
- </div>
21
- <div class="spinner"></div>
22
- </div>
23
- </div>
24
- <div id="unity-fullscreen-button" style="display: none;"></div>
25
- <script>
26
- const hideFullScreenButton = "true";
27
- const buildUrl = "Build";
28
- const loaderUrl = buildUrl + "/SolarTrackerWebGL.loader.js";
29
- const config = {
30
- dataUrl: buildUrl + "/SolarTrackerWebGL.data",
31
- frameworkUrl: buildUrl + "/SolarTrackerWebGL.framework.js",
32
- codeUrl: buildUrl + "/SolarTrackerWebGL.wasm",
33
- streamingAssetsUrl: "StreamingAssets",
34
- companyName: "SamuelM0422",
35
- productName: "Solar Tracker RL",
36
- productVersion: "0.1.0",
37
- };
38
-
39
- const container = document.querySelector("#unity-container");
40
- const canvas = document.querySelector("#unity-canvas");
41
- const loadingCover = document.querySelector("#loading-cover");
42
- const progressBarEmpty = document.querySelector("#unity-progress-bar-empty");
43
- const progressBarFull = document.querySelector("#unity-progress-bar-full");
44
- const fullscreenButton = document.querySelector("#unity-fullscreen-button");
45
- const spinner = document.querySelector('.spinner');
46
-
47
- const canFullscreen = (function() {
48
- for (const key of [
49
- 'exitFullscreen',
50
- 'webkitExitFullscreen',
51
- 'webkitCancelFullScreen',
52
- 'mozCancelFullScreen',
53
- 'msExitFullscreen',
54
- ]) {
55
- if (key in document) {
56
- return true;
57
- }
58
- }
59
- return false;
60
- }());
61
-
62
- if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
63
- container.className = "unity-mobile";
64
- config.devicePixelRatio = 1;
65
- }
66
- loadingCover.style.display = "";
67
-
68
- const script = document.createElement("script");
69
- script.src = loaderUrl;
70
- script.onload = () => {
71
- createUnityInstance(canvas, config, (progress) => {
72
- spinner.style.display = "none";
73
- progressBarEmpty.style.display = "";
74
- progressBarFull.style.width = `${100 * progress}%`;
75
- }).then((unityInstance) => {
76
- loadingCover.style.display = "none";
77
- if (canFullscreen) {
78
- if (!hideFullScreenButton) {
79
- fullscreenButton.style.display = "";
80
- }
81
- fullscreenButton.onclick = () => {
82
- unityInstance.SetFullscreen(1);
83
- };
84
- }
85
- }).catch((message) => {
86
- alert(message);
87
- });
88
- };
89
- document.body.appendChild(script);
90
- </script>
91
- </body>
92
- </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en-us">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
7
+ <title>Solar Tracker RL</title>
8
+ <link rel="shortcut icon" href="TemplateData/favicon.ico">
9
+ <link rel="stylesheet" href="TemplateData/style.css">
10
+ </head>
11
+ <body class="dark">
12
+ <div id="unity-container" class="unity-desktop">
13
+ <canvas id="unity-canvas"></canvas>
14
+ </div>
15
+ <div id="loading-cover" style="display:none;">
16
+ <div id="unity-loading-bar">
17
+ <div id="unity-logo"><img src="logo.png"></div>
18
+ <div id="unity-progress-bar-empty" style="display: none;">
19
+ <div id="unity-progress-bar-full"></div>
20
+ </div>
21
+ <div class="spinner"></div>
22
+ </div>
23
+ </div>
24
+ <div id="unity-fullscreen-button" style="display: none;"></div>
25
+ <script>
26
+ const hideFullScreenButton = "true";
27
+ const buildUrl = "Build";
28
+ const loaderUrl = buildUrl + "/SolarTrackerWebGL.loader.js";
29
+ const config = {
30
+ dataUrl: buildUrl + "/SolarTrackerWebGL.data",
31
+ frameworkUrl: buildUrl + "/SolarTrackerWebGL.framework.js",
32
+ codeUrl: buildUrl + "/SolarTrackerWebGL.wasm",
33
+ streamingAssetsUrl: "StreamingAssets",
34
+ companyName: "SamuelM0422",
35
+ productName: "Solar Tracker RL",
36
+ productVersion: "0.1.0",
37
+ };
38
+
39
+ const container = document.querySelector("#unity-container");
40
+ const canvas = document.querySelector("#unity-canvas");
41
+ const loadingCover = document.querySelector("#loading-cover");
42
+ const progressBarEmpty = document.querySelector("#unity-progress-bar-empty");
43
+ const progressBarFull = document.querySelector("#unity-progress-bar-full");
44
+ const fullscreenButton = document.querySelector("#unity-fullscreen-button");
45
+ const spinner = document.querySelector('.spinner');
46
+
47
+ const canFullscreen = (function() {
48
+ for (const key of [
49
+ 'exitFullscreen',
50
+ 'webkitExitFullscreen',
51
+ 'webkitCancelFullScreen',
52
+ 'mozCancelFullScreen',
53
+ 'msExitFullscreen',
54
+ ]) {
55
+ if (key in document) {
56
+ return true;
57
+ }
58
+ }
59
+ return false;
60
+ }());
61
+
62
+ if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
63
+ container.className = "unity-mobile";
64
+ config.devicePixelRatio = 5;
65
+ }
66
+ loadingCover.style.display = "";
67
+
68
+ const script = document.createElement("script");
69
+ script.src = loaderUrl;
70
+ script.onload = () => {
71
+ createUnityInstance(canvas, config, (progress) => {
72
+ spinner.style.display = "none";
73
+ progressBarEmpty.style.display = "";
74
+ progressBarFull.style.width = `${100 * progress}%`;
75
+ }).then((unityInstance) => {
76
+ loadingCover.style.display = "none";
77
+ if (canFullscreen) {
78
+ if (!hideFullScreenButton) {
79
+ fullscreenButton.style.display = "";
80
+ }
81
+ fullscreenButton.onclick = () => {
82
+ unityInstance.SetFullscreen(1);
83
+ };
84
+ }
85
+ }).catch((message) => {
86
+ alert(message);
87
+ });
88
+ };
89
+ document.body.appendChild(script);
90
+ </script>
91
+ </body>
92
+ </html>