anan66 commited on
Commit
173b08a
·
1 Parent(s): 3527080

upload house game

Browse files
Files changed (1) hide show
  1. house/TowerBlocksGame.html +383 -383
house/TowerBlocksGame.html CHANGED
@@ -1,386 +1,386 @@
1
- <!DOCTYPE html>
2
- <html xmlns='http://www.w3.org/1999/xhtml' lang='' xml:lang=''>
3
- <head>
4
- <meta charset='utf-8' />
5
- <meta name='viewport' content='width=device-width, user-scalable=no' />
6
- <title>TowerBlocks</title>
7
- <style type='text/css'>
8
-
9
- body {
10
- touch-action: none;
11
- margin: 0;
12
- border: 0 none;
13
- padding: 0;
14
- text-align: center;
15
- background-color: black;
16
- }
17
-
18
- #progress-container {
19
- display: flex;
20
- flex-direction: column;
21
- align-items: center;
22
- justify-content: center;
23
- height: 100vh; /* 垂直居中整个页面高度 */
24
- }
25
-
26
- #custom-loader {
27
- position: absolute;
28
- top: 0;
29
- left: 0;
30
- right: 0;
31
- bottom: 0;
32
- display: flex;
33
- flex-direction: column;
34
- justify-content: center;
35
- align-items: center;
36
- }
37
-
38
- #logo {
39
- width: 400px;
40
- max-width: 80vw;
41
- margin-bottom: 250px;
42
- }
43
-
44
- #bottom-text {
45
- position: absolute;
46
- bottom: 20px;
47
- font-size: 14px;
48
- width: 90%;
49
- color: white;
50
- }
51
-
52
- #canvas {
53
- display: block;
54
- margin: 0;
55
- color: white;
56
- }
57
-
58
- #canvas:focus {
59
- outline: none;
60
- }
61
-
62
- .godot {
63
- font-family: 'Noto Sans', 'Droid Sans', Arial, sans-serif;
64
- color: #e0e0e0;
65
- background-color: #3b3943;
66
- background-image: linear-gradient(to bottom, #403e48, #35333c);
67
- border: 1px solid #45434e;
68
- box-shadow: 0 0 1px 1px #2f2d35;
69
- }
70
-
71
-
72
- /* Status display
73
- * ============== */
74
-
75
- #status {
76
- position: absolute;
77
- left: 0;
78
- top: 0;
79
- right: 0;
80
- bottom: 0;
81
- display: flex;
82
- justify-content: center;
83
- align-items: center;
84
- /* don't consume click events - make children visible explicitly */
85
- visibility: hidden;
86
- }
87
-
88
- @keyframes breathing {
89
- 0% { opacity: 0.5; }
90
- 50% { opacity: 1; }
91
- 100% { opacity: 0.5; }
92
- }
93
-
94
- /* 外层背景(加载图) */
95
- #status-progress {
96
- width: 512px;
97
- height: 512px;
98
- background-image: url('loadback.png');
99
- background-size: contain;
100
- background-repeat: no-repeat;
101
- background-position: center;
102
- position: absolute;
103
- top: 50%;
104
- left: 50%;
105
- transform: translate(-50%, -50%);
106
- visibility: visible;
107
- }
108
-
109
- /* 前景进度图 */
110
- #status-progress-inner {
111
- width: 100%;
112
- height: 100%;
113
- background-image: url('loadfront.png');
114
- background-size: contain;
115
- background-repeat: no-repeat;
116
- background-position: center;
117
- position: absolute;
118
- top: 0;
119
- left: 0;
120
- clip-path: inset(0 100% 0 0); /* 动态控制这里 */
121
- <!-- transition: clip-path 0.3s ease-out; -->
122
- visibility: visible;
123
- pointer-events: none;
124
- }
125
-
126
- /* 百分比文字 */
127
- #progress-percent {
128
- position: absolute;
129
- top: 55%; /* ✅ 在进度条底下 */
130
- left: 50%;
131
- transform: translate(-50%, 10px); /* ✅ 微调垂直距离 */
132
- color: orange;
133
- font-weight: bold;
134
- font-size: 20px;
135
- text-shadow: 1px 1px 2px #000;
136
- z-index: 2;
137
- pointer-events: none;
138
- }
139
-
140
- #status-indeterminate {
141
- height: 42px;
142
- visibility: visible;
143
- position: relative;
144
- }
145
-
146
- #status-indeterminate > div {
147
- width: 4.5px;
148
- height: 0;
149
- border-style: solid;
150
- border-width: 9px 3px 0 3px;
151
- border-color: #2b2b2b transparent transparent transparent;
152
- transform-origin: center 21px;
153
- position: absolute;
154
- }
155
-
156
- #status-indeterminate > div:nth-child(1) { transform: rotate( 22.5deg); }
157
- #status-indeterminate > div:nth-child(2) { transform: rotate( 67.5deg); }
158
- #status-indeterminate > div:nth-child(3) { transform: rotate(112.5deg); }
159
- #status-indeterminate > div:nth-child(4) { transform: rotate(157.5deg); }
160
- #status-indeterminate > div:nth-child(5) { transform: rotate(202.5deg); }
161
- #status-indeterminate > div:nth-child(6) { transform: rotate(247.5deg); }
162
- #status-indeterminate > div:nth-child(7) { transform: rotate(292.5deg); }
163
- #status-indeterminate > div:nth-child(8) { transform: rotate(337.5deg); }
164
-
165
- #status-notice {
166
- margin: 0 100px;
167
- line-height: 1.3;
168
- visibility: visible;
169
- padding: 4px 6px;
170
- visibility: visible;
171
- }
172
-
173
- /* 手机适配 */
174
- @media only screen and (orientation: portrait) {
175
- #status-progress {
176
- width: 61.8vw;
177
- height: 61.8vw;
178
- }
179
- #logo {
180
- width: 200px;
181
- margin-bottom: 150px;
182
- }
183
- }
184
-
185
- </style>
186
  <link id='-gd-engine-icon' rel='icon' type='image/png' href='TowerBlocksGame.icon.png' />
