|
| 1 | +<!DOCTYPE html> |
| 2 | +<html lang="en-us"> |
| 3 | + |
| 4 | +<head> |
| 5 | + <meta charset="utf-8"> |
| 6 | + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
| 7 | + <title>ArrowDash</title> |
| 8 | + <style> |
| 9 | + html, |
| 10 | + body { |
| 11 | + background-image: url("Build/Build.jpg"); |
| 12 | + background-position: center; |
| 13 | + background-repeat: no-repeat; |
| 14 | + background-size: cover; |
| 15 | + width: 100%; |
| 16 | + height: 100%; |
| 17 | + overflow: visible; |
| 18 | + padding: 0; |
| 19 | + margin: 0; |
| 20 | + background-color: black; |
| 21 | + } |
| 22 | + |
| 23 | + div#gameContainer { |
| 24 | + background: transparent !important; |
| 25 | + position: absolute; |
| 26 | + top: 0px !important; |
| 27 | + width: 100% !important; |
| 28 | + height: 100% !important; |
| 29 | + left: 0px !important; |
| 30 | + } |
| 31 | + |
| 32 | + div#gameContainer canvas { |
| 33 | + position: absolute; |
| 34 | + width: 100% !important; |
| 35 | + height: 100% !important; |
| 36 | + } |
| 37 | + |
| 38 | + div#gameContainer canvas[data-pixel-art="true"] { |
| 39 | + position: absolute; |
| 40 | + image-rendering: optimizeSpeed; |
| 41 | + image-rendering: -webkit-crisp-edges; |
| 42 | + image-rendering: -moz-crisp-edges; |
| 43 | + image-rendering: -o-crisp-edges; |
| 44 | + image-rendering: crisp-edges; |
| 45 | + image-rendering: -webkit-optimize-contrast; |
| 46 | + image-rendering: optimize-contrast; |
| 47 | + image-rendering: pixelated; |
| 48 | + -ms-interpolation-mode: nearest-neighbor; |
| 49 | + } |
| 50 | + |
| 51 | + .loadingOut { |
| 52 | + width: 250px; |
| 53 | + position: fixed; |
| 54 | + left: 50%; |
| 55 | + top: calc(50% - 8px); |
| 56 | + transform: translate(-50%); |
| 57 | + border: 2px solid white; |
| 58 | + height: 14px; |
| 59 | + background: transparent; |
| 60 | + } |
| 61 | + |
| 62 | + .progress-bar { |
| 63 | + height: 100%; |
| 64 | + background: linear-gradient(to right, white, white 0%, transparent 0%, transparent); |
| 65 | + } |
| 66 | + |
| 67 | + .centered { |
| 68 | + position: fixed; |
| 69 | + top: 50%; |
| 70 | + left: 50%; |
| 71 | + margin-top: -150px; |
| 72 | + margin-left: -250px; |
| 73 | + width: 500px; |
| 74 | + } |
| 75 | + |
| 76 | + #orientation-warning { |
| 77 | + display: none; |
| 78 | + position: fixed; |
| 79 | + top: 50%; |
| 80 | + left: 50%; |
| 81 | + transform: translate(-50%, -50%); |
| 82 | + background-color: red; |
| 83 | + color: white; |
| 84 | + padding: 20px; |
| 85 | + border: 2px solid white; |
| 86 | + text-align: center; |
| 87 | + z-index: 1000; |
| 88 | + } |
| 89 | + |
| 90 | + #orientation-image { |
| 91 | + width: 125px; |
| 92 | + height: 125px; |
| 93 | + margin-top: 10px; |
| 94 | + display: none; |
| 95 | + position: fixed; |
| 96 | + top: calc(50% - 150px); |
| 97 | + left: 50%; |
| 98 | + transform: translate(-50%, -50%); |
| 99 | + } |
| 100 | + </style> |
| 101 | +</head> |
| 102 | + |
| 103 | +<body> |
| 104 | + <img id="orientation-image" src="TemplateData/Orientation/orientation.png" alt="Orientation"> |
| 105 | + <div id="orientation-warning"> |
| 106 | + <div>Please rotate your device to the correct mode.</div> |
| 107 | + |
| 108 | + </div> |
| 109 | + <div id="gameContainer"> |
| 110 | + <img src="TemplateData/logo.png" class="centered"> |
| 111 | + <div class="loadingOut"> |
| 112 | + <div class="progress-bar" id="progress-bar"></div> |
| 113 | + </div> |
| 114 | + <canvas id="unity-canvas" data-pixel-art=""></canvas> |
| 115 | + <script src="Build/GeometryVibes_V1_39.loader.js"></script> |
| 116 | + <script> |
| 117 | + var canvas = document.querySelector("#unity-canvas"); |
| 118 | + var progressBar = document.querySelector("#progress-bar"); |
| 119 | + var gameContainer = document.querySelector("#gameContainer"); |
| 120 | + var orientationWarning = document.querySelector("#orientation-warning"); |
| 121 | + var orientationImage = document.querySelector("#orientation-image"); |
| 122 | + var config = { |
| 123 | + dataUrl: "Build/GeometryVibes_V1_39.data.unityweb", |
| 124 | + frameworkUrl: "Build/GeometryVibes_V1_39.framework.js.unityweb", |
| 125 | + codeUrl: "Build/GeometryVibes_V1_39.wasm.unityweb", |
| 126 | + streamingAssetsUrl: "StreamingAssets", |
| 127 | + companyName: "GameVGames", |
| 128 | + productName: "ArrowDash", |
| 129 | + productVersion: "1.0", |
| 130 | + }; |
| 131 | + var scaleToFit; |
| 132 | + try { |
| 133 | + scaleToFit = !!JSON.parse(""); |
| 134 | + } catch (e) { |
| 135 | + scaleToFit = true; |
| 136 | + } |
| 137 | + |
| 138 | + function progressHandler(progress) { |
| 139 | + var percent = progress * 100 + '%'; |
| 140 | + progressBar.style.background = 'linear-gradient(to right, white, white ' + percent + ', transparent ' + percent + ', transparent)'; |
| 141 | + } |
| 142 | + |
| 143 | + function onResize() { |
| 144 | + var container = canvas.parentElement; |
| 145 | + var w; |
| 146 | + var h; |
| 147 | + |
| 148 | + if (scaleToFit) { |
| 149 | + w = window.innerWidth; |
| 150 | + h = window.innerHeight; |
| 151 | + |
| 152 | + var r = 1080 / 1920; |
| 153 | + |
| 154 | + if (w * r > window.innerHeight) { |
| 155 | + w = Math.min(w, Math.ceil(h / r)); |
| 156 | + } |
| 157 | + h = Math.floor(w * r); |
| 158 | + } else { |
| 159 | + w = 1920; |
| 160 | + h = 1080; |
| 161 | + } |
| 162 | + |
| 163 | + container.style.width = canvas.style.width = w + "px"; |
| 164 | + container.style.height = canvas.style.height = h + "px"; |
| 165 | + container.style.top = Math.floor((window.innerHeight - h) / 2) + "px"; |
| 166 | + container.style.left = Math.floor((window.innerWidth - w) / 2) + "px"; |
| 167 | + } |
| 168 | + |
| 169 | + function checkOrientation(orientation) { |
| 170 | + if (orientation === "Portrait" && window.innerHeight < window.innerWidth) { |
| 171 | + orientationWarning.style.display = 'block'; |
| 172 | + gameContainer.style.display = 'none'; |
| 173 | + orientationWarning.innerText = 'Please rotate your device to portrait mode.'; |
| 174 | + orientationImage.style.display = 'block'; // Ensure the image is visible |
| 175 | + } else if (orientation === "Landscape" && window.innerHeight > window.innerWidth) { |
| 176 | + orientationWarning.style.display = 'block'; |
| 177 | + gameContainer.style.display = 'none'; |
| 178 | + orientationWarning.innerText = 'Please rotate your device to landscape mode.'; |
| 179 | + orientationImage.style.display = 'block'; // Ensure the image is visible |
| 180 | + } else { |
| 181 | + orientationWarning.style.display = 'none'; |
| 182 | + gameContainer.style.display = 'block'; |
| 183 | + orientationImage.style.display = 'none'; // Hide the image when not needed |
| 184 | + } |
| 185 | + } |
| 186 | + |
| 187 | + function loadTemplateConfig() { |
| 188 | + var request = new XMLHttpRequest(); |
| 189 | + request.open('GET', 'TemplateData/Orientation/template.json', true); |
| 190 | + request.onreadystatechange = function() { |
| 191 | + if (request.readyState === 4 && request.status === 200) { |
| 192 | + var config = JSON.parse(request.responseText); |
| 193 | + var orientation = config.customOptions.find(option => option.name === "orientation").default; |
| 194 | + checkOrientation(orientation); |
| 195 | + } |
| 196 | + }; |
| 197 | + request.send(); |
| 198 | + } |
| 199 | + |
| 200 | + createUnityInstance(canvas, config, progressHandler).then(function(instance) { |
| 201 | + canvas = instance.Module.canvas; |
| 202 | + myGameInstance = instance; |
| 203 | + onResize(); |
| 204 | + }); |
| 205 | + |
| 206 | + window.addEventListener('resize', function() { |
| 207 | + onResize(); |
| 208 | + loadTemplateConfig(); |
| 209 | + }); |
| 210 | + |
| 211 | + loadTemplateConfig(); |
| 212 | + </script> |
| 213 | + |
| 214 | + <!--RHM API--> |
| 215 | + <script type="text/javascript" src="js/rhmApi.js"></script> |
| 216 | + </div> |
| 217 | +</body> |
| 218 | + |
| 219 | +</html> |
0 commit comments