pxt-common-packages 12.0.1 → 12.0.2

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.
Files changed (35) hide show
  1. package/built/common-sim.js +4 -4
  2. package/libs/azureiot/built/debug/binary.js +461 -461
  3. package/libs/base/configkeys.h +1 -0
  4. package/libs/color/built/debug/binary.js +8 -8
  5. package/libs/color-sensor/built/debug/binary.js +8 -8
  6. package/libs/controller/built/debug/binary.js +7120 -7120
  7. package/libs/controller---none/built/debug/binary.js +7100 -7100
  8. package/libs/datalogger/built/debug/binary.js +63 -63
  9. package/libs/edge-connector/built/debug/binary.js +8 -8
  10. package/libs/esp32/built/debug/binary.js +462 -462
  11. package/libs/game/built/debug/binary.js +7039 -7039
  12. package/libs/game/game.ts +11 -1
  13. package/libs/game/info.ts +7 -2
  14. package/libs/lcd/built/debug/binary.js +8 -8
  15. package/libs/light-spectrum-sensor/built/debug/binary.js +8 -8
  16. package/libs/lora/built/debug/binary.js +8 -8
  17. package/libs/matrix-keypad/built/debug/binary.js +8 -8
  18. package/libs/mixer/sim/music.ts +4 -4
  19. package/libs/mqtt/built/debug/binary.js +176 -176
  20. package/libs/net/built/debug/binary.js +176 -176
  21. package/libs/net-game/built/debug/binary.js +8628 -8628
  22. package/libs/palette/built/debug/binary.js +7038 -7038
  23. package/libs/pixel/built/debug/binary.js +8 -8
  24. package/libs/power/built/debug/binary.js +8 -8
  25. package/libs/proximity/built/debug/binary.js +8 -8
  26. package/libs/radio/built/debug/binary.js +8 -8
  27. package/libs/radio-broadcast/built/debug/binary.js +8 -8
  28. package/libs/rotary-encoder/built/debug/binary.js +8 -8
  29. package/libs/screen/built/debug/binary.js +50 -50
  30. package/libs/servo/built/debug/binary.js +8 -8
  31. package/libs/servo/docs/reference/servos/set-pulse.md +1 -1
  32. package/libs/settings/settings.cpp +5 -0
  33. package/libs/sprite-scaling/built/debug/binary.js +7038 -7038
  34. package/libs/storyboard/built/debug/binary.js +7038 -7038
  35. package/package.json +1 -1
package/libs/game/game.ts CHANGED
@@ -372,6 +372,15 @@ namespace game {
372
372
  _gameOverImpl(true, player);
373
373
  }
374
374
 
