1
0
Fork 0
mirror of https://github.com/jugeeya/UltimateTrainingModpack.git synced 2024-11-27 20:34:03 +00:00

Break if layout doesn't contain icon; switch current/all default load in menu (#511)

* Return to break if layout doesn't contain icon; switch current/all default load in menu

* Update menu.rs

* unwrap_or_else

* fix

* Update menu.rs

* Updated save_state_slot_enable icon

---------

Co-authored-by: Matthew Edell <edell.matthew@gmail.com>
This commit is contained in:
jugeeya 2023-03-26 16:09:17 -07:00 committed by GitHub
parent b5735c54d7
commit 99da64d2a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 24 deletions

View file

@ -317,7 +317,7 @@ pub unsafe fn quick_menu_loop() {
received_input = true;
});
button_presses.y.read_press().then(|| {
app.reset_current_submenu();
app.reset_all_submenus();
received_input = true;
});
button_presses.l.read_press().then(|| {
@ -330,7 +330,7 @@ pub unsafe fn quick_menu_loop() {
if is_gcc {
app.next_tab();
} else {
app.reset_all_submenus();
app.reset_current_submenu();
}
received_input = true;
});
@ -344,7 +344,7 @@ pub unsafe fn quick_menu_loop() {
if !is_gcc {
app.next_tab();
} else {
app.reset_all_submenus();
app.reset_current_submenu();
}
received_input = true;
});

Binary file not shown.

View file

@ -112,13 +112,10 @@ unsafe fn render_submenu_page(app: &App, root_pane: &mut Pane) {
// Hide all icon images, and strategically mark the icon that
// corresponds with a particular button to be visible.
submenu_ids.iter().for_each(|id| {
// TODO: Break if ID not found on release
let icon = menu_button
.find_pane_by_name_recursive(id);
if let Some(icon) = icon {
icon
menu_button
.find_pane_by_name_recursive(id)
.unwrap_or_else(|| panic!("Unable to find icon {} in layout.arc", id))
.set_visible(id == &submenu.submenu_id);
}
});
menu_button
@ -195,20 +192,10 @@ unsafe fn render_toggle_page(app: &App, root_pane: &mut Pane) {
let submenu_ids = app.submenu_ids();
submenu_ids.iter().for_each(|id| {
// TODO: Break if ID not found on release
let icon = menu_button
.find_pane_by_name_recursive(id);
if let Some(icon) = icon {
icon
menu_button
.find_pane_by_name_recursive(id)
.unwrap_or_else(|| panic!("Unable to find icon {} in layout.arc", id))
.set_visible(false);
}
});
title_text.set_text_string(name);
@ -431,9 +418,9 @@ pub unsafe fn draw(root_pane: &mut Pane) {
let (left_tab_key, right_tab_key, save_defaults_key, reset_current_key, reset_all_key) =
if is_gcc {
(l_key, r_key, x_key, y_key, z_key)
(l_key, r_key, x_key, z_key, y_key)
} else {
(zl_key, zr_key, x_key, y_key, r_key)
(zl_key, zr_key, x_key, r_key, y_key)
};
[