persistence + proper disconnect
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
use crate::net::NetState;
|
||||
|
||||
use super::*;
|
||||
|
||||
pub fn login_screen(client: &mut Client) -> WidgetId {
|
||||
@@ -5,13 +7,7 @@ pub fn login_screen(client: &mut Client) -> WidgetId {
|
||||
ui, handle, data, ..
|
||||
} = client;
|
||||
|
||||
let mut field = |name, hint_| {
|
||||
text(name)
|
||||
.editable(true)
|
||||
.size(20)
|
||||
.hint(hint(hint_))
|
||||
.add(ui)
|
||||
};
|
||||
let mut field = |name, hint_| text(name).editable(true).size(20).hint(hint(hint_)).add(ui);
|
||||
let ip = field(&data.ip, "ip");
|
||||
let username = field(&data.username, "username");
|
||||
// let password = field("password");
|
||||
@@ -35,7 +31,8 @@ pub fn login_screen(client: &mut Client) -> WidgetId {
|
||||
client.ui[id].color = color.darker(0.3);
|
||||
let ip = client.ui[&ip_].content();
|
||||
let username = client.ui[&username_].content();
|
||||
connect(handle.clone(), ConnectInfo { ip, username });
|
||||
let th = connect(handle.clone(), ConnectInfo { ip, username });
|
||||
client.net = NetState::Connecting(th);
|
||||
})
|
||||
.height(40);
|
||||
let modal = (
|
||||
|
||||
Reference in New Issue
Block a user