Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/ui/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ pub fn sequence_control_button_system(
mut rhythm_state: ResMut<RhythmState>,
) {
for (interaction, mut background_color, children) in &mut interaction_query {
let mut text = text_query.get_mut(children[0]).unwrap();
let Some(&child) = children.first() else { continue; };
let Ok(mut text) = text_query.get_mut(child) else { continue; };
match *interaction {
Interaction::Pressed => {
sequence_state.running = !sequence_state.running;
Expand Down Expand Up @@ -67,7 +68,8 @@ pub fn curriculum_toggle_system(
mut sequence_state: ResMut<SequenceState>,
) {
for (interaction, mut background_color, children) in &mut interaction_query {
let mut text = text_query.get_mut(children[0]).unwrap();
let Some(&child) = children.first() else { continue; };
let Ok(mut text) = text_query.get_mut(child) else { continue; };
match *interaction {
Interaction::Pressed => {
curriculum_state.is_visible = !curriculum_state.is_visible;
Expand Down Expand Up @@ -102,7 +104,8 @@ pub fn mode_toggle_system(
mut sequence_state: ResMut<SequenceState>,
) {
for (interaction, mut background_color, children) in &mut interaction_query {
let mut text = text_query.get_mut(children[0]).unwrap();
let Some(&child) = children.first() else { continue; };
let Ok(mut text) = text_query.get_mut(child) else { continue; };
match *interaction {
Interaction::Pressed => {
sequence_state.mode = match sequence_state.mode {
Expand Down Expand Up @@ -146,7 +149,8 @@ pub fn rhythm_mode_toggle_system(
mut rhythm_state: ResMut<RhythmState>,
) {
for (interaction, mut background_color, children) in &mut interaction_query {
let mut text = text_query.get_mut(children[0]).unwrap();
let Some(&child) = children.first() else { continue; };
let Ok(mut text) = text_query.get_mut(child) else { continue; };
match *interaction {
Interaction::Pressed => {
rhythm_state.mode = match rhythm_state.mode {
Expand Down