mirror of
https://github.com/scratchfoundation/scratch-vm.git
synced 2024-12-24 06:52:40 -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
|
||||
/.travis.yml
|
||||
/.tx
|
||||
-/test
|
||||
/test
|
||||
|
||||
# Build created files
|
||||
/playground
|
||||
|
|
|
@ -23,6 +23,7 @@ class Scratch3DataBlocks {
|
|||
data_listcontents: this.getListContents,
|
||||
data_addtolist: this.addToList,
|
||||
data_deleteoflist: this.deleteOfList,
|
||||
data_deletealloflist: this.deleteAllOfList,
|
||||
data_insertatlist: this.insertAtList,
|
||||
data_replaceitemoflist: this.replaceItemOfList,
|
||||
data_itemoflist: this.getItemOfList,
|
||||
|
@ -136,6 +137,13 @@ class Scratch3DataBlocks {
|
|||
list._monitorUpToDate = false;
|
||||
}
|
||||
|
||||
deleteAllOfList (args, util) {
|
||||
const list = util.target.lookupOrCreateList(
|
||||
args.LIST.id, args.LIST.name);
|
||||
list.value = [];
|
||||
return;
|
||||
}
|
||||
|
||||
insertAtList (args, util) {
|
||||
const item = args.ITEM;
|
||||
const list = util.target.lookupOrCreateList(
|
||||
|
|
|
@ -58,6 +58,10 @@ const ArgumentTypeMap = (() => {
|
|||
map[ArgumentType.BOOLEAN] = {
|
||||
check: 'Boolean'
|
||||
};
|
||||
map[ArgumentType.MATRIX] = {
|
||||
shadowType: 'matrix',
|
||||
fieldType: 'MATRIX'
|
||||
};
|
||||
return map;
|
||||
})();
|
||||
|
||||
|
|
|
@ -26,7 +26,12 @@ const ArgumentType = {
|
|||
/**
|
||||
* String value with text field
|
||||
*/
|
||||
STRING: 'string'
|
||||
STRING: 'string',
|
||||
|
||||
/**
|
||||
* String value with matirx field
|
||||
*/
|
||||
MATRIX: 'matrix'
|
||||
};
|
||||
|
||||
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 () {
|
||||
this._loadedExtensions.forEach(serviceName => {
|
||||
const allPromises = Array.from(this._loadedExtensions.values()).map(serviceName =>
|
||||
dispatch.call(serviceName, 'getInfo')
|
||||
.then(info => {
|
||||
info = this._prepareExtensionInfo(serviceName, info);
|
||||
dispatch.call('runtime', '_refreshExtensionPrimitives', info);
|
||||
})
|
||||
.catch(e => {
|
||||
log.error(`Failed to refresh buildtin extension primitives: ${JSON.stringify(e)}`);
|
||||
});
|
||||
});
|
||||
})
|
||||
);
|
||||
return Promise.all(allPromises);
|
||||
}
|
||||
|
||||
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})
|
||||
.then(() => {
|
||||
log.info('should have connected');
|
||||
this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED);
|
||||
this._connected = true;
|
||||
this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED);
|
||||
this._connectCallback();
|
||||
})
|
||||
.catch(e => {
|
||||
|
|
|
@ -53,8 +53,8 @@ class BTSession extends JSONRPCWebSocket {
|
|||
this.sendRemoteRequest('connect', {peripheralId: id})
|
||||
.then(() => {
|
||||
log.info('should have connected');
|
||||
this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED);
|
||||
this._connected = true;
|
||||
this._runtime.emit(this._runtime.constructor.PERIPHERAL_CONNECTED);
|
||||
this._connectCallback();
|
||||
})
|
||||
.catch(e => {
|
||||
|
|
|
@ -916,12 +916,15 @@ class VirtualMachine extends EventEmitter {
|
|||
* set the current locale and builtin messages for the VM
|
||||
* @param {[type]} locale 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) {
|
||||
if (locale !== formatMessage.setup().locale) {
|
||||
formatMessage.setup({locale: locale, translations: {[locale]: messages}});
|
||||
this.extensionManager.refreshBlocks();
|
||||
if (locale === formatMessage.setup().locale) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
formatMessage.setup({locale: locale, translations: {[locale]: messages}});
|
||||
return this.extensionManager.refreshBlocks();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue