Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
package-lock.json
README.md
.wrangler/
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
# 13hrsofstudying
# 13hrsofstudying
## Running it
```
npx wrangler dev
```
## Adding games
1. Put your games in a subfolder inside of `/public/g`
2. Open g.json in `/public/g.json`
3. Copy paste the format from another
4. Edit(Each game needs each thing filled out, game won't show up if no icon etc.)
316 changes: 316 additions & 0 deletions public/app.js

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions public/g.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"games": [
{
"name": "Something",
"filepath": "./g/something/index.html",
"icon": "./g/something/icon.png"
},
{
"name": "Karlson",
"filepath": "./g/karlson/index.html",
"icon": "./g/karlson/icon.png"
}
]
}
Binary file added public/g/karlson/Build/Karlson.data.unityweb
Binary file not shown.
15 changes: 15 additions & 0 deletions public/g/karlson/Build/Karlson.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"companyName": "Dani",
"productName": "Karlson",
"productVersion": "0.1",
"dataUrl": "Karlson.data.unityweb",
"wasmCodeUrl": "Karlson.wasm.code.unityweb",
"wasmFrameworkUrl": "Karlson.wasm.framework.unityweb",
"graphicsAPI": ["WebGL 2.0","WebGL 1.0"],
"webglContextAttributes": {"preserveDrawingBuffer": false},
"splashScreenStyle": "Dark",
"backgroundColor": "#000000",
"developmentBuild": false,
"multithreading": false,
"unityVersion": "2019.2.6f1"
}
Binary file added public/g/karlson/Build/Karlson.wasm.code.unityweb
Binary file not shown.
Binary file not shown.
4 changes: 4 additions & 0 deletions public/g/karlson/Build/UnityLoader.js

Large diffs are not rendered by default.

Binary file added public/g/karlson/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions public/g/karlson/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<!DOCTYPE html>
<html lang="en-us">
<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Unity WebGL Player | Karlson</title>
<script src="Build/UnityLoader.js"></script>
<script>
UnityLoader.instantiate("unityContainer", "Build/Karlson.json");
</script>
<style>
html, body {
margin: 0;
padding: 0;
height: 100%;
width: 100%;
background: #000;
overflow: hidden;
}

#unityContainer {
width: 100%;
height: 100%;
background: #000;
}
</style>
</head>
<body>
<div id="unityContainer"></div>
</body>
</html>
Binary file added public/g/something/Build/Something.data
Binary file not shown.
22 changes: 22 additions & 0 deletions public/g/something/Build/Something.framework.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions public/g/something/Build/Something.loader.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added public/g/something/Build/Something.wasm.part1
Binary file not shown.
Binary file added public/g/something/Build/Something.wasm.part2
Binary file not shown.
Binary file added public/g/something/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
145 changes: 145 additions & 0 deletions public/g/something/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
<!DOCTYPE html>
<html lang="en-us">

<head>
<base href="https://cdn.jsdelivr.net/gh/googoogoob/SomethingWebPort/">
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Unity WebGL Player | Something</title>
<style>
#loading-overlay {
position: fixed;
inset: 0;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: #0d0d0d;
z-index: 9999;
font-family: 'Verdana', monospace;
color: #e0e0e0;
gap: 18px;
transition: opacity 0.6s ease;
}

#loading-overlay.hidden {
opacity: 0;
pointer-events: none;
}

#loading-bar-track {
width: 280px;
height: 3px;
background: #222;
}

#loading-bar-fill {
height: 100%;
width: 0%;
background: #fff;
transition: width 0.3s;
}
</style>
</head>

<body style="text-align: center; padding: 0; border: 0; margin: 0;">
<div id="loading-overlay">
<div id="loading-title">Something</div>
<div id="loading-bar-track">
<div id="loading-bar-fill"></div>
</div>
<div id="loading-mb">Initializing…</div>
</div>
<canvas id="unity-canvas" width=960 height=600 tabindex="-1"
style="width: 100%; height: 100%; background: #CCCCCC"></canvas>
<script>
let totalDownloaded = 0;
const _nativeFetch = window.fetch.bind(window);

window.fetch = async function (input, init) {
const response = await _nativeFetch(input, init);
const url = typeof input === 'string' ? input : input.url;

if (/\.(data|wasm|js)(\.gz|\.br)?(\?|$)/i.test(url)) {
const cloned = response.clone();
const reader = cloned.body.getReader();
(async () => {
try {
while (true) {
const {done, value} = await reader.read();
if (done) break;
totalDownloaded += value.byteLength;
updateMbLabel();
}
} catch (_) { }
})();
}
return response;
};

function updateMbLabel() {
const mb = (totalDownloaded / (1024 * 1024)).toFixed(1);
document.getElementById('loading-mb').textContent = mb + ' MB downloaded';
}
</script>
<script src="Build/Something.loader.js"></script>
<script>
const overlay = document.getElementById('loading-overlay');
const overlayBar = document.getElementById('loading-bar-fill');

if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
var 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);
var canvas = document.querySelector("#unity-canvas");
canvas.style.width = "100%";
canvas.style.height = "100%";
canvas.style.position = "fixed";
document.body.style.textAlign = "left";
}

function mergeFiles(fileParts) {
return new Promise((resolve, reject) => {
let buffers = [];
function fetchPart(index) {
if (index >= fileParts.length) {
resolve(URL.createObjectURL(new Blob(buffers)));
return;
}
fetch(fileParts[index])
.then(r => r.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;
}

mergeFiles(getParts("Build/Something.wasm", 1, 2)).then((wasmUrl) => {
createUnityInstance(document.querySelector("#unity-canvas"), {
dataUrl: "Build/Something.data",
frameworkUrl: "Build/Something.framework.js",
codeUrl: wasmUrl,
streamingAssetsUrl: "StreamingAssets",
companyName: "Pixelatto_SirCheetoDust",
productName: "Something",
productVersion: "1.0",
}, (progress) => {
overlayBar.style.width = (progress * 100) + '%';
}).then(() => {
overlay.classList.add('hidden');
setTimeout(() => overlay.remove(), 700);
}).catch((message) => {alert(message);});
}).catch((message) => {alert(message);});
</script>
<div id="unity-loading-bar" style="display:none">…</div>
</body>

</html>
Loading