@@ -47,7 +47,18 @@ class Circle {
4747 }
4848 this . _sprite = sprites . create ( this . _img )
4949 }
50-
50+ //% group="Properties"
51+ //% blockSetVariable="myCircle"
52+ //% blockCombine block="text"
53+ get text ( ) : string {
54+ return this . _dataText ;
55+ }
56+ //% group="Properties"
57+ //% blockSetVariable="myCircle"
58+ //% blockCombine block="text"
59+ set text ( value : string ) {
60+ this . _dataText = value ;
61+ }
5162 //% group="Properties"
5263 //% blockSetVariable="myCircle"
5364 //% blockCombine block="data number"
@@ -85,18 +96,7 @@ class Circle {
8596 get fillColor ( ) {
8697 return this . _fillColor ;
8798 }
88- //% group="Properties"
89- //% blockSetVariable="myCircle"
90- //% blockCombine block="text"
91- get text ( ) : string {
92- return this . _dataText ;
93- }
94- //% group="Properties"
95- //% blockSetVariable="myCircle"
96- //% blockCombine block="text"
97- set text ( value : string ) {
98- this . _dataText = value ;
99- }
99+
100100 //% group="Properties"
101101 //% blockSetVariable="myCircle"
102102 //% blockCombine block="sprite"
@@ -144,17 +144,17 @@ class CircleList{
144144 _circles : Circle [ ] = [ ]
145145 constructor ( ) {
146146 }
147- //% group="List" weight=89
147+ //% group="List"
148148 //% block="length of array %myCircleList"
149149 length ( ) : number {
150150 return this . _circles . length
151151 }
152- //% group="List" weight=88
152+ //% group="List"
153153 //% block=" reverse %myCircleList"
154154 reverse ( ) {
155155 this . _circles . reverse ( )
156156 }
157- //% group="List" weight=87
157+ //% group="List"
158158 //% block="%myCircleList find index of %value=variables_get(myCircle)"
159159 findIndexOfCircle ( value :Circle ) :number {
160160 for ( let i = 0 ; i < this . length ( ) ; i ++ ) {
@@ -165,23 +165,24 @@ class CircleList{
165165 /*
166166 beginning
167167 */
168- //% group="List Beginning" weight=86
169- //% block="get and remove first circle from %myCircleList"
170- getAndRemoveFirst ( ) :Circle {
171- if ( this . length ( ) > 0 ) {
172- return this . _circles . removeAt ( 0 )
173- }
174- return null ;
175- }
176- //% group="List Beginning" weight=85
168+ //% group="List Beginning"
177169 //% block="%myCircleList remove and destroy first circle"
178170 removeAndDestroyFirst ( ) {
179171 if ( this . length ( ) > 0 ) {
180172 let tmp = this . _circles . removeAt ( 0 )
181173 tmp . destroy ( )
182174 }
183175 }
184- //% group="List Beginning" weight=84
176+ //% group="List Beginning"
177+ //% block="get and remove first circle from %myCircleList"
178+ getAndRemoveFirst ( ) :Circle {
179+ if ( this . length ( ) > 0 ) {
180+ return this . _circles . removeAt ( 0 )
181+ }
182+ return null ;
183+ }
184+
185+ //% group="List Beginning"
185186 //% block="%myCircleList insert %value=variables_get(myCircle) at beginning"
186187 insertCircleToBeginning ( value :Circle ) {
187188 this . _circles . unshift ( value )
@@ -232,15 +233,7 @@ class CircleList{
232233 /*
233234 end
234235 */
235- //% group="List End" weight=80
236- //% block="get and remove last circle from %myCircleList"
237- getAndRemoveLast ( ) :Circle {
238- if ( this . length ( ) > 0 ) {
239- return this . _circles . removeAt ( this . length ( ) - 1 )
240- }
241- return null ;
242- }
243- //% group="List End" weight=79
236+ //% group="List End"
244237 //% block="%myCircleList remove and destroy last circle"
245238 removeAndDestroyLast ( ) {
246239 if ( this . length ( ) > 0 )
@@ -249,7 +242,16 @@ class CircleList{
249242 tmp . destroy ( )
250243 }
251244 }
252- //% group="List End" weight=78
245+ //% group="List End"
246+ //% block="get and remove last circle from %myCircleList"
247+ getAndRemoveLast ( ) :Circle {
248+ if ( this . length ( ) > 0 ) {
249+ return this . _circles . removeAt ( this . length ( ) - 1 )
250+ }
251+ return null ;
252+ }
253+
254+ //% group="List End"
253255 //% block="%myCircleList add %value=variables_get(myCircle) to end"
254256 addCircleToEnd ( value :Circle ) {
255257 this . _circles . push ( value )
0 commit comments