@@ -57,7 +57,7 @@ class Game extends StatefulWidget {
57
57
}
58
58
}
59
59
60
- ///duration for show a line when reseting
60
+ ///duration for show a line when reset
61
61
const _REST_LINE_DURATION = const Duration (milliseconds: 50 );
62
62
63
63
const _LEVEL_MAX = 6 ;
@@ -87,10 +87,10 @@ class GameControl extends State<Game> {
87
87
88
88
///在 [build] 方法中于 [_data] 混合,形成一个新的矩阵
89
89
///[_mask] 矩阵的宽高与 [_data] 一致
90
- ///对于任意的 _shinning [x,y] :
90
+ ///对于任意的 _mask [x,y] :
91
91
/// 如果值为 0,则对 [_data] 没有任何影响
92
92
/// 如果值为 -1,则表示 [_data] 中该行不显示
93
- /// 如果值为 1,则表示 [_data] 中改行高亮
93
+ /// 如果值为 1,则表示 [_data] 中该行高亮
94
94
final List <List <int >> _mask = [];
95
95
96
96
///from 1-6
@@ -154,12 +154,11 @@ class GameControl extends State<Game> {
154
154
for (int i = 0 ; i < GAME_PAD_MATRIX_H ; i++ ) {
155
155
final fall = _current.fall (step: i + 1 );
156
156
if (! fall.isValidInMatrix (_data)) {
157
- sounds.fall ();
158
157
_current = _current.fall (step: i);
159
158
_states = GameStates .drop;
160
159
setState (() {});
161
160
await Future .delayed (const Duration (milliseconds: 100 ));
162
- _mixCurrentIntoData ();
161
+ _mixCurrentIntoData (mixSound : sounds.fall );
163
162
break ;
164
163
}
165
164
}
@@ -187,7 +186,7 @@ class GameControl extends State<Game> {
187
186
Timer _autoFallTimer;
188
187
189
188
///mix current into [_data]
190
- Future <void > _mixCurrentIntoData () async {
189
+ Future <void > _mixCurrentIntoData ({ void mixSound ()} ) async {
191
190
if (_current == null ) {
192
191
return ;
193
192
}
@@ -235,6 +234,7 @@ class GameControl extends State<Game> {
235
234
_level = level <= _LEVEL_MAX && level > _level ? level : _level;
236
235
} else {
237
236
_states = GameStates .mixing;
237
+ if (mixSound != null ) mixSound ();
238
238
_forTable ((i, j) => _mask[i][j] = _current.get (j, i) ?? _mask[i][j]);
239
239
setState (() {});
240
240
await Future .delayed (const Duration (milliseconds: 200 ));
0 commit comments