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 * user defined custom block palettes
* PWA, thanks, Joan and John, for pioneering this at Robolot and in Mircoblocks! * PWA, thanks, Joan and John, for pioneering this at Robolot and in Mircoblocks!
* new "blocksZoom=n" url parameter, thanks, Bernat! * 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 "enter" key to key-pressed dropdown
* added "green flag" symbol to message drop-down * added "green flag" symbol to message drop-down
* **Notable Changes:** * **Notable Changes:**
@ -43,6 +43,7 @@
### 2021-10-20 ### 2021-10-20
* blocks: enable sending green-flag events when switching scenes * blocks: enable sending green-flag events when switching scenes
* blocks, objects, gui, threads: removed "When switched to this scene hat block"
### 2021-10-19 ### 2021-10-19
* threads: enable sending green-flag events to specific sprites * 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/symbols.js?version=2021-03-03"></script>
<script src="src/widgets.js?version=2021-07-21"></script> <script src="src/widgets.js?version=2021-07-21"></script>
<script src="src/blocks.js?version=2021-10-20"></script> <script src="src/blocks.js?version=2021-10-20"></script>
<script src="src/threads.js?version=2021-10-19"></script> <script src="src/threads.js?version=2021-10-20"></script>
<script src="src/objects.js?version=2021-10-14"></script> <script src="src/objects.js?version=2021-10-20"></script>
<script src="src/scenes.js?version=2021-10-12"></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/paint.js?version=2021-07-05"></script>
<script src="src/lists.js?version=2021-07-19"></script> <script src="src/lists.js?version=2021-07-19"></script>
<script src="src/byob.js?version=2021-10-14"></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__'; message = '__shout__go__';
} else if (this.selector === 'receiveOnClone') { } else if (this.selector === 'receiveOnClone') {
message = '__clone__init__'; message = '__clone__init__';
} else if (this.selector === 'receiveOnScene') {
message = '__scene__init__';
} else if (inputs[0] instanceof InputSlotMorph) { } else if (inputs[0] instanceof InputSlotMorph) {
message = inputs[0].evaluate(); message = inputs[0].evaluate();
} }

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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