moved an if statement into the switch statement

This commit is contained in:
Nickiel12 2022-06-29 20:43:47 -07:00
parent b04d93b96a
commit 21c38e275a

View file

@ -106,27 +106,23 @@ impl MessageHandler for StreamState {
StateUpdate::Scene(value) => { StateUpdate::Scene(value) => {
println!("handling 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; let mut instruction = None;
if self.current_scene != value { if self.current_scene != value {
match value { match value {
Scenes::Camera => { Scenes::Camera => {
hotkey_handler.change_scene(Scenes::Camera, Some(self.camera_sub_scene)); 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 => { Scenes::Screen => {
hotkey_handler.change_scene(Scenes::Screen, Some(self.screen_sub_scene)); hotkey_handler.change_scene(Scenes::Screen, Some(self.screen_sub_scene));
self.timer_start = SystemTime::now();
self.timer_finished = false;
}, },
Scenes::Augmented => { Scenes::Augmented => {
hotkey_handler.change_scene(Scenes::Augmented, None); hotkey_handler.change_scene(Scenes::Augmented, None);
self.timer_finished = true;
} }
} }
} }