|
| 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>Geometry Vibes Monster</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: 40%; |
| 53 | + max-width: 400px; |
| 54 | + position: fixed; |
| 55 | + left: 50%; |
| 56 | + top: 50%; |
| 57 | + transform: translate(-50%, -50%); |
| 58 | + border-radius: 10px; |
| 59 | + height: 15px; |
| 60 | + background: #e0e0e0; |
| 61 | + overflow: hidden; |
| 62 | + box-shadow: 0 2px 5px rgba(0,0,0,0.2); |
| 63 | + } |
| 64 | + |
| 65 | + .progress-bar { |
| 66 | + height: 100%; |
| 67 | + background: repeating-linear-gradient( |
| 68 | + 45deg, |
| 69 | + #4CAF50, |
| 70 | + #4CAF50 10px, |
| 71 | + #8BC34A 10px, |
| 72 | + #8BC34A 20px |
| 73 | + ); |
| 74 | + border-radius: 10px; |
| 75 | + transition: width 0.2s ease; |
| 76 | + } |
| 77 | + |
| 78 | + .centered { |
| 79 | + position: fixed; |
| 80 | + top: 50%; |
| 81 | + left: 50%; |
| 82 | + margin-top: -150px; |
| 83 | + margin-left: -250px; |
| 84 | + width: 500px; |
| 85 | + } |
| 86 | + |
| 87 | + #orientation-warning { |
| 88 | + display: none; |
| 89 | + position: fixed; |
| 90 | + top: 50%; |
| 91 | + left: 50%; |
| 92 | + transform: translate(-50%, -50%); |
| 93 | + background-color: red; |
| 94 | + color: white; |
| 95 | + padding: 20px; |
| 96 | + border: 2px solid white; |
| 97 | + text-align: center; |
| 98 | + z-index: 1000; |
| 99 | + } |
| 100 | + |
| 101 | + #orientation-image { |
| 102 | + width: 125px; |
| 103 | + height: 125px; |
| 104 | + margin-top: 10px; |
| 105 | + display: none; |
| 106 | + position: fixed; |
| 107 | + top: calc(50% - 150px); |
| 108 | + left: 50%; |
| 109 | + transform: translate(-50%, -50%); |
| 110 | + } |
| 111 | + </style> |
| 112 | +</head> |
| 113 | + |
| 114 | +<body> |
| 115 | + <img id="orientation-image" src="TemplateData/Orientation/orientation.png" alt="Orientation"> |
| 116 | + <div id="orientation-warning"> |
| 117 | + <div>Please rotate your device to the correct mode.</div> |
| 118 | + |
| 119 | + </div> |
| 120 | + <div id="gameContainer"> |
| 121 | + <img src="TemplateData/logo.png" class="centered"> |
| 122 | + <div class="loadingOut"> |
| 123 | + <div class="progress-bar" id="progress-bar"></div> |
| 124 | + </div> |
| 125 | + <canvas id="unity-canvas" data-pixel-art=""></canvas> |
| 126 | + <script src="Build/geometryVibes_SpaceV28.loader.js"></script> |
| 127 | + <script> |
| 128 | + var canvas = document.querySelector("#unity-canvas"); |
| 129 | + var progressBar = document.querySelector("#progress-bar"); |
| 130 | + var gameContainer = document.querySelector("#gameContainer"); |
| 131 | + var orientationWarning = document.querySelector("#orientation-warning"); |
| 132 | + var orientationImage = document.querySelector("#orientation-image"); |
| 133 | + var config = { |
| 134 | + dataUrl: "Build/geometryVibes_SpaceV28.data.unityweb", |
| 135 | + frameworkUrl: "Build/geometryVibes_SpaceV28.framework.js.unityweb", |
| 136 | + codeUrl: "Build/geometryVibes_SpaceV28.wasm.unityweb", |
| 137 | + streamingAssetsUrl: "StreamingAssets", |
| 138 | + companyName: "GameVGames", |
| 139 | + productName: "Geometry Vibes Monster", |
| 140 | + productVersion: "1.0", |
| 141 | + }; |
| 142 | + var scaleToFit; |
| 143 | + try { |
| 144 | + scaleToFit = !!JSON.parse(""); |
| 145 | + } catch (e) { |
| 146 | + scaleToFit = true; |
| 147 | + } |
| 148 | + |
| 149 | + function progressHandler(progress) { |
| 150 | + var percent = progress * 100 + '%'; |
| 151 | + progressBar.style.width = percent; |
| 152 | + } |
| 153 | + |
| 154 | + function onResize() { |
| 155 | + var container = canvas.parentElement; |
| 156 | + var w; |
| 157 | + var h; |
| 158 | + |
| 159 | + if (scaleToFit) { |
| 160 | + w = window.innerWidth; |
| 161 | + h = window.innerHeight; |
| 162 | + |
| 163 | + var r = 1080 / 1920; |
| 164 | + |
| 165 | + if (w * r > window.innerHeight) { |
| 166 | + w = Math.min(w, Math.ceil(h / r)); |
| 167 | + } |
| 168 | + h = Math.floor(w * r); |
| 169 | + } else { |
| 170 | + w = 1920; |
| 171 | + h = 1080; |
| 172 | + } |
| 173 | + |
| 174 | + container.style.width = canvas.style.width = w + "px"; |
| 175 | + container.style.height = canvas.style.height = h + "px"; |
| 176 | + container.style.top = Math.floor((window.innerHeight - h) / 2) + "px"; |
| 177 | + container.style.left = Math.floor((window.innerWidth - w) / 2) + "px"; |
| 178 | + } |
| 179 | + |
| 180 | + function checkOrientation(orientation) { |
| 181 | + if (orientation === "Portrait" && window.innerHeight < window.innerWidth) { |
| 182 | + orientationWarning.style.display = 'block'; |
| 183 | + gameContainer.style.display = 'none'; |
| 184 | + orientationWarning.innerText = 'Please rotate your device to portrait mode.'; |
| 185 | + orientationImage.style.display = 'block'; // Ensure the image is visible |
| 186 | + } else if (orientation === "Landscape" && window.innerHeight > window.innerWidth) { |
| 187 | + orientationWarning.style.display = 'block'; |
| 188 | + gameContainer.style.display = 'none'; |
| 189 | + orientationWarning.innerText = 'Please rotate your device to landscape mode.'; |
| 190 | + orientationImage.style.display = 'block'; // Ensure the image is visible |
| 191 | + } else { |
| 192 | + orientationWarning.style.display = 'none'; |
| 193 | + gameContainer.style.display = 'block'; |
| 194 | + orientationImage.style.display = 'none'; // Hide the image when not needed |
| 195 | + } |
| 196 | + } |
| 197 | + |
| 198 | + function loadTemplateConfig() { |
| 199 | + var request = new XMLHttpRequest(); |
| 200 | + request.open('GET', 'TemplateData/Orientation/template.json', true); |
| 201 | + request.onreadystatechange = function() { |
| 202 | + if (request.readyState === 4 && request.status === 200) { |
| 203 | + var config = JSON.parse(request.responseText); |
| 204 | + var orientation = config.customOptions.find(option => option.name === "orientation").default; |
| 205 | + checkOrientation(orientation); |
| 206 | + } |
| 207 | + }; |
| 208 | + request.send(); |
| 209 | + } |
| 210 | + |
| 211 | + createUnityInstance(canvas, config, progressHandler).then(function(instance) { |
| 212 | + canvas = instance.Module.canvas; |
| 213 | + myGameInstance = instance; |
| 214 | + onResize(); |
| 215 | + }); |
| 216 | + |
| 217 | + window.addEventListener('resize', function() { |
| 218 | + onResize(); |
| 219 | + loadTemplateConfig(); |
| 220 | + }); |
| 221 | + |
| 222 | + loadTemplateConfig(); |
| 223 | + </script> |
| 224 | + |
| 225 | + <!--RHM API--> |
| 226 | + <script type="text/javascript" src="js/rhmApi.js"></script> |
| 227 | + </div> |
| 228 | +</body> |
| 229 | + |
| 230 | +</html> |
0 commit comments