pxt-arcade 2.0.37 → 2.0.39
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-strings.json +1 -1
- package/built/sim.js +37 -0
- package/built/target.js +1 -1
- package/built/target.json +1 -1
- package/built/targetlight.js +1 -1
- package/built/targetlight.json +1 -1
- package/package.json +3 -3
package/built/sim-strings.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"Type your response using your keyboard and hit ENTER":"Type your response using your keyboard and hit ENTER"}
|
|
1
|
+
{"Type your response using your keyboard and hit ENTER":"Type your response using your keyboard and hit ENTER","Unmute simulator":"Unmute simulator"}
|
package/built/sim.js
CHANGED
|
@@ -152,6 +152,35 @@ var pxsim;
|
|
|
152
152
|
}
|
|
153
153
|
})(pxsim || (pxsim = {}));
|
|
154
154
|
var pxsim;
|
|
155
|
+
(function (pxsim) {
|
|
156
|
+
const icon = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!-- Font Awesome Pro 5.15.4 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) --><path d="M215.03 71.05L126.06 160H24c-13.26 0-24 10.74-24 24v144c0 13.25 10.74 24 24 24h102.06l88.97 88.95c15.03 15.03 40.97 4.47 40.97-16.97V88.02c0-21.46-25.96-31.98-40.97-16.97zM461.64 256l45.64-45.64c6.3-6.3 6.3-16.52 0-22.82l-22.82-22.82c-6.3-6.3-16.52-6.3-22.82 0L416 210.36l-45.64-45.64c-6.3-6.3-16.52-6.3-22.82 0l-22.82 22.82c-6.3 6.3-6.3 16.52 0 22.82L370.36 256l-45.63 45.63c-6.3 6.3-6.3 16.52 0 22.82l22.82 22.82c6.3 6.3 16.52 6.3 22.82 0L416 301.64l45.64 45.64c6.3 6.3 16.52 6.3 22.82 0l22.82-22.82c6.3-6.3 6.3-16.52 0-22.82L461.64 256z"/></svg>`;
|
|
157
|
+
// We only need to unmute from within the iframe once
|
|
158
|
+
let hasUnmuted = false;
|
|
159
|
+
function createMuteButton() {
|
|
160
|
+
const el = document.createElement("div");
|
|
161
|
+
el.setAttribute("id", "safari-mute-button-outer");
|
|
162
|
+
el.innerHTML = `
|
|
163
|
+
<button class="safari-mute-button">
|
|
164
|
+
${icon}
|
|
165
|
+
</button>
|
|
166
|
+
`;
|
|
167
|
+
const button = el.firstElementChild;
|
|
168
|
+
button.setAttribute("title", pxsim.localization.lf("Unmute simulator"));
|
|
169
|
+
button.addEventListener("click", () => {
|
|
170
|
+
pxsim.AudioContextManager.mute(false);
|
|
171
|
+
pxsim.setParentMuteState("unmuted");
|
|
172
|
+
button.remove();
|
|
173
|
+
hasUnmuted = true;
|
|
174
|
+
});
|
|
175
|
+
return el;
|
|
176
|
+
}
|
|
177
|
+
pxsim.createMuteButton = createMuteButton;
|
|
178
|
+
function shouldShowMute() {
|
|
179
|
+
return isSafari() && !hasUnmuted;
|
|
180
|
+
}
|
|
181
|
+
pxsim.shouldShowMute = shouldShowMute;
|
|
182
|
+
})(pxsim || (pxsim = {}));
|
|
183
|
+
var pxsim;
|
|
155
184
|
(function (pxsim) {
|
|
156
185
|
let forcedUpdateLoop;
|
|
157
186
|
let isFirstRunSafari = true;
|
|
@@ -595,6 +624,7 @@ var pxsim;
|
|
|
595
624
|
}
|
|
596
625
|
resize() { }
|
|
597
626
|
async initAsync(msg) {
|
|
627
|
+
var _a;
|
|
598
628
|
this.runOptions = msg;
|
|
599
629
|
this.stats = document.getElementById("debug-stats");
|
|
600
630
|
this.stats.className = "stats no-select";
|
|
@@ -615,6 +645,13 @@ var pxsim;
|
|
|
615
645
|
}
|
|
616
646
|
this.setActivePlayer(msg.activePlayer, theme);
|
|
617
647
|
this.updateStats();
|
|
648
|
+
if (((_a = msg.options) === null || _a === void 0 ? void 0 : _a.mpRole) !== "server") {
|
|
649
|
+
if (pxsim.shouldShowMute()) {
|
|
650
|
+
document.body.appendChild(pxsim.createMuteButton());
|
|
651
|
+
pxsim.AudioContextManager.mute(true);
|
|
652
|
+
pxsim.setParentMuteState("disabled");
|
|
653
|
+
}
|
|
654
|
+
}
|
|
618
655
|
let safariEnablePromise;
|
|
619
656
|
if (isFirstRunSafari && !safariEnablePromise) {
|
|
620
657
|
const safariWarning = document.getElementById("safari-enable-game");
|