From cdb3666ad7e9d81025bc1df8508d8a86afe47691 Mon Sep 17 00:00:00 2001 From: Nickiel12 <35903114+Nickiel12@users.noreply.github.com> Date: Sun, 19 Jun 2022 20:37:11 -0700 Subject: [PATCH] swapped type checks with convenience function --- src/modules/message_handler.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/modules/message_handler.rs b/src/modules/message_handler.rs index 750010b..dab5ef3 100644 --- a/src/modules/message_handler.rs +++ b/src/modules/message_handler.rs @@ -41,7 +41,7 @@ impl MessageHandler for StreamState { }, } - if self.change_scene_on_slide_hotkey { + if self.change_scene_on_slide_hotkey && !self.current_scene.is_camera() { if self.timer_can_run { self.timer_finished = false; self.timer_start = SystemTime::now(); @@ -82,14 +82,14 @@ impl MessageHandler for StreamState { StateUpdate::TimerLength(value) => {self.timer_length = value; return (Some(update), None)}, StateUpdate::TimerText(value) => {self.timer_text = value.clone(); return (Some(StateUpdate::TimerText(value)), None)}, StateUpdate::SubScene(value) => { - if value.get_type() == Scenes::Camera { - if self.current_scene == Scenes::Camera { + if value.get_type().is_camera() { + if self.current_scene.is_camera() { hotkey_handler.change_scene(Scenes::Camera, Some(value)); } self.camera_sub_scene = value; return (Some(update), None) - } else if value.get_type() == Scenes::Screen { - if self.current_scene == Scenes::Screen{ + } else if value.get_type().is_screen() { + if self.current_scene.is_screen() { hotkey_handler.change_scene(Scenes::Screen, Some(value)); } self.screen_sub_scene = value; @@ -97,9 +97,10 @@ impl MessageHandler for StreamState { } }, StateUpdate::Scene(value) => { - println!("{:?}", value); - if value == Scenes::Screen { - if self.current_scene != Scenes::Screen { + println!("handling scene: {:?}", value); + + if value.is_screen() { + if !self.current_scene.is_screen() { self.timer_start = SystemTime::now(); self.timer_finished = false; }