187
  <link rel='apple-touch-icon' href='TowerBlocksGame.apple-touch-icon.png'/>
188
-
189
- <link rel='apple-touch-icon' href='TowerBlocks.apple-touch-icon.png'/>
190
- <script type="text/javascript" src="./uni.webview.1.5.5.js"></script>
191
- <script type="text/javascript" src="./anan.tool.js"></script>
192
- <script type="text/javascript" src="./gameapp.js"></script>
193
- </head>
194
- <body>
195
- <canvas id='canvas'>
196
- HTML5 canvas appears to be unsupported in the current browser.<br />
197
- Please try updating or use a different browser.
198
- </canvas>
199
- <div id="custom-loader">
200
- <div id="progress-container">
201
- <img id="logo" src="Logo.png" alt="Loading Logo"/>
202
- <div id='status-progress'>
203
- <div id ='status-progress-inner'></div>
204
- </div>
205
- <div id="progress-percent">0%</div>
206
- </div>
207
- <div id="bottom-text">Set your favorite music as the background music for your work,<br>so that you can share it with others.</div>
208
- </div>
209
- <div id='status'>
210
- <div id='status-indeterminate' style='display: none;' oncontextmenu='event.preventDefault();'>
211
- <div></div>
212
- <div></div>
213
- <div></div>
214
- <div></div>
215
- <div></div>
216
- <div></div>
217
- <div></div>
218
- <div></div>
219
- </div>
220
- <div id='status-notice' class='godot' style='display: none;'></div>
221
- </div>
222
-
223
- <!-- // 文字轮播效果 -->
224
- <script type='text/javascript'>
225
- const textElement = document.getElementById("bottom-text");
226
- let currentIndex = 0;
227
- let textList = [];
228
-
229
- // 从文件读取内容
230
- fetch("./HintText.json")
231
- .then(response => response.json())
232
- .then(data => {
233
- textList = data;
234
- if (textList.length > 0) {
235
- updateText(); // 初始显示
236
- setInterval(updateText, 5000); // 每 5 秒切换一次
237
- }
238
- })
239
- .catch(error => {
240
- console.error("加载消息列表失败:", error);
241
- });
242
- function updateText() {
243
- textElement.innerText = textList[currentIndex];
244
- currentIndex = (currentIndex + 1) % textList.length;
245
- }
246
- </script>
247
-
248
- <script type='text/javascript' src='TowerBlocks.js'></script>
249
- <script type='text/javascript'>//<![CDATA[
250
- const GODOT_CONFIG = {"args":[],"canvasResizePolicy":0,"executable":"TowerBlocks","experimentalVK":false,"fileSizes":{"TowerBlocks.pck":56207824,"TowerBlocks.wasm":25658069},"focusCanvas":true,"gdnativeLibs":[]};
251
- var engine = new Engine(GODOT_CONFIG);
252
-
253
- (function() {
254
- const INDETERMINATE_STATUS_STEP_MS = 100;
255
- var logo = document.getElementById('logo');
256
- var statusProgress = document.getElementById('status-progress');
257
- var statusProgressInner = document.getElementById('status-progress-inner');
258
- var statusIndeterminate = document.getElementById('status-indeterminate');
259
- var statusNotice = document.getElementById('status-notice');
260
-
261
- var initializing = true;
262
- var statusMode = 'hidden';
263
-
264
- var animationCallbacks = [];
265
-
266
- const textElement = document.getElementById("bottom-text");
267
- let currentIndex = 0;
268
- let textList = [];
269
-
270
- //定义给 Godot 调用的函数
271
- window.godotFinishedLoading = function () {
272
- console.log('Godot 内部加载完成!');
273
- document.getElementById('status-progress-inner').style.clipPath = `inset(0 0% 0 0)`; // 100%
274
- setTimeout(() => {
275
- <!-- setStatusMode('hidden'); -->
276
- document.getElementById("custom-loader").style.display = "none";
277
- setStatusMode('hidden');
278
- initializing = false;
279
- }, 500); // 延迟一点
280
- };
281
-
282
- function animate(time) {
283
- animationCallbacks.forEach(callback => callback(time));
284
- requestAnimationFrame(animate);
285
- }
286
- requestAnimationFrame(animate);
287
-
288
- function setStatusMode(mode) {
289
-
290
- if (statusMode === mode || !initializing)
291
- return;
292
- [statusProgress, statusIndeterminate, statusNotice].forEach(elem => {
293
- elem.style.display = 'none';
294
- });
295
- animationCallbacks = animationCallbacks.filter(function(value) {
296
- return (value != animateStatusIndeterminate);
297
- });
298
- switch (mode) {
299
- case 'progress':
300
- statusProgress.style.display = 'block';
301
- logo.style.display = 'block';
302
- break;
303
- case 'indeterminate':
304
- statusIndeterminate.style.display = 'block';
305
- logo.style.display = 'block';
306
- animationCallbacks.push(animateStatusIndeterminate);
307
- break;
308
- case 'notice':
309
- statusNotice.style.display = 'block';
310
- logo.style.display = 'block';
311
- break;
312
- case 'hidden':
313
- if (logo) logo.style.display = 'none';
314
- break;
315
- default:
316
- throw new Error('Invalid status mode');
317
- }
318
- statusMode = mode;
319
- }
320
-
321
- function animateStatusIndeterminate(ms) {
322
- var i = Math.floor(ms / INDETERMINATE_STATUS_STEP_MS % 8);
323
- if (statusIndeterminate.children[i].style.borderTopColor == '') {
324
- Array.prototype.slice.call(statusIndeterminate.children).forEach(child => {
325
- child.style.borderTopColor = '';
326
- });
327
- statusIndeterminate.children[i].style.borderTopColor = '#dfdfdf';
328
- }
329
- }
330
-
331
- function setStatusNotice(text) {
332
- while (statusNotice.lastChild) {
333
- statusNotice.removeChild(statusNotice.lastChild);
334
- }
335
- var lines = text.split('\n');
336
- lines.forEach((line) => {
337
- statusNotice.appendChild(document.createTextNode(line));
338
- statusNotice.appendChild(document.createElement('br'));
339
- });
340
- };
341
-
342
- function displayFailureNotice(err) {
343
- var msg = err.message || err;
344
- console.error(msg);
345
- setStatusNotice(msg);
346
- setStatusMode('notice');
347
- initializing = false;
348
- };
349
-
350
- if (!Engine.isWebGLAvailable()) {
351
- displayFailureNotice('WebGL not available');
352
- } else {
353
- setStatusMode('indeterminate');
354
- engine.startGame({
355
- 'onProgress': function (current, total) {
356
- if (total > 0) {
357
- let progress = Math.min((current / total) * 100, 90); //进度条卡在90 等待游戏内加载
358
- progress = Math.floor(progress);
359
- document.getElementById("progress-percent").innerText = `${progress}%`;
360
- statusProgressInner.style.clipPath = `inset(0 ${100 - progress}% 0 0)`;
361
- setStatusMode('progress');
362
- if (current === total) {
363
- // wait for progress bar animation
364
- setTimeout(() => {
365
- setStatusMode('indeterminate');
366
- }, 500);
367
- }
368
- } else {
369
- setStatusMode('indeterminate');
370
- }
371
- },
372
- }).then(() => {
373
- // 不隐藏, 等待游戏通知
374
- console.log('Godot 引擎已启动, 等待游戏内资源加载完成...');
375
- //setStatusMode('hidden');
376
- //initializing = false;
377
- }, displayFailureNotice);
378
-
379
- }
380
- })();
381
- //]]></script>
382
- </body>
383
- </html>
384
-
385
-
386
 
 
1
+ <!DOCTYPE html>
2
+ <html xmlns='http://www.w3.org/1999/xhtml' lang='' xml:lang=''>
3
+ <head>
4
+ <meta charset='utf-8' />
5
+ <meta name='viewport' content='width=device-width, user-scalable=no' />
6
+ <title>TowerBlocksGame</title>
7
+ <style type='text/css'>
8
+
9
+ body {
10
+ touch-action: none;
11
+ margin: 0;
12
+ border: 0 none;
13
+ padding: 0;
14
+ text-align: center;
15
+ background-color: black;
16
+ }
17
+
18
+ #progress-container {
19
+ display: flex;
20
+ flex-direction: column;
21
+ align-items: center;
22
+ justify-content: center;
23
+ height: 100vh; /* 垂直居中整个页面高度 */
24
+ }
25
+
26
+ #custom-loader {
27
+ position: absolute;
28
+ top: 0;
29
+ left: 0;
30
+ right: 0;
31
+ bottom: 0;
32
+ display: flex;
33
+ flex-direction: column;
34
+ justify-content: center;
35
+ align-items: center;
36
+ }
37
+
38
+ #logo {
39
+ width: 400px;
40
+ max-width: 80vw;
41
+ margin-bottom: 250px;
42
+ }
43
+
44
+ #bottom-text {
45
+ position: absolute;
46
+ bottom: 20px;
47
+ font-size: 14px;
48
+ width: 90%;
49
+ color: white;
50
+ }
51
+
52
+ #canvas {
53
+ display: block;
54
+ margin: 0;
55
+ color: white;
56
+ }
57
+
58
+ #canvas:focus {
59
+ outline: none;
60
+ }
61
+
62
+ .godot {
63
+ font-family: 'Noto Sans', 'Droid Sans', Arial, sans-serif;
64
+ color: #e0e0e0;
65
+ background-color: #3b3943;
66
+ background-image: linear-gradient(to bottom, #403e48, #35333c);
67
+ border: 1px solid #45434e;
68
+ box-shadow: 0 0 1px 1px #2f2d35;
69
+ }
70
+
71
+
72
+ /* Status display
73
+ * ============== */
74
+
75
+ #status {
76
+ position: absolute;
77
+ left: 0;
78
+ top: 0;
79
+ right: 0;
80
+ bottom: 0;
81
+ display: flex;
82
+ justify-content: center;
83
+ align-items: center;
84
+ /* don't consume click events - make children visible explicitly */
85
+ visibility: hidden;
86
+ }
87
+
88
+ @keyframes breathing {
89
+ 0% { opacity: 0.5; }
90
+ 50% { opacity: 1; }
91
+ 100% { opacity: 0.5; }
92
+ }
93
+
94
+ /* 外层背景(加载图) */
95
+ #status-progress {
96
+ width: 512px;
97
+ height: 512px;
98
+ background-image: url('loadback.png');
99
+ background-size: contain;
100
+ background-repeat: no-repeat;
101
+ background-position: center;
102
+ position: absolute;
103
+ top: 50%;
104
+ left: 50%;
105
+ transform: translate(-50%, -50%);
106
+ visibility: visible;
107
+ }
108
+
109
+ /* 前景进度图 */
110
+ #status-progress-inner {
111
+ width: 100%;
112
+ height: 100%;
113
+ background-image: url('loadfront.png');
114
+ background-size: contain;
115
+ background-repeat: no-repeat;
116
+ background-position: center;
117
+ position: absolute;
118
+ top: 0;
119
+ left: 0;
120
+ clip-path: inset(0 100% 0 0); /* 动态控制这里 */
121
+ <!-- transition: clip-path 0.3s ease-out; -->
122
+ visibility: visible;
123
+ pointer-events: none;
124
+ }
125
+
126
+ /* 百分比文字 */
127
+ #progress-percent {
128
+ position: absolute;
129
+ top: 55%; /* ✅ 在进度条底下 */
130
+ left: 50%;
131
+ transform: translate(-50%, 10px); /* ✅ 微调垂直距离 */
132
+ color: orange;
133
+ font-weight: bold;
134
+ font-size: 20px;
135
+ text-shadow: 1px 1px 2px #000;
136
+ z-index: 2;
137
+ pointer-events: none;
138
+ }
139
+
140
+ #status-indeterminate {
141
+ height: 42px;
142
+ visibility: visible;
143
+ position: relative;
144
+ }
145
+
146
+ #status-indeterminate > div {
147
+ width: 4.5px;
148
+ height: 0;
149
+ border-style: solid;
150
+ border-width: 9px 3px 0 3px;
151
+ border-color: #2b2b2b transparent transparent transparent;
152
+ transform-origin: center 21px;
153
+ position: absolute;
154
+ }
155
+
156
+ #status-indeterminate > div:nth-child(1) { transform: rotate( 22.5deg); }
157
+ #status-indeterminate > div:nth-child(2) { transform: rotate( 67.5deg); }
158
+ #status-indeterminate > div:nth-child(3) { transform: rotate(112.5deg); }
159
+ #status-indeterminate > div:nth-child(4) { transform: rotate(157.5deg); }
160
+ #status-indeterminate > div:nth-child(5) { transform: rotate(202.5deg); }
161
+ #status-indeterminate > div:nth-child(6) { transform: rotate(247.5deg); }
162
+ #status-indeterminate > div:nth-child(7) { transform: rotate(292.5deg); }
163
+ #status-indeterminate > div:nth-child(8) { transform: rotate(337.5deg); }
164
+
165
+ #status-notice {
166
+ margin: 0 100px;
167
+ line-height: 1.3;
168
+ visibility: visible;
169
+ padding: 4px 6px;
170
+ visibility: visible;
171
+ }
172
+
173
+ /* 手机适配 */
174
+ @media only screen and (orientation: portrait) {
175
+ #status-progress {
176
+ width: 61.8vw;
177
+ height: 61.8vw;
178
+ }
179
+ #logo {
180
+ width: 200px;
181
+ margin-bottom: 150px;
182
+ }
183
+ }
184
+
185
+ </style>
186
  <link id='-gd-engine-icon' rel='icon' type='image/png' href='TowerBlocksGame.icon.png' />
