pxt-arcade 1.10.21 → 1.10.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/built/sim.js +87 -33
- package/built/target.js +143 -143
- package/built/target.json +143 -143
- package/built/targetlight.json +5 -5
- package/docs/graveyard/.checkdocs-ignore +1 -0
- package/docs/graveyard/.crowdinignore +1 -0
- package/docs/{skillmap → graveyard/skillmap}/beginner-skillmap-2.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/clicker/clicker1.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/clicker/clicker2.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/clicker/clicker3.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/clicker/clicker4.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/clicker/clicker4a.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/clicker/clicker5.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/collector/collector1.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/collector/collector1a.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/collector/collector2.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/collector/collector3.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/collector/collector3a.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/collector/collector4.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/collector/collector5.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/collector/scroller.ts +0 -0
- package/docs/{skillmap → graveyard/skillmap}/forest/forest1.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/forest/forest2.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/forest/forest3.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/forest/forest4.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/forest/forest5.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/forest/forest6.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/forest-old.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/long-shark.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/star-sing2/star1.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/star-sing2/star2.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/star-sing2/star3.md +0 -0
- package/docs/{skillmap → graveyard/skillmap}/star-sing2/star4.md +0 -0
- package/docs/hour-of-code-2022.html +450 -0
- package/docs/static/hour-of-code/2022/HoC_logo.png +0 -0
- package/docs/static/hour-of-code/2022/Inter/static/Inter-Bold.ttf +0 -0
- package/docs/static/hour-of-code/2022/Inter/static/Inter-ExtraBold.ttf +0 -0
- package/docs/static/hour-of-code/2022/New_ Start here!.png +0 -0
- package/docs/static/hour-of-code/2022/Nunito/static/Nunito-Bold.ttf +0 -0
- package/docs/static/hour-of-code/2022/Nunito/static/Nunito-ExtraBold.ttf +0 -0
- package/docs/static/hour-of-code/2022/Nunito/static/Nunito-Regular.ttf +0 -0
- package/docs/static/hour-of-code/2022/Nunito/static/Nunito-SemiBold.ttf +0 -0
- package/docs/static/hour-of-code/2022/arcadeImage.png +0 -0
- package/docs/static/hour-of-code/2022/arrow.png +0 -0
- package/docs/static/hour-of-code/2022/gameImg_ballon.png +0 -0
- package/docs/static/hour-of-code/2022/gameImg_target.png +0 -0
- package/docs/static/hour-of-code/2022/gameImg_whack_em_all.png +0 -0
- package/docs/static/hour-of-code/2022/microbitImage.png +0 -0
- package/docs/static/hour-of-code/2022/microsoftMakeCodeLogo.svg +9 -0
- package/docs/static/hour-of-code/2022/red-pixel-heart-vmx.png +0 -0
- package/docs/static/hour-of-code/2022/skyTile.png +0 -0
- package/docs/static/hour-of-code/2022/social/instagram.png +0 -0
- package/docs/static/hour-of-code/2022/social/tik_tok.png +0 -0
- package/docs/static/hour-of-code/2022/social/twitch.png +0 -0
- package/docs/static/hour-of-code/2022/social/twitter.png +0 -0
- package/docs/static/hour-of-code/2022/social/youtube.png +0 -0
- package/docs/static/hour-of-code/2022/startHere.png +0 -0
- package/docs/static/hour-of-code/2022/styles-old.css +1510 -0
- package/docs/static/hour-of-code/2022/styles.css +386 -0
- package/docs/test/skillmap/forest/forest1.md +191 -0
- package/docs/test/skillmap/forest/forest2.md +217 -0
- package/docs/test/skillmap/forest/forest3.md +333 -0
- package/docs/test/skillmap/forest/forest4.md +196 -0
- package/docs/test/skillmap/forest/forest5.md +292 -0
- package/docs/test/skillmap/forest/forest6.md +273 -0
- package/docs/test/skillmap/forest-2022.md +99 -0
- package/docs/{skillmap/puzzle/puzzle1.md → test/skillmap/guess/guess1.md} +0 -0
- package/docs/{skillmap/puzzle/puzzle2.md → test/skillmap/guess/guess2.md} +0 -0
- package/docs/{skillmap/puzzle/puzzle3.md → test/skillmap/guess/guess3.md} +0 -0
- package/docs/{skillmap/puzzle/puzzle4.md → test/skillmap/guess/guess4.md} +0 -0
- package/docs/{skillmap/puzzle/puzzle5.md → test/skillmap/guess/guess5.md} +0 -0
- package/docs/test/skillmap/guess.md +88 -0
- package/docs/test/skillmap/mole/mole1.md +1 -1
- package/docs/test/skillmap/mole/mole1a.md +27 -31
- package/docs/test/skillmap/mole/mole2a.md +38 -49
- package/docs/test/skillmap/mole/mole3a.md +22 -27
- package/docs/{skillmap → test/skillmap}/pongo/pongo1.md +0 -0
- package/docs/{skillmap → test/skillmap}/pongo/pongo2.md +0 -0
- package/docs/{skillmap → test/skillmap}/pongo/pongo3.md +0 -0
- package/docs/{skillmap → test/skillmap}/pongo.md +0 -0
- package/docs/{skillmap → test/skillmap}/turkey-0.md +0 -0
- package/package.json +3 -3
package/built/sim.js
CHANGED
|
@@ -159,7 +159,46 @@ var pxsim;
|
|
|
159
159
|
setSimThemeColor("button-stroke", searchParams.get("button-stroke"));
|
|
160
160
|
setSimThemeColor("text-color", searchParams.get("text-color"));
|
|
161
161
|
setSimThemeColor("button-fill", searchParams.get("button-fill"));
|
|
162
|
+
if (!!searchParams.get("pointer-events"))
|
|
163
|
+
registerPointerEvents();
|
|
162
164
|
});
|
|
165
|
+
function registerPointerEvents() {
|
|
166
|
+
const canvas = document.getElementById("game-screen");
|
|
167
|
+
const encoder = new TextEncoder();
|
|
168
|
+
const reporter = (event) => {
|
|
169
|
+
var _a;
|
|
170
|
+
// map canvas coordinates to arcade screen coordinates
|
|
171
|
+
const rect = canvas.getBoundingClientRect();
|
|
172
|
+
const x = ((event.clientX - rect.left) / rect.width) * 160;
|
|
173
|
+
const y = ((event.clientY - rect.top) / rect.height) * 120;
|
|
174
|
+
const msg = {
|
|
175
|
+
x,
|
|
176
|
+
y,
|
|
177
|
+
type: event.type,
|
|
178
|
+
pointerId: event.pointerId,
|
|
179
|
+
buttons: event.buttons,
|
|
180
|
+
pressure: event.pressure,
|
|
181
|
+
pointerType: event.pointerType,
|
|
182
|
+
};
|
|
183
|
+
const data = encoder.encode(JSON.stringify(msg));
|
|
184
|
+
const state = (_a = pxsim.board()) === null || _a === void 0 ? void 0 : _a.controlMessageState;
|
|
185
|
+
// queue in control sims
|
|
186
|
+
state === null || state === void 0 ? void 0 : state.enqueue({
|
|
187
|
+
type: "messagepacket",
|
|
188
|
+
channel: "pointer-events",
|
|
189
|
+
broadcast: false,
|
|
190
|
+
data,
|
|
191
|
+
});
|
|
192
|
+
};
|
|
193
|
+
canvas.addEventListener("pointerdown", reporter);
|
|
194
|
+
canvas.addEventListener("pointerup", reporter);
|
|
195
|
+
canvas.addEventListener("pointermove", reporter);
|
|
196
|
+
canvas.addEventListener("pointerleave", reporter);
|
|
197
|
+
canvas.addEventListener("pointerenter", reporter);
|
|
198
|
+
canvas.addEventListener("pointercancel", reporter);
|
|
199
|
+
canvas.addEventListener("pointerover", reporter);
|
|
200
|
+
canvas.addEventListener("pointerout", reporter);
|
|
201
|
+
}
|
|
163
202
|
function setSimThemeColor(part, color) {
|
|
164
203
|
if (!part || !color || !/^[0-9A-F]{6}$/i.test(color))
|
|
165
204
|
return;
|
|
@@ -191,27 +230,27 @@ var pxsim;
|
|
|
191
230
|
window.onkeydown = function (e) {
|
|
192
231
|
const b = board();
|
|
193
232
|
if (b) {
|
|
194
|
-
const key =
|
|
233
|
+
const key = typeof e.which == "number" ? e.which : e.keyCode;
|
|
195
234
|
b.setKey(key, true, e);
|
|
196
235
|
}
|
|
197
236
|
pxsim.Runtime.postMessage({
|
|
198
237
|
type: "messagepacket",
|
|
199
238
|
broadcast: false,
|
|
200
239
|
channel: "keydown-" + e.key,
|
|
201
|
-
data: new Uint8Array()
|
|
240
|
+
data: new Uint8Array(),
|
|
202
241
|
});
|
|
203
242
|
};
|
|
204
243
|
window.onkeyup = function (e) {
|
|
205
244
|
const b = board();
|
|
206
245
|
if (b) {
|
|
207
|
-
const key =
|
|
246
|
+
const key = typeof e.which == "number" ? e.which : e.keyCode;
|
|
208
247
|
b.setKey(key, false, e);
|
|
209
248
|
}
|
|
210
249
|
pxsim.Runtime.postMessage({
|
|
211
250
|
type: "messagepacket",
|
|
212
251
|
broadcast: false,
|
|
213
252
|
channel: "keyup-" + e.key,
|
|
214
|
-
data: new Uint8Array()
|
|
253
|
+
data: new Uint8Array(),
|
|
215
254
|
});
|
|
216
255
|
};
|
|
217
256
|
window.oncontextmenu = function (e) {
|
|
@@ -246,11 +285,13 @@ var pxsim;
|
|
|
246
285
|
if (url.searchParams.get("hideSimButtons") === "1") {
|
|
247
286
|
const gamePlayer = document.getElementsByClassName("game-player");
|
|
248
287
|
if (gamePlayer && gamePlayer.length) {
|
|
249
|
-
document
|
|
288
|
+
document
|
|
289
|
+
.getElementsByClassName("game-player")[0]
|
|
290
|
+
.classList.add("just-screen");
|
|
250
291
|
}
|
|
251
292
|
}
|
|
252
293
|
};
|
|
253
|
-
window.addEventListener("message", ev => {
|
|
294
|
+
window.addEventListener("message", (ev) => {
|
|
254
295
|
if (ev.data.button !== undefined) {
|
|
255
296
|
let key;
|
|
256
297
|
switch (ev.data.button) {
|
|
@@ -284,7 +325,8 @@ var pxsim;
|
|
|
284
325
|
b.setButton(key, ev.data.pressed);
|
|
285
326
|
}
|
|
286
327
|
if (ev.data.context !== undefined) {
|
|
287
|
-
if (ev.data.context == "client" ||
|
|
328
|
+
if (ev.data.context == "client" ||
|
|
329
|
+
ev.data.context == "server") {
|
|
288
330
|
const b = board();
|
|
289
331
|
b.multiplayerState.origin = ev.data.context;
|
|
290
332
|
}
|
|
@@ -315,27 +357,33 @@ var pxsim;
|
|
|
315
357
|
this.microphoneState = new pxsim.AnalogSensorState(DAL.DEVICE_ID_MICROPHONE, 0, 255, 50, 120);
|
|
316
358
|
this.controlMessageState = new pxsim.ControlMessageState(this);
|
|
317
359
|
// set all pin ids
|
|
318
|
-
[
|
|
360
|
+
[
|
|
361
|
+
{
|
|
319
362
|
prefix: "PIN_A",
|
|
320
363
|
id: 100,
|
|
321
|
-
count: 32
|
|
322
|
-
},
|
|
364
|
+
count: 32,
|
|
365
|
+
},
|
|
366
|
+
{
|
|
323
367
|
prefix: "PIN_B",
|
|
324
368
|
id: 300,
|
|
325
|
-
count: 32
|
|
326
|
-
},
|
|
369
|
+
count: 32,
|
|
370
|
+
},
|
|
371
|
+
{
|
|
327
372
|
prefix: "PIN_C",
|
|
328
373
|
id: 350,
|
|
329
|
-
count: 32
|
|
330
|
-
},
|
|
374
|
+
count: 32,
|
|
375
|
+
},
|
|
376
|
+
{
|
|
331
377
|
prefix: "PIN_D",
|
|
332
378
|
id: 150,
|
|
333
|
-
count: 32
|
|
334
|
-
},
|
|
379
|
+
count: 32,
|
|
380
|
+
},
|
|
381
|
+
{
|
|
335
382
|
prefix: "PIN_P",
|
|
336
383
|
id: 400,
|
|
337
|
-
count: 20
|
|
338
|
-
}
|
|
384
|
+
count: 20,
|
|
385
|
+
},
|
|
386
|
+
].forEach((pinp) => {
|
|
339
387
|
for (let i = 0; i < pinp.count; ++i) {
|
|
340
388
|
const id = pinp.id + i;
|
|
341
389
|
pxsim.setConfigKey(pinp.prefix + i, id);
|
|
@@ -344,25 +392,26 @@ var pxsim;
|
|
|
344
392
|
}
|
|
345
393
|
});
|
|
346
394
|
// add pins from config
|
|
347
|
-
const pins = pxsim
|
|
348
|
-
.
|
|
349
|
-
.
|
|
350
|
-
.
|
|
395
|
+
const pins = pxsim
|
|
396
|
+
.getAllConfigKeys()
|
|
397
|
+
.filter((k) => /^PIN_/.test(k))
|
|
398
|
+
.map((k) => pxsim.getConfig(pxsim.getConfigKey(k)))
|
|
399
|
+
.filter((id) => !!id);
|
|
351
400
|
this.edgeConnectorState = new pxsim.EdgeConnectorState({
|
|
352
|
-
pins
|
|
401
|
+
pins,
|
|
353
402
|
});
|
|
354
403
|
this.lightSensorState = new pxsim.AnalogSensorState(DAL.DEVICE_ID_LIGHT_SENSOR);
|
|
355
404
|
this.thermometerState = new pxsim.AnalogSensorState(DAL.DEVICE_ID_THERMOMETER);
|
|
356
405
|
this.thermometerUnitState = pxsim.TemperatureUnit.Celsius;
|
|
357
406
|
this.radioState = new pxsim.RadioState(pxsim.runtime, this, {
|
|
358
407
|
ID_RADIO: DAL.DEVICE_ID_RADIO,
|
|
359
|
-
RADIO_EVT_DATAGRAM: DAL.DEVICE_RADIO_EVT_DATAGRAM
|
|
408
|
+
RADIO_EVT_DATAGRAM: DAL.DEVICE_RADIO_EVT_DATAGRAM,
|
|
360
409
|
});
|
|
361
410
|
this.multiplayerState = new pxsim.MultiplayerState();
|
|
362
411
|
this.keymapState = new pxsim.KeymapState();
|
|
363
|
-
const scale =
|
|
412
|
+
const scale = isEdge() || isIE() ? 10 : 1;
|
|
364
413
|
this.gameplayer = new pxsim.visuals.GamePlayer(scale);
|
|
365
|
-
throttleAnimation(cb => this.screenState.onChange = cb, () => this.gameplayer.draw(this.screenState));
|
|
414
|
+
throttleAnimation((cb) => (this.screenState.onChange = cb), () => this.gameplayer.draw(this.screenState));
|
|
366
415
|
}
|
|
367
416
|
getDefaultPitchPin() {
|
|
368
417
|
return undefined;
|
|
@@ -388,7 +437,7 @@ var pxsim;
|
|
|
388
437
|
this.gameplayer.dispose();
|
|
389
438
|
pxsim.Runtime.postMessage({
|
|
390
439
|
type: "simulator",
|
|
391
|
-
command: "restart"
|
|
440
|
+
command: "restart",
|
|
392
441
|
});
|
|
393
442
|
}
|
|
394
443
|
return;
|
|
@@ -427,8 +476,7 @@ var pxsim;
|
|
|
427
476
|
tryScreenshot() {
|
|
428
477
|
// ignore
|
|
429
478
|
}
|
|
430
|
-
resize() {
|
|
431
|
-
}
|
|
479
|
+
resize() { }
|
|
432
480
|
initAsync(msg) {
|
|
433
481
|
this.runOptions = msg;
|
|
434
482
|
this.stats = document.getElementById("debug-stats");
|
|
@@ -445,7 +493,7 @@ var pxsim;
|
|
|
445
493
|
return Promise.resolve();
|
|
446
494
|
}
|
|
447
495
|
updateStats() {
|
|
448
|
-
this.stats.textContent = this.screenState.stats ||
|
|
496
|
+
this.stats.textContent = this.screenState.stats || "";
|
|
449
497
|
// screenshots are handled in the share dialog
|
|
450
498
|
}
|
|
451
499
|
tryGetNeopixelState(pinId) {
|
|
@@ -462,7 +510,9 @@ var pxsim;
|
|
|
462
510
|
}
|
|
463
511
|
pxsim.Board = Board;
|
|
464
512
|
function indicateFocus(hasFocus) {
|
|
465
|
-
document
|
|
513
|
+
document
|
|
514
|
+
.getElementById("root")
|
|
515
|
+
.setAttribute("class", hasFocus ? "" : "blur");
|
|
466
516
|
const b = board();
|
|
467
517
|
if (b) {
|
|
468
518
|
b.gameplayer.indicateFocus(hasFocus);
|
|
@@ -497,7 +547,11 @@ function isMac() {
|
|
|
497
547
|
}
|
|
498
548
|
//Microsoft Edge and IE11 lie about being Chrome
|
|
499
549
|
function isChrome() {
|
|
500
|
-
return !isEdge() &&
|
|
550
|
+
return (!isEdge() &&
|
|
551
|
+
!isIE() &&
|
|
552
|
+
!!navigator &&
|
|
553
|
+
(/Chrome/i.test(navigator.userAgent) ||
|
|
554
|
+
/Chromium/i.test(navigator.userAgent)));
|
|
501
555
|
}
|
|
502
556
|
(function (pxsim) {
|
|
503
557
|
var pxtcore;
|
|
@@ -512,7 +566,7 @@ function isChrome() {
|
|
|
512
566
|
var ButtonMethods;
|
|
513
567
|
(function (ButtonMethods) {
|
|
514
568
|
function id(button) {
|
|
515
|
-
return
|
|
569
|
+
return button.id;
|
|
516
570
|
}
|
|
517
571
|
ButtonMethods.id = id;
|
|
518
572
|
})(ButtonMethods = pxsim.ButtonMethods || (pxsim.ButtonMethods = {}));
|