pxt-arcade 1.12.5 → 1.12.7
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/common-sim.d.ts +12 -0
- package/built/common-sim.js +24 -0
- package/built/sim.js +58 -3
- package/built/target.js +280 -248
- package/built/target.json +280 -248
- package/built/targetlight.json +5 -5
- package/built/theme.json +1 -1
- package/docs/GameList.json +1 -1
- package/docs/kiosk.html +1 -1
- package/docs/static/kiosk/asset-manifest.json +6 -6
- package/docs/static/kiosk/static/css/main.269c590e.css +2 -0
- package/docs/static/kiosk/static/css/main.269c590e.css.map +1 -0
- package/docs/static/kiosk/static/js/{main.7c9f0b91.js → main.0fe8d35c.js} +3 -3
- package/docs/static/kiosk/static/js/{main.7c9f0b91.js.LICENSE.txt → main.0fe8d35c.js.LICENSE.txt} +0 -0
- package/docs/static/kiosk/static/js/main.0fe8d35c.js.map +1 -0
- package/docs/tutorials/hundred.md +140 -157
- package/package.json +4 -4
- package/pxtarget.json +1 -1
- package/docs/static/kiosk/static/css/main.b60591be.css +0 -2
- package/docs/static/kiosk/static/css/main.b60591be.css.map +0 -1
- package/docs/static/kiosk/static/js/main.7c9f0b91.js.map +0 -1
package/built/common-sim.d.ts
CHANGED
|
@@ -774,6 +774,7 @@ declare namespace pxsim {
|
|
|
774
774
|
}
|
|
775
775
|
declare namespace pxsim.multiplayer {
|
|
776
776
|
function postImage(im: pxsim.RefImage): void;
|
|
777
|
+
function postIcon(iconType: IconType, slot: number, im: pxsim.RefImage): void;
|
|
777
778
|
function getCurrentImage(): pxsim.RefImage;
|
|
778
779
|
function setOrigin(origin: "client" | "server" | undefined): void;
|
|
779
780
|
function getOrigin(): string;
|
|
@@ -796,6 +797,17 @@ declare namespace pxsim {
|
|
|
796
797
|
image: RefBuffer;
|
|
797
798
|
palette: Uint8Array;
|
|
798
799
|
}
|
|
800
|
+
enum IconType {
|
|
801
|
+
Player = 0,
|
|
802
|
+
Reaction = 1
|
|
803
|
+
}
|
|
804
|
+
interface MultiplayerIconMessage extends SimulatorMultiplayerMessage {
|
|
805
|
+
content: "Icon";
|
|
806
|
+
icon: RefBuffer;
|
|
807
|
+
slot: number;
|
|
808
|
+
iconType: IconType;
|
|
809
|
+
palette: Uint8Array;
|
|
810
|
+
}
|
|
799
811
|
interface MultiplayerButtonEvent extends SimulatorMultiplayerMessage {
|
|
800
812
|
content: "Button";
|
|
801
813
|
button: number;
|
package/built/common-sim.js
CHANGED
|
@@ -2553,6 +2553,25 @@ var pxsim;
|
|
|
2553
2553
|
});
|
|
2554
2554
|
}
|
|
2555
2555
|
multiplayer.postImage = postImage;
|
|
2556
|
+
function postIcon(iconType, slot, im) {
|
|
2557
|
+
if (pxsim.getMultiplayerState().origin !== "server")
|
|
2558
|
+
return;
|
|
2559
|
+
if (im._width * im._height > 64 * 64) {
|
|
2560
|
+
// setting 64x64 as max size for icon for now
|
|
2561
|
+
return;
|
|
2562
|
+
}
|
|
2563
|
+
const asBuf = pxsim.image.toBuffer(im);
|
|
2564
|
+
const sb = pxsim.board();
|
|
2565
|
+
const screenState = sb && sb.screenState;
|
|
2566
|
+
pxsim.getMultiplayerState().send({
|
|
2567
|
+
content: "Icon",
|
|
2568
|
+
slot: slot,
|
|
2569
|
+
icon: asBuf,
|
|
2570
|
+
iconType: iconType,
|
|
2571
|
+
palette: screenState.paletteToUint8Array(),
|
|
2572
|
+
});
|
|
2573
|
+
}
|
|
2574
|
+
multiplayer.postIcon = postIcon;
|
|
2556
2575
|
function getCurrentImage() {
|
|
2557
2576
|
return pxsim.getMultiplayerState().backgroundImage;
|
|
2558
2577
|
}
|
|
@@ -2572,6 +2591,11 @@ var pxsim;
|
|
|
2572
2591
|
return pxsim.board().multiplayerState;
|
|
2573
2592
|
}
|
|
2574
2593
|
pxsim.getMultiplayerState = getMultiplayerState;
|
|
2594
|
+
let IconType;
|
|
2595
|
+
(function (IconType) {
|
|
2596
|
+
IconType[IconType["Player"] = 0] = "Player";
|
|
2597
|
+
IconType[IconType["Reaction"] = 1] = "Reaction";
|
|
2598
|
+
})(IconType = pxsim.IconType || (pxsim.IconType = {}));
|
|
2575
2599
|
class MultiplayerState {
|
|
2576
2600
|
constructor() {
|
|
2577
2601
|
this.lastMessageId = 0;
|
package/built/sim.js
CHANGED
|
@@ -153,6 +153,7 @@ var pxsim;
|
|
|
153
153
|
var pxsim;
|
|
154
154
|
(function (pxsim) {
|
|
155
155
|
let forcedUpdateLoop;
|
|
156
|
+
let isFirstRunSafari = true;
|
|
156
157
|
window.addEventListener("DOMContentLoaded", () => {
|
|
157
158
|
const searchParams = new URL(window.location.toString()).searchParams;
|
|
158
159
|
setSimThemeColor("background-color", searchParams.get("background-color"));
|
|
@@ -304,7 +305,7 @@ var pxsim;
|
|
|
304
305
|
}
|
|
305
306
|
};
|
|
306
307
|
window.addEventListener("message", (ev) => {
|
|
307
|
-
if (ev.data.button !== undefined) {
|
|
308
|
+
if (ev.data.button !== undefined && ev.data.type !== "multiplayer") {
|
|
308
309
|
let key;
|
|
309
310
|
switch (ev.data.button) {
|
|
310
311
|
case 0:
|
|
@@ -492,7 +493,11 @@ var pxsim;
|
|
|
492
493
|
// ignore
|
|
493
494
|
}
|
|
494
495
|
resize() { }
|
|
495
|
-
initAsync(msg) {
|
|
496
|
+
async initAsync(msg) {
|
|
497
|
+
var _a;
|
|
498
|
+
if (msg.options.mpRole) {
|
|
499
|
+
this.multiplayerState.origin = msg.options.mpRole;
|
|
500
|
+
}
|
|
496
501
|
this.runOptions = msg;
|
|
497
502
|
this.stats = document.getElementById("debug-stats");
|
|
498
503
|
this.stats.className = "stats no-select";
|
|
@@ -510,7 +515,27 @@ var pxsim;
|
|
|
510
515
|
}
|
|
511
516
|
}
|
|
512
517
|
this.updateStats();
|
|
513
|
-
|
|
518
|
+
let safariEnablePromise;
|
|
519
|
+
if (isFirstRunSafari && !safariEnablePromise) {
|
|
520
|
+
const safariWarning = document.getElementById("safari-enable-game");
|
|
521
|
+
if (isSafari() && ((_a = msg.options) === null || _a === void 0 ? void 0 : _a.mpRole) === "server") {
|
|
522
|
+
safariEnablePromise = new Promise(resolve => {
|
|
523
|
+
safariWarning.style.display = "flex";
|
|
524
|
+
safariWarning.addEventListener("click", () => {
|
|
525
|
+
safariWarning.remove();
|
|
526
|
+
isFirstRunSafari = false;
|
|
527
|
+
resolve();
|
|
528
|
+
});
|
|
529
|
+
});
|
|
530
|
+
}
|
|
531
|
+
else {
|
|
532
|
+
safariWarning.remove();
|
|
533
|
+
isFirstRunSafari = false;
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
if (isFirstRunSafari) {
|
|
537
|
+
await safariEnablePromise;
|
|
538
|
+
}
|
|
514
539
|
}
|
|
515
540
|
updateStats() {
|
|
516
541
|
this.stats.textContent = this.screenState.stats || "";
|
|
@@ -573,6 +598,12 @@ function isChrome() {
|
|
|
573
598
|
(/Chrome/i.test(navigator.userAgent) ||
|
|
574
599
|
/Chromium/i.test(navigator.userAgent)));
|
|
575
600
|
}
|
|
601
|
+
//Chrome and Microsoft Edge lie about being Safari
|
|
602
|
+
function isSafari() {
|
|
603
|
+
//Could also check isMac but I don't want to risk excluding iOS
|
|
604
|
+
//Checking for iPhone, iPod or iPad as well as Safari in order to detect home screen browsers on iOS
|
|
605
|
+
return !isChrome() && !isEdge() && !!navigator && /(Macintosh|Safari|iPod|iPhone|iPad)/i.test(navigator.userAgent);
|
|
606
|
+
}
|
|
576
607
|
(function (pxsim) {
|
|
577
608
|
var pxtcore;
|
|
578
609
|
(function (pxtcore) {
|
|
@@ -2767,6 +2798,25 @@ var pxsim;
|
|
|
2767
2798
|
});
|
|
2768
2799
|
}
|
|
2769
2800
|
multiplayer.postImage = postImage;
|
|
2801
|
+
function postIcon(iconType, slot, im) {
|
|
2802
|
+
if (pxsim.getMultiplayerState().origin !== "server")
|
|
2803
|
+
return;
|
|
2804
|
+
if (im._width * im._height > 64 * 64) {
|
|
2805
|
+
// setting 64x64 as max size for icon for now
|
|
2806
|
+
return;
|
|
2807
|
+
}
|
|
2808
|
+
const asBuf = pxsim.image.toBuffer(im);
|
|
2809
|
+
const sb = pxsim.board();
|
|
2810
|
+
const screenState = sb && sb.screenState;
|
|
2811
|
+
pxsim.getMultiplayerState().send({
|
|
2812
|
+
content: "Icon",
|
|
2813
|
+
slot: slot,
|
|
2814
|
+
icon: asBuf,
|
|
2815
|
+
iconType: iconType,
|
|
2816
|
+
palette: screenState.paletteToUint8Array(),
|
|
2817
|
+
});
|
|
2818
|
+
}
|
|
2819
|
+
multiplayer.postIcon = postIcon;
|
|
2770
2820
|
function getCurrentImage() {
|
|
2771
2821
|
return pxsim.getMultiplayerState().backgroundImage;
|
|
2772
2822
|
}
|
|
@@ -2786,6 +2836,11 @@ var pxsim;
|
|
|
2786
2836
|
return pxsim.board().multiplayerState;
|
|
2787
2837
|
}
|
|
2788
2838
|
pxsim.getMultiplayerState = getMultiplayerState;
|
|
2839
|
+
let IconType;
|
|
2840
|
+
(function (IconType) {
|
|
2841
|
+
IconType[IconType["Player"] = 0] = "Player";
|
|
2842
|
+
IconType[IconType["Reaction"] = 1] = "Reaction";
|
|
2843
|
+
})(IconType = pxsim.IconType || (pxsim.IconType = {}));
|
|
2789
2844
|
class MultiplayerState {
|
|
2790
2845
|
constructor() {
|
|
2791
2846
|
this.lastMessageId = 0;
|