maze-blockly-wrapper 0.7.26 → 0.7.27
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/dist/index.esm.js
CHANGED
|
@@ -10795,25 +10795,25 @@ class MazeGame extends Component {
|
|
|
10795
10795
|
}
|
|
10796
10796
|
return false;
|
|
10797
10797
|
}
|
|
10798
|
-
sleepSync(milliseconds) {
|
|
10799
|
-
if (milliseconds <= 0) {
|
|
10800
|
-
return;
|
|
10801
|
-
}
|
|
10802
|
-
}
|
|
10803
10798
|
executeCommands(commands) {
|
|
10804
10799
|
var _a;
|
|
10805
|
-
const stepInterval = (_a = this.props.stepInterval) != null ? _a :
|
|
10806
|
-
|
|
10800
|
+
const stepInterval = (_a = this.props.stepInterval) != null ? _a : 800;
|
|
10801
|
+
let commandIndex = 0;
|
|
10802
|
+
this.executionInterval = setInterval(() => {
|
|
10807
10803
|
if (this.state.gameState.isGameOver) {
|
|
10808
|
-
|
|
10804
|
+
this.stopExecution();
|
|
10805
|
+
return;
|
|
10806
|
+
}
|
|
10807
|
+
if (commandIndex >= commands.length) {
|
|
10808
|
+
this.stopExecution();
|
|
10809
|
+
this.emitRunFinish(this.getCurrentRunResult());
|
|
10810
|
+
return;
|
|
10809
10811
|
}
|
|
10810
10812
|
const command = commands[commandIndex];
|
|
10811
10813
|
this.executeCommand(command);
|
|
10812
|
-
|
|
10813
|
-
this.
|
|
10814
|
-
}
|
|
10815
|
-
this.stopExecution();
|
|
10816
|
-
this.emitRunFinish(this.getCurrentRunResult());
|
|
10814
|
+
commandIndex++;
|
|
10815
|
+
this.setState({ currentCommandIndex: commandIndex });
|
|
10816
|
+
}, stepInterval);
|
|
10817
10817
|
}
|
|
10818
10818
|
executeCommand(command) {
|
|
10819
10819
|
switch (command.type) {
|
|
@@ -13230,18 +13230,17 @@ class DrawingGame extends Component {
|
|
|
13230
13230
|
executeCommands(commands) {
|
|
13231
13231
|
var _a;
|
|
13232
13232
|
const stepInterval = (_a = this.props.stepInterval) != null ? _a : 500;
|
|
13233
|
-
|
|
13233
|
+
let commandIndex = 0;
|
|
13234
|
+
this.executionInterval = setInterval(() => {
|
|
13235
|
+
if (commandIndex >= commands.length) {
|
|
13236
|
+
this.stopExecution();
|
|
13237
|
+
return;
|
|
13238
|
+
}
|
|
13234
13239
|
const command = commands[commandIndex];
|
|
13235
13240
|
this.executeCommand(command);
|
|
13236
|
-
|
|
13237
|
-
this.
|
|
13238
|
-
}
|
|
13239
|
-
this.stopExecution();
|
|
13240
|
-
}
|
|
13241
|
-
sleepSync(milliseconds) {
|
|
13242
|
-
if (milliseconds <= 0) {
|
|
13243
|
-
return;
|
|
13244
|
-
}
|
|
13241
|
+
commandIndex++;
|
|
13242
|
+
this.setState({ currentCommandIndex: commandIndex });
|
|
13243
|
+
}, stepInterval);
|
|
13245
13244
|
}
|
|
13246
13245
|
executeCommand(command) {
|
|
13247
13246
|
switch (command.type) {
|