Remove resume button from complete games.
This commit is contained in:
parent
6965ebbf75
commit
15030fc700
@ -471,6 +471,8 @@ pub async fn thread_system(mut app:App, bus:Bus<protocol::QRPacket>)
|
||||
// Verify that session exists
|
||||
if let Some(session) = app.sessions.get_mut(&request.token) {
|
||||
|
||||
response.is_complete = session.game.is_complete();
|
||||
|
||||
if user_id == Some(session.p_dawn.user) {
|
||||
response.player = 1;
|
||||
} else if user_id == Some(session.p_dusk.user) {
|
||||
|
@ -42,6 +42,7 @@ pub struct PacketSessionViewResponse {
|
||||
pub status:u16,
|
||||
pub token:SessionToken,
|
||||
pub player:u8,
|
||||
pub is_complete:bool,
|
||||
}
|
||||
impl PacketSessionViewResponse {
|
||||
pub fn new() -> Self
|
||||
@ -50,6 +51,7 @@ impl PacketSessionViewResponse {
|
||||
status:0,
|
||||
token:SessionToken::default(),
|
||||
player:0,
|
||||
is_complete:false,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -59,7 +61,8 @@ impl Packet for PacketSessionViewResponse {
|
||||
fn encode(&self) -> Vec<u8>
|
||||
{
|
||||
let mut flags = 0u8;
|
||||
flags |= self.player;
|
||||
flags |= self.is_complete as u8;
|
||||
flags |= (self.player as u8) << 1;
|
||||
|
||||
[
|
||||
pack_u16(self.status),
|
||||
|
@ -622,6 +622,7 @@ const SCENES = {
|
||||
// Resume / Review Buttons
|
||||
if(data.view.player != 0) {
|
||||
if(data.mode == INTERFACE.Mode.Review) {
|
||||
if(!data.view.is_complete) {
|
||||
let callback_resume = function() {
|
||||
LOAD(SCENES.GameLoad, {
|
||||
token:this.token,
|
||||
@ -634,6 +635,7 @@ const SCENES = {
|
||||
});
|
||||
|
||||
buttons_top.push(UI.button(LANG("resume"), callback_resume));
|
||||
}
|
||||
} else {
|
||||
let callback_review = function() {
|
||||
LOAD(SCENES.GameLoad, {
|
||||
|
@ -222,6 +222,7 @@ function MESSAGE(event) {
|
||||
data = {
|
||||
status:0,
|
||||
player:0,
|
||||
is_complete:false,
|
||||
token:new Uint8Array(8),
|
||||
};
|
||||
|
||||
@ -234,7 +235,8 @@ function MESSAGE(event) {
|
||||
result = UNPACK.u8(bytes, index);
|
||||
index = result.index;
|
||||
let flags = result.data;
|
||||
data.player = flags & 3;
|
||||
data.is_complete = (flags & 1) == 1;
|
||||
data.player = (flags >> 1) & 3;
|
||||
|
||||
// Token
|
||||
for(let i = 0; i < 8; ++i) { data.token[i] = bytes[index++]; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user