Compare commits
3 Commits
58a3b74d2b
...
9504eb7a88
| Author | SHA1 | Date | |
|---|---|---|---|
| 9504eb7a88 | |||
| 2464ad00db | |||
| 97cc8b1712 |
@ -2,9 +2,10 @@
|
|||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://cqiwdajl71ujv" path="res://scenes/ui/slider.tscn" id="1_8wfqe"]
|
[ext_resource type="PackedScene" uid="uid://cqiwdajl71ujv" path="res://scenes/ui/slider.tscn" id="1_8wfqe"]
|
||||||
|
|
||||||
[node name="settings" type="SettingsPanel" unique_id=999912383 node_paths=PackedStringArray("general_grid", "volume_grid")]
|
[node name="settings" type="SettingsPanel" unique_id=999912383 node_paths=PackedStringArray("general_grid", "volume_grid", "keybinds_grid")]
|
||||||
general_grid = NodePath("v_box_container/tab_container/general")
|
general_grid = NodePath("v_box_container/tab_container/general")
|
||||||
volume_grid = NodePath("v_box_container/tab_container/volume")
|
volume_grid = NodePath("v_box_container/tab_container/volume")
|
||||||
|
keybinds_grid = NodePath("v_box_container/tab_container/keybinds")
|
||||||
slider_scene = ExtResource("1_8wfqe")
|
slider_scene = ExtResource("1_8wfqe")
|
||||||
anchors_preset = 8
|
anchors_preset = 8
|
||||||
anchor_left = 0.5
|
anchor_left = 0.5
|
||||||
@ -19,6 +20,7 @@ grow_horizontal = 2
|
|||||||
grow_vertical = 2
|
grow_vertical = 2
|
||||||
|
|
||||||
[node name="v_box_container" type="VBoxContainer" parent="." unique_id=1384128810]
|
[node name="v_box_container" type="VBoxContainer" parent="." unique_id=1384128810]
|
||||||
|
custom_minimum_size = Vector2(500, 500)
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|
||||||
[node name="label" type="Label" parent="v_box_container" unique_id=2036746921]
|
[node name="label" type="Label" parent="v_box_container" unique_id=2036746921]
|
||||||
@ -32,20 +34,22 @@ size_flags_vertical = 3
|
|||||||
current_tab = 0
|
current_tab = 0
|
||||||
|
|
||||||
[node name="general" type="GridContainer" parent="v_box_container/tab_container" unique_id=833231169]
|
[node name="general" type="GridContainer" parent="v_box_container/tab_container" unique_id=833231169]
|
||||||
custom_minimum_size = Vector2(400, 0)
|
|
||||||
custom_maximum_size = Vector2(400, -1)
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
columns = 2
|
columns = 2
|
||||||
metadata/_tab_index = 0
|
metadata/_tab_index = 0
|
||||||
|
|
||||||
[node name="volume" type="GridContainer" parent="v_box_container/tab_container" unique_id=1992916365]
|
[node name="volume" type="GridContainer" parent="v_box_container/tab_container" unique_id=1992916365]
|
||||||
visible = false
|
visible = false
|
||||||
custom_minimum_size = Vector2(400, 0)
|
|
||||||
custom_maximum_size = Vector2(400, -1)
|
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
columns = 2
|
columns = 2
|
||||||
metadata/_tab_index = 1
|
metadata/_tab_index = 1
|
||||||
|
|
||||||
|
[node name="keybinds" type="GridContainer" parent="v_box_container/tab_container" unique_id=852698711]
|
||||||
|
visible = false
|
||||||
|
layout_mode = 2
|
||||||
|
columns = 2
|
||||||
|
metadata/_tab_index = 2
|
||||||
|
|
||||||
[node name="button" type="Button" parent="v_box_container" unique_id=1301469030]
|
[node name="button" type="Button" parent="v_box_container" unique_id=1301469030]
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
size_flags_horizontal = 4
|
size_flags_horizontal = 4
|
||||||
|
|||||||
@ -4,7 +4,11 @@ use std::{
|
|||||||
};
|
};
|
||||||
|
|
||||||
use godot::{
|
use godot::{
|
||||||
classes::{AudioServer, FileAccess, file_access::ModeFlags},
|
classes::{
|
||||||
|
AudioServer, FileAccess, InputEvent, InputEventKey, InputEventMouse, InputEventMouseButton,
|
||||||
|
InputMap, file_access::ModeFlags,
|
||||||
|
},
|
||||||
|
global::{Key, MouseButton},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
tools::get_autoload_by_name,
|
tools::get_autoload_by_name,
|
||||||
};
|
};
|
||||||
@ -23,6 +27,7 @@ pub struct GameSettings {
|
|||||||
pub default_name: String,
|
pub default_name: String,
|
||||||
pub recent_servers: Vec<RecentServer>,
|
pub recent_servers: Vec<RecentServer>,
|
||||||
pub volume: VolumeSettings,
|
pub volume: VolumeSettings,
|
||||||
|
pub keybinds: KeybindSettings,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
@ -33,6 +38,61 @@ pub struct VolumeSettings {
|
|||||||
pub announcer_volume: f64,
|
pub announcer_volume: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
|
pub struct KeybindSettings {
|
||||||
|
pub move_left: Keybind,
|
||||||
|
pub move_right: Keybind,
|
||||||
|
pub move_forward: Keybind,
|
||||||
|
pub move_backward: Keybind,
|
||||||
|
pub select_raygun: Keybind,
|
||||||
|
pub select_shotgun: Keybind,
|
||||||
|
pub shoot: Keybind,
|
||||||
|
pub melee: Keybind,
|
||||||
|
pub jump: Keybind,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Copy, Debug, Serialize, Deserialize)]
|
||||||
|
pub enum Keybind {
|
||||||
|
Key(i32),
|
||||||
|
MouseButton(i32),
|
||||||
|
}
|
||||||
|
|
||||||
|
impl ToString for Keybind {
|
||||||
|
fn to_string(&self) -> String {
|
||||||
|
match self {
|
||||||
|
Keybind::Key(value) => format!("{:?}", Key::from_godot(*value)),
|
||||||
|
Keybind::MouseButton(value) => format!("{:?}", MouseButton::from_godot(*value)),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Keybind {
|
||||||
|
pub fn from_event(event: Gd<InputEvent>) -> Option<Keybind> {
|
||||||
|
if let Ok(key) = event.clone().try_cast::<InputEventKey>() {
|
||||||
|
Some(Keybind::Key(key.get_keycode().to_godot()))
|
||||||
|
} else if let Ok(mouse) = event.clone().try_cast::<InputEventMouseButton>() {
|
||||||
|
Some(Keybind::MouseButton(mouse.get_button_index().to_godot()))
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn into_event(&self) -> Gd<InputEvent> {
|
||||||
|
match self {
|
||||||
|
Keybind::Key(key) => {
|
||||||
|
let mut event = InputEventKey::new_gd();
|
||||||
|
event.set_keycode(Key::from_godot(*key));
|
||||||
|
event.upcast()
|
||||||
|
}
|
||||||
|
Keybind::MouseButton(mb) => {
|
||||||
|
let mut event = InputEventMouseButton::new_gd();
|
||||||
|
event.set_button_index(MouseButton::from_godot(*mb));
|
||||||
|
event.upcast()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl VolumeSettings {
|
impl VolumeSettings {
|
||||||
pub fn master(&self) -> f32 {
|
pub fn master(&self) -> f32 {
|
||||||
(self.master_volume / 100.) as f32
|
(self.master_volume / 100.) as f32
|
||||||
@ -69,6 +129,17 @@ impl Default for GameSettings {
|
|||||||
music_volume: 100.,
|
music_volume: 100.,
|
||||||
announcer_volume: 100.,
|
announcer_volume: 100.,
|
||||||
},
|
},
|
||||||
|
keybinds: KeybindSettings {
|
||||||
|
move_left: Keybind::Key(Key::A.to_godot()),
|
||||||
|
move_right: Keybind::Key(Key::D.to_godot()),
|
||||||
|
move_forward: Keybind::Key(Key::W.to_godot()),
|
||||||
|
move_backward: Keybind::Key(Key::S.to_godot()),
|
||||||
|
select_raygun: Keybind::Key(Key::KEY_1.to_godot()),
|
||||||
|
select_shotgun: Keybind::Key(Key::KEY_2.to_godot()),
|
||||||
|
shoot: Keybind::MouseButton(MouseButton::LEFT.to_godot()),
|
||||||
|
melee: Keybind::Key(Key::F.to_godot()),
|
||||||
|
jump: Keybind::Key(Key::SPACE.to_godot()),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -108,6 +179,16 @@ impl GameSettingsManager {
|
|||||||
set_bus_volume(MUSIC_BUS, settings.volume.music());
|
set_bus_volume(MUSIC_BUS, settings.volume.music());
|
||||||
set_bus_volume(ANNOUNCER_BUS, settings.volume.announcer());
|
set_bus_volume(ANNOUNCER_BUS, settings.volume.announcer());
|
||||||
|
|
||||||
|
set_keybind("right", settings.keybinds.move_right);
|
||||||
|
set_keybind("left", settings.keybinds.move_left);
|
||||||
|
set_keybind("forward", settings.keybinds.move_forward);
|
||||||
|
set_keybind("backward", settings.keybinds.move_backward);
|
||||||
|
set_keybind("weapon_1", settings.keybinds.select_raygun);
|
||||||
|
set_keybind("weapon_2", settings.keybinds.select_shotgun);
|
||||||
|
set_keybind("shoot", settings.keybinds.shoot);
|
||||||
|
set_keybind("punch", settings.keybinds.melee);
|
||||||
|
set_keybind("jump", settings.keybinds.jump);
|
||||||
|
|
||||||
self.settings = settings;
|
self.settings = settings;
|
||||||
if let Some(mut file) = FileAccess::open("user://config.toml", ModeFlags::WRITE) {
|
if let Some(mut file) = FileAccess::open("user://config.toml", ModeFlags::WRITE) {
|
||||||
if let Ok(serialized) = toml::to_string(&self.settings) {
|
if let Ok(serialized) = toml::to_string(&self.settings) {
|
||||||
@ -157,3 +238,8 @@ fn set_bus_volume(bus: &str, volume: f32) {
|
|||||||
let idx = AudioServer::singleton().get_bus_index(bus);
|
let idx = AudioServer::singleton().get_bus_index(bus);
|
||||||
AudioServer::singleton().set_bus_volume_linear(idx, volume);
|
AudioServer::singleton().set_bus_volume_linear(idx, volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn set_keybind(action: &str, keybind: Keybind) {
|
||||||
|
InputMap::singleton().action_erase_events(action);
|
||||||
|
InputMap::singleton().action_add_event(action, &keybind.into_event());
|
||||||
|
}
|
||||||
|
|||||||
@ -2,27 +2,46 @@ use std::collections::HashMap;
|
|||||||
|
|
||||||
use godot::{
|
use godot::{
|
||||||
classes::{
|
classes::{
|
||||||
Control, GridContainer, IPanelContainer, Label, LineEdit, PanelContainer,
|
Button, Control, GridContainer, IPanelContainer, InputEvent, InputEventKey,
|
||||||
control::SizeFlags,
|
InputEventMouseButton, InputMap, Label, LineEdit, PanelContainer,
|
||||||
|
control::{FocusBehaviorRecursive, FocusMode, SizeFlags},
|
||||||
},
|
},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::{game_settings::GameSettingsManager, ui::slider::SliderContainer};
|
use crate::{
|
||||||
|
game_settings::{GameSettingsManager, Keybind},
|
||||||
|
ui::slider::SliderContainer,
|
||||||
|
};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Ord, Eq, Hash)]
|
#[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Ord, Eq, Hash)]
|
||||||
pub enum Setting {
|
pub enum Setting {
|
||||||
|
// General settings
|
||||||
FoV,
|
FoV,
|
||||||
DefaultName,
|
DefaultName,
|
||||||
|
|
||||||
|
// Volume settings
|
||||||
MasterVolume,
|
MasterVolume,
|
||||||
SfxVolume,
|
SfxVolume,
|
||||||
MusicVolume,
|
MusicVolume,
|
||||||
AnnouncerVolume,
|
AnnouncerVolume,
|
||||||
|
|
||||||
|
// Keybinds
|
||||||
|
MoveLeft,
|
||||||
|
MoveForward,
|
||||||
|
MoveRight,
|
||||||
|
MoveBackward,
|
||||||
|
Shoot,
|
||||||
|
Melee,
|
||||||
|
Jump,
|
||||||
|
SelectRaygun,
|
||||||
|
SelectShotgun,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub enum SettingsTab {
|
pub enum SettingsTab {
|
||||||
General,
|
General,
|
||||||
Volume,
|
Volume,
|
||||||
|
Keybinds,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToString for Setting {
|
impl ToString for Setting {
|
||||||
@ -30,10 +49,21 @@ impl ToString for Setting {
|
|||||||
match self {
|
match self {
|
||||||
Setting::FoV => "Field of View",
|
Setting::FoV => "Field of View",
|
||||||
Setting::DefaultName => "Default Name",
|
Setting::DefaultName => "Default Name",
|
||||||
|
|
||||||
Setting::MasterVolume => "Master volume",
|
Setting::MasterVolume => "Master volume",
|
||||||
Setting::SfxVolume => "Sfx Volume",
|
Setting::SfxVolume => "Sfx Volume",
|
||||||
Setting::MusicVolume => "Music Volume",
|
Setting::MusicVolume => "Music Volume",
|
||||||
Setting::AnnouncerVolume => "Announcer Volume",
|
Setting::AnnouncerVolume => "Announcer Volume",
|
||||||
|
|
||||||
|
Setting::MoveLeft => "Move left",
|
||||||
|
Setting::MoveRight => "Move right",
|
||||||
|
Setting::MoveForward => "Move forward",
|
||||||
|
Setting::MoveBackward => "Move backward",
|
||||||
|
Setting::SelectRaygun => "Select Raygun",
|
||||||
|
Setting::SelectShotgun => "Select Shotgun",
|
||||||
|
Setting::Shoot => "Shoot",
|
||||||
|
Setting::Melee => "Melee",
|
||||||
|
Setting::Jump => "Jump",
|
||||||
}
|
}
|
||||||
.to_string()
|
.to_string()
|
||||||
}
|
}
|
||||||
@ -44,10 +74,13 @@ impl Setting {
|
|||||||
match self {
|
match self {
|
||||||
Setting::FoV => SettingsTab::General,
|
Setting::FoV => SettingsTab::General,
|
||||||
Setting::DefaultName => SettingsTab::General,
|
Setting::DefaultName => SettingsTab::General,
|
||||||
|
|
||||||
Setting::MasterVolume => SettingsTab::Volume,
|
Setting::MasterVolume => SettingsTab::Volume,
|
||||||
Setting::SfxVolume => SettingsTab::Volume,
|
Setting::SfxVolume => SettingsTab::Volume,
|
||||||
Setting::MusicVolume => SettingsTab::Volume,
|
Setting::MusicVolume => SettingsTab::Volume,
|
||||||
Setting::AnnouncerVolume => SettingsTab::Volume,
|
Setting::AnnouncerVolume => SettingsTab::Volume,
|
||||||
|
|
||||||
|
_ => SettingsTab::Keybinds,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -56,6 +89,7 @@ impl Setting {
|
|||||||
pub enum SettingValue {
|
pub enum SettingValue {
|
||||||
SliderNumber(SliderValue),
|
SliderNumber(SliderValue),
|
||||||
String(String),
|
String(String),
|
||||||
|
Keybind(Keybind),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
@ -73,10 +107,14 @@ pub struct SettingsPanel {
|
|||||||
#[export]
|
#[export]
|
||||||
volume_grid: Option<Gd<GridContainer>>,
|
volume_grid: Option<Gd<GridContainer>>,
|
||||||
#[export]
|
#[export]
|
||||||
|
keybinds_grid: Option<Gd<GridContainer>>,
|
||||||
|
#[export]
|
||||||
slider_scene: Option<Gd<PackedScene>>,
|
slider_scene: Option<Gd<PackedScene>>,
|
||||||
|
|
||||||
settings: HashMap<Setting, SettingValue>,
|
settings: HashMap<Setting, SettingValue>,
|
||||||
|
|
||||||
|
keybind_button: Option<(Setting, Gd<Button>)>,
|
||||||
|
|
||||||
base: Base<PanelContainer>,
|
base: Base<PanelContainer>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,6 +168,41 @@ impl IPanelContainer for SettingsPanel {
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
self.settings.insert(
|
||||||
|
Setting::MoveForward,
|
||||||
|
SettingValue::Keybind(settings.keybinds.move_forward),
|
||||||
|
);
|
||||||
|
self.settings.insert(
|
||||||
|
Setting::MoveBackward,
|
||||||
|
SettingValue::Keybind(settings.keybinds.move_backward),
|
||||||
|
);
|
||||||
|
self.settings.insert(
|
||||||
|
Setting::MoveLeft,
|
||||||
|
SettingValue::Keybind(settings.keybinds.move_left),
|
||||||
|
);
|
||||||
|
self.settings.insert(
|
||||||
|
Setting::MoveRight,
|
||||||
|
SettingValue::Keybind(settings.keybinds.move_right),
|
||||||
|
);
|
||||||
|
self.settings.insert(
|
||||||
|
Setting::SelectRaygun,
|
||||||
|
SettingValue::Keybind(settings.keybinds.select_raygun),
|
||||||
|
);
|
||||||
|
self.settings.insert(
|
||||||
|
Setting::SelectShotgun,
|
||||||
|
SettingValue::Keybind(settings.keybinds.select_shotgun),
|
||||||
|
);
|
||||||
|
self.settings.insert(
|
||||||
|
Setting::Shoot,
|
||||||
|
SettingValue::Keybind(settings.keybinds.shoot),
|
||||||
|
);
|
||||||
|
self.settings.insert(
|
||||||
|
Setting::Melee,
|
||||||
|
SettingValue::Keybind(settings.keybinds.melee),
|
||||||
|
);
|
||||||
|
self.settings
|
||||||
|
.insert(Setting::Jump, SettingValue::Keybind(settings.keybinds.jump));
|
||||||
|
|
||||||
let mut keys = self.settings.keys().collect::<Vec<_>>();
|
let mut keys = self.settings.keys().collect::<Vec<_>>();
|
||||||
keys.sort();
|
keys.sort();
|
||||||
|
|
||||||
@ -139,6 +212,7 @@ impl IPanelContainer for SettingsPanel {
|
|||||||
let grid = match setting.tab() {
|
let grid = match setting.tab() {
|
||||||
SettingsTab::General => self.general_grid.clone(),
|
SettingsTab::General => self.general_grid.clone(),
|
||||||
SettingsTab::Volume => self.volume_grid.clone(),
|
SettingsTab::Volume => self.volume_grid.clone(),
|
||||||
|
SettingsTab::Keybinds => self.keybinds_grid.clone(),
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(mut grid) = grid {
|
if let Some(mut grid) = grid {
|
||||||
@ -191,6 +265,28 @@ impl IPanelContainer for SettingsPanel {
|
|||||||
|
|
||||||
line_edit.upcast()
|
line_edit.upcast()
|
||||||
}
|
}
|
||||||
|
SettingValue::Keybind(value) => {
|
||||||
|
let mut toggle_button = Button::new_alloc();
|
||||||
|
toggle_button.set_text(&value.to_string());
|
||||||
|
toggle_button.set_toggle_mode(true);
|
||||||
|
|
||||||
|
let setting_clone = setting.clone();
|
||||||
|
let button_clone = toggle_button.clone();
|
||||||
|
toggle_button
|
||||||
|
.signals()
|
||||||
|
.pressed()
|
||||||
|
.connect_other(self, move |s| {
|
||||||
|
if let Some((_, mut button)) = s.keybind_button.take() {
|
||||||
|
button.set_pressed(false);
|
||||||
|
}
|
||||||
|
s.base_mut().set_focus_behavior_recursive(
|
||||||
|
FocusBehaviorRecursive::DISABLED,
|
||||||
|
);
|
||||||
|
s.keybind_button = Some((setting_clone, button_clone.clone()))
|
||||||
|
});
|
||||||
|
|
||||||
|
toggle_button.upcast()
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
grid.add_child(&node);
|
grid.add_child(&node);
|
||||||
@ -198,6 +294,19 @@ impl IPanelContainer for SettingsPanel {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn input(&mut self, event: Gd<InputEvent>) {
|
||||||
|
if let Some((setting, mut button)) = self.keybind_button.clone()
|
||||||
|
&& let Some(keybind) = Keybind::from_event(event)
|
||||||
|
{
|
||||||
|
self.keybind_button.take();
|
||||||
|
self.on_change(setting.clone(), SettingValue::Keybind(keybind));
|
||||||
|
button.set_text(&keybind.to_string());
|
||||||
|
button.set_pressed(false);
|
||||||
|
self.base_mut()
|
||||||
|
.set_focus_behavior_recursive(FocusBehaviorRecursive::INHERITED);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[godot_api]
|
#[godot_api]
|
||||||
@ -214,6 +323,7 @@ impl SettingsPanel {
|
|||||||
(Setting::DefaultName, SettingValue::String(value)) => {
|
(Setting::DefaultName, SettingValue::String(value)) => {
|
||||||
new_settings.default_name = value.clone()
|
new_settings.default_name = value.clone()
|
||||||
}
|
}
|
||||||
|
|
||||||
(Setting::MasterVolume, SettingValue::SliderNumber(value)) => {
|
(Setting::MasterVolume, SettingValue::SliderNumber(value)) => {
|
||||||
new_settings.volume.master_volume = value.value;
|
new_settings.volume.master_volume = value.value;
|
||||||
}
|
}
|
||||||
@ -226,6 +336,34 @@ impl SettingsPanel {
|
|||||||
(Setting::AnnouncerVolume, SettingValue::SliderNumber(value)) => {
|
(Setting::AnnouncerVolume, SettingValue::SliderNumber(value)) => {
|
||||||
new_settings.volume.announcer_volume = value.value;
|
new_settings.volume.announcer_volume = value.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(Setting::MoveRight, SettingValue::Keybind(keybind)) => {
|
||||||
|
new_settings.keybinds.move_right = *keybind;
|
||||||
|
}
|
||||||
|
(Setting::MoveLeft, SettingValue::Keybind(keybind)) => {
|
||||||
|
new_settings.keybinds.move_left = *keybind;
|
||||||
|
}
|
||||||
|
(Setting::MoveForward, SettingValue::Keybind(keybind)) => {
|
||||||
|
new_settings.keybinds.move_forward = *keybind;
|
||||||
|
}
|
||||||
|
(Setting::MoveBackward, SettingValue::Keybind(keybind)) => {
|
||||||
|
new_settings.keybinds.move_backward = *keybind;
|
||||||
|
}
|
||||||
|
(Setting::SelectRaygun, SettingValue::Keybind(keybind)) => {
|
||||||
|
new_settings.keybinds.select_raygun = *keybind;
|
||||||
|
}
|
||||||
|
(Setting::SelectShotgun, SettingValue::Keybind(keybind)) => {
|
||||||
|
new_settings.keybinds.select_raygun = *keybind;
|
||||||
|
}
|
||||||
|
(Setting::Shoot, SettingValue::Keybind(keybind)) => {
|
||||||
|
new_settings.keybinds.shoot = *keybind;
|
||||||
|
}
|
||||||
|
(Setting::Melee, SettingValue::Keybind(keybind)) => {
|
||||||
|
new_settings.keybinds.melee = *keybind;
|
||||||
|
}
|
||||||
|
(Setting::Jump, SettingValue::Keybind(keybind)) => {
|
||||||
|
new_settings.keybinds.jump = *keybind;
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user