blob: d9c756a22732b3bd193288d843341071715291d6 (
plain)
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
|
import '../game_event.dart';
import '../state/game_state.dart';
import 'command_l10n.dart';
class TurnDoneCommand extends Command {
int index = 0;
final String id;
final GameState _gameState;
TurnDoneCommand(this.id, {required GameState gameState})
: _gameState = gameState {
index = 0;
for (int i = 0; i < _gameState.currentList.length; i++) {
if (id == _gameState.currentList[i].id) {
index = i;
break;
}
}
}
@override
void execute() {
RoundMethods.setTurnDone(stateAccess, index);
_gameState.notifyListeners();
}
@override
GameEvent get event => TurnDoneEvent(id);
@override
String describe() {
return commandL10n.cmdTurnDone(id);
}
}
|