Show main menu even if there are no stats

This commit is contained in:
Imbris 2020-05-14 19:10:27 -04:00
parent 51eb928eb8
commit eac11ecfe8

View File

@ -1616,29 +1616,27 @@ impl Hud {
// Bag button and nearby icons // Bag button and nearby icons
let ecs = client.state().ecs(); let ecs = client.state().ecs();
let stats = ecs.read_storage::<comp::Stats>(); let stats = ecs.read_storage::<comp::Stats>();
let player_stats = match stats.get(client.entity()) { if let Some(player_stats) = stats.get(client.entity()) {
Some(stats) => stats, match Buttons::new(
None => return events, client,
}; self.show.bag,
match Buttons::new( &self.imgs,
client, &self.fonts,
self.show.bag, global_state,
&self.imgs, &self.rot_imgs,
&self.fonts, tooltip_manager,
global_state, &self.voxygen_i18n,
&self.rot_imgs, &player_stats,
tooltip_manager, )
&self.voxygen_i18n, .set(self.ids.buttons, ui_widgets)
&player_stats, {
) Some(buttons::Event::ToggleBag) => self.show.toggle_bag(),
.set(self.ids.buttons, ui_widgets) Some(buttons::Event::ToggleSettings) => self.show.toggle_settings(),
{ Some(buttons::Event::ToggleSocial) => self.show.toggle_social(),
Some(buttons::Event::ToggleBag) => self.show.toggle_bag(), Some(buttons::Event::ToggleSpell) => self.show.toggle_spell(),
Some(buttons::Event::ToggleSettings) => self.show.toggle_settings(), Some(buttons::Event::ToggleMap) => self.show.toggle_map(),
Some(buttons::Event::ToggleSocial) => self.show.toggle_social(), None => {},
Some(buttons::Event::ToggleSpell) => self.show.toggle_spell(), }
Some(buttons::Event::ToggleMap) => self.show.toggle_map(),
None => {},
} }
// MiniMap // MiniMap
@ -1658,33 +1656,29 @@ impl Hud {
// Bag contents // Bag contents
if self.show.bag { if self.show.bag {
let ecs = client.state().ecs(); if let Some(player_stats) = stats.get(client.entity()) {
let stats = ecs.read_storage::<comp::Stats>(); match Bag::new(
let player_stats = match stats.get(client.entity()) { client,
Some(stats) => stats, &self.imgs,
None => return events, &self.item_imgs,
}; &self.fonts,
match Bag::new( &self.rot_imgs,
client, tooltip_manager,
&self.imgs, &mut self.slot_manager,
&self.item_imgs, self.pulse,
&self.fonts, &self.voxygen_i18n,
&self.rot_imgs, &player_stats,
tooltip_manager, &self.show,
&mut self.slot_manager, )
self.pulse, .set(self.ids.bag, ui_widgets)
&self.voxygen_i18n, {
&player_stats, Some(bag::Event::Stats) => self.show.stats = !self.show.stats,
&self.show, Some(bag::Event::Close) => {
) self.show.bag(false);
.set(self.ids.bag, ui_widgets) self.force_ungrab = true;
{ },
Some(bag::Event::Stats) => self.show.stats = !self.show.stats, None => {},
Some(bag::Event::Close) => { }
self.show.bag(false);
self.force_ungrab = true;
},
None => {},
} }
} }