| | |
| | | Services.treeInfo().subscribe(onNext: {data in |
| | | if let m = data.data{ |
| | | self.taskListView.setTreeInfoModel(m) |
| | | |
| | | //检查hash,进行同步 |
| | | // if m.toJSON()?.jq_hash() != self.treeInfoModel?.toJSON()?.jq_hash(){ |
| | | self.treeInfoModel = m |
| | | self.updateTreeInfo() |
| | | self.updateAni(false) |
| | | try? self.cacheTreeInfoModel.save(m) |
| | | // } |
| | | } |
| | | }).disposed(by: disposeBag) |
| | | } |
| | |
| | | private func updateTreeInfo(){ |
| | | btn_seedingAgain.isHidden = treeInfoModel!.treeLevelType != .level_10 |
| | | |
| | | // if treeLevel.rawValue != treeInfoModel?.treeLevelType.rawValue{ |
| | | // treeLevel = treeInfoModel!.treeLevelType |
| | | // } |
| | | icon_energy.text = String(format: "当前能量值:%ld", treeInfoModel!.energyValue) |
| | | setProgress(current: treeInfoModel!.growthValue, total: treeInfoModel!.nextLevel) |
| | | } |
| | |
| | | if let m = data.data{ |
| | | sender.isUserInteractionEnabled = true |
| | | if m.isNext{ |
| | | let type = weakSelf.treeInfoModel?.treeLevelType ?? .level_1 |
| | | weakSelf.treeInfoModel!.treeLevelType = m.treeLevelType |
| | | |
| | | let h = (JQ_ScreenW - 90) * 0.7729 |
| | |
| | | weakSelf.voicePlayer.replaceCurrentItem(with: AVPlayerItem(url: soundURL)) |
| | | weakSelf.voicePlayer.play() |
| | | } |
| | | weakSelf.updateAni() |
| | | weakSelf.getTreeData() |
| | | return |
| | | } |
| | | |
| | | weakSelf.updateAni() |
| | | weakSelf.getTreeData() |
| | | |
| | | weakSelf.treeInfoModel?.growthValue = m.growthValue |
| | | weakSelf.treeInfoModel?.energyValue = 0 |
| | |
| | | |
| | | extension TreeTeskVC:CAAnimationDelegate{ |
| | | func animationDidStart(_ anim: CAAnimation) { |
| | | print("开始动画") |
| | | treeImage.isUserInteractionEnabled = false |
| | | } |
| | | |
| | | func animationDidStop(_ anim: CAAnimation, finished flag: Bool) { |
| | | print("结束动画") |
| | | if anim.value(forKey: "customType") as! String == "ani_flower"{ |
| | | |
| | | |
| | | } |
| | | // print("结束动画") |
| | | // if anim.value(forKey: "customType") as! String == "ani_flower"{ |
| | | // |
| | | // |
| | | // } |
| | | } |
| | | } |