DEVELOPMENT ENVIRONMENT

~liljamo/deck-builder

ccb1903569be666dcce005ea00cf35579944d314 — Jonni Liljamo 1 year, 8 months ago e32bf35
feat(client): show player names in lobby screen
1 files changed, 82 insertions(+), 5 deletions(-)

M client/src/plugins/menu/ui/play/ui.rs
M client/src/plugins/menu/ui/play/ui.rs => client/src/plugins/menu/ui/play/ui.rs +82 -5
@@ 133,6 133,47 @@ pub fn ui(
                });
            }
            PlayScreenState::InLobbyHost => {
                ui.label(egui::RichText::new(format!(
                    "Host: {}",
                    global
                        .users_cache
                        .iter()
                        .filter(|u| u.id == global.cur_game.as_ref().unwrap().host_id)
                        .cloned()
                        .collect::<Vec<UserPub>>()
                        .first()
                        .unwrap_or(&UserPub {
                            id: "".to_string(),
                            created_at: "".to_string(),
                            username: "N/A".to_string()
                        })
                        .username
                )));

                ui.label(egui::RichText::new(format!(
                    "Guest: {}",
                    global
                        .users_cache
                        .iter()
                        .filter(|u| &u.id
                            == global
                                .cur_game
                                .as_ref()
                                .unwrap()
                                .guest_id
                                .as_ref()
                                .unwrap_or(&"".to_string()))
                        .cloned()
                        .collect::<Vec<UserPub>>()
                        .first()
                        .unwrap_or(&UserPub {
                            id: "".to_string(),
                            created_at: "".to_string(),
                            username: "N/A".to_string()
                        })
                        .username
                )));

                if ui.button("Start").clicked() {
                    //startgame_ev_w.send(StartGameEvent);
                }


@@ 142,10 183,46 @@ pub fn ui(
                }
            }
            PlayScreenState::InLobbyGuest => {
                //ui.label(egui::RichText::new(format!(
                //    "Host: {}",
                //    rtdmenu.cur_game.as_ref().unwrap().host.username
                //)));
                ui.label(egui::RichText::new(format!(
                    "Host: {}",
                    global
                        .users_cache
                        .iter()
                        .filter(|u| u.id == global.cur_game.as_ref().unwrap().host_id)
                        .cloned()
                        .collect::<Vec<UserPub>>()
                        .first()
                        .unwrap_or(&UserPub {
                            id: "".to_string(),
                            created_at: "".to_string(),
                            username: "N/A".to_string()
                        })
                        .username
                )));

                ui.label(egui::RichText::new(format!(
                    "Guest: {}",
                    global
                        .users_cache
                        .iter()
                        .filter(|u| &u.id
                            == global
                                .cur_game
                                .as_ref()
                                .unwrap()
                                .guest_id
                                .as_ref()
                                .unwrap_or(&"".to_string()))
                        .cloned()
                        .collect::<Vec<UserPub>>()
                        .first()
                        .unwrap_or(&UserPub {
                            id: "".to_string(),
                            created_at: "".to_string(),
                            username: "N/A".to_string()
                        })
                        .username
                )));

                if ui.button("Back").clicked() {
                    data.state = PlayScreenState::Main;


@@ 273,7 350,7 @@ fn browse_inprogress(
                                .unwrap_or(&UserPub {
                                    id: "".to_string(),
                                    created_at: "".to_string(),
                                    username: "".to_string()
                                    username: "N/A".to_string()
                                })
                                .username
                        ));