mumuki-gobstones-runner 2.8.5 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/checker.rb +1 -0
- data/lib/public/local-media/main-procedure.png +0 -0
- data/lib/public/local-media/program.png +0 -0
- data/lib/public/media/ShiftDown.png +0 -0
- data/lib/public/media/ShiftLeft.png +0 -0
- data/lib/public/media/ShiftRight.png +0 -0
- data/lib/public/media/ShiftUp.png +0 -0
- data/lib/render/editor/editor.css +4 -0
- data/lib/render/editor/editor.html.erb +74 -18
- data/lib/version_hook.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8649ceb9e6f82c9af3f51dcd2e043789db0c332dfc5e9527255cc62556a36df7
|
4
|
+
data.tar.gz: 1bd206f906582c08ae1f4d868d101c624acf13e75f44d5a2ff40d72586a20cc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6e614deb4c8f6872f4e46ef40635994b43895f398f40b2c8d6a13aa5e3b88da29ba1b7ff12e7227f7993ca49b651858d57dfba7345414ab8b1bd3e6172845123
|
7
|
+
data.tar.gz: 54e15f720eca89a266dc4c6a7363c7ace0f58f02d5d7f3ead5e20cc92753779f6ed784ad39505f6fb375e5efd75747abd73d2dfb449eb08464140ab9f46a0cae
|
data/lib/checker.rb
CHANGED
@@ -113,6 +113,7 @@ module Gobstones
|
|
113
113
|
return "no_stones" if code == 'cannot-remove-stone'
|
114
114
|
return "out_of_board" if code == 'cannot-move-to'
|
115
115
|
return "unassigned_variable" if code == 'undefined-variable'
|
116
|
+
return "boom_called" if code == 'boom-called'
|
116
117
|
return "wrong_argument_type" if has_wrong_argument_type? code
|
117
118
|
return "wrong_arguments_quantity" if code.include? 'arity-mismatch'
|
118
119
|
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
@@ -5,6 +5,24 @@
|
|
5
5
|
<script src="./hammer.min.js"></script>
|
6
6
|
|
7
7
|
<script>
|
8
|
+
Blockly.FieldImage.prototype.__setValue__ = Blockly.FieldImage.prototype.setValue;
|
9
|
+
Blockly.FieldImage.prototype.setValue = function(a) {
|
10
|
+
if (a && a.startsWith("undefined")) {
|
11
|
+
console.debug(`Ignoring unavailable image ${a}`);
|
12
|
+
} else {
|
13
|
+
this.__setValue__(a);
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
Blockly.FieldImage.prototype.__setTooltip__ = Blockly.FieldImage.prototype.setTooltip;
|
18
|
+
Blockly.FieldImage.prototype.setTooltip = function(a) {
|
19
|
+
try {
|
20
|
+
this.__setTooltip__(a);
|
21
|
+
} catch (_e) {
|
22
|
+
console.debug('Could not set tooltip');
|
23
|
+
}
|
24
|
+
}
|
25
|
+
|
8
26
|
function postpone(action) {
|
9
27
|
return setTimeout(action, 50);
|
10
28
|
}
|
@@ -115,10 +133,28 @@
|
|
115
133
|
this._scrollToMainBlock();
|
116
134
|
},
|
117
135
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
136
|
+
/**
|
137
|
+
* Configures a custom toolbox using a toolbox url
|
138
|
+
* This method does nothing if editor is read-only, but
|
139
|
+
* assumes a gs-toolbox element is present - otherwise it would
|
140
|
+
* have no sense to have a toolboxUrl.
|
141
|
+
*/
|
142
|
+
configureCustomToolboxFromUrl(toolboxUrl) {
|
143
|
+
if (this.readOnly) return;
|
144
|
+
|
145
|
+
console.debug('Configuring custom toolbox');
|
146
|
+
|
147
|
+
$.get(toolboxUrl, (toolboxXml) => {
|
148
|
+
this._initializeCustomToolboxBlocklyWorkspace(toolboxXml);
|
149
|
+
});
|
150
|
+
},
|
151
|
+
|
152
|
+
/**
|
153
|
+
* Wether a custom toolbox is required. Read only editors and gs-toolbox-less context
|
154
|
+
* don't require it
|
155
|
+
*/
|
156
|
+
hasCustomToolbox() {
|
157
|
+
return !this.readOnly && $('gs-toolbox').length;
|
122
158
|
},
|
123
159
|
|
124
160
|
compile(code) {
|
@@ -129,10 +165,6 @@
|
|
129
165
|
return this._getBlockly().initialXml.indexOf("block type=\"InteractiveProgram\"") !== -1;
|
130
166
|
},
|
131
167
|
|
132
|
-
hasCustomToolbox() {
|
133
|
-
return $('gs-toolbox').length;
|
134
|
-
},
|
135
|
-
|
136
168
|
toggleInteractiveMode() {
|
137
169
|
this.$exerciseContainer.toggleClass('play-mode');
|
138
170
|
this._triggerResize();
|
@@ -191,12 +223,7 @@
|
|
191
223
|
_configureBlocklyBehavior() {
|
192
224
|
this._setTeacherActions();
|
193
225
|
this._setGameActions();
|
194
|
-
|
195
|
-
// Blockly's workspace is destroyed when toolbox changes, so it doesn't make sense to initialize it here.
|
196
|
-
if (!this.hasCustomToolbox()) {
|
197
|
-
this._initializeBlocklyWorkspace();
|
198
|
-
}
|
199
|
-
|
226
|
+
this._initializeNonCustomToolboxBlocklyWorkspace();
|
200
227
|
this._registerLayoutChangedEvent();
|
201
228
|
},
|
202
229
|
|
@@ -208,7 +235,34 @@
|
|
208
235
|
$(window).resize(() => this._relocateTrash());
|
209
236
|
},
|
210
237
|
|
238
|
+
|
239
|
+
/**
|
240
|
+
* Initializes a workspace using a custom toolbox.
|
241
|
+
*
|
242
|
+
* Blockly's workspace is destroyed when toolbox changes, so initialization
|
243
|
+
* is performed here
|
244
|
+
*/
|
245
|
+
_initializeCustomToolboxBlocklyWorkspace(toolboxXml) {
|
246
|
+
this._getBlockly().toolbox = { defaultToolbox: toolboxXml };
|
247
|
+
this._initializeBlocklyWorkspace();
|
248
|
+
},
|
249
|
+
|
250
|
+
/**
|
251
|
+
* Initializes a workspace using a non-custom toolbox.
|
252
|
+
*
|
253
|
+
* Blockly's workspace is destroyed when toolbox changes,
|
254
|
+
* so this method will initialize it only if a there is a custom toolbox
|
255
|
+
* that will be called later.
|
256
|
+
*/
|
257
|
+
_initializeNonCustomToolboxBlocklyWorkspace() {
|
258
|
+
if (!this.hasCustomToolbox()) {
|
259
|
+
this._initializeBlocklyWorkspace();
|
260
|
+
}
|
261
|
+
},
|
262
|
+
|
211
263
|
_initializeBlocklyWorkspace() {
|
264
|
+
console.debug('Initializing Blockly Workspace');
|
265
|
+
|
212
266
|
this._setInitialXml();
|
213
267
|
this._initializeWorkspace();
|
214
268
|
this._subscribeToWorkspace(() => this._updateSolution());
|
@@ -945,10 +999,12 @@
|
|
945
999
|
},
|
946
1000
|
|
947
1001
|
_setEditorToolbox: function () {
|
948
|
-
const editor = $("mu-gobstones-custom-editor")[0];
|
949
|
-
|
950
|
-
|
951
|
-
|
1002
|
+
const $editor = $("mu-gobstones-custom-editor")[0];
|
1003
|
+
|
1004
|
+
// there is no editor to configure
|
1005
|
+
if (!$editor) return;
|
1006
|
+
|
1007
|
+
$editor.configureCustomToolboxFromUrl(this.toolboxUrl);
|
952
1008
|
}
|
953
1009
|
});
|
954
1010
|
</script>
|
data/lib/version_hook.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mumuki-gobstones-runner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rodrigo Alfonso
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2020-10-
|
12
|
+
date: 2020-10-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: gobstones-board
|