@@ 37,17 37,22 @@ pub struct CfgSettings {
pub resolution: (f32, f32),
}
-/// Settings that the user has no access to, or can only access through developer settings
+/// User details and status
#[derive(Resource, Debug, Component, PartialEq, Clone)]
-pub struct CfgHidden {
- /// API Server
- pub api_server: String,
+pub struct CfgUser {
/// User logged in status
pub logged_in: bool,
/// User Token
pub user_token: String,
}
+/// Settings that the user has no access to, or can only access through developer settings
+#[derive(Resource, Debug, Component, PartialEq, Clone)]
+pub struct CfgHidden {
+ /// API Server
+ pub api_server: String,
+}
+
// Input structs
/// Login inputs
#[derive(Resource, Debug, Component, PartialEq, Eq, Clone)]
@@ 95,11 100,13 @@ fn main() {
fullscreen: false,
resolution: (1280., 720.),
})
- .insert_resource(CfgHidden {
- api_server: "http://localhost:8080".to_string(),
+ .insert_resource(CfgUser {
logged_in: false,
user_token: "".to_string(),
})
+ .insert_resource(CfgHidden {
+ api_server: "http://localhost:8080".to_string(),
+ })
.insert_resource(InputsUserLogin("".to_string(), "".to_string()))
.insert_resource(InputsUserRegister(
"".to_string(),
@@ 8,7 8,7 @@
use bevy::{app::AppExit, prelude::*};
use crate::CfgHidden;
use crate::CfgUser;
use super::{despawn_screen, GameState};
@@ 138,7 138,7 @@ fn menu_action(
mut app_exit_events: EventWriter<AppExit>,
mut menu_state: ResMut<State<MenuState>>,
//mut game_state: ResMut<State<GameState>>,
cfg_hidden: Res<CfgHidden>,
cfg_user: Res<CfgUser>,
) {
for (interaction, menu_button_action) in &interaction_query {
if *interaction == Interaction::Clicked {
@@ 154,7 154,7 @@ fn menu_action(
}
MenuButtonAction::SettingsMisc => menu_state.set(MenuState::SettingsMisc).unwrap(),
MenuButtonAction::Account => {
if cfg_hidden.logged_in {
if cfg_user.logged_in {
menu_state.set(MenuState::AccountLoggedIn).unwrap()
} else {
menu_state.set(MenuState::AccountLoggedOut).unwrap()