| | |
| | | private var voicePlayer = VoicePlayer.share() |
| | | private var isListen:Bool = false |
| | | private var handleClouse:(()->Void)? |
| | | private var jumpFormRest:Bool = false //重新答题 |
| | | |
| | | private lazy var collectionView:UICollectionView = { |
| | | let flowLayout = UICollectionViewFlowLayout() |
| | |
| | | |
| | | override func setRx() { |
| | | NotificationCenter.default.rx.notification(ResetLession_Noti).take(until: self.rx.deallocated).subscribe(onNext: {[weak self]_ in |
| | | self?.jumpFormRest = true |
| | | self?.restore() |
| | | self?.viewDidLoad() |
| | | }).disposed(by: disposeBag) |
| | |
| | | |
| | | DispatchQueue.main.asyncAfter(deadline: .now()+1.0) { |
| | | //自动播放第一条 |
| | | tempArray.first?.playingAction() |
| | | if self.jumpFormRest{ |
| | | if self.page == 0{ |
| | | tempArray.first?.playingAction() |
| | | } |
| | | self.jumpFormRest.toggle() |
| | | }else{ |
| | | tempArray.first?.playingAction() |
| | | } |
| | | } |
| | | |
| | | stackView.addArrangedSubviews(tempArray) |
| | |
| | | break |
| | | } |
| | | } |
| | | |
| | | //全部答完 |
| | | if self.stackView.subviews.filter({$0.alpha == 0}).count == 4{ |
| | | self.voicePlayer.playerEnd() |
| | | NotificationCenter.default.post(name: NextLession_Noti, object: nil) |
| | | } |
| | | } |
| | | |
| | | } |