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

upload house game

Browse files
.gitattributes CHANGED
@@ -41,3 +41,4 @@ house/MatchNGame.pck filter=lfs diff=lfs merge=lfs -text
41
  matchn/Logo.png filter=lfs diff=lfs merge=lfs -text
42
  snake/Logo.png filter=lfs diff=lfs merge=lfs -text
43
  watermelon/Logo.png filter=lfs diff=lfs merge=lfs -text
 
 
41
  matchn/Logo.png filter=lfs diff=lfs merge=lfs -text
42
  snake/Logo.png filter=lfs diff=lfs merge=lfs -text
43
  watermelon/Logo.png filter=lfs diff=lfs merge=lfs -text
44
+ house/Logo.png filter=lfs diff=lfs merge=lfs -text
house/HintText.json ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ [
2
+ "Don't forget to give a like to the game you think is fun!",
3
+ "Pay attention to the creators you like, and they will remind you of their new works as soon as possible!",
4
+ "Set your favorite music as the background music for your work, so that you can share it with others.",
5
+ "Failed the game? The best solution is to play another round.",
6
+ "Remember to talk more with your little pet!"
7
+ ]
house/Logo.png ADDED

Git LFS Details

  • SHA256: 4812724f669394b9e0c9a18044cfeca74c890b4653fcdb29fb3a1800f122ddb5
  • Pointer size: 131 Bytes
  • Size of remote file: 119 kB
house/TowerBlocksGame.html CHANGED
@@ -14,6 +14,40 @@
14
  text-align: center;
15
  background-color: black;
16
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
  #canvas {
19
  display: block;
@@ -51,32 +85,56 @@
51
  visibility: hidden;
52
  }
53
 
54
- #status-progress {
55
- width: 366px;
56
- height: 7px;
57
- background-color: #38363A;
58
- border: 1px solid #444246;
59
- padding: 1px;
60
- box-shadow: 0 0 2px 1px #1B1C22;
61
- border-radius: 2px;
62
- visibility: visible;
63
  }
64
 
65
- @media only screen and (orientation:portrait) {
66
- #status-progress {
67
- width: 61.8%;
68
- }
 
 
 
 
 
 
 
 
 
69
  }
70
 
 
71
  #status-progress-inner {
 
72
  height: 100%;
73
- width: 0;
74
- box-sizing: border-box;
75
- transition: width 0.5s linear;
76
- background-color: #202020;
77
- border: 1px solid #222223;
78
- box-shadow: 0 0 1px 1px #27282E;
79
- border-radius: 3px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
  }
81
 
82
  #status-indeterminate {
@@ -111,141 +169,218 @@
111
  padding: 4px 6px;
112
  visibility: visible;
113
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  </style>
115
- <link id='-gd-engine-icon' rel='icon' type='image/png' href='TowerBlocksGame.icon.png' />
116
  <link rel='apple-touch-icon' href='TowerBlocksGame.apple-touch-icon.png'/>
117
 
118
- <script type="text/javascript" src="./uni.webview.1.5.5.js"></script>
119
- <script type="text/javascript" src="./anan.tool.js"></script>
120
- <script type="text/javascript" src="./gameapp.js"></script>
 
121
  </head>
122
  <body>
123
- <canvas id='canvas'>
124
- HTML5 canvas appears to be unsupported in the current browser.<br />
125
- Please try updating or use a different browser.
126
- </canvas>
127
- <div id='status'>
128
- <div id='status-progress' style='display: none;' oncontextmenu='event.preventDefault();'><div id ='status-progress-inner'></div></div>
129
- <div id='status-indeterminate' style='display: none;' oncontextmenu='event.preventDefault();'>
130
- <div></div>
131
- <div></div>
132
- <div></div>
133
- <div></div>
134
- <div></div>
135
- <div></div>
136
- <div></div>
137
- <div></div>
138
  </div>
139
- <div id='status-notice' class='godot' style='display: none;'></div>
140
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
 
142
- <script type='text/javascript' src='TowerBlocksGame.js'></script>
143
- <script type='text/javascript'>//<![CDATA[
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
144
 
145
- const GODOT_CONFIG = {"args":[],"canvasResizePolicy":0,"executable":"TowerBlocksGame","experimentalVK":false,"fileSizes":{"TowerBlocksGame.pck":60549072,"TowerBlocksGame.wasm":19761972},"focusCanvas":true,"gdnativeLibs":[]};
146
- var engine = new Engine(GODOT_CONFIG);
 
 
147
 
