| 123456789101112131415161718192021222324252627 |
- import 'package:gobang/models/game_state.dart';
- class UserContext {
- late GameState _state;
- GameState get state => _state;
- UserContext() {
- _state = StartState(this);
- }
- void play() {
- _state.play();
- }
- bool regretChess() => _state.regretChess();
- bool surrender() => _state.surrender();
- void setState(GameState state) {
- _state = state;
- }
- void reset() {
- _state = StartState(this);
- }
- }
|