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:
ShanaiaBot
2026-04-24 18:47:56 +02:00
parent 3df3ae1e95
commit d3fc3386f9
31 changed files with 1266 additions and 106 deletions

View File

@@ -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,