diff --git a/Podfile b/Podfile index 3237ec59..87622e40 100644 --- a/Podfile +++ b/Podfile @@ -60,6 +60,7 @@ target 'xplan-ios' do pod 'YYWebImage', '~> 1.0.5' #vap礼物动画 pod 'QGVAPlayer' + pod 'IQKeyboardManager', '~> 6.5.5' #调试 pod 'LookinServer', :configurations => ['Debug'] diff --git a/Podfile.lock b/Podfile.lock index 76f40496..eecfa9e9 100644 --- a/Podfile.lock +++ b/Podfile.lock @@ -20,6 +20,7 @@ PODS: - FFPopup (1.1.5) - HappyDNS (0.3.17) - IAPHelper (1.1) + - IQKeyboardManager (6.5.9) - JXCategoryView (1.5.9) - JXPagingView/Pager (2.1.2) - LookinServer (1.0.4) @@ -92,6 +93,7 @@ DEPENDENCIES: - Base64 - FFPopup - IAPHelper + - IQKeyboardManager (~> 6.5.5) - JXCategoryView - JXPagingView/Pager - LookinServer @@ -124,6 +126,7 @@ DEPENDENCIES: SPEC REPOS: https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git: + - IQKeyboardManager - JXPagingView - NTESBaseComponent - NTESQuickPass @@ -175,6 +178,7 @@ SPEC CHECKSUMS: FFPopup: a208dcee8db3e54ec4a88fcd6481f6f5d85b7a83 HappyDNS: 848ef73e24f2b0e2752064223ce2dc0dd88900ea IAPHelper: fd74f53b0ac142eed085777b88b86a11746a2dd4 + IQKeyboardManager: 241cc94ccabc9deb8f8bd7d12f00d73288d13ecc JXCategoryView: 2ef9ecfd3735158d009ce02d1f29811aa822da65 JXPagingView: 90924b364a2ff7e94db534fad1fa50925ff69ee4 LookinServer: 743c1681771d0a8dcc38825325a080c3186404a5 @@ -207,6 +211,6 @@ SPEC CHECKSUMS: YYText: 5c461d709e24d55a182d1441c41dc639a18a4849 YYWebImage: 5f7f36aee2ae293f016d418c7d6ba05c4863e928 -PODFILE CHECKSUM: 1a683727ef25bd79085c9712a04f56f64ed29993 +PODFILE CHECKSUM: 5f8d1ca73148363e1d2c4871b0136f5edc0ee8e5 COCOAPODS: 1.11.2 diff --git a/xplan-ios.xcodeproj/project.pbxproj b/xplan-ios.xcodeproj/project.pbxproj index 0f3a7007..c5f316c6 100644 --- a/xplan-ios.xcodeproj/project.pbxproj +++ b/xplan-ios.xcodeproj/project.pbxproj @@ -363,6 +363,14 @@ E87E914E2796678D00A7B3F2 /* XPMineDressEmptyTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E87E914D2796678D00A7B3F2 /* XPMineDressEmptyTableViewCell.m */; }; E87E91522796A15500A7B3F2 /* MicroExtModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E87E91512796A15500A7B3F2 /* MicroExtModel.m */; }; E87E91552796B6DE00A7B3F2 /* XPRoomInviteUserViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E87E91542796B6DE00A7B3F2 /* XPRoomInviteUserViewController.m */; }; + E880B39E278BD49E00A83B0D /* XPAcrossRoomPKViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E880B39D278BD49E00A83B0D /* XPAcrossRoomPKViewController.m */; }; + E880B3A1278BD60C00A83B0D /* XPAcrossRoomPKSelectRoomView.m in Sources */ = {isa = PBXBuildFile; fileRef = E880B3A0278BD60C00A83B0D /* XPAcrossRoomPKSelectRoomView.m */; }; + E880B3A6278BD69900A83B0D /* XPAcrossRoomPKTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E880B3A5278BD69900A83B0D /* XPAcrossRoomPKTableViewCell.m */; }; + E880B3A9278BD82300A83B0D /* AcrossRoomPKInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E880B3A8278BD82300A83B0D /* AcrossRoomPKInfoModel.m */; }; + E880B3AC278BD98600A83B0D /* XPAcrossRoomPKEmptyTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = E880B3AB278BD98600A83B0D /* XPAcrossRoomPKEmptyTableViewCell.m */; }; + E880B3AF278BE1D800A83B0D /* Api+AcrossRoomPK.m in Sources */ = {isa = PBXBuildFile; fileRef = E880B3AE278BE1D800A83B0D /* Api+AcrossRoomPK.m */; }; + E880B3B2278C1D1800A83B0D /* XPAcrossRoomPKRuleView.m in Sources */ = {isa = PBXBuildFile; fileRef = E880B3B1278C1D1800A83B0D /* XPAcrossRoomPKRuleView.m */; }; + E880B3B5278C1FE400A83B0D /* XPAcrossRoomPKPresenter.m in Sources */ = {isa = PBXBuildFile; fileRef = E880B3B4278C1FE400A83B0D /* XPAcrossRoomPKPresenter.m */; }; E884C36C2743951B00E1EBED /* GiftReceiveInfoModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E884C36B2743951B00E1EBED /* GiftReceiveInfoModel.m */; }; E884C36F2743AAC800E1EBED /* AttachmentModel.m in Sources */ = {isa = PBXBuildFile; fileRef = E884C36E2743AAC800E1EBED /* AttachmentModel.m */; }; E884C3722743AEDE00E1EBED /* CustomAttachmentDecoder.m in Sources */ = {isa = PBXBuildFile; fileRef = E884C3712743AEDE00E1EBED /* CustomAttachmentDecoder.m */; }; @@ -1280,6 +1288,23 @@ E87E91512796A15500A7B3F2 /* MicroExtModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MicroExtModel.m; sourceTree = ""; }; E87E91532796B6DE00A7B3F2 /* XPRoomInviteUserViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPRoomInviteUserViewController.h; sourceTree = ""; }; E87E91542796B6DE00A7B3F2 /* XPRoomInviteUserViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPRoomInviteUserViewController.m; sourceTree = ""; }; + E880B39C278BD49E00A83B0D /* XPAcrossRoomPKViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAcrossRoomPKViewController.h; sourceTree = ""; }; + E880B39D278BD49E00A83B0D /* XPAcrossRoomPKViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAcrossRoomPKViewController.m; sourceTree = ""; }; + E880B39F278BD60C00A83B0D /* XPAcrossRoomPKSelectRoomView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAcrossRoomPKSelectRoomView.h; sourceTree = ""; }; + E880B3A0278BD60C00A83B0D /* XPAcrossRoomPKSelectRoomView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAcrossRoomPKSelectRoomView.m; sourceTree = ""; }; + E880B3A4278BD69900A83B0D /* XPAcrossRoomPKTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAcrossRoomPKTableViewCell.h; sourceTree = ""; }; + E880B3A5278BD69900A83B0D /* XPAcrossRoomPKTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAcrossRoomPKTableViewCell.m; sourceTree = ""; }; + E880B3A7278BD82300A83B0D /* AcrossRoomPKInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AcrossRoomPKInfoModel.h; sourceTree = ""; }; + E880B3A8278BD82300A83B0D /* AcrossRoomPKInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AcrossRoomPKInfoModel.m; sourceTree = ""; }; + E880B3AA278BD98600A83B0D /* XPAcrossRoomPKEmptyTableViewCell.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAcrossRoomPKEmptyTableViewCell.h; sourceTree = ""; }; + E880B3AB278BD98600A83B0D /* XPAcrossRoomPKEmptyTableViewCell.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAcrossRoomPKEmptyTableViewCell.m; sourceTree = ""; }; + E880B3AD278BE1D800A83B0D /* Api+AcrossRoomPK.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Api+AcrossRoomPK.h"; sourceTree = ""; }; + E880B3AE278BE1D800A83B0D /* Api+AcrossRoomPK.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "Api+AcrossRoomPK.m"; sourceTree = ""; }; + E880B3B0278C1D1800A83B0D /* XPAcrossRoomPKRuleView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAcrossRoomPKRuleView.h; sourceTree = ""; }; + E880B3B1278C1D1800A83B0D /* XPAcrossRoomPKRuleView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAcrossRoomPKRuleView.m; sourceTree = ""; }; + E880B3B3278C1FE400A83B0D /* XPAcrossRoomPKPresenter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAcrossRoomPKPresenter.h; sourceTree = ""; }; + E880B3B4278C1FE400A83B0D /* XPAcrossRoomPKPresenter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = XPAcrossRoomPKPresenter.m; sourceTree = ""; }; + E880B3B6278C1FFB00A83B0D /* XPAcrossRoomProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = XPAcrossRoomProtocol.h; sourceTree = ""; }; E884C36A2743951B00E1EBED /* GiftReceiveInfoModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GiftReceiveInfoModel.h; sourceTree = ""; }; E884C36B2743951B00E1EBED /* GiftReceiveInfoModel.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GiftReceiveInfoModel.m; sourceTree = ""; }; E884C36D2743AAC800E1EBED /* AttachmentModel.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AttachmentModel.h; sourceTree = ""; }; @@ -3644,6 +3669,86 @@ path = Cell; sourceTree = ""; }; + E880B396278BD3D800A83B0D /* AcrossRoomPK */ = { + isa = PBXGroup; + children = ( + E880B39B278BD45A00A83B0D /* Model */, + E880B39A278BD45200A83B0D /* Api */, + E880B399278BD44500A83B0D /* View */, + E880B398278BD43D00A83B0D /* Presenter */, + E880B397278BD43600A83B0D /* Protocol */, + ); + path = AcrossRoomPK; + sourceTree = ""; + }; + E880B397278BD43600A83B0D /* Protocol */ = { + isa = PBXGroup; + children = ( + E880B3B6278C1FFB00A83B0D /* XPAcrossRoomProtocol.h */, + ); + path = Protocol; + sourceTree = ""; + }; + E880B398278BD43D00A83B0D /* Presenter */ = { + isa = PBXGroup; + children = ( + E880B3B3278C1FE400A83B0D /* XPAcrossRoomPKPresenter.h */, + E880B3B4278C1FE400A83B0D /* XPAcrossRoomPKPresenter.m */, + ); + path = Presenter; + sourceTree = ""; + }; + E880B399278BD44500A83B0D /* View */ = { + isa = PBXGroup; + children = ( + E880B3A3278BD66400A83B0D /* SubViews */, + E880B3A2278BD65E00A83B0D /* Cell */, + E880B39C278BD49E00A83B0D /* XPAcrossRoomPKViewController.h */, + E880B39D278BD49E00A83B0D /* XPAcrossRoomPKViewController.m */, + E880B39F278BD60C00A83B0D /* XPAcrossRoomPKSelectRoomView.h */, + E880B3A0278BD60C00A83B0D /* XPAcrossRoomPKSelectRoomView.m */, + ); + path = View; + sourceTree = ""; + }; + E880B39A278BD45200A83B0D /* Api */ = { + isa = PBXGroup; + children = ( + E880B3AD278BE1D800A83B0D /* Api+AcrossRoomPK.h */, + E880B3AE278BE1D800A83B0D /* Api+AcrossRoomPK.m */, + ); + path = Api; + sourceTree = ""; + }; + E880B39B278BD45A00A83B0D /* Model */ = { + isa = PBXGroup; + children = ( + E880B3A7278BD82300A83B0D /* AcrossRoomPKInfoModel.h */, + E880B3A8278BD82300A83B0D /* AcrossRoomPKInfoModel.m */, + ); + path = Model; + sourceTree = ""; + }; + E880B3A2278BD65E00A83B0D /* Cell */ = { + isa = PBXGroup; + children = ( + E880B3A4278BD69900A83B0D /* XPAcrossRoomPKTableViewCell.h */, + E880B3A5278BD69900A83B0D /* XPAcrossRoomPKTableViewCell.m */, + E880B3AA278BD98600A83B0D /* XPAcrossRoomPKEmptyTableViewCell.h */, + E880B3AB278BD98600A83B0D /* XPAcrossRoomPKEmptyTableViewCell.m */, + ); + path = Cell; + sourceTree = ""; + }; + E880B3A3278BD66400A83B0D /* SubViews */ = { + isa = PBXGroup; + children = ( + E880B3B0278C1D1800A83B0D /* XPAcrossRoomPKRuleView.h */, + E880B3B1278C1D1800A83B0D /* XPAcrossRoomPKRuleView.m */, + ); + path = SubViews; + sourceTree = ""; + }; E884C3732743B66400E1EBED /* IM */ = { isa = PBXGroup; children = ( @@ -3946,6 +4051,7 @@ children = ( 9B92C01A27E0BAEB0044C5EA /* NobleTrumpet */, 9B7B605827BB52FD0070BB72 /* AnchorView */, + E880B396278BD3D800A83B0D /* AcrossRoomPK */, E8412F9A2779BAC2006E1101 /* Setting */, E84150B027747A7400A7F548 /* FirstRecharge */, E81C1B1327705EF00020D1E4 /* ArrangeMic */, @@ -4869,6 +4975,7 @@ E899C68C275093B800E189E5 /* XPUserCardMicroItemModel.m in Sources */, E87A270027588445002DDC7A /* XPHomeListEmptyCollectionViewCell.m in Sources */, E82325F5274E2E09003A3332 /* XPUserCardPresenter.m in Sources */, + E880B39E278BD49E00A83B0D /* XPAcrossRoomPKViewController.m in Sources */, E8AC723D26F4B6AA007D6E91 /* XPLoginBindPhoneResultViewController.m in Sources */, 9B2A12D52783EEC700CED41B /* XPNobleCenterTableHeadView.m in Sources */, 9BEE3D11278584FE00C83219 /* XPNobleCenterEmptyView.m in Sources */, @@ -4903,6 +5010,7 @@ E82325E9274CE56A003A3332 /* XPShareItem.m in Sources */, E890BC0D273D09A50007C46B /* XPGiftCountView.m in Sources */, 9B060B5827BCAEE20001B767 /* AnchorGiftValueView.m in Sources */, + E880B3B2278C1D1800A83B0D /* XPAcrossRoomPKRuleView.m in Sources */, E81C1B262770663B0020D1E4 /* XPArrangeMicTableViewCell.m in Sources */, E8AC722F26F49610007D6E91 /* XPMineNotificationItemModel.m in Sources */, E8E70D7A26F2F16600F03460 /* XPMinePresent.m in Sources */, @@ -4973,6 +5081,7 @@ 18E7B26926E8D5D60064BC9B /* XCCurrentVCStackManager.m in Sources */, E824544326F58FCE00BE8163 /* XPMinePayPwdInputView.m in Sources */, 1808073027315E8E001FD836 /* NetImageView.m in Sources */, + E880B3AC278BD98600A83B0D /* XPAcrossRoomPKEmptyTableViewCell.m in Sources */, 18486235271EB794005FC5DC /* AgoraRtcImpl.m in Sources */, 9B92A3392797BE4500AD168F /* XPMineSkillTipView.m in Sources */, E8A1E454276208E500B294CA /* CandyTreeInfoModel.m in Sources */, @@ -5029,6 +5138,7 @@ 186A534726FC6ED900D67B2C /* TTAlertConfig.m in Sources */, 18F403EE2758CF2F00A6C548 /* MessageContentImage.m in Sources */, 18E7B31E26F0984C0064BC9B /* UserLevelVo.m in Sources */, + E880B3A9278BD82300A83B0D /* AcrossRoomPKInfoModel.m in Sources */, E82D5C7A276B25D100858D6D /* SpriteSheetImageManager.m in Sources */, E874B88B27215EAF003954B9 /* MicroQueueModel.m in Sources */, 9B92A3662798132600AD168F /* XPSkillCardTypeView.m in Sources */, @@ -5054,6 +5164,7 @@ E88B5CBD26FB3BDF00DA9178 /* XPTeenagerAlertView.m in Sources */, E82D5C70276AE60000858D6D /* HeadwearModel.m in Sources */, E8A03DEC276301EF0098D9EA /* XPCandyTreeRankView.m in Sources */, + E880B3A1278BD60C00A83B0D /* XPAcrossRoomPKSelectRoomView.m in Sources */, 18F404C3276098F100A6C548 /* Api+Message.m in Sources */, E8C6FFED27550CC2004DC9F0 /* HomeSearchResultModel.m in Sources */, 9BB549592782E6A30090CD26 /* XPNobleCenterPresenter.m in Sources */, @@ -5111,6 +5222,7 @@ 9B208A362779B50100F9E54A /* GiftNobleInfoModel.m in Sources */, E8C6FFDA2754BE81004DC9F0 /* ThemeColor+Home.m in Sources */, E824545126F5CE6E00BE8163 /* XPMineModifPayPwdPresenter.m in Sources */, + E880B3AF278BE1D800A83B0D /* Api+AcrossRoomPK.m in Sources */, E8EEB90F26FC6AB8007C6EBA /* XPMineUserInfoEditPresenter.m in Sources */, E8AC723A26F49AAE007D6E91 /* XPMineNotifyStatus.m in Sources */, 18E7B33226F317A20064BC9B /* XPWebViewController.m in Sources */, @@ -5123,6 +5235,7 @@ E8E5E1B327C397A400F457D8 /* HomeMenuInfoModel.m in Sources */, E8AEAEF027141C430017FCE0 /* XPRoomMenuContainerView.m in Sources */, E8DEC99527648FA50078CB70 /* ClientConfig.m in Sources */, + E880B3A6278BD69900A83B0D /* XPAcrossRoomPKTableViewCell.m in Sources */, E8EEB90926FC579A007C6EBA /* XPMineUserInfoEditTableViewCell.m in Sources */, 9B9DFD9A27DB2194000F95B3 /* XPSessionMessageHeadView.m in Sources */, 18C17A5D26F338F300C48E11 /* XplanFBFlutterViewContainer.m in Sources */, @@ -5151,6 +5264,7 @@ 9BAA5FED277A1BBE007453F3 /* XPPrivacyViewController.m in Sources */, E872309326E8D31500B90D4F /* LoginVerifCodeView.m in Sources */, E87E91552796B6DE00A7B3F2 /* XPRoomInviteUserViewController.m in Sources */, + E880B3B5278C1FE400A83B0D /* XPAcrossRoomPKPresenter.m in Sources */, 186A534626FC6ED900D67B2C /* TTPopup.m in Sources */, E896EFB62771D55500AD2CC1 /* FansInfoModel.m in Sources */, E81C278C26EAFAF60031E639 /* Base64.m in Sources */, diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/Contents.json b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_delete_pk_room.imageset/Contents.json b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_delete_pk_room.imageset/Contents.json new file mode 100644 index 00000000..c57fb376 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_delete_pk_room.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "room_across_delete_pk_room@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "room_across_delete_pk_room@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_delete_pk_room.imageset/room_across_delete_pk_room@2x.png b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_delete_pk_room.imageset/room_across_delete_pk_room@2x.png new file mode 100644 index 00000000..b64ce5cb Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_delete_pk_room.imageset/room_across_delete_pk_room@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_delete_pk_room.imageset/room_across_delete_pk_room@3x.png b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_delete_pk_room.imageset/room_across_delete_pk_room@3x.png new file mode 100644 index 00000000..3c737da8 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_delete_pk_room.imageset/room_across_delete_pk_room@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_add_room.imageset/Contents.json b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_add_room.imageset/Contents.json new file mode 100644 index 00000000..8e7acc14 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_add_room.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "room_across_pk_add_room@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "room_across_pk_add_room@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_add_room.imageset/room_across_pk_add_room@2x.png b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_add_room.imageset/room_across_pk_add_room@2x.png new file mode 100644 index 00000000..551f240c Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_add_room.imageset/room_across_pk_add_room@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_add_room.imageset/room_across_pk_add_room@3x.png b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_add_room.imageset/room_across_pk_add_room@3x.png new file mode 100644 index 00000000..9b481ec9 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_add_room.imageset/room_across_pk_add_room@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_help.imageset/Contents.json b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_help.imageset/Contents.json new file mode 100644 index 00000000..d57c7f5c --- /dev/null +++ b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_help.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "room_across_pk_help@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "room_across_pk_help@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_help.imageset/room_across_pk_help@2x.png b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_help.imageset/room_across_pk_help@2x.png new file mode 100644 index 00000000..1d1282ce Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_help.imageset/room_across_pk_help@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_help.imageset/room_across_pk_help@3x.png b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_help.imageset/room_across_pk_help@3x.png new file mode 100644 index 00000000..d452078c Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_help.imageset/room_across_pk_help@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_rule_bg.imageset/Contents.json b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_rule_bg.imageset/Contents.json new file mode 100644 index 00000000..f191ff63 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_rule_bg.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "room_across_pk_rule_bg@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "room_across_pk_rule_bg@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_rule_bg.imageset/room_across_pk_rule_bg@2x.png b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_rule_bg.imageset/room_across_pk_rule_bg@2x.png new file mode 100644 index 00000000..e502b8c6 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_rule_bg.imageset/room_across_pk_rule_bg@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_rule_bg.imageset/room_across_pk_rule_bg@3x.png b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_rule_bg.imageset/room_across_pk_rule_bg@3x.png new file mode 100644 index 00000000..b2bd5f3c Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/room_across_pk_rule_bg.imageset/room_across_pk_rule_bg@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_normal.imageset/Contents.json b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_normal.imageset/Contents.json new file mode 100644 index 00000000..27d398b1 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_normal.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "roomg_across_pk_choose_normal@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "roomg_across_pk_choose_normal@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_normal.imageset/roomg_across_pk_choose_normal@2x.png b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_normal.imageset/roomg_across_pk_choose_normal@2x.png new file mode 100644 index 00000000..2d4b0302 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_normal.imageset/roomg_across_pk_choose_normal@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_normal.imageset/roomg_across_pk_choose_normal@3x.png b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_normal.imageset/roomg_across_pk_choose_normal@3x.png new file mode 100644 index 00000000..ce408055 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_normal.imageset/roomg_across_pk_choose_normal@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_select.imageset/Contents.json b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_select.imageset/Contents.json new file mode 100644 index 00000000..23b9e607 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_select.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "roomg_across_pk_choose_select@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "roomg_across_pk_choose_select@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_select.imageset/roomg_across_pk_choose_select@2x.png b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_select.imageset/roomg_across_pk_choose_select@2x.png new file mode 100644 index 00000000..68c34e06 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_select.imageset/roomg_across_pk_choose_select@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_select.imageset/roomg_across_pk_choose_select@3x.png b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_select.imageset/roomg_across_pk_choose_select@3x.png new file mode 100644 index 00000000..026b8e39 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/AcrossRoomPK/roomg_across_pk_choose_select.imageset/roomg_across_pk_choose_select@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_close.imageset/Contents.json b/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_close.imageset/Contents.json new file mode 100644 index 00000000..4beaf3a8 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_close.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "room_more_menu_cross_pk_close@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "room_more_menu_cross_pk_close@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_close.imageset/room_more_menu_cross_pk_close@2x.png b/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_close.imageset/room_more_menu_cross_pk_close@2x.png new file mode 100644 index 00000000..c201d3ae Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_close.imageset/room_more_menu_cross_pk_close@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_close.imageset/room_more_menu_cross_pk_close@3x.png b/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_close.imageset/room_more_menu_cross_pk_close@3x.png new file mode 100644 index 00000000..bac2db96 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_close.imageset/room_more_menu_cross_pk_close@3x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_open.imageset/Contents.json b/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_open.imageset/Contents.json new file mode 100644 index 00000000..3aafe521 --- /dev/null +++ b/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_open.imageset/Contents.json @@ -0,0 +1,22 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "room_more_menu_cross_pk_open@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "room_more_menu_cross_pk_open@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_open.imageset/room_more_menu_cross_pk_open@2x.png b/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_open.imageset/room_more_menu_cross_pk_open@2x.png new file mode 100644 index 00000000..17a5e07a Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_open.imageset/room_more_menu_cross_pk_open@2x.png differ diff --git a/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_open.imageset/room_more_menu_cross_pk_open@3x.png b/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_open.imageset/room_more_menu_cross_pk_open@3x.png new file mode 100644 index 00000000..5c332ed3 Binary files /dev/null and b/xplan-ios/Assets.xcassets/Room/MoreMenu/room_more_menu_cross_pk_open.imageset/room_more_menu_cross_pk_open@3x.png differ diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/Api/Api+AcrossRoomPK.h b/xplan-ios/Main/Room/View/AcrossRoomPK/Api/Api+AcrossRoomPK.h new file mode 100644 index 00000000..bf780d65 --- /dev/null +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/Api/Api+AcrossRoomPK.h @@ -0,0 +1,52 @@ +// +// Api+AcrossRoomPK.h +// xplan-ios +// +// Created by 冯硕 on 2022/1/10. +// + +#import "Api.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface Api (AcrossRoomPK) + +/// 搜索PK的房间列表 +/// @param completion 完成 +/// @param erbanNo 要搜索的房主的id +/// @param roomUid 房主的uid +/// @param pageNum 当前的页数 +/// @param pageSize 一页多少个 ++ (void)searchAcrossRoomPKRoomList:(HttpRequestHelperCompletion)completion + erbanNo:(NSString *)erbanNo + roomUid:(NSString *)roomUid + pageNum:(NSString *)pageNum + pageSize:(NSString *)pageSize; + +/// 获取可以PK的房间列表 +/// @param completion 完成 +/// @param roomUid 房主的uid +/// @param pageNum 当前的页数 +/// @param pageSize 一页多少个 ++ (void)getAcrossRoomPKRoomList:(HttpRequestHelperCompletion)completion + roomUid:(NSString *)roomUid + pageNum:(NSString *)pageNum + pageSize:(NSString *)pageSize; + +/// 开启一轮PK +/// @param completion 完成 +/// @param acceptUid pk对方的uid +/// @param duration 持续的时间 分钟 +/// @param inviteUid 邀请房间的房主的id +/// @param operateUid 操作者的uid +/// @param playDesc 描述 ++ (void)beginAcrossRoomPK:(HttpRequestHelperCompletion)completion + acceptUid:(NSString *)acceptUid + duration:(NSString *)duration + inviteUid:(NSString *)inviteUid + operateUid:(NSString *)operateUid + playDesc:(NSString *)playDesc; + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/Api/Api+AcrossRoomPK.m b/xplan-ios/Main/Room/View/AcrossRoomPK/Api/Api+AcrossRoomPK.m new file mode 100644 index 00000000..6066d8c7 --- /dev/null +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/Api/Api+AcrossRoomPK.m @@ -0,0 +1,42 @@ +// +// Api+AcrossRoomPK.m +// xplan-ios +// +// Created by 冯硕 on 2022/1/10. +// + +#import "Api+AcrossRoomPK.h" + +@implementation Api (AcrossRoomPK) + + +/// 搜索PK的房间列表 +/// @param completion 完成 +/// @param erbanNo 要搜索的房主的id +/// @param roomUid 房主的uid +/// @param pageNum 当前的页数 +/// @param pageSize 一页多少个 ++ (void)searchAcrossRoomPKRoomList:(HttpRequestHelperCompletion)completion erbanNo:(NSString *)erbanNo roomUid:(NSString *)roomUid pageNum:(NSString *)pageNum pageSize:(NSString *)pageSize { + [self makeRequest:@"search/permitRoom" method:HttpRequestHelperMethodGET completion:completion,__FUNCTION__, erbanNo, roomUid, pageNum, pageSize, nil]; +} + +/// 获取可以PK的房间列表 +/// @param completion 完成 +/// @param roomUid 房主的uid +/// @param pageNum 当前的页数 +/// @param pageSize 一页多少个 ++ (void)getAcrossRoomPKRoomList:(HttpRequestHelperCompletion)completion roomUid:(NSString *)roomUid pageNum:(NSString *)pageNum pageSize:(NSString *)pageSize { + [self makeRequest:@"search/permitRoom" method:HttpRequestHelperMethodGET completion:completion,__FUNCTION__, roomUid, pageNum, pageSize, nil]; +} + +/// 开启一轮PK +/// @param completion 完成 +/// @param acceptUid pk对方的uid +/// @param duration 持续的时间 分钟 +/// @param inviteUid 邀请房间的房主的id +/// @param operateUid 操作者的uid +/// @param playDesc 描述 ++ (void)beginAcrossRoomPK:(HttpRequestHelperCompletion)completion acceptUid:(NSString *)acceptUid duration:(NSString *)duration inviteUid:(NSString *)inviteUid operateUid:(NSString *)operateUid playDesc:(NSString *)playDesc { + [self makeRequest:@"crossroompkround/initiateChallenge" method:HttpRequestHelperMethodPOST completion:completion, __FUNCTION__, acceptUid, duration, inviteUid, operateUid, playDesc, nil]; +} +@end diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/Model/AcrossRoomPKInfoModel.h b/xplan-ios/Main/Room/View/AcrossRoomPK/Model/AcrossRoomPKInfoModel.h new file mode 100644 index 00000000..03e2e7e8 --- /dev/null +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/Model/AcrossRoomPKInfoModel.h @@ -0,0 +1,27 @@ +// +// AcrossRoomPkInfoModel.h +// xplan-ios +// +// Created by 冯硕 on 2022/1/10. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface AcrossRoomPKInfoModel : NSObject +@property (nonatomic, copy) NSString * roomId; +@property (nonatomic, copy) NSString * uid; +@property (nonatomic, copy) NSString * roomUid; +@property (nonatomic, copy) NSString *title; +///头像 +@property (nonatomic, copy) NSString *avatar; +///昵称 +@property (nonatomic, copy) NSString *nick; +///二般号 +@property (nonatomic, copy) NSString * erbanNo; +///是否选中 +@property (nonatomic, assign) BOOL hadSelected; +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/Model/AcrossRoomPKInfoModel.m b/xplan-ios/Main/Room/View/AcrossRoomPK/Model/AcrossRoomPKInfoModel.m new file mode 100644 index 00000000..c507a0d3 --- /dev/null +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/Model/AcrossRoomPKInfoModel.m @@ -0,0 +1,12 @@ +// +// AcrossRoomPkInfoModel.m +// xplan-ios +// +// Created by 冯硕 on 2022/1/10. +// + +#import "AcrossRoomPKInfoModel.h" + +@implementation AcrossRoomPKInfoModel + +@end diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/Presenter/XPAcrossRoomPKPresenter.h b/xplan-ios/Main/Room/View/AcrossRoomPK/Presenter/XPAcrossRoomPKPresenter.h new file mode 100644 index 00000000..7d8d905a --- /dev/null +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/Presenter/XPAcrossRoomPKPresenter.h @@ -0,0 +1,24 @@ +// +// XPAcrossRoomPKPresenter.h +// xplan-ios +// +// Created by 冯硕 on 2022/1/10. +// + +#import "BaseMvpPresenter.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface XPAcrossRoomPKPresenter : BaseMvpPresenter +/// 开启跨房PK +/// @param roomUid 当前房间的房主uid +/// @param duration 持续的时间 +/// @param acceptUid 接收者的uid +/// @param playDesc 玩法 +- (void)beginAcrossRoomPK:(NSString *)roomUid + duration:(NSInteger)duration + acceptUid:(NSString *)acceptUid + playDesc:(NSString *)playDesc; +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/Presenter/XPAcrossRoomPKPresenter.m b/xplan-ios/Main/Room/View/AcrossRoomPK/Presenter/XPAcrossRoomPKPresenter.m new file mode 100644 index 00000000..e185abf3 --- /dev/null +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/Presenter/XPAcrossRoomPKPresenter.m @@ -0,0 +1,29 @@ +// +// XPAcrossRoomPKPresenter.m +// xplan-ios +// +// Created by 冯硕 on 2022/1/10. +// + +#import "XPAcrossRoomPKPresenter.h" +#import "Api+AcrossRoomPK.h" +#import "XPAcrossRoomProtocol.h" +#import "AccountInfoStorage.h" + +@implementation XPAcrossRoomPKPresenter + + +/// 开启跨房PK +/// @param roomUid 当前房间的房主uid +/// @param duration 持续的时间 +/// @param acceptUid 接收者的uid +/// @param playDesc 玩法 +- (void)beginAcrossRoomPK:(NSString *)roomUid duration:(NSInteger)duration acceptUid:(NSString *)acceptUid playDesc:(NSString *)playDesc { + NSString * uid = [AccountInfoStorage instance].getUid; + NSString * time = [NSString stringWithFormat:@"%ld", duration]; + [Api beginAcrossRoomPK:[self createHttpCompletion:^(BaseModel * _Nonnull data) { + [[self getView] beginAcrossRoomPKSuccess]; + } showLoading:YES] acceptUid:acceptUid duration:time inviteUid:roomUid operateUid:uid playDesc:playDesc]; +} + +@end diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/Protocol/XPAcrossRoomProtocol.h b/xplan-ios/Main/Room/View/AcrossRoomPK/Protocol/XPAcrossRoomProtocol.h new file mode 100644 index 00000000..a4c82176 --- /dev/null +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/Protocol/XPAcrossRoomProtocol.h @@ -0,0 +1,19 @@ +// +// XPAcrossRoomProtocol.h +// xplan-ios +// +// Created by 冯硕 on 2022/1/10. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@protocol XPAcrossRoomProtocol + +///开启咵房pk成功 +- (void)beginAcrossRoomPKSuccess; + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/View/Cell/XPAcrossRoomPKEmptyTableViewCell.h b/xplan-ios/Main/Room/View/AcrossRoomPK/View/Cell/XPAcrossRoomPKEmptyTableViewCell.h new file mode 100644 index 00000000..58b7274d --- /dev/null +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/View/Cell/XPAcrossRoomPKEmptyTableViewCell.h @@ -0,0 +1,16 @@ +// +// XPAcrossRoomPKEmptyTableViewCell.h +// xplan-ios +// +// Created by 冯硕 on 2022/1/10. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface XPAcrossRoomPKEmptyTableViewCell : UITableViewCell + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/View/Cell/XPAcrossRoomPKEmptyTableViewCell.m b/xplan-ios/Main/Room/View/AcrossRoomPK/View/Cell/XPAcrossRoomPKEmptyTableViewCell.m new file mode 100644 index 00000000..a1e01e1f --- /dev/null +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/View/Cell/XPAcrossRoomPKEmptyTableViewCell.m @@ -0,0 +1,70 @@ +// +// XPAcrossRoomPKEmptyTableViewCell.m +// xplan-ios +// +// Created by 冯硕 on 2022/1/10. +// + +#import "XPAcrossRoomPKEmptyTableViewCell.h" +///Third +#import +///Tool +#import "ThemeColor.h" +#import "UIImageConstant.h" + +@interface XPAcrossRoomPKEmptyTableViewCell () +@property (nonatomic,strong) UIImageView *emptyImageView; +@property (nonatomic,strong) UILabel *titleLabel; +@end + +@implementation XPAcrossRoomPKEmptyTableViewCell + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) { + [self initSubViews]; + [self initSubViewConstraints]; + } + return self; +} +#pragma mark - Private Method +- (void)initSubViews { + self.selectionStyle = UITableViewCellSelectionStyleNone; + [self.contentView addSubview:self.emptyImageView]; + [self.contentView addSubview:self.titleLabel]; +} + +- (void)initSubViewConstraints { + [self.emptyImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.contentView).offset(50); + make.centerX.mas_equalTo(self.contentView); + make.size.mas_equalTo(CGSizeMake(200, 200)); + }]; + + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.emptyImageView.mas_bottom).offset(20); + make.left.right.mas_equalTo(self.contentView); + }]; +} +#pragma mark - Getters And Setters +- (UIImageView *)emptyImageView { + if (!_emptyImageView) { + _emptyImageView = [[UIImageView alloc] init]; + _emptyImageView.userInteractionEnabled = YES; + _emptyImageView.image = [UIImageConstant defalutEmptyPlaceholder]; + _emptyImageView.layer.masksToBounds = YES; + _emptyImageView.contentMode = UIViewContentModeScaleAspectFit; + } + return _emptyImageView; +} + +- (UILabel *)titleLabel { + if (!_titleLabel) { + _titleLabel = [[UILabel alloc] init]; + _titleLabel.text = @"暂无搜索结果"; + _titleLabel.font = [UIFont systemFontOfSize:16]; + _titleLabel.textAlignment = NSTextAlignmentCenter; + _titleLabel.textColor = [ThemeColor secondTextColor]; + } + return _titleLabel; +} +@end diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/View/Cell/XPAcrossRoomPKTableViewCell.h b/xplan-ios/Main/Room/View/AcrossRoomPK/View/Cell/XPAcrossRoomPKTableViewCell.h new file mode 100644 index 00000000..0544da62 --- /dev/null +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/View/Cell/XPAcrossRoomPKTableViewCell.h @@ -0,0 +1,22 @@ +// +// XPAcrossRoomPKTableViewCell.h +// xplan-ios +// +// Created by 冯硕 on 2022/1/10. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +@class AcrossRoomPKInfoModel,XPAcrossRoomPKTableViewCell; +@protocol XPAcrossRoomPKTableViewCellDelegate +///点击了选择的按钮 +- (void)xPAcrossRoomPKTableViewCell:(XPAcrossRoomPKTableViewCell *)view didChooseRoom:(AcrossRoomPKInfoModel *)roomInfo; +@end +@interface XPAcrossRoomPKTableViewCell : UITableViewCell +@property (nonatomic,strong) AcrossRoomPKInfoModel *roomPKInfo; +///代理 +@property (nonatomic,weak) id delegate; +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/View/Cell/XPAcrossRoomPKTableViewCell.m b/xplan-ios/Main/Room/View/AcrossRoomPK/View/Cell/XPAcrossRoomPKTableViewCell.m new file mode 100644 index 00000000..faeaa55a --- /dev/null +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/View/Cell/XPAcrossRoomPKTableViewCell.m @@ -0,0 +1,131 @@ +// +// XPAcrossRoomPKTableViewCell.m +// xplan-ios +// +// Created by 冯硕 on 2022/1/10. +// + +#import "XPAcrossRoomPKTableViewCell.h" +///Third +#import +///Tool +#import "ThemeColor.h" +#import "NetImageView.h" +///Model +#import "AcrossRoomPKInfoModel.h" + +@interface XPAcrossRoomPKTableViewCell () +///头像 +@property (nonatomic, strong) NetImageView *avatarImageView; +///选择的 +@property (nonatomic, strong) UIButton *selectButton; +///名字 +@property (nonatomic, strong) UILabel *nameLabel; +///大鹅号 +@property (nonatomic, strong) UILabel *idLabel; + +@end + +@implementation XPAcrossRoomPKTableViewCell + +- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { + self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; + if (self) { + self.selectionStyle = UITableViewCellSelectionStyleNone; + [self initSubViews]; + [self initSubViewConstraints]; + + } + return self; +} +#pragma mark - Private Method + +- (void)initSubViews { + self.backgroundColor = [ThemeColor appCellBackgroundColor]; + [self.contentView addSubview:self.avatarImageView]; + [self.contentView addSubview:self.nameLabel]; + [self.contentView addSubview:self.idLabel]; + [self.contentView addSubview:self.selectButton]; +} + +- (void)initSubViewConstraints { + [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(13); + make.width.height.mas_equalTo(60); + make.centerY.mas_equalTo(self.contentView); + }]; + [self.nameLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.avatarImageView.mas_right).mas_offset(6); + make.bottom.mas_equalTo(self.avatarImageView.mas_centerY); + make.height.mas_equalTo(14); + make.right.mas_equalTo(self.selectButton.mas_left).mas_offset(-5); + }]; + [self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.nameLabel); + make.top.mas_equalTo(self.nameLabel.mas_bottom).mas_offset(7); + }]; + + [self.selectButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(-12); + make.centerY.mas_equalTo(self.avatarImageView); + make.width.height.mas_equalTo(30); + }]; +} + +#pragma mark - Event Response +- (void)selectButtonAction:(UIButton *)sender { + if (self.delegate && [self.delegate respondsToSelector:@selector(xPAcrossRoomPKTableViewCell:didChooseRoom:)]) { + [self.delegate xPAcrossRoomPKTableViewCell:self didChooseRoom:self.roomPKInfo]; + } +} +#pragma mark - Getters And Setters +- (void)setRoomPKInfo:(AcrossRoomPKInfoModel *)roomPKInfo { + _roomPKInfo = roomPKInfo; + self.avatarImageView.imageUrl = _roomPKInfo.avatar; + self.nameLabel.text = _roomPKInfo.title; + self.idLabel.text = [NSString stringWithFormat:@"大鹅号:%@", _roomPKInfo.erbanNo]; + self.selectButton.selected = _roomPKInfo.hadSelected; +} + +- (NetImageView *)avatarImageView { + if (!_avatarImageView) { + NetImageConfig * config = [[NetImageConfig alloc]init]; + config.imageType = ImageTypeUserIcon; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; + _avatarImageView = [[NetImageView alloc] initWithConfig:config]; + _avatarImageView.layer.masksToBounds = YES; + _avatarImageView.layer.cornerRadius = 38/2; + _avatarImageView.layer.borderColor = [ThemeColor appMainColor].CGColor; + } + return _avatarImageView; +} + +- (UIButton *)selectButton { + if (!_selectButton) { + _selectButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_selectButton setImage:[UIImage imageNamed:@"roomg_across_pk_choose_normal"] forState:UIControlStateNormal]; + [_selectButton setImage:[UIImage imageNamed:@"roomg_across_pk_choose_select"] forState:UIControlStateSelected]; + [_selectButton addTarget:self action:@selector(selectButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + _selectButton.userInteractionEnabled = YES; + } + return _selectButton; +} + +- (UILabel *)nameLabel { + if (!_nameLabel) { + _nameLabel = [[UILabel alloc] init]; + _nameLabel.textColor = [ThemeColor mainTextColor]; + _nameLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; + } + return _nameLabel; +} + +- (UILabel *)idLabel { + if (!_idLabel) { + _idLabel = [[UILabel alloc] init]; + _idLabel.textColor = [ThemeColor mainTextColor]; + _idLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; + } + return _idLabel; +} +@end diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKRuleView.h b/xplan-ios/Main/Room/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKRuleView.h new file mode 100644 index 00000000..ee03ff49 --- /dev/null +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKRuleView.h @@ -0,0 +1,16 @@ +// +// XPAcrossRoomPKRuleView.h +// xplan-ios +// +// Created by 冯硕 on 2022/1/10. +// + +#import + +NS_ASSUME_NONNULL_BEGIN + +@interface XPAcrossRoomPKRuleView : UIView + +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKRuleView.m b/xplan-ios/Main/Room/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKRuleView.m new file mode 100644 index 00000000..1e356a1f --- /dev/null +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/View/SubViews/XPAcrossRoomPKRuleView.m @@ -0,0 +1,99 @@ +// +// XPAcrossRoomPKRuleView.m +// xplan-ios +// +// Created by 冯硕 on 2022/1/10. +// + +#import "XPAcrossRoomPKRuleView.h" +///Third +#import +///Tool +#import "ThemeColor.h" +#import "TTPopup.h" + +@interface XPAcrossRoomPKRuleView () +///标题 +@property (nonatomic, strong) UILabel *titleLabel; +///显示内容 +@property (nonatomic, strong) UITextView *ruleTextView; +///背景 +@property (nonatomic, strong) UIImageView *backgroundImageView; + +@end + +@implementation XPAcrossRoomPKRuleView + +- (instancetype)initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame]) { + [self initSubViews]; + [self initSubViewConstraints]; + } + return self; +} + +#pragma mark - Private Method +- (void)initSubViews { + [self addSubview:self.backgroundImageView]; + [self addSubview:self.titleLabel]; + [self addSubview:self.ruleTextView]; +} + +- (void)initSubViewConstraints { + [self mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(300, 300)); + }]; + + [self.backgroundImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.edges.mas_equalTo(0); + }]; + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(7); + make.centerX.mas_equalTo(self); + make.height.mas_equalTo(18); + }]; + [self.ruleTextView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.titleLabel.mas_bottom).mas_offset(23); + make.left.mas_equalTo(17); + make.right.mas_equalTo(-18); + make.bottom.mas_equalTo(-17); + }]; +} + +#pragma mark - Event Response +- (void)closeBtnClick:(UIButton *)button { + [TTPopup dismiss]; +} + +#pragma mark - Getters And Setters +- (UIImageView *)backgroundImageView { + if (!_backgroundImageView) { + _backgroundImageView = [[UIImageView alloc] init]; + _backgroundImageView.image = [UIImage imageNamed:@"room_across_pk_rule_bg"]; + } + return _backgroundImageView; +} + +- (UILabel *)titleLabel { + if (!_titleLabel) { + _titleLabel = [[UILabel alloc] init]; + _titleLabel.text = @"如何开启跨房PK"; + _titleLabel.textColor = [UIColor whiteColor]; + _titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightBold]; + } + return _titleLabel; +} + +- (UITextView *)ruleTextView { + if (!_ruleTextView) { + _ruleTextView = [[UITextView alloc] init]; + _ruleTextView.textColor = UIColorFromRGB(0xffffff); + _ruleTextView.backgroundColor = [UIColor clearColor]; + _ruleTextView.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; + _ruleTextView.scrollEnabled = NO; + _ruleTextView.editable = NO; + _ruleTextView.text = @"1)只有牌照房房主和超管才可以发起跨房pk,一次只能选择一个牌照房发起;\n2)只有房主和超管才可以接受或拒绝跨房pk请求,若10秒内不点击pk邀请弹窗,弹窗消失,视为自动拒绝;\n3)发起pk时需选择pk时间和pk对象,自定义时间下限为5,上限为180,只能填写整数;\n4)pk发起后,未到pk时间无法自行结束,若有特殊情况需提前结束可联系客服,但本场pk不算胜负。\n"; + } + return _ruleTextView; +} +@end diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/View/XPAcrossRoomPKSelectRoomView.h b/xplan-ios/Main/Room/View/AcrossRoomPK/View/XPAcrossRoomPKSelectRoomView.h new file mode 100644 index 00000000..294260a9 --- /dev/null +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/View/XPAcrossRoomPKSelectRoomView.h @@ -0,0 +1,24 @@ +// +// XPAcrossRoomPKSelectRoomView.h +// xplan-ios +// +// Created by 冯硕 on 2022/1/10. +// + +#import + +NS_ASSUME_NONNULL_BEGIN +@class XPAcrossRoomPKSelectRoomView, AcrossRoomPKInfoModel; +@protocol XPAcrossRoomPKSelectRoomViewDelegate + +- (void)XPAcrossRoomPKSelectRoomView:(XPAcrossRoomPKSelectRoomView *)view didChoosePKRoom:(AcrossRoomPKInfoModel *)pkRoomInfo; + +@end +@interface XPAcrossRoomPKSelectRoomView : UIView +///代理 +@property (nonatomic,weak) id delegate; +///房间的uid +@property (nonatomic,copy) NSString *roomUid; +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/View/XPAcrossRoomPKSelectRoomView.m b/xplan-ios/Main/Room/View/AcrossRoomPK/View/XPAcrossRoomPKSelectRoomView.m new file mode 100644 index 00000000..5fce9b18 --- /dev/null +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/View/XPAcrossRoomPKSelectRoomView.m @@ -0,0 +1,369 @@ +// +// XPAcrossRoomPKSelectRoomView.m +// xplan-ios +// +// Created by 冯硕 on 2022/1/10. +// + +#import "XPAcrossRoomPKSelectRoomView.h" +///Third +#import +#import +///Tool +#import "ThemeColor.h" +#import "XCHudTool.h" +#import "UIImage+Utils.h" +#import "Api+AcrossRoomPK.h" +#import "XPMacro.h" +///Model +#import "AcrossRoomPKInfoModel.h" +///View +#import "XPAcrossRoomPKEmptyTableViewCell.h" +#import "XPAcrossRoomPKTableViewCell.h" + +@interface XPAcrossRoomPKSelectRoomView () + +///返回按钮 +@property (nonatomic, strong) UIButton *backButton; +@property (nonatomic, strong) UITableView *tableView; +///确认选择 +@property (nonatomic, strong) UIButton *doneButton; +///输入框背景 +@property (nonatomic,strong) UIView * inputBackView; +///搜索logo +@property (nonatomic,strong) UIButton *searchButton; +///输入框 +@property (nonatomic,strong) UITextField *searchTextField; +///数据源 +@property (nonatomic, strong) NSMutableArray *datasource; +///当前的页数 +@property (nonatomic, assign) NSInteger page; +///是否有更多的数据 +@property (nonatomic,assign) BOOL hasNoMoreData; +///选中的PK房间 +@property (nonatomic, strong) AcrossRoomPKInfoModel *selectRoomInfo; + +@end + +@implementation XPAcrossRoomPKSelectRoomView + +- (instancetype)initWithFrame:(CGRect)frame { + if (self = [super initWithFrame:frame]) { + [self initSubViews]; + [self initSubViewConstraints]; + [self initHeaderAndFooterRrfresh]; + } + return self; +} + +#pragma mark - Private Method +- (void)initSubViews { + self.backgroundColor = [UIColor whiteColor]; + [self addSubview:self.backButton]; + [self addSubview:self.inputBackView]; + [self addSubview:self.tableView]; + [self addSubview:self.doneButton]; + + [self.inputBackView addSubview:self.searchButton]; + [self.inputBackView addSubview:self.searchTextField]; + + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onKeyBoardResign:)]; + [self addGestureRecognizer:tap]; + self.backgroundColor = [ThemeColor appBackgroundColor]; +} + +- (void)initSubViewConstraints { + [self.backButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(12); + make.width.mas_equalTo(22); + make.height.mas_equalTo(22); + make.top.mas_equalTo(27); + }]; + + + [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.inputBackView.mas_bottom).mas_offset(5); + make.left.right.mas_equalTo(0); + make.bottom.mas_equalTo(self.mas_bottom); + }]; + [self.doneButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.mas_equalTo(-38); + make.width.mas_equalTo(300); + make.height.mas_equalTo(40); + make.centerX.mas_equalTo(self); + }]; + + [self.inputBackView mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(30); + make.left.mas_equalTo(self.backButton.mas_right).offset(5); + make.right.mas_equalTo(self.mas_right).offset(-15); + make.centerY.mas_equalTo(self.backButton); + }]; + + [self.searchButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.size.mas_equalTo(CGSizeMake(18, 18)); + make.centerY.mas_equalTo(self.inputBackView); + make.right.mas_equalTo(self.inputBackView).offset(-12); + }]; + + [self.searchTextField mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.mas_equalTo(self.inputBackView).offset(25); + make.right.top.bottom.mas_equalTo(self.inputBackView); + }]; +} + +- (void)initHeaderAndFooterRrfresh { + MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingTarget:self refreshingAction:@selector(headerRefresh)]; + header.stateLabel.font = [UIFont systemFontOfSize:10.0]; + header.lastUpdatedTimeLabel.font = [UIFont systemFontOfSize:10.0]; + header.stateLabel.textColor = [ThemeColor secondTextColor]; + header.lastUpdatedTimeLabel.textColor = [ThemeColor secondTextColor]; + self.tableView.mj_header = header; + + MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingTarget:self refreshingAction:@selector(footerRefresh)]; + footer.stateLabel.textColor = [ThemeColor secondTextColor]; + footer.stateLabel.font = [UIFont systemFontOfSize:10.0]; + self.tableView.mj_footer = footer; +} + +#pragma mark - 刷新的fangfa +- (void)headerRefresh { + self.page = 1; + [Api getAcrossRoomPKRoomList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + if (code == 200) { + NSArray * array = [AcrossRoomPKInfoModel modelsWithArray:data.data]; + [self getAcrossRoomPKListSuccess:array state:0]; + } else { + [XCHUDTool showErrorWithMessage:msg]; + } + } roomUid:self.roomUid pageNum:[NSString stringWithFormat:@"%ld", self.page] pageSize:@"20"]; +} + +- (void)footerRefresh { + if (self.hasNoMoreData) { + [XCHUDTool showErrorWithMessage:@"没有更多房间了"]; + return; + } + self.page++; + [Api getAcrossRoomPKRoomList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + if (code == 200) { + NSArray * array = [AcrossRoomPKInfoModel modelsWithArray:data.data]; + [self getAcrossRoomPKListSuccess:array state:0]; + } else { + [XCHUDTool showErrorWithMessage:msg]; + } + } roomUid:self.roomUid pageNum:[NSString stringWithFormat:@"%ld", self.page] pageSize:@"20"]; +} + +- (void)getAcrossRoomPKListSuccess:(NSArray *)list state:(int)state { + if (state == 0) { + self.selectRoomInfo = nil; + self.doneButton.enabled = NO; + [self.datasource removeAllObjects]; + [self.tableView.mj_header endRefreshing]; + } else { + [self.tableView.mj_footer endRefreshing]; + } + if (list.count > 0) { + self.hasNoMoreData = NO; + [self.datasource addObjectsFromArray:list]; + } else { + self.hasNoMoreData = YES; + [self.tableView.mj_footer endRefreshingWithNoMoreData]; + } + [self.tableView reloadData]; +} + +- (void)onKeyBoardResign:(UITapGestureRecognizer *)ges { + [self.searchTextField resignFirstResponder]; +} +#pragma mark - tableviewDelegate +- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + return self.datasource.count > 0 ? self.datasource.count : 1; +} + +- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { + if (self.datasource.count > 0) { + XPAcrossRoomPKTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPAcrossRoomPKTableViewCell class])]; + if (cell == nil) { + cell = [[XPAcrossRoomPKTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPAcrossRoomPKTableViewCell class])]; + } + cell.delegate = self; + AcrossRoomPKInfoModel * pkRoomInfo = [self.datasource objectAtIndex:indexPath.row]; + if (pkRoomInfo.uid.integerValue == self.selectRoomInfo.uid.integerValue) { + pkRoomInfo.hadSelected = YES; + } else { + pkRoomInfo.hadSelected = NO; + } + cell.roomPKInfo = pkRoomInfo; + return cell; + } + + XPAcrossRoomPKEmptyTableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass([XPAcrossRoomPKEmptyTableViewCell class])]; + if (cell == nil) { + cell = [[XPAcrossRoomPKEmptyTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:NSStringFromClass([XPAcrossRoomPKEmptyTableViewCell class])]; + } + return cell; + +} + +- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { + if (self.datasource.count > 0) { + return 75; + } + return (370 + kSafeAreaBottomHeight); +} + +#pragma mark - XPAcrossRoomPKTableViewCellDelegate +- (void)xPAcrossRoomPKTableViewCell:(XPAcrossRoomPKTableViewCell *)view didChooseRoom:(AcrossRoomPKInfoModel *)roomInfo{ + if (self.selectRoomInfo && roomInfo.uid == self.selectRoomInfo.uid) {///有选中的且点击了选中的,取消掉选择 + [self.tableView reloadData]; + self.selectRoomInfo = nil; + self.doneButton.enabled = NO; + } else { + self.selectRoomInfo = roomInfo; + [self.tableView reloadData]; + self.doneButton.enabled = YES; + } +} + +#pragma mark - Event Response +- (void)searchButtonAction:(UIButton *)sender { + if (self.searchTextField.text.length > 0) { + [Api searchAcrossRoomPKRoomList:^(BaseModel * _Nullable data, NSInteger code, NSString * _Nullable msg) { + if (code == 200) { + NSArray * array = [AcrossRoomPKInfoModel modelsWithArray:data.data]; + [self getAcrossRoomPKListSuccess:array state:0]; + } else { + [XCHUDTool showErrorWithMessage:msg]; + } + } erbanNo:self.searchTextField.text roomUid:@"" pageNum:@"1" pageSize:@"50"]; + } else { + [XCHUDTool showErrorWithMessage:@"请输入要搜索的厅大鹅号"]; + } +} + +- (void)backButtonAction:(UIButton *)sender { + [self.searchTextField resignFirstResponder]; + CATransition *transition = [CATransition animation]; + transition.duration = 0.3f; + transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + transition.type = kCATransitionPush; + transition.subtype = kCATransitionFromLeft; + [self.layer addAnimation:transition forKey:nil]; + [self removeFromSuperview]; +} + +- (void)doneButtonAction:(UIButton *)sender { + [self.searchTextField resignFirstResponder]; + if (self.delegate && [self.delegate respondsToSelector:@selector(XPAcrossRoomPKSelectRoomView:didChoosePKRoom:)]) { + [self.delegate XPAcrossRoomPKSelectRoomView:self didChoosePKRoom:self.selectRoomInfo]; + } + CATransition *transition = [CATransition animation]; + transition.duration = 0.3f; + transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + transition.type = kCATransitionPush; + transition.subtype = kCATransitionFromLeft; + [self.layer addAnimation:transition forKey:nil]; + [self removeFromSuperview]; +} + +#pragma mark - Getters And Setters +- (void)setRoomUid:(NSString *)roomUid { + _roomUid = roomUid; + [self.datasource removeAllObjects]; + [self.tableView reloadData]; + if (_roomUid.length > 0) { + [self headerRefresh]; + } +} +- (UITableView *)tableView { + if (!_tableView) { + _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; + _tableView.delegate = self; + _tableView.dataSource = self; + _tableView.tableFooterView = [UIView new]; + _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; + _tableView.backgroundColor = [UIColor clearColor]; + if (@available(iOS 11.0, *)) { + _tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; + } + [_tableView registerClass:[XPAcrossRoomPKTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPAcrossRoomPKTableViewCell class])]; + [_tableView registerClass:[XPAcrossRoomPKEmptyTableViewCell class] forCellReuseIdentifier:NSStringFromClass([XPAcrossRoomPKEmptyTableViewCell class])]; + } + return _tableView; +} + + +- (UIView *)inputBackView { + if (!_inputBackView) { + _inputBackView = [[UIView alloc] init]; + _inputBackView.backgroundColor = [ThemeColor appCellBackgroundColor]; + _inputBackView.layer.masksToBounds = YES; + _inputBackView.layer.cornerRadius = 15; + } + return _inputBackView; +} + +- (UIButton *)searchButton { + if (!_searchButton) { + _searchButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_searchButton setImage:[UIImage imageNamed:@"home_search_input_search"] forState:UIControlStateNormal]; + [_searchButton setImage:[UIImage imageNamed:@"home_search_input_search"] forState:UIControlStateSelected]; + [_searchButton addTarget:self action:@selector(searchButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _searchButton; +} + +- (UITextField *)searchTextField { + if (!_searchTextField) { + _searchTextField = [[UITextField alloc] init]; + _searchTextField.layer.cornerRadius = 15; + _searchTextField.layer.masksToBounds = YES; + _searchTextField.tintColor = [ThemeColor secondTextColor]; + _searchTextField.textColor = [ThemeColor mainTextColor]; + _searchTextField.backgroundColor = [UIColor clearColor]; + _searchTextField.font = [UIFont systemFontOfSize:13]; + NSString *placeholder = [NSString stringWithFormat:@"请输入厅的大鹅号"]; + _searchTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:placeholder attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:13], NSForegroundColorAttributeName : [ThemeColor secondTextColor]}]; + _searchTextField.clearButtonMode = UITextFieldViewModeWhileEditing; + _searchTextField.returnKeyType = UIReturnKeySearch; + _searchTextField.enablesReturnKeyAutomatically = YES; + } + return _searchTextField; +} + +- (UIButton *)doneButton { + if (!_doneButton) { + _doneButton = [[UIButton alloc] init]; + [_doneButton setBackgroundImage:[UIImage imageWithColor:[ThemeColor disableButtonColor]] forState:UIControlStateDisabled]; + [_doneButton setTitleColor:[ThemeColor disableButtonTextColor] forState:UIControlStateDisabled]; + [_doneButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor],[ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal]; + [_doneButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal]; + [_doneButton setTitle:@"确认选择" forState:UIControlStateNormal]; + _doneButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium]; + [_doneButton addTarget:self action:@selector(doneButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + _doneButton.enabled = NO; + _doneButton.layer.masksToBounds = YES; + _doneButton.layer.cornerRadius = 20; + } + return _doneButton; +} + +- (UIButton *)backButton { + if (!_backButton) { + _backButton = [[UIButton alloc] init]; + [_backButton setImage:[UIImage imageNamed:@"common_nav_back"] forState:UIControlStateNormal]; + _backButton.imageView.contentMode = UIViewContentModeScaleAspectFit; + [_backButton addTarget:self action:@selector(backButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _backButton; +} + +- (NSMutableArray *)datasource { + if (!_datasource) { + _datasource = [NSMutableArray array]; + } + return _datasource; +} +@end diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/View/XPAcrossRoomPKViewController.h b/xplan-ios/Main/Room/View/AcrossRoomPK/View/XPAcrossRoomPKViewController.h new file mode 100644 index 00000000..2033df36 --- /dev/null +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/View/XPAcrossRoomPKViewController.h @@ -0,0 +1,16 @@ +// +// XPAcrossRoomPKViewController.h +// xplan-ios +// +// Created by 冯硕 on 2022/1/10. +// + +#import "MvpViewController.h" + +NS_ASSUME_NONNULL_BEGIN + +@interface XPAcrossRoomPKViewController : MvpViewController +- (instancetype)initWithRoomUid:(NSString *)roomUid; +@end + +NS_ASSUME_NONNULL_END diff --git a/xplan-ios/Main/Room/View/AcrossRoomPK/View/XPAcrossRoomPKViewController.m b/xplan-ios/Main/Room/View/AcrossRoomPK/View/XPAcrossRoomPKViewController.m new file mode 100644 index 00000000..8247ba26 --- /dev/null +++ b/xplan-ios/Main/Room/View/AcrossRoomPK/View/XPAcrossRoomPKViewController.m @@ -0,0 +1,654 @@ +// +// XPAcrossRoomPKViewController.m +// xplan-ios +// +// Created by 冯硕 on 2022/1/10. +// + +#import "XPAcrossRoomPKViewController.h" +///Third +#import +#import +///Tool +#import "ThemeColor.h" +#import "NetImageView.h" +#import "XPMacro.h" +#import "UIImage+Utils.h" +#import "TTPopup.h" +///Model +#import "AcrossRoomPKInfoModel.h" +///View +#import "XPAcrossRoomPKSelectRoomView.h" +#import "XPAcrossRoomPKRuleView.h" +///P +#import "XPAcrossRoomPKPresenter.h" +#import "XPAcrossRoomProtocol.h" + +#define kContentHeight (404 + kSafeAreaBottomHeight) + +@interface XPAcrossRoomPKViewController () +///顶部点击消失的view +@property (nonatomic, strong) UIView *topView; +///显示内容的view +@property (nonatomic, strong) UIView *contentView; +///标题 +@property (nonatomic, strong) UILabel *titleLabel; +///帮助 +@property (nonatomic, strong) UIButton *helpButton; +///PK对象的容器 +@property (nonatomic,strong) UIStackView *userStackView; +///选择PK对象title +@property (nonatomic, strong) UILabel *selectPKLabel; +///选择PK对象 +@property (nonatomic, strong) UIButton *selectPKButton; +///PK对象的容器 +@property (nonatomic,strong) UIStackView *timeStackView; +///选择PK时长title +@property (nonatomic, strong) UILabel *selectPKTimeLabel; +///选择PK时间的容器 +@property (nonatomic,strong) UIStackView *chooseTimeStackView; +@property (nonatomic, strong) UIButton *tenMinuteButton; +@property (nonatomic, strong) UIButton *twentyMinuteButton; +@property (nonatomic, strong) UIButton *thirtyMinuteButton; +///自定义PK时间 +@property (nonatomic, strong) UITextField *customTimeTextField; +///玩法的容器 +@property (nonatomic,strong) UIStackView *playStackView; +///PK玩法title +@property (nonatomic, strong) UILabel *pkPlayModeLabel; +///PK玩法 +@property (nonatomic, strong) UITextField *pkPlayModeTextField; +///发起挑战按钮 +@property (nonatomic, strong) UIButton *doneButton; +///选择房间的内容 +@property (nonatomic, strong) UIView *selectRoomContentView; +///选中的房间头像 +@property (nonatomic, strong) NetImageView *avatarImageView; +///房间标题 +@property (nonatomic, strong) UILabel *roomTitleLabel; +//平台ID +@property (nonatomic, strong) UILabel *idLabel; +///取消选择房间 +@property (nonatomic, strong) UIButton *cancelButon; +///选中的PK房间 +@property (nonatomic, strong) AcrossRoomPKInfoModel *selectRoomInfo; +///PK的时长 +@property (nonatomic, assign) NSInteger pkDuration; +///选择PK房间 +@property (nonatomic, strong) XPAcrossRoomPKSelectRoomView *selectView; +///房间信息 +@property (nonatomic,strong) NSString *roomUid; +@end + +@implementation XPAcrossRoomPKViewController + +- (instancetype)initWithRoomUid:(NSString *)roomUid { + if (self = [super init]) { + self.roomUid = roomUid; + self.modalPresentationStyle = UIModalPresentationOverFullScreen; + } + return self; +} + +- (XPAcrossRoomPKPresenter *)createPresenter { + return [[XPAcrossRoomPKPresenter alloc] init];; +} + +- (void)viewDidLoad { + [super viewDidLoad]; + [self initSubViews]; + [self initSubViewConstraints]; + self.pkDuration = 10; +} + +- (void)viewWillAppear:(BOOL)animated { + [super viewWillAppear:animated]; + [IQKeyboardManager sharedManager].enable = YES; +} + +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { + [self.view endEditing:YES]; +} + + +#pragma mark - Private Method +- (void)initSubViews { + self.view.backgroundColor = [UIColor clearColor]; + [self.view addSubview:self.topView]; + [self.view addSubview:self.contentView]; + + [self.contentView addSubview:self.titleLabel]; + [self.contentView addSubview:self.helpButton]; + [self.contentView addSubview:self.userStackView]; + [self.contentView addSubview:self.timeStackView]; + [self.contentView addSubview:self.playStackView]; + [self.contentView addSubview:self.customTimeTextField]; + [self.contentView addSubview:self.doneButton]; + + [self.userStackView addArrangedSubview:self.selectPKLabel]; + [self.userStackView addArrangedSubview:self.selectPKButton]; + [self.userStackView addArrangedSubview:self.selectRoomContentView]; + + [self.timeStackView addArrangedSubview:self.selectPKTimeLabel]; + [self.timeStackView addArrangedSubview:self.chooseTimeStackView]; + + [self.chooseTimeStackView addArrangedSubview:self.tenMinuteButton]; + [self.chooseTimeStackView addArrangedSubview:self.twentyMinuteButton]; + [self.chooseTimeStackView addArrangedSubview:self.thirtyMinuteButton]; + + [self.playStackView addArrangedSubview:self.pkPlayModeLabel]; + [self.playStackView addArrangedSubview:self.pkPlayModeTextField]; + + [self.selectRoomContentView addSubview:self.avatarImageView]; + [self.selectRoomContentView addSubview:self.roomTitleLabel]; + [self.selectRoomContentView addSubview:self.idLabel]; + [self.selectRoomContentView addSubview:self.cancelButon]; +} + +- (void)initSubViewConstraints { + + [self.topView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.top.mas_equalTo(self.view); + make.bottom.mas_equalTo(self.contentView.mas_top); + }]; + + [self.contentView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.bottom.mas_equalTo(self.view); + make.height.mas_equalTo(kContentHeight); + }]; + + [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerX.mas_equalTo(self.contentView); + make.top.mas_equalTo(18); + }]; + + [self.helpButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.right.mas_equalTo(-12); + make.width.height.mas_equalTo(22); + make.centerY.mas_equalTo(self.titleLabel); + }]; + + [self.userStackView mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(32); + make.left.mas_equalTo(self.contentView).offset(22); + make.top.mas_equalTo(self.titleLabel.mas_bottom).offset(20); + }]; + + [self.selectPKLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(90); + }]; + + [self.selectPKButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(22); + }]; + + [self.selectRoomContentView mas_updateConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(KScreenWidth - 85 - 12 * 2 - 16); + }]; + + [self.timeStackView mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(32); + make.left.right.mas_equalTo(self.contentView).inset(22); + make.top.mas_equalTo(self.userStackView.mas_bottom).offset(30); + }]; + + [self.selectPKTimeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(self.selectPKLabel); + }]; + + [self.customTimeTextField mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(32); + make.width.mas_equalTo(170); + make.top.mas_equalTo(self.timeStackView.mas_bottom).offset(16); + make.left.mas_equalTo(self.tenMinuteButton); + }]; + + [self.playStackView mas_makeConstraints:^(MASConstraintMaker *make) { + make.left.right.height.mas_equalTo(self.timeStackView); + make.top.mas_equalTo(self.customTimeTextField.mas_bottom).offset(30); + }]; + + [self.pkPlayModeLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.width.mas_equalTo(self.selectPKLabel); + }]; + + [self.doneButton mas_makeConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(40); + make.left.right.mas_equalTo(self.contentView).inset(40); + make.bottom.mas_equalTo(self.contentView.mas_bottom).offset(-34 - kSafeAreaBottomHeight); + }]; + + [self.avatarImageView mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.selectRoomContentView); + make.left.mas_equalTo(self.selectRoomContentView); + make.height.width.mas_equalTo(60); + }]; + [self.roomTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.bottom.mas_equalTo(self.avatarImageView.mas_centerY).offset(-3); + make.left.mas_equalTo(self.avatarImageView.mas_right).mas_offset(6); + make.right.mas_lessThanOrEqualTo(self.selectRoomContentView); + }]; + [self.idLabel mas_makeConstraints:^(MASConstraintMaker *make) { + make.top.mas_equalTo(self.avatarImageView.mas_centerY).mas_offset(3); + make.left.right.mas_equalTo(self.roomTitleLabel); + }]; + + [self.cancelButon mas_makeConstraints:^(MASConstraintMaker *make) { + make.centerY.mas_equalTo(self.avatarImageView); + make.right.mas_equalTo(self.selectRoomContentView).offset(-12); + make.height.width.mas_equalTo(22); + }]; +} + +- (void)updateDoneButtonState { + if (self.selectRoomInfo && self.pkDuration > 5 && self.pkDuration < 180) { + self.doneButton.enabled = YES; + } else { + self.doneButton.enabled = NO; + } +} +#pragma mark - XPAcrossRoomProtocol +- (void)beginAcrossRoomPKSuccess { + [self showSuccessToast:@"开启成功"]; + [self dismissViewControllerAnimated:YES completion:nil]; +} + +#pragma mark - TTRoomPKSelectViewControllerDelegate +///选择要PK的对象按钮点击 +- (void)XPAcrossRoomPKSelectRoomView:(XPAcrossRoomPKSelectRoomView *)view didChoosePKRoom:(AcrossRoomPKInfoModel *)pkRoomInfo{ + if (pkRoomInfo) { + [self.userStackView mas_updateConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(60); + }]; + self.selectRoomContentView.hidden = NO; + self.selectPKButton.hidden= YES; + self.avatarImageView.imageUrl = pkRoomInfo.avatar; + self.roomTitleLabel.text = pkRoomInfo.title; + self.idLabel.text = [NSString stringWithFormat:@"大鹅号:%@", pkRoomInfo.erbanNo]; + self.selectRoomInfo = pkRoomInfo; + [self updateDoneButtonState]; + } +} +#pragma mark - UITextFieldDelegate +- (BOOL)textFieldShouldReturn:(UITextField *)textField { + if (textField == self.customTimeTextField) { + NSString *countStr = [self.customTimeTextField.text stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; + NSInteger count = [countStr integerValue]; + if (count > 180) { + [self showErrorToast:@"PK时长最长为180分钟"]; + return NO; + } else if(count < 5) { + [self showErrorToast:@"PK时长最短为5分钟"]; + return NO; + } + [self.customTimeTextField resignFirstResponder]; + self.pkDuration = textField.text.integerValue; + [self updateDoneButtonState]; + } else if(textField == self.pkPlayModeTextField) { + if (self.pkPlayModeTextField.text.length > 10) { + return NO; + } + } + return YES; +} + +- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string { + if (textField == self.customTimeTextField) { + NSString *regex =@"[0-9]*"; + NSPredicate *pred = [NSPredicate predicateWithFormat:@"SELF MATCHES %@",regex]; + if ([pred evaluateWithObject:string]) { + return YES; + } + return NO; + } + return YES; +} + +#pragma mark - Event Response +- (void)helpButtonAction:(UIButton *)sender { + [self.customTimeTextField resignFirstResponder]; + [self.pkPlayModeTextField resignFirstResponder]; + XPAcrossRoomPKRuleView *view = [[XPAcrossRoomPKRuleView alloc] init]; + [TTPopup popupView:view style:TTPopupStyleAlert]; +} + +- (void)selectPKButtonAction:(UIButton *)sender { + [self.customTimeTextField resignFirstResponder]; + [self.pkPlayModeTextField resignFirstResponder]; + self.selectView.roomUid = self.roomUid; + CATransition *transition = [CATransition animation]; + transition.duration = 0.3f; + transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + transition.type = kCATransitionPush; + transition.subtype = kCATransitionFromRight; + [self.selectView.layer addAnimation:transition forKey:nil]; + [self.contentView addSubview:self.selectView]; +} + +- (void)chooseTimeButtonAction:(UIButton *)sender { + [self.customTimeTextField resignFirstResponder]; + [self.pkPlayModeTextField resignFirstResponder]; + self.tenMinuteButton.selected = YES; + self.twentyMinuteButton.selected = YES; + self.thirtyMinuteButton.selected = YES; + sender.selected = NO; + self.pkDuration = sender.tag; + self.customTimeTextField.text = nil; +} + +- (void)doneButtonAction:(UIButton *)sender { + [self.customTimeTextField resignFirstResponder]; + [self.pkPlayModeTextField resignFirstResponder]; + NSString * pkDes = self.pkPlayModeTextField.text.length > 0 ? self.pkPlayModeTextField.text : @""; + [self.presenter beginAcrossRoomPK:self.roomUid duration:self.pkDuration acceptUid:self.selectRoomInfo.uid playDesc:pkDes]; +} + +- (void)cancelButtonAction:(UIButton *)sender { + self.selectRoomContentView.hidden = YES; + self.selectPKButton.hidden = NO; + self.selectRoomInfo = nil; + [self updateDoneButtonState]; + self.avatarImageView.image = nil; + self.roomTitleLabel.text = nil; + self.idLabel.text = nil; + [self.userStackView mas_updateConstraints:^(MASConstraintMaker *make) { + make.height.mas_equalTo(32); + }]; +} + +- (void)onKeyBoardResign:(UITapGestureRecognizer *)ges { + [self.customTimeTextField resignFirstResponder]; + [self.pkPlayModeTextField resignFirstResponder]; + if (self.selectView.superview) { + CATransition *transition = [CATransition animation]; + transition.duration = 0.3f; + transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; + transition.type = kCATransitionPush; + transition.subtype = kCATransitionFromLeft; + [self.selectView.layer addAnimation:transition forKey:nil]; + [self.selectView removeFromSuperview]; + } else { + [self dismissViewControllerAnimated:YES completion:nil]; + } +} + +#pragma mark - Getters And Setters +- (UILabel *)titleLabel { + if (!_titleLabel) { + _titleLabel = [[UILabel alloc] init]; + _titleLabel.textColor = [ThemeColor mainTextColor]; + _titleLabel.font = [UIFont boldSystemFontOfSize:18]; + _titleLabel.text = @"跨房PK"; + } + return _titleLabel; +} +- (UIButton *)helpButton { + if (!_helpButton) { + _helpButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_helpButton setImage:[UIImage imageNamed:@"room_across_pk_help"] forState:UIControlStateNormal]; + [_helpButton addTarget:self action:@selector(helpButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _helpButton; +} + +- (UIStackView *)userStackView { + if (!_userStackView) { + _userStackView = [[UIStackView alloc] init]; + _userStackView.axis = UILayoutConstraintAxisHorizontal; + _userStackView.distribution = UIStackViewDistributionFill; + _userStackView.alignment = UIStackViewAlignmentFill; + _userStackView.spacing = 16; + } + return _userStackView; +} +- (UILabel *)selectPKLabel { + if (!_selectPKLabel) { + _selectPKLabel = [[UILabel alloc] init]; + _selectPKLabel.textColor = [ThemeColor mainTextColor]; + _selectPKLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]; + _selectPKLabel.text = @"选择PK对象"; + } + return _selectPKLabel; +} +- (UIButton *)selectPKButton { + if (!_selectPKButton) { + _selectPKButton = [UIButton buttonWithType:UIButtonTypeCustom]; + [_selectPKButton setImage:[UIImage imageNamed:@"room_across_pk_add_room"] forState:UIControlStateNormal]; + [_selectPKButton addTarget:self action:@selector(selectPKButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _selectPKButton; +} + +- (UIStackView *)timeStackView { + if (!_timeStackView) { + _timeStackView = [[UIStackView alloc] init]; + _timeStackView.axis = UILayoutConstraintAxisHorizontal; + _timeStackView.distribution = UIStackViewDistributionFill; + _timeStackView.alignment = UIStackViewAlignmentFill; + _timeStackView.spacing = 16; + } + return _timeStackView; +} +- (UILabel *)selectPKTimeLabel { + if (!_selectPKTimeLabel) { + _selectPKTimeLabel = [[UILabel alloc] init]; + _selectPKTimeLabel.textColor = [ThemeColor mainTextColor]; + _selectPKTimeLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]; + _selectPKTimeLabel.text = @"选择PK时长"; + } + return _selectPKTimeLabel; +} + +- (UIStackView *)chooseTimeStackView { + if (!_chooseTimeStackView) { + _chooseTimeStackView = [[UIStackView alloc] init]; + _chooseTimeStackView.axis = UILayoutConstraintAxisHorizontal; + _chooseTimeStackView.distribution = UIStackViewDistributionFillEqually; + _chooseTimeStackView.alignment = UIStackViewAlignmentFill; + _chooseTimeStackView.spacing = 5; + } + return _chooseTimeStackView; +} + +- (UIButton *)tenMinuteButton { + if (!_tenMinuteButton) { + _tenMinuteButton = [[UIButton alloc] init]; + [_tenMinuteButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal]; + [_tenMinuteButton setBackgroundImage:[UIImage imageWithColor:[ThemeColor disableButtonColor]] forState:UIControlStateSelected]; + [_tenMinuteButton setTitle:@"10分钟" forState:UIControlStateNormal]; + _tenMinuteButton.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium]; + [_tenMinuteButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal]; + [_tenMinuteButton setTitleColor:[ThemeColor disableButtonTextColor] forState:UIControlStateSelected]; + _tenMinuteButton.tag = 10; + [_tenMinuteButton addTarget:self action:@selector(chooseTimeButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + _tenMinuteButton.selected = NO; + _tenMinuteButton.layer.masksToBounds = YES; + _tenMinuteButton.layer.cornerRadius = 32 / 2; + } + return _tenMinuteButton; +} + +- (UIButton *)twentyMinuteButton { + if (!_twentyMinuteButton) { + _twentyMinuteButton = [[UIButton alloc] init]; + [_twentyMinuteButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal]; + [_twentyMinuteButton setBackgroundImage:[UIImage imageWithColor:[ThemeColor disableButtonColor]] forState:UIControlStateSelected]; + [_twentyMinuteButton setTitle:@"20分钟" forState:UIControlStateNormal]; + _twentyMinuteButton.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium]; + [_twentyMinuteButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal]; + [_twentyMinuteButton setTitleColor:[ThemeColor disableButtonTextColor] forState:UIControlStateSelected]; + _twentyMinuteButton.tag = 20; + [_twentyMinuteButton addTarget:self action:@selector(chooseTimeButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + _twentyMinuteButton.selected = YES; + _twentyMinuteButton.layer.masksToBounds = YES; + _twentyMinuteButton.layer.cornerRadius = 32 / 2; + } + return _twentyMinuteButton; +} + +- (UIButton *)thirtyMinuteButton { + if (!_thirtyMinuteButton) { + _thirtyMinuteButton = [[UIButton alloc] init]; + [_thirtyMinuteButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal]; + [_thirtyMinuteButton setBackgroundImage:[UIImage imageWithColor:[ThemeColor disableButtonColor]] forState:UIControlStateSelected]; + [_thirtyMinuteButton setTitle:@"30分钟" forState:UIControlStateNormal]; + _thirtyMinuteButton.titleLabel.font = [UIFont systemFontOfSize:15 weight:UIFontWeightMedium]; + [_thirtyMinuteButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal]; + [_thirtyMinuteButton setTitleColor:[ThemeColor disableButtonTextColor] forState:UIControlStateSelected]; + _thirtyMinuteButton.tag = 30; + _thirtyMinuteButton.layer.masksToBounds = YES; + _thirtyMinuteButton.layer.cornerRadius = 32 / 2; + [_thirtyMinuteButton addTarget:self action:@selector(chooseTimeButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + _thirtyMinuteButton.selected = YES; + } + return _thirtyMinuteButton; +} +- (UITextField *)customTimeTextField { + if (!_customTimeTextField) { + _customTimeTextField = [[UITextField alloc] init]; + _customTimeTextField.layer.cornerRadius = 15; + _customTimeTextField.layer.masksToBounds = YES; + _customTimeTextField.backgroundColor = [ThemeColor appCellBackgroundColor]; + _customTimeTextField.textColor = [ThemeColor mainTextColor]; + _customTimeTextField.leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 19, 0)]; + _customTimeTextField.leftViewMode = UITextFieldViewModeAlways; + _customTimeTextField.delegate = self; + _customTimeTextField.keyboardType = UIKeyboardTypeNumberPad; + _customTimeTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"自定义(5-180)分钟" attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:15], NSForegroundColorAttributeName: [ThemeColor secondTextColor]}]; + + } + return _customTimeTextField; +} +- (UIStackView *)playStackView { + if (!_playStackView) { + _playStackView = [[UIStackView alloc] init]; + _playStackView.axis = UILayoutConstraintAxisHorizontal; + _playStackView.distribution = UIStackViewDistributionFill; + _playStackView.alignment = UIStackViewAlignmentFill; + _playStackView.spacing = 16; + } + return _playStackView; +} + +- (UILabel *)pkPlayModeLabel { + if (!_pkPlayModeLabel) { + _pkPlayModeLabel = [[UILabel alloc] init]; + _pkPlayModeLabel.textColor = [ThemeColor mainTextColor]; + _pkPlayModeLabel.textAlignment = NSTextAlignmentRight; + _pkPlayModeLabel.font = [UIFont systemFontOfSize:16 weight:UIFontWeightMedium]; + _pkPlayModeLabel.text = @"PK玩法"; + } + return _pkPlayModeLabel; +} + +- (UITextField *)pkPlayModeTextField { + if (!_pkPlayModeTextField) { + _pkPlayModeTextField = [[UITextField alloc] init]; + _pkPlayModeTextField.layer.cornerRadius = 15; + _pkPlayModeTextField.layer.masksToBounds = YES; + _pkPlayModeTextField.backgroundColor = [ThemeColor appCellBackgroundColor]; + _pkPlayModeTextField.textColor = [ThemeColor mainTextColor]; + _pkPlayModeTextField.leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 19, 0)]; + _pkPlayModeTextField.leftViewMode = UITextFieldViewModeAlways; + _pkPlayModeTextField.delegate = self; + _pkPlayModeTextField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"选填,10个字以内" attributes:@{NSFontAttributeName : [UIFont systemFontOfSize:15], NSForegroundColorAttributeName: [ThemeColor secondTextColor]}]; + } + return _pkPlayModeTextField; +} + +- (UIButton *)doneButton { + if (!_doneButton) { + _doneButton = [[UIButton alloc] init]; + [_doneButton setBackgroundImage:[UIImage gradientColorImageFromColors:@[[ThemeColor confirmButtonGradientStartColor], [ThemeColor confirmButtonGradientEndColor]] gradientType:GradientTypeLeftToRight imgSize:CGSizeMake(10, 10)] forState:UIControlStateNormal]; + [_doneButton setBackgroundImage:[UIImage imageWithColor:[ThemeColor disableButtonColor]] forState:UIControlStateDisabled]; + [_doneButton setTitle:@"发起挑战" forState:UIControlStateNormal]; + _doneButton.layer.masksToBounds = YES; + _doneButton.layer.cornerRadius = 20; + _doneButton.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium]; + [_doneButton setTitleColor:[ThemeColor confirmButtonTextColor] forState:UIControlStateNormal]; + [_doneButton setTitleColor:[ThemeColor disableButtonTextColor] forState:UIControlStateDisabled]; + [_doneButton addTarget:self action:@selector(doneButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + _doneButton.enabled = NO; + } + return _doneButton; +} + +- (UIView *)selectRoomContentView { + if (!_selectRoomContentView) { + _selectRoomContentView = [[UIView alloc] init]; + _selectRoomContentView.hidden = YES; + } + return _selectRoomContentView; +} + +- (NetImageView *)avatarImageView { + if (!_avatarImageView) { + NetImageConfig * config = [[NetImageConfig alloc]init]; + config.imageType = ImageTypeUserIcon; + config.placeHolder = [UIImageConstant defaultAvatarPlaceholder]; + _avatarImageView = [[NetImageView alloc] initWithConfig:config]; + _avatarImageView.layer.masksToBounds = YES; + _avatarImageView.layer.cornerRadius = 60 / 2; + _avatarImageView.layer.borderColor = [ThemeColor appMainColor].CGColor; + } + return _avatarImageView; +} + +- (UILabel *)roomTitleLabel { + if (!_roomTitleLabel) { + _roomTitleLabel = [[UILabel alloc] init]; + _roomTitleLabel.textColor = [ThemeColor mainTextColor]; + _roomTitleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; + } + return _roomTitleLabel; +} + +- (UILabel *)idLabel { + if (!_idLabel) { + _idLabel = [[UILabel alloc] init]; + _idLabel.textColor = [ThemeColor mainTextColor]; + _idLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightMedium]; + } + return _idLabel; +} + +- (UIButton *)cancelButon { + if (!_cancelButon) { + _cancelButon = [UIButton buttonWithType:UIButtonTypeCustom]; + [_cancelButon setImage:[UIImage imageNamed:@"room_across_delete_pk_room"] forState:UIControlStateNormal]; + [_cancelButon addTarget:self action:@selector(cancelButtonAction:) forControlEvents:UIControlEventTouchUpInside]; + } + return _cancelButon; +} + +- (UIView *)contentView { + if (!_contentView) { + _contentView = [[UIView alloc] init]; + _contentView.backgroundColor = [ThemeColor appBackgroundColor]; + CAShapeLayer * layer = [CAShapeLayer layer]; + layer.path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth,kContentHeight) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(12, 12)].CGPath; + _contentView.layer.mask = layer; + } + return _contentView; +} + +- (UIView *)topView { + if (!_topView) { + _topView = [[UIView alloc] init]; + _topView.backgroundColor = UIColor.blackColor; + _topView.alpha = 0.3; + UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onKeyBoardResign:)]; + [_topView addGestureRecognizer:tap]; + } + return _topView; +} + +- (XPAcrossRoomPKSelectRoomView *)selectView { + if (!_selectView) { + _selectView = [[XPAcrossRoomPKSelectRoomView alloc] initWithFrame:CGRectMake(0, 0, KScreenWidth, kContentHeight)]; + _selectView.delegate = self; + } + return _selectView; +} + +@end diff --git a/xplan-ios/Main/Room/View/MoreView/Model/XPRoomMoreItemModel.h b/xplan-ios/Main/Room/View/MoreView/Model/XPRoomMoreItemModel.h index ecfc40b9..b6fd894f 100644 --- a/xplan-ios/Main/Room/View/MoreView/Model/XPRoomMoreItemModel.h +++ b/xplan-ios/Main/Room/View/MoreView/Model/XPRoomMoreItemModel.h @@ -34,6 +34,10 @@ typedef NS_ENUM(NSInteger, RoomMoreMenuType) { RoomMoreMenuType_Release_Radio = 11, ///房间小喇叭 RoomMoreMenuType_Room_trumpet = 12, + ///开启跨房PK + RoomMoreMenuType_Room_Cross_PK_Open = 13, + ///关闭跨房pk + RoomMoreMenuType_Room_Cross_PK_Close = 14, }; @interface XPRoomMoreItemModel : NSObject diff --git a/xplan-ios/Main/Room/View/MoreView/Presenter/XPMoreMenuPresenter.m b/xplan-ios/Main/Room/View/MoreView/Presenter/XPMoreMenuPresenter.m index a9f8f781..1dbc08fc 100644 --- a/xplan-ios/Main/Room/View/MoreView/Presenter/XPMoreMenuPresenter.m +++ b/xplan-ios/Main/Room/View/MoreView/Presenter/XPMoreMenuPresenter.m @@ -40,6 +40,12 @@ dating.imageName = roomInfo.roomModeType == RoomModeType_Open_Blind ? @"room_more_menu_dating_close" : @"room_more_menu_dating_open"; dating.type = roomInfo.roomModeType == RoomModeType_Open_Blind ? RoomMoreMenuType_Room_Dating_Close : RoomMoreMenuType_Room_Dating_Open; dating.titleColor = roomInfo.isCloseScreen ? nil : [ThemeColor roomMoreMenuTextColor]; + + XPRoomMoreItemModel * acrossRoomPK = [[XPRoomMoreItemModel alloc] init]; + acrossRoomPK.title = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? @"跨房PK中" : @"跨房PK"; + acrossRoomPK.imageName = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? @"room_more_menu_cross_pk_close" : @"room_more_menu_cross_pk_open"; + acrossRoomPK.type = roomInfo.roomModeType == RoomModeType_Open_AcrossRoomPK_mode ? RoomMoreMenuType_Room_Cross_PK_Close : RoomMoreMenuType_Room_Cross_PK_Open; + acrossRoomPK.titleColor = roomInfo.isCloseScreen ? nil : [ThemeColor roomMoreMenuTextColor]; XPRoomMoreItemModel * messageScreen = [[XPRoomMoreItemModel alloc] init]; messageScreen.title = roomInfo.isCloseScreen ? @"开启公屏" : @"关闭公屏"; @@ -83,6 +89,10 @@ NIMChatroomMember * member = members.firstObject; BOOL isCreator = member.type == NIMChatroomMemberTypeCreator; BOOL isManager = member.type == NIMChatroomMemberTypeManager; + if (isCreator && roomInfo.isPermitRoom == PermitRoomType_Licnese) { + [array addObject:acrossRoomPK]; + } + if (isCreator || isManager) { if (roomInfo.canOpenBlindDate && roomInfo.type != RoomType_Anchor) { [array addObject:dating]; diff --git a/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m b/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m index 885c5524..085291e8 100644 --- a/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m +++ b/xplan-ios/Main/Room/View/MoreView/View/XPRoomMoreMenuViewController.m @@ -19,6 +19,7 @@ ///View #import "XPRoomMoreMenuCollectionViewCell.h" #import "XPRoomInviteFansView.h" +#import "XPAcrossRoomPKViewController.h" ///P #import "XPMoreMenuPresenter.h" #import "XPMoreMenuProtocol.h" @@ -97,12 +98,12 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; CGFloat contentHeight= 24 + 36; CGFloat itemHeight = 52; int page = list.count % 5; - int line = (int)list.count / 5; - if (page > 0) { - contentHeight += ((line + 1) *itemHeight + line * 10); - } else { - contentHeight += (line *itemHeight + (line -1) * 10); - } + int scale = page / 5; + if (scale > 0) { + contentHeight += ((page+1) *itemHeight + page * 10); + } else { + contentHeight += (page *itemHeight + (page -1) * 10); + } CAShapeLayer * layer = [CAShapeLayer layer]; UIBezierPath * path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, KScreenWidth, contentHeight) byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight cornerRadii:CGSizeMake(12, 12)]; layer.path = path.CGPath; @@ -264,6 +265,13 @@ UIKIT_EXTERN NSString * const kRoomGiftEffectUpdateNotificationKey; case RoomMoreMenuType_Room_trumpet: [self.presenter getRoomgetUserVipRoomTrumpet:roomUid]; break; + case RoomMoreMenuType_Room_Cross_PK_Open: + { + [self dismissViewControllerAnimated:NO completion:nil]; + XPAcrossRoomPKViewController * acrossRoomPKVC = [[XPAcrossRoomPKViewController alloc] initWithRoomUid:roomUid]; + [self.currentNav presentViewController:acrossRoomPKVC animated:YES completion:nil]; + } + break; default: break; }