| | |
| | | extension HomeListenGame_2_VC:UICollectionViewDelegate{ |
| | | func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { |
| | | |
| | | if listen1Model.subjectList[indexPath.row].isOpen{ |
| | | print("已经展开过了");return |
| | | } |
| | | |
| | | if selectModels.last?.indexPath == indexPath{ |
| | | print("重复点击");return |
| | | } |
| | |
| | | lastM?.model.isOpen = true |
| | | selectModels.removeAll() |
| | | print("相同") |
| | | rootViewModel.correctNum += 1 |
| | | }else{ |
| | | print("不相同") |
| | | rootViewModel.errorNum += 1 |
| | | let firstIndex = firstM!.indexPath |
| | | let secondIndex = lastM!.indexPath |
| | | |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | let surplusListCount = listen1Model.subjectList.filter({$0.isOpen == false}).count |
| | | if surplusListCount == 0{ |
| | | NotificationCenter.default.post(name: NextLession_Noti, object: ["gameId":listen1Model.data!.id,"gameIntegral":listen1Model.data!.integral]) |
| | | rootViewModel.answerItems[0] = self.listen1Model |
| | | timer?.invalidate() |
| | | } |
| | | print("剩余:\(surplusListCount)") |
| | | |
| | | } |
| | | } |
| | | } |
| | |
| | | let model = listen1Model.subjectList[indexPath.row] |
| | | let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "_ListenFight_Game_Pocket_CCell", for: indexPath) as! ListenFight_Game_Pocket_CCell |
| | | cell.setModel(model) |
| | | cell.voice_view.isHidden = !model.correct.isEmpty |
| | | cell.voice_view.isHidden = model.correct.isEmpty |
| | | return cell |
| | | } |
| | | |