mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
cleaned up settings_change.rs
This commit is contained in:
parent
df38dfbaf8
commit
56deb5919f
@ -145,360 +145,300 @@ settings_change_from!(Networking);
|
|||||||
|
|
||||||
impl SettingsChange {
|
impl SettingsChange {
|
||||||
pub fn process(self, global_state: &mut GlobalState, session_state: &mut SessionState) {
|
pub fn process(self, global_state: &mut GlobalState, session_state: &mut SessionState) {
|
||||||
// let mut settings = &mut global_state.settings;
|
let mut settings = &mut global_state.settings;
|
||||||
// let mut window = &mut global_state.window;
|
|
||||||
match self {
|
match self {
|
||||||
SettingsChange::Audio(audio_change) => match audio_change {
|
SettingsChange::Audio(audio_change) => {
|
||||||
Audio::AdjustMusicVolume(music_volume) => {
|
match audio_change {
|
||||||
global_state.audio.set_music_volume(music_volume);
|
Audio::AdjustMusicVolume(music_volume) => {
|
||||||
|
global_state.audio.set_music_volume(music_volume);
|
||||||
|
|
||||||
global_state.settings.audio.music_volume = music_volume;
|
settings.audio.music_volume = music_volume;
|
||||||
global_state.settings.save_to_file_warn();
|
},
|
||||||
},
|
Audio::AdjustSfxVolume(sfx_volume) => {
|
||||||
Audio::AdjustSfxVolume(sfx_volume) => {
|
global_state.audio.set_sfx_volume(sfx_volume);
|
||||||
global_state.audio.set_sfx_volume(sfx_volume);
|
|
||||||
|
|
||||||
global_state.settings.audio.sfx_volume = sfx_volume;
|
settings.audio.sfx_volume = sfx_volume;
|
||||||
global_state.settings.save_to_file_warn();
|
},
|
||||||
},
|
//Audio::ChangeAudioDevice(name) => {
|
||||||
//Audio::ChangeAudioDevice(name) => {
|
// global_state.audio.set_device(name.clone());
|
||||||
// global_state.audio.set_device(name.clone());
|
|
||||||
|
|
||||||
// global_state.settings.audio.output = AudioOutput::Device(name);
|
// settings.audio.output = AudioOutput::Device(name);
|
||||||
// global_state.settings.save_to_file_warn();
|
//},
|
||||||
//},
|
Audio::ResetAudioSettings => {
|
||||||
Audio::ResetAudioSettings => {
|
settings.audio = AudioSettings::default();
|
||||||
global_state.settings.audio = AudioSettings::default();
|
let audio = &settings.audio;
|
||||||
global_state.settings.save_to_file_warn();
|
global_state.audio.set_music_volume(audio.music_volume);
|
||||||
let audio = &global_state.settings.audio;
|
global_state.audio.set_sfx_volume(audio.sfx_volume);
|
||||||
global_state.audio.set_music_volume(audio.music_volume);
|
},
|
||||||
global_state.audio.set_sfx_volume(audio.sfx_volume);
|
}
|
||||||
},
|
settings.save_to_file_warn();
|
||||||
},
|
},
|
||||||
SettingsChange::Control(control_change) => match control_change {
|
SettingsChange::Control(control_change) => match control_change {
|
||||||
Control::ChangeBinding(game_input) => {
|
Control::ChangeBinding(game_input) => {
|
||||||
global_state.window.set_keybinding_mode(game_input);
|
global_state.window.set_keybinding_mode(game_input);
|
||||||
},
|
},
|
||||||
Control::ResetKeyBindings => {
|
Control::ResetKeyBindings => {
|
||||||
global_state.settings.controls = ControlSettings::default();
|
settings.controls = ControlSettings::default();
|
||||||
global_state.settings.save_to_file_warn();
|
settings.save_to_file_warn();
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
SettingsChange::Gamepad(gamepad_change) => match gamepad_change {},
|
SettingsChange::Gamepad(gamepad_change) => match gamepad_change {},
|
||||||
SettingsChange::Gameplay(gameplay_change) => match gameplay_change {
|
SettingsChange::Gameplay(gameplay_change) => {
|
||||||
Gameplay::AdjustMousePan(sensitivity) => {
|
let mut window = &mut global_state.window;
|
||||||
global_state.window.pan_sensitivity = sensitivity;
|
match gameplay_change {
|
||||||
global_state.settings.gameplay.pan_sensitivity = sensitivity;
|
Gameplay::AdjustMousePan(sensitivity) => {
|
||||||
global_state.settings.save_to_file_warn();
|
window.pan_sensitivity = sensitivity;
|
||||||
},
|
settings.gameplay.pan_sensitivity = sensitivity;
|
||||||
Gameplay::AdjustMouseZoom(sensitivity) => {
|
},
|
||||||
global_state.window.zoom_sensitivity = sensitivity;
|
Gameplay::AdjustMouseZoom(sensitivity) => {
|
||||||
global_state.settings.gameplay.zoom_sensitivity = sensitivity;
|
window.zoom_sensitivity = sensitivity;
|
||||||
global_state.settings.save_to_file_warn();
|
settings.gameplay.zoom_sensitivity = sensitivity;
|
||||||
},
|
},
|
||||||
Gameplay::AdjustCameraClamp(angle) => {
|
Gameplay::AdjustCameraClamp(angle) => {
|
||||||
global_state.settings.gameplay.camera_clamp_angle = angle;
|
settings.gameplay.camera_clamp_angle = angle;
|
||||||
global_state.settings.save_to_file_warn();
|
},
|
||||||
},
|
Gameplay::ToggleControllerYInvert(controller_y_inverted) => {
|
||||||
Gameplay::ToggleControllerYInvert(controller_y_inverted) => {
|
window.controller_settings.pan_invert_y = controller_y_inverted;
|
||||||
global_state.window.controller_settings.pan_invert_y = controller_y_inverted;
|
settings.controller.pan_invert_y = controller_y_inverted;
|
||||||
global_state.settings.controller.pan_invert_y = controller_y_inverted;
|
},
|
||||||
global_state.settings.save_to_file_warn();
|
Gameplay::ToggleMouseYInvert(mouse_y_inverted) => {
|
||||||
},
|
window.mouse_y_inversion = mouse_y_inverted;
|
||||||
Gameplay::ToggleMouseYInvert(mouse_y_inverted) => {
|
settings.gameplay.mouse_y_inversion = mouse_y_inverted;
|
||||||
global_state.window.mouse_y_inversion = mouse_y_inverted;
|
},
|
||||||
global_state.settings.gameplay.mouse_y_inversion = mouse_y_inverted;
|
Gameplay::ToggleZoomInvert(zoom_inverted) => {
|
||||||
global_state.settings.save_to_file_warn();
|
window.zoom_inversion = zoom_inverted;
|
||||||
},
|
settings.gameplay.zoom_inversion = zoom_inverted;
|
||||||
Gameplay::ToggleZoomInvert(zoom_inverted) => {
|
},
|
||||||
global_state.window.zoom_inversion = zoom_inverted;
|
Gameplay::ToggleSmoothPan(smooth_pan_enabled) => {
|
||||||
global_state.settings.gameplay.zoom_inversion = zoom_inverted;
|
settings.gameplay.smooth_pan_enable = smooth_pan_enabled;
|
||||||
global_state.settings.save_to_file_warn();
|
},
|
||||||
},
|
Gameplay::ChangeFreeLookBehavior(behavior) => {
|
||||||
Gameplay::ToggleSmoothPan(smooth_pan_enabled) => {
|
settings.gameplay.free_look_behavior = behavior;
|
||||||
global_state.settings.gameplay.smooth_pan_enable = smooth_pan_enabled;
|
},
|
||||||
global_state.settings.save_to_file_warn();
|
Gameplay::ChangeAutoWalkBehavior(behavior) => {
|
||||||
},
|
settings.gameplay.auto_walk_behavior = behavior;
|
||||||
|
},
|
||||||
Gameplay::ChangeFreeLookBehavior(behavior) => {
|
Gameplay::ChangeCameraClampBehavior(behavior) => {
|
||||||
global_state.settings.gameplay.free_look_behavior = behavior;
|
settings.gameplay.camera_clamp_behavior = behavior;
|
||||||
global_state.settings.save_to_file_warn();
|
},
|
||||||
},
|
Gameplay::ChangeStopAutoWalkOnInput(state) => {
|
||||||
Gameplay::ChangeAutoWalkBehavior(behavior) => {
|
settings.gameplay.stop_auto_walk_on_input = state;
|
||||||
global_state.settings.gameplay.auto_walk_behavior = behavior;
|
},
|
||||||
global_state.settings.save_to_file_warn();
|
Gameplay::ChangeAutoCamera(state) => {
|
||||||
},
|
settings.gameplay.auto_camera = state;
|
||||||
Gameplay::ChangeCameraClampBehavior(behavior) => {
|
},
|
||||||
global_state.settings.gameplay.camera_clamp_behavior = behavior;
|
Gameplay::ResetGameplaySettings => {
|
||||||
global_state.settings.save_to_file_warn();
|
// Reset Gameplay Settings
|
||||||
},
|
settings.gameplay = GameplaySettings::default();
|
||||||
Gameplay::ChangeStopAutoWalkOnInput(state) => {
|
// Reset Gamepad and Controller Settings
|
||||||
global_state.settings.gameplay.stop_auto_walk_on_input = state;
|
settings.controller = GamepadSettings::default();
|
||||||
global_state.settings.save_to_file_warn();
|
window.controller_settings = ControllerSettings::from(&settings.controller);
|
||||||
},
|
// Pan Sensitivity
|
||||||
Gameplay::ChangeAutoCamera(state) => {
|
window.pan_sensitivity = settings.gameplay.pan_sensitivity;
|
||||||
global_state.settings.gameplay.auto_camera = state;
|
// Zoom Sensitivity
|
||||||
global_state.settings.save_to_file_warn();
|
window.zoom_sensitivity = settings.gameplay.zoom_sensitivity;
|
||||||
},
|
// Invert Scroll Zoom
|
||||||
Gameplay::ResetGameplaySettings => {
|
window.zoom_inversion = settings.gameplay.zoom_inversion;
|
||||||
// Reset Gameplay Settings
|
// Invert Mouse Y Axis
|
||||||
global_state.settings.gameplay = GameplaySettings::default();
|
window.mouse_y_inversion = settings.gameplay.mouse_y_inversion;
|
||||||
// Reset Gamepad and Controller Settings
|
},
|
||||||
global_state.settings.controller = GamepadSettings::default();
|
}
|
||||||
global_state.window.controller_settings =
|
settings.save_to_file_warn();
|
||||||
ControllerSettings::from(&global_state.settings.controller);
|
|
||||||
// Pan Sensitivity
|
|
||||||
global_state.window.pan_sensitivity =
|
|
||||||
global_state.settings.gameplay.pan_sensitivity;
|
|
||||||
// Zoom Sensitivity
|
|
||||||
global_state.window.zoom_sensitivity =
|
|
||||||
global_state.settings.gameplay.zoom_sensitivity;
|
|
||||||
// Invert Scroll Zoom
|
|
||||||
global_state.window.zoom_inversion =
|
|
||||||
global_state.settings.gameplay.zoom_inversion;
|
|
||||||
// Invert Mouse Y Axis
|
|
||||||
global_state.window.mouse_y_inversion =
|
|
||||||
global_state.settings.gameplay.mouse_y_inversion;
|
|
||||||
// Save to File
|
|
||||||
global_state.settings.save_to_file_warn();
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
SettingsChange::Graphics(graphics_change) => match graphics_change {
|
SettingsChange::Graphics(graphics_change) => {
|
||||||
Graphics::AdjustViewDistance(view_distance) => {
|
match graphics_change {
|
||||||
session_state
|
Graphics::AdjustViewDistance(view_distance) => {
|
||||||
.client
|
session_state
|
||||||
.borrow_mut()
|
.client
|
||||||
.set_view_distance(view_distance);
|
.borrow_mut()
|
||||||
|
.set_view_distance(view_distance);
|
||||||
|
|
||||||
global_state.settings.graphics.view_distance = view_distance;
|
settings.graphics.view_distance = view_distance;
|
||||||
global_state.settings.save_to_file_warn();
|
},
|
||||||
},
|
Graphics::AdjustLodDetail(lod_detail) => {
|
||||||
Graphics::AdjustLodDetail(lod_detail) => {
|
session_state.scene.lod.set_detail(lod_detail);
|
||||||
session_state.scene.lod.set_detail(lod_detail);
|
|
||||||
|
|
||||||
global_state.settings.graphics.lod_detail = lod_detail;
|
settings.graphics.lod_detail = lod_detail;
|
||||||
global_state.settings.save_to_file_warn();
|
},
|
||||||
},
|
Graphics::AdjustSpriteRenderDistance(sprite_render_distance) => {
|
||||||
Graphics::AdjustSpriteRenderDistance(sprite_render_distance) => {
|
settings.graphics.sprite_render_distance = sprite_render_distance;
|
||||||
global_state.settings.graphics.sprite_render_distance = sprite_render_distance;
|
},
|
||||||
global_state.settings.save_to_file_warn();
|
Graphics::AdjustFigureLoDRenderDistance(figure_lod_render_distance) => {
|
||||||
},
|
settings.graphics.figure_lod_render_distance = figure_lod_render_distance;
|
||||||
Graphics::AdjustFigureLoDRenderDistance(figure_lod_render_distance) => {
|
},
|
||||||
global_state.settings.graphics.figure_lod_render_distance =
|
Graphics::ChangeMaxFPS(fps) => {
|
||||||
figure_lod_render_distance;
|
settings.graphics.max_fps = fps;
|
||||||
global_state.settings.save_to_file_warn();
|
},
|
||||||
},
|
Graphics::ChangeFOV(new_fov) => {
|
||||||
Graphics::ChangeMaxFPS(fps) => {
|
settings.graphics.fov = new_fov;
|
||||||
global_state.settings.graphics.max_fps = fps;
|
session_state.scene.camera_mut().set_fov_deg(new_fov);
|
||||||
global_state.settings.save_to_file_warn();
|
session_state
|
||||||
},
|
.scene
|
||||||
Graphics::ChangeFOV(new_fov) => {
|
.camera_mut()
|
||||||
global_state.settings.graphics.fov = new_fov;
|
.compute_dependents(&*session_state.client.borrow().state().terrain());
|
||||||
global_state.settings.save_to_file_warn();
|
},
|
||||||
session_state.scene.camera_mut().set_fov_deg(new_fov);
|
Graphics::ChangeGamma(new_gamma) => {
|
||||||
session_state
|
settings.graphics.gamma = new_gamma;
|
||||||
.scene
|
},
|
||||||
.camera_mut()
|
Graphics::ChangeExposure(new_exposure) => {
|
||||||
.compute_dependents(&*session_state.client.borrow().state().terrain());
|
settings.graphics.exposure = new_exposure;
|
||||||
},
|
},
|
||||||
Graphics::ChangeGamma(new_gamma) => {
|
Graphics::ChangeAmbiance(new_ambiance) => {
|
||||||
global_state.settings.graphics.gamma = new_gamma;
|
settings.graphics.ambiance = new_ambiance;
|
||||||
global_state.settings.save_to_file_warn();
|
},
|
||||||
},
|
Graphics::ChangeRenderMode(new_render_mode) => {
|
||||||
Graphics::ChangeExposure(new_exposure) => {
|
// Do this first so if it crashes the setting isn't saved :)
|
||||||
global_state.settings.graphics.exposure = new_exposure;
|
global_state
|
||||||
global_state.settings.save_to_file_warn();
|
.window
|
||||||
},
|
.renderer_mut()
|
||||||
Graphics::ChangeAmbiance(new_ambiance) => {
|
.set_render_mode((&*new_render_mode).clone())
|
||||||
global_state.settings.graphics.ambiance = new_ambiance;
|
.unwrap();
|
||||||
global_state.settings.save_to_file_warn();
|
settings.graphics.render_mode = *new_render_mode;
|
||||||
},
|
},
|
||||||
Graphics::ChangeRenderMode(new_render_mode) => {
|
Graphics::ChangeFullscreenMode(new_fullscreen_settings) => {
|
||||||
// Do this first so if it crashes the setting isn't saved :)
|
global_state
|
||||||
global_state
|
.window
|
||||||
.window
|
.set_fullscreen_mode(new_fullscreen_settings);
|
||||||
.renderer_mut()
|
settings.graphics.fullscreen = new_fullscreen_settings;
|
||||||
.set_render_mode((&*new_render_mode).clone())
|
},
|
||||||
.unwrap();
|
Graphics::ToggleParticlesEnabled(particles_enabled) => {
|
||||||
global_state.settings.graphics.render_mode = *new_render_mode;
|
settings.graphics.particles_enabled = particles_enabled;
|
||||||
global_state.settings.save_to_file_warn();
|
},
|
||||||
},
|
Graphics::AdjustWindowSize(new_size) => {
|
||||||
Graphics::ChangeFullscreenMode(new_fullscreen_settings) => {
|
global_state.window.set_size(new_size.into());
|
||||||
global_state
|
settings.graphics.window_size = new_size;
|
||||||
.window
|
},
|
||||||
.set_fullscreen_mode(new_fullscreen_settings);
|
Graphics::ResetGraphicsSettings => {
|
||||||
global_state.settings.graphics.fullscreen = new_fullscreen_settings;
|
settings.graphics = GraphicsSettings::default();
|
||||||
global_state.settings.save_to_file_warn();
|
let graphics = &settings.graphics;
|
||||||
},
|
// View distance
|
||||||
Graphics::ToggleParticlesEnabled(particles_enabled) => {
|
session_state
|
||||||
global_state.settings.graphics.particles_enabled = particles_enabled;
|
.client
|
||||||
global_state.settings.save_to_file_warn();
|
.borrow_mut()
|
||||||
},
|
.set_view_distance(graphics.view_distance);
|
||||||
Graphics::AdjustWindowSize(new_size) => {
|
// FOV
|
||||||
global_state.window.set_size(new_size.into());
|
session_state.scene.camera_mut().set_fov_deg(graphics.fov);
|
||||||
global_state.settings.graphics.window_size = new_size;
|
session_state
|
||||||
global_state.settings.save_to_file_warn();
|
.scene
|
||||||
},
|
.camera_mut()
|
||||||
Graphics::ResetGraphicsSettings => {
|
.compute_dependents(&*session_state.client.borrow().state().terrain());
|
||||||
global_state.settings.graphics = GraphicsSettings::default();
|
// LoD
|
||||||
global_state.settings.save_to_file_warn();
|
session_state.scene.lod.set_detail(graphics.lod_detail);
|
||||||
let graphics = &global_state.settings.graphics;
|
// Render mode
|
||||||
// View distance
|
global_state
|
||||||
session_state
|
.window
|
||||||
.client
|
.renderer_mut()
|
||||||
.borrow_mut()
|
.set_render_mode(graphics.render_mode.clone())
|
||||||
.set_view_distance(graphics.view_distance);
|
.unwrap();
|
||||||
// FOV
|
// Fullscreen mode
|
||||||
session_state.scene.camera_mut().set_fov_deg(graphics.fov);
|
global_state.window.set_fullscreen_mode(graphics.fullscreen);
|
||||||
session_state
|
// Window size
|
||||||
.scene
|
global_state.window.set_size(graphics.window_size.into());
|
||||||
.camera_mut()
|
},
|
||||||
.compute_dependents(&*session_state.client.borrow().state().terrain());
|
}
|
||||||
// LoD
|
settings.save_to_file_warn();
|
||||||
session_state.scene.lod.set_detail(graphics.lod_detail);
|
|
||||||
// Render mode
|
|
||||||
global_state
|
|
||||||
.window
|
|
||||||
.renderer_mut()
|
|
||||||
.set_render_mode(graphics.render_mode.clone())
|
|
||||||
.unwrap();
|
|
||||||
// Fullscreen mode
|
|
||||||
global_state.window.set_fullscreen_mode(graphics.fullscreen);
|
|
||||||
// Window size
|
|
||||||
global_state.window.set_size(graphics.window_size.into());
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
SettingsChange::Interface(interface_change) => match interface_change {
|
SettingsChange::Interface(interface_change) => {
|
||||||
Interface::Sct(sct) => {
|
match interface_change {
|
||||||
global_state.settings.interface.sct = sct;
|
Interface::Sct(sct) => {
|
||||||
global_state.settings.save_to_file_warn();
|
settings.interface.sct = sct;
|
||||||
},
|
},
|
||||||
Interface::SctPlayerBatch(sct_player_batch) => {
|
Interface::SctPlayerBatch(sct_player_batch) => {
|
||||||
global_state.settings.interface.sct_player_batch = sct_player_batch;
|
settings.interface.sct_player_batch = sct_player_batch;
|
||||||
global_state.settings.save_to_file_warn();
|
},
|
||||||
},
|
Interface::SctDamageBatch(sct_damage_batch) => {
|
||||||
Interface::SctDamageBatch(sct_damage_batch) => {
|
settings.interface.sct_damage_batch = sct_damage_batch;
|
||||||
global_state.settings.interface.sct_damage_batch = sct_damage_batch;
|
},
|
||||||
global_state.settings.save_to_file_warn();
|
Interface::SpeechBubbleDarkMode(sbdm) => {
|
||||||
},
|
settings.interface.speech_bubble_dark_mode = sbdm;
|
||||||
Interface::SpeechBubbleDarkMode(sbdm) => {
|
},
|
||||||
global_state.settings.interface.speech_bubble_dark_mode = sbdm;
|
Interface::SpeechBubbleIcon(sbi) => {
|
||||||
global_state.settings.save_to_file_warn();
|
settings.interface.speech_bubble_icon = sbi;
|
||||||
},
|
},
|
||||||
Interface::SpeechBubbleIcon(sbi) => {
|
Interface::ToggleHelp(_) => {
|
||||||
global_state.settings.interface.speech_bubble_icon = sbi;
|
// implemented in hud
|
||||||
global_state.settings.save_to_file_warn();
|
},
|
||||||
},
|
Interface::ToggleDebug(toggle_debug) => {
|
||||||
Interface::ToggleHelp(_) => {
|
settings.interface.toggle_debug = toggle_debug;
|
||||||
// implemented in hud
|
},
|
||||||
},
|
Interface::ToggleTips(loading_tips) => {
|
||||||
Interface::ToggleDebug(toggle_debug) => {
|
settings.interface.loading_tips = loading_tips;
|
||||||
global_state.settings.interface.toggle_debug = toggle_debug;
|
},
|
||||||
global_state.settings.save_to_file_warn();
|
Interface::CrosshairTransp(crosshair_transp) => {
|
||||||
},
|
settings.interface.crosshair_transp = crosshair_transp;
|
||||||
Interface::ToggleTips(loading_tips) => {
|
},
|
||||||
global_state.settings.interface.loading_tips = loading_tips;
|
Interface::ChatTransp(chat_transp) => {
|
||||||
global_state.settings.save_to_file_warn();
|
settings.interface.chat_transp = chat_transp;
|
||||||
},
|
},
|
||||||
|
Interface::ChatCharName(chat_char_name) => {
|
||||||
Interface::CrosshairTransp(crosshair_transp) => {
|
settings.interface.chat_character_name = chat_char_name;
|
||||||
global_state.settings.interface.crosshair_transp = crosshair_transp;
|
},
|
||||||
global_state.settings.save_to_file_warn();
|
Interface::CrosshairType(crosshair_type) => {
|
||||||
},
|
settings.interface.crosshair_type = crosshair_type;
|
||||||
Interface::ChatTransp(chat_transp) => {
|
},
|
||||||
global_state.settings.interface.chat_transp = chat_transp;
|
Interface::Intro(intro_show) => {
|
||||||
global_state.settings.save_to_file_warn();
|
settings.interface.intro_show = intro_show;
|
||||||
},
|
},
|
||||||
Interface::ChatCharName(chat_char_name) => {
|
Interface::ToggleXpBar(xp_bar) => {
|
||||||
global_state.settings.interface.chat_character_name = chat_char_name;
|
settings.interface.xp_bar = xp_bar;
|
||||||
global_state.settings.save_to_file_warn();
|
},
|
||||||
},
|
Interface::ToggleBarNumbers(bar_numbers) => {
|
||||||
Interface::CrosshairType(crosshair_type) => {
|
settings.interface.bar_numbers = bar_numbers;
|
||||||
global_state.settings.interface.crosshair_type = crosshair_type;
|
},
|
||||||
global_state.settings.save_to_file_warn();
|
Interface::ToggleShortcutNumbers(shortcut_numbers) => {
|
||||||
},
|
settings.interface.shortcut_numbers = shortcut_numbers;
|
||||||
Interface::Intro(intro_show) => {
|
},
|
||||||
global_state.settings.interface.intro_show = intro_show;
|
Interface::BuffPosition(buff_position) => {
|
||||||
global_state.settings.save_to_file_warn();
|
settings.interface.buff_position = buff_position;
|
||||||
},
|
},
|
||||||
Interface::ToggleXpBar(xp_bar) => {
|
Interface::UiScale(scale_change) => {
|
||||||
global_state.settings.interface.xp_bar = xp_bar;
|
settings.interface.ui_scale = session_state.hud.scale_change(scale_change);
|
||||||
global_state.settings.save_to_file_warn();
|
},
|
||||||
},
|
Interface::MapZoom(map_zoom) => {
|
||||||
Interface::ToggleBarNumbers(bar_numbers) => {
|
settings.interface.map_zoom = map_zoom;
|
||||||
global_state.settings.interface.bar_numbers = bar_numbers;
|
},
|
||||||
global_state.settings.save_to_file_warn();
|
Interface::MapDrag(map_drag) => {
|
||||||
},
|
settings.interface.map_drag = map_drag;
|
||||||
Interface::ToggleShortcutNumbers(shortcut_numbers) => {
|
},
|
||||||
global_state.settings.interface.shortcut_numbers = shortcut_numbers;
|
Interface::MapShowTopoMap(map_show_topo_map) => {
|
||||||
global_state.settings.save_to_file_warn();
|
settings.interface.map_show_topo_map = map_show_topo_map;
|
||||||
},
|
},
|
||||||
Interface::BuffPosition(buff_position) => {
|
Interface::MapShowDifficulty(map_show_difficulty) => {
|
||||||
global_state.settings.interface.buff_position = buff_position;
|
settings.interface.map_show_difficulty = map_show_difficulty;
|
||||||
global_state.settings.save_to_file_warn();
|
},
|
||||||
},
|
Interface::MapShowTowns(map_show_towns) => {
|
||||||
|
settings.interface.map_show_towns = map_show_towns;
|
||||||
Interface::UiScale(scale_change) => {
|
},
|
||||||
global_state.settings.interface.ui_scale =
|
Interface::MapShowDungeons(map_show_dungeons) => {
|
||||||
session_state.hud.scale_change(scale_change);
|
settings.interface.map_show_dungeons = map_show_dungeons;
|
||||||
global_state.settings.save_to_file_warn();
|
},
|
||||||
},
|
Interface::MapShowCastles(map_show_castles) => {
|
||||||
Interface::MapZoom(map_zoom) => {
|
settings.interface.map_show_castles = map_show_castles;
|
||||||
global_state.settings.interface.map_zoom = map_zoom;
|
},
|
||||||
global_state.settings.save_to_file_warn();
|
Interface::MapShowCaves(map_show_caves) => {
|
||||||
},
|
settings.interface.map_show_caves = map_show_caves;
|
||||||
Interface::MapDrag(map_drag) => {
|
},
|
||||||
global_state.settings.interface.map_drag = map_drag;
|
Interface::MapShowTrees(map_show_trees) => {
|
||||||
global_state.settings.save_to_file_warn();
|
settings.interface.map_show_trees = map_show_trees;
|
||||||
},
|
},
|
||||||
Interface::MapShowTopoMap(map_show_topo_map) => {
|
Interface::ResetInterfaceSettings => {
|
||||||
global_state.settings.interface.map_show_topo_map = map_show_topo_map;
|
// Reset Interface Settings
|
||||||
global_state.settings.save_to_file_warn();
|
let tmp = settings.interface.intro_show;
|
||||||
},
|
settings.interface = InterfaceSettings::default();
|
||||||
Interface::MapShowDifficulty(map_show_difficulty) => {
|
settings.interface.intro_show = tmp;
|
||||||
global_state.settings.interface.map_show_difficulty = map_show_difficulty;
|
// Update Current Scaling Mode
|
||||||
global_state.settings.save_to_file_warn();
|
session_state
|
||||||
},
|
.hud
|
||||||
Interface::MapShowTowns(map_show_towns) => {
|
.set_scaling_mode(settings.interface.ui_scale);
|
||||||
global_state.settings.interface.map_show_towns = map_show_towns;
|
},
|
||||||
global_state.settings.save_to_file_warn();
|
}
|
||||||
},
|
settings.save_to_file_warn();
|
||||||
Interface::MapShowDungeons(map_show_dungeons) => {
|
|
||||||
global_state.settings.interface.map_show_dungeons = map_show_dungeons;
|
|
||||||
global_state.settings.save_to_file_warn();
|
|
||||||
},
|
|
||||||
Interface::MapShowCastles(map_show_castles) => {
|
|
||||||
global_state.settings.interface.map_show_castles = map_show_castles;
|
|
||||||
global_state.settings.save_to_file_warn();
|
|
||||||
},
|
|
||||||
Interface::MapShowCaves(map_show_caves) => {
|
|
||||||
global_state.settings.interface.map_show_caves = map_show_caves;
|
|
||||||
global_state.settings.save_to_file_warn();
|
|
||||||
},
|
|
||||||
Interface::MapShowTrees(map_show_trees) => {
|
|
||||||
global_state.settings.interface.map_show_trees = map_show_trees;
|
|
||||||
global_state.settings.save_to_file_warn();
|
|
||||||
},
|
|
||||||
Interface::ResetInterfaceSettings => {
|
|
||||||
// Reset Interface Settings
|
|
||||||
let tmp = global_state.settings.interface.intro_show;
|
|
||||||
global_state.settings.interface = InterfaceSettings::default();
|
|
||||||
global_state.settings.interface.intro_show = tmp;
|
|
||||||
// Update Current Scaling Mode
|
|
||||||
session_state
|
|
||||||
.hud
|
|
||||||
.set_scaling_mode(global_state.settings.interface.ui_scale);
|
|
||||||
|
|
||||||
// Save to File
|
|
||||||
global_state.settings.save_to_file_warn();
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
SettingsChange::Language(language_change) => match language_change {
|
SettingsChange::Language(language_change) => match language_change {
|
||||||
Language::ChangeLanguage(new_language) => {
|
Language::ChangeLanguage(new_language) => {
|
||||||
global_state.settings.language.selected_language =
|
settings.language.selected_language = new_language.language_identifier;
|
||||||
new_language.language_identifier;
|
|
||||||
global_state.i18n = Localization::load_expect(&i18n_asset_key(
|
global_state.i18n = Localization::load_expect(&i18n_asset_key(
|
||||||
&global_state.settings.language.selected_language,
|
&settings.language.selected_language,
|
||||||
));
|
));
|
||||||
global_state.i18n.read().log_missing_entries();
|
global_state.i18n.read().log_missing_entries();
|
||||||
session_state.hud.update_fonts(&global_state.i18n.read());
|
session_state.hud.update_fonts(&global_state.i18n.read());
|
||||||
|
Loading…
Reference in New Issue
Block a user