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.
|
@@ -40,7 +40,6 @@ declare class DrawingGame extends Component<DrawingGameProps & WithTranslation,
|
|
|
40
40
|
private handleConfigChange;
|
|
41
41
|
private handleExecuteCode;
|
|
42
42
|
private executeCommands;
|
|
43
|
-
private sleepSync;
|
|
44
43
|
private executeCommand;
|
|
45
44
|
private movePenForward;
|
|
46
45
|
private turnPen;
|
|
@@ -45,7 +45,6 @@ declare class MazeGame extends Component<MazeGameProps & WithTranslation, MazeGa
|
|
|
45
45
|
private handleCodeChange;
|
|
46
46
|
private handleConfigChange;
|
|
47
47
|
private handleExecuteCode;
|
|
48
|
-
private sleepSync;
|
|
49
48
|
private executeCommands;
|
|
50
49
|
private executeCommand;
|
|
51
50
|
private moveSpiderForward;
|
package/dist/index.cjs.js
CHANGED
|
@@ -10833,25 +10833,25 @@ class MazeGame extends React.Component {
|
|
|
10833
10833
|
}
|
|
10834
10834
|
return false;
|
|
10835
10835
|
}
|
|
10836
|
-
sleepSync(milliseconds) {
|
|
10837
|
-
if (milliseconds <= 0) {
|
|
10838
|
-
return;
|
|
10839
|
-
}
|
|
10840
|
-
}
|
|
10841
10836
|
executeCommands(commands) {
|
|
10842
10837
|
var _a;
|
|
10843
|
-
const stepInterval = (_a = this.props.stepInterval) != null ? _a :
|
|
10844
|
-
|
|
10838
|
+
const stepInterval = (_a = this.props.stepInterval) != null ? _a : 800;
|
|
10839
|
+
let commandIndex = 0;
|
|
10840
|
+
this.executionInterval = setInterval(() => {
|
|
10845
10841
|
if (this.state.gameState.isGameOver) {
|
|
10846
|
-
|
|
10842
|
+
this.stopExecution();
|
|
10843
|
+
return;
|
|
10844
|
+
}
|
|
10845
|
+
if (commandIndex >= commands.length) {
|
|
10846
|
+
this.stopExecution();
|
|
10847
|
+
this.emitRunFinish(this.getCurrentRunResult());
|
|
10848
|
+
return;
|
|
10847
10849
|
}
|
|
10848
10850
|
const command = commands[commandIndex];
|
|
10849
10851
|
this.executeCommand(command);
|
|
10850
|
-
|
|
10851
|
-
this.
|
|
10852
|
-
}
|
|
10853
|
-
this.stopExecution();
|
|
10854
|
-
this.emitRunFinish(this.getCurrentRunResult());
|
|
10852
|
+
commandIndex++;
|
|
10853
|
+
this.setState({ currentCommandIndex: commandIndex });
|
|
10854
|
+
}, stepInterval);
|
|
10855
10855
|
}
|
|
10856
10856
|
executeCommand(command) {
|
|
10857
10857
|
switch (command.type) {
|
|
@@ -13268,18 +13268,17 @@ class DrawingGame extends React.Component {
|
|
|
13268
13268
|
executeCommands(commands) {
|
|
13269
13269
|
var _a;
|
|
13270
13270
|
const stepInterval = (_a = this.props.stepInterval) != null ? _a : 500;
|
|
13271
|
-
|
|
13271
|
+
let commandIndex = 0;
|
|
13272
|
+
this.executionInterval = setInterval(() => {
|
|
13273
|
+
if (commandIndex >= commands.length) {
|
|
13274
|
+
this.stopExecution();
|
|
13275
|
+
return;
|
|
13276
|
+
}
|
|
13272
13277
|
const command = commands[commandIndex];
|
|
13273
13278
|
this.executeCommand(command);
|
|
13274
|
-
|
|
13275
|
-
this.
|
|
13276
|
-
}
|
|
13277
|
-
this.stopExecution();
|
|
13278
|
-
}
|
|
13279
|
-
sleepSync(milliseconds) {
|
|
13280
|
-
if (milliseconds <= 0) {
|
|
13281
|
-
return;
|
|
13282
|
-
}
|
|
13279
|
+
commandIndex++;
|
|
13280
|
+
this.setState({ currentCommandIndex: commandIndex });
|
|
13281
|
+
}, stepInterval);
|
|
13283
13282
|
}
|
|
13284
13283
|
executeCommand(command) {
|
|
13285
13284
|
switch (command.type) {
|