44 lines
1.0 KiB
Dart
44 lines
1.0 KiB
Dart
import 'package:uuid/uuid.dart';
|
|
|
|
class PlayerInfo {
|
|
final UuidValue? playerID;
|
|
final UuidValue? lobbyID;
|
|
final String? passphrase;
|
|
|
|
const PlayerInfo({
|
|
required this.playerID,
|
|
required this.lobbyID,
|
|
required this.passphrase,
|
|
});
|
|
|
|
factory PlayerInfo.fromJson(Map<String, dynamic> json) {
|
|
final playerid = UuidValue(json['playerID']);
|
|
final lobbyid = UuidValue(json['lobbyID']);
|
|
final passphrase = json['passphrase'];
|
|
|
|
return PlayerInfo(
|
|
playerID: playerid, lobbyID: lobbyid, passphrase: passphrase);
|
|
}
|
|
|
|
Map<String, dynamic> toJson() => {
|
|
'playerID': playerID,
|
|
'lobbyID': lobbyID,
|
|
'passphrase': passphrase,
|
|
};
|
|
}
|
|
|
|
class WebsocketMessageIdentifyPlayer {
|
|
final String playerID;
|
|
final String lobbyID;
|
|
final String? passphrase;
|
|
|
|
const WebsocketMessageIdentifyPlayer({
|
|
required this.playerID,
|
|
required this.lobbyID,
|
|
required this.passphrase,
|
|
});
|
|
|
|
Map<String, dynamic> toJson() =>
|
|
{'lobbyID': lobbyID, 'playerID': playerID, 'passphrase': passphrase};
|
|
}
|