mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Add right click to use, latern is not armor tweaks
This commit is contained in:
parent
f52d66d721
commit
77d13376d3
@ -1,8 +0,0 @@
|
||||
Item(
|
||||
name: "Black Lantern",
|
||||
description: "Used by city guards.",
|
||||
kind: Armor(
|
||||
kind: Lantern(Black0),
|
||||
stats: (20),
|
||||
),
|
||||
)
|
@ -1,8 +0,0 @@
|
||||
Item(
|
||||
name: "Lime Zest Lantern",
|
||||
description: "It has an opening that could fit a ring...",
|
||||
kind: Armor(
|
||||
kind: Lantern(Green0),
|
||||
stats: (20),
|
||||
),
|
||||
)
|
@ -1,8 +1,5 @@
|
||||
Item(
|
||||
name: "Lime Zest Lantern",
|
||||
description: "It has an opening that could fit a ring...",
|
||||
kind: Armor(
|
||||
kind: Lantern(Green0),
|
||||
stats: (20),
|
||||
),
|
||||
description: "It has an opening that could fit a ring...",
|
||||
kind: Lantern(Green0),
|
||||
)
|
||||
|
5
assets/common/items/lantern/black_0.ron
Normal file
5
assets/common/items/lantern/black_0.ron
Normal file
@ -0,0 +1,5 @@
|
||||
Item(
|
||||
name: "Black Lantern",
|
||||
description: "Used by city guards.",
|
||||
kind: Lantern(Black0),
|
||||
)
|
5
assets/common/items/lantern/green_0.ron
Normal file
5
assets/common/items/lantern/green_0.ron
Normal file
@ -0,0 +1,5 @@
|
||||
Item(
|
||||
name: "Lime Zest Lantern",
|
||||
description: "It has an opening that could fit a ring...",
|
||||
kind: Lantern(Green0),
|
||||
)
|
@ -217,9 +217,10 @@ where
|
||||
_ => (),
|
||||
}
|
||||
|
||||
let input = ui.widget_input(widget);
|
||||
// TODO: make more robust wrt multiple events in the same frame (eg event order
|
||||
// may matter) TODO: handle taps as well
|
||||
let click_count = ui.widget_input(widget).clicks().left().count();
|
||||
let click_count = input.clicks().left().count();
|
||||
if click_count > 0 {
|
||||
let odd_num_clicks = click_count % 2 == 1;
|
||||
self.state = if let ManagerState::Selected(id, other_slot) = self.state {
|
||||
@ -255,17 +256,25 @@ where
|
||||
};
|
||||
}
|
||||
|
||||
// If not dragging and there is a drag event on this slot start dragging
|
||||
if ui.widget_input(widget).drags().left().next().is_some() {
|
||||
// Use on right click if not dragging
|
||||
if input.clicks().right().next().is_some() {
|
||||
match self.state {
|
||||
ManagerState::Selected(_, _) | ManagerState::Idle => {
|
||||
// Start dragging if widget is filled
|
||||
if let Some(img) = content_img {
|
||||
self.state = ManagerState::Dragging(widget, slot, img);
|
||||
}
|
||||
self.events.push(Event::Used(slot));
|
||||
// If something is selected, deselect
|
||||
self.state = ManagerState::Idle;
|
||||
},
|
||||
// Already dragging or id doesn't match
|
||||
_ => {},
|
||||
ManagerState::Dragging(_, _, _) => {},
|
||||
}
|
||||
}
|
||||
|
||||
// If not dragging and there is a drag event on this slot start dragging
|
||||
if input.drags().left().next().is_some()
|
||||
&& !matches!(self.state, ManagerState::Dragging(_, _, _))
|
||||
{
|
||||
// Start dragging if widget is filled
|
||||
if let Some(img) = content_img {
|
||||
self.state = ManagerState::Dragging(widget, slot, img);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user