dylanebert HF staff commited on
Commit
f526bf0
·
1 Parent(s): 0e853b6
Files changed (4) hide show
  1. Build/Build.data +2 -2
  2. Build/Build.loader.js +1 -1
  3. Build/Build.wasm +2 -2
  4. index.html +75 -11
Build/Build.data CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f2849441613d40beb8575fd099287db185778798f0ff558346dda122355ab3a4
3
- size 15190460
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:404bcb3340e26d3a1c20e423a62f64000ad8985e8a5a1cd6f084804c5366148b
3
+ size 15191467
Build/Build.loader.js CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:80127c16a9052a5f0a630450368ed3396832591a7e95fcbc39d22f7fbd931bf1
3
  size 26416
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:97e57dc75c7230a1641c9aebe068a623819b5166a4ff0c3206f3359da25d34b7
3
  size 26416
Build/Build.wasm CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:7d3bb6a3f366f94d2877d8a99cbdfbd6e889c7f90d2529e898c7d15c5ce1a94a
3
- size 33434485
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:b96f139eefc9f41b4d4c2eb4aca9b1cdea5d91b8843158178b46ff92f39626f4
3
+ size 33435441
index.html CHANGED
@@ -28,7 +28,7 @@
28
  #loading-text {
29
  color: white;
30
  font-family: "Bebas Neue", Arial, sans-serif;
31
- font-size: 64px;
32
  position: absolute;
33
  top: 50%;
34
  left: 50%;
@@ -40,7 +40,7 @@
40
  }
41
  #loading-subtext {
42
  font-family: "Bebas Neue", Arial, sans-serif;
43
- font-size: 32px;
44
  position: absolute;
45
  top: 50%;
46
  left: 50%;
