feat(multi-device): host puede participar como jugador
- Añadido modelo Usuario con pool de usuarios sincronizado - El host ahora recibe palabra y rol como cualquier jugador - UI de selección de perfil en pantallas de lobby - Los clientes pueden ver usuarios del servidor o crear nuevos - El juego no inicia hasta que el host selecciona perfil
This commit is contained in:
@@ -12,11 +12,17 @@ class EstadoJuego extends ChangeNotifier {
|
||||
final Map<String, String> _votos = {}; // votanteId -> votadoId
|
||||
bool _cargando = false;
|
||||
|
||||
/// Jugador local del host en modo multi-dispositivo
|
||||
Jugador? _hostLocal;
|
||||
|
||||
BancoPalabras? get banco => _banco;
|
||||
Partida? get partida => _partida;
|
||||
Map<String, String> get votos => Map.unmodifiable(_votos);
|
||||
bool get cargando => _cargando;
|
||||
|
||||
/// Jugador local del host (para modo multi-dispositivo)
|
||||
Jugador? get hostLocal => _hostLocal;
|
||||
|
||||
Future<void> cargarBanco() async {
|
||||
_cargando = true;
|
||||
notifyListeners();
|
||||
@@ -25,6 +31,16 @@ class EstadoJuego extends ChangeNotifier {
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// Establece el jugador local del host para modo multi-dispositivo
|
||||
void setHostJugador(String nombre) {
|
||||
_hostLocal = Jugador(
|
||||
id: 'host-local',
|
||||
nombre: nombre,
|
||||
endpointId: null, // El host local no tiene endpointId
|
||||
);
|
||||
notifyListeners();
|
||||
}
|
||||
|
||||
/// Crea una nueva partida con la configuración dada y lista de jugadores
|
||||
void crearPartida({
|
||||
required ConfigPartida config,
|
||||
|
||||
Reference in New Issue
Block a user