|
3 | 3 |
|
4 | 4 | <head>
|
5 | 5 | <meta charset="utf-8">
|
6 |
| - <title>WebGLFitWindow</title> |
| 6 | + <title>%UNITY_WEB_NAME%</title> |
7 | 7 | <style>
|
8 | 8 | html {
|
9 | 9 | box-sizing: border-box;
|
|
26 | 26 | }
|
27 | 27 |
|
28 | 28 | .logo {
|
29 |
| - width: 50vw; |
30 |
| - height: 33vh; |
31 |
| - background-image: url(logo.png); |
32 |
| - background-position: bottom center; |
33 |
| - background-size: contain; |
34 |
| - background-repeat: no-repeat; |
| 29 | + display: block; |
| 30 | + width: max-width: 100vw; |
| 31 | + height: max-height: 70vh; |
35 | 32 | }
|
36 | 33 |
|
37 | 34 | .progress {
|
|
87 | 84 | }
|
88 | 85 |
|
89 | 86 | </style>
|
90 |
| - <script src="Build/UnityLoader.js"></script> |
91 |
| - <script> |
92 |
| - var gameInstance = UnityLoader.instantiate("gameContainer", "Build/dist.json", {onProgress: UnityProgress}); |
93 |
| - function UnityProgress(gameInstance, progress) { |
94 |
| - if (!gameInstance.Module) { |
95 |
| - return; |
96 |
| - } |
97 |
| - const loader = document.querySelector("#loader"); |
98 |
| - if (!gameInstance.progress) { |
99 |
| - const progress = document.querySelector("#loader .progress"); |
100 |
| - progress.style.display = "block"; |
101 |
| - gameInstance.progress = progress.querySelector(".full"); |
102 |
| - loader.querySelector(".spinner").style.display = "none"; |
103 |
| - } |
104 |
| - gameInstance.progress.style.transform = `scaleX(${progress})`; |
105 |
| - if (progress === 1) { |
106 |
| - loader.style.display = "none"; |
107 |
| - } |
108 |
| - } |
109 |
| - </script> |
110 | 87 | </head>
|
111 | 88 |
|
112 | 89 | <body>
|
113 | 90 | <div id="gameContainer"></div>
|
114 | 91 | <div id="loader">
|
115 |
| - <div class="logo"></div> |
| 92 | + <img class="logo" src="logo.png"> |
116 | 93 | <div class="spinner"></div>
|
117 | 94 | <div class="progress"><div class="full"></div></div>
|
118 | 95 | </div>
|
119 | 96 | </body>
|
120 | 97 |
|
| 98 | + <script src="%UNITY_WEBGL_LOADER_URL%"></script> |
| 99 | + <script> |
| 100 | + var gameInstance = UnityLoader.instantiate("gameContainer", "%UNITY_WEBGL_BUILD_URL%", {onProgress: UnityProgress}); |
| 101 | + function UnityProgress(gameInstance, progress) { |
| 102 | + if (!gameInstance.Module) { |
| 103 | + return; |
| 104 | + } |
| 105 | + const loader = document.querySelector("#loader"); |
| 106 | + if (!gameInstance.progress) { |
| 107 | + const progress = document.querySelector("#loader .progress"); |
| 108 | + progress.style.display = "block"; |
| 109 | + gameInstance.progress = progress.querySelector(".full"); |
| 110 | + loader.querySelector(".spinner").style.display = "none"; |
| 111 | + } |
| 112 | + gameInstance.progress.style.transform = `scaleX(${progress})`; |
| 113 | + if (progress === 1 && !gameInstance.removeTimeout) { |
| 114 | + gameInstance.removeTimeout = setTimeout(function() { |
| 115 | + loader.style.display = "none"; |
| 116 | + }, 2000); |
| 117 | + } |
| 118 | + } |
| 119 | + </script> |
| 120 | + |
121 | 121 | </html>
|
| 122 | + |
0 commit comments