Add a cheese counter in the bag display.

This commit is contained in:
Avi Weinstock 2021-04-04 11:14:25 -04:00
parent 1e18904092
commit 78f130a3b2
3 changed files with 22 additions and 6 deletions

View File

@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Buy and sell prices in tooltips when trading with a merchant now have colors. - Buy and sell prices in tooltips when trading with a merchant now have colors.
- Attacks now emit sound effects from the target on hit. - Attacks now emit sound effects from the target on hit.
- Crafting menu tabs - Crafting menu tabs
- Cheese count indicator next to the coin count indicator
### Changed ### Changed

View File

@ -49,8 +49,10 @@ widget_ids! {
bg_frame, bg_frame,
char_ico, char_ico,
coin_ico, coin_ico,
cheese_ico,
space_txt, space_txt,
currency_txt, coin_txt,
cheese_txt,
inventory_title, inventory_title,
inventory_title_bg, inventory_title_bg,
scrollbar_bg, scrollbar_bg,
@ -336,19 +338,32 @@ impl<'a> InventoryScroller<'a> {
let bag_space = format!("{}/{}", space_used, space_max); let bag_space = format!("{}/{}", space_used, space_max);
let bag_space_percentage = space_used as f32 / space_max as f32; let bag_space_percentage = space_used as f32 / space_max as f32;
let coin_itemdef = Arc::<ItemDef>::load_expect_cloned("common.items.utility.coins"); let coin_itemdef = Arc::<ItemDef>::load_expect_cloned("common.items.utility.coins");
let currency = self.inventory.item_count(&coin_itemdef); let coin_count = self.inventory.item_count(&coin_itemdef);
let cheese_itemdef = Arc::<ItemDef>::load_expect_cloned("common.items.food.cheese");
let cheese_count = self.inventory.item_count(&cheese_itemdef);
// Coin Icon and Currency Text // Coin Icon and Coin Text
Image::new(self.imgs.coin_ico) Image::new(self.imgs.coin_ico)
.w_h(16.0, 17.0) .w_h(16.0, 17.0)
.bottom_left_with_margins_on(self.bg_ids.bg_frame, 2.0, 43.0) .bottom_left_with_margins_on(self.bg_ids.bg_frame, 2.0, 43.0)
.set(state.ids.coin_ico, ui); .set(state.ids.coin_ico, ui);
Text::new(&format!("{}", currency)) Text::new(&format!("{}", coin_count))
.bottom_left_with_margins_on(self.bg_ids.bg_frame, 6.0, 64.0) .bottom_left_with_margins_on(self.bg_ids.bg_frame, 6.0, 64.0)
.font_id(self.fonts.cyri.conrod_id) .font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14)) .font_size(self.fonts.cyri.scale(14))
.color(Color::Rgba(0.871, 0.863, 0.05, 1.0)) .color(Color::Rgba(0.871, 0.863, 0.05, 1.0))
.set(state.ids.currency_txt, ui); .set(state.ids.coin_txt, ui);
// Cheese Icon and Cheese Text
Image::new(self.imgs.cheese_ico)
.w_h(16.0, 17.0)
.bottom_left_with_margins_on(self.bg_ids.bg_frame, 2.0, 110.0)
.set(state.ids.cheese_ico, ui);
Text::new(&format!("{}", cheese_count))
.bottom_left_with_margins_on(self.bg_ids.bg_frame, 6.0, 144.0)
.font_id(self.fonts.cyri.conrod_id)
.font_size(self.fonts.cyri.scale(14))
.color(Color::Rgba(0.871, 0.863, 0.05, 1.0))
.set(state.ids.cheese_txt, ui);
//Free Bag-Space //Free Bag-Space
Text::new(&bag_space) Text::new(&bag_space)
.bottom_right_with_margins_on(self.bg_ids.bg_frame, 6.0, 43.0) .bottom_right_with_margins_on(self.bg_ids.bg_frame, 6.0, 43.0)
@ -403,7 +418,6 @@ widget_ids! {
char_ico, char_ico,
coin_ico, coin_ico,
space_txt, space_txt,
currency_txt,
inventory_title, inventory_title,
inventory_title_bg, inventory_title_bg,
scrollbar_bg, scrollbar_bg,

View File

@ -410,6 +410,7 @@ image_ids! {
expand_btn_hover: "voxygen.element.buttons.inv_expand_hover", expand_btn_hover: "voxygen.element.buttons.inv_expand_hover",
expand_btn_press: "voxygen.element.buttons.inv_expand_press", expand_btn_press: "voxygen.element.buttons.inv_expand_press",
coin_ico: "voxygen.element.icons.coin", coin_ico: "voxygen.element.icons.coin",
cheese_ico: "voxygen.element.icons.item_cheese",
inv_bg_armor: "voxygen.element.misc_bg.inv_bg_0", inv_bg_armor: "voxygen.element.misc_bg.inv_bg_0",
inv_bg_stats: "voxygen.element.misc_bg.inv_bg_1", inv_bg_stats: "voxygen.element.misc_bg.inv_bg_1",
inv_frame: "voxygen.element.misc_bg.inv_frame", inv_frame: "voxygen.element.misc_bg.inv_frame",