blob: 546b7ff8d7a84a2f52ab8f56e387fa87c5adb9c6 (
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
|
import '../state/game_state.dart';
import 'command_l10n.dart';
class UnlockSpecialCommand extends Command {
final GameState _gameState;
final String _id;
bool _unlock = true;
UnlockSpecialCommand(this._id, {required GameState gameState})
: _gameState = gameState;
@override
void execute() {
if (_gameState.unlockedClasses.contains(_id)) {
_unlock = false;
ScenarioMethods.clearUnlockedClass(stateAccess, _id);
} else {
ScenarioMethods.unlockClass(stateAccess, _id);
}
}
@override
void onUndo();
@override
String describe() {
if (_unlock) {
return commandL10n.cmdUnlock(_id);
}
return commandL10n.cmdLock(_id);
}
}
|