hotbar keybindings

This commit is contained in:
Pfauenauge90 2020-04-09 03:15:54 +02:00
parent a29f199e80
commit f24ba71d94
5 changed files with 219 additions and 81 deletions

View File

@ -288,7 +288,16 @@ Viel Spaß in der Welt von Veloren, Abenteurer!"#,
"gameinput.primary": "Linker mittlerer Slot",
"gameinput.secondary": "Rechter mittlerer Slot",
"gameinput.ability3": "Hotbar Slot 1",
"gameinput.slot1": "Hotbar Slot 1",
"gameinput.slot2": "Hotbar Slot 2",
"gameinput.slot3": "Hotbar Slot 3",
"gameinput.slot4": "Hotbar Slot 4",
"gameinput.slot5": "Hotbar Slot 5",
"gameinput.slot6": "Hotbar Slot 6",
"gameinput.slot7": "Hotbar Slot 7",
"gameinput.slot8": "Hotbar Slot 8",
"gameinput.slot9": "Hotbar Slot 9",
"gameinput.slot10": "Hotbar Slot 10",
"gameinput.swaploadout": "Waffe wechseln",
"gameinput.togglecursor": "Mauszeiger zeigen/verstecken",
"gameinput.help": "Hilfe anzeigen",

View File

@ -285,7 +285,16 @@ Enjoy your stay in the World of Veloren."#,
"gameinput.primary": "Basic Attack",
"gameinput.secondary": "Secondary Attack/Block/Aim",
"gameinput.ability3": "Hotbar Slot 1",
"gameinput.slot1": "Hotbar Slot 1",
"gameinput.slot2": "Hotbar Slot 2",
"gameinput.slot3": "Hotbar Slot 3",
"gameinput.slot4": "Hotbar Slot 4",
"gameinput.slot5": "Hotbar Slot 5",
"gameinput.slot6": "Hotbar Slot 6",
"gameinput.slot7": "Hotbar Slot 7",
"gameinput.slot8": "Hotbar Slot 8",
"gameinput.slot9": "Hotbar Slot 9",
"gameinput.slot10": "Hotbar Slot 10",
"gameinput.swaploadout": "Swap Loadout",
"gameinput.togglecursor": "Toggle Cursor",
"gameinput.help": "Toggle Help Window",

View File

