mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Show disclaimer once
Former-commit-id: f4937dba2caca207b02deb18ad209a8435e65b61
This commit is contained in:
parent
045f41dae7
commit
38416ef37c
@ -81,6 +81,10 @@ pub trait PlayState {
|
|||||||
fn main() {
|
fn main() {
|
||||||
// Set up the global state.
|
// Set up the global state.
|
||||||
let mut settings = Settings::load();
|
let mut settings = Settings::load();
|
||||||
|
// Save settings to add new fields or create the file if it is not already there
|
||||||
|
// TODO: Handle this result.
|
||||||
|
settings.save_to_file();
|
||||||
|
|
||||||
let window = Window::new(&settings).expect("Failed to create window!");
|
let window = Window::new(&settings).expect("Failed to create window!");
|
||||||
|
|
||||||
// Initialize logging.
|
// Initialize logging.
|
||||||
|
@ -117,6 +117,9 @@ impl PlayState for MainMenuState {
|
|||||||
return PlayStateResult::Push(Box::new(StartSingleplayerState::new()));
|
return PlayStateResult::Push(Box::new(StartSingleplayerState::new()));
|
||||||
}
|
}
|
||||||
MainMenuEvent::Quit => return PlayStateResult::Shutdown,
|
MainMenuEvent::Quit => return PlayStateResult::Shutdown,
|
||||||
|
MainMenuEvent::DisclaimerClosed => {
|
||||||
|
global_state.settings.show_disclaimer = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,6 +90,7 @@ pub enum Event {
|
|||||||
},
|
},
|
||||||
StartSingleplayer,
|
StartSingleplayer,
|
||||||
Quit,
|
Quit,
|
||||||
|
DisclaimerClosed,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct MainMenuUi {
|
pub struct MainMenuUi {
|
||||||
@ -129,11 +130,11 @@ impl MainMenuUi {
|
|||||||
login_error: None,
|
login_error: None,
|
||||||
connecting: None,
|
connecting: None,
|
||||||
show_servers: false,
|
show_servers: false,
|
||||||
show_disclaimer: true,
|
show_disclaimer: global_state.settings.show_disclaimer,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update_layout(&mut self, global_state: &GlobalState) -> Vec<Event> {
|
fn update_layout(&mut self, global_state: &mut GlobalState) -> Vec<Event> {
|
||||||
let mut events = Vec::new();
|
let mut events = Vec::new();
|
||||||
let ref mut ui_widgets = self.ui.set_widgets();
|
let ref mut ui_widgets = self.ui.set_widgets();
|
||||||
let version = env!("CARGO_PKG_VERSION");
|
let version = env!("CARGO_PKG_VERSION");
|
||||||
@ -209,8 +210,9 @@ impl MainMenuUi {
|
|||||||
.set(self.ids.disc_button, ui_widgets)
|
.set(self.ids.disc_button, ui_widgets)
|
||||||
.was_clicked()
|
.was_clicked()
|
||||||
{
|
{
|
||||||
self.show_disclaimer = false
|
self.show_disclaimer = false;
|
||||||
};
|
events.push(Event::DisclaimerClosed);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: Don't use macros for this?
|
// TODO: Don't use macros for this?
|
||||||
// Input fields
|
// Input fields
|
||||||
|
@ -13,6 +13,7 @@ pub struct Settings {
|
|||||||
pub log: Log,
|
pub log: Log,
|
||||||
pub graphics: GraphicsSettings,
|
pub graphics: GraphicsSettings,
|
||||||
pub audio: AudioSettings,
|
pub audio: AudioSettings,
|
||||||
|
pub show_disclaimer: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// `ControlSettings` contains keybindings.
|
/// `ControlSettings` contains keybindings.
|
||||||
@ -117,6 +118,7 @@ impl Default for Settings {
|
|||||||
sfx_volume: 0.5,
|
sfx_volume: 0.5,
|
||||||
audio_device: None,
|
audio_device: None,
|
||||||
},
|
},
|
||||||
|
show_disclaimer: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user