MCPcopy Index your code
hub / github.com/RustOtomeLab/RustEng / execute_jump

Method execute_jump

src/executors/executor.rs:306–358  ·  view source on GitHub ↗
(&mut self, label: Jump)

Source from the content-addressed store, hash-verified

304 pub(crate) fn execute_save_config(&self) -> Result<(), EngineError> {
305 let weak = self.get_weak();
306 save_user_config(weak)
307 }
308
309 pub(crate) fn execute_choose(&mut self, choice: SharedString) -> Result<(), EngineError> {
310 *self.choose_lock.borrow_mut() = false;
311
312 let label: (String, String);
313 {
314 let scr = self.script.clone();
315 let scr = scr.borrow();
316 label = scr.get_choice_label(&choice).unwrap().clone();
317 }
318
319 if let Some(window) = self.weak.upgrade() {
320 window.set_choose_branch(Rc::new(VecModel::from(vec![])).into());
321 window.set_current_choose(0);
322 window.set_speaker("".into());
323 window.set_dialogue_1(choice);
324 window.set_dialogue_2(SharedString::default());
325 window.set_dialogue_3(SharedString::default());
326 }
327
328 if let Some(window) = self.weak.upgrade() {
329 if window.get_is_auto() {
330 self.auto_tx
331 .clone()
332 .unwrap()
333 .try_send(Duration::from_secs(5))?;
334 }
335 }
336 self.execute_jump(Jump::Label(label))
337 }
338
339 pub(crate) fn execute_jump(&mut self, label: Jump) -> Result<(), EngineError> {
340 {
341 let mut script = self.script.borrow_mut();
342 let current_bgm = script.current_bgm().to_string();
343 let mut pre_bgm = PreBgm::None;
344 let backlog = script.to_owned().take_backlog();
345 let jump_index = match label {
346 Jump::Label((name, label)) => {
347 if name != script.name() {
348 let mut scr = Script::new();
349 scr.with_name(&name)?;
350 scr.set_backlog(backlog);
351 *script = scr;
352 }
353 script.find_label(&label).copied()
354 }
355 Jump::Index((name, index)) => {
356 if name != script.name() {
357 let mut scr = Script::new();
358 scr.with_name(&name)?;
359 scr.set_backlog(backlog);
360 *script = scr;
361 }

Callers 3

execute_loadMethod · 0.80
execute_chooseMethod · 0.80
apply_commandMethod · 0.80

Calls 15

current_bgmMethod · 0.80
take_backlogMethod · 0.80
nameMethod · 0.80
with_nameMethod · 0.80
set_backlogMethod · 0.80
find_labelMethod · 0.80
indexMethod · 0.80
get_bgmMethod · 0.80
get_backgroundMethod · 0.80
get_figuresMethod · 0.80
set_pre_bgMethod · 0.80
set_pre_bgmMethod · 0.80

Tested by

no test coverage detected