(&mut self, bg: &Command)
| 611 | if ch_name == full_name { |
| 612 | self.media_player.borrow().play_voice( |
| 613 | &format!("{}/{}/{}.ogg", ENGINE_CONFIG.voice_path(), name, voice), |
| 614 | volume * voice_volume * ch_volume / 100.0, |
| 615 | )?; |
| 616 | break; |
| 617 | } |
| 618 | } |
| 619 | } |
| 620 | return Ok(*length.get(voice).unwrap()); |
| 621 | } |
| 622 | |
| 623 | Ok(Duration::from_secs(0)) |
| 624 | } |
| 625 | |
| 626 | fn show_bg(&mut self, bg: &Command) -> Result<(), EngineError> { |
| 627 | let weak = self.weak.clone(); |
| 628 | let Command::Background { |
| 629 | name, |
| 630 | x_offset, |
| 631 | y_offset, |
| 632 | zoom, |
| 633 | is_cg, |
| 634 | } = bg |
| 635 | else { |
| 636 | unreachable!() |
| 637 | }; |
| 638 | |
| 639 | let path = if *is_cg { |
| 640 | if let Some((index, _)) = CG_CONFIG.find_by_name(name) { |
| 641 | self.unlock(*index); |
| 642 | save_extra_config(self.cg.clone())?; |
| 643 | } |
| 644 | ENGINE_CONFIG.cg_path() |
| 645 | } else { |
| 646 | ENGINE_CONFIG.background_path() |
| 647 | }; |
| 648 | |
| 649 | if let Some(window) = weak.upgrade() { |
| 650 | let image = Image::load_from_path(Path::new(&format!("{path}{name}.png"))).unwrap(); |
no test coverage detected