@ -925,78 +925,162 @@ impl<'a> Widget for Skillbar<'a> {
// Shortcuts
if let ShortcutNumbers::On = shortcuts {
Text::new("1")
.top_right_with_margins_on(state.ids.slot1_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot1_text, ui);
Text::new("2")
.top_right_with_margins_on(state.ids.slot2_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot2_text, ui);
Text::new("3")
.top_right_with_margins_on(state.ids.slot3_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot3_text, ui);
Text::new("4")
.top_right_with_margins_on(state.ids.slot4_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot4_text, ui);
Text::new("5")
.top_right_with_margins_on(state.ids.slot5_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot5_text, ui);
Text::new("M1")
.top_left_with_margins_on(state.ids.m1_slot, 5.0, 5.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.m1_text, ui);
Text::new("M2")
.top_right_with_margins_on(state.ids.m2_slot, 5.0, 5.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.m2_text, ui);
Text::new("6")
.top_left_with_margins_on(state.ids.slot6_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot6_text, ui);
Text::new("7")
.top_left_with_margins_on(state.ids.slot7_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot7_text, ui);
Text::new("8")
.top_left_with_margins_on(state.ids.slot8_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot8_text, ui);
Text::new("9")
.top_left_with_margins_on(state.ids.slot9_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot9_text, ui);
Text::new("Q")
.top_left_with_margins_on(state.ids.slotq_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slotq_text, ui);
if let Some(slot1) = &self
.global_state
.settings
.controls
.get_binding(GameInput::Ability3)
{
Text::new(slot1.to_string().as_str())
.top_right_with_margins_on(state.ids.slot1_bg, 1.0, 2.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot1_text, ui);
}
if let Some(slot2) = &self
.global_state
.settings
.controls
.get_binding(GameInput::Slot2)
{
Text::new(slot2.to_string().as_str())
.top_right_with_margins_on(state.ids.slot2_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot2_text, ui);
}
if let Some(slot3) = &self
.global_state
.settings
.controls
.get_binding(GameInput::Slot3)
{
Text::new(slot3.to_string().as_str())
.top_right_with_margins_on(state.ids.slot3_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot3_text, ui);
}
if let Some(slot4) = &self
.global_state
.settings
.controls
.get_binding(GameInput::Slot4)
{
Text::new(slot4.to_string().as_str())
.top_right_with_margins_on(state.ids.slot4_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot4_text, ui);
}
if let Some(slot5) = &self
.global_state
.settings
.controls
.get_binding(GameInput::Slot5)
{
Text::new(slot5.to_string().as_str())
.top_right_with_margins_on(state.ids.slot5_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot5_text, ui);
}
if let Some(m1) = &self
.global_state
.settings
.controls
.get_binding(GameInput::Primary)
{
Text::new(m1.to_string().as_str())
.top_left_with_margins_on(state.ids.m1_slot, 5.0, 5.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.m1_text, ui);
}
if let Some(m2) = &self
.global_state
.settings
.controls
.get_binding(GameInput::Secondary)
{
Text::new(m2.to_string().as_str())
.top_right_with_margins_on(state.ids.m2_slot, 5.0, 5.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.m2_text, ui);
}
if let Some(slot6) = &self
.global_state
.settings
.controls
.get_binding(GameInput::Slot6)
{
Text::new(slot6.to_string().as_str())
.top_left_with_margins_on(state.ids.slot6_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot6_text, ui);
}
if let Some(slot7) = &self
.global_state
.settings
.controls
.get_binding(GameInput::Slot7)
{
Text::new(slot7.to_string().as_str())
.top_left_with_margins_on(state.ids.slot7_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot7_text, ui);
}
if let Some(slot8) = &self
.global_state
.settings
.controls
.get_binding(GameInput::Slot8)
{
Text::new(slot8.to_string().as_str())
.top_left_with_margins_on(state.ids.slot8_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot8_text, ui);
}
if let Some(slot9) = &self
.global_state
.settings
.controls
.get_binding(GameInput::Slot9)
{
Text::new(slot9.to_string().as_str())
.top_left_with_margins_on(state.ids.slot9_bg, 1.0, 1.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slot9_text, ui);
}
if let Some(slot10) = &self
.global_state
.settings
.controls
.get_binding(GameInput::Slot10)
{
Text::new(slot10.to_string().as_str())
.top_left_with_margins_on(state.ids.slotq_bg, 1.0, 2.0)
.font_size(self.fonts.cyri.scale(8))
.font_id(self.fonts.cyri.conrod_id)
.color(TEXT_COLOR)
.set(state.ids.slotq_text, ui);
}
};
// Lifebar

View File

@ -139,6 +139,15 @@ impl ControlSettings {
//GameInput::Charge => KeyMouse::Key(VirtualKeyCode::Key1),
GameInput::FreeLook => KeyMouse::Key(VirtualKeyCode::L),
GameInput::Ability3 => KeyMouse::Key(VirtualKeyCode::Key1),
GameInput::Slot2 => KeyMouse::Key(VirtualKeyCode::Key2),
GameInput::Slot3 => KeyMouse::Key(VirtualKeyCode::Key3),
GameInput::Slot4 => KeyMouse::Key(VirtualKeyCode::Key4),
GameInput::Slot5 => KeyMouse::Key(VirtualKeyCode::Key5),
GameInput::Slot6 => KeyMouse::Key(VirtualKeyCode::Key6),
GameInput::Slot7 => KeyMouse::Key(VirtualKeyCode::Key7),
GameInput::Slot8 => KeyMouse::Key(VirtualKeyCode::Key8),
GameInput::Slot9 => KeyMouse::Key(VirtualKeyCode::Key9),
GameInput::Slot10 => KeyMouse::Key(VirtualKeyCode::Q),
GameInput::SwapLoadout => KeyMouse::Key(VirtualKeyCode::LAlt),
}
}
@ -188,6 +197,15 @@ impl Default for ControlSettings {
//GameInput::Charge,
GameInput::FreeLook,
GameInput::Ability3,
GameInput::Slot2,
GameInput::Slot3,
GameInput::Slot4,
GameInput::Slot5,
GameInput::Slot6,
GameInput::Slot7,
GameInput::Slot8,
GameInput::Slot9,
GameInput::Slot10,
GameInput::SwapLoadout,
];
for game_input in game_inputs {
@ -256,7 +274,7 @@ pub mod con_settings {
pub glide: Button,
pub climb: Button,
pub climb_down: Button,
pub wall_leap: Button,
//pub wall_leap: Button,
pub mount: Button,
pub map: Button,
pub bag: Button,
@ -276,7 +294,7 @@ pub mod con_settings {
pub interact: Button,
pub toggle_wield: Button,
pub swap_loadout: Button,
pub charge: Button,
//pub charge: Button,
}
#[derive(Clone, Debug, Serialize, Deserialize)]
@ -342,7 +360,7 @@ pub mod con_settings {
glide: Button::Simple(GilButton::LeftTrigger),
climb: Button::Simple(GilButton::South),
climb_down: Button::Simple(GilButton::Unknown),
wall_leap: Button::Simple(GilButton::Unknown),
//wall_leap: Button::Simple(GilButton::Unknown),
mount: Button::Simple(GilButton::North),
map: Button::Simple(GilButton::DPadRight),
bag: Button::Simple(GilButton::DPadDown),
@ -362,7 +380,7 @@ pub mod con_settings {
interact: Button::Simple(GilButton::LeftTrigger2),
toggle_wield: Button::Simple(GilButton::DPadLeft),
swap_loadout: Button::Simple(GilButton::Unknown),
charge: Button::Simple(GilButton::Unknown),
//charge: Button::Simple(GilButton::Unknown),
}
}
}

View File

@ -18,6 +18,15 @@ pub enum GameInput {
Primary,
Secondary,
Ability3,
Slot2,
Slot3,
Slot4,
Slot5,
Slot6,
Slot7,
Slot8,
Slot9,
Slot10,
ToggleCursor,
MoveForward,
MoveBack,
@ -90,7 +99,16 @@ impl GameInput {
GameInput::ToggleWield => "gameinput.togglewield",
//GameInput::Charge => "gameinput.charge",
GameInput::FreeLook => "gameinput.freelook",
GameInput::Ability3 => "gameinput.ability3",
GameInput::Ability3 => "gameinput.slot1",
GameInput::Slot2 => "gameinput.slot2",
GameInput::Slot3 => "gameinput.slot3",
GameInput::Slot4 => "gameinput.slot4",
GameInput::Slot5 => "gameinput.slot5",
GameInput::Slot6 => "gameinput.slot6",
GameInput::Slot7 => "gameinput.slot7",
GameInput::Slot8 => "gameinput.slot8",
GameInput::Slot9 => "gameinput.slot9",
GameInput::Slot10 => "gameinput.slot10",
GameInput::SwapLoadout => "gameinput.swaploadout",
}
}
@ -341,8 +359,8 @@ impl fmt::Display for KeyMouse {
Key(Copy) => "Copy",
Key(Paste) => "Paste",
Key(Cut) => "Cut",
Mouse(MouseButton::Left) => "Mouse L-Click",
Mouse(MouseButton::Right) => "Mouse R-Click",
Mouse(MouseButton::Left) => "Mouse Left",
Mouse(MouseButton::Right) => "Mouse Right",
Mouse(MouseButton::Middle) => "Mouse Middle-Click",
Mouse(MouseButton::Other(button)) =>
return write!(f, "Unknown Mouse Button: {:?}", button),