-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathhappywheels.xml
120 lines (115 loc) · 3.07 KB
/
happywheels.xml
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<Module>
<ModulePrefs title=""/>
<Content type="html">
<![CDATA[
<style>
html {
box-sizing: border-box;
}
*, *:before, *:after {
box-sizing: inherit;
}
body {
margin: 0;
background: #444;
}
#gameContainer {
width: 100vw;
height: 100vh;
}
canvas {
width: 100%;
height: 100%;
display: block;
}
/* try to handle mobile dialog */
canvas + * {
z-index: 2;
}
.logo {
display: block;
max-width: 100vw;
max-height: 70vh;
}
.progress {
margin: 1.5em;
border: 1px solid white;
width: 50vw;
display: none;
}
.progress .full {
margin: 2px;
background: white;
height: 1em;
transform-origin: top left;
}
#loader {
position: absolute;
left: 0;
top: 0;
width: 100vw;
height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background-color:black;
}
.spinner,
.spinner:after {
border-radius: 50%;
width: 5em;
height: 5em;
}
.spinner {
margin: 10px;
font-size: 10px;
position: relative;
text-indent: -9999em;
border-top: 1.1em solid rgba(255, 255, 255, 0.2);
border-right: 1.1em solid rgba(255, 255, 255, 0.2);
border-bottom: 1.1em solid rgba(255, 255, 255, 0.2);
border-left: 1.1em solid #ffffff;
transform: translateZ(0);
animation: spinner-spin 1.1s infinite linear;
}
@keyframes spinner-spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
</style>
<div id="gameContainer"></div>
<div id="loader">
<img class="logo" src="https://87a9e3ea-a44d-4e23-8636-92b93e95d95b.id.repl.co/loading.png?v=1">
<div class="spinner"></div>
<div class="progress"><div class="full"></div></div>
</div>
<script src="https://87a9e3ea-a44d-4e23-8636-92b93e95d95b.id.repl.co/Build/UnityLoader.js"></script>
<script>
var gameInstance = UnityLoader.instantiate("gameContainer", "https://87a9e3ea-a44d-4e23-8636-92b93e95d95b.id.repl.co/Build/HappyWheels.json", {onProgress: UnityProgress});
function UnityProgress(gameInstance, progress) {
if (!gameInstance.Module) {
return;
}
const loader = document.querySelector("#loader");
if (!gameInstance.progress) {
const progress = document.querySelector("#loader .progress");
progress.style.display = "block";
gameInstance.progress = progress.querySelector(".full");
loader.querySelector(".spinner").style.display = "none";
}
gameInstance.progress.style.transform = `scaleX(${progress})`;
if (progress === 1 && !gameInstance.removeTimeout) {
gameInstance.removeTimeout = setTimeout(function() {
loader.style.display = "none";
}, 2000);
}
}
</script>
]]>
</Content>
</Module>