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(
|
Item(
|
||||||
name: "Lime Zest Lantern",
|
name: "Lime Zest Lantern",
|
||||||
description: "It has an opening that could fit a ring...",
|
description: "It has an opening that could fit a ring...",
|
||||||
kind: Armor(
|
|
||||||
kind: Lantern(Green0),
|
kind: Lantern(Green0),
|
||||||
stats: (20),
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
|
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
|
// TODO: make more robust wrt multiple events in the same frame (eg event order
|
||||||
// may matter) TODO: handle taps as well
|
// 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 {
|
if click_count > 0 {
|
||||||
let odd_num_clicks = click_count % 2 == 1;
|
let odd_num_clicks = click_count % 2 == 1;
|
||||||
self.state = if let ManagerState::Selected(id, other_slot) = self.state {
|
self.state = if let ManagerState::Selected(id, other_slot) = self.state {
|
||||||
@ -255,18 +256,26 @@ where
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// If not dragging and there is a drag event on this slot start dragging
|
// Use on right click if not dragging
|
||||||
if ui.widget_input(widget).drags().left().next().is_some() {
|
if input.clicks().right().next().is_some() {
|
||||||
match self.state {
|
match self.state {
|
||||||
ManagerState::Selected(_, _) | ManagerState::Idle => {
|
ManagerState::Selected(_, _) | ManagerState::Idle => {
|
||||||
|
self.events.push(Event::Used(slot));
|
||||||
|
// If something is selected, deselect
|
||||||
|
self.state = ManagerState::Idle;
|
||||||
|
},
|
||||||
|
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
|
// Start dragging if widget is filled
|
||||||
if let Some(img) = content_img {
|
if let Some(img) = content_img {
|
||||||
self.state = ManagerState::Dragging(widget, slot, img);
|
self.state = ManagerState::Dragging(widget, slot, img);
|
||||||
}
|
}
|
||||||
},
|
|
||||||
// Already dragging or id doesn't match
|
|
||||||
_ => {},
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Determine whether this slot is being interacted with
|
// Determine whether this slot is being interacted with
|
||||||
|
Loading…
Reference in New Issue
Block a user