148
- (function() {
149
- const INDETERMINATE_STATUS_STEP_MS = 100;
150
- var statusProgress = document.getElementById('status-progress');
151
- var statusProgressInner = document.getElementById('status-progress-inner');
152
- var statusIndeterminate = document.getElementById('status-indeterminate');
153
- var statusNotice = document.getElementById('status-notice');
 
154
 
155
- var initializing = true;
156
- var statusMode = 'hidden';
157
 
158
- var animationCallbacks = [];
159
- function animate(time) {
160
- animationCallbacks.forEach(callback => callback(time));
161
- requestAnimationFrame(animate);
162
- }
163
- requestAnimationFrame(animate);
164
-
165
- function setStatusMode(mode) {
166
-
167
- if (statusMode === mode || !initializing)
168
- return;
169
- [statusProgress, statusIndeterminate, statusNotice].forEach(elem => {
170
- elem.style.display = 'none';
171
- });
172
- animationCallbacks = animationCallbacks.filter(function(value) {
173
- return (value != animateStatusIndeterminate);
174
- });
175
- switch (mode) {
176
- case 'progress':
177
- statusProgress.style.display = 'block';
178
- break;
179
- case 'indeterminate':
180
- statusIndeterminate.style.display = 'block';
181
- animationCallbacks.push(animateStatusIndeterminate);
182
- break;
183
- case 'notice':
184
- statusNotice.style.display = 'block';
185
- break;
186
- case 'hidden':
187
- break;
188
- default:
189
- throw new Error('Invalid status mode');
190
- }
191
- statusMode = mode;
192
- }
193
 
194
- function animateStatusIndeterminate(ms) {
195
- var i = Math.floor(ms / INDETERMINATE_STATUS_STEP_MS % 8);
196
- if (statusIndeterminate.children[i].style.borderTopColor == '') {
197
- Array.prototype.slice.call(statusIndeterminate.children).forEach(child => {
198
- child.style.borderTopColor = '';
199
- });
200
- statusIndeterminate.children[i].style.borderTopColor = '#dfdfdf';
201
- }
202
- }
203
 
204
- function setStatusNotice(text) {
205
- while (statusNotice.lastChild) {
206
- statusNotice.removeChild(statusNotice.lastChild);
207
- }
208
- var lines = text.split('\n');
209
- lines.forEach((line) => {
210
- statusNotice.appendChild(document.createTextNode(line));
211
- statusNotice.appendChild(document.createElement('br'));
212
- });
213
- };
214
-
215
- function displayFailureNotice(err) {
216
- var msg = err.message || err;
217
- console.error(msg);
218
- setStatusNotice(msg);
219
- setStatusMode('notice');
220
- initializing = false;
221
- };
222
-
223
- if (!Engine.isWebGLAvailable()) {
224
- displayFailureNotice('WebGL not available');
225
- } else {
226
- setStatusMode('indeterminate');
227
- engine.startGame({
228
- 'onProgress': function (current, total) {
229
- if (total > 0) {
230
- statusProgressInner.style.width = current/total * 100 + '%';
231
- setStatusMode('progress');
232
- if (current === total) {
233
- // wait for progress bar animation
234
- setTimeout(() => {
235
- setStatusMode('indeterminate');
236
- }, 500);
237
- }
238
- } else {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
239
  setStatusMode('indeterminate');
240
- }
241
- },
242
- }).then(() => {
243
- setStatusMode('hidden');
244
- initializing = false;
245
- }, displayFailureNotice);
246
- }
247
- })();
248
- //]]></script>
 
 
 
 
 
 
 
249
  </body>
250
  </html>
251
 
 
 
 
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;
 
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 {
 
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
+
house/TowerBlocksGame.js CHANGED
The diff for this file is too large to render. See raw diff
 
house/TowerBlocksGame.wasm CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d8e9ae9d009a8d11ea028310e4e81d88664b6d3885a6d221feaea526a26f7393
3
- size 19761972
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:30d8df5794ff9b30728fd91d1c976ba8a25c8b3acd7d4daf89435ebf1b9b840c
3
+ size 15494210
house/loadback.png ADDED
house/loadfront.png ADDED