-
Notifications
You must be signed in to change notification settings - Fork 68
Expand file tree
/
Copy pathindex.html
More file actions
76 lines (71 loc) · 2.94 KB
/
index.html
File metadata and controls
76 lines (71 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html lang="en-us">
<head>
<base href="https://cdn.jsdelivr.net/gh/gn-math/assets@51462750d29b68ac1e33887c1bf13d9c478d5ead/198/">
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Unity WebGL Player | Slope Plus</title>
<link rel="shortcut icon" href="TemplateData/favicon.ico">
<link rel="stylesheet" href="TemplateData/style.css">
<script src="TemplateData/UnityProgress.js"></script>
<script src="Build/UnityLoader.js"></script>
<script>
function mergeFiles(fileParts) {
return new Promise((resolve, reject) => {
let buffers = [];
function fetchPart(index) {
if (index >= fileParts.length) {
let mergedBlob = new Blob(buffers);
let mergedFileUrl = URL.createObjectURL(mergedBlob);
resolve(mergedFileUrl);
return;
}
fetch(fileParts[index]).then((response) => response.arrayBuffer()).then((data) => {
buffers.push(data);
fetchPart(index + 1);
}).catch(reject);
}
fetchPart(0);
});
}
function getParts(file, start, end) {
let parts = [];
for (let i = start; i <= end; i++) {
parts.push(file + ".part" + i);
}
return parts;
}
Promise.all([
mergeFiles(getParts("https://cdn.jsdelivr.net/gh/gn-math/assets@51462750d29b68ac1e33887c1bf13d9c478d5ead/198/Build/WEB1.2.1.data.unityweb", 1, 2))
]).then(([dataUrl]) => {
let json = {
companyName: "Slope Plus",
productName: "Slope Plus",
dataUrl: dataUrl,
wasmCodeUrl: "https://cdn.jsdelivr.net/gh/gn-math/assets@51462750d29b68ac1e33887c1bf13d9c478d5ead/198/Build/WEB1.2.1.wasm.code.unityweb",
wasmFrameworkUrl: "https://cdn.jsdelivr.net/gh/gn-math/assets@51462750d29b68ac1e33887c1bf13d9c478d5ead/198/Build/WEB1.2.1.wasm.framework.unityweb",
TOTAL_MEMORY: 268435456,
graphicsAPI: ["WebGL 2.0", "WebGL 1.0"],
webglContextAttributes: {
preserveDrawingBuffer: false
},
splashScreenStyle: "Dark",
backgroundColor: "#000000"
}
let blob = new Blob([JSON.stringify(json)], {
type: 'application/json'
});
let blobUrl = URL.createObjectURL(blob);
UnityLoader.instantiate("gameContainer", json, {
onProgress: UnityProgress,
url: blobUrl
});
});
</script>
</head>
<body>
<div class="webgl-content">
<div id="gameContainer" style="width: 900px; height: 600px"></div>
</div>
</body>
</html>