(&mut self, label: Jump)
| 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 | } |
no test coverage detected