| 131 | fn read_of(&self, name: &str) -> usize { |
| 132 | self.user_data.borrow().read.get(name).copied().unwrap_or(0) |
| 133 | } |
| 134 | |
| 135 | fn request_save(&self) { |
| 136 | if let Some(tx) = &self.save_tx { |
| 137 | let _ = tx.send(Some(self.user_data.borrow().clone())); |
| 138 | } |
| 139 | } |
| 140 | |
| 141 | pub(crate) fn set_text_tx(&mut self, text_tx: Sender<Arc<RwLock<DisplayText>>>) { |
| 142 | self.text_tx = Some(text_tx); |
| 143 | } |
| 144 | |
| 145 | pub(crate) fn set_auto_tx(&mut self, auto_tx: Sender<Duration>) { |
| 146 | self.auto_tx = Some(auto_tx); |
| 147 | } |
| 148 | |
| 149 | pub(crate) fn set_delay_channels( |
| 150 | &mut self, |
| 151 | delay_tx: DelayTX, |
| 152 | delay_move_tx: DelayTX, |
| 153 | loop_move_tx: DelayTX, |
| 154 | ) { |
| 155 | self.delay_channels = Some(DelayChannels { |
| 156 | delay_tx, |
| 157 | delay_move_tx, |
| 158 | loop_move_tx, |
| 159 | }); |
| 160 | } |
| 161 | |
| 162 | pub(crate) fn set_status_channel(&mut self, auto_tx: Sender<()>, skip_tx: Sender<()>) { |
| 163 | self.status_channel = Some((auto_tx, skip_tx)); |
| 164 | } |
| 165 | |
| 166 | pub(crate) fn get_status_channel(&self) -> Option<(Sender<()>, Sender<()>)> { |
| 167 | if let Some((auto_tx, skip_tx)) = self.status_channel.as_ref() { |
| 168 | return Some((auto_tx.clone(), skip_tx.clone())); |
| 169 | } |
| 170 | None |
| 171 | } |
| 172 | |
| 173 | pub(crate) fn can_skip(&self) -> bool { |
| 174 | if let Some(window) = self.weak.upgrade() { |
| 175 | if window.get_skip_conf() { |
| 176 | return true; |
| 177 | } |
| 178 | } |
| 179 | let scr = self.script.borrow(); |
| 180 | scr.read_block() > scr.index() |
| 181 | } |
| 182 | |
| 183 | pub(crate) fn unlock(&mut self, index: usize) { |