Commit 05954dd78a79ea245db768c75ed3737fb47afb79
Merge branch 'master' of bj.gitlab.cnlive.com:ios-team/LiveVideoCloud
Showing
80 changed files
with
2604 additions
and
452 deletions
LiveVideoCloud/LiveVideoCloud.xcodeproj/project.pbxproj
| ... | ... | @@ -122,15 +122,21 @@ |
| 122 | 122 | D2029D091E6EAE2E0027CD92 /* Foundation+Log.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029CF21E6EAE2E0027CD92 /* Foundation+Log.m */; }; |
| 123 | 123 | D2029D0A1E6EAE2E0027CD92 /* ZXServerUrl.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029CFE1E6EAE2E0027CD92 /* ZXServerUrl.m */; }; |
| 124 | 124 | D2029D161E6EB00D0027CD92 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = D2029D151E6EB00D0027CD92 /* AppDelegate.m */; }; |
| 125 | + D217A24A1E7B76C7003B44CB /* PresentView.m in Sources */ = {isa = PBXBuildFile; fileRef = D217A2471E7B76C7003B44CB /* PresentView.m */; }; | |
| 126 | + D217A24B1E7B76C7003B44CB /* PresentViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D217A2491E7B76C7003B44CB /* PresentViewCell.m */; }; | |
| 127 | + D217A24E1E7B77C7003B44CB /* ComboCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D217A24D1E7B77C7003B44CB /* ComboCell.m */; }; | |
| 125 | 128 | D22830F11E778C0F00627701 /* LiveBaseView.m in Sources */ = {isa = PBXBuildFile; fileRef = D22830F01E778C0F00627701 /* LiveBaseView.m */; }; |
| 126 | 129 | D22830FC1E77C2D900627701 /* BottomToolView.m in Sources */ = {isa = PBXBuildFile; fileRef = D22830FB1E77C2D900627701 /* BottomToolView.m */; }; |
| 127 | 130 | D22830FF1E77C69E00627701 /* GiftListView.m in Sources */ = {isa = PBXBuildFile; fileRef = D22830FE1E77C69E00627701 /* GiftListView.m */; }; |
| 128 | - D22831021E77D83C00627701 /* GiftModelView.m in Sources */ = {isa = PBXBuildFile; fileRef = D22831011E77D83C00627701 /* GiftModelView.m */; }; | |
| 129 | 131 | D22831091E77D8D500627701 /* GiftModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D22831081E77D8D500627701 /* GiftModel.m */; }; |
| 132 | + D236967E1E7F9E4100E4BF71 /* GiftPayButton.m in Sources */ = {isa = PBXBuildFile; fileRef = D236967D1E7F9E4100E4BF71 /* GiftPayButton.m */; }; | |
| 133 | + D23696841E7FC6A900E4BF71 /* chatListCell.m in Sources */ = {isa = PBXBuildFile; fileRef = D23696831E7FC6A900E4BF71 /* chatListCell.m */; }; | |
| 134 | + D236968D1E7FC7C200E4BF71 /* CNBarrageManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D236968A1E7FC7C200E4BF71 /* CNBarrageManager.m */; }; | |
| 135 | + D236968E1E7FC7C200E4BF71 /* CNBarrageView.m in Sources */ = {isa = PBXBuildFile; fileRef = D236968C1E7FC7C200E4BF71 /* CNBarrageView.m */; }; | |
| 136 | + D23696921E7FC83800E4BF71 /* chatMsgModel.m in Sources */ = {isa = PBXBuildFile; fileRef = D23696911E7FC83800E4BF71 /* chatMsgModel.m */; }; | |
| 130 | 137 | D25530001E7909AC00DF38A5 /* GiftAnimOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = D2552FFF1E7909AC00DF38A5 /* GiftAnimOperation.m */; }; |
| 131 | 138 | D25530031E79115100DF38A5 /* AnimQueueManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D25530021E79115100DF38A5 /* AnimQueueManager.m */; }; |
| 132 | 139 | D25530061E7911A800DF38A5 /* GiftAnimationAction.m in Sources */ = {isa = PBXBuildFile; fileRef = D25530051E7911A800DF38A5 /* GiftAnimationAction.m */; }; |
| 133 | - D25530091E791A7100DF38A5 /* GiftComboView.m in Sources */ = {isa = PBXBuildFile; fileRef = D25530081E791A7100DF38A5 /* GiftComboView.m */; }; | |
| 134 | 140 | D255300C1E793F8200DF38A5 /* NHFighterView+animDelegagte.m in Sources */ = {isa = PBXBuildFile; fileRef = D255300B1E793F8200DF38A5 /* NHFighterView+animDelegagte.m */; }; |
| 135 | 141 | D2575C461E76857100E3A8FC /* LVCAnimationManager.m in Sources */ = {isa = PBXBuildFile; fileRef = D2575C451E76857100E3A8FC /* LVCAnimationManager.m */; }; |
| 136 | 142 | D2575C4A1E7685DE00E3A8FC /* UIView+Bubbling.m in Sources */ = {isa = PBXBuildFile; fileRef = D2575C481E7685DE00E3A8FC /* UIView+Bubbling.m */; }; |
| ... | ... | @@ -443,24 +449,37 @@ |
| 443 | 449 | D2029CFF1E6EAE2E0027CD92 /* UtilKits.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UtilKits.h; sourceTree = "<group>"; }; |
| 444 | 450 | D2029D121E6EAF8D0027CD92 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; }; |
| 445 | 451 | D2029D151E6EB00D0027CD92 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; }; |
| 452 | + D217A2451E7B76C7003B44CB /* PresentModelAble.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PresentModelAble.h; sourceTree = "<group>"; }; | |
| 453 | + D217A2461E7B76C7003B44CB /* PresentView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PresentView.h; sourceTree = "<group>"; }; | |
| 454 | + D217A2471E7B76C7003B44CB /* PresentView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PresentView.m; sourceTree = "<group>"; }; | |
| 455 | + D217A2481E7B76C7003B44CB /* PresentViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PresentViewCell.h; sourceTree = "<group>"; }; | |
| 456 | + D217A2491E7B76C7003B44CB /* PresentViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PresentViewCell.m; sourceTree = "<group>"; }; | |
| 457 | + D217A24C1E7B77C7003B44CB /* ComboCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ComboCell.h; path = Present/ComboCell.h; sourceTree = "<group>"; }; | |
| 458 | + D217A24D1E7B77C7003B44CB /* ComboCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ComboCell.m; path = Present/ComboCell.m; sourceTree = "<group>"; }; | |
| 446 | 459 | D22830EF1E778C0F00627701 /* LiveBaseView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LiveBaseView.h; sourceTree = "<group>"; }; |
| 447 | 460 | D22830F01E778C0F00627701 /* LiveBaseView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = LiveBaseView.m; sourceTree = "<group>"; }; |
| 448 | 461 | D22830FA1E77C2D900627701 /* BottomToolView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BottomToolView.h; sourceTree = "<group>"; }; |
| 449 | 462 | D22830FB1E77C2D900627701 /* BottomToolView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BottomToolView.m; sourceTree = "<group>"; }; |
| 450 | 463 | D22830FD1E77C69E00627701 /* GiftListView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GiftListView.h; sourceTree = "<group>"; }; |
| 451 | 464 | D22830FE1E77C69E00627701 /* GiftListView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GiftListView.m; sourceTree = "<group>"; }; |
| 452 | - D22831001E77D83C00627701 /* GiftModelView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GiftModelView.h; sourceTree = "<group>"; }; | |
| 453 | - D22831011E77D83C00627701 /* GiftModelView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GiftModelView.m; sourceTree = "<group>"; }; | |
| 454 | 465 | D22831071E77D8D500627701 /* GiftModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GiftModel.h; sourceTree = "<group>"; }; |
| 455 | 466 | D22831081E77D8D500627701 /* GiftModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GiftModel.m; sourceTree = "<group>"; }; |
| 467 | + D236967C1E7F9E4100E4BF71 /* GiftPayButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GiftPayButton.h; sourceTree = "<group>"; }; | |
| 468 | + D236967D1E7F9E4100E4BF71 /* GiftPayButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GiftPayButton.m; sourceTree = "<group>"; }; | |
| 469 | + D23696821E7FC6A900E4BF71 /* chatListCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chatListCell.h; sourceTree = "<group>"; }; | |
| 470 | + D23696831E7FC6A900E4BF71 /* chatListCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = chatListCell.m; sourceTree = "<group>"; }; | |
| 471 | + D23696891E7FC7C200E4BF71 /* CNBarrageManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNBarrageManager.h; sourceTree = "<group>"; }; | |
| 472 | + D236968A1E7FC7C200E4BF71 /* CNBarrageManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNBarrageManager.m; sourceTree = "<group>"; }; | |
| 473 | + D236968B1E7FC7C200E4BF71 /* CNBarrageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CNBarrageView.h; sourceTree = "<group>"; }; | |
| 474 | + D236968C1E7FC7C200E4BF71 /* CNBarrageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CNBarrageView.m; sourceTree = "<group>"; }; | |
| 475 | + D23696901E7FC83800E4BF71 /* chatMsgModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = chatMsgModel.h; sourceTree = "<group>"; }; | |
| 476 | + D23696911E7FC83800E4BF71 /* chatMsgModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = chatMsgModel.m; sourceTree = "<group>"; }; | |
| 456 | 477 | D2552FFE1E7909AC00DF38A5 /* GiftAnimOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GiftAnimOperation.h; sourceTree = "<group>"; }; |
| 457 | 478 | D2552FFF1E7909AC00DF38A5 /* GiftAnimOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GiftAnimOperation.m; sourceTree = "<group>"; }; |
| 458 | 479 | D25530011E79115100DF38A5 /* AnimQueueManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AnimQueueManager.h; sourceTree = "<group>"; }; |
| 459 | 480 | D25530021E79115100DF38A5 /* AnimQueueManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AnimQueueManager.m; sourceTree = "<group>"; }; |
| 460 | 481 | D25530041E7911A800DF38A5 /* GiftAnimationAction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GiftAnimationAction.h; sourceTree = "<group>"; }; |
| 461 | 482 | D25530051E7911A800DF38A5 /* GiftAnimationAction.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GiftAnimationAction.m; sourceTree = "<group>"; }; |
| 462 | - D25530071E791A7100DF38A5 /* GiftComboView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GiftComboView.h; sourceTree = "<group>"; }; | |
| 463 | - D25530081E791A7100DF38A5 /* GiftComboView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GiftComboView.m; sourceTree = "<group>"; }; | |
| 464 | 483 | D255300A1E793F8200DF38A5 /* NHFighterView+animDelegagte.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NHFighterView+animDelegagte.h"; sourceTree = "<group>"; }; |
| 465 | 484 | D255300B1E793F8200DF38A5 /* NHFighterView+animDelegagte.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NHFighterView+animDelegagte.m"; sourceTree = "<group>"; }; |
| 466 | 485 | D2575C441E76857100E3A8FC /* LVCAnimationManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LVCAnimationManager.h; path = ../LVCAnimationManager.h; sourceTree = "<group>"; }; |
| ... | ... | @@ -1174,13 +1193,25 @@ |
| 1174 | 1193 | path = AppDelegate; |
| 1175 | 1194 | sourceTree = "<group>"; |
| 1176 | 1195 | }; |
| 1196 | + D217A2441E7B76C7003B44CB /* Present */ = { | |
| 1197 | + isa = PBXGroup; | |
| 1198 | + children = ( | |
| 1199 | + D217A2451E7B76C7003B44CB /* PresentModelAble.h */, | |
| 1200 | + D217A2461E7B76C7003B44CB /* PresentView.h */, | |
| 1201 | + D217A2471E7B76C7003B44CB /* PresentView.m */, | |
| 1202 | + D217A2481E7B76C7003B44CB /* PresentViewCell.h */, | |
| 1203 | + D217A2491E7B76C7003B44CB /* PresentViewCell.m */, | |
| 1204 | + ); | |
| 1205 | + path = Present; | |
| 1206 | + sourceTree = "<group>"; | |
| 1207 | + }; | |
| 1177 | 1208 | D22830F51E77C24900627701 /* GiftViews */ = { |
| 1178 | 1209 | isa = PBXGroup; |
| 1179 | 1210 | children = ( |
| 1180 | 1211 | D22830FD1E77C69E00627701 /* GiftListView.h */, |
| 1181 | 1212 | D22830FE1E77C69E00627701 /* GiftListView.m */, |
| 1182 | - D22831001E77D83C00627701 /* GiftModelView.h */, | |
| 1183 | - D22831011E77D83C00627701 /* GiftModelView.m */, | |
| 1213 | + D236967C1E7F9E4100E4BF71 /* GiftPayButton.h */, | |
| 1214 | + D236967D1E7F9E4100E4BF71 /* GiftPayButton.m */, | |
| 1184 | 1215 | ); |
| 1185 | 1216 | path = GiftViews; |
| 1186 | 1217 | sourceTree = "<group>"; |
| ... | ... | @@ -1188,6 +1219,8 @@ |
| 1188 | 1219 | D22830F61E77C26C00627701 /* Chat */ = { |
| 1189 | 1220 | isa = PBXGroup; |
| 1190 | 1221 | children = ( |
| 1222 | + D23696881E7FC7C200E4BF71 /* Barrage */, | |
| 1223 | + D236968F1E7FC83800E4BF71 /* ChatMsgModel */, | |
| 1191 | 1224 | D22830F71E77C27A00627701 /* ChatViews */, |
| 1192 | 1225 | ); |
| 1193 | 1226 | path = Chat; |
| ... | ... | @@ -1196,6 +1229,8 @@ |
| 1196 | 1229 | D22830F71E77C27A00627701 /* ChatViews */ = { |
| 1197 | 1230 | isa = PBXGroup; |
| 1198 | 1231 | children = ( |
| 1232 | + D23696821E7FC6A900E4BF71 /* chatListCell.h */, | |
| 1233 | + D23696831E7FC6A900E4BF71 /* chatListCell.m */, | |
| 1199 | 1234 | ); |
| 1200 | 1235 | path = ChatViews; |
| 1201 | 1236 | sourceTree = "<group>"; |
| ... | ... | @@ -1225,6 +1260,26 @@ |
| 1225 | 1260 | path = GiftModel; |
| 1226 | 1261 | sourceTree = "<group>"; |
| 1227 | 1262 | }; |
| 1263 | + D23696881E7FC7C200E4BF71 /* Barrage */ = { | |
| 1264 | + isa = PBXGroup; | |
| 1265 | + children = ( | |
| 1266 | + D23696891E7FC7C200E4BF71 /* CNBarrageManager.h */, | |
| 1267 | + D236968A1E7FC7C200E4BF71 /* CNBarrageManager.m */, | |
| 1268 | + D236968B1E7FC7C200E4BF71 /* CNBarrageView.h */, | |
| 1269 | + D236968C1E7FC7C200E4BF71 /* CNBarrageView.m */, | |
| 1270 | + ); | |
| 1271 | + path = Barrage; | |
| 1272 | + sourceTree = "<group>"; | |
| 1273 | + }; | |
| 1274 | + D236968F1E7FC83800E4BF71 /* ChatMsgModel */ = { | |
| 1275 | + isa = PBXGroup; | |
| 1276 | + children = ( | |
| 1277 | + D23696901E7FC83800E4BF71 /* chatMsgModel.h */, | |
| 1278 | + D23696911E7FC83800E4BF71 /* chatMsgModel.m */, | |
| 1279 | + ); | |
| 1280 | + path = ChatMsgModel; | |
| 1281 | + sourceTree = "<group>"; | |
| 1282 | + }; | |
| 1228 | 1283 | D2575C431E76846900E3A8FC /* InteractionSections */ = { |
| 1229 | 1284 | isa = PBXGroup; |
| 1230 | 1285 | children = ( |
| ... | ... | @@ -1255,8 +1310,9 @@ |
| 1255 | 1310 | D2575C681E76A42B00E3A8FC /* Gift */ = { |
| 1256 | 1311 | isa = PBXGroup; |
| 1257 | 1312 | children = ( |
| 1258 | - D25530071E791A7100DF38A5 /* GiftComboView.h */, | |
| 1259 | - D25530081E791A7100DF38A5 /* GiftComboView.m */, | |
| 1313 | + D217A2441E7B76C7003B44CB /* Present */, | |
| 1314 | + D217A24C1E7B77C7003B44CB /* ComboCell.h */, | |
| 1315 | + D217A24D1E7B77C7003B44CB /* ComboCell.m */, | |
| 1260 | 1316 | D25530041E7911A800DF38A5 /* GiftAnimationAction.h */, |
| 1261 | 1317 | D25530051E7911A800DF38A5 /* GiftAnimationAction.m */, |
| 1262 | 1318 | D25530011E79115100DF38A5 /* AnimQueueManager.h */, |
| ... | ... | @@ -1602,7 +1658,6 @@ |
| 1602 | 1658 | isa = PBXSourcesBuildPhase; |
| 1603 | 1659 | buildActionMask = 2147483647; |
| 1604 | 1660 | files = ( |
| 1605 | - D25530091E791A7100DF38A5 /* GiftComboView.m in Sources */, | |
| 1606 | 1661 | D2029CC31E6EADE10027CD92 /* UIImageView+HighlightedWebCache.m in Sources */, |
| 1607 | 1662 | D22830FF1E77C69E00627701 /* GiftListView.m in Sources */, |
| 1608 | 1663 | D2029CC01E6EADE10027CD92 /* UIImage+GIF.m in Sources */, |
| ... | ... | @@ -1622,6 +1677,7 @@ |
| 1622 | 1677 | D2029CCD1E6EADE10027CD92 /* SearchModel.m in Sources */, |
| 1623 | 1678 | 810B65051E779B1F00133E15 /* NSLayoutConstraint+MASDebugAdditions.m in Sources */, |
| 1624 | 1679 | D2029CCB1E6EADE10027CD92 /* SVRadialGradientLayer.m in Sources */, |
| 1680 | + D23696841E7FC6A900E4BF71 /* chatListCell.m in Sources */, | |
| 1625 | 1681 | D2029CAF1E6EADE10027CD92 /* MJRefreshStateHeader.m in Sources */, |
| 1626 | 1682 | D2029C941E6EADE10027CD92 /* UIRefreshControl+AFNetworking.m in Sources */, |
| 1627 | 1683 | D2029C911E6EADE10027CD92 /* UIButton+AFNetworking.m in Sources */, |
| ... | ... | @@ -1644,6 +1700,7 @@ |
| 1644 | 1700 | D2029CA11E6EADE10027CD92 /* NSString+MJExtension.m in Sources */, |
| 1645 | 1701 | D2029BCB1E6EADD70027CD92 /* BaseTableViewCell.m in Sources */, |
| 1646 | 1702 | D2029CAA1E6EADE10027CD92 /* MJRefreshBackGifFooter.m in Sources */, |
| 1703 | + D217A24B1E7B76C7003B44CB /* PresentViewCell.m in Sources */, | |
| 1647 | 1704 | D2029C9B1E6EADE10027CD92 /* MJPropertyKey.m in Sources */, |
| 1648 | 1705 | D2029CBF1E6EADE10027CD92 /* UIButton+WebCache.m in Sources */, |
| 1649 | 1706 | 810B64E31E779AFE00133E15 /* LVCLivePlayerController.m in Sources */, |
| ... | ... | @@ -1658,9 +1715,9 @@ |
| 1658 | 1715 | D2029CA31E6EADE10027CD92 /* MJRefreshBackFooter.m in Sources */, |
| 1659 | 1716 | D255300C1E793F8200DF38A5 /* NHFighterView+animDelegagte.m in Sources */, |
| 1660 | 1717 | D2575C4A1E7685DE00E3A8FC /* UIView+Bubbling.m in Sources */, |
| 1661 | - D22831021E77D83C00627701 /* GiftModelView.m in Sources */, | |
| 1662 | 1718 | D2029CA61E6EADE10027CD92 /* MJRefreshHeader.m in Sources */, |
| 1663 | 1719 | D2029CC41E6EADE10027CD92 /* UIImageView+WebCache.m in Sources */, |
| 1720 | + D236967E1E7F9E4100E4BF71 /* GiftPayButton.m in Sources */, | |
| 1664 | 1721 | D2029CC81E6EADE10027CD92 /* SVProgressAnimatedView.m in Sources */, |
| 1665 | 1722 | D2029C961E6EADE10027CD92 /* MBProgressHUD.m in Sources */, |
| 1666 | 1723 | 810B65071E779B1F00133E15 /* ViewController+MASAdditions.m in Sources */, |
| ... | ... | @@ -1671,6 +1728,7 @@ |
| 1671 | 1728 | D2029C981E6EADE10027CD92 /* MJExtensionConst.m in Sources */, |
| 1672 | 1729 | D2575C671E76A25400E3A8FC /* LVCInteractionController.m in Sources */, |
| 1673 | 1730 | D2029CAE1E6EADE10027CD92 /* MJRefreshNormalHeader.m in Sources */, |
| 1731 | + D23696921E7FC83800E4BF71 /* chatMsgModel.m in Sources */, | |
| 1674 | 1732 | D2029C901E6EADE10027CD92 /* UIActivityIndicatorView+AFNetworking.m in Sources */, |
| 1675 | 1733 | D2029CC61E6EADE10027CD92 /* SSKeychain.m in Sources */, |
| 1676 | 1734 | D2029C8B1E6EADE10027CD92 /* AFURLResponseSerialization.m in Sources */, |
| ... | ... | @@ -1682,6 +1740,7 @@ |
| 1682 | 1740 | D2029D041E6EAE2E0027CD92 /* UILabel+ContentSize.m in Sources */, |
| 1683 | 1741 | D25530031E79115100DF38A5 /* AnimQueueManager.m in Sources */, |
| 1684 | 1742 | D2029C871E6EADE10027CD92 /* AFHTTPSessionManager.m in Sources */, |
| 1743 | + D236968D1E7FC7C200E4BF71 /* CNBarrageManager.m in Sources */, | |
| 1685 | 1744 | D2029B861E6EAAA50027CD92 /* main.m in Sources */, |
| 1686 | 1745 | D2029C8C1E6EADE10027CD92 /* AFURLSessionManager.m in Sources */, |
| 1687 | 1746 | D2029C9F1E6EADE10027CD92 /* NSObject+MJKeyValue.m in Sources */, |
| ... | ... | @@ -1704,6 +1763,7 @@ |
| 1704 | 1763 | D2029CCA1E6EADE10027CD92 /* SVProgressHUD.m in Sources */, |
| 1705 | 1764 | D2029CA81E6EADE10027CD92 /* MJRefreshAutoNormalFooter.m in Sources */, |
| 1706 | 1765 | D2029C891E6EADE10027CD92 /* AFSecurityPolicy.m in Sources */, |
| 1766 | + D217A24A1E7B76C7003B44CB /* PresentView.m in Sources */, | |
| 1707 | 1767 | D22830F11E778C0F00627701 /* LiveBaseView.m in Sources */, |
| 1708 | 1768 | D2029CBA1E6EADE10027CD92 /* SDWebImageDecoder.m in Sources */, |
| 1709 | 1769 | 8112D4311E7927A5002E00F6 /* LVCPlayerLoadingView.m in Sources */, |
| ... | ... | @@ -1712,11 +1772,13 @@ |
| 1712 | 1772 | D2029BCD1E6EADD70027CD92 /* BaseViewController.m in Sources */, |
| 1713 | 1773 | 810B64E01E779AE900133E15 /* LVCPlayer.m in Sources */, |
| 1714 | 1774 | 810B64FF1E779B1F00133E15 /* MASConstraint.m in Sources */, |
| 1775 | + D236968E1E7FC7C200E4BF71 /* CNBarrageView.m in Sources */, | |
| 1715 | 1776 | D25BF87A1E7B8A82007FB138 /* FilterFunctionView.m in Sources */, |
| 1716 | 1777 | D2029D001E6EAE2E0027CD92 /* NSNumber+ScaleHeight.m in Sources */, |
| 1717 | 1778 | D2888D9E1E6EBF1B003A77C8 /* LVCLiveViewController.m in Sources */, |
| 1718 | 1779 | D2029C951E6EADE10027CD92 /* UIWebView+AFNetworking.m in Sources */, |
| 1719 | 1780 | 810B650A1E77B39D00133E15 /* LVCFullScreenPlayerController.m in Sources */, |
| 1781 | + D217A24E1E7B77C7003B44CB /* ComboCell.m in Sources */, | |
| 1720 | 1782 | D2029CBD1E6EADE10027CD92 /* SDWebImageManager.m in Sources */, |
| 1721 | 1783 | D2029CB41E6EADE10027CD92 /* UIView+MJExtension.m in Sources */, |
| 1722 | 1784 | 81FB5B3C1E7A6FFC00F98E1D /* SevenSwitch.m in Sources */, | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/BottomToolView/BottomToolView.m
| ... | ... | @@ -31,12 +31,16 @@ |
| 31 | 31 | #pragma mark - buttonClick |
| 32 | 32 | - (void)chatAction |
| 33 | 33 | { |
| 34 | - | |
| 34 | + if ([self.delegate respondsToSelector:@selector(bottomActionWithType:)]) { | |
| 35 | + [self.delegate bottomActionWithType:BtnClickTypeChat]; | |
| 36 | + } | |
| 35 | 37 | } |
| 36 | 38 | |
| 37 | 39 | - (void)privateChatAction |
| 38 | 40 | { |
| 39 | - | |
| 41 | + if ([self.delegate respondsToSelector:@selector(bottomActionWithType:)]) { | |
| 42 | + [self.delegate bottomActionWithType:BtnClickTypePriChat]; | |
| 43 | + } | |
| 40 | 44 | } |
| 41 | 45 | |
| 42 | 46 | - (void)giftAction | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/Barrage/CNBarrageManager.h
0 → 100644
| 1 | +// | |
| 2 | +// CNBarrageManager.h | |
| 3 | +// personalXmppChatDemo | |
| 4 | +// | |
| 5 | +// Created by 张旭 on 2016/12/10. | |
| 6 | +// Copyright © 2016年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <Foundation/Foundation.h> | |
| 10 | + | |
| 11 | +@class CNBarrageView; | |
| 12 | +@class chatMsgModel; | |
| 13 | +@interface CNBarrageManager : NSObject | |
| 14 | + | |
| 15 | +@property (nonatomic, copy) void(^generateBarrageBlock)(CNBarrageView *view);//生成弹幕View回调 | |
| 16 | +@property (nonatomic) BOOL isStopBarrage;//是否关闭了弹幕 | |
| 17 | +/** | |
| 18 | + 开始弹幕根据新消息数组 | |
| 19 | + | |
| 20 | + @param newBarrageArray 新消息数组 | |
| 21 | + */ | |
| 22 | +- (void)startBarrageWithNewArray:(NSMutableArray <chatMsgModel *>*)newBarrageArray; | |
| 23 | + | |
| 24 | +/** | |
| 25 | + 停止弹幕 | |
| 26 | + */ | |
| 27 | +- (void)stopBarrage; | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/Barrage/CNBarrageManager.m
0 → 100644
| 1 | +// | |
| 2 | +// CNBarrageManager.m | |
| 3 | +// personalXmppChatDemo | |
| 4 | +// | |
| 5 | +// Created by 张旭 on 2016/12/10. | |
| 6 | +// Copyright © 2016年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "CNBarrageManager.h" | |
| 10 | +#import "CNBarrageView.h" | |
| 11 | +#import "chatMsgModel.h" | |
| 12 | + | |
| 13 | +#define MAX_OVERLAP_COUNT 100 | |
| 14 | + | |
| 15 | +@interface CNBarrageManager () | |
| 16 | + | |
| 17 | +@property (nonatomic, strong) NSMutableArray *_Nullable allComments;//所有评论 | |
| 18 | +@property (nonatomic, strong) NSMutableArray *_Nullable tmpComments;//临时评论 | |
| 19 | +@property (nonatomic ,strong) NSMutableArray *_Nullable barrageQueue;//评论管理队列数组 | |
| 20 | +@property (nonatomic ,strong) NSMutableArray *_Nullable trajectoryArr;//弹幕轨迹数组 | |
| 21 | + | |
| 22 | +@property BOOL isStarted;//标记是否开始弹幕 | |
| 23 | +@property BOOL isStopAnimation;//标记是否停止弹幕 | |
| 24 | + | |
| 25 | +@end | |
| 26 | + | |
| 27 | +@implementation CNBarrageManager | |
| 28 | + | |
| 29 | +/** | |
| 30 | + 开始弹幕根据新消息数组 | |
| 31 | + | |
| 32 | + @param newBarrageArray 新消息数组 | |
| 33 | + */ | |
| 34 | +- (void)startBarrageWithNewArray:(NSMutableArray <chatMsgModel *>*)newBarrageArray | |
| 35 | +{ | |
| 36 | + if (self.isStopAnimation && _isStopBarrage) { | |
| 37 | + return; | |
| 38 | + } | |
| 39 | + [self.allComments addObjectsFromArray:newBarrageArray]; | |
| 40 | + | |
| 41 | + [self startBarrage]; | |
| 42 | +} | |
| 43 | + | |
| 44 | +/** | |
| 45 | + 开始弹幕 | |
| 46 | + */ | |
| 47 | +- (void)startBarrage | |
| 48 | +{ | |
| 49 | + if (self.tmpComments.count == 0) { | |
| 50 | + [self.tmpComments addObjectsFromArray:self.allComments]; | |
| 51 | + [self.allComments removeAllObjects]; | |
| 52 | + } | |
| 53 | + | |
| 54 | + self.isStarted = YES; | |
| 55 | + self.isStopAnimation = NO; | |
| 56 | + [self initBarrageCommentView]; | |
| 57 | +} | |
| 58 | + | |
| 59 | +/** | |
| 60 | + 停止弹幕 | |
| 61 | + */ | |
| 62 | +- (void)stopBarrage | |
| 63 | +{ | |
| 64 | + self.isStopAnimation = YES; | |
| 65 | + | |
| 66 | + [self.barrageQueue enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { | |
| 67 | + CNBarrageView *view = obj; | |
| 68 | + [view stopAnimation]; | |
| 69 | + view = nil; | |
| 70 | + self.tmpComments = nil; | |
| 71 | + self.allComments = nil; | |
| 72 | + self.trajectoryArr = nil; | |
| 73 | + }]; | |
| 74 | + self.barrageQueue = nil; | |
| 75 | +} | |
| 76 | + | |
| 77 | +/** | |
| 78 | + 初始化弹幕的评论View | |
| 79 | + */ | |
| 80 | +- (void)initBarrageCommentView | |
| 81 | +{ | |
| 82 | + if(self.isStopAnimation)return; | |
| 83 | + //初始化轨道位置随机 | |
| 84 | + long count = self.tmpComments.count; | |
| 85 | + for (int i = 0; i < count; i ++) { | |
| 86 | + chatMsgModel *model = [self.tmpComments firstObject]; | |
| 87 | + NSString *comment = model.content; | |
| 88 | + NSString *userName = model.name; | |
| 89 | + if (comment) { | |
| 90 | + [self.tmpComments removeObjectAtIndex:0]; | |
| 91 | + //根据当前未发送弹幕数量生成轨迹 | |
| 92 | + NSString *trajectory; | |
| 93 | + if (self.tmpComments.count > MAX_OVERLAP_COUNT) | |
| 94 | + {//数量较多轨迹可重叠 | |
| 95 | + trajectory = [self trajectoryOverlap:YES]; | |
| 96 | + }else | |
| 97 | + {//数量较少轨迹可能不重叠,但频率高会使轨迹数组已满,造成重叠 | |
| 98 | + trajectory = [self trajectoryOverlap:NO]; | |
| 99 | + } | |
| 100 | + [self createBarrageComment:comment userName:userName trajectory:trajectory isMine:model.isMine]; //trajectory:trajectory isMine:model.isMine]; | |
| 101 | + } | |
| 102 | + else { | |
| 103 | + //当弹幕没有时跳出循环 | |
| 104 | + break; | |
| 105 | + } | |
| 106 | + } | |
| 107 | +} | |
| 108 | + | |
| 109 | +/** | |
| 110 | + 生成评论弹幕轨迹 | |
| 111 | + | |
| 112 | + @param isOverlap 是否重叠 | |
| 113 | + @return 根据轨迹是否可重叠,生成对应的新轨迹 | |
| 114 | + */ | |
| 115 | +- (NSString *)trajectoryOverlap:(BOOL)isOverlap | |
| 116 | +{ | |
| 117 | + NSString *trajectory = @""; | |
| 118 | + long arcIndex = arc4random() % MAX_BARRAGE_VERTICAL_COUNT; | |
| 119 | + CGFloat tra = arcIndex * BARRAGE_VERTICAL_HEIGHT + (arcIndex - 1) * BARRAGE_VERTICAL_MARGIN; | |
| 120 | +// NSLog(@"trajectory = %f ,%ld,%f,%ld,%f",tra,arcIndex,BARRAGE_VERTICAL_MARGIN,MAX_BARRAGE_VERTICAL_COUNT,BARRAGE_VERTICAL_MARGIN); | |
| 121 | + if (isOverlap) { | |
| 122 | + //生成可重叠的轨迹 | |
| 123 | + trajectory = [NSString stringWithFormat:@"%f",tra]; | |
| 124 | + [self.trajectoryArr addObject:trajectory]; | |
| 125 | + return [NSString stringWithFormat:@"%f",tra]; | |
| 126 | + } | |
| 127 | + //生成不重叠的轨迹 | |
| 128 | + do { | |
| 129 | + arcIndex = arc4random() % MAX_BARRAGE_VERTICAL_COUNT; | |
| 130 | + tra = arcIndex * BARRAGE_VERTICAL_HEIGHT + (arcIndex - 1) * BARRAGE_VERTICAL_MARGIN; | |
| 131 | + trajectory = [NSString stringWithFormat:@"%f",tra]; | |
| 132 | + if (self.trajectoryArr.count >= MAX_BARRAGE_VERTICAL_COUNT) break; | |
| 133 | + | |
| 134 | + } while ([self.trajectoryArr containsObject:trajectory]); | |
| 135 | + if (self.trajectoryArr.count >= MAX_BARRAGE_VERTICAL_COUNT) | |
| 136 | + {//当前轨迹数组已满,弹幕需要重叠显示 | |
| 137 | + | |
| 138 | + }else | |
| 139 | + {//当前轨迹数组还没满,弹幕无需重叠 | |
| 140 | + [self.trajectoryArr addObject:trajectory]; | |
| 141 | + } | |
| 142 | + return trajectory; | |
| 143 | +} | |
| 144 | + | |
| 145 | +/** | |
| 146 | + 下一条评论 | |
| 147 | + | |
| 148 | + @return 返回当前tmpComments的下一条评论数据 | |
| 149 | + */ | |
| 150 | +- (NSString *)nextComment { | |
| 151 | + chatMsgModel *model = [self.tmpComments firstObject]; | |
| 152 | + if (model.content) { | |
| 153 | + [self.tmpComments removeObjectAtIndex:0]; | |
| 154 | + } | |
| 155 | + return model.content; | |
| 156 | +} | |
| 157 | + | |
| 158 | +/** | |
| 159 | + 创建评论弹幕,根据评论内容和弹幕轨迹 | |
| 160 | + | |
| 161 | + @param comment 评论内容 | |
| 162 | + @param userName 用户名字 | |
| 163 | + @param trajectory 弹幕轨迹 | |
| 164 | + @param isMine 是否是我发的弹幕 | |
| 165 | + */ | |
| 166 | +- (void)createBarrageComment:(NSString *)comment userName:(NSString *)userName trajectory:(NSString *)trajectory isMine:(BOOL)isMine | |
| 167 | +{ | |
| 168 | + if (self.isStopAnimation) { | |
| 169 | + return; | |
| 170 | + } | |
| 171 | + //创建一个弹幕view | |
| 172 | + CNBarrageView *view = [[CNBarrageView alloc] initWithContent:comment userName:userName isMine:isMine]; | |
| 173 | + | |
| 174 | + //设置运行轨迹 | |
| 175 | + view.trajectory = [trajectory floatValue]; | |
| 176 | + weakself | |
| 177 | + __weak CNBarrageView *weakBarrageView = view; | |
| 178 | + view.moveBlock = ^(CommentMoveState status){ | |
| 179 | + strongself | |
| 180 | + if (self.isStopAnimation) { | |
| 181 | + return; | |
| 182 | + } | |
| 183 | + switch (status) { | |
| 184 | + case CommentMoveStateStart: | |
| 185 | + { | |
| 186 | + //弹幕开始,将view加入弹幕管理数组 | |
| 187 | + [self.barrageQueue addObject:weakBarrageView]; | |
| 188 | + } | |
| 189 | + break; | |
| 190 | + case CommentMoveStateEnter: | |
| 191 | + { | |
| 192 | + [self.trajectoryArr removeObject:trajectory]; | |
| 193 | + //弹幕完全进入屏幕,判断接下来是否还有内容,如果有则在该弹幕轨迹队列中创建弹幕 | |
| 194 | + NSString *comment = [self nextComment]; | |
| 195 | + if (comment) { | |
| 196 | + [self createBarrageComment:comment userName:userName trajectory:trajectory isMine:isMine]; | |
| 197 | +// [self createBarrageComment:comment trajectory:trajectory isMine:isMine]; | |
| 198 | + } | |
| 199 | + else { | |
| 200 | + //没有评论了 | |
| 201 | + } | |
| 202 | + } | |
| 203 | + break; | |
| 204 | + case CommentMoveStateEnd: | |
| 205 | + { | |
| 206 | + //弹幕飞出屏幕后从弹幕管理队列中删除 | |
| 207 | + if ([self.barrageQueue containsObject:weakBarrageView]) { | |
| 208 | + [self.barrageQueue removeObject:weakBarrageView]; | |
| 209 | + } | |
| 210 | + } | |
| 211 | + break; | |
| 212 | + default: | |
| 213 | + break; | |
| 214 | + } | |
| 215 | + }; | |
| 216 | + //弹幕生成后,传到Controller进行页面展示 | |
| 217 | + if (self.generateBarrageBlock) { | |
| 218 | + self.generateBarrageBlock(view); | |
| 219 | + } | |
| 220 | +} | |
| 221 | + | |
| 222 | +#pragma mark - getter | |
| 223 | + | |
| 224 | +- (NSMutableArray *)allComments { | |
| 225 | + if (!_allComments) { | |
| 226 | + _allComments = [NSMutableArray array]; | |
| 227 | + } | |
| 228 | + return _allComments; | |
| 229 | +} | |
| 230 | + | |
| 231 | +- (NSMutableArray *)tmpComments { | |
| 232 | + if (!_tmpComments) { | |
| 233 | + _tmpComments = [NSMutableArray array]; | |
| 234 | + } | |
| 235 | + return _tmpComments; | |
| 236 | +} | |
| 237 | + | |
| 238 | +- (NSMutableArray *)barrageQueue { | |
| 239 | + if (!_barrageQueue) { | |
| 240 | + _barrageQueue = [NSMutableArray array]; | |
| 241 | + } | |
| 242 | + return _barrageQueue; | |
| 243 | +} | |
| 244 | + | |
| 245 | +- (NSMutableArray *)trajectoryArr { | |
| 246 | + if (!_trajectoryArr) { | |
| 247 | + _trajectoryArr = [NSMutableArray array]; | |
| 248 | + } | |
| 249 | + return _trajectoryArr; | |
| 250 | +} | |
| 251 | + | |
| 252 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/Barrage/CNBarrageView.h
0 → 100644
| 1 | +// | |
| 2 | +// CNBarrageView.h | |
| 3 | +// personalXmppChatDemo | |
| 4 | +// | |
| 5 | +// Created by 张旭 on 2016/12/10. | |
| 6 | +// Copyright © 2016年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | + | |
| 11 | +#define BARRAGE_VERTICAL_HEIGHT 25.f //每个弹幕View在垂直方向上的高度 | |
| 12 | +#define MAX_BARRAGE_VERTICAL_COUNT (long)([UIScreen mainScreen].bounds.size.height * 1.0/BARRAGE_VERTICAL_HEIGHT) //垂直方向上的弹幕最大数量 | |
| 13 | +#define BARRAGE_VERTICAL_MARGIN ([UIScreen mainScreen].bounds.size.height - BARRAGE_VERTICAL_HEIGHT * MAX_BARRAGE_VERTICAL_COUNT) * 1.0 / (MAX_BARRAGE_VERTICAL_COUNT - 1) //垂直方向上弹幕之间的间隙 | |
| 14 | + | |
| 15 | +typedef NS_ENUM(NSInteger, CommentMoveState){//弹幕移动的状态 | |
| 16 | + CommentMoveStateStart = 0,//将要进入屏幕 | |
| 17 | + CommentMoveStateEnter ,//完全进入 | |
| 18 | + CommentMoveStateEnd //完全移除屏幕 | |
| 19 | +}; | |
| 20 | + | |
| 21 | + | |
| 22 | +@interface CNBarrageView : UIView | |
| 23 | + | |
| 24 | +@property (nonatomic ,copy) void (^moveBlock) (CommentMoveState state);//弹幕移动的状态 | |
| 25 | +@property (nonatomic) CGFloat trajectory;//弹幕的移动轨迹 | |
| 26 | + | |
| 27 | +/** | |
| 28 | + 初始化弹幕View根据评论内容,消息是否是自己发送 | |
| 29 | + | |
| 30 | + @param content 评论内容 | |
| 31 | + @param userName 用户名字 | |
| 32 | + @param isMine 是否是自己的评论弹幕 | |
| 33 | + @return 弹幕View | |
| 34 | + */ | |
| 35 | +- (instancetype)initWithContent:(NSString *)content userName:(NSString *)userName isMine:(BOOL)isMine; | |
| 36 | + | |
| 37 | +/** | |
| 38 | + 开始移动动画 | |
| 39 | + */ | |
| 40 | +- (void)startAnimation; | |
| 41 | + | |
| 42 | +/** | |
| 43 | + 停止移动动画 | |
| 44 | + */ | |
| 45 | +- (void)stopAnimation; | |
| 46 | + | |
| 47 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/Barrage/CNBarrageView.m
0 → 100644
| 1 | + | |
| 2 | +// | |
| 3 | +// CNBarrageView.m | |
| 4 | +// personalXmppChatDemo | |
| 5 | +// | |
| 6 | +// Created by 张旭 on 2016/12/10. | |
| 7 | +// Copyright © 2016年 cnlive. All rights reserved. | |
| 8 | +// | |
| 9 | + | |
| 10 | +#import "CNBarrageView.h" | |
| 11 | + | |
| 12 | +#define TotalDuration 5 //弹幕飘过总时间 | |
| 13 | +#define BARRAGE_Horizontal_Margin 5 //弹幕间水平间隙 | |
| 14 | + | |
| 15 | +@interface CNBarrageView () | |
| 16 | + | |
| 17 | +@property (nonatomic ,strong) UILabel * _Nullable commentLabel;//评论Label | |
| 18 | +@property BOOL isDealloc;//标记资源是否已释放 | |
| 19 | + | |
| 20 | +@end | |
| 21 | + | |
| 22 | +@implementation CNBarrageView | |
| 23 | + | |
| 24 | +/** | |
| 25 | + 销毁对象及动画 | |
| 26 | + */ | |
| 27 | +- (void)dealloc | |
| 28 | +{ | |
| 29 | + [self stopAnimation]; | |
| 30 | + self.moveBlock = nil; | |
| 31 | +} | |
| 32 | + | |
| 33 | +/** | |
| 34 | + 初始化弹幕View根据评论内容,消息是否是自己发送 | |
| 35 | + | |
| 36 | + @param content 评论内容 | |
| 37 | + @param userName 用户名字 | |
| 38 | + @param isMine 是否是自己的评论弹幕 | |
| 39 | + @return 弹幕View | |
| 40 | + */ | |
| 41 | +- (instancetype)initWithContent:(NSString *)content userName:(NSString *)userName isMine:(BOOL)isMine | |
| 42 | +{ | |
| 43 | + if (self = [super init]) | |
| 44 | + { | |
| 45 | + content = [NSString stringWithFormat:@"%@:%@",userName,content]; | |
| 46 | + NSDictionary *attributes = @{NSFontAttributeName:[UIFont systemFontOfSize:14]}; | |
| 47 | + float width = [content sizeWithAttributes:attributes].width; | |
| 48 | +// float height = [content sizeWithAttributes:attributes].height;//16.707031 | |
| 49 | + self.bounds = CGRectMake(0, 0, width + BARRAGE_Horizontal_Margin * 2, BARRAGE_VERTICAL_HEIGHT); | |
| 50 | + self.commentLabel.text = content; | |
| 51 | + self.commentLabel.frame = CGRectMake(BARRAGE_Horizontal_Margin, 0, width, BARRAGE_VERTICAL_HEIGHT); | |
| 52 | + if(isMine) | |
| 53 | + { | |
| 54 | + self.commentLabel.textColor = [UIColor redColor]; | |
| 55 | + }else | |
| 56 | + { | |
| 57 | + self.commentLabel.textColor = [UIColor lightGrayColor]; | |
| 58 | + } | |
| 59 | + | |
| 60 | + } | |
| 61 | + return self; | |
| 62 | +} | |
| 63 | + | |
| 64 | +/** | |
| 65 | + 开始移动动画 | |
| 66 | + */ | |
| 67 | +- (void)startAnimation | |
| 68 | +{ | |
| 69 | + CGFloat wholeWidth = self.width + SCREEN_WIDTH + 50;//总轨迹长度 | |
| 70 | + CGFloat speed = wholeWidth / TotalDuration;//速度 | |
| 71 | + CGFloat duration = (self.width + 50) / speed;//完全进入屏幕的时间 | |
| 72 | + | |
| 73 | + if (self.moveBlock) { | |
| 74 | + //弹幕开始进入屏幕 | |
| 75 | + self.moveBlock(CommentMoveStateStart); | |
| 76 | + } | |
| 77 | + | |
| 78 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(duration * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |
| 79 | + //避免重复,若资源已释放 不再操作 | |
| 80 | + if (self.isDealloc) { | |
| 81 | + return; | |
| 82 | + } | |
| 83 | + //duration时间后弹幕完全进入屏幕 | |
| 84 | + if (self.moveBlock) { | |
| 85 | + self.moveBlock(CommentMoveStateEnter); | |
| 86 | + } | |
| 87 | + }); | |
| 88 | + | |
| 89 | + weakself | |
| 90 | + //弹幕完全离开屏幕 | |
| 91 | + [UIView animateWithDuration:TotalDuration delay:0 options:UIViewAnimationOptionCurveLinear animations:^{ | |
| 92 | + strongself | |
| 93 | + self.left = - self.width; | |
| 94 | + } completion:^(BOOL finished) { | |
| 95 | + if (self.moveBlock) { | |
| 96 | + self.moveBlock(CommentMoveStateEnd); | |
| 97 | + } | |
| 98 | + [self removeFromSuperview]; | |
| 99 | + }]; | |
| 100 | + | |
| 101 | +} | |
| 102 | + | |
| 103 | +/** | |
| 104 | + 停止移动动画 | |
| 105 | + */ | |
| 106 | +- (void)stopAnimation | |
| 107 | +{ | |
| 108 | + self.isDealloc = YES; | |
| 109 | + [self.layer removeAllAnimations]; | |
| 110 | + [self removeFromSuperview]; | |
| 111 | +} | |
| 112 | + | |
| 113 | +#pragma mark getter | |
| 114 | + | |
| 115 | +- (UILabel *)commentLabel | |
| 116 | +{ | |
| 117 | + if (!_commentLabel) { | |
| 118 | + _commentLabel = [[UILabel alloc] init]; | |
| 119 | + _commentLabel.backgroundColor = [UIColor clearColor]; | |
| 120 | + _commentLabel.font = [UIFont systemFontOfSize:14.f]; | |
| 121 | + _commentLabel.textColor = [UIColor lightGrayColor]; | |
| 122 | + [self addSubview:self.commentLabel]; | |
| 123 | + } | |
| 124 | + return _commentLabel; | |
| 125 | +} | |
| 126 | + | |
| 127 | +/* | |
| 128 | +// Only override drawRect: if you perform custom drawing. | |
| 129 | +// An empty implementation adversely affects performance during animation. | |
| 130 | +- (void)drawRect:(CGRect)rect { | |
| 131 | + // Drawing code | |
| 132 | +} | |
| 133 | +*/ | |
| 134 | + | |
| 135 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/ChatMsgModel/chatMsgModel.h
0 → 100644
| 1 | +// | |
| 2 | +// chatMsgModel.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by 张旭 on 2017/3/20. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "BaseModel.h" | |
| 10 | + | |
| 11 | +@interface chatMsgModel : BaseModel | |
| 12 | + | |
| 13 | +@property (nonatomic ,copy ) NSString * _Nullable icon;//头像 | |
| 14 | +@property (nonatomic ,copy ) NSString * _Nullable name;//姓名 | |
| 15 | +@property (nonatomic ,copy ) NSString * _Nullable content;//内容 | |
| 16 | + | |
| 17 | +@property (nonatomic ,assign) CGFloat cellWidth;//内容宽度 | |
| 18 | +@property (nonatomic ,assign) CGFloat cellHeight;//内容高度 | |
| 19 | + | |
| 20 | +@property (nonatomic) BOOL isMine;//消息是否是自己发送 | |
| 21 | + | |
| 22 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/ChatMsgModel/chatMsgModel.m
0 → 100644
| 1 | +// | |
| 2 | +// chatMsgModel.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by 张旭 on 2017/3/20. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "chatMsgModel.h" | |
| 10 | + | |
| 11 | +#define ChatCellMargin 10 | |
| 12 | + | |
| 13 | +@implementation chatMsgModel | |
| 14 | + | |
| 15 | +- (CGFloat)cellHeight | |
| 16 | +{ | |
| 17 | + //如果计算过高度,直接返回 | |
| 18 | + if (_cellHeight) return _cellHeight; | |
| 19 | + | |
| 20 | + //头像 | |
| 21 | + _cellHeight = 40; | |
| 22 | + //文字 | |
| 23 | + CGFloat textMaxW = self.cellWidth - 2 * ChatCellMargin; | |
| 24 | + CGSize textMaxSize = CGSizeMake(textMaxW, MAXFLOAT); | |
| 25 | + CGSize textSize = [self.content boundingRectWithSize:textMaxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:16]} context:nil].size; | |
| 26 | + | |
| 27 | + //底部空隙 | |
| 28 | + _cellHeight += textSize.height + ChatCellMargin; | |
| 29 | + // NSLog(@"cellHeight = %f",_cellHeight); | |
| 30 | + return _cellHeight; | |
| 31 | +} | |
| 32 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/ChatViews/chatListCell.h
0 → 100644
| 1 | +// | |
| 2 | +// chatListCell.h | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by 张旭 on 2017/3/20. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "BaseTableViewCell.h" | |
| 10 | +@class chatMsgModel; | |
| 11 | +@interface chatListCell : BaseTableViewCell | |
| 12 | + | |
| 13 | +- (void)loadUIWithModel:(chatMsgModel *)model; | |
| 14 | + | |
| 15 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Chat/ChatViews/chatListCell.m
0 → 100644
| 1 | +// | |
| 2 | +// chatListCell.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by 张旭 on 2017/3/20. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "chatListCell.h" | |
| 10 | +#import "chatMsgModel.h" | |
| 11 | +@interface chatListCell () | |
| 12 | + | |
| 13 | +@property (nonatomic ,strong) UIImageView * _Nullable iconImageView;//头像图片 | |
| 14 | +@property (nonatomic ,strong) UILabel * _Nullable nameLabel;//名字 | |
| 15 | +@property (nonatomic ,strong) UILabel * _Nullable contentLabel;//内容 | |
| 16 | +@property (nonatomic ,strong) UIImageView * _Nullable lineImageView;//分割线 | |
| 17 | + | |
| 18 | +@property (nonatomic ,strong) chatMsgModel * _Nullable model; | |
| 19 | + | |
| 20 | +@end | |
| 21 | + | |
| 22 | +@implementation chatListCell | |
| 23 | + | |
| 24 | +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier | |
| 25 | +{ | |
| 26 | + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; | |
| 27 | + if (self) { | |
| 28 | + self.backgroundColor = [UIColor clearColor]; | |
| 29 | + self.selectionStyle = UITableViewCellSelectionStyleNone; | |
| 30 | + } | |
| 31 | + return self; | |
| 32 | +} | |
| 33 | + | |
| 34 | +- (void)loadUIWithModel:(chatMsgModel *)model | |
| 35 | +{ | |
| 36 | + model.cellWidth = self.width; | |
| 37 | + _model = model; | |
| 38 | + | |
| 39 | + [self bindView];//更新cell高度后再初始化UI | |
| 40 | + [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.icon] placeholderImage:nil]; | |
| 41 | + // self.iconImageView.backgroundColor = [UIColor greenColor]; | |
| 42 | + self.nameLabel.text = [NSString stringWithFormat:@"%@:",model.name]; | |
| 43 | + CGSize labelSize = [self.nameLabel labelSize]; | |
| 44 | + self.nameLabel.frame = CGRectMake(self.iconImageView.right + 10, self.iconImageView.top, labelSize.width, labelSize.height); | |
| 45 | + self.nameLabel.centerY = self.iconImageView.centerY; | |
| 46 | + self.contentLabel.text = model.content; | |
| 47 | + CGSize contentLabelSize = [self.contentLabel labelSizeWithWidth:self.width - 2 * self.iconImageView.left]; | |
| 48 | + self.contentLabel.frame = CGRectMake(self.iconImageView.left, self.iconImageView.bottom + 10, contentLabelSize.width, contentLabelSize.height); | |
| 49 | + | |
| 50 | + self.lineImageView.frame = CGRectMake(self.iconImageView.left, self.contentLabel.bottom + 5, self.width - self.iconImageView.left * 2, 1); | |
| 51 | +} | |
| 52 | + | |
| 53 | +- (void)bindView | |
| 54 | +{ | |
| 55 | + self.iconImageView.frame = CGRectMake(10, 10, 30, 30); | |
| 56 | + self.nameLabel.frame = CGRectMake(self.iconImageView.right + 10, self.iconImageView.top, self.width - self.iconImageView.right - 20, 25); | |
| 57 | + self.nameLabel.centerY = self.iconImageView.centerY; | |
| 58 | + self.contentLabel.frame = CGRectMake(self.iconImageView.left, self.iconImageView.bottom + 10, self.width - 2 * self.iconImageView.left, 25); | |
| 59 | +} | |
| 60 | + | |
| 61 | +#pragma mark - getter | |
| 62 | +- (UILabel * _Nullable)nameLabel | |
| 63 | +{ | |
| 64 | + if (!_nameLabel) | |
| 65 | + { | |
| 66 | + _nameLabel = [[UILabel alloc] init]; | |
| 67 | + _nameLabel.textAlignment = NSTextAlignmentLeft; | |
| 68 | + _nameLabel.textColor = [UIColor redColor]; | |
| 69 | + _nameLabel.font = [UIFont systemFontOfSize:15.f]; | |
| 70 | + [self addSubview:_nameLabel]; | |
| 71 | + } | |
| 72 | + return _nameLabel; | |
| 73 | +} | |
| 74 | + | |
| 75 | +- (UILabel * _Nullable)contentLabel | |
| 76 | +{ | |
| 77 | + if (!_contentLabel) | |
| 78 | + { | |
| 79 | + _contentLabel = [[UILabel alloc] init]; | |
| 80 | + _contentLabel.textAlignment = NSTextAlignmentLeft; | |
| 81 | + _contentLabel.textColor = [UIColor lightGrayColor]; | |
| 82 | + _contentLabel.numberOfLines = 0; | |
| 83 | + _contentLabel.font = [UIFont systemFontOfSize:12.f]; | |
| 84 | + [self addSubview:_contentLabel]; | |
| 85 | + } | |
| 86 | + return _contentLabel; | |
| 87 | +} | |
| 88 | + | |
| 89 | +- (UIImageView * _Nullable)iconImageView | |
| 90 | +{ | |
| 91 | + if (!_iconImageView) | |
| 92 | + { | |
| 93 | + _iconImageView = [[UIImageView alloc] init]; | |
| 94 | + _iconImageView.layer.masksToBounds = YES; | |
| 95 | + _iconImageView.layer.cornerRadius = 15.f; | |
| 96 | + [self addSubview:_iconImageView]; | |
| 97 | + } | |
| 98 | + return _iconImageView; | |
| 99 | +} | |
| 100 | + | |
| 101 | +- (UIImageView * _Nullable)lineImageView | |
| 102 | +{ | |
| 103 | + if (!_lineImageView) | |
| 104 | + { | |
| 105 | + _lineImageView = [[UIImageView alloc] init]; | |
| 106 | + _lineImageView.image = [UIImage imageNamed:@"分割线(聊天复用)"]; | |
| 107 | + [self addSubview:_lineImageView]; | |
| 108 | + } | |
| 109 | + return _lineImageView; | |
| 110 | +} | |
| 111 | + | |
| 112 | + | |
| 113 | +/* | |
| 114 | +// Only override drawRect: if you perform custom drawing. | |
| 115 | +// An empty implementation adversely affects performance during animation. | |
| 116 | +- (void)drawRect:(CGRect)rect { | |
| 117 | + // Drawing code | |
| 118 | +} | |
| 119 | +*/ | |
| 120 | + | |
| 121 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/AnimQueueManager.h
| ... | ... | @@ -9,11 +9,9 @@ |
| 9 | 9 | #import <Foundation/Foundation.h> |
| 10 | 10 | |
| 11 | 11 | @class GiftModel; |
| 12 | +@class PresentView; | |
| 12 | 13 | @interface AnimQueueManager : NSObject |
| 13 | 14 | |
| 14 | -@property (nonatomic, assign)NSInteger maxTop; //初始位置(需要根据显示设置最低位置在哪里) | |
| 15 | -//@property (nonatomic, strong)NSMutableArray *arGiftArray; //横幅的数量,用于轨道计算(现在结构是一维数组,因为轨道中的弹道只有1个,如果是多个的话需要变为二维数组) | |
| 16 | - | |
| 17 | 15 | /** |
| 18 | 16 | 初始化管理类 |
| 19 | 17 | @return 当前manager | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/AnimQueueManager.m
| ... | ... | @@ -9,10 +9,13 @@ |
| 9 | 9 | #import "AnimQueueManager.h" |
| 10 | 10 | #import "GiftAnimOperation.h" |
| 11 | 11 | #import "GiftModel.h" |
| 12 | +#import "PresentView.h" | |
| 13 | + | |
| 14 | +#import "LiveBaseView.h" | |
| 15 | +#import "PresentView.h" | |
| 12 | 16 | |
| 13 | 17 | @interface AnimQueueManager () |
| 14 | 18 | |
| 15 | -@property (nonatomic, assign)NSInteger maxOperationCount; //并发数 | |
| 16 | 19 | @property (nonatomic,strong) NSOperationQueue *comboAnimationQueue; //连击动画队列 |
| 17 | 20 | @property (nonatomic,strong) NSOperationQueue *expenAnimationQueue; //豪华礼物动画队列 |
| 18 | 21 | |
| ... | ... | @@ -31,26 +34,11 @@ |
| 31 | 34 | static dispatch_once_t onceToken; |
| 32 | 35 | dispatch_once(&onceToken, ^{ |
| 33 | 36 | manager = [[AnimQueueManager alloc] init]; |
| 34 | - manager.maxOperationCount = 2; | |
| 35 | -// manager.arGiftArray = [NSMutableArray arrayWithObjects:@200,@240,@280, nil]; | |
| 36 | 37 | }); |
| 37 | 38 | return manager; |
| 38 | 39 | } |
| 39 | 40 | |
| 40 | 41 | /** |
| 41 | - 连击动画队列 | |
| 42 | - | |
| 43 | - @return 队列obj | |
| 44 | - */ | |
| 45 | -- (NSOperationQueue *)comboAnimationQueue{ | |
| 46 | - if (_comboAnimationQueue == nil) { | |
| 47 | - _comboAnimationQueue = [[NSOperationQueue alloc] init]; | |
| 48 | - _comboAnimationQueue.maxConcurrentOperationCount = 3; | |
| 49 | - } | |
| 50 | - return _comboAnimationQueue; | |
| 51 | -} | |
| 52 | - | |
| 53 | -/** | |
| 54 | 42 | 豪华动画队列 |
| 55 | 43 | |
| 56 | 44 | @return 队列obj |
| ... | ... | @@ -69,28 +57,29 @@ |
| 69 | 57 | @param model modelobj |
| 70 | 58 | */ |
| 71 | 59 | - (void)addAnimationWithModel:(GiftModel *)model animContentView:(UIView *)animContentView{ |
| 72 | - | |
| 73 | - GiftAnimOperation *op = [GiftAnimOperation addGiftAnimOperationWithGiftModel:model animContentView:animContentView maxTop:self.maxTop]; | |
| 74 | - NSInteger index = self.comboAnimationQueue.operationCount; | |
| 75 | - NSLog(@"index:%zd",index); | |
| 60 | + | |
| 61 | + GiftAnimOperation *op = [GiftAnimOperation addGiftAnimOperationWithGiftModel:model animContentView:animContentView]; | |
| 76 | 62 | switch (model.giftStyle) { |
| 77 | 63 | case GiftStylePorsch: |
| 64 | + { | |
| 65 | + [self.expenAnimationQueue addOperation:op]; | |
| 66 | + } | |
| 67 | + break; | |
| 68 | + case GiftStyleFighter: | |
| 69 | + { | |
| 78 | 70 | [self.expenAnimationQueue addOperation:op]; |
| 71 | + } | |
| 79 | 72 | break; |
| 80 | -// case GiftStyleFighter: | |
| 81 | -// [self.expenAnimationQueue addOperation:op]; | |
| 82 | -// break; | |
| 83 | 73 | case GiftStylePlane: |
| 74 | + { | |
| 84 | 75 | [self.expenAnimationQueue addOperation:op]; |
| 76 | + } | |
| 85 | 77 | break; |
| 78 | + | |
| 86 | 79 | case GiftStyleCombo: |
| 87 | 80 | { |
| 88 | - [self.comboAnimationQueue addOperation:op]; | |
| 89 | -// int i = rand()%4; | |
| 90 | -// op.name = i >0 ? @"张三_love" : @"李四_flower";//name imagename | |
| 91 | -// self.comboAnimationQueue.suspended; | |
| 92 | - } | |
| 93 | - | |
| 81 | + [(PresentView *)animContentView insertPresentMessages:@[model] showShakeAnimation:YES]; | |
| 82 | + } | |
| 94 | 83 | break; |
| 95 | 84 | default: |
| 96 | 85 | break; | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftAnimOperation.h
| ... | ... | @@ -13,6 +13,6 @@ |
| 13 | 13 | |
| 14 | 14 | @interface GiftAnimOperation : NSOperation |
| 15 | 15 | |
| 16 | -+ (GiftAnimOperation *)addGiftAnimOperationWithGiftModel:(GiftModel *)model animContentView:(UIView *)animContentView maxTop:(NSInteger)maxTop; | |
| 16 | ++ (GiftAnimOperation *)addGiftAnimOperationWithGiftModel:(GiftModel *)model animContentView:(UIView *)animContentView; | |
| 17 | 17 | |
| 18 | 18 | @end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftAnimOperation.m
| ... | ... | @@ -8,12 +8,11 @@ |
| 8 | 8 | |
| 9 | 9 | #import "GiftAnimOperation.h" |
| 10 | 10 | #import "GiftModel.h" |
| 11 | -#import "GiftComboView.h" | |
| 12 | 11 | #import "NHCarViews.h" |
| 13 | 12 | #import "NHPlaneViews.h" |
| 14 | 13 | #import "GiftAnimationAction.h" |
| 15 | -//#import "NHFighterView.h" | |
| 16 | -//#import "NHFighterView+animDelegagte.h" | |
| 14 | +#import "NHFighterView.h" | |
| 15 | +#import "NHFighterView+animDelegagte.h" | |
| 17 | 16 | |
| 18 | 17 | @interface GiftAnimOperation () |
| 19 | 18 | { |
| ... | ... | @@ -21,24 +20,19 @@ |
| 21 | 20 | BOOL _executing; //队列任务开始执行 |
| 22 | 21 | } |
| 23 | 22 | |
| 24 | -@property (nonatomic, strong)GiftComboView *giftComboView; //连击动画 | |
| 25 | 23 | @property (nonatomic, strong)NHCarViews *giftCarView; //跑车动画 |
| 26 | -//@property (nonatomic, strong)NHFighterView *giftFighterView; //歼灭机动画 | |
| 24 | +@property (nonatomic, strong)NHFighterView *giftFighterView; //歼灭机动画 | |
| 27 | 25 | @property (nonatomic, strong)NHPlaneViews *giftPlaneView; //客机动画 |
| 28 | - | |
| 29 | 26 | @property (nonatomic, strong)GiftModel *model; //model |
| 30 | 27 | @property (nonatomic,strong) UIView *animContentView; //需要显示动画的view |
| 31 | -@property (nonatomic, assign)NSInteger maxTop; //初始位置(需要根据显示设置最低位置在哪里) | |
| 32 | -@property (nonatomic ,strong) NSArray * _Nullable defaultTrajory;//默认轨迹数组 | |
| 33 | -@property (nonatomic ,strong) NSMutableArray * _Nullable emptyTrajory;//当前空轨迹数组 | |
| 34 | 28 | |
| 35 | 29 | @end |
| 36 | 30 | |
| 37 | 31 | @implementation GiftAnimOperation |
| 38 | 32 | |
| 39 | -+ (GiftAnimOperation *)addGiftAnimOperationWithGiftModel:(GiftModel *)model animContentView:(UIView *)animContentView maxTop:(NSInteger)maxTop{ | |
| 33 | ++ (GiftAnimOperation *)addGiftAnimOperationWithGiftModel:(GiftModel *)model animContentView:(UIView *)animContentView{ | |
| 40 | 34 | |
| 41 | - GiftAnimOperation *giftAnimOperation = [[GiftAnimOperation alloc]initWithGiftModel:model animContentView:animContentView maxTop:maxTop]; | |
| 35 | + GiftAnimOperation *giftAnimOperation = [[GiftAnimOperation alloc]initWithGiftModel:model animContentView:animContentView]; | |
| 42 | 36 | return giftAnimOperation; |
| 43 | 37 | } |
| 44 | 38 | |
| ... | ... | @@ -49,12 +43,11 @@ |
| 49 | 43 | @param animContentView 需要把动画view添加到的view |
| 50 | 44 | @return obj |
| 51 | 45 | */ |
| 52 | -- (instancetype)initWithGiftModel:(GiftModel *)model animContentView:(UIView *)animContentView maxTop:(NSInteger)maxTop{ | |
| 46 | +- (instancetype)initWithGiftModel:(GiftModel *)model animContentView:(UIView *)animContentView{ | |
| 53 | 47 | self = [super init]; |
| 54 | 48 | if (self) { |
| 55 | 49 | self.model = model; |
| 56 | 50 | self.animContentView = animContentView; |
| 57 | - self.maxTop = maxTop; | |
| 58 | 51 | } |
| 59 | 52 | return self; |
| 60 | 53 | } |
| ... | ... | @@ -79,15 +72,13 @@ |
| 79 | 72 | case GiftStylePorsch: |
| 80 | 73 | [self porschAnimation]; |
| 81 | 74 | break; |
| 82 | -// case GiftStyleFighter: | |
| 83 | -// [self fighterAnimation]; | |
| 84 | -// break; | |
| 75 | + case GiftStyleFighter: | |
| 76 | + [self fighterAnimation]; | |
| 77 | + break; | |
| 85 | 78 | case GiftStylePlane: |
| 86 | 79 | [self planeAnimation]; |
| 87 | 80 | break; |
| 88 | - case GiftStyleCombo: | |
| 89 | - [self comboViewAnimation]; | |
| 90 | - break; | |
| 81 | + | |
| 91 | 82 | default: |
| 92 | 83 | break; |
| 93 | 84 | } |
| ... | ... | @@ -114,110 +105,48 @@ |
| 114 | 105 | }); |
| 115 | 106 | } |
| 116 | 107 | |
| 117 | -//- (void)fighterAnimation | |
| 118 | -//{ | |
| 119 | -// weakself | |
| 120 | -// dispatch_async(dispatch_get_main_queue(), ^{ | |
| 121 | -// strongself | |
| 122 | -// | |
| 123 | -// [self.giftFighterView addAnimationsMoveToPoint:CGPointMake(SCREEN_WIDTH, 60) endPoint:CGPointMake( -500, 600)]; | |
| 124 | -// [self.animContentView addSubview:self.giftFighterView]; | |
| 125 | -// [self.giftFighterView startFighterAnimationWithCompletion:^{ | |
| 126 | -// [self willChangeValueForKey:@"isFinished"]; | |
| 127 | -// | |
| 128 | -// _finished = YES; | |
| 129 | -// | |
| 130 | -// [self didChangeValueForKey:@"isFinished"]; | |
| 131 | -// }]; | |
| 132 | -// | |
| 133 | -// }); | |
| 134 | -//} | |
| 135 | - | |
| 136 | -- (void)planeAnimation | |
| 108 | +- (void)fighterAnimation | |
| 137 | 109 | { |
| 138 | 110 | weakself |
| 139 | 111 | dispatch_async(dispatch_get_main_queue(), ^{ |
| 140 | 112 | strongself |
| 141 | 113 | |
| 142 | - [self.giftPlaneView addAnimationsMoveToPoint:CGPointMake(SCREEN_WIDTH, 100) endPoint:CGPointMake(-500, 410)]; | |
| 143 | - [self.animContentView addSubview:self.giftPlaneView]; | |
| 144 | - [self.giftPlaneView startPlaneAnimationWithCompletion:^{ | |
| 145 | - | |
| 114 | + [self.giftFighterView addAnimationsMoveToPoint:CGPointMake(SCREEN_WIDTH, 60) endPoint:CGPointMake( -500, 600)]; | |
| 115 | + [self.animContentView addSubview:self.giftFighterView]; | |
| 116 | + | |
| 117 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(12 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |
| 146 | 118 | [self willChangeValueForKey:@"isFinished"]; |
| 147 | 119 | |
| 148 | 120 | _finished = YES; |
| 149 | 121 | |
| 150 | 122 | [self didChangeValueForKey:@"isFinished"]; |
| 151 | - }]; | |
| 152 | - | |
| 123 | + | |
| 124 | + }); | |
| 153 | 125 | }); |
| 154 | 126 | } |
| 155 | 127 | |
| 156 | -static long currentCompleteIndex = 0; | |
| 157 | -/** | |
| 158 | - 连击动画 | |
| 159 | - */ | |
| 160 | -- (void)comboViewAnimation{ | |
| 161 | - | |
| 162 | - __weak GiftAnimOperation *weakSelf = self; | |
| 163 | -// currentCompleteIndex ++; | |
| 164 | - | |
| 165 | -// if (self.emptyTrajory.count == 0)//index = 0 | |
| 166 | -// { | |
| 167 | -// currentCompleteIndex = 0; | |
| 168 | -// | |
| 169 | -// }else if (self.emptyTrajory.count < 3)//从emptyArr取空的index并赋值 index | |
| 170 | -// { | |
| 171 | -// | |
| 172 | -// | |
| 173 | -// }else// = 3已满 index = 0 | |
| 174 | -// { | |
| 175 | -// currentCompleteIndex = 0; | |
| 176 | -// } | |
| 177 | -// self.name = @"111"; | |
| 128 | +- (void)planeAnimation | |
| 129 | +{ | |
| 130 | + weakself | |
| 178 | 131 | dispatch_async(dispatch_get_main_queue(), ^{ |
| 179 | - [weakSelf.animContentView addSubview:weakSelf.giftComboView]; | |
| 180 | - | |
| 181 | - weakSelf.giftComboView.top = [self.defaultTrajory[currentCompleteIndex] integerValue]; | |
| 132 | + strongself | |
| 182 | 133 | |
| 183 | - NSLog(@"top:%zd,index%ld",[self.defaultTrajory[currentCompleteIndex] integerValue],currentCompleteIndex); | |
| 184 | - currentCompleteIndex ++; | |
| 185 | - if (currentCompleteIndex == 3) | |
| 186 | - { | |
| 187 | - currentCompleteIndex = 0; | |
| 188 | - } | |
| 189 | -// if ([self.name isEqualToString:@"李四_flower"]) { | |
| 190 | -//// currentCompleteIndex = 0; | |
| 191 | -// self. | |
| 192 | -// } | |
| 193 | - [weakSelf.giftComboView startComboAnimationWithCompletion:^{ | |
| 194 | - NSLog(@"complet top:%zd,index%zd",[self.defaultTrajory[currentCompleteIndex] integerValue],currentCompleteIndex); | |
| 195 | - //empty存当前顺序 | |
| 196 | -// [self.emptyTrajory replaceObjectAtIndex:<#(NSUInteger)#> withObject:<#(nonnull id)#>]; | |
| 197 | - [weakSelf.giftComboView removeFromSuperview]; | |
| 134 | + [self.giftPlaneView addAnimationsMoveToPoint:CGPointMake(SCREEN_WIDTH, 100) endPoint:CGPointMake(-500, 410)]; | |
| 135 | + [self.animContentView addSubview:self.giftPlaneView]; | |
| 136 | + | |
| 137 | + [self.giftPlaneView startPlaneAnimationWithCompletion:^{ | |
| 198 | 138 | |
| 199 | - [weakSelf willChangeValueForKey:@"isFinished"]; | |
| 139 | + [self willChangeValueForKey:@"isFinished"]; | |
| 200 | 140 | |
| 201 | 141 | _finished = YES; |
| 202 | 142 | |
| 203 | - [weakSelf didChangeValueForKey:@"isFinished"]; | |
| 143 | + [self didChangeValueForKey:@"isFinished"]; | |
| 204 | 144 | }]; |
| 145 | + | |
| 205 | 146 | }); |
| 206 | 147 | } |
| 207 | 148 | |
| 208 | 149 | /** |
| 209 | - 连击动画 | |
| 210 | - | |
| 211 | - @return 连击view | |
| 212 | - */ | |
| 213 | -- (GiftComboView *)giftComboView{ | |
| 214 | - if (_giftComboView == nil) { | |
| 215 | - _giftComboView = [GiftComboView comboView]; | |
| 216 | - } | |
| 217 | - return _giftComboView; | |
| 218 | -} | |
| 219 | - | |
| 220 | -/** | |
| 221 | 150 | 跑车动画 |
| 222 | 151 | |
| 223 | 152 | @return 连击view |
| ... | ... | @@ -241,12 +170,12 @@ static long currentCompleteIndex = 0; |
| 241 | 170 | |
| 242 | 171 | @return 连击view |
| 243 | 172 | */ |
| 244 | -//- (NHFighterView *)giftFighterView{ | |
| 245 | -// if (_giftFighterView == nil) { | |
| 246 | -// _giftFighterView = [NHFighterView loadFighterViewWithPoint:CGPointMake(10, 100)]; | |
| 247 | -// } | |
| 248 | -// return _giftFighterView; | |
| 249 | -//} | |
| 173 | +- (NHFighterView *)giftFighterView{ | |
| 174 | + if (_giftFighterView == nil) { | |
| 175 | + _giftFighterView = [NHFighterView loadFighterViewWithPoint:CGPointMake(10, 100)]; | |
| 176 | + } | |
| 177 | + return _giftFighterView; | |
| 178 | +} | |
| 250 | 179 | |
| 251 | 180 | /** |
| 252 | 181 | 客机动画 |
| ... | ... | @@ -260,24 +189,6 @@ static long currentCompleteIndex = 0; |
| 260 | 189 | return _giftPlaneView; |
| 261 | 190 | } |
| 262 | 191 | |
| 263 | -- (NSArray *)defaultTrajory | |
| 264 | -{ | |
| 265 | - if (!_defaultTrajory) | |
| 266 | - { | |
| 267 | - _defaultTrajory = [[NSArray alloc] initWithObjects:@200,@240,@280, nil]; | |
| 268 | - } | |
| 269 | - return _defaultTrajory; | |
| 270 | -} | |
| 271 | - | |
| 272 | -- (NSMutableArray *)emptyTrajory | |
| 273 | -{ | |
| 274 | - if (!_emptyTrajory) | |
| 275 | - { | |
| 276 | - _emptyTrajory = [[NSMutableArray alloc] init]; | |
| 277 | - } | |
| 278 | - return _emptyTrajory; | |
| 279 | -} | |
| 280 | - | |
| 281 | 192 | // 提示:To be deprecated; use and override 'asynchronous' below |
| 282 | 193 | //之前用的isConcurrent |
| 283 | 194 | /** | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftAnimationAction.h
| ... | ... | @@ -18,21 +18,11 @@ typedef void(^giftAnimationCompletion)(); |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | /** |
| 21 | - 连击动画 | |
| 22 | - */ | |
| 23 | -- (void)startComboAnimationWithCompletion:(giftAnimationCompletion)Completion; | |
| 24 | - | |
| 25 | -/** | |
| 26 | 21 | 跑车动画 |
| 27 | 22 | */ |
| 28 | 23 | - (void)startPorschAnimationWithCompletion:(giftAnimationCompletion)Completion; |
| 29 | 24 | |
| 30 | 25 | /** |
| 31 | - 歼灭机动画 | |
| 32 | - */ | |
| 33 | -//- (void)startFighterAnimationWithCompletion:(giftAnimationCompletion)Completion; | |
| 34 | - | |
| 35 | -/** | |
| 36 | 26 | 客机动画 |
| 37 | 27 | */ |
| 38 | 28 | - (void)startPlaneAnimationWithCompletion:(giftAnimationCompletion)Completion; | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftAnimationAction.m
| ... | ... | @@ -11,46 +11,6 @@ |
| 11 | 11 | @implementation GiftAnimationAction |
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | - 连击横屏动画 | |
| 15 | - */ | |
| 16 | -- (void)startComboAnimationWithCompletion:(giftAnimationCompletion)Completion{ | |
| 17 | - _giftAnimationCompletion = Completion; | |
| 18 | - NSLog(@"self.width:%f",self.width); | |
| 19 | - [self animationWithDuration:4 | |
| 20 | - YValues:@[@(0 - self.width), @(115), @(110), @(110), @(0 - self.width)] | |
| 21 | - keyTimes:@[@0.0, @0.2, @0.3, @0.8, @1.0] | |
| 22 | - timingFunctions:@[ | |
| 23 | - [CAMediaTimingFunction functionWithName: kCAMediaTimingFunctionEaseOut], | |
| 24 | - [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault], | |
| 25 | - [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionDefault], | |
| 26 | - [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn] | |
| 27 | - ] | |
| 28 | - addView:self]; | |
| 29 | -} | |
| 30 | - | |
| 31 | -/** | |
| 32 | - 位移动画具体实现 | |
| 33 | - | |
| 34 | - @param duration 动画持续时间 | |
| 35 | - @param YValues 动画帧数组 | |
| 36 | - @param keyTimes 动画帧时间 | |
| 37 | - @param timingFunctions 动画方式数组 | |
| 38 | - @param addView 需要添加的view | |
| 39 | - */ | |
| 40 | -- (void)animationWithDuration:(float)duration YValues:(NSArray *)YValues keyTimes:(NSArray *)keyTimes timingFunctions:(NSArray *)timingFunctions addView:(UIView *)addView{ | |
| 41 | - CAKeyframeAnimation *rocketAnim = [CAKeyframeAnimation animation]; | |
| 42 | - rocketAnim.keyPath = @"position.x"; | |
| 43 | - rocketAnim.values = YValues; | |
| 44 | - rocketAnim.keyTimes = keyTimes; | |
| 45 | - rocketAnim.timingFunctions = timingFunctions; | |
| 46 | - rocketAnim.duration = duration; | |
| 47 | - rocketAnim.fillMode = kCAFillModeForwards; | |
| 48 | - rocketAnim.removedOnCompletion = NO; | |
| 49 | - rocketAnim.delegate = self; | |
| 50 | - [addView.layer addAnimation:rocketAnim forKey:@"positionY"]; | |
| 51 | -} | |
| 52 | - | |
| 53 | -/** | |
| 54 | 14 | 跑车动画 |
| 55 | 15 | */ |
| 56 | 16 | - (void)startPorschAnimationWithCompletion:(giftAnimationCompletion)Completion |
| ... | ... | @@ -59,14 +19,6 @@ |
| 59 | 19 | } |
| 60 | 20 | |
| 61 | 21 | /** |
| 62 | - 歼灭机动画 | |
| 63 | - */ | |
| 64 | -//- (void)startFighterAnimationWithCompletion:(giftAnimationCompletion)Completion | |
| 65 | -//{ | |
| 66 | -// _giftAnimationCompletion = Completion; | |
| 67 | -//} | |
| 68 | - | |
| 69 | -/** | |
| 70 | 22 | 客机动画 |
| 71 | 23 | */ |
| 72 | 24 | - (void)startPlaneAnimationWithCompletion:(giftAnimationCompletion)Completion | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftComboView.h deleted
100644 → 0
| 1 | -// | |
| 2 | -// GiftComboView.h | |
| 3 | -// LiveVideoCloud | |
| 4 | -// | |
| 5 | -// Created by 张旭 on 2017/3/15. | |
| 6 | -// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | -// | |
| 8 | - | |
| 9 | -#import "GiftAnimationAction.h" | |
| 10 | - | |
| 11 | -@class GiftModel; | |
| 12 | -@interface GiftComboView : GiftAnimationAction | |
| 13 | - | |
| 14 | -/** | |
| 15 | - 动画开始 | |
| 16 | - | |
| 17 | - @param model 对应的动画解析model | |
| 18 | - @param animationCompletion 动画完成回调(用于控制队列) | |
| 19 | - */ | |
| 20 | -- (void)startAnimationWithModel:(GiftModel *)model withAnimationCompletion: (giftAnimationCompletion)animationCompletion; | |
| 21 | - | |
| 22 | -+ (instancetype)comboView; | |
| 23 | - | |
| 24 | -@end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftComboView.m deleted
100644 → 0
| 1 | -// | |
| 2 | -// GiftComboView.m | |
| 3 | -// LiveVideoCloud | |
| 4 | -// | |
| 5 | -// Created by 张旭 on 2017/3/15. | |
| 6 | -// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | -// | |
| 8 | - | |
| 9 | -#import "GiftComboView.h" | |
| 10 | -#import "GiftModel.h" | |
| 11 | - | |
| 12 | -@interface GiftComboView (){ | |
| 13 | - GiftModel *_model;//礼物model | |
| 14 | -} | |
| 15 | - | |
| 16 | -@end | |
| 17 | - | |
| 18 | -@implementation GiftComboView | |
| 19 | - | |
| 20 | -/** | |
| 21 | - 动画开始 | |
| 22 | - | |
| 23 | - @param model 对应的动画解析model | |
| 24 | - @param animationCompletion 动画完成回调(用于控制队列) | |
| 25 | - */ | |
| 26 | -- (void)startAnimationWithModel:(GiftModel *)model withAnimationCompletion: (giftAnimationCompletion)animationCompletion | |
| 27 | -{ | |
| 28 | - _giftAnimationCompletion = animationCompletion; | |
| 29 | - _model = model; | |
| 30 | - | |
| 31 | - [self startComboAnimationWithCompletion:animationCompletion]; | |
| 32 | -} | |
| 33 | - | |
| 34 | - | |
| 35 | -/** | |
| 36 | - 初始化连击View | |
| 37 | - | |
| 38 | - @return 初始化连击ComboView | |
| 39 | - */ | |
| 40 | -+ (instancetype)comboView | |
| 41 | -{ | |
| 42 | - GiftComboView *comboView = [[GiftComboView alloc] initWithFrame:CGRectMake(0, 0, 180, 30)]; | |
| 43 | - comboView.backgroundColor = [UIColor blueColor]; | |
| 44 | - | |
| 45 | - return comboView; | |
| 46 | -} | |
| 47 | - | |
| 48 | -/* | |
| 49 | -// Only override drawRect: if you perform custom drawing. | |
| 50 | -// An empty implementation adversely affects performance during animation. | |
| 51 | -- (void)drawRect:(CGRect)rect { | |
| 52 | - // Drawing code | |
| 53 | -} | |
| 54 | -*/ | |
| 55 | - | |
| 56 | -@end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftModel/GiftModel.h
| ... | ... | @@ -7,29 +7,36 @@ |
| 7 | 7 | // |
| 8 | 8 | |
| 9 | 9 | #import "BaseModel.h" |
| 10 | - | |
| 10 | +#import "PresentModelAble.h" | |
| 11 | 11 | typedef NS_ENUM(NSInteger, GiftStyle) {//礼物类型 |
| 12 | 12 | GiftStyleCombo = 1,//普通可连击礼物 |
| 13 | 13 | GiftStylePorsch ,//豪华跑车礼物 |
| 14 | -// GiftStyleFighter ,//豪华歼灭机礼物 | |
| 14 | + GiftStyleFighter ,//豪华歼灭机礼物 | |
| 15 | 15 | GiftStylePlane ,//豪华客机礼物 |
| 16 | 16 | }; |
| 17 | 17 | |
| 18 | -@interface GiftModel : BaseModel | |
| 18 | +@interface GiftModel : BaseModel <PresentModelAble> | |
| 19 | +@property (copy, nonatomic) NSString *_Nullable sender;//送礼人 | |
| 20 | +@property (copy, nonatomic) NSString *_Nullable giftName;//礼物名称 | |
| 21 | +@property (copy, nonatomic) NSString *_Nullable icon;//送礼头像 | |
| 22 | +@property (copy, nonatomic) NSString *_Nullable giftImageName;//礼物图片名字 | |
| 23 | +@property (assign, nonatomic) NSInteger giftNumber;//礼物数量 | |
| 19 | 24 | |
| 20 | -@property (nonatomic ,copy ) NSString * _Nullable image; | |
| 25 | +//可本地处理 | |
| 21 | 26 | @property (nonatomic ,copy ) NSString * _Nullable price; |
| 22 | - | |
| 23 | -@property (nonatomic ) NSInteger index;//索引 | |
| 24 | 27 | @property (nonatomic ) GiftStyle giftStyle;//动画类型 |
| 25 | -@property (nonatomic, copy ) NSString * _Nullable giftname;//礼物名字 | |
| 26 | -@property (nonatomic, strong) NSArray * _Nullable giftIconArray;//礼物图片数组 | |
| 27 | -@property (nonatomic, copy ) NSString * _Nullable giftNum;//礼物数量 | |
| 28 | -@property (nonatomic, copy ) NSString * _Nullable giftRusername;//接受礼物的人 | |
| 29 | -@property (nonatomic, copy ) NSString * _Nullable giftRuserId;//接受礼物的人id | |
| 30 | -@property (nonatomic, copy ) NSString * _Nullable giftGusername;//送礼物的人 | |
| 31 | -@property (nonatomic, copy ) NSString * _Nullable giftGuserId;//送礼物的id | |
| 28 | +@property (nonatomic ) NSInteger index;//索引和giftname一样 | |
| 29 | + | |
| 30 | +//@property (nonatomic, copy ) NSString * _Nullable giftname;//礼物名字 | |
| 31 | +//@property (nonatomic, strong) NSArray * _Nullable giftIconArray;//礼物图片数组 | |
| 32 | +//@property (nonatomic, copy ) NSString * _Nullable giftNum;//礼物数量 | |
| 33 | +//@property (nonatomic, copy ) NSString * _Nullable giftRusername;//接受礼物的人 | |
| 34 | +//@property (nonatomic, copy ) NSString * _Nullable giftRuserId;//接受礼物的人id | |
| 35 | +//@property (nonatomic, copy ) NSString * _Nullable giftGusername;//送礼物的人 | |
| 36 | +//@property (nonatomic, copy ) NSString * _Nullable giftGuserId;//送礼物的id | |
| 32 | 37 | |
| 33 | 38 | //@property (nonatomic, strong) NSString *_Nullable pushId;//跳转id |
| 34 | 39 | |
| 40 | ++ (instancetype _Nonnull)modelWithSender:(NSString *_Nonnull)sender giftName:(NSString *_Nonnull)giftName icon:(NSString *_Nonnull)icon giftImageName:(NSString *_Nonnull)giftImageName; | |
| 41 | + | |
| 35 | 42 | @end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftModel/GiftModel.m
| ... | ... | @@ -9,5 +9,13 @@ |
| 9 | 9 | #import "GiftModel.h" |
| 10 | 10 | |
| 11 | 11 | @implementation GiftModel |
| 12 | - | |
| 12 | ++ (instancetype)modelWithSender:(NSString *)sender giftName:(NSString *)giftName icon:(NSString *)icon giftImageName:(NSString *)giftImageName | |
| 13 | +{ | |
| 14 | + GiftModel *model = [[GiftModel alloc] init]; | |
| 15 | + model.sender = sender; | |
| 16 | + model.giftName = giftName; | |
| 17 | + model.icon = icon; | |
| 18 | + model.giftImageName = giftImageName; | |
| 19 | + return model; | |
| 20 | +} | |
| 13 | 21 | @end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftResource/NHCarViews.m
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftResource/NHFighterView+animDelegagte.m
| ... | ... | @@ -7,6 +7,7 @@ |
| 7 | 7 | // |
| 8 | 8 | |
| 9 | 9 | #import "NHFighterView+animDelegagte.h" |
| 10 | +#import "GiftAnimationAction.h" | |
| 10 | 11 | |
| 11 | 12 | @implementation NHFighterView (animDelegagte) |
| 12 | 13 | |
| ... | ... | @@ -17,7 +18,8 @@ |
| 17 | 18 | |
| 18 | 19 | - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag |
| 19 | 20 | { |
| 20 | - _giftAnimationCompletion(-1); | |
| 21 | +// _giftAnimationCompletion(); | |
| 22 | + | |
| 21 | 23 | NSLog(@"did stop"); |
| 22 | 24 | } |
| 23 | 25 | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftResource/NHFighterView.h
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftResource/NHPlaneViews.m
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftViews/GiftListView.m
| ... | ... | @@ -10,16 +10,23 @@ |
| 10 | 10 | #import "GiftModel.h" |
| 11 | 11 | #import "LiveBaseView.h" |
| 12 | 12 | #import "AnimQueueManager.h" |
| 13 | +#import "GiftPayButton.h" | |
| 13 | 14 | |
| 14 | 15 | #define MAX_LINE_COUNT 4 |
| 15 | 16 | #define MAX_ROW_COUNT 2 |
| 16 | 17 | |
| 18 | +#define GiftPayViewHeight 50 | |
| 19 | + | |
| 17 | 20 | @interface GiftListView () |
| 18 | 21 | |
| 19 | -@property (nonatomic ,strong) NSArray <GiftModel *>* _Nullable giftArray; | |
| 20 | -@property (nonatomic ,weak) LiveBaseView * _Nullable liveBaseView; | |
| 21 | -@property (nonatomic, strong) AnimQueueManager *animQueueManager; | |
| 22 | -@property (nonatomic ,strong) GiftModel * _Nullable model; | |
| 22 | +@property (nonatomic ,strong) NSArray <GiftModel *>* _Nullable giftArray; | |
| 23 | +@property (nonatomic ,strong) NSArray <NSString *>* _Nullable images; | |
| 24 | +@property (nonatomic ,strong) NSArray <NSString *>* _Nullable giftNames; | |
| 25 | +@property (nonatomic ,strong) NSArray <NSString *>* _Nullable prices; | |
| 26 | +@property (nonatomic ,strong) NSArray <NSString *>* _Nullable types; | |
| 27 | +@property (nonatomic ,weak ) LiveBaseView * _Nullable liveBaseView; | |
| 28 | +@property (nonatomic, strong) AnimQueueManager * animQueueManager; | |
| 29 | +@property (nonatomic ,strong) GiftModel * _Nullable model; | |
| 23 | 30 | |
| 24 | 31 | @end |
| 25 | 32 | |
| ... | ... | @@ -28,18 +35,22 @@ |
| 28 | 35 | - (instancetype)initWithFrame:(CGRect)frame liveBaseView:(LiveBaseView *_Nullable)liveBaseView |
| 29 | 36 | { |
| 30 | 37 | if (self = [super initWithFrame:frame]) { |
| 38 | + | |
| 39 | + _images = [NSArray arrayWithObjects:@"porsch_small80",@"fighter_small80",@"plane_small80",@"love_gift",@"beer",@"chicken",@"cucumber",@"flower",@"hug",@"mouth",@"ring",@"rose",@"sticks",nil]; | |
| 40 | + _giftNames = [NSArray arrayWithObjects:@"跑车",@"歼灭机",@"飞机",@"大大的爱心",@"啤酒",@"小鸡",@"小黄瓜",@"鲜花",@"抱抱",@"亲吻",@"戒指",@"玫瑰花",@"荧光棒",nil]; | |
| 41 | + _prices = [NSArray arrayWithObjects:@"300000000",@"300000000",@"300000",@"30",@"30",@"3",@"3",@"1",@"3",@"1",@"3",@"30",@"300", nil]; | |
| 42 | + _types = [NSArray arrayWithObjects:@2,@3,@4,@1,@1,@1,@1,@1,@1,@1,@1,@1,@1, nil]; | |
| 43 | + | |
| 31 | 44 | self.liveBaseView = liveBaseView; |
| 32 | 45 | self.animQueueManager = [AnimQueueManager sharedAnimQueueManager]; |
| 33 | - self.animQueueManager.maxTop = 200; | |
| 34 | 46 | |
| 35 | - UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height - 30)]; | |
| 36 | - scrollView.contentSize = CGSizeMake(self.width *(self.giftArray.count/(MAX_ROW_COUNT*MAX_LINE_COUNT) + 1), self.height - 30); | |
| 47 | + UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, self.width, self.height - GiftPayViewHeight)]; | |
| 48 | + scrollView.contentSize = CGSizeMake(self.width *(self.giftArray.count/(MAX_ROW_COUNT*MAX_LINE_COUNT) + 1), self.height - GiftPayViewHeight); | |
| 37 | 49 | scrollView.pagingEnabled = YES; |
| 38 | 50 | scrollView.bounces = NO; |
| 39 | 51 | scrollView.showsVerticalScrollIndicator = NO; |
| 40 | 52 | scrollView.showsHorizontalScrollIndicator = NO; |
| 41 | 53 | [self addSubview:scrollView]; |
| 42 | - scrollView.backgroundColor = ZXRandomColor; | |
| 43 | 54 | |
| 44 | 55 | int line = 0; |
| 45 | 56 | int row = 0; |
| ... | ... | @@ -57,40 +68,67 @@ |
| 57 | 68 | } |
| 58 | 69 | row = i % MAX_LINE_COUNT; |
| 59 | 70 | CGFloat giftWidth = self.width / MAX_LINE_COUNT * 1.0; |
| 60 | - CGFloat giftHeight = (self.height - 30) / MAX_ROW_COUNT * 1.0; | |
| 71 | + CGFloat giftHeight = (self.height - GiftPayViewHeight) / MAX_ROW_COUNT * 1.0; | |
| 61 | 72 | giftX = row * giftWidth + page * scrollView.width; |
| 62 | 73 | giftY = line * giftHeight; |
| 63 | 74 | |
| 64 | 75 | UIView *giftView = [self giftViewWithFrame:CGRectMake(giftX, giftY, giftWidth, giftHeight) model:self.giftArray[i]]; |
| 76 | + giftView.backgroundColor = [UIColor clearColor]; | |
| 65 | 77 | |
| 66 | - UIImageView *picImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:self.giftArray[i].image]]; | |
| 78 | + //礼物图片 | |
| 79 | + UIImageView *picImg = [[UIImageView alloc] initWithImage:[UIImage imageNamed:self.giftArray[i].giftImageName]]; | |
| 67 | 80 | picImg.centerX = giftView.width * 0.5; |
| 68 | 81 | picImg.centerY = giftView.height * 0.5; |
| 69 | 82 | [giftView addSubview:picImg]; |
| 70 | - | |
| 71 | 83 | [scrollView addSubview:giftView]; |
| 72 | 84 | |
| 73 | 85 | UITapGestureRecognizer *gesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(gestureClick:)]; |
| 74 | 86 | giftView.tag = i + 10; |
| 75 | 87 | [giftView addGestureRecognizer:gesture]; |
| 76 | 88 | } |
| 89 | + UIImageView *giftBottomView = [[UIImageView alloc] initWithFrame:CGRectMake(0, self.height - GiftPayViewHeight, self.width, GiftPayViewHeight)]; | |
| 90 | + giftBottomView.image = [UIImage imageNamed:@"背景400x30"]; | |
| 91 | + giftBottomView.alpha = 0.4; | |
| 92 | + [self addSubview:giftBottomView]; | |
| 93 | + | |
| 94 | + GiftPayButton *payBtn = [[GiftPayButton alloc] initWithFrame:CGRectMake(10, self.height - GiftPayViewHeight, 80, GiftPayViewHeight)]; | |
| 95 | + [payBtn addTarget:self action:@selector(payClick) forControlEvents:UIControlEventTouchUpInside]; | |
| 96 | + [self addSubview:payBtn]; | |
| 97 | + | |
| 98 | + UIButton *sendBtn = [[UIButton alloc] initWithFrame:CGRectMake(self.width - 70, self.height - GiftPayViewHeight + (GiftPayViewHeight - 30)*0.5, 60, 30)]; | |
| 99 | + [sendBtn addTarget:self action:@selector(sendClick) forControlEvents:UIControlEventTouchUpInside]; | |
| 100 | + [sendBtn setTitle:@"发送" forState:UIControlStateNormal]; | |
| 101 | + [sendBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal | |
| 102 | + ]; | |
| 103 | + [sendBtn setBackgroundColor:[UIColor orangeColor]]; | |
| 104 | + sendBtn.layer.cornerRadius = sendBtn.height * 0.5; | |
| 105 | + sendBtn.layer.masksToBounds = YES; | |
| 106 | + [self addSubview:sendBtn]; | |
| 77 | 107 | } |
| 78 | 108 | return self; |
| 79 | 109 | } |
| 80 | 110 | |
| 111 | +- (void)sendClick | |
| 112 | +{ | |
| 113 | + NSLog(@"sendClick"); | |
| 114 | +} | |
| 115 | + | |
| 116 | +- (void)payClick | |
| 117 | +{ | |
| 118 | + NSLog(@"payClick"); | |
| 119 | +} | |
| 120 | + | |
| 81 | 121 | - (UIView *)giftViewWithFrame:(CGRect)frame model:(GiftModel *)model |
| 82 | 122 | { |
| 83 | 123 | _model = model; |
| 84 | 124 | UIView *giftView = [[UIView alloc] initWithFrame:frame]; |
| 85 | 125 | if (model.giftStyle == GiftStyleCombo) |
| 86 | - { | |
| 126 | + {//右上角连击标识 | |
| 87 | 127 | UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(giftView.width - 17, 3, 15, 15)]; |
| 88 | - imageView.backgroundColor = ZXRandomColor; | |
| 128 | + imageView.image = [UIImage imageNamed:@"continuous"]; | |
| 89 | 129 | [giftView addSubview:imageView]; |
| 90 | - }else | |
| 91 | - { | |
| 92 | - | |
| 93 | 130 | } |
| 131 | + //礼物价格lbl | |
| 94 | 132 | UILabel *priceLbl = [[UILabel alloc] initWithFrame:CGRectMake(0, giftView.height - 15, 40, 14)]; |
| 95 | 133 | priceLbl.font = [UIFont systemFontOfSize:kDetailContentFont]; |
| 96 | 134 | priceLbl.textColor = [UIColor greenColor]; |
| ... | ... | @@ -99,8 +137,8 @@ |
| 99 | 137 | priceLbl.height = [priceLbl labelSize].height; |
| 100 | 138 | priceLbl.centerX = giftView.width * 0.5 - 4; |
| 101 | 139 | [giftView addSubview:priceLbl]; |
| 102 | - | |
| 103 | - UIImageView *image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"littleHeart2"]]; | |
| 140 | + //礼物价格图标 | |
| 141 | + UIImageView *image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"diamond"]]; | |
| 104 | 142 | image.left = priceLbl.right + 3; |
| 105 | 143 | image.centerY = priceLbl.centerY; |
| 106 | 144 | [giftView addSubview:image]; |
| ... | ... | @@ -114,7 +152,26 @@ |
| 114 | 152 | NSInteger tag = gesture.view.tag - 10; |
| 115 | 153 | NSLog(@"%zd",tag); |
| 116 | 154 | //右上角添加✔️,再次点击去掉✔️ |
| 117 | - [self.animQueueManager addAnimationWithModel:self.giftArray[tag] animContentView:self.liveBaseView]; | |
| 155 | + GiftModel *model = self.giftArray[tag]; | |
| 156 | + if (model.giftStyle == GiftStyleCombo) { | |
| 157 | + | |
| 158 | + [self.animQueueManager addAnimationWithModel:self.giftArray[tag] animContentView:(UIView *)self.liveBaseView.presentView]; | |
| 159 | + }else | |
| 160 | + { | |
| 161 | + [self.animQueueManager addAnimationWithModel:self.giftArray[tag] animContentView:self.liveBaseView]; | |
| 162 | + } | |
| 163 | +} | |
| 164 | + | |
| 165 | +- (NSString *)giftNameWithImageName:(NSString *)imageName | |
| 166 | +{ | |
| 167 | + NSString *giftName = @""; | |
| 168 | + | |
| 169 | + if ([_images containsObject:imageName]) { | |
| 170 | + NSInteger index = [_images indexOfObject:imageName]; | |
| 171 | + giftName = [_giftNames objectAtIndex:index]; | |
| 172 | + } | |
| 173 | + | |
| 174 | + return giftName; | |
| 118 | 175 | } |
| 119 | 176 | |
| 120 | 177 | #pragma mark - getter |
| ... | ... | @@ -123,39 +180,37 @@ |
| 123 | 180 | { |
| 124 | 181 | if (!_giftArray) |
| 125 | 182 | { |
| 126 | - NSArray *images = [NSArray arrayWithObjects:@"love",@"love",@"love",@"love",@"love",@"love",@"love",@"love",@"love",@"love",nil]; | |
| 127 | - NSArray *types = [NSArray arrayWithObjects:@2,@3,@1,@1,@1,@1,@1,@1,@1,@1, nil]; | |
| 128 | - NSArray *prices = [NSArray arrayWithObjects:@"300000000",@"3000",@"300000",@"30",@"3",@"3",@"1",@"3",@"1",@"3", nil]; | |
| 129 | - | |
| 183 | + NSArray *senders = [NSArray arrayWithObjects:@"张三",@"龙的传人",@"李四",@"王五",@"宋刘",@"老七",@"老八",@"老九",@"老十",@"老师",@"小十七",@"小十八",@"小十九", nil]; | |
| 130 | 184 | NSMutableArray *tempArr = [NSMutableArray array]; |
| 131 | - for (int i = 0; i < images.count; i ++) { | |
| 132 | - GiftModel *model = [GiftModel new]; | |
| 133 | - model.giftname = @"鲜花"; | |
| 134 | - model.giftIconArray = @[[UIImage imageNamed:@"love"]]; | |
| 135 | - model.giftNum = @"5"; | |
| 136 | - model.giftRusername = @"啊啊啊啊啊啊啊啊啊啊啊啊"; | |
| 137 | - model.giftRuserId = @"10000"; | |
| 138 | - model.giftGusername = @"按时大多数阿萨德 爱傻傻的爱的"; | |
| 139 | - model.giftGuserId = @"20000"; | |
| 140 | - model.image = images[i]; | |
| 141 | - int type = [types[i] intValue]; | |
| 185 | + for (int i = 0; i < _images.count; i ++) { | |
| 186 | + | |
| 187 | + int type = [_types[i] intValue]; | |
| 142 | 188 | if (type == 1) { |
| 143 | - model.giftStyle = GiftStyleCombo; | |
| 144 | - }else if (type == 2) | |
| 145 | - { | |
| 146 | - model.giftStyle = GiftStylePorsch; | |
| 147 | - } | |
| 148 | -// else if (type == 3) | |
| 149 | -// { | |
| 150 | -// model.giftStyle = GiftStyleFighter; | |
| 151 | -// } | |
| 152 | - else if (type == 3) | |
| 153 | - { | |
| 154 | - model.giftStyle = GiftStylePlane; | |
| 155 | - } | |
| 189 | + //combo | |
| 190 | + GiftModel *model1 = [GiftModel modelWithSender:senders[i] giftName:[self giftNameWithImageName:_images[i]] icon:@"love" giftImageName:_images[i]]; | |
| 191 | + model1.giftStyle = GiftStyleCombo; | |
| 192 | + model1.price = _prices[i]; | |
| 193 | + [tempArr addObject:model1]; | |
| 194 | + | |
| 195 | + }else | |
| 196 | + {//expen | |
| 197 | + GiftModel *model = [GiftModel modelWithSender:senders[i] giftName:[self giftNameWithImageName:_images[i]] icon:@"love" giftImageName:@""]; | |
| 156 | 198 | |
| 157 | - model.price = prices[i]; | |
| 158 | - [tempArr addObject:model]; | |
| 199 | + if (type == 2) { | |
| 200 | + model.giftStyle = GiftStylePorsch; | |
| 201 | + model.giftImageName = @"porsch_small80"; | |
| 202 | + } | |
| 203 | + if (type == 3) { | |
| 204 | + model.giftStyle = GiftStyleFighter; | |
| 205 | + model.giftImageName = @"fighter_small80"; | |
| 206 | + } | |
| 207 | + if (type == 4) { | |
| 208 | + model.giftStyle = GiftStylePlane; | |
| 209 | + model.giftImageName = @"plane_small80"; | |
| 210 | + } | |
| 211 | + model.price = _prices[i]; | |
| 212 | + [tempArr addObject:model]; | |
| 213 | + } | |
| 159 | 214 | } |
| 160 | 215 | _giftArray = [[NSArray alloc] initWithArray:tempArr]; |
| 161 | 216 | } | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftViews/GiftModelView.m deleted
100644 → 0
| 1 | -// | |
| 2 | -// GiftModelView.m | |
| 3 | -// LiveVideoCloud | |
| 4 | -// | |
| 5 | -// Created by 张旭 on 2017/3/14. | |
| 6 | -// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | -// | |
| 8 | - | |
| 9 | -#import "GiftModelView.h" | |
| 10 | -#import "GiftModel.h" | |
| 11 | - | |
| 12 | -@implementation GiftModelView | |
| 13 | - | |
| 14 | -//+ (instancetype)giftViewWithModel:(GiftModel *)giftModel | |
| 15 | -//{ | |
| 16 | -// GiftModelView *view = [[GiftModelView alloc] init]; | |
| 17 | -// view | |
| 18 | -// return ; | |
| 19 | -//} | |
| 20 | - | |
| 21 | -/* | |
| 22 | -// Only override drawRect: if you perform custom drawing. | |
| 23 | -// An empty implementation adversely affects performance during animation. | |
| 24 | -- (void)drawRect:(CGRect)rect { | |
| 25 | - // Drawing code | |
| 26 | -} | |
| 27 | -*/ | |
| 28 | - | |
| 29 | -@end |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftViews/GiftPayButton.h
0 → 100644
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftViews/GiftPayButton.m
0 → 100644
| 1 | +// | |
| 2 | +// GiftPayButton.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by 张旭 on 2017/3/20. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "GiftPayButton.h" | |
| 10 | + | |
| 11 | +@implementation GiftPayButton | |
| 12 | + | |
| 13 | +- (void)layoutSubviews | |
| 14 | +{ | |
| 15 | + [super layoutSubviews]; | |
| 16 | + | |
| 17 | + [self setTitle:@"充值 10" forState:UIControlStateNormal]; | |
| 18 | + self.titleLabel.textAlignment = NSTextAlignmentLeft; | |
| 19 | + self.titleLabel.font = [UIFont systemFontOfSize:kContentFont]; | |
| 20 | + [self setTitleColor:[UIColor yellowColor] forState:UIControlStateNormal]; | |
| 21 | + [self setImage:[UIImage imageNamed:@"diamond"] forState:UIControlStateNormal]; | |
| 22 | + [self setImage:[UIImage imageNamed:@"diamond"] forState:UIControlStateHighlighted]; | |
| 23 | + | |
| 24 | + self.titleLabel.left = 0; | |
| 25 | + self.titleLabel.top = 0; | |
| 26 | + self.titleLabel.width = self.width - 20; | |
| 27 | + self.titleLabel.height = self.height; | |
| 28 | + | |
| 29 | + self.imageView.height = 10; | |
| 30 | + self.imageView.width = 13; | |
| 31 | + self.imageView.left = self.width - 25; | |
| 32 | + self.imageView.centerY = self.titleLabel.centerY; | |
| 33 | +} | |
| 34 | + | |
| 35 | +/* | |
| 36 | +// Only override drawRect: if you perform custom drawing. | |
| 37 | +// An empty implementation adversely affects performance during animation. | |
| 38 | +- (void)drawRect:(CGRect)rect { | |
| 39 | + // Drawing code | |
| 40 | +} | |
| 41 | +*/ | |
| 42 | + | |
| 43 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/GiftViews/GiftModelView.h renamed to LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/Present/ComboCell.h
| 1 | 1 | // |
| 2 | -// GiftModelView.h | |
| 2 | +// ComboCell.h | |
| 3 | 3 | // LiveVideoCloud |
| 4 | 4 | // |
| 5 | -// Created by 张旭 on 2017/3/14. | |
| 5 | +// Created by 张旭 on 2017/3/17. | |
| 6 | 6 | // Copyright © 2017年 cnlive. All rights reserved. |
| 7 | 7 | // |
| 8 | 8 | |
| 9 | -#import "BaseView.h" | |
| 10 | - | |
| 9 | +#import "PresentViewCell.h" | |
| 11 | 10 | @class GiftModel; |
| 12 | -@interface GiftModelView : BaseView | |
| 13 | 11 | |
| 14 | -+ (instancetype)giftViewWithModel:(GiftModel *)giftModel; | |
| 12 | +@interface ComboCell : PresentViewCell | |
| 13 | + | |
| 14 | +@property (nonatomic ,strong) GiftModel * _Nullable model; | |
| 15 | 15 | @end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/Present/ComboCell.m
0 → 100644
| 1 | +// | |
| 2 | +// ComboCell.m | |
| 3 | +// LiveVideoCloud | |
| 4 | +// | |
| 5 | +// Created by 张旭 on 2017/3/17. | |
| 6 | +// Copyright © 2017年 cnlive. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "ComboCell.h" | |
| 10 | +#import "GiftModel.h" | |
| 11 | + | |
| 12 | +@interface ComboCell () | |
| 13 | + | |
| 14 | +@property (nonatomic ,strong) UIView * _Nullable bgView; | |
| 15 | +@property (nonatomic ,strong) UIImageView * _Nullable icon; | |
| 16 | +@property (nonatomic ,strong) UILabel * _Nullable senderNameLbl; | |
| 17 | +@property (nonatomic ,strong) UILabel * _Nullable giftNameLbl; | |
| 18 | +@property (nonatomic ,strong) UIImageView * _Nullable giftImage; | |
| 19 | + | |
| 20 | +@end | |
| 21 | + | |
| 22 | +@implementation ComboCell | |
| 23 | + | |
| 24 | +- (instancetype)initWithRow:(NSInteger)row | |
| 25 | +{ | |
| 26 | + if (self = [super initWithRow:row]) { | |
| 27 | + | |
| 28 | + [self addSubview:self.bgView]; | |
| 29 | + [self addSubview:self.icon]; | |
| 30 | + [self addSubview:self.senderNameLbl]; | |
| 31 | + [self addSubview:self.giftNameLbl]; | |
| 32 | + [self addSubview:self.giftImage]; | |
| 33 | + } | |
| 34 | + return self; | |
| 35 | +} | |
| 36 | + | |
| 37 | +- (void)setModel:(GiftModel *)model | |
| 38 | +{ | |
| 39 | + _model = model; | |
| 40 | + self.icon.image = [UIImage imageNamed:model.icon]; | |
| 41 | + self.senderNameLbl.text = model.sender; | |
| 42 | + self.giftNameLbl.text = [NSString stringWithFormat:@"送一个%@",model.giftName]; | |
| 43 | + self.senderNameLbl.size = [self.senderNameLbl labelSize]; | |
| 44 | + self.giftNameLbl.size = [self.giftNameLbl labelSize]; | |
| 45 | + self.bgView.frame = CGRectMake(0, 0, self.width, self.height); | |
| 46 | + self.bgView.layer.cornerRadius = self.height * 0.5; | |
| 47 | + self.giftImage.frame = CGRectMake(self.width - self.height, 0, self.height, self.height); | |
| 48 | + self.giftImage.image = [UIImage imageNamed:model.giftImageName]; | |
| 49 | +} | |
| 50 | + | |
| 51 | +//自定义cell的展示动画 | |
| 52 | +- (void)customDisplayAnimationOfShowShakeAnimation:(BOOL)flag | |
| 53 | +{ | |
| 54 | + //这里是直接使用父类中的动画,如果用户想自定义可这里实现动画,不调用父类的方法(这个方法在UIView动画的animations回调中执行) | |
| 55 | + [super customDisplayAnimationOfShowShakeAnimation:flag]; | |
| 56 | +} | |
| 57 | + | |
| 58 | +//自定义cell的隐藏动画 | |
| 59 | +- (void)customHideAnimationOfShowShakeAnimation:(BOOL)flag | |
| 60 | +{ | |
| 61 | + [super customHideAnimationOfShowShakeAnimation:flag]; | |
| 62 | +} | |
| 63 | + | |
| 64 | +#pragma mark - getter | |
| 65 | +- (UILabel *)senderNameLbl | |
| 66 | +{ | |
| 67 | + if (!_senderNameLbl) | |
| 68 | + { | |
| 69 | + _senderNameLbl = [[UILabel alloc] initWithFrame:CGRectMake(self.icon.right + 5, 0, 100, 20)]; | |
| 70 | + _senderNameLbl.font = [UIFont systemFontOfSize:kContentFont]; | |
| 71 | + _senderNameLbl.textColor = [UIColor blackColor]; | |
| 72 | + } | |
| 73 | + return _senderNameLbl; | |
| 74 | +} | |
| 75 | + | |
| 76 | +- (UILabel *)giftNameLbl | |
| 77 | +{ | |
| 78 | + if (!_giftNameLbl) | |
| 79 | + { | |
| 80 | + _giftNameLbl = [[UILabel alloc] initWithFrame:CGRectMake(self.icon.right + 5, self.senderNameLbl.bottom , 100, 20)]; | |
| 81 | + _giftNameLbl.font = [UIFont systemFontOfSize:kContentFont]; | |
| 82 | + _giftNameLbl.textColor = [UIColor blackColor]; | |
| 83 | + } | |
| 84 | + return _giftNameLbl; | |
| 85 | +} | |
| 86 | + | |
| 87 | +- (UIImageView *)icon | |
| 88 | +{ | |
| 89 | + if (!_icon) | |
| 90 | + { | |
| 91 | + _icon = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 40, 40)]; | |
| 92 | + _icon.clipsToBounds = YES; | |
| 93 | + _icon.layer.cornerRadius = 20; | |
| 94 | + _icon.layer.borderWidth = 1; | |
| 95 | + _icon.layer.borderColor = [UIColor cyanColor].CGColor; | |
| 96 | + | |
| 97 | + } | |
| 98 | + return _icon; | |
| 99 | +} | |
| 100 | + | |
| 101 | +- (UIImageView *)giftImage | |
| 102 | +{ | |
| 103 | + if (!_giftImage) | |
| 104 | + { | |
| 105 | + _giftImage = [[UIImageView alloc] init]; | |
| 106 | + } | |
| 107 | + return _giftImage; | |
| 108 | +} | |
| 109 | + | |
| 110 | +- (UIView *)bgView | |
| 111 | +{ | |
| 112 | + if (!_bgView) | |
| 113 | + { | |
| 114 | + _bgView = [[UIView alloc] init]; | |
| 115 | + _bgView.backgroundColor = [UIColor yellowColor]; | |
| 116 | + _bgView.clipsToBounds = YES; | |
| 117 | + } | |
| 118 | + return _bgView; | |
| 119 | +} | |
| 120 | + | |
| 121 | +/* | |
| 122 | +// Only override drawRect: if you perform custom drawing. | |
| 123 | +// An empty implementation adversely affects performance during animation. | |
| 124 | +- (void)drawRect:(CGRect)rect { | |
| 125 | + // Drawing code | |
| 126 | +} | |
| 127 | +*/ | |
| 128 | + | |
| 129 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/Present/PresentModelAble.h
0 → 100755
| 1 | +// | |
| 2 | +// PresentModelAble.h | |
| 3 | +// PresentDemo | |
| 4 | +// | |
| 5 | +// Created by 张旭 on 2017/3/17. | |
| 6 | +// Copyright © 2017年 张旭. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <Foundation/Foundation.h> | |
| 10 | + | |
| 11 | +// 日志 | |
| 12 | + | |
| 13 | +#ifdef DEBUG | |
| 14 | + | |
| 15 | +#ifndef DebugLog | |
| 16 | +#define DebugLog(fmt, ...) NSLog((@"[%s Line %d]" fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__) | |
| 17 | +#endif | |
| 18 | + | |
| 19 | +#else | |
| 20 | + | |
| 21 | +#ifndef DebugLog | |
| 22 | +#define DebugLog(fmt, ...) | |
| 23 | +#endif | |
| 24 | + | |
| 25 | +#define NSLog | |
| 26 | + | |
| 27 | + | |
| 28 | +#endif | |
| 29 | + | |
| 30 | +/** | |
| 31 | + * 礼物模型必须遵守的协议 | |
| 32 | + */ | |
| 33 | +@protocol PresentModelAble <NSObject> | |
| 34 | + | |
| 35 | +@required | |
| 36 | +/** | |
| 37 | + * 发送者 | |
| 38 | + */ | |
| 39 | +@property (copy, nonatomic) NSString *sender; | |
| 40 | +/** | |
| 41 | + * 礼物名(或礼物编号) | |
| 42 | + */ | |
| 43 | +@property (copy, nonatomic) NSString *giftName; | |
| 44 | + | |
| 45 | +@optional | |
| 46 | + | |
| 47 | +/** | |
| 48 | + 需要展示的礼物连乘数 默认为0 | |
| 49 | + | |
| 50 | + @discussion 用于解决当前礼物消息消息展示到一半时,新加入到聊天室的人看到的礼物消息不是从1开始,如果要使用,消息体中必须包含当前礼物个数 | |
| 51 | + */ | |
| 52 | +@property (assign, nonatomic) NSInteger giftNumber; | |
| 53 | + | |
| 54 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/Present/PresentView.h
0 → 100755
| 1 | +// | |
| 2 | +// PresentView.h | |
| 3 | +// PresentDemo | |
| 4 | +// | |
| 5 | +// Created by 张旭 on 2017/3/17. | |
| 6 | +// Copyright © 2017年 张旭. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | +#import "PresentViewCell.h" | |
| 11 | + | |
| 12 | +@protocol PresentViewDelegate; | |
| 13 | + | |
| 14 | +@interface PresentView : UIView | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * cell高度(默认40) | |
| 18 | + */ | |
| 19 | +@property (assign, nonatomic) CGFloat cellHeight; | |
| 20 | +/** | |
| 21 | + * 礼物动画展示时间(默认3秒) | |
| 22 | + */ | |
| 23 | +@property (assign, nonatomic)NSTimeInterval showTime; | |
| 24 | +/** | |
| 25 | + * 轨道总数 | |
| 26 | + */ | |
| 27 | +@property (assign, nonatomic, readonly) NSInteger rows; | |
| 28 | +@property (weak, nonatomic) id<PresentViewDelegate> delegate; | |
| 29 | +/** | |
| 30 | + * 获取对应轨道上的cell | |
| 31 | + */ | |
| 32 | +- (__kindof PresentViewCell *)cellForRowAtIndex:(NSUInteger)index; | |
| 33 | +/** | |
| 34 | + * 插入送礼消息 | |
| 35 | + * | |
| 36 | + * @param models 礼物模型数组中的模型必须遵守PresentModelAble协议 | |
| 37 | + * @param flag 是否需要连乘动画 | |
| 38 | + */ | |
| 39 | +- (void)insertPresentMessages:(NSArray<id <PresentModelAble>> *)models showShakeAnimation:(BOOL)flag; | |
| 40 | +/** | |
| 41 | + 释放相关引用变量 | |
| 42 | + */ | |
| 43 | +- (void)releaseVariable; | |
| 44 | + | |
| 45 | +@end | |
| 46 | + | |
| 47 | +@protocol PresentViewDelegate <NSObject> | |
| 48 | + | |
| 49 | +@required | |
| 50 | +/** | |
| 51 | + * 返回自定义cell样式 | |
| 52 | + */ | |
| 53 | +- (PresentViewCell *)presentView:(PresentView *)presentView cellOfRow:(NSInteger)row; | |
| 54 | +/** | |
| 55 | + * 礼物动画即将展示的时调用,根据礼物消息类型为自定义的cell设置对应的模型数据用于展示 | |
| 56 | + * | |
| 57 | + * @param cell 用来展示动画的cell | |
| 58 | + * @param model 礼物模型 | |
| 59 | + */ | |
| 60 | +- (void)presentView:(PresentView *)presentView | |
| 61 | + configCell:(PresentViewCell *)cell | |
| 62 | + model:(id<PresentModelAble>)model; | |
| 63 | + | |
| 64 | +@optional | |
| 65 | + | |
| 66 | +/** | |
| 67 | + * cell点击事件 | |
| 68 | + */ | |
| 69 | +- (void)presentView:(PresentView *)presentView didSelectedCellOfRowAtIndex:(NSUInteger)index; | |
| 70 | + | |
| 71 | +/** | |
| 72 | + 一组连乘动画执行完成回调 | |
| 73 | + */ | |
| 74 | +- (void)presentView:(PresentView *)presentView animationCompleted:(NSInteger)shakeNumber model:(id<PresentModelAble>)model; | |
| 75 | + | |
| 76 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/Present/PresentView.m
0 → 100755
| 1 | +// | |
| 2 | +// PresentView.m | |
| 3 | +// PresentDemo | |
| 4 | +// | |
| 5 | +// Created by 张旭 on 2017/3/17. | |
| 6 | +// Copyright © 2017年 张旭. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "PresentView.h" | |
| 10 | + | |
| 11 | +#define Margin 20 | |
| 12 | + | |
| 13 | +@interface PresentView ()<PresentViewCellDelegate> | |
| 14 | + | |
| 15 | +/** | |
| 16 | + * 带连乘动画的消息缓存数组 | |
| 17 | + */ | |
| 18 | +@property (strong, nonatomic) NSMutableArray *dataCaches; | |
| 19 | +/** | |
| 20 | + * 不带连乘动画的消息缓存数组 | |
| 21 | + */ | |
| 22 | +@property (strong, nonatomic)NSMutableArray *nonshakeDataCaches; | |
| 23 | +/** | |
| 24 | + * 记录presentView上的cell | |
| 25 | + */ | |
| 26 | +@property (strong, nonatomic) NSMutableArray *showCells; | |
| 27 | + | |
| 28 | +@end | |
| 29 | + | |
| 30 | +@implementation PresentView | |
| 31 | + | |
| 32 | +#pragma mark - Setter/Getter | |
| 33 | + | |
| 34 | +- (void)setCellHeight:(CGFloat)cellHeight | |
| 35 | +{ | |
| 36 | + _cellHeight = cellHeight; | |
| 37 | + | |
| 38 | + [self setNeedsDisplay]; | |
| 39 | +} | |
| 40 | + | |
| 41 | +- (NSMutableArray *)dataCaches | |
| 42 | +{ | |
| 43 | + if (!_dataCaches) { | |
| 44 | + _dataCaches = [NSMutableArray array]; | |
| 45 | + } | |
| 46 | + return _dataCaches; | |
| 47 | +} | |
| 48 | + | |
| 49 | +- (NSMutableArray *)nonshakeDataCaches | |
| 50 | +{ | |
| 51 | + if (!_nonshakeDataCaches) { | |
| 52 | + _nonshakeDataCaches = [NSMutableArray array]; | |
| 53 | + } | |
| 54 | + return _nonshakeDataCaches; | |
| 55 | +} | |
| 56 | + | |
| 57 | +- (NSMutableArray *)showCells | |
| 58 | +{ | |
| 59 | + if (!_showCells) { | |
| 60 | + _showCells = [NSMutableArray array]; | |
| 61 | + } | |
| 62 | + return _showCells; | |
| 63 | +} | |
| 64 | + | |
| 65 | +#pragma mark - Initial | |
| 66 | + | |
| 67 | +- (instancetype)init | |
| 68 | +{ | |
| 69 | + if (self = [super init]) { | |
| 70 | + self.userInteractionEnabled = NO; | |
| 71 | + } | |
| 72 | + return self; | |
| 73 | +} | |
| 74 | + | |
| 75 | +- (void)awakeFromNib | |
| 76 | +{ | |
| 77 | + [super awakeFromNib]; | |
| 78 | + | |
| 79 | + self.userInteractionEnabled = NO; | |
| 80 | +} | |
| 81 | + | |
| 82 | +- (void)drawRect:(CGRect)rect | |
| 83 | +{ | |
| 84 | + [super drawRect:rect]; | |
| 85 | + | |
| 86 | + //初始值 | |
| 87 | + self.showTime = 3; | |
| 88 | + | |
| 89 | + //添加cell | |
| 90 | + self.cellHeight = self.cellHeight ? self.cellHeight : 40; | |
| 91 | + _rows = (int)floor(rect.size.height / (self.cellHeight + Margin)); | |
| 92 | + CGFloat inset = rect.size.height - (self.cellHeight + Margin) * _rows + Margin; | |
| 93 | + inset = MAX(0, inset) * 0.5; | |
| 94 | + for (int index = 0; index < _rows; index++) { | |
| 95 | + CGFloat w = rect.size.width; | |
| 96 | + CGFloat y = inset + (self.cellHeight + Margin) * index; | |
| 97 | + CGFloat x = -w; | |
| 98 | + PresentViewCell *cell = [self.delegate presentView:self cellOfRow:index]; | |
| 99 | + cell.frame = CGRectMake(x, y, w, self.cellHeight); | |
| 100 | + cell.delegate = self; | |
| 101 | + [self addSubview:cell]; | |
| 102 | + [self.showCells addObject:cell]; | |
| 103 | + } | |
| 104 | +} | |
| 105 | + | |
| 106 | +- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event | |
| 107 | +{ | |
| 108 | + UITouch *touch = touches.anyObject; | |
| 109 | + CGPoint point = [touch locationInView:self]; | |
| 110 | + for (int index = 0; index < self.showCells.count; index++) { | |
| 111 | + PresentViewCell *cell = self.showCells[index]; | |
| 112 | + if (CGRectContainsPoint(cell.frame, point)) { | |
| 113 | + if ([self.delegate respondsToSelector:@selector(presentView:didSelectedCellOfRowAtIndex:)]) { | |
| 114 | + [self.delegate presentView:self didSelectedCellOfRowAtIndex:index]; | |
| 115 | + } | |
| 116 | + break; | |
| 117 | + } | |
| 118 | + } | |
| 119 | +} | |
| 120 | + | |
| 121 | +#pragma mark - Private | |
| 122 | + | |
| 123 | +//问题一:如果展示动画还在执行,就收到了新的连乘动画消息,这时会判定为去执行连乘动画,因为展示动画还没有执行完成,所以连乘lable还没有被创建,所以会导致连乘动画会消失 | |
| 124 | +//解决办法:等连展示动画执行完成了,才能开始连乘动画,否则连乘动画消息就被缓存 | |
| 125 | + | |
| 126 | +//问题二:点击礼物4,等礼物4快要消失的时候,点击礼物1。会出现两个礼物1,并且下面的cell不会消失,导致礼物1的消息都会被缓存起来 | |
| 127 | +//问题原因:当礼物4将要隐藏时,这时接收到礼物1的消息,就会利用空闲的cell来展示礼物1,但这是没有马上删除礼物1的缓存,而是等到礼物1展示完成才删除的,所以礼物4展示完成就会检测缓存,这时礼物1并没有被删除,所以这里又会展示礼物1,这就导致了礼物一被展示了两次 | |
| 128 | +//解决办法:当礼物4执行完成了,去取缓存的时候,如果取到了缓存,还需要判断这个缓存当前有没有在展示,如果在展示就不做处理,如果没有在展示就利用当前的cell去展示它 | |
| 129 | + | |
| 130 | +//问题三:连续快速点击礼物1,会分两次动画展示 | |
| 131 | +//问题原因:因为两次送的礼物相同,如果快速点击,会发生用于展示第一个礼物的cell还处在AnimationStateShowing状态时,就收到第二个礼物,这个是时候的逻辑处理是将第二个消息缓存了起来(为了解决上述的问题一) | |
| 132 | + | |
| 133 | +/** | |
| 134 | + * 插入带连乘动画的消息 | |
| 135 | + */ | |
| 136 | +- (void)insertShowShakeAnimationMessages:(NSArray<id<PresentModelAble>> *)models | |
| 137 | +{ | |
| 138 | + for (int index = 0; index < models.count; index++) { | |
| 139 | + id<PresentModelAble> obj = models[index]; | |
| 140 | + PresentViewCell *cell = [self examinePresentingCell:obj]; | |
| 141 | + if (cell) { | |
| 142 | + if (cell.state == AnimationStateShowing) { | |
| 143 | + //在执行展示动画期间如果收到了连乘动画礼物消息,就将消息缓存 | |
| 144 | + [self.dataCaches addObject:obj]; | |
| 145 | + }else { | |
| 146 | + if ([obj giftNumber] > 0) { | |
| 147 | + [cell shakeAnimationWithModels:@[obj]]; | |
| 148 | + } else { | |
| 149 | + [cell shakeAnimationWithNumber:1]; | |
| 150 | + } | |
| 151 | + } | |
| 152 | + }else { | |
| 153 | + [self.dataCaches addObject:obj];//将当前消息加到缓存中 | |
| 154 | + NSArray *cells = [self examinePresentViewCells]; | |
| 155 | + if (cells.count) { | |
| 156 | + cell = cells.firstObject; | |
| 157 | + //设置后,再次展示的动画才会生效 | |
| 158 | + cell.showTime = self.showTime; | |
| 159 | + __weak typeof(self) ws = self; | |
| 160 | + [cell showAnimationWithModel:obj showShakeAnimation:YES prepare:^{ | |
| 161 | + if ([ws.delegate respondsToSelector:@selector(presentView:configCell:model:)]) { | |
| 162 | + [ws.delegate presentView:ws configCell:cell model:obj]; | |
| 163 | + } | |
| 164 | + } completion:^(BOOL flag) { | |
| 165 | + if (flag) { | |
| 166 | + //如果相同礼物类型的消息缓存在执行展示动画之前就删除了,这就会造成在cell执行展示动画期间收到的相同类型的消息会被缓存到下一个cell中展示 | |
| 167 | + if ([obj giftNumber] > 0) { | |
| 168 | + [cell shakeAnimationWithModels:[self subarrayWithObj:obj]]; | |
| 169 | + }else { | |
| 170 | + [cell shakeAnimationWithNumber:[self subarrayWithObj:obj].count]; | |
| 171 | + } | |
| 172 | + } | |
| 173 | + }]; | |
| 174 | + } | |
| 175 | + } | |
| 176 | + } | |
| 177 | +} | |
| 178 | + | |
| 179 | +/** | |
| 180 | + * 插入不带连城动画的消息 | |
| 181 | + */ | |
| 182 | +- (void)insertNonshakeAnimationMessages:(NSArray<id<PresentModelAble>> *)models | |
| 183 | +{ | |
| 184 | + if (models) { | |
| 185 | + [self.nonshakeDataCaches addObjectsFromArray:models]; | |
| 186 | + } | |
| 187 | + NSArray *freeCells = [self examinePresentViewCells]; | |
| 188 | + if (self.nonshakeDataCaches.count > 0 && freeCells.count > 0) { | |
| 189 | + id<PresentModelAble> obj = self.nonshakeDataCaches.firstObject; | |
| 190 | + [self.nonshakeDataCaches removeObjectAtIndex:0]; | |
| 191 | + PresentViewCell *cell = freeCells.firstObject; | |
| 192 | + cell.showTime = self.showTime; | |
| 193 | + __weak typeof(self) ws = self; | |
| 194 | + [cell showAnimationWithModel:obj showShakeAnimation:NO prepare:^{ | |
| 195 | + if ([ws.delegate respondsToSelector:@selector(presentView:configCell:model:)]) { | |
| 196 | + [ws.delegate presentView:ws configCell:cell model:obj]; | |
| 197 | + } | |
| 198 | + } completion:^(BOOL flag) { | |
| 199 | + if (!flag) { | |
| 200 | + [cell performSelector:@selector(hiddenAnimationOfShowShake:) withObject:@(NO) afterDelay:self.showTime]; | |
| 201 | + } | |
| 202 | + }]; | |
| 203 | + } | |
| 204 | +} | |
| 205 | + | |
| 206 | +/** | |
| 207 | + * 检测插入的消息模型 | |
| 208 | + */ | |
| 209 | +- (NSArray *)checkElementOfModels:(NSArray<id<PresentModelAble>> *)models | |
| 210 | +{ | |
| 211 | + NSMutableArray *siftArray = [NSMutableArray array]; | |
| 212 | + for (id obj in models) { | |
| 213 | + if (![obj conformsToProtocol:@protocol(PresentModelAble)]) { | |
| 214 | + DebugLog(@"%@对象没有遵守PresentModelAble协议", obj); | |
| 215 | + }else { | |
| 216 | + [siftArray addObject:obj]; | |
| 217 | + } | |
| 218 | + } | |
| 219 | + return siftArray; | |
| 220 | +} | |
| 221 | + | |
| 222 | +/** | |
| 223 | + * 检测当前是否有obj类型的礼物消息在展示 | |
| 224 | + */ | |
| 225 | +- (PresentViewCell *)examinePresentingCell:(id<PresentModelAble>)obj | |
| 226 | +{ | |
| 227 | + for (PresentViewCell *cell in self.showCells) { | |
| 228 | + if ([cell.sender isEqualToString:[obj sender]] && [cell.giftName isEqualToString:[obj giftName]]) { | |
| 229 | + //当前正在展示动画并且不是隐藏动画 | |
| 230 | + if (cell.state != AnimationStateNone && cell.state != AnimationStateHiding ) return cell; | |
| 231 | + } | |
| 232 | + } | |
| 233 | + return nil; | |
| 234 | +} | |
| 235 | + | |
| 236 | +/** | |
| 237 | + * 检测空闲cell | |
| 238 | + */ | |
| 239 | +- (NSArray<PresentViewCell *> *)examinePresentViewCells | |
| 240 | +{ | |
| 241 | + NSMutableArray *freeCells = [NSMutableArray array]; | |
| 242 | + for (PresentViewCell *cell in self.showCells) { | |
| 243 | + if (cell.state == AnimationStateNone) { | |
| 244 | + [freeCells addObject:cell]; | |
| 245 | + } | |
| 246 | + } | |
| 247 | + return freeCells; | |
| 248 | +} | |
| 249 | + | |
| 250 | +/** | |
| 251 | + * 从缓存中截取与obj类型相同的消息 | |
| 252 | + */ | |
| 253 | +- (NSArray<id<PresentModelAble>> *)subarrayWithObj:(id<PresentModelAble>)obj | |
| 254 | +{ | |
| 255 | + NSMutableArray *array = [NSMutableArray array]; | |
| 256 | + for (id<PresentModelAble> cache in self.dataCaches) { | |
| 257 | + if ([[cache sender] isEqualToString:[obj sender]] && [[cache giftName] isEqualToString:[obj giftName]]) { | |
| 258 | + [array addObject:cache]; | |
| 259 | + } | |
| 260 | + } | |
| 261 | + [self.dataCaches removeObjectsInArray:array];//取出的数据从缓存中移除 | |
| 262 | + return array; | |
| 263 | +} | |
| 264 | + | |
| 265 | +#pragma mark - Public | |
| 266 | + | |
| 267 | +- (void)insertPresentMessages:(NSArray<id<PresentModelAble>> *)models showShakeAnimation:(BOOL)flag | |
| 268 | +{ | |
| 269 | + NSArray *siftArray = [self checkElementOfModels:models]; | |
| 270 | + if (!siftArray.count) return; | |
| 271 | + if (flag) { | |
| 272 | + [self insertShowShakeAnimationMessages:siftArray]; | |
| 273 | + }else { | |
| 274 | + [self insertNonshakeAnimationMessages:siftArray]; | |
| 275 | + } | |
| 276 | +} | |
| 277 | + | |
| 278 | +- (PresentViewCell *)cellForRowAtIndex:(NSUInteger)index | |
| 279 | +{ | |
| 280 | + if (index < self.showCells.count) | |
| 281 | + { | |
| 282 | + return self.showCells[index]; | |
| 283 | + } | |
| 284 | + return nil; | |
| 285 | +} | |
| 286 | + | |
| 287 | +- (void)releaseVariable | |
| 288 | +{ | |
| 289 | + [self.dataCaches removeAllObjects]; | |
| 290 | + [self.nonshakeDataCaches removeAllObjects]; | |
| 291 | + [self.showCells makeObjectsPerformSelector:@selector(removeFromSuperview)]; | |
| 292 | + [self.showCells removeAllObjects]; | |
| 293 | +} | |
| 294 | + | |
| 295 | +#pragma mark - PresentViewCellDelegate | |
| 296 | + | |
| 297 | +- (void)presentViewCell:(PresentViewCell *)cell showShakeAnimation:(BOOL)flag shakeNumber:(NSInteger)number | |
| 298 | +{ | |
| 299 | + if ([self.delegate respondsToSelector:@selector(presentView:animationCompleted:model:)]) { | |
| 300 | + [self.delegate presentView:self animationCompleted:number model:cell.baseModel]; | |
| 301 | + } | |
| 302 | + if (self.dataCaches.count) { | |
| 303 | + id<PresentModelAble> obj = self.dataCaches.firstObject; | |
| 304 | + if (![self examinePresentingCell:obj]) { | |
| 305 | + //取到的缓存当前没有在展示 | |
| 306 | + __weak typeof(self) ws = self; | |
| 307 | + [cell showAnimationWithModel:obj showShakeAnimation:YES prepare:^{ | |
| 308 | + if ([ws.delegate respondsToSelector:@selector(presentView:configCell:model:)]) { | |
| 309 | + [ws.delegate presentView:ws configCell:cell model:obj]; | |
| 310 | + } | |
| 311 | + } completion:^(BOOL flag) { | |
| 312 | + if (flag) { | |
| 313 | + if ([obj giftNumber] > 0) { | |
| 314 | + [cell shakeAnimationWithModels:[self subarrayWithObj:obj]]; | |
| 315 | + }else { | |
| 316 | + [cell shakeAnimationWithNumber:[self subarrayWithObj:obj].count]; | |
| 317 | + } | |
| 318 | + } | |
| 319 | + }]; | |
| 320 | + } | |
| 321 | + }else if (self.nonshakeDataCaches.count) { | |
| 322 | + //带连乘的缓存优先处理 | |
| 323 | + [self insertNonshakeAnimationMessages:nil]; | |
| 324 | + }else { | |
| 325 | + [cell releaseVariable]; | |
| 326 | + } | |
| 327 | +} | |
| 328 | + | |
| 329 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/Present/PresentViewCell.h
0 → 100755
| 1 | +// | |
| 2 | +// PresentViewCell.h | |
| 3 | +// PresentDemo | |
| 4 | +// | |
| 5 | +// Created by 张旭 on 2017/3/17. | |
| 6 | +// Copyright © 2017年 张旭. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import <UIKit/UIKit.h> | |
| 10 | +#import "PresentModelAble.h" | |
| 11 | + | |
| 12 | +//动画状态 | |
| 13 | +typedef NS_ENUM(NSUInteger, AnimationState) { | |
| 14 | + AnimationStateNone = 0, | |
| 15 | + AnimationStateShowing, | |
| 16 | + AnimationStateShaking, | |
| 17 | + AnimationStateShaked, | |
| 18 | + AnimationStateHiding | |
| 19 | +}; | |
| 20 | + | |
| 21 | +@protocol PresentViewCellDelegate; | |
| 22 | + | |
| 23 | +@interface PresentViewCell : UIView | |
| 24 | + | |
| 25 | +@property (weak, nonatomic) id<PresentViewCellDelegate> delegate; | |
| 26 | +/** | |
| 27 | + * cell展示时间 | |
| 28 | + */ | |
| 29 | +@property (assign, nonatomic)NSTimeInterval showTime; | |
| 30 | +/** | |
| 31 | + * 轨道编号 | |
| 32 | + */ | |
| 33 | +@property (assign, nonatomic, readonly) NSInteger row; | |
| 34 | +/** | |
| 35 | + * cell当前的动画状态 | |
| 36 | + */ | |
| 37 | +@property (assign, nonatomic, readonly) AnimationState state; | |
| 38 | +/** | |
| 39 | + 礼物模型 | |
| 40 | + */ | |
| 41 | +@property (strong, nonatomic, readonly)id<PresentModelAble> baseModel; | |
| 42 | +/** | |
| 43 | + * 礼物发送者 | |
| 44 | + */ | |
| 45 | +@property (copy, nonatomic, readonly) NSString *sender; | |
| 46 | +/** | |
| 47 | + * 礼物名 | |
| 48 | + */ | |
| 49 | +@property (copy, nonatomic, readonly) NSString *giftName; | |
| 50 | + | |
| 51 | +- (instancetype)initWithRow:(NSInteger)row; | |
| 52 | +/** | |
| 53 | + * 显示cell动画 | |
| 54 | + * | |
| 55 | + * @param model 礼物模型 | |
| 56 | + * @param flag 是否带连乘动画 | |
| 57 | + * @param prepare 准备动画回调 | |
| 58 | + * @param completion 动画完成回调 | |
| 59 | + */ | |
| 60 | +- (void)showAnimationWithModel:(id<PresentModelAble> )model | |
| 61 | + showShakeAnimation:(BOOL)flag | |
| 62 | + prepare:(void (^)(void))prepare | |
| 63 | + completion:(void (^)(BOOL flag))completion; | |
| 64 | +/** | |
| 65 | + * 连乘动画 | |
| 66 | + * | |
| 67 | + * @param number 连乘次数 | |
| 68 | + */ | |
| 69 | +- (void)shakeAnimationWithNumber:(NSInteger)number; | |
| 70 | +/** | |
| 71 | + 连乘动画 | |
| 72 | + | |
| 73 | + @discussion 当礼物模型中拥有礼物个数时,才调用此接口 | |
| 74 | + @param model 礼物模型 | |
| 75 | + */ | |
| 76 | +- (void)shakeAnimationWithModels:(NSArray<id<PresentModelAble>> *)models; | |
| 77 | +/** | |
| 78 | + * 隐藏cell动画 | |
| 79 | + * | |
| 80 | + * @param flag 是否带有连城动画 | |
| 81 | + */ | |
| 82 | +- (void)hiddenAnimationOfShowShake:(BOOL)flag; | |
| 83 | +/** | |
| 84 | + * 释放引用变量 | |
| 85 | + */ | |
| 86 | +- (void)releaseVariable; | |
| 87 | + | |
| 88 | +@end | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | +//供子类重写的接口 | |
| 93 | +@interface PresentViewCell (OverWrite) | |
| 94 | + | |
| 95 | +/** | |
| 96 | + * 自定义展示动画 | |
| 97 | + * | |
| 98 | + * @param flag 是否带有连乘动画 | |
| 99 | + */ | |
| 100 | +- (void)customDisplayAnimationOfShowShakeAnimation:(BOOL)flag; | |
| 101 | +/** | |
| 102 | + * 自定义隐藏动画 | |
| 103 | + * | |
| 104 | + * @param flag 是否带有连乘动画 | |
| 105 | + */ | |
| 106 | +- (void)customHideAnimationOfShowShakeAnimation:(BOOL)flag; | |
| 107 | + | |
| 108 | +@end | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | +@interface PresentLable : UILabel | |
| 113 | + | |
| 114 | +/** | |
| 115 | + * 数字描边颜色 | |
| 116 | + */ | |
| 117 | +@property (strong, nonatomic) UIColor *borderColor; | |
| 118 | +/** | |
| 119 | + * 开始连乘动画 | |
| 120 | + * | |
| 121 | + * @param interval 动画时间 | |
| 122 | + * @param completion 动画完成回调 | |
| 123 | + */ | |
| 124 | +- (void)startAnimationDuration:(NSTimeInterval)interval | |
| 125 | + completion:(void (^)(BOOL finish))completion; | |
| 126 | + | |
| 127 | +@end | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | +@protocol PresentViewCellDelegate <NSObject> | |
| 132 | + | |
| 133 | +@optional | |
| 134 | +/** | |
| 135 | + * 一组动画组完成回调 | |
| 136 | + * | |
| 137 | + * @param flag 是否带连乘动画 | |
| 138 | + * @param number 最终连乘数,如果flag为NO number就为0 | |
| 139 | + */ | |
| 140 | +- (void)presentViewCell:(PresentViewCell *)cell | |
| 141 | + showShakeAnimation:(BOOL)flag | |
| 142 | + shakeNumber:(NSInteger)number; | |
| 143 | + | |
| 144 | +@end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/Gift/Present/PresentViewCell.m
0 → 100755
| 1 | +// | |
| 2 | +// PresentViewCell.m | |
| 3 | +// PresentDemo | |
| 4 | +// | |
| 5 | +// Created by 张旭 on 2017/3/17. | |
| 6 | +// Copyright © 2017年 张旭. All rights reserved. | |
| 7 | +// | |
| 8 | + | |
| 9 | +#import "PresentViewCell.h" | |
| 10 | + | |
| 11 | +#define Duration 0.3 | |
| 12 | + | |
| 13 | +@interface PresentViewCell () | |
| 14 | + | |
| 15 | +@property (weak, nonatomic) PresentLable *shakeLable; | |
| 16 | +/** | |
| 17 | + * 记录礼物连乘数 | |
| 18 | + */ | |
| 19 | +@property (assign, nonatomic) NSInteger number; | |
| 20 | +/** | |
| 21 | + * 记录cell最初始的frame(即开始展示动画前的frame) | |
| 22 | + */ | |
| 23 | +@property (assign, nonatomic) CGRect originalFrame; | |
| 24 | +/** | |
| 25 | + * shake动画的缓存数组 | |
| 26 | + */ | |
| 27 | +@property (strong, nonatomic) NSMutableArray *caches; | |
| 28 | +/** | |
| 29 | + shake动画模型的缓存数组 | |
| 30 | + */ | |
| 31 | +@property (strong, nonatomic) NSMutableArray *modelCaches; | |
| 32 | + | |
| 33 | +@end | |
| 34 | + | |
| 35 | +@implementation PresentViewCell | |
| 36 | + | |
| 37 | +#pragma mark - Setter/Getter | |
| 38 | + | |
| 39 | +- (NSMutableArray *)caches | |
| 40 | +{ | |
| 41 | + if (!_caches) { | |
| 42 | + _caches = [NSMutableArray array]; | |
| 43 | + } | |
| 44 | + return _caches; | |
| 45 | +} | |
| 46 | + | |
| 47 | +- (NSMutableArray *)modelCaches | |
| 48 | +{ | |
| 49 | + if (!_modelCaches) { | |
| 50 | + _modelCaches = [NSMutableArray array]; | |
| 51 | + } | |
| 52 | + return _modelCaches; | |
| 53 | +} | |
| 54 | + | |
| 55 | +#pragma mark - Initial | |
| 56 | + | |
| 57 | +- (instancetype)initWithRow:(NSInteger)row | |
| 58 | +{ | |
| 59 | + if (self = [super init]) { | |
| 60 | + _row = row; | |
| 61 | + _state = AnimationStateNone; | |
| 62 | + } | |
| 63 | + return self; | |
| 64 | +} | |
| 65 | + | |
| 66 | +#pragma mark - Private | |
| 67 | + | |
| 68 | +/** | |
| 69 | + * 添加连乘lable | |
| 70 | + */ | |
| 71 | +- (void)addShakeLable | |
| 72 | +{ | |
| 73 | + PresentLable *lable = [[PresentLable alloc] init]; | |
| 74 | + lable.backgroundColor = [UIColor clearColor]; | |
| 75 | + lable.borderColor = [UIColor yellowColor]; | |
| 76 | + lable.textColor = [UIColor greenColor]; | |
| 77 | + lable.font = [UIFont systemFontOfSize:17.0]; | |
| 78 | + lable.textAlignment = NSTextAlignmentCenter; | |
| 79 | + lable.alpha = 0.0; | |
| 80 | + CGFloat w = 60; | |
| 81 | + CGFloat h = 20; | |
| 82 | + CGFloat x = CGRectGetWidth(self.frame); | |
| 83 | + CGFloat y = - h * 0.5 + self.frame.size.height * 0.5; | |
| 84 | + lable.frame = CGRectMake(x, y, w, h); | |
| 85 | + self.shakeLable = lable; | |
| 86 | + [self addSubview:lable]; | |
| 87 | +} | |
| 88 | + | |
| 89 | +/** | |
| 90 | + * 开始连乘动画(利用递归实现连乘动画) | |
| 91 | + * | |
| 92 | + * @param number 连乘次数 | |
| 93 | + * @param block 当前number次连乘动画执行完成回调 | |
| 94 | + */ | |
| 95 | +- (void)startShakeAnimationWithNumber:(NSInteger)number completion:(void (^)(BOOL finished))block | |
| 96 | +{ | |
| 97 | + self.superview.userInteractionEnabled = YES; | |
| 98 | + _state = AnimationStateShaking; | |
| 99 | + self.shakeLable.text = [NSString stringWithFormat:@"X%ld", ++self.number]; | |
| 100 | + __weak typeof(self) ws = self; | |
| 101 | + [self.shakeLable startAnimationDuration:Duration completion:^(BOOL finish) { | |
| 102 | + if (number > 1) { | |
| 103 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |
| 104 | + [ws startShakeAnimationWithNumber:(number - 1) completion:block]; | |
| 105 | + }); | |
| 106 | + }else { | |
| 107 | + _state = AnimationStateShaked; | |
| 108 | + if (block) { | |
| 109 | + block(YES); | |
| 110 | + } | |
| 111 | + } | |
| 112 | + }]; | |
| 113 | +} | |
| 114 | + | |
| 115 | +#pragma mark - Public | |
| 116 | + | |
| 117 | +- (void)showAnimationWithModel:(id<PresentModelAble>)model showShakeAnimation:(BOOL)flag prepare:(void (^)(void))prepare completion:(void (^)(BOOL))completion | |
| 118 | +{ | |
| 119 | + _state = AnimationStateShowing; | |
| 120 | + _baseModel = model; | |
| 121 | + _sender = [model sender]; | |
| 122 | + _giftName = [model giftName]; | |
| 123 | + self.originalFrame = self.frame; | |
| 124 | + self.number = 0; | |
| 125 | + if (prepare) { | |
| 126 | + prepare(); | |
| 127 | + } | |
| 128 | + [UIView animateWithDuration:Duration delay:0 usingSpringWithDamping:1.0 initialSpringVelocity:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^{ | |
| 129 | + [self customDisplayAnimationOfShowShakeAnimation:flag]; | |
| 130 | + } completion:^(BOOL finished) { | |
| 131 | + if (flag) { | |
| 132 | + if (!self.shakeLable) { | |
| 133 | + [self addShakeLable]; | |
| 134 | + } | |
| 135 | + self.shakeLable.alpha = 1.0; | |
| 136 | + } | |
| 137 | + if (completion) { | |
| 138 | + completion(flag); | |
| 139 | + } | |
| 140 | + }]; | |
| 141 | +} | |
| 142 | + | |
| 143 | +- (void)shakeAnimationWithNumber:(NSInteger)number | |
| 144 | +{ | |
| 145 | + [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(hiddenAnimationOfShowShake:) object:@(YES)]; | |
| 146 | + [self performSelector:@selector(hiddenAnimationOfShowShake:) withObject:@(YES) afterDelay:self.showTime]; | |
| 147 | + if (number > 0) [self.caches addObject:@(number)]; | |
| 148 | + if (self.caches.count > 0 && _state != AnimationStateShaking) { | |
| 149 | + NSInteger cache = [self.caches.firstObject integerValue]; | |
| 150 | + [self.caches removeObjectAtIndex:0];//不能删除对象,因为可能有相同的对象 | |
| 151 | + __weak typeof(self) ws = self;// | |
| 152 | + [self startShakeAnimationWithNumber:cache completion:^(BOOL finished) { | |
| 153 | + [ws shakeAnimationWithNumber:-1];//传-1是为了缓存不被重复添加 | |
| 154 | + }]; | |
| 155 | + } | |
| 156 | +} | |
| 157 | + | |
| 158 | +- (void)shakeAnimationWithModels:(NSArray<id<PresentModelAble>> *)models | |
| 159 | +{ | |
| 160 | + [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(hiddenAnimationOfShowShake:) object:@(YES)]; | |
| 161 | + [self performSelector:@selector(hiddenAnimationOfShowShake:) withObject:@(YES) afterDelay:self.showTime]; | |
| 162 | + if (models.count > 0) [self.modelCaches addObjectsFromArray:models]; | |
| 163 | + if (self.modelCaches.count > 0 && _state != AnimationStateShaking) { | |
| 164 | + _state = AnimationStateShaking; | |
| 165 | + id<PresentModelAble> obj = self.modelCaches.firstObject; | |
| 166 | + self.shakeLable.text = [NSString stringWithFormat:@"X%ld", [obj giftNumber]]; | |
| 167 | + [self.modelCaches removeObjectAtIndex:0]; | |
| 168 | + __weak typeof(self) ws = self; | |
| 169 | + [self.shakeLable startAnimationDuration:Duration completion:^(BOOL finish) { | |
| 170 | + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ | |
| 171 | + _state = AnimationStateShaked; | |
| 172 | + if (ws.modelCaches.count > 0) { | |
| 173 | + [ws shakeAnimationWithModels:nil]; | |
| 174 | + } | |
| 175 | + }); | |
| 176 | + }]; | |
| 177 | + } | |
| 178 | +} | |
| 179 | + | |
| 180 | +- (void)hiddenAnimationOfShowShake:(BOOL)flag | |
| 181 | +{ | |
| 182 | + self.superview.userInteractionEnabled = NO; | |
| 183 | + _state = AnimationStateHiding; | |
| 184 | + [UIView animateWithDuration:Duration delay:0 usingSpringWithDamping:1.0 initialSpringVelocity:0.0 options:UIViewAnimationOptionCurveEaseIn animations:^{ | |
| 185 | + [self customHideAnimationOfShowShakeAnimation:flag]; | |
| 186 | + } completion:^(BOOL finished) { | |
| 187 | + | |
| 188 | + //恢复cell的初始状态 | |
| 189 | + self.frame = self.originalFrame; | |
| 190 | + _state = AnimationStateNone; | |
| 191 | + self.shakeLable.alpha = 0.0; | |
| 192 | + [self.caches removeAllObjects]; | |
| 193 | + [self.modelCaches removeAllObjects]; | |
| 194 | + | |
| 195 | + //通知代理 | |
| 196 | + if ([self.delegate respondsToSelector:@selector(presentViewCell:showShakeAnimation:shakeNumber:)]) { | |
| 197 | + [self.delegate presentViewCell:self showShakeAnimation:flag shakeNumber:self.number]; | |
| 198 | + | |
| 199 | + } | |
| 200 | + }]; | |
| 201 | +} | |
| 202 | + | |
| 203 | +//目前还没有使用 | |
| 204 | +- (void)releaseVariable | |
| 205 | +{ | |
| 206 | +// [self.shakeLable removeFromSuperview]; | |
| 207 | +} | |
| 208 | + | |
| 209 | +@end | |
| 210 | + | |
| 211 | +@implementation PresentViewCell (OverWrite) | |
| 212 | + | |
| 213 | +- (void)customDisplayAnimationOfShowShakeAnimation:(BOOL)flag | |
| 214 | +{ | |
| 215 | + self.alpha = 1.0; | |
| 216 | + CGRect selfF = self.frame; | |
| 217 | + selfF.origin.x = 0; | |
| 218 | + self.frame = selfF; | |
| 219 | +} | |
| 220 | + | |
| 221 | +- (void)customHideAnimationOfShowShakeAnimation:(BOOL)flag | |
| 222 | +{ | |
| 223 | + self.alpha = 0.0; | |
| 224 | + CGRect selfF = self.frame; | |
| 225 | + selfF.origin.y -= (CGRectGetHeight(selfF) * 0.5); | |
| 226 | + self.frame = selfF; | |
| 227 | +} | |
| 228 | + | |
| 229 | +@end | |
| 230 | + | |
| 231 | +@implementation PresentLable | |
| 232 | + | |
| 233 | +- (void)drawTextInRect:(CGRect)rect | |
| 234 | +{ | |
| 235 | + UIColor *textColor = self.textColor; | |
| 236 | + | |
| 237 | + CGContextRef c = UIGraphicsGetCurrentContext(); | |
| 238 | + CGContextSetLineWidth(c, 5); | |
| 239 | + CGContextSetLineJoin(c, kCGLineJoinRound); | |
| 240 | + | |
| 241 | + CGContextSetTextDrawingMode(c, kCGTextStroke); | |
| 242 | + self.textColor = self.borderColor; | |
| 243 | + [super drawTextInRect:rect]; | |
| 244 | + | |
| 245 | + CGContextSetTextDrawingMode(c, kCGTextFill); | |
| 246 | + self.textColor = textColor; | |
| 247 | + self.shadowOffset = CGSizeMake(0, 0); | |
| 248 | + [super drawTextInRect:rect]; | |
| 249 | +} | |
| 250 | + | |
| 251 | +- (void)startAnimationDuration:(NSTimeInterval)interval completion:(void (^)(BOOL finish))completion | |
| 252 | +{ | |
| 253 | + [UIView animateKeyframesWithDuration:interval delay:0 options:0 animations:^{ | |
| 254 | + | |
| 255 | + [UIView addKeyframeWithRelativeStartTime:0 relativeDuration:1/2.0 animations:^{ | |
| 256 | + self.transform = CGAffineTransformMakeScale(4, 4); | |
| 257 | + }]; | |
| 258 | + [UIView addKeyframeWithRelativeStartTime:1/2.0 relativeDuration:1/2.0 animations:^{ | |
| 259 | + self.transform = CGAffineTransformMakeScale(0.8, 0.8); | |
| 260 | + }]; | |
| 261 | + | |
| 262 | + } completion:^(BOOL finished) { | |
| 263 | + | |
| 264 | + [UIView animateWithDuration:0.25 delay:0 usingSpringWithDamping:0.4 initialSpringVelocity:10 options:UIViewAnimationOptionCurveEaseInOut animations:^{ | |
| 265 | + self.transform = CGAffineTransformMakeScale(1.0, 1.0); | |
| 266 | + } completion:^(BOOL finished) { | |
| 267 | + if (completion) { | |
| 268 | + completion(finished); | |
| 269 | + } | |
| 270 | + }]; | |
| 271 | + | |
| 272 | + }]; | |
| 273 | +} | |
| 274 | + | |
| 275 | +@end | |
| 276 | + | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/LVCAnimationManager.m
| ... | ... | @@ -65,7 +65,7 @@ static LVCAnimationManager * __singleton__; |
| 65 | 65 | */ |
| 66 | 66 | - (void)bubblingWithCenterPoint:(CGPoint)centerPoint toView:(UIView *_Nonnull)toView speed:(CGFloat)speed |
| 67 | 67 | { |
| 68 | - CGFloat defSpeed = 2; | |
| 68 | + CGFloat defSpeed = 1; | |
| 69 | 69 | if (speed != 0) { |
| 70 | 70 | defSpeed = speed; |
| 71 | 71 | } | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/LiveBaseView.h
| ... | ... | @@ -7,9 +7,11 @@ |
| 7 | 7 | // |
| 8 | 8 | |
| 9 | 9 | #import "BaseView.h" |
| 10 | +@class PresentView; | |
| 10 | 11 | |
| 11 | 12 | @interface LiveBaseView : BaseView |
| 12 | 13 | |
| 13 | 14 | @property (nonatomic ,strong) UIViewController * _Nullable viewController; |
| 14 | - | |
| 15 | +@property (nonatomic ,strong ,readonly) PresentView * _Nullable presentView; | |
| 16 | +@property (nonatomic ,strong ,readonly) UIView * _Nullable animationBaseView; | |
| 15 | 17 | @end | ... | ... |
LiveVideoCloud/LiveVideoCloud/Classes/Sections/InteractionSections/LiveBaseView.m
| ... | ... | @@ -11,12 +11,31 @@ |
| 11 | 11 | #import "BottomToolView.h" |
| 12 | 12 | #import "GiftListView.h" |
| 13 | 13 | #import "GiftModel.h" |
| 14 | -@interface LiveBaseView ()<bottomBtnDeledate> | |
| 14 | +#import "PresentView.h" | |
| 15 | +#import "ComboCell.h" | |
| 16 | +#import "LVCAnimationManager.h" | |
| 17 | +#import "chatListCell.h" | |
| 18 | +#import "chatMsgModel.h" | |
| 15 | 19 | |
| 16 | -@property (nonatomic ,strong) UIScrollView * _Nullable scrollView; | |
| 17 | -@property (nonatomic ,strong) BottomToolView* _Nullable bottomToolView; | |
| 18 | -@property (nonatomic ,strong) UIButton * _Nullable closeBtn; | |
| 19 | -@property (nonatomic ,strong) UIView * _Nullable currentPopView; | |
| 20 | +#define BottomToolHeight 60 | |
| 21 | + | |
| 22 | +typedef NS_ENUM(NSInteger, PopType) {//弹窗类型 | |
| 23 | + PopTypeGift = 1,//礼物弹窗 | |
| 24 | + PopTypeChat ,//聊天弹窗 | |
| 25 | + PopTypePriMessage //私信弹窗 | |
| 26 | +}; | |
| 27 | + | |
| 28 | +@interface LiveBaseView ()<bottomBtnDeledate,PresentViewDelegate,UIScrollViewDelegate,UITableViewDelegate,UITableViewDataSource> | |
| 29 | + | |
| 30 | +@property (nonatomic ,strong ) UIScrollView * _Nullable scrollView; | |
| 31 | +@property (nonatomic ,strong ,readwrite) UIView * _Nullable animationBaseView;//展示层View | |
| 32 | +@property (nonatomic ,strong ) BottomToolView* _Nullable bottomToolView; | |
| 33 | +@property (nonatomic ,strong ) UIButton * _Nullable closeBtn; | |
| 34 | +@property (nonatomic ,strong ) UIView * _Nullable giftPopView; | |
| 35 | +@property (nonatomic ,strong ,readwrite) PresentView * _Nullable presentView;//连击View | |
| 36 | +@property (nonatomic ,assign ) PopType popType; | |
| 37 | +@property (nonatomic ,strong) UITableView * _Nullable chatTableView; | |
| 38 | +@property (nonatomic ,strong) NSMutableArray * _Nullable chatMsgArray;//聊天消息数组 | |
| 20 | 39 | |
| 21 | 40 | @end |
| 22 | 41 | |
| ... | ... | @@ -27,9 +46,20 @@ |
| 27 | 46 | if (self = [super initWithFrame:frame]) { |
| 28 | 47 | |
| 29 | 48 | [self addSubview:self.scrollView]; |
| 30 | - [self.scrollView addSubview:self.bottomToolView]; | |
| 49 | + [self.scrollView addSubview:self.animationBaseView]; | |
| 50 | + [self.animationBaseView addSubview:self.bottomToolView]; | |
| 51 | + [self.animationBaseView addSubview:self.presentView]; | |
| 31 | 52 | [self addSubview:self.closeBtn]; |
| 32 | 53 | [self addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapGestureClick:)]]; |
| 54 | + [[LVCAnimationManager shareManager] bubblingWithCenterPoint:CGPointMake(SCREEN_WIDTH - 50, SCREEN_HEIGHT - 50) toView:self.animationBaseView speed:1]; | |
| 55 | +// ChatView *chatView = [[ChatView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT - 150, 200, 100)]; | |
| 56 | +// chatView.backgroundColor = ZXRandomColor; | |
| 57 | +// [self addSubview:chatView]; | |
| 58 | + [self.animationBaseView addSubview:self.chatTableView]; | |
| 59 | + self.chatTableView.backgroundColor = ZXRandomColor; | |
| 60 | + chatMsgModel *model = [[chatMsgModel alloc] init]; | |
| 61 | + model.name = @"张旭"; | |
| 62 | + [self.chatMsgArray addObject:model]; | |
| 33 | 63 | } |
| 34 | 64 | return self; |
| 35 | 65 | } |
| ... | ... | @@ -37,25 +67,34 @@ |
| 37 | 67 | #pragma mark - bottomBtnDelegate |
| 38 | 68 | - (void)bottomActionWithType:(BtnClickType)btnType |
| 39 | 69 | { |
| 40 | - [self hiddenView:YES]; | |
| 41 | 70 | switch (btnType) { |
| 42 | 71 | case BtnClickTypeChat: |
| 43 | 72 | { |
| 73 | + self.popType = PopTypeChat; | |
| 44 | 74 | |
| 45 | 75 | } |
| 46 | 76 | break; |
| 47 | 77 | case BtnClickTypePriChat: |
| 48 | 78 | { |
| 49 | - | |
| 79 | + self.popType = PopTypePriMessage; | |
| 50 | 80 | } |
| 51 | 81 | break; |
| 52 | 82 | case BtnClickTypeGift: |
| 53 | 83 | { |
| 54 | - GiftListView *giftListView = [[GiftListView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT - 230, SCREEN_WIDTH, 230) liveBaseView:self]; | |
| 55 | - giftListView.backgroundColor = [UIColor lightGrayColor]; | |
| 84 | + self.popType = PopTypeGift; | |
| 85 | + [self hiddenView:YES]; | |
| 86 | + GiftListView *giftListView = [[GiftListView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT - 250, SCREEN_WIDTH, 250) liveBaseView:self]; | |
| 56 | 87 | [self addSubview:giftListView]; |
| 57 | - self.currentPopView = giftListView; | |
| 58 | - | |
| 88 | + self.giftPopView = giftListView; | |
| 89 | + | |
| 90 | + UIImageView *giftBg = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, giftListView.width, giftListView.height)]; | |
| 91 | + giftBg.image = [UIImage imageNamed:@"背景400x300"]; | |
| 92 | + giftBg.centerX = giftListView.width * 0.5; | |
| 93 | + giftBg.centerY = giftListView.height * 0.5; | |
| 94 | + giftBg.alpha = 0.4; | |
| 95 | + [giftListView addSubview:giftBg]; | |
| 96 | + | |
| 97 | + | |
| 59 | 98 | } |
| 60 | 99 | break; |
| 61 | 100 | default: |
| ... | ... | @@ -67,22 +106,87 @@ |
| 67 | 106 | { |
| 68 | 107 | self.bottomToolView.hidden = isHidden; |
| 69 | 108 | self.closeBtn.hidden = isHidden; |
| 109 | + self.chatTableView.hidden = isHidden; | |
| 70 | 110 | } |
| 71 | 111 | |
| 72 | 112 | - (void)clearCurrentPopView |
| 73 | 113 | { |
| 74 | - [UIView animateWithDuration:0.25 animations:^{ | |
| 75 | - | |
| 76 | - self.currentPopView.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT); | |
| 77 | - [self hiddenView:NO]; | |
| 78 | - } completion:^(BOOL finished) { | |
| 79 | - [self.currentPopView removeFromSuperview]; | |
| 80 | - }]; | |
| 114 | + switch (self.popType) { | |
| 115 | + case PopTypeGift: | |
| 116 | + { | |
| 117 | + [UIView animateWithDuration:0.25 animations:^{ | |
| 118 | + | |
| 119 | + self.giftPopView.frame = CGRectMake(0, SCREEN_HEIGHT, SCREEN_WIDTH, SCREEN_HEIGHT); | |
| 120 | + [self hiddenView:NO]; | |
| 121 | + } completion:^(BOOL finished) { | |
| 122 | + [self.giftPopView removeFromSuperview]; | |
| 123 | + }]; | |
| 124 | + } | |
| 125 | + break; | |
| 126 | + case PopTypeChat: | |
| 127 | + { | |
| 128 | + | |
| 129 | + } | |
| 130 | + break; | |
| 131 | + case PopTypePriMessage: | |
| 132 | + { | |
| 133 | + | |
| 134 | + } | |
| 135 | + break; | |
| 136 | + default: | |
| 137 | + break; | |
| 138 | + } | |
| 139 | + | |
| 140 | +} | |
| 141 | +#pragma mark - 聊天消息列表 | |
| 142 | +#pragma mark - UITableViewDataSource | |
| 143 | + | |
| 144 | +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section | |
| 145 | +{ | |
| 146 | + return self.chatMsgArray.count; | |
| 147 | +} | |
| 148 | + | |
| 149 | +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
| 150 | +{ | |
| 151 | + chatListCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([chatListCell class]) forIndexPath:indexPath]; | |
| 152 | + [cell loadUIWithModel:self.chatMsgArray[indexPath.row]]; | |
| 153 | + return cell; | |
| 154 | +} | |
| 155 | + | |
| 156 | +#pragma mark - UITableViewDelegate | |
| 157 | +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath | |
| 158 | +{ | |
| 159 | + return [self.chatMsgArray[indexPath.row] cellHeight]; | |
| 160 | +} | |
| 161 | + | |
| 162 | +#pragma mark - PresentViewDelegate | |
| 163 | + | |
| 164 | +- (PresentViewCell *)presentView:(PresentView *)presentView cellOfRow:(NSInteger)row | |
| 165 | +{ | |
| 166 | + return [[ComboCell alloc] initWithRow:row]; | |
| 167 | +} | |
| 168 | + | |
| 169 | +- (void)presentView:(PresentView *)presentView configCell:(PresentViewCell *)cell model:(id<PresentModelAble>)model | |
| 170 | +{ | |
| 171 | + ComboCell *comboCell = (ComboCell *)cell; | |
| 172 | + comboCell.model = (GiftModel *)model; | |
| 173 | +} | |
| 174 | + | |
| 175 | +- (void)presentView:(PresentView *)presentView didSelectedCellOfRowAtIndex:(NSUInteger)index | |
| 176 | +{ | |
| 177 | + ComboCell *cell = [presentView cellForRowAtIndex:index]; | |
| 178 | + NSLog(@"你点击了:%@", cell.model.giftName); | |
| 179 | +} | |
| 180 | + | |
| 181 | +- (void)presentView:(PresentView *)presentView animationCompleted:(NSInteger)shakeNumber model:(id<PresentModelAble>)model | |
| 182 | +{ | |
| 183 | + NSLog(@"%@礼物的连送动画执行完成", model.giftName); | |
| 81 | 184 | } |
| 82 | 185 | |
| 83 | 186 | #pragma mark - buttonClick |
| 84 | 187 | - (void)tapGestureClick:(UITapGestureRecognizer *)gesture |
| 85 | 188 | { |
| 189 | + [[LVCAnimationManager shareManager] bubblingWithCenterPoint:CGPointMake(SCREEN_WIDTH - 50, SCREEN_HEIGHT - 50) toView:self.animationBaseView]; | |
| 86 | 190 | [self clearCurrentPopView]; |
| 87 | 191 | } |
| 88 | 192 | |
| ... | ... | @@ -91,6 +195,12 @@ |
| 91 | 195 | [self.viewController.navigationController popViewControllerAnimated:YES]; |
| 92 | 196 | } |
| 93 | 197 | |
| 198 | +#pragma mark - UIScrollViewDelegate | |
| 199 | +- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView | |
| 200 | +{ | |
| 201 | + [self clearCurrentPopView]; | |
| 202 | +} | |
| 203 | + | |
| 94 | 204 | #pragma mark - setter |
| 95 | 205 | -(void)setViewController:(UIViewController *)viewController |
| 96 | 206 | { |
| ... | ... | @@ -110,15 +220,38 @@ |
| 110 | 220 | _scrollView.showsVerticalScrollIndicator = NO; |
| 111 | 221 | _scrollView.showsHorizontalScrollIndicator = NO; |
| 112 | 222 | _scrollView.backgroundColor = [UIColor clearColor]; |
| 223 | + _scrollView.delegate = self; | |
| 113 | 224 | } |
| 114 | 225 | return _scrollView; |
| 115 | 226 | } |
| 116 | 227 | |
| 228 | +- (UIView *)animationBaseView | |
| 229 | +{ | |
| 230 | + if (!_animationBaseView) | |
| 231 | + { | |
| 232 | + _animationBaseView = [[UIView alloc] initWithFrame:CGRectMake(self.scrollView.width, 0, self.scrollView.width, self.scrollView.height)]; | |
| 233 | + _animationBaseView.backgroundColor = [UIColor redColor]; | |
| 234 | + _animationBaseView.clipsToBounds = YES; | |
| 235 | + } | |
| 236 | + return _animationBaseView; | |
| 237 | +} | |
| 238 | + | |
| 239 | +- (PresentView *)presentView | |
| 240 | +{ | |
| 241 | + if (!_presentView) | |
| 242 | + { | |
| 243 | + _presentView = [[PresentView alloc] initWithFrame:CGRectMake(0, 200, 220, 200)]; | |
| 244 | + _presentView.delegate = self; | |
| 245 | + _presentView.backgroundColor = [UIColor clearColor]; | |
| 246 | + } | |
| 247 | + return _presentView; | |
| 248 | +} | |
| 249 | + | |
| 117 | 250 | - (BottomToolView *)bottomToolView |
| 118 | 251 | { |
| 119 | 252 | if (!_bottomToolView) |
| 120 | 253 | { |
| 121 | - _bottomToolView = [[BottomToolView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH, SCREEN_HEIGHT - 60, SCREEN_WIDTH, 60)]; | |
| 254 | + _bottomToolView = [[BottomToolView alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT - BottomToolHeight, SCREEN_WIDTH, BottomToolHeight)]; | |
| 122 | 255 | _bottomToolView.delegate = self; |
| 123 | 256 | _bottomToolView.backgroundColor = [UIColor lightGrayColor]; |
| 124 | 257 | _bottomToolView.alpha = 0.7; |
| ... | ... | @@ -126,6 +259,31 @@ |
| 126 | 259 | return _bottomToolView; |
| 127 | 260 | } |
| 128 | 261 | |
| 262 | +- (UITableView *)chatTableView | |
| 263 | +{ | |
| 264 | + if (!_chatTableView) { | |
| 265 | + UITableView *tableView = [[UITableView alloc]initWithFrame:CGRectMake(10, SCREEN_HEIGHT - 150 - BottomToolHeight - 10, 300, 150)]; | |
| 266 | + tableView.delegate = self; | |
| 267 | + tableView.dataSource = self; | |
| 268 | + tableView.separatorStyle = UITableViewCellSeparatorStyleNone; | |
| 269 | + [tableView registerClass:[chatListCell class] forCellReuseIdentifier:NSStringFromClass([chatListCell class])]; | |
| 270 | + tableView.showsVerticalScrollIndicator = NO; | |
| 271 | + tableView.showsHorizontalScrollIndicator = NO; | |
| 272 | + tableView.backgroundColor = [UIColor clearColor]; | |
| 273 | + tableView.separatorStyle = UITableViewCellSeparatorStyleNone; | |
| 274 | + _chatTableView = tableView; | |
| 275 | + } | |
| 276 | + return _chatTableView; | |
| 277 | +} | |
| 278 | + | |
| 279 | +- (NSMutableArray *)chatMsgArray | |
| 280 | +{ | |
| 281 | + if (!_chatMsgArray) { | |
| 282 | + _chatMsgArray = [NSMutableArray array]; | |
| 283 | + } | |
| 284 | + return _chatMsgArray; | |
| 285 | +} | |
| 286 | + | |
| 129 | 287 | - (UIButton *)closeBtn |
| 130 | 288 | { |
| 131 | 289 | if (!_closeBtn) | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/Contents.json
0 → 100644
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/beer.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "beer.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/beer.imageset/beer.png
0 → 100644
5.11 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/chicken.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "chicken.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/chicken.imageset/chicken.png
0 → 100644
4.37 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/continuous.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "continuous.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/continuous.imageset/continuous.png
0 → 100644
1.94 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/cucumber.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "cucumber.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/cucumber.imageset/cucumber.png
0 → 100644
7.15 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/diamond.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "diamond.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/diamond.imageset/diamond.png
0 → 100644
1.01 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/fighter_small80.imageset/Contents.json
0 → 100644
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/fighter_small80.imageset/fighter_small80.png
0 → 100644
7.91 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/flower.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "flower.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/flower.imageset/flower.png
0 → 100644
4.82 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/hug.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "hug.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/hug.imageset/hug.png
0 → 100644
4.34 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/love_gift.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "love_gift.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/love_gift.imageset/love_gift.png
0 → 100644
2.14 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/mouth.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "mouth.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/mouth.imageset/mouth.png
0 → 100644
5.06 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/plane_small80.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "plane_small80.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/plane_small80.imageset/plane_small80.png
0 → 100644
6.96 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/porsch_small80.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "porsch_small80.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/porsch_small80.imageset/porsch_small80.png
0 → 100644
8.48 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/ring.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "ring.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/ring.imageset/ring.png
0 → 100644
6.54 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/rose.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "rose.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/rose.imageset/rose.png
0 → 100644
5.39 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/sticks.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "sticks.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/sticks.imageset/sticks.png
0 → 100644
4.44 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/背景100x100.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "背景100x100.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/背景100x100.imageset/背景100x100.png
0 → 100644
1.46 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/背景150x100.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "背景150x100.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/背景150x100.imageset/背景150x100.png
0 → 100644
1.56 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/背景200x50.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "背景200x50.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/背景200x50.imageset/背景200x50.png
0 → 100644
1.4 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/背景400x30.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "背景400x30.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/背景400x30.imageset/背景400x30.png
0 → 100644
1.45 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/背景400x300.imageset/Contents.json
0 → 100644
| 1 | +{ | |
| 2 | + "images" : [ | |
| 3 | + { | |
| 4 | + "idiom" : "universal", | |
| 5 | + "filename" : "背景400x300.png", | |
| 6 | + "scale" : "1x" | |
| 7 | + }, | |
| 8 | + { | |
| 9 | + "idiom" : "universal", | |
| 10 | + "scale" : "2x" | |
| 11 | + }, | |
| 12 | + { | |
| 13 | + "idiom" : "universal", | |
| 14 | + "scale" : "3x" | |
| 15 | + } | |
| 16 | + ], | |
| 17 | + "info" : { | |
| 18 | + "version" : 1, | |
| 19 | + "author" : "xcode" | |
| 20 | + } | |
| 21 | +} | |
| 0 | 22 | \ No newline at end of file | ... | ... |
LiveVideoCloud/LiveVideoCloud/animation.xcassets/Interaction/Gift/背景400x300.imageset/背景400x300.png
0 → 100644
3.76 KB
LiveVideoCloud/LiveVideoCloud/animation.xcassets/LaunchImage.launchimage/Contents.json
| ... | ... | @@ -3,43 +3,30 @@ |
| 3 | 3 | { |
| 4 | 4 | "orientation" : "portrait", |
| 5 | 5 | "idiom" : "ipad", |
| 6 | - "minimum-system-version" : "7.0", | |
| 7 | 6 | "extent" : "full-screen", |
| 8 | - "scale" : "2x" | |
| 9 | - }, | |
| 10 | - { | |
| 11 | - "orientation" : "landscape", | |
| 12 | - "idiom" : "ipad", | |
| 13 | 7 | "minimum-system-version" : "7.0", |
| 14 | - "extent" : "full-screen", | |
| 15 | 8 | "scale" : "1x" |
| 16 | 9 | }, |
| 17 | 10 | { |
| 18 | 11 | "orientation" : "landscape", |
| 19 | 12 | "idiom" : "ipad", |
| 20 | - "minimum-system-version" : "7.0", | |
| 21 | 13 | "extent" : "full-screen", |
| 22 | - "scale" : "2x" | |
| 23 | - }, | |
| 24 | - { | |
| 25 | - "orientation" : "portrait", | |
| 26 | - "idiom" : "iphone", | |
| 27 | 14 | "minimum-system-version" : "7.0", |
| 28 | - "scale" : "2x" | |
| 15 | + "scale" : "1x" | |
| 29 | 16 | }, |
| 30 | 17 | { |
| 31 | 18 | "orientation" : "portrait", |
| 32 | - "idiom" : "iphone", | |
| 19 | + "idiom" : "ipad", | |
| 20 | + "extent" : "full-screen", | |
| 33 | 21 | "minimum-system-version" : "7.0", |
| 34 | - "subtype" : "retina4", | |
| 35 | 22 | "scale" : "2x" |
| 36 | 23 | }, |
| 37 | 24 | { |
| 38 | - "orientation" : "portrait", | |
| 25 | + "orientation" : "landscape", | |
| 39 | 26 | "idiom" : "ipad", |
| 40 | - "minimum-system-version" : "7.0", | |
| 41 | 27 | "extent" : "full-screen", |
| 42 | - "scale" : "1x" | |
| 28 | + "minimum-system-version" : "7.0", | |
| 29 | + "scale" : "2x" | |
| 43 | 30 | } |
| 44 | 31 | ], |
| 45 | 32 | "info" : { | ... | ... |