mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 23:12:24 -05:00
Merge branch 'develop' into loadCostume
This commit is contained in:
commit
004f38190a
9 changed files with 117 additions and 124 deletions
|
@ -6,7 +6,7 @@
|
||||||
/.github
|
/.github
|
||||||
/.travis.yml
|
/.travis.yml
|
||||||
/.tx
|
/.tx
|
||||||
-/test
|
/test
|
||||||
|
|
||||||
# Build created files
|
# Build created files
|
||||||
/playground
|
/playground
|
||||||
|
|
|
@ -23,6 +23,7 @@ class Scratch3DataBlocks {
|
||||||
data_listcontents: this.getListContents,
|
data_listcontents: this.getListContents,
|
||||||
data_addtolist: this.addToList,
|
data_addtolist: this.addToList,
|
||||||
data_deleteoflist: this.deleteOfList,
|
data_deleteoflist: this.deleteOfList,
|
||||||
|
data_deletealloflist: this.deleteAllOfList,
|
||||||
data_insertatlist: this.insertAtList,
|
data_insertatlist: this.insertAtList,
|
||||||
data_replaceitemoflist: this.replaceItemOfList,
|
data_replaceitemoflist: this.replaceItemOfList,
|
||||||
data_itemoflist: this.getItemOfList,
|
data_itemoflist: this.getItemOfList,
|
||||||
|
@ -136,6 +137,13 @@ class Scratch3DataBlocks {
|
||||||
list._monitorUpToDate = false;
|
list._monitorUpToDate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
deleteAllOfList (args, util) {
|
||||||
|
const list = util.target.lookupOrCreateList(
|
||||||
|
args.LIST.id, args.LIST.name);
|
||||||
|
list.value = [];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
insertAtList (args, util) {
|
insertAtList (args, util) {
|
||||||
const item = args.ITEM;
|
const item = args.ITEM;
|
||||||
const list = util.target.lookupOrCreateList(
|
const list = util.target.lookupOrCreateList(
|
||||||
|
|
|
@ -58,6 +58,10 @@ const ArgumentTypeMap = (() => {
|
||||||
map[ArgumentType.BOOLEAN] = {
|
map[ArgumentType.BOOLEAN] = {
|
||||||
check: 'Boolean'
|
check: 'Boolean'
|
||||||
};
|
};
|
||||||
|
map[ArgumentType.MATRIX] = {
|
||||||
|
shadowType: 'matrix',
|
||||||
|
fieldType: 'MATRIX'
|
||||||
|
};
|
||||||
return map;
|
return map;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,12 @@ const ArgumentType = {
|
||||||
/**
|
/**
|
||||||
* String value with text field
|
* String value with text field
|
||||||
*/
|
*/
|
||||||
STRING: 'string'
|
STRING: 'string',
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String value with matirx field
|
||||||
|
*/
|
||||||
|
MATRIX: 'matrix'
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = ArgumentType;
|
module.exports = ArgumentType;
|
||||||
|
|
|
@ -144,18 +144,21 @@ class ExtensionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* regenerate blockinfo for any loaded extensions
|
* Regenerate blockinfo for any loaded extensions
|
||||||
|
* @returns {Promise} resolved once all the extensions have been reinitialized
|
||||||
*/
|
*/
|
||||||
refreshBlocks () {
|
refreshBlocks () {
|
||||||
this._loadedExtensions.forEach(serviceName => {
|
const allPromises = Array.from(this._loadedExtensions.values()).map(serviceName =>
|
||||||
dispatch.call(serviceName, 'getInfo')
|
dispatch.call(serviceName, 'getInfo')
|
||||||
.then(info => {
|
.then(info => {
|
||||||
|
info = this._prepareExtensionInfo(serviceName, info);
|
||||||
dispatch.call('runtime', '_refreshExtensionPrimitives', info);
|
dispatch.call('runtime', '_refreshExtensionPrimitives', info);
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
log.error(`Failed to refresh buildtin extension primitives: ${JSON.stringify(e)}`);
|
log.error(`Failed to refresh buildtin extension primitives: ${JSON.stringify(e)}`);
|
||||||
});
|
})
|
||||||
});
|
);
|
||||||
|
return Promise.all(allPromises);
|
||||||
}
|
}
|
||||||
|
|
||||||
allocateWorker () {
|
allocateWorker () {
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -51,8 +51,8 @@ class BLESession extends JSONRPCWebSocket {
|
||||||
this.sendRemoteRequest('connect', {peripheralId: id})
|
this.sendRemoteRequest('connect', {peripheralId: id})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
log.info('should have connected');
|
log.info('should have connected');
|
||||||
this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED);
|
|
||||||
this._connected = true;
|
this._connected = true;
|
||||||
|
this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED);
|
||||||
this._connectCallback();
|
this._connectCallback();
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
|
|
|
@ -53,8 +53,8 @@ class BTSession extends JSONRPCWebSocket {
|
||||||
this.sendRemoteRequest('connect', {peripheralId: id})
|
this.sendRemoteRequest('connect', {peripheralId: id})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
log.info('should have connected');
|
log.info('should have connected');
|
||||||
this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED);
|
|
||||||
this._connected = true;
|
this._connected = true;
|
||||||
|
this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED);
|
||||||
this._connectCallback();
|
this._connectCallback();
|
||||||
})
|
})
|
||||||
.catch(e => {
|
.catch(e => {
|
||||||
|
|
|
@ -916,12 +916,15 @@ class VirtualMachine extends EventEmitter {
|
||||||
* set the current locale and builtin messages for the VM
|
* set the current locale and builtin messages for the VM
|
||||||
* @param {[type]} locale current locale
|
* @param {[type]} locale current locale
|
||||||
* @param {[type]} messages builtin messages map for current locale
|
* @param {[type]} messages builtin messages map for current locale
|
||||||
|
* @returns {Promise} Promise that resolves when all the blocks have been
|
||||||
|
* updated for a new locale (or empty if locale hasn't changed.)
|
||||||
*/
|
*/
|
||||||
setLocale (locale, messages) {
|
setLocale (locale, messages) {
|
||||||
if (locale !== formatMessage.setup().locale) {
|
if (locale === formatMessage.setup().locale) {
|
||||||
formatMessage.setup({locale: locale, translations: {[locale]: messages}});
|
return Promise.resolve();
|
||||||
this.extensionManager.refreshBlocks();
|
|
||||||
}
|
}
|
||||||
|
formatMessage.setup({locale: locale, translations: {[locale]: messages}});
|
||||||
|
return this.extensionManager.refreshBlocks();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue