From 01eb061a834de0c3e18aa30305c6901ccca20a0b Mon Sep 17 00:00:00 2001 From: Imbris Date: Wed, 3 Jun 2020 01:48:33 -0400 Subject: [PATCH] Fill in username & server fields in ui reimplementation, stop saving password in the settings file --- voxygen/src/menu/main/ui/connecting.rs | 1 - voxygen/src/menu/main/ui/mod.rs | 39 ++++++++++---------------- voxygen/src/settings.rs | 6 ++-- 3 files changed, 18 insertions(+), 28 deletions(-) diff --git a/voxygen/src/menu/main/ui/connecting.rs b/voxygen/src/menu/main/ui/connecting.rs index 63f1012565..cdab71b879 100644 --- a/voxygen/src/menu/main/ui/connecting.rs +++ b/voxygen/src/menu/main/ui/connecting.rs @@ -33,7 +33,6 @@ impl Screen { fonts: &Fonts, imgs: &Imgs, bg_img: image::Handle, - start: &std::time::Instant, connection_state: &ConnectionState, version: &str, time: f32, diff --git a/voxygen/src/menu/main/ui/mod.rs b/voxygen/src/menu/main/ui/mod.rs index 1bb3bef40d..f94a5b1100 100644 --- a/voxygen/src/menu/main/ui/mod.rs +++ b/voxygen/src/menu/main/ui/mod.rs @@ -93,7 +93,7 @@ pub enum Event { StartSingleplayer, Quit, Settings, - //DisclaimerClosed, + //DisclaimerClosed, TODO: remove all traces? AuthServerTrust(String, bool), } @@ -115,7 +115,7 @@ pub struct LoginInfo { } enum Info { - Disclaimer, + //Disclaimer, Intro, } @@ -151,7 +151,6 @@ enum Screen { }, } -// TODO: use i18n font scale thing struct IcedState { fonts: IcedFonts, imgs: IcedImgs, @@ -184,7 +183,7 @@ enum Message { TrustPromptAdd, TrustPromptCancel, CloseError, - CloseDisclaimer, + //CloseDisclaimer, } impl IcedState { @@ -201,11 +200,11 @@ impl IcedState { common::util::GIT_VERSION.to_string() ); - let info = if settings.show_disclaimer { - Info::Disclaimer - } else { - Info::Intro - }; + let info = Info::Intro; // if settings.show_disclaimer { + //Info::Disclaimer + //} else { + //Info::Intro + //}; Self { fonts, @@ -215,9 +214,9 @@ impl IcedState { version, login_info: LoginInfo { - username: String::new(), + username: settings.networking.username.clone(), password: String::new(), - server: String::new(), + server: settings.networking.default_server.clone(), }, show_servers: false, @@ -248,13 +247,11 @@ impl IcedState { ), Screen::Connecting { screen, - start, connection_state, } => screen.view( &self.fonts, &self.imgs, self.bg_img, - &start, &connection_state, &self.version, self.time, @@ -271,7 +268,6 @@ impl IcedState { Message::Singleplayer => { self.screen = Screen::Connecting { screen: connecting::Screen::new(), - start: std::time::Instant::now(), connection_state: ConnectionState::InProgress { status: [self.i18n.get("main.creating_world"), "..."].concat(), }, @@ -282,7 +278,6 @@ impl IcedState { Message::Multiplayer => { self.screen = Screen::Connecting { screen: connecting::Screen::new(), - start: std::time::Instant::now(), connection_state: ConnectionState::InProgress { status: [self.i18n.get("main.connecting"), "..."].concat(), }, @@ -332,9 +327,9 @@ impl IcedState { *error = None; } }, - Message::CloseDisclaimer => { - events.push(Event::DisclaimerClosed); - }, + //Message::CloseDisclaimer => { + // events.push(Event::DisclaimerClosed); + //}, } } @@ -535,11 +530,7 @@ impl<'a> MainMenuUi { imgs, username: networking.username.clone(), password: "".to_owned(), - server_address: networking - .servers - .get(networking.default_server) - .cloned() - .unwrap_or_default(), + server_address: networking.default_server.clone(), popup: None, connecting: None, show_servers: false, @@ -992,7 +983,7 @@ impl<'a> MainMenuUi { .was_clicked() { self.server_address = net_settings.servers[item.i].clone(); - net_settings.default_server = item.i; + net_settings.default_server = self.server_address.clone(); } } diff --git a/voxygen/src/settings.rs b/voxygen/src/settings.rs index b6f23dd828..e74be75932 100644 --- a/voxygen/src/settings.rs +++ b/voxygen/src/settings.rs @@ -558,16 +558,16 @@ impl Default for GameplaySettings { pub struct NetworkingSettings { pub username: String, pub servers: Vec, - pub default_server: usize, + pub default_server: String, pub trusted_auth_servers: HashSet, } impl Default for NetworkingSettings { fn default() -> Self { Self { - username: "Username".to_string(), + username: "".to_string(), servers: vec!["server.veloren.net".to_string()], - default_server: 0, + default_server: "server.veloren.net".to_string(), trusted_auth_servers: ["https://auth.veloren.net"] .iter() .map(|s| s.to_string())