removed "When switched to this scene hat block"

snap7
jmoenig 2021-10-20 16:50:14 +02:00
rodzic 52473cfb4e
commit bd58ec1f40
6 zmienionych plików z 39 dodań i 41 usunięć

Wyświetl plik

@ -11,7 +11,7 @@
* user defined custom block palettes
* PWA, thanks, Joan and John, for pioneering this at Robolot and in Mircoblocks!
* new "blocksZoom=n" url parameter, thanks, Bernat!
* message, key and scene hat blocks can be expanded to show an optional upvar referencing their event data
* message and key hat blocks can be expanded to show an optional upvar referencing their event data
* added "enter" key to key-pressed dropdown
* added "green flag" symbol to message drop-down
* **Notable Changes:**
@ -43,6 +43,7 @@
### 2021-10-20
* blocks: enable sending green-flag events when switching scenes
* blocks, objects, gui, threads: removed "When switched to this scene hat block"
### 2021-10-19
* threads: enable sending green-flag events to specific sprites

Wyświetl plik

@ -17,10 +17,10 @@
<script src="src/symbols.js?version=2021-03-03"></script>
<script src="src/widgets.js?version=2021-07-21"></script>
<script src="src/blocks.js?version=2021-10-20"></script>
<script src="src/threads.js?version=2021-10-19"></script>
<script src="src/objects.js?version=2021-10-14"></script>
<script src="src/threads.js?version=2021-10-20"></script>
<script src="src/objects.js?version=2021-10-20"></script>
<script src="src/scenes.js?version=2021-10-12"></script>
<script src="src/gui.js?version=2021-10-14"></script>
<script src="src/gui.js?version=2021-10-20"></script>
<script src="src/paint.js?version=2021-07-05"></script>
<script src="src/lists.js?version=2021-07-19"></script>
<script src="src/byob.js?version=2021-10-14"></script>

Wyświetl plik

@ -3177,8 +3177,6 @@ BlockMorph.prototype.showMessageUsers = function () {
message = '__shout__go__';
} else if (this.selector === 'receiveOnClone') {
message = '__clone__init__';
} else if (this.selector === 'receiveOnScene') {
message = '__scene__init__';
} else if (inputs[0] instanceof InputSlotMorph) {
message = inputs[0].evaluate();
}

Wyświetl plik

@ -85,7 +85,7 @@ Animation, BoxMorph, BlockDialogMorph, RingMorph, Project, ZERO, BLACK*/
// Global stuff ////////////////////////////////////////////////////////
modules.gui = '2021-October-14';
modules.gui = '2021-October-20';
// Declarations
@ -5830,7 +5830,9 @@ IDE_Morph.prototype.switchToScene = function (scene, refreshAlbum, msg) {
}
this.toggleAppMode(appMode);
this.world().keyboardFocus = this.stage;
this.stage.fireChangeOfSceneEvent(msg);
if (msg) {
this.stage.fireChangeOfSceneEvent(msg);
}
};
IDE_Morph.prototype.setURL = function (str) {

Wyświetl plik

@ -87,7 +87,7 @@ BlockVisibilityDialogMorph*/
/*jshint esversion: 6*/
modules.objects = '2021-October-14';
modules.objects = '2021-October-20';
var SpriteMorph;
var StageMorph;
@ -907,11 +907,6 @@ SpriteMorph.prototype.initBlocks = function () {
},
// Scenes
receiveOnScene: {
type: 'hat',
category: 'control',
spec: 'when switched to this scene %message'
},
doSwitchToScene: {
type: 'command',
category: 'control',
@ -2557,7 +2552,6 @@ SpriteMorph.prototype.blockTemplates = function (
blocks.push(block('newClone'));
blocks.push(block('removeClone'));
blocks.push('-');
blocks.push(block('receiveOnScene'));
blocks.push(block('doSwitchToScene'));
blocks.push('-');
blocks.push(block('doPauseAll'));
@ -6095,8 +6089,7 @@ SpriteMorph.prototype.allHatBlocksFor = function (message) {
return event === message
|| (event instanceof Array
&& message !== '__shout__go__'
&& message !== '__clone__init__'
&& message !== '__scene__init__');
&& message !== '__clone__init__');
}
if (sel === 'receiveGo') {
return message === '__shout__go__';
@ -6104,9 +6097,6 @@ SpriteMorph.prototype.allHatBlocksFor = function (message) {
if (sel === 'receiveOnClone') {
return message === '__clone__init__';
}
if (sel === 'receiveOnScene') {
return message === '__scene__init__';
}
}
return false;
});
@ -8472,24 +8462,32 @@ StageMorph.prototype.fireChangeOfSceneEvent = function (message) {
this.children.concat(this).forEach(morph => {
if (isSnapObject(morph)) {
morph.allHatBlocksFor('__scene__init__').forEach(block => {
var varName = block.inputs()[0].evaluate()[0],
varFrame;
if (varName) {
varFrame = new VariableFrame();
varFrame.addVar(varName, isNil(message) ? '' : message);
morph.allHatBlocksFor(message).forEach(block => {
var varName, varFrame;
if (block.selector === 'receiveMessage') {
varName = block.inputs()[1].evaluate()[0];
if (varName) {
varFrame = new VariableFrame();
varFrame.addVar(varName, message);
}
procs.push(this.threads.startProcess(
block,
morph,
this.isThreadSafe,
null, // exportResult (bool)
null, // callback
null, // isClicked
null, // rightAway
null, // atomic
varFrame
));
} else {
procs.push(this.threads.startProcess(
block,
morph,
this.isThreadSafe
));
}
procs.push(this.threads.startProcess(
block,
morph,
this.isThreadSafe,
null, // exportResult (bool)
null, // callback
null, // isClicked
null, // rightAway
null, // atomic
varFrame
));
});
}
});
@ -8799,7 +8797,6 @@ StageMorph.prototype.blockTemplates = function (
blocks.push(block('createClone'));
blocks.push(block('newClone'));
blocks.push('-');
blocks.push(block('receiveOnScene'));
blocks.push(block('doSwitchToScene'));
blocks.push('-');
blocks.push(block('doPauseAll'));

Wyświetl plik

@ -64,7 +64,7 @@ SnapExtensions, AlignmentMorph, TextMorph, Cloud*/
/*jshint esversion: 6*/
modules.threads = '2021-October-19';
modules.threads = '2021-October-20';
var ThreadManager;
var Process;
@ -4700,11 +4700,11 @@ Process.prototype.goToLayer = function (name) {
Process.prototype.doSwitchToScene = function (id, transmission) {
var rcvr = this.blockReceiver(),
idx = 0,
message = transmission.at(1),
message = this.inputOption(transmission.at(1)),
ide, scenes, num, scene;
this.assertAlive(rcvr);
this.assertType(message, ['text', 'number']);
if (this.readyToTerminate || this.topBlock.selector === 'receiveOnScene') {
if (this.readyToTerminate) {
// let the user press "stop" or "esc",
// prevent "when this scene starts" hat blocks from directly
// switching to another