375
+ function _mapScoreTypeToString(scoreType: ScoringType): string {
376
+ switch (scoreType) {
377
+ case ScoringType.HighScore: return "highscore";
378
+ case ScoringType.LowScore: return "lowscore";
379
+ case ScoringType.None: return "none";
380
+ default: return "none";
381
+ }
382
+ }
383
+
375
384
  function _gameOverImpl(win: boolean, winnerOverride?: number) {
376
385
  init();
377
386
  if (__isOver) return;
@@ -389,7 +398,8 @@ namespace game {
389
398
  const scores = playersWithScores.map(player => new GameOverPlayerScore(player.number, player.impl.score(), player === winner));
390
399
 
391
400
  // Save all scores. Dependency Note: this action triggers Kiosk to exit the simulator and show the high score screen.
392
- info.saveAllScores();
401
+ const scoreTypeString = _mapScoreTypeToString(goc.scoringType);
402
+ info.saveAllScores(scoreTypeString);
393
403
 
394
404
  // Save high score if this was a judged game and there was a winner (don't save in the LOSE case).
395
405
  if (judged && winner) {
package/libs/game/info.ts CHANGED
@@ -241,7 +241,7 @@ namespace info {
241
241
  return players ? players.filter(item => item.impl.hasScore()) : [];
242
242
  }
243
243
 
244
- export function saveAllScores() {
244
+ export function saveAllScores(scoringType: string) {
245
245
  const allScoresKey = "all-scores";
246
246
  let allScores: number[];
247
247
  const pws = playersWithScores();
@@ -252,7 +252,12 @@ namespace info {
252
252
  allScores = [];
253
253
  }
254
254
 
255
- settings.writeJSON(allScoresKey, allScores);
255
+ const scoresObj = {
256
+ "allScores": allScores,
257
+ "scoringType": allScores.length ? scoringType : "None"
258
+ }
259
+
260
+ settings.writeJSON(allScoresKey, scoresObj);
256
261
  }
257
262
 
258
263
  export function winningPlayer(): PlayerInfo {
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P48912(s) {
59
+ function _main___P48913(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___49155 = (undefined);
70
- globals._pollEventQueue___49168 = (undefined);
69
+ globals._intervals___49156 = (undefined);
70
+ globals._pollEventQueue___49169 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P48912.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P48912.continuations = [ ]
75
+ _main___P48913.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"characterlcd.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P48913.continuations = [ ]
77
77
 
78
- function _main___P48912_mk(s) {
78
+ function _main___P48913_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P48912, depth: s.depth + 1,
81
+ parent: s, fn: _main___P48913, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P48912_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P48912
91
+ return _main___P48913
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P99074(s) {
59
+ function _main___P99077(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___99317 = (undefined);
70
- globals._pollEventQueue___99330 = (undefined);
69
+ globals._intervals___99320 = (undefined);
70
+ globals._pollEventQueue___99333 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P99074.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P99074.continuations = [ ]
75
+ _main___P99077.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"tsl2591.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P99077.continuations = [ ]
77
77
 
78
- function _main___P99074_mk(s) {
78
+ function _main___P99077_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P99074, depth: s.depth + 1,
81
+ parent: s, fn: _main___P99077, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P99074_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P99074
91
+ return _main___P99077
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P60220(s) {
59
+ function _main___P60221(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___60463 = (undefined);
70
- globals._pollEventQueue___60476 = (undefined);
69
+ globals._intervals___60464 = (undefined);
70
+ globals._pollEventQueue___60477 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P60220.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P60220.continuations = [ ]
75
+ _main___P60221.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"lora.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P60221.continuations = [ ]
77
77
 
78
- function _main___P60220_mk(s) {
78
+ function _main___P60221_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P60220, depth: s.depth + 1,
81
+ parent: s, fn: _main___P60221, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P60220_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P60220
91
+ return _main___P60221
92
92
  })
@@ -56,7 +56,7 @@ const pxsim_pxtrt = pxsim.pxtrt;
56
56
  const pxsim_numops = pxsim.numops;
57
57
 
58
58
 
59
- function _main___P192910(s) {
59
+ function _main___P192917(s) {
60
60
  let r0 = s.r0, step = s.pc;
61
61
  s.pc = -1;
62
62
 
@@ -66,19 +66,19 @@ if (yieldSteps-- < 0 && maybeYield(s, step, r0) || runtime !== pxsim.runtime) re
66
66
  switch (step) {
67
67
  case 0:
68
68
 
69
- globals._intervals___193153 = (undefined);
70
- globals._pollEventQueue___193166 = (undefined);
69
+ globals._intervals___193160 = (undefined);
70
+ globals._pollEventQueue___193173 = (undefined);
71
71
  r0 = undefined;
72
72
  return leave(s, r0)
73
73
  default: oops()
74
74
  } } }
75
- _main___P192910.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
- _main___P192910.continuations = [ ]
75
+ _main___P192917.info = {"start":0,"length":0,"line":0,"column":0,"endLine":0,"endColumn":0,"fileName":"keypad.ts","functionName":"<main>","argumentNames":[]}
76
+ _main___P192917.continuations = [ ]
77
77
 
78
- function _main___P192910_mk(s) {
78
+ function _main___P192917_mk(s) {
79
79
  checkStack(s.depth);
80
80
  return {
81
- parent: s, fn: _main___P192910, depth: s.depth + 1,
81
+ parent: s, fn: _main___P192917, depth: s.depth + 1,
82
82
  pc: 0, retval: undefined, r0: undefined, overwrittenPC: false, lambdaArgs: null,
83
83
  } }
84
84
 
@@ -88,5 +88,5 @@ function _main___P192910_mk(s) {
88
88
 
89
89
  const breakpoints = setupDebugger(1, [])
90
90
 
91
- return _main___P192910
91
+ return _main___P192917
92
92
  })
@@ -54,16 +54,16 @@ namespace pxsim.music {
54
54
 
55
55
  await res.sequencer.initAsync();
56
56
  res.sequencer.addEventListener("stop", () => {
57
- board().bus.queue(SEQUENCER_STOP_MESSAGE, this.id);
57
+ board().bus.queue(SEQUENCER_STOP_MESSAGE, res.id);
58
58
  });
59
59
  res.sequencer.addEventListener("state-change", () => {
60
- board().bus.queue(SEQUENCER_STATE_CHANGE_MESSAGE, this.id);
60
+ board().bus.queue(SEQUENCER_STATE_CHANGE_MESSAGE, res.id);
61
61
  });
62
62
  res.sequencer.addEventListener("looped", () => {
63
- board().bus.queue(SEQUENCER_LOOPED_MESSAGE, this.id);
63
+ board().bus.queue(SEQUENCER_LOOPED_MESSAGE, res.id);
64
64
  });
65
65
  res.sequencer.addEventListener("tick", () => {
66
- board().bus.queue(SEQUENCER_TICK_MESSAGE, this.id);
66
+ board().bus.queue(SEQUENCER_TICK_MESSAGE, res.id);
67
67
  });
68
68
 
69
69