MCPcopy Create free account
hub / github.com/RustOtomeLab/RustEng / show_bg

Method show_bg

src/executors/executor.rs:613–647  ·  view source on GitHub ↗
(&mut self, bg: &Command)

Source from the content-addressed store, hash-verified

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();

Callers 1

apply_commandMethod · 0.80

Calls 5

save_extra_configFunction · 0.85
find_by_nameMethod · 0.80
unlockMethod · 0.80
cg_pathMethod · 0.80
background_pathMethod · 0.80

Tested by

no test coverage detected