Send notification updates on undo; fix practice on retire; fix loading game from challenge.

This commit is contained in:
yukirij 2024-10-06 12:44:30 -07:00
parent 60b48e4708
commit 5fb0067168
3 changed files with 12 additions and 4 deletions

View File

@ -726,6 +726,9 @@ pub async fn thread_system(mut app:App, bus:Bus<protocol::QRPacket>)
)); ));
} }
send_user_status.push(session.p_dawn.user);
send_user_status.push(session.p_dusk.user);
session.undo = 0; session.undo = 0;
} }
} }

View File

@ -1439,8 +1439,6 @@ const INTERFACE = {
case INTERFACE.Mode.Local: { case INTERFACE.Mode.Local: {
INTERFACE.history_push(play, true); INTERFACE.history_push(play, true);
INTERFACE.game_step();
if(INTERFACE_DATA.Game.auto !== null && INTERFACE_DATA.Game.auto == (GAME_DATA.turn & 1)) { if(INTERFACE_DATA.Game.auto !== null && INTERFACE_DATA.Game.auto == (GAME_DATA.turn & 1)) {
setTimeout(INTERFACE.auto_play, 1000); setTimeout(INTERFACE.auto_play, 1000);
} }

View File

@ -675,10 +675,17 @@ const SCENES = {
// Practice Button // Practice Button
if(data.mode == INTERFACE.Mode.Review) { if(data.mode == INTERFACE.Mode.Review) {
let play_callback = function() { let play_callback = function() {
let turn = INTERFACE_DATA.Replay.turn;
if(INTERFACE_DATA.Game.history.length > 0) {
if(INTERFACE_DATA.Game.history[turn - 1].source == 0xF) {
turn -= 1;
}
}
LOAD(SCENES.GamePractice, { LOAD(SCENES.GamePractice, {
token:this.token, token:this.token,
history:INTERFACE_DATA.Game.history, history:INTERFACE_DATA.Game.history,
turn:INTERFACE_DATA.Replay.turn, turn:turn,
}); });
} }
play_callback = play_callback.bind({ play_callback = play_callback.bind({
@ -1002,7 +1009,7 @@ const SCENES = {
case OpCode.ChallengeAnswer: { case OpCode.ChallengeAnswer: {
if(data.status == Status.Ok) { if(data.status == Status.Ok) {
LOAD(SCENES.GameLoad, { LOAD(SCENES.GameLoad, {
token:this.token, token:data.token,
mode:INTERFACE.Mode.Player, mode:INTERFACE.Mode.Player,
}); });
} else { } else {