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

Method apply_command

src/executors/executor.rs:474–596  ·  view source on GitHub ↗
(&mut self, command: Command)

Source from the content-addressed store, hash-verified

472 }
473
474 let res = {
475 let mut text = self.text.write().unwrap();
476 if text.is_running {
477 text.end();
478 true
479 } else {
480 false
481 }
482 };
483 if res {
484 if let Some(window) = self.weak.upgrade() {
485 if window.get_is_auto() {
486 self.auto_tx
487 .clone()
488 .unwrap()
489 .try_send(Duration::from_secs(2))?;
490 }
491 }
492 return Ok(());
493 }
494
495 let (is_wait, is_auto, mut duration) = match self.weak.upgrade() {
496 Some(window) => (
497 window.get_is_wait(),
498 window.get_is_auto(),
499 Duration::from_millis((window.get_delay() * 1000.0) as u64),
500 ),
501 None => (true, false, Duration::default()),
502 };
503
504 if *self.choose_lock.borrow() {
505 return Ok(());
506 }
507
508 if self.video_context.try_borrow().is_err() {
509 return Ok(());
510 }
511
512 let commands = {
513 let scr = self.script.clone();
514 let mut scr = scr.borrow_mut();
515 if let Some(cmds) = scr.next_command() {
516 cmds.clone()
517 } else {
518 Commands::EmptyCmd
519 }
520 };
521 let delay = match commands {
522 Commands::EmptyCmd => unreachable!(),
523 Commands::OneCmd(command) => self.apply_command(command)?,
524 Commands::VarCmds(vars) => {
525 let mut delay = Duration::default();
526 for command in vars {
527 delay += self.apply_command(command)?;
528 }
529 delay
530 }
531 };

Callers 1

execute_scriptMethod · 0.80

Calls 15

pre_bgMethod · 0.80
pre_bgmMethod · 0.80
pre_figuresMethod · 0.80
show_bgMethod · 0.80
stop_bgmMethod · 0.80
show_fgMethod · 0.80
current_bgmMethod · 0.80
set_current_bgmMethod · 0.80
set_explainMethod · 0.80
pushMethod · 0.80
push_backlogMethod · 0.80
start_animationMethod · 0.80

Tested by

no test coverage detected