mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
fmt
This commit is contained in:
parent
03894cb2ab
commit
991e4b15e5
@ -95,13 +95,22 @@ impl<'a> Widget for Bag<'a> {
|
|||||||
.set(state.ids.inv_scrollbar, ui);
|
.set(state.ids.inv_scrollbar, ui);
|
||||||
// Create available inventory slot widgets
|
// Create available inventory slot widgets
|
||||||
if state.ids.inv_slot.len() < self.inventory_space {
|
if state.ids.inv_slot.len() < self.inventory_space {
|
||||||
state.update(|s| { s.ids.inv_slot.resize(self.inventory_space, &mut ui.widget_id_generator());});}
|
state.update(|s| {
|
||||||
|
s.ids
|
||||||
|
.inv_slot
|
||||||
|
.resize(self.inventory_space, &mut ui.widget_id_generator());
|
||||||
|
});
|
||||||
|
}
|
||||||
// "Allowed" max. inventory space should be handled serverside and thus isn't limited in the UI
|
// "Allowed" max. inventory space should be handled serverside and thus isn't limited in the UI
|
||||||
for i in 0..self.inventory_space {
|
for i in 0..self.inventory_space {
|
||||||
let x = i % 5;
|
let x = i % 5;
|
||||||
let y = i / 5;
|
let y = i / 5;
|
||||||
Button::image(self.imgs.inv_slot)
|
Button::image(self.imgs.inv_slot)
|
||||||
.top_left_with_margins_on(state.ids.inv_grid_1, 4.0 + y as f64 * (40.0 + 4.0), 4.0 + x as f64 * (40.0 + 4.0)) // conrod uses a (y,x) format for placing...
|
.top_left_with_margins_on(
|
||||||
|
state.ids.inv_grid_1,
|
||||||
|
4.0 + y as f64 * (40.0 + 4.0),
|
||||||
|
4.0 + x as f64 * (40.0 + 4.0),
|
||||||
|
) // conrod uses a (y,x) format for placing...
|
||||||
.parent(state.ids.inv_grid_2) // Avoids the background overlapping available slots
|
.parent(state.ids.inv_grid_2) // Avoids the background overlapping available slots
|
||||||
.w_h(40.0, 40.0)
|
.w_h(40.0, 40.0)
|
||||||
.set(state.ids.inv_slot[i], ui);
|
.set(state.ids.inv_slot[i], ui);
|
||||||
@ -118,7 +127,6 @@ impl<'a> Widget for Bag<'a> {
|
|||||||
.label_y(Relative::Scalar(-10.0))
|
.label_y(Relative::Scalar(-10.0))
|
||||||
.label_color(TEXT_COLOR)
|
.label_color(TEXT_COLOR)
|
||||||
.set(state.ids.item1, ui); // TODO: Add widget_id generator for displayed items
|
.set(state.ids.item1, ui); // TODO: Add widget_id generator for displayed items
|
||||||
|
|
||||||
}
|
}
|
||||||
// X-button
|
// X-button
|
||||||
if Button::image(self.imgs.close_button)
|
if Button::image(self.imgs.close_button)
|
||||||
|
Loading…
Reference in New Issue
Block a user