Line data Source code
1 : import 'package:fast_immutable_collections/fast_immutable_collections.dart';
2 : import 'package:freezed_annotation/freezed_annotation.dart';
3 : import 'package:redfire/types.dart';
4 : import 'package:ws_game_server_types/ws_game_server_types.dart';
5 :
6 : import 'background/barriers.dart';
7 :
8 : part 'game_state.freezed.dart';
9 : part 'game_state.g.dart';
10 :
11 : @freezed
12 : class GameState with _$GameState, ReduxState {
13 : static const String className = 'GameState';
14 :
15 1 : const GameState._();
16 : factory GameState(
17 : {required Barriers barriers,
18 : required ISet<String> otherPlayerIds,
19 : required IMap<String, IList<Double2>> playerPaths}) = _GameState;
20 :
21 2 : factory GameState.init() => GameState(
22 1 : barriers: Barriers(),
23 1 : otherPlayerIds: ISet(const {}),
24 1 : playerPaths: IMap<String, IList<Double2>>(),
25 : );
26 :
27 0 : factory GameState.fromJson(Map<String, Object?> json) =>
28 0 : _$GameStateFromJson(json);
29 :
30 0 : @override
31 : String get typeName => className;
32 : }
|