187
  <link rel='apple-touch-icon' href='TowerBlocksGame.apple-touch-icon.png'/>
188
+
189
+ <link rel='apple-touch-icon' href='TowerBlocksGame.apple-touch-icon.png'/>
190
+ <script type="text/javascript" src="./uni.webview.1.5.5.js"></script>
191
+ <script type="text/javascript" src="./anan.tool.js"></script>
192
+ <script type="text/javascript" src="./gameapp.js"></script>
193
+ </head>
194
+ <body>
195
+ <canvas id='canvas'>
196
+ HTML5 canvas appears to be unsupported in the current browser.<br />
197
+ Please try updating or use a different browser.
198
+ </canvas>
199
+ <div id="custom-loader">
200
+ <div id="progress-container">
201
+ <img id="logo" src="Logo.png" alt="Loading Logo"/>
202
+ <div id='status-progress'>
203
+ <div id ='status-progress-inner'></div>
204
+ </div>
205
+ <div id="progress-percent">0%</div>
206
+ </div>
207
+ <div id="bottom-text">Set your favorite music as the background music for your work,<br>so that you can share it with others.</div>
208
+ </div>
209
+ <div id='status'>
210
+ <div id='status-indeterminate' style='display: none;' oncontextmenu='event.preventDefault();'>
211
+ <div></div>
212
+ <div></div>
213
+ <div></div>
214
+ <div></div>
215
+ <div></div>
216
+ <div></div>
217
+ <div></div>
218
+ <div></div>
219
+ </div>
220
+ <div id='status-notice' class='godot' style='display: none;'></div>
221
+ </div>
222
+
223
+ <!-- // 文字轮播效果 -->
224
+ <script type='text/javascript'>
225
+ const textElement = document.getElementById("bottom-text");
226
+ let currentIndex = 0;
227
+ let textList = [];
228
+
229
+ // 从文件读取内容
230
+ fetch("./HintText.json")
231
+ .then(response => response.json())
232
+ .then(data => {
233
+ textList = data;
234
+ if (textList.length > 0) {
235
+ updateText(); // 初始显示
236
+ setInterval(updateText, 5000); // 每 5 秒切换一次
237
+ }
238
+ })
239
+ .catch(error => {
240
+ console.error("加载消息列表失败:", error);
241
+ });
242
+ function updateText() {
243
+ textElement.innerText = textList[currentIndex];
244
+ currentIndex = (currentIndex + 1) % textList.length;
245
+ }
246
+ </script>
247
+
248
+ <script type='text/javascript' src='TowerBlocksGame.js'></script>
249
+ <script type='text/javascript'>//<![CDATA[
250
+ const GODOT_CONFIG = {"args":[],"canvasResizePolicy":0,"executable":"TowerBlocksGame","experimentalVK":false,"fileSizes":{"TowerBlocksGame.pck":56207824,"TowerBlocksGame.wasm":25658069},"focusCanvas":true,"gdnativeLibs":[]};
251
+ var engine = new Engine(GODOT_CONFIG);
252
+
253
+ (function() {
254
+ const INDETERMINATE_STATUS_STEP_MS = 100;
255
+ var logo = document.getElementById('logo');
256
+ var statusProgress = document.getElementById('status-progress');
257
+ var statusProgressInner = document.getElementById('status-progress-inner');
258
+ var statusIndeterminate = document.getElementById('status-indeterminate');
259
+ var statusNotice = document.getElementById('status-notice');
260
+
261
+ var initializing = true;
262
+ var statusMode = 'hidden';
263
+
264
+ var animationCallbacks = [];
265
+
266
+ const textElement = document.getElementById("bottom-text");
267
+ let currentIndex = 0;
268
+ let textList = [];
269
+
270
+ //定义给 Godot 调用的函数
271
+ window.godotFinishedLoading = function () {
272
+ console.log('Godot 内部加载完成!');
273
+ document.getElementById('status-progress-inner').style.clipPath = `inset(0 0% 0 0)`; // 100%
274
+ setTimeout(() => {
275
+ <!-- setStatusMode('hidden'); -->
276
+ document.getElementById("custom-loader").style.display = "none";
277
+ setStatusMode('hidden');
278
+ initializing = false;
279
+ }, 500); // 延迟一点
280
+ };
281
+
282
+ function animate(time) {
283
+ animationCallbacks.forEach(callback => callback(time));
284
+ requestAnimationFrame(animate);
285
+ }
286
+ requestAnimationFrame(animate);
287
+
288
+ function setStatusMode(mode) {
289
+
290
+ if (statusMode === mode || !initializing)
291
+ return;
292
+ [statusProgress, statusIndeterminate, statusNotice].forEach(elem => {
293
+ elem.style.display = 'none';
294
+ });
295
+ animationCallbacks = animationCallbacks.filter(function(value) {
296
+ return (value != animateStatusIndeterminate);
297
+ });
298
+ switch (mode) {
299
+ case 'progress':
300
+ statusProgress.style.display = 'block';
301
+ logo.style.display = 'block';
302
+ break;
303
+ case 'indeterminate':
304
+ statusIndeterminate.style.display = 'block';
305
+ logo.style.display = 'block';
306
+ animationCallbacks.push(animateStatusIndeterminate);
307
+ break;
308
+ case 'notice':
309
+ statusNotice.style.display = 'block';
310
+ logo.style.display = 'block';
311
+ break;
312
+ case 'hidden':
313
+ if (logo) logo.style.display = 'none';
314
+ break;
315
+ default:
316
+ throw new Error('Invalid status mode');
317
+ }
318
+ statusMode = mode;
319
+ }
320
+
321
+ function animateStatusIndeterminate(ms) {
322
+ var i = Math.floor(ms / INDETERMINATE_STATUS_STEP_MS % 8);
323
+ if (statusIndeterminate.children[i].style.borderTopColor == '') {
324
+ Array.prototype.slice.call(statusIndeterminate.children).forEach(child => {
325
+ child.style.borderTopColor = '';
326
+ });
327
+ statusIndeterminate.children[i].style.borderTopColor = '#dfdfdf';
328
+ }
329
+ }
330
+
331
+ function setStatusNotice(text) {
332
+ while (statusNotice.lastChild) {
333
+ statusNotice.removeChild(statusNotice.lastChild);
334
+ }
335
+ var lines = text.split('\n');
336
+ lines.forEach((line) => {
337
+ statusNotice.appendChild(document.createTextNode(line));
338
+ statusNotice.appendChild(document.createElement('br'));
339
+ });
340
+ };
341
+
342
+ function displayFailureNotice(err) {
343
+ var msg = err.message || err;
344
+ console.error(msg);
345
+ setStatusNotice(msg);
346
+ setStatusMode('notice');
347
+ initializing = false;
348
+ };
349
+
350
+ if (!Engine.isWebGLAvailable()) {
351
+ displayFailureNotice('WebGL not available');
352
+ } else {
353
+ setStatusMode('indeterminate');
354
+ engine.startGame({
355
+ 'onProgress': function (current, total) {
356
+ if (total > 0) {
357
+ let progress = Math.min((current / total) * 100, 90); //进度条卡在90 等待游戏内加载
358
+ progress = Math.floor(progress);
359
+ document.getElementById("progress-percent").innerText = `${progress}%`;
360
+ statusProgressInner.style.clipPath = `inset(0 ${100 - progress}% 0 0)`;
361
+ setStatusMode('progress');
362
+ if (current === total) {
363
+ // wait for progress bar animation
364
+ setTimeout(() => {
365
+ setStatusMode('indeterminate');
366
+ }, 500);
367
+ }
368
+ } else {
369
+ setStatusMode('indeterminate');
370
+ }
371
+ },
372
+ }).then(() => {
373
+ // 不隐藏, 等待游戏通知
374
+ console.log('Godot 引擎已启动, 等待游戏内资源加载完成...');
375
+ //setStatusMode('hidden');
376
+ //initializing = false;
377
+ }, displayFailureNotice);
378
+
379
+ }
380
+ })();
381
+ //]]></script>
382
+ </body>
383
+ </html>
384
+
385
+
386