Create first event handler and framework for it

This commit is contained in:
NG (Graham) committed 2025-07-03 21:53:34 -04:00
1 parent e69c7dabd6
commit 38ab4ba799
10 files changed
+120 -11

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
pub struct User {
state: tokio::sync::RwLock<UserState>,
}
impl User {
pub fn new() -> Self {
Self {
state: tokio::sync::RwLock::new(UserState::Connecting),
}
}
pub async fn authenticate(&self, info: rlnl::events::loading::GameGuidInfo) -> bool {
*self.state.write().await = UserState::Authenticated(UserInfo {
game: info.game_guid.0,
username: info.player_name.0,
});
true
}
}
enum UserState {
Connecting,
Authenticated(UserInfo),
}
pub struct UserInfo {
pub game: String,
pub username: String,
}