kopia lustrzana https://github.com/backface/turtlestitch
refactored STOP
rodzic
09071850a6
commit
3bc54b45e3
|
|
@ -14,6 +14,9 @@
|
||||||
* **Translation Updates:**
|
* **Translation Updates:**
|
||||||
* German
|
* German
|
||||||
|
|
||||||
|
### 2022-03-04
|
||||||
|
* scenes, objects, threads, gui: refactored STOP
|
||||||
|
|
||||||
### 2022-03-03
|
### 2022-03-03
|
||||||
* SciSnap2 extension update (FFT), thanks, Eckart!
|
* SciSnap2 extension update (FFT), thanks, Eckart!
|
||||||
* threads: removed experimental code
|
* threads: removed experimental code
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ BlockVisibilityDialogMorph, ThreadManager*/
|
||||||
|
|
||||||
// Global stuff ////////////////////////////////////////////////////////
|
// Global stuff ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
modules.gui = '2022-March-03';
|
modules.gui = '2022-March-04';
|
||||||
|
|
||||||
// Declarations
|
// Declarations
|
||||||
|
|
||||||
|
|
@ -688,7 +688,7 @@ IDE_Morph.prototype.openIn = function (world) {
|
||||||
|
|
||||||
world.keyboardFocus = this.stage;
|
world.keyboardFocus = this.stage;
|
||||||
this.warnAboutIE();
|
this.warnAboutIE();
|
||||||
this.warnAboutDev();
|
// this.warnAboutDev();
|
||||||
};
|
};
|
||||||
|
|
||||||
// IDE_Morph construction
|
// IDE_Morph construction
|
||||||
|
|
@ -2836,7 +2836,6 @@ IDE_Morph.prototype.stopAllScripts = function () {
|
||||||
this.scene.stop();
|
this.scene.stop();
|
||||||
}
|
}
|
||||||
this.controlBar.stopButton.refresh();
|
this.controlBar.stopButton.refresh();
|
||||||
this.stage.fireStopAllEvent();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
IDE_Morph.prototype.selectSprite = function (sprite, noEmptyRefresh) {
|
IDE_Morph.prototype.selectSprite = function (sprite, noEmptyRefresh) {
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,7 @@ BlockVisibilityDialogMorph, CostumeIconMorph, SoundIconMorph*/
|
||||||
|
|
||||||
/*jshint esversion: 6*/
|
/*jshint esversion: 6*/
|
||||||
|
|
||||||
modules.objects = '2022-March-01';
|
modules.objects = '2022-March-04';
|
||||||
|
|
||||||
var SpriteMorph;
|
var SpriteMorph;
|
||||||
var StageMorph;
|
var StageMorph;
|
||||||
|
|
@ -8661,7 +8661,7 @@ StageMorph.prototype.fireKeyEvent = function (key) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (evt === 'esc' && !ide.isAppMode) {
|
if (evt === 'esc' && !ide.isAppMode) {
|
||||||
return this.fireStopAllEvent();
|
return ide.stopAllScripts();
|
||||||
}
|
}
|
||||||
this.children.concat(this).forEach(morph => {
|
this.children.concat(this).forEach(morph => {
|
||||||
if (isSnapObject(morph)) {
|
if (isSnapObject(morph)) {
|
||||||
|
|
@ -8768,33 +8768,6 @@ StageMorph.prototype.fireGreenFlagEvent = function () {
|
||||||
return procs;
|
return procs;
|
||||||
};
|
};
|
||||||
|
|
||||||
StageMorph.prototype.fireStopAllEvent = function () { // +++
|
|
||||||
var ide = this.parentThatIsA(IDE_Morph);
|
|
||||||
|
|
||||||
this.threads.resumeAll(this.stage);
|
|
||||||
|
|
||||||
// experimental: run one step of a user-defined script
|
|
||||||
this.runStopScripts();
|
|
||||||
|
|
||||||
this.keysPressed = {};
|
|
||||||
this.threads.stopAll();
|
|
||||||
this.stopAllActiveSounds();
|
|
||||||
this.children.forEach(morph => {
|
|
||||||
if (morph.stopTalking) {
|
|
||||||
morph.stopTalking();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
this.removeAllClones();
|
|
||||||
if (ide) {
|
|
||||||
ide.nextSteps([
|
|
||||||
nop,
|
|
||||||
() => this.stopAllActiveSounds(), // catch forever loops
|
|
||||||
() => this.stopProjection(),
|
|
||||||
() => ide.controlBar.pauseButton.refresh()
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
StageMorph.prototype.runStopScripts = function () {
|
StageMorph.prototype.runStopScripts = function () {
|
||||||
// experimental: Allow each sprite to run one last step before termination
|
// experimental: Allow each sprite to run one last step before termination
|
||||||
// usage example: Stop a robot or device associated with the sprite
|
// usage example: Stop a robot or device associated with the sprite
|
||||||
|
|
|
||||||
|
|
@ -47,13 +47,13 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*global modules, VariableFrame, StageMorph, SpriteMorph, Process, List,
|
/*global modules, VariableFrame, StageMorph, SpriteMorph, Process, List,
|
||||||
normalizeCanvas, SnapSerializer, Costume, ThreadManager*/
|
normalizeCanvas, SnapSerializer, Costume, ThreadManager, IDE_Morph*/
|
||||||
|
|
||||||
/*jshint esversion: 6*/
|
/*jshint esversion: 6*/
|
||||||
|
|
||||||
// Global stuff ////////////////////////////////////////////////////////
|
// Global stuff ////////////////////////////////////////////////////////
|
||||||
|
|
||||||
modules.scenes = '2022-March-03';
|
modules.scenes = '2022-March-04';
|
||||||
|
|
||||||
// Projecct /////////////////////////////////////////////////////////
|
// Projecct /////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
|
@ -226,10 +226,30 @@ Scene.prototype.updateTrash = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
Scene.prototype.stop = function (forGood) {
|
Scene.prototype.stop = function (forGood) {
|
||||||
if (this.stage.enableCustomHatBlocks) {
|
var ide;
|
||||||
|
if (this.stage.enableCustomHatBlocks || forGood) {
|
||||||
this.stage.threads.pauseCustomHatBlocks = forGood ? true
|
this.stage.threads.pauseCustomHatBlocks = forGood ? true
|
||||||
: !this.stage.threads.pauseCustomHatBlocks;
|
: !this.stage.threads.pauseCustomHatBlocks;
|
||||||
} else {
|
} else {
|
||||||
this.stage.threads.pauseCustomHatBlocks = false;
|
this.stage.threads.pauseCustomHatBlocks = false;
|
||||||
}
|
}
|
||||||
|
this.stage.stopAllActiveSounds();
|
||||||
|
this.stage.threads.resumeAll(this.stage);
|
||||||
|
this.stage.keysPressed = {};
|
||||||
|
this.stage.runStopScripts();
|
||||||
|
this.stage.threads.stopAll();
|
||||||
|
if (this.stage.projectionSource) {
|
||||||
|
this.stage.stopProjection();
|
||||||
|
}
|
||||||
|
this.stage.children.forEach(morph => {
|
||||||
|
if (morph.stopTalking) {
|
||||||
|
morph.stopTalking();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
this.stage.removeAllClones();
|
||||||
|
ide = this.stage.parentThatIsA(IDE_Morph);
|
||||||
|
if (ide) {
|
||||||
|
ide.controlBar.pauseButton.refresh();
|
||||||
|
ide.controlBar.stopButton.refresh();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,7 @@ SnapExtensions, AlignmentMorph, TextMorph, Cloud, HatBlockMorph*/
|
||||||
|
|
||||||
/*jshint esversion: 6*/
|
/*jshint esversion: 6*/
|
||||||
|
|
||||||
modules.threads = '2022-March-03';
|
modules.threads = '2022-March-04';
|
||||||
|
|
||||||
var ThreadManager;
|
var ThreadManager;
|
||||||
var Process;
|
var Process;
|
||||||
|
|
@ -2442,37 +2442,11 @@ Process.prototype.doStop = function () {
|
||||||
this.stop();
|
this.stop();
|
||||||
};
|
};
|
||||||
|
|
||||||
Process.prototype.doStopAll = function (forGood) {
|
Process.prototype.doStopAll = function () {
|
||||||
var stage, ide;
|
var ide;
|
||||||
if (this.homeContext.receiver) {
|
if (this.homeContext.receiver) {
|
||||||
stage = this.homeContext.receiver.parentThatIsA(StageMorph);
|
ide = this.homeContext.receiver.parentThatIsA(IDE_Morph);
|
||||||
if (stage) {
|
ide.scene.stop();
|
||||||
if (stage.enableCustomHatBlocks) {
|
|
||||||
stage.threads.pauseCustomHatBlocks = forGood ? true
|
|
||||||
: !stage.threads.pauseCustomHatBlocks;
|
|
||||||
} else {
|
|
||||||
stage.threads.pauseCustomHatBlocks = false;
|
|
||||||
}
|
|
||||||
stage.stopAllActiveSounds();
|
|
||||||
stage.threads.resumeAll(stage);
|
|
||||||
stage.keysPressed = {};
|
|
||||||
stage.runStopScripts();
|
|
||||||
stage.threads.stopAll();
|
|
||||||
if (stage.projectionSource) {
|
|
||||||
stage.stopProjection();
|
|
||||||
}
|
|
||||||
stage.children.forEach(morph => {
|
|
||||||
if (morph.stopTalking) {
|
|
||||||
morph.stopTalking();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
stage.removeAllClones();
|
|
||||||
}
|
|
||||||
ide = stage.parentThatIsA(IDE_Morph);
|
|
||||||
if (ide) {
|
|
||||||
ide.controlBar.pauseButton.refresh();
|
|
||||||
ide.controlBar.stopButton.refresh();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -2480,13 +2454,8 @@ Process.prototype.doStopAllScenes = function () {
|
||||||
var ide;
|
var ide;
|
||||||
if (this.homeContext.receiver) {
|
if (this.homeContext.receiver) {
|
||||||
ide = this.homeContext.receiver.parentThatIsA(IDE_Morph);
|
ide = this.homeContext.receiver.parentThatIsA(IDE_Morph);
|
||||||
ide.scenes.map(scn => {
|
ide.scenes.map(scn => scn.stop(true));
|
||||||
if (scn !== ide.scene) {
|
|
||||||
scn.stop(true);
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
|
||||||
this.doStopAll(true);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Process.prototype.doStopThis = function (choice) {
|
Process.prototype.doStopThis = function (choice) {
|
||||||
|
|
|
||||||
Ładowanie…
Reference in New Issue