El Impostor v0.1 — app Flutter completa
Juego de deducción social para 3-20 jugadores. Modo un solo móvil completamente funcional. 1000 palabras en 10 categorías. Notas privadas, votación, adivinanza, revancha. Material 3 dark theme. Package: es.freetimelab.elimpostor
This commit is contained in:
51
lib/modelos/jugador.dart
Normal file
51
lib/modelos/jugador.dart
Normal file
@@ -0,0 +1,51 @@
|
||||
/// Representa un jugador en la partida
|
||||
class Jugador {
|
||||
final String id;
|
||||
final String nombre;
|
||||
bool esImpostor;
|
||||
bool eliminado;
|
||||
String? palabra;
|
||||
String? endpointId; // Para modo multimóvil
|
||||
Map<String, String> notas; // nombre_jugador -> nota
|
||||
|
||||
Jugador({
|
||||
required this.id,
|
||||
required this.nombre,
|
||||
this.esImpostor = false,
|
||||
this.eliminado = false,
|
||||
this.palabra,
|
||||
this.endpointId,
|
||||
Map<String, String>? notas,
|
||||
}) : notas = notas ?? {};
|
||||
|
||||
Jugador copiar({
|
||||
bool? esImpostor,
|
||||
bool? eliminado,
|
||||
String? palabra,
|
||||
String? endpointId,
|
||||
}) {
|
||||
return Jugador(
|
||||
id: id,
|
||||
nombre: nombre,
|
||||
esImpostor: esImpostor ?? this.esImpostor,
|
||||
eliminado: eliminado ?? this.eliminado,
|
||||
palabra: palabra ?? this.palabra,
|
||||
endpointId: endpointId ?? this.endpointId,
|
||||
notas: Map.from(notas),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'id': id,
|
||||
'nombre': nombre,
|
||||
'esImpostor': esImpostor,
|
||||
'eliminado': eliminado,
|
||||
};
|
||||
|
||||
factory Jugador.fromJson(Map<String, dynamic> json) => Jugador(
|
||||
id: json['id'] as String,
|
||||
nombre: json['nombre'] as String,
|
||||
esImpostor: json['esImpostor'] as bool? ?? false,
|
||||
eliminado: json['eliminado'] as bool? ?? false,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user