-
Notifications
You must be signed in to change notification settings - Fork 479
/
levels.js
146 lines (137 loc) · 5.1 KB
/
levels.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
import msg from '@cdo/applab/locale';
import * as utils from '../utils';
import blockUtils from '../block_utils';
import { ApplabBlocks } from '@cdo/apps/applab/sharedApplabBlocks';
import { ApplabGoalBlocks } from '@cdo/apps/applab/sharedApplabGoalBlocks';
var tb = blockUtils.createToolbox;
var blockOfType = blockUtils.blockOfType;
var createCategory = blockUtils.createCategory;
/*
* Configuration for all levels.
*/
var levels = {};
export default levels;
levels.simple = {
'requiredBlocks': [
],
'scale': {
'snapRadius': 2
},
'freePlay': true,
'toolbox':
tb('<block type="applab_container" inline="true"> \
<value name="ID"><block type="text"><title name="TEXT">id</title></block></value> \
<value name="HTML"><block type="text"><title name="TEXT">html</title></block></value></block>'),
'startBlocks':
'<block type="when_run" deletable="false" x="20" y="20"></block>'
};
levels.custom = {
'freePlay': true,
'editCode': true,
'sliderSpeed': 1,
/**
* This is the default set of functions available to us if the levelbuilder
* leaves codeFunctions blank.
* They are defined in Applab.rb, and generated into a static JS file via
* generateSharedConstants.rb
*/
'codeFunctions': ApplabBlocks
// "randomNumber_max": null, // DEPRECATED
};
levels.ec_simple = utils.extend(levels.custom, {
});
levels.ec_goals = utils.extend(levels.custom, {
'codeFunctions': {...ApplabBlocks, ...ApplabGoalBlocks}
});
// Functions in Advanced category currently disabled in all levels:
/*
"imageUploadButton": null,
"container": null,
"innerHTML": null,
"setStyle": null,
"getAttribute": null,
"setAttribute": null,
"setParent": null,
*/
levels.full_sandbox = {
'scrollbars' : true,
'requiredBlocks': [
],
'scale': {
'snapRadius': 2
},
'softButtons': [
'leftButton',
'rightButton',
'downButton',
'upButton'
],
'minWorkspaceHeight': 1400,
'freePlay': true,
'toolbox':
tb(createCategory(
msg.catActions(),
'<block type="applab_createHtmlBlock" inline="true"> \
<value name="ID"><block type="text"><title name="TEXT">id</title></block></value> \
<value name="HTML"><block type="text"><title name="TEXT">html</title></block></value></block>') +
createCategory(msg.catControl(),
blockOfType('controls_whileUntil') +
'<block type="controls_for"> \
<value name="FROM"> \
<block type="math_number"> \
<title name="NUM">1</title> \
</block> \
</value> \
<value name="TO"> \
<block type="math_number"> \
<title name="NUM">10</title> \
</block> \
</value> \
<value name="BY"> \
<block type="math_number"> \
<title name="NUM">1</title> \
</block> \
</value> \
</block>' +
blockOfType('controls_flow_statements')) +
createCategory(msg.catLogic(),
blockOfType('controls_if') +
blockOfType('logic_compare') +
blockOfType('logic_operation') +
blockOfType('logic_negate') +
blockOfType('logic_boolean')) +
createCategory(msg.catMath(),
blockOfType('math_number') +
'<block type="math_change"> \
<value name="DELTA"> \
<block type="math_number"> \
<title name="NUM">1</title> \
</block> \
</value> \
</block>' +
'<block type="math_random_int"> \
<value name="FROM"> \
<block type="math_number"> \
<title name="NUM">1</title> \
</block> \
</value> \
<value name="TO"> \
<block type="math_number"> \
<title name="NUM">100</title> \
</block> \
</value> \
</block>' +
blockOfType('math_arithmetic')) +
createCategory(msg.catText(),
blockOfType('text') +
blockOfType('text_join') +
'<block type="text_append"> \
<value name="TEXT"> \
<block type="text"></block> \
</value> \
</block>') +
createCategory(msg.catVariables(), '', 'VARIABLE') +
createCategory(msg.catProcedures(), '', 'PROCEDURE')),
'startBlocks':
'<block type="when_run" deletable="false" x="20" y="20"></block>'
};