pxt-common-packages 10.3.10 → 10.3.12
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 +6 -0
- package/built/common-sim.js +15 -2
- package/libs/azureiot/built/debug/binary.js +461 -461
- package/libs/color/built/debug/binary.js +8 -8
- package/libs/color-sensor/built/debug/binary.js +8 -8
- package/libs/controller/built/debug/binary.js +8627 -8381
- package/libs/controller---none/built/debug/binary.js +8606 -8360
- package/libs/datalogger/built/debug/binary.js +63 -63
- package/libs/edge-connector/built/debug/binary.js +8 -8
- package/libs/esp32/built/debug/binary.js +462 -462
- package/libs/game/built/debug/binary.js +9031 -8785
- package/libs/game/controller.ts +5 -0
- package/libs/game/multiplayer.ts +39 -0
- package/libs/game/sim/multiplayer.ts +23 -2
- package/libs/lcd/built/debug/binary.js +8 -8
- package/libs/light-spectrum-sensor/built/debug/binary.js +8 -8
- package/libs/lora/built/debug/binary.js +8 -8
- package/libs/matrix-keypad/built/debug/binary.js +8 -8
- package/libs/mqtt/built/debug/binary.js +176 -176
- package/libs/multiplayer/player.ts +15 -0
- package/libs/net/built/debug/binary.js +176 -176
- package/libs/net-game/built/debug/binary.js +10613 -10367
- package/libs/palette/built/debug/binary.js +9030 -8784
- package/libs/pixel/built/debug/binary.js +8 -8
- package/libs/power/built/debug/binary.js +8 -8
- package/libs/proximity/built/debug/binary.js +8 -8
- package/libs/radio/built/debug/binary.js +8 -8
- package/libs/radio-broadcast/built/debug/binary.js +8 -8
- package/libs/rotary-encoder/built/debug/binary.js +8 -8
- package/libs/screen/built/debug/binary.js +50 -50
- package/libs/servo/built/debug/binary.js +8 -8
- package/libs/sprite-scaling/built/debug/binary.js +9030 -8784
- package/libs/storyboard/built/debug/binary.js +9030 -8784
- package/package.json +1 -1
package/built/common-sim.d.ts
CHANGED
|
@@ -818,6 +818,11 @@ declare namespace pxsim {
|
|
|
818
818
|
instruction: "playinstructions" | "muteallchannels";
|
|
819
819
|
soundbuf?: Uint8Array;
|
|
820
820
|
}
|
|
821
|
+
interface MultiplayerConnectionEvent extends SimulatorMultiplayerMessage {
|
|
822
|
+
content: "Connection";
|
|
823
|
+
slot: number;
|
|
824
|
+
connected: boolean;
|
|
825
|
+
}
|
|
821
826
|
class MultiplayerState {
|
|
822
827
|
lastMessageId: number;
|
|
823
828
|
origin: string;
|
|
@@ -826,6 +831,7 @@ declare namespace pxsim {
|
|
|
826
831
|
send(msg: SimulatorMultiplayerMessage): void;
|
|
827
832
|
init(origin: string): void;
|
|
828
833
|
setButton(key: number, isPressed: boolean): void;
|
|
834
|
+
registerConnectionState(player: number, connected: boolean): void;
|
|
829
835
|
protected messageHandler(msg: SimulatorMessage): void;
|
|
830
836
|
}
|
|
831
837
|
}
|
package/built/common-sim.js
CHANGED
|
@@ -2554,8 +2554,6 @@ var pxsim;
|
|
|
2554
2554
|
}
|
|
2555
2555
|
multiplayer.postImage = postImage;
|
|
2556
2556
|
function postIcon(iconType, slot, im) {
|
|
2557
|
-
if (pxsim.getMultiplayerState().origin !== "server")
|
|
2558
|
-
return;
|
|
2559
2557
|
if (im._width * im._height > 64 * 64) {
|
|
2560
2558
|
// setting 64x64 as max size for icon for now
|
|
2561
2559
|
return;
|
|
@@ -2596,6 +2594,8 @@ var pxsim;
|
|
|
2596
2594
|
IconType[IconType["Player"] = 0] = "Player";
|
|
2597
2595
|
IconType[IconType["Reaction"] = 1] = "Reaction";
|
|
2598
2596
|
})(IconType = pxsim.IconType || (pxsim.IconType = {}));
|
|
2597
|
+
const MULTIPLAYER_PLAYER_JOINED_ID = 3241;
|
|
2598
|
+
const MULTIPLAYER_PLAYER_LEFT_ID = 3242;
|
|
2599
2599
|
class MultiplayerState {
|
|
2600
2600
|
constructor() {
|
|
2601
2601
|
this.lastMessageId = 0;
|
|
@@ -2628,6 +2628,11 @@ var pxsim;
|
|
|
2628
2628
|
});
|
|
2629
2629
|
}
|
|
2630
2630
|
}
|
|
2631
|
+
registerConnectionState(player, connected) {
|
|
2632
|
+
const evId = connected ? MULTIPLAYER_PLAYER_JOINED_ID : MULTIPLAYER_PLAYER_LEFT_ID;
|
|
2633
|
+
const b = pxsim.board();
|
|
2634
|
+
b.bus.queue(evId, player);
|
|
2635
|
+
}
|
|
2631
2636
|
messageHandler(msg) {
|
|
2632
2637
|
if (!isMultiplayerMessage(msg)) {
|
|
2633
2638
|
return;
|
|
@@ -2661,6 +2666,11 @@ var pxsim;
|
|
|
2661
2666
|
}
|
|
2662
2667
|
}
|
|
2663
2668
|
}
|
|
2669
|
+
else if (isConnectionMessage(msg)) {
|
|
2670
|
+
if (this.origin === "server") {
|
|
2671
|
+
this.registerConnectionState(msg.slot, msg.connected);
|
|
2672
|
+
}
|
|
2673
|
+
}
|
|
2664
2674
|
}
|
|
2665
2675
|
}
|
|
2666
2676
|
pxsim.MultiplayerState = MultiplayerState;
|
|
@@ -2676,6 +2686,9 @@ var pxsim;
|
|
|
2676
2686
|
function isAudioMessage(msg) {
|
|
2677
2687
|
return msg && msg.content === "Audio";
|
|
2678
2688
|
}
|
|
2689
|
+
function isConnectionMessage(msg) {
|
|
2690
|
+
return msg && msg.content === "Connection";
|
|
2691
|
+
}
|
|
2679
2692
|
})(pxsim || (pxsim = {}));
|
|
2680
2693
|
var pxsim;
|
|
2681
2694
|
(function (pxsim) {
|