mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fill in username & server fields in ui reimplementation, stop saving password in the settings file
This commit is contained in:
parent
73982637b2
commit
01eb061a83
@ -33,7 +33,6 @@ impl Screen {
|
|||||||
fonts: &Fonts,
|
fonts: &Fonts,
|
||||||
imgs: &Imgs,
|
imgs: &Imgs,
|
||||||
bg_img: image::Handle,
|
bg_img: image::Handle,
|
||||||
start: &std::time::Instant,
|
|
||||||
connection_state: &ConnectionState,
|
connection_state: &ConnectionState,
|
||||||
version: &str,
|
version: &str,
|
||||||
time: f32,
|
time: f32,
|
||||||
|
@ -93,7 +93,7 @@ pub enum Event {
|
|||||||
StartSingleplayer,
|
StartSingleplayer,
|
||||||
Quit,
|
Quit,
|
||||||
Settings,
|
Settings,
|
||||||
//DisclaimerClosed,
|
//DisclaimerClosed, TODO: remove all traces?
|
||||||
AuthServerTrust(String, bool),
|
AuthServerTrust(String, bool),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ pub struct LoginInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum Info {
|
enum Info {
|
||||||
Disclaimer,
|
//Disclaimer,
|
||||||
Intro,
|
Intro,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +151,6 @@ enum Screen {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: use i18n font scale thing
|
|
||||||
struct IcedState {
|
struct IcedState {
|
||||||
fonts: IcedFonts,
|
fonts: IcedFonts,
|
||||||
imgs: IcedImgs,
|
imgs: IcedImgs,
|
||||||
@ -184,7 +183,7 @@ enum Message {
|
|||||||
TrustPromptAdd,
|
TrustPromptAdd,
|
||||||
TrustPromptCancel,
|
TrustPromptCancel,
|
||||||
CloseError,
|
CloseError,
|
||||||
CloseDisclaimer,
|
//CloseDisclaimer,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl IcedState {
|
impl IcedState {
|
||||||
@ -201,11 +200,11 @@ impl IcedState {
|
|||||||
common::util::GIT_VERSION.to_string()
|
common::util::GIT_VERSION.to_string()
|
||||||
);
|
);
|
||||||
|
|
||||||
let info = if settings.show_disclaimer {
|
let info = Info::Intro; // if settings.show_disclaimer {
|
||||||
Info::Disclaimer
|
//Info::Disclaimer
|
||||||
} else {
|
//} else {
|
||||||
Info::Intro
|
//Info::Intro
|
||||||
};
|
//};
|
||||||
|
|
||||||
Self {
|
Self {
|
||||||
fonts,
|
fonts,
|
||||||
@ -215,9 +214,9 @@ impl IcedState {
|
|||||||
version,
|
version,
|
||||||
|
|
||||||
login_info: LoginInfo {
|
login_info: LoginInfo {
|
||||||
username: String::new(),
|
username: settings.networking.username.clone(),
|
||||||
password: String::new(),
|
password: String::new(),
|
||||||
server: String::new(),
|
server: settings.networking.default_server.clone(),
|
||||||
},
|
},
|
||||||
|
|
||||||
show_servers: false,
|
show_servers: false,
|
||||||
@ -248,13 +247,11 @@ impl IcedState {
|
|||||||
),
|
),
|
||||||
Screen::Connecting {
|
Screen::Connecting {
|
||||||
screen,
|
screen,
|
||||||
start,
|
|
||||||
connection_state,
|
connection_state,
|
||||||
} => screen.view(
|
} => screen.view(
|
||||||
&self.fonts,
|
&self.fonts,
|
||||||
&self.imgs,
|
&self.imgs,
|
||||||
self.bg_img,
|
self.bg_img,
|
||||||
&start,
|
|
||||||
&connection_state,
|
&connection_state,
|
||||||
&self.version,
|
&self.version,
|
||||||
self.time,
|
self.time,
|
||||||
@ -271,7 +268,6 @@ impl IcedState {
|
|||||||
Message::Singleplayer => {
|
Message::Singleplayer => {
|
||||||
self.screen = Screen::Connecting {
|
self.screen = Screen::Connecting {
|
||||||
screen: connecting::Screen::new(),
|
screen: connecting::Screen::new(),
|
||||||
start: std::time::Instant::now(),
|
|
||||||
connection_state: ConnectionState::InProgress {
|
connection_state: ConnectionState::InProgress {
|
||||||
status: [self.i18n.get("main.creating_world"), "..."].concat(),
|
status: [self.i18n.get("main.creating_world"), "..."].concat(),
|
||||||
},
|
},
|
||||||
@ -282,7 +278,6 @@ impl IcedState {
|
|||||||
Message::Multiplayer => {
|
Message::Multiplayer => {
|
||||||
self.screen = Screen::Connecting {
|
self.screen = Screen::Connecting {
|
||||||
screen: connecting::Screen::new(),
|
screen: connecting::Screen::new(),
|
||||||
start: std::time::Instant::now(),
|
|
||||||
connection_state: ConnectionState::InProgress {
|
connection_state: ConnectionState::InProgress {
|
||||||
status: [self.i18n.get("main.connecting"), "..."].concat(),
|
status: [self.i18n.get("main.connecting"), "..."].concat(),
|
||||||
},
|
},
|
||||||
@ -332,9 +327,9 @@ impl IcedState {
|
|||||||
*error = None;
|
*error = None;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Message::CloseDisclaimer => {
|
//Message::CloseDisclaimer => {
|
||||||
events.push(Event::DisclaimerClosed);
|
// events.push(Event::DisclaimerClosed);
|
||||||
},
|
//},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -535,11 +530,7 @@ impl<'a> MainMenuUi {
|
|||||||
imgs,
|
imgs,
|
||||||
username: networking.username.clone(),
|
username: networking.username.clone(),
|
||||||
password: "".to_owned(),
|
password: "".to_owned(),
|
||||||
server_address: networking
|
server_address: networking.default_server.clone(),
|
||||||
.servers
|
|
||||||
.get(networking.default_server)
|
|
||||||
.cloned()
|
|
||||||
.unwrap_or_default(),
|
|
||||||
popup: None,
|
popup: None,
|
||||||
connecting: None,
|
connecting: None,
|
||||||
show_servers: false,
|
show_servers: false,
|
||||||
@ -992,7 +983,7 @@ impl<'a> MainMenuUi {
|
|||||||
.was_clicked()
|
.was_clicked()
|
||||||
{
|
{
|
||||||
self.server_address = net_settings.servers[item.i].clone();
|
self.server_address = net_settings.servers[item.i].clone();
|
||||||
net_settings.default_server = item.i;
|
net_settings.default_server = self.server_address.clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -558,16 +558,16 @@ impl Default for GameplaySettings {
|
|||||||
pub struct NetworkingSettings {
|
pub struct NetworkingSettings {
|
||||||
pub username: String,
|
pub username: String,
|
||||||
pub servers: Vec<String>,
|
pub servers: Vec<String>,
|
||||||
pub default_server: usize,
|
pub default_server: String,
|
||||||
pub trusted_auth_servers: HashSet<String>,
|
pub trusted_auth_servers: HashSet<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for NetworkingSettings {
|
impl Default for NetworkingSettings {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
username: "Username".to_string(),
|
username: "".to_string(),
|
||||||
servers: vec!["server.veloren.net".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"]
|
trusted_auth_servers: ["https://auth.veloren.net"]
|
||||||
.iter()
|
.iter()
|
||||||
.map(|s| s.to_string())
|
.map(|s| s.to_string())
|
||||||
|
Loading…
Reference in New Issue
Block a user