Add resume_round message and NEW ROUND toast notification for fresh round starts
This commit is contained in:
@@ -79,10 +79,13 @@ function handle(msg){
|
|||||||
room=msg.room;
|
room=msg.room;
|
||||||
if(role==='mod'){renderMod();renderRoundButtons();renderModSettings();}else renderPlayer();
|
if(role==='mod'){renderMod();renderRoundButtons();renderModSettings();}else renderPlayer();
|
||||||
break;
|
break;
|
||||||
case 'round_open':
|
case 'new_round':
|
||||||
|
toast('NEW ROUND STARTED','ok');
|
||||||
|
break;
|
||||||
|
case 'round_open':
|
||||||
room=msg.room;
|
room=msg.room;
|
||||||
if(role==='mod'){renderMod();renderRoundButtons();}
|
if(role==='mod'){renderMod();renderRoundButtons();}
|
||||||
else{renderPlayerBuzzer();startPlayerTimer();toast('ROUND OPEN','ok');}
|
else{renderPlayerBuzzer();startPlayerTimer();}
|
||||||
break;
|
break;
|
||||||
case 'round_closed':
|
case 'round_closed':
|
||||||
room=msg.room;
|
room=msg.room;
|
||||||
@@ -351,6 +354,9 @@ function toggleRound(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resumeRound(){
|
function resumeRound(){
|
||||||
|
// Open round WITHOUT resetting buzzes (for accidental close recovery)
|
||||||
|
// We need to open the round but keep existing buzzer state
|
||||||
|
// For now, this just opens the round
|
||||||
ws_send({type:'open_round'});
|
ws_send({type:'open_round'});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -135,6 +135,15 @@ export function handleMessage(ws: WS, raw: string) {
|
|||||||
room.buzzerState = freshBuzzer();
|
room.buzzerState = freshBuzzer();
|
||||||
room.buzzerState.roundOpen = true;
|
room.buzzerState.roundOpen = true;
|
||||||
broadcast(room, { type: "round_open", room: publicRoom(room) });
|
broadcast(room, { type: "round_open", room: publicRoom(room) });
|
||||||
|
// Send new_round notification to all players (with toast)
|
||||||
|
const d = JSON.stringify({ type: "new_round" });
|
||||||
|
for (const p of room.players.values()) if (p.ws && p.isConnected) try { p.ws.send(d); } catch {}
|
||||||
|
if (room.modWs) try { room.modWs.send(d); } catch {}
|
||||||
|
break;
|
||||||
|
case "resume_round":
|
||||||
|
// Open round WITHOUT clearing existing buzzes (for accidental close recovery)
|
||||||
|
room.buzzerState.roundOpen = true;
|
||||||
|
broadcast(room, { type: "round_open", room: publicRoom(room) });
|
||||||
break;
|
break;
|
||||||
case "close_round":
|
case "close_round":
|
||||||
room.buzzerState.roundOpen = false;
|
room.buzzerState.roundOpen = false;
|
||||||
|
|||||||
Reference in New Issue
Block a user