@@ -56,6 +56,37 @@
56
  .fade-out {
57
  opacity: 0;
58
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  </style>
60
  </head>
61
  <body class="dark">
@@ -66,6 +97,14 @@
66
  <div id="loading-text">Vibe Coding in the Dark</div>
67
  <div id="loading-subtext">by Dylan Ebert (IndividualKex)</div>
68
  </div>
 
 
 
 
 
 
 
 
69
  <div id="unity-fullscreen-button" style="display: none"></div>
70
  <a
71
  target="_blank"
@@ -106,6 +145,9 @@
106
  const canvas = document.querySelector("#unity-canvas");
107
  const loadingCover = document.querySelector("#loading-cover");
108
  const fullscreenButton = document.querySelector("#unity-fullscreen-button");
 
 
 
109
 
110
  const canFullscreen = (function() {
111
  for (const key of [
@@ -133,14 +175,16 @@
133
  let loadingStartTime = Date.now();
134
  let loadingFinished = false;
135
  let minTimeElapsed = false;
 
136
 
137
- // Function to check if we can hide the loading screen
138
- function tryHideLoadingScreen() {
139
  if (loadingFinished && minTimeElapsed) {
140
  loadingCover.classList.add('fade-out');
141
  setTimeout(() => {
142
  loadingCover.style.display = "none";
143
  loadingCover.classList.remove('fade-out');
 
144
  }, 1500); // Match the CSS transition time
145
  }
146
  }
@@ -148,17 +192,17 @@
148
  // Start the minimum display time timer
149
  setTimeout(() => {
150
  minTimeElapsed = true;
151
- tryHideLoadingScreen();
152
  }, minDisplayTime);
153
 
154
- const script = document.createElement("script");
155
- script.src = loaderUrl;
156
- script.onload = () => {
 
157
  createUnityInstance(canvas, config, (progress) => {
158
  // No progress visualization needed
159
- }).then((unityInstance) => {
160
- loadingFinished = true;
161
- tryHideLoadingScreen();
162
 
163
  if (canFullscreen) {
164
  if (!hideFullScreenButton) {
@@ -171,6 +215,26 @@
171
  }).catch((message) => {
172
  alert(message);
173
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
174
  };
175
  document.body.appendChild(script);
176
  </script>
 
28
  #loading-text {
29
  color: white;
30
  font-family: "Bebas Neue", Arial, sans-serif;
31
+ font-size: 40px;
32
  position: absolute;
33
  top: 50%;
34
  left: 50%;
 
40
  }
41
  #loading-subtext {
42
  font-family: "Bebas Neue", Arial, sans-serif;
43
+ font-size: 24px;
44
  position: absolute;
45
  top: 50%;
46
  left: 50%;
 
56
  .fade-out {
57
  opacity: 0;
58
  }
59
+
60
+ /* Start Game Button Styles */
61
+ #start-game-container {
62
+ position: fixed;
63
+ top: 0;
64
+ left: 0;
65
+ width: 100%;
66
+ height: 100%;
67
+ background-color: #000000;
68
+ display: none;
69
+ justify-content: center;
70
+ align-items: center;
71
+ z-index: 100;
72
+ }
73
+
74
+ #start-game-button {
75
+ font-family: "Bebas Neue", Arial, sans-serif;
76
+ font-size: 32px;
77
+ padding: 15px 40px;
78
+ color: white;
79
+ background-color: #333;
80
+ border: 2px solid white;
81
+ border-radius: 8px;
82
+ cursor: pointer;
83
+ transition: all 0.3s ease;
84
+ }
85
+
86
+ #start-game-button:hover {
87
+ background-color: #555;
88
+ transform: scale(1.05);
89
+ }
90
  </style>
91
  </head>
92
  <body class="dark">
 
97
  <div id="loading-text">Vibe Coding in the Dark</div>
98
  <div id="loading-subtext">by Dylan Ebert (IndividualKex)</div>
99
  </div>
100
+ <div id="start-game-container">
101
+ <button id="start-game-button">START GAME</button>
102
+ <audio
103
+ id="audio-element"
104
+ src="data:audio/mp3;base64,SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjU4Ljc2LjEwMAAAAAAAAAAAAAAA/+M4wAAAAAAAAAAAAEluZm8AAAAPAAAAAwAAAbsAVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVA=="
105
+ type="audio/mp3"
106
+ ></audio>
107
+ </div>
108
  <div id="unity-fullscreen-button" style="display: none"></div>
109
  <a
110
  target="_blank"
 
145
  const canvas = document.querySelector("#unity-canvas");
146
  const loadingCover = document.querySelector("#loading-cover");
147
  const fullscreenButton = document.querySelector("#unity-fullscreen-button");
148
+ const startGameContainer = document.querySelector("#start-game-container");
149
+ const startGameButton = document.querySelector("#start-game-button");
150
+ const audioElement = document.querySelector("#audio-element");
151
 
152
  const canFullscreen = (function() {
153
  for (const key of [
 
175
  let loadingStartTime = Date.now();
176
  let loadingFinished = false;
177
  let minTimeElapsed = false;
178
+ let unityInstance = null;
179
 
180
+ // Function to check if we can show the start button
181
+ function tryShowStartButton() {
182
  if (loadingFinished && minTimeElapsed) {
183
  loadingCover.classList.add('fade-out');
184
  setTimeout(() => {
185
  loadingCover.style.display = "none";
186
  loadingCover.classList.remove('fade-out');
187
+ startGameContainer.style.display = "flex";
188
  }, 1500); // Match the CSS transition time
189
  }
190
  }
 
192
  // Start the minimum display time timer
193
  setTimeout(() => {
194
  minTimeElapsed = true;
195
+ tryShowStartButton();
196
  }, minDisplayTime);
197
 
198
+ // Initialize Unity
199
+ function initUnity() {
200
+ if (unityInstance) return; // Prevent multiple initializations
201
+
202
  createUnityInstance(canvas, config, (progress) => {
203
  // No progress visualization needed
204
+ }).then((instance) => {
205
+ unityInstance = instance;
 
206
 
207
  if (canFullscreen) {
208
  if (!hideFullScreenButton) {
 
215
  }).catch((message) => {
216
  alert(message);
217
  });
218
+ }
219
+
220
+ // Start button click handler
221
+ startGameButton.addEventListener('click', () => {
222
+ // Play silent audio to unlock audio on Safari
223
+ audioElement.play().catch(error => console.log("Audio play failed:", error));
224
+
225
+ // Hide start button container
226
+ startGameContainer.style.display = "none";
227
+
228
+ // Initialize Unity if not already done
229
+ initUnity();
230
+ });
231
+
232
+ const script = document.createElement("script");
233
+ script.src = loaderUrl;
234
+ script.onload = () => {
235
+ // Signal that loading is finished
236
+ loadingFinished = true;
237
+ tryShowStartButton();
238
  };
239
  document.body.appendChild(script);
240
  </script>