add new blocks

This commit is contained in:
Mario
2020-09-16 14:59:09 +02:00
parent 25134d4d86
commit bbd14c58b5
16 changed files with 780 additions and 5 deletions
+167
View File
@@ -0,0 +1,167 @@
import Blockly from 'blockly/core';
import { getColour } from '../helpers/colour';
Blockly.defineBlocksWithJsonArray([
// BEGIN JSON EXTRACT
{
type: 'variables_get_number',
message0: '= number variable %1',
args0: [
{
type: 'field_variable',
name: 'VAR',
variable: null,
variableTypes: ['Number'],
defaultType: 'Number',
},
],
output: 'Number',
colour: getColour().variables,
tooltip: '',
helpUrl: '',
},
{
type: 'variables_set_number',
message0: 'Number variable %1 = %2',
args0: [
{
type: 'field_variable',
name: 'VAR',
variable: null,
variableTypes: ['Number'],
defaultType: 'Number',
createNewVariable: false,
},
{
type: 'input_value',
name: 'VALUE',
check: 'Number',
},
],
previousStatement: null,
nextStatement: null,
colour: getColour().variables,
tooltip: '',
helpUrl: '',
},
{
type: 'variables_get_colour',
message0: '= color variable %1',
args0: [
{
type: 'field_variable',
name: 'VAR',
variable: null,
variableTypes: ['Colour'],
defaultType: 'Colour',
},
],
output: 'Colour',
colour: getColour().variables,
tooltip: '',
helpUrl: '',
},
{
type: 'variables_set_colour',
message0: 'Color variable %1 = %2',
args0: [
{
type: 'field_variable',
name: 'VAR',
variable: null,
variableTypes: ['Colour'],
defaultType: 'Colour',
},
{
type: 'input_value',
name: 'VALUE',
check: 'Colour',
},
],
previousStatement: null,
nextStatement: null,
colour: getColour().variables,
tooltip: '',
helpUrl: '',
},
{
type: 'variables_get_string',
message0: '= text variable %1',
args0: [
{
type: 'field_variable',
name: 'VAR',
variable: null,
variableTypes: ['String'],
defaultType: 'String',
},
],
output: 'String',
colour: getColour().variables,
tooltip: '',
helpUrl: '',
},
{
type: 'variables_set_string',
message0: 'Text variable %1 = %2',
args0: [
{
type: 'field_variable',
name: 'VAR',
variable: null,
variableTypes: ['String'],
defaultType: 'String',
},
{
type: 'input_value',
name: 'VALUE',
check: 'String',
},
],
previousStatement: null,
nextStatement: null,
colour: getColour().variables,
tooltip: '',
helpUrl: '',
},
{
type: 'variables_get_boolean',
message0: '= boolean variable %1',
args0: [
{
type: 'field_variable',
name: 'VAR',
variable: null,
variableTypes: ['Boolean'],
defaultType: 'Boolean',
},
],
output: 'Boolean',
colour: getColour().variables,
tooltip: '',
helpUrl: '',
},
{
type: 'variables_set_boolean',
message0: 'Boolean variable %1 = %2',
args0: [
{
type: 'field_variable',
name: 'VAR',
variable: null,
variableTypes: ['Boolean'],
defaultType: 'Boolean',
},
{
type: 'input_value',
name: 'VALUE',
check: 'Boolean',
},
],
previousStatement: null,
nextStatement: null,
colour: getColour().variables,
tooltip: '',
helpUrl: '',
},
]); // END JSON EXTRACT (Do not delete this comment.)