working with new login page, IOS is still a bit weird but it should just be HTML work

This commit is contained in:
2025-05-26 11:38:44 -06:00
parent 2ba48354ac
commit 88ce6db3aa
10 changed files with 375 additions and 187 deletions
+11 -3
View File
@@ -2,22 +2,30 @@ use ewebsock::WsEvent;
use macroquad::prelude::{error, info};
use serde::{Serialize, de::DeserializeOwned};
use crate::cfg::{Cfg, ClientType};
pub struct Context {
pub sender: ewebsock::WsSender,
pub reciever: ewebsock::WsReceiver,
pub token: String,
pub username: String,
pub user_id: u64,
pub game_code: String,
pub client_type: ClientType,
}
impl Context {
pub fn new(url: &str) -> Context {
pub fn new(url: &str, cfg: Cfg) -> Context {
let (sender, reciever) = ewebsock::connect(url, ewebsock::Options::default()).unwrap();
Self {
sender,
reciever,
token: String::new(),
username: String::new(),
token: cfg.token,
username: cfg.username,
game_code: cfg.game_code,
user_id: cfg.user_id,
client_type: cfg.client_type,
}
}