From 21c38e275a62da77435e2666d5eb9f579b3e65b4 Mon Sep 17 00:00:00 2001 From: Nickiel12 <35903114+Nickiel12@users.noreply.github.com> Date: Wed, 29 Jun 2022 20:43:47 -0700 Subject: [PATCH] moved an if statement into the switch statement --- src/modules/message_handler.rs | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/modules/message_handler.rs b/src/modules/message_handler.rs index 4346c91..c6144a3 100644 --- a/src/modules/message_handler.rs +++ b/src/modules/message_handler.rs @@ -105,28 +105,24 @@ impl MessageHandler for StreamState { }, StateUpdate::Scene(value) => { println!("handling scene: {:?}", value); - - if value.is_screen() { - if !self.current_scene.is_screen() { - self.timer_start = SystemTime::now(); - self.timer_finished = false; - } - } else { - self.timer_finished = true; - } + let mut instruction = None; if self.current_scene != value { match value { Scenes::Camera => { hotkey_handler.change_scene(Scenes::Camera, Some(self.camera_sub_scene)); - instruction = Some(vec![StateUpdate::TimerText("0.0".to_string())]) + instruction = Some(vec![StateUpdate::TimerText("0.0".to_string())]); + self.timer_finished = true; }, Scenes::Screen => { hotkey_handler.change_scene(Scenes::Screen, Some(self.screen_sub_scene)); + self.timer_start = SystemTime::now(); + self.timer_finished = false; }, Scenes::Augmented => { hotkey_handler.change_scene(Scenes::Augmented, None); + self.timer_finished = true; } } }