debug
This commit is contained in:
@@ -0,0 +1,158 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en-us">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Déroc Virtual 3D</title>
|
||||
<style>
|
||||
html, body {
|
||||
background: #000;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: visible;
|
||||
padding: 0;
|
||||
margin: 0;
|
||||
font-family: Arial, sans-serif;
|
||||
color: white;
|
||||
}
|
||||
#container {
|
||||
background: transparent !important;
|
||||
position: absolute;
|
||||
}
|
||||
#container canvas {
|
||||
position: absolute;
|
||||
}
|
||||
#container canvas[data-pixel-art="true"] {
|
||||
image-rendering: pixelated;
|
||||
-ms-interpolation-mode: nearest-neighbor;
|
||||
}
|
||||
#loading-box {
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
text-align: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
#logo {
|
||||
max-width: 600px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
#progress-container {
|
||||
width: 300px;
|
||||
height: 20px;
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
margin: 0 auto;
|
||||
}
|
||||
#progress-bar {
|
||||
height: 100%;
|
||||
width: 0%;
|
||||
background-color: #4caf50;
|
||||
transition: width 0.1s ease;
|
||||
}
|
||||
#progress-info {
|
||||
margin-top: 10px;
|
||||
font-size: 14px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="container">
|
||||
<canvas id="game-canvas" data-pixel-art=""></canvas>
|
||||
|
||||
<!-- Logo et barre de chargement -->
|
||||
<div id="loading-box">
|
||||
<img id="logo" src="Logo.png" alt="Logo">
|
||||
<div id="progress-container">
|
||||
<div id="progress-bar"></div>
|
||||
</div>
|
||||
<div id="progress-info">Chargement... 0%</div>
|
||||
</div>
|
||||
|
||||
<script src="Build/Build WebGL.loader.js"></script>
|
||||
<script>
|
||||
const canvas = document.querySelector("#game-canvas");
|
||||
const progressBar = document.getElementById("progress-bar");
|
||||
const progressInfo = document.getElementById("progress-info");
|
||||
const loadingBox = document.getElementById("loading-box");
|
||||
|
||||
let lastTime = performance.now();
|
||||
let lastProgress = 0;
|
||||
|
||||
const config = {
|
||||
dataUrl: "Build/Build WebGL.data",
|
||||
frameworkUrl: "Build/Build WebGL.framework.js",
|
||||
codeUrl: "Build/Build WebGL.wasm",
|
||||
streamingAssetsUrl: "StreamingAssets",
|
||||
companyName: "GUCEM _ Clan des Tritons",
|
||||
productName: "Déroc Virtual 3D",
|
||||
productVersion: "2025.06.02"
|
||||
};
|
||||
|
||||
let scaleToFit;
|
||||
try {
|
||||
scaleToFit = !!JSON.parse("");
|
||||
} catch (e) {
|
||||
scaleToFit = true;
|
||||
}
|
||||
|
||||
function progressHandler(progress) {
|
||||
const percent = Math.floor(progress * 100);
|
||||
const now = performance.now();
|
||||
const deltaTime = (now - lastTime) / 1000; // en secondes
|
||||
const deltaProgress = progress - lastProgress;
|
||||
const speed = deltaProgress > 0 ? (deltaProgress * 100 / deltaTime).toFixed(2) : "0";
|
||||
|
||||
progressBar.style.width = percent + "%";
|
||||
// <!-- progressInfo.textContent = `Chargement... ${percent}% (${speed}%/s)`; -->
|
||||
progressInfo.textContent = `Chargement... ${percent}%`;
|
||||
|
||||
lastTime = now;
|
||||
lastProgress = progress;
|
||||
|
||||
if (percent >= 100) {
|
||||
// Masquer le logo et la barre après chargement
|
||||
setTimeout(() => loadingBox.style.display = "none", 500);
|
||||
}
|
||||
}
|
||||
|
||||
function onResize() {
|
||||
const container = canvas.parentElement;
|
||||
let w, h;
|
||||
if (scaleToFit) {
|
||||
w = window.innerWidth;
|
||||
h = window.innerHeight;
|
||||
const r = 540 / 960;
|
||||
if (w * r > h) w = Math.min(w, Math.ceil(h / r));
|
||||
h = Math.floor(w * r);
|
||||
} else {
|
||||
w = 960;
|
||||
h = 540;
|
||||
}
|
||||
container.style.width = canvas.style.width = w + "px";
|
||||
container.style.height = canvas.style.height = h + "px";
|
||||
container.style.top = Math.floor((window.innerHeight - h) / 2) + "px";
|
||||
container.style.left = Math.floor((window.innerWidth - w) / 2) + "px";
|
||||
}
|
||||
|
||||
createUnityInstance(canvas, config, progressHandler).then(function (instance) {
|
||||
canvas = instance.Module.canvas;
|
||||
onResize();
|
||||
});
|
||||
|
||||
window.addEventListener('resize', onResize);
|
||||
onResize();
|
||||
|
||||
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
|
||||
const meta = document.createElement('meta');
|
||||
meta.name = 'viewport';
|
||||
meta.content = 'width=device-width, height=device-height, initial-scale=1.0, user-scalable=no, shrink-to-fit=yes';
|
||||
document.getElementsByTagName('head')[0].appendChild(meta);
|
||||
}
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user