DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

ef761fb8369103dc99e7856efc5dd03050c9ffb9 — Jonni Liljamo 1 year, 9 months ago 649b913
feat(client): user_cache_queue
2 files changed, 6 insertions(+), 3 deletions(-)

M client/src/main.rs
M client/src/plugins/networking/systems/events/receive/mod.rs
M client/src/main.rs => client/src/main.rs +3 -0
@@ 47,6 47,8 @@ pub enum GameState {
#[derive(Resource)]
pub struct Global {
    pub users_cache: Vec<UserPub>,
    /// stores ids of users currently in queue to be gotten
    pub users_cache_queue: Vec<String>,
}

#[derive(SystemSet, Debug, Hash, PartialEq, Eq, Clone)]


@@ 100,6 102,7 @@ fn main() {

    app.insert_resource(Global {
        users_cache: vec![],
        users_cache_queue: vec![],
    })
    .insert_resource(cfg::CfgDirs(
        directories::ProjectDirs::from("com", "liljamo", "deckbuilder")

M client/src/plugins/networking/systems/events/receive/mod.rs => client/src/plugins/networking/systems/events/receive/mod.rs +3 -3
@@ 103,9 103,9 @@ pub fn message_events(
                }
                DataRequestType::PubUserDetails => {
                    // TODO: handle possible error
                    global
                        .users_cache
                        .push(response.users.unwrap().get(0).unwrap().clone());
                    let user = response.users.unwrap().get(0).unwrap().clone();
                    global.users_cache_queue.retain(|id| id != &user.id);
                    global.users_cache.push(user);
                }